text
stringlengths
2.85k
2.55M
label
class label
11 classes
arXiv:1703.02873v1 [cs.SE] 7 Mar 2017 Redundancy Suppression In Time-Aware Dynamic Binary Instrumentation Pansy Arafa Hany Kashif University of Waterloo University of Waterloo University of Waterloo [email protected] [email protected] [email protected] ABSTRACT Software tracing techniques are well-established and used by instrumentation tools to extract run-time information for program analysis and debugging. Dynamic binary instrumentation as one tool instruments program binaries to extract information. Unfortunately, instrumentation causes perturbation that is unacceptable for time-sensitive applications. Consequently we developed DIME*, a tool for dynamic binary instrumentation that considers timing constraints. DIME* uses Pin and a rate-based server approach to extract information only as long as user-specified constraints are maintained. Due to the large amount of redundancies in program traces, DIME* reduces the instrumentation overhead by one to three orders of magnitude compared to native Pin while extracting up to 99% of the information. We instrument VLC and PostgreSQL to demonstrate the usability of DIME*. 1. INTRODUCTION Program profiling is essential for analyzing program performance and understanding run-time behavior [36, 6, 30]. A program profiler extracts program information during execution; such as memory access patterns, code coverage, register usage, and dynamic call context trees. Other examples include collection of run-time statistics on instruction usage, or cache hits and misses. In order to extract this runtime information, the profiler instruments the program. Instrumentation naturally causes perturbation to the program under analysis. Such perturbation can result in erroneous performance-analysis data or inaccurate program profile. Instrumentation of performance-sensitive applications such as video players must not only preserve functional correctness, but also performance constraints. Thus, time-sensitive applications require specialized program-profiling tools in order to honor their timing constraints. Generally, there exist two instrumentation approaches; hardware based and software based. Hardware-based tracing methods [23, 29] cause significant perturbation to the traced program [26]. Also, these methods collect low-level data and, hence, require higher-level support to provide traces at a higherlevel of abstraction [24, 25]. Software-based instrumentation methods [22, 17] insert code in the original program, either statically or dynamically, to enable tracing, which results in modifying the program’s timing behavior. Consequently, recent line of research focuses on time-aware instrumentation techniques that respect the timing constraints of the program [12, 16, 15, 4]. Time-aware instrumentation extracts program informa- Sebastian Fischmeister tion while preserving both functional and timing properties. Fischmeister and Lam [12] propose a time-aware static instrumentation technique that preserves the worst-case execution time (WCET) of the instrumented program. Kashif et al. [16] apply program transformation techniques to increase the effectiveness of time-aware instrumentation. In [15], Kashif et al. introduce INSTEP; a static instrumentation framework for preserving extra-functional properties. All these approaches are impractical for large code bases with library dependencies as they require static analysis and worstcase execution time analysis. They also do not support multi-threaded applications. In [4], Arafa et al. propose DIME; a time-aware dynamic binary instrumentation framework using rate-based resource allocation. DIME limits the instrumentation time to a predefined budget per each time period. If the instrumentation consumes the budget before the time period ends, DIME will disable the instrumentation till the beginning of the next time period. While DIME reduces overhead, it only extracts partial (incomplete) traces due to disabling instrumentation on budget consumption. In this paper, we introduce DIME*, which offers the same advantages as the original version DIME, but provides higher instrumentation coverage. The idea is to attempt to trace only untraced information in successive runs of the program under analysis. Even with multiple runs, running a program multiple times on top of DIME* is less time-consuming than native Pin. We investigate different implementations and compare them qualitatively. We quantitatively evaluate the performance of DIME* compared to native Pin using the SPEC benchmarks [14]. Our results show that DIME* extracts up to 99% of the tracing information while reducing the overhead of native Pin by up to three orders of magnitude. For instance, dealII, a SPEC benchmark [14], originally runs for four minutes without any instrumentation. Extracting the branch profile of dealII using native Pin takes nine days of CPU time, while it only takes a maximum of 30 minutes using DIME*. We also apply our approach to VLC [3] and PostgreSQL [2] as case studies to demonstrate the scalability and applicability of DIME*. 2. BACKGROUND This section provides a basic overview of time-aware instrumentation, dynamic binary instrumentation, and the basics of DIME. 2.1 Time-aware Instrumentation Instrumentation is the process of inserting extra code inside a program to extract information during execution. In- strumentation can be static or dynamic. Static instrumentation means inserting the instrumentation code before running the program, whereas dynamic techniques inserts the instrumentation code during the program execution. Timeaware instrumentation [12, 16, 15, 4] is a mechanism that preserves functional correctness and timing properties when instrumenting programs. The static technique in [12] instruments a program at code locations that do not modify the program’s WCET and at the same time preserves the program’s original behavior. Static time-aware instrumentation shifts the program’s execution time profile towards its deadline. The authors in [16] apply code transformation techniques to the program under analysis to increase instrumentation coverage. They duplicate or create basic blocks in the program to increase the locations at which instrumentation code can be inserted while preserving timing constraints. The authors in [15] introduce INSTEP; an instrumentation framework for preserving multiple competing extra-functional properties. INSTEP uses cost models and constraints of the extra-functional properties in addition to the user’s instrumentation intent to transform the input program into an instrumented program that respects the specified constraints. All the mentioned work on time-aware instrumentation is based on static source-code instrumentation techniques. Static source-code instrumentation requires performing WCET analysis of the input program to guide the placement of instrumentation code inside the input program. It also needs WCET analysis after instrumenting the program to validate that timing constraints are met. Static instrumentation techniques are sound and effective, but the need for running WCET analysis before and after instrumentation reduces the applicability to only hard real-time applications where WCET analysis is common. Additionally, static instrumentation requires the availability of the source code including all library dependencies. For example, the VLC media player [3] has approximately 600 000 lines of code and uses libraries with more than three million lines of code. Thus, it is impractical to statically analyze the source code of a multi-threaded application like VLC along with its library dependencies. In [4], Arafa et al. propose DIME; a time-aware dynamic binary instrumentation framework. 2.2 Dynamic Binary Instrumentation Dynamic binary instrumentation (DBI) instruments the program’s binary during execution. Unlike static instrumentation, DBI does not require preprocessing of the program under analysis. On the other hand, DBI incurs higher runtime overhead compared to static instrumentation since DBI decides the placement of instrumentation code at runtime. Pin [21] is a DBI instrumentation framework that provides a cross-platform API for building program-profiling tools. Pin has lower run-time overhead than that of the other DBI frameworks like DynamoRio [8], and Valgrind [28]. Pin is easily extensible and transparent i.e., it maintains the same instruction and data addresses, and the same register and memory values compared to the original program. Pin can trace statically unknown indirect-jump targets, dynamically generated code, and dynamically loaded libraries. It can also handle mixed code and data, and variable-length instructions. To build an analysis tool using Pin (pintool), two types of routines should be implemented. The analysis routine contains the code to be inserted in the program during execution, whereas the instrumentation routine decides on the locations of inserting the analysis-routine calls. The analysis routine is the main source of Pin’s overhead which varies according to the invocation frequency of the analysis routines and their complexity. On the other hand, the dynamic compilation and the execution of the instrumentation routine represent a minor source of run-time overhead. Pin is known for its efficiency [21, 4]; it uses a just-intime (JIT) compiler to insert and optimize instrumentation code. The unit of compilation is the trace; a straight-line sequence of instructions that have a single entry point and may have multiple exits. When the program starts execution, Pin compiles the first trace and generates a modified one which is almost identical to the original. The modified trace enables Pin to regain control when needed. Pin transfers control to the generated trace, then regains control when a branch exits the trace. Afterwards, Pin compiles the new trace and continues execution. Whenever the JIT compiler fetches some code to compile, the pintool is allowed to instrument the code before compilation. Pin saves the compiled code and its instrumentation in a cache in case it gets re-executed [35, 31, 21]. Pin supports different granularities for both the instrumentation routine and the analysis routine, e.g., trace, routine, and instruction granularities. The instrumentation-routine granularity defines when Pin should execute the instrumentation routine. Similarly, the granularity of the analysis routine tells Pin where to insert the analysis-routine calls. DIME [4] is implemented as an extension to Pin [21]. 2.3 DIME DIME [4] is a dynamic binary time-aware instrumentation tool that respects the timing properties of the program. DIME, as a tool for instrumenting soft real-time applications, is practical, scalable, and supports multi-threaded applications. It guarantees less run-time overhead compared to Pin especially for the profiling tools with heavy-weight analysis routines. DIME uses rate-based resource allocation to limit the instrumentation time to a pre-specified budget B per time period T . Instrumentation is enabled (i.e. allowed to execute) for a total of tins time units in every time period T . The total instrumentation time tins per period T should not exceed the instrumentation budget B. If the budget is fully consumed before the end of the time period T , DIME will disable instrumentation. At the beginning of the next period T , the budget resets to B time units and the instrumentation is re-enabled. This process repeats until the program terminates. Specifically, DIME limits the execution time of the analysis routine to the budget B [4]. The reason is that the analysis routine is the main source of run-time overhead, and the overhead of the instrumentation routine is negligible [21]. Figure 1 further illustrates the rate-based DBI approach. The X-axis represents the program’s execution time tprog and the Y-axis shows the remaining instrumentation budget (B −tins ). The program starts execution in the DBI-enabled state i.e., full instrumentation budget is available. In the first time period [0, T ) of the program’s execution, instrumentation code executes and reduces the available budget. Once the instrumentation has fully consumed the budget, the framework will switch to the DBI-disabled state and will prevent further instrumentation. At time T , the budget is reset, and the framework returns back to the DBI-enabled state [4]. Remaining Budget (B - tins) DBI Enabled Budget Reset, DBI Re-enabled For each inst rum enta tion point { InsertCall ( budget_check ) ; i f ( version == V_BASE ) { // c h e c k s w i t c h i n g t o V INSTRUMENT I n s e r t V e r s i o n C a s e ( 1 , V_INSTRUMENT ) ; } e l s e i f ( version == V_INSTRUMENT ) { // c h e c k s w i t c h i n g t o V BASE I n s e r t V e r s i o n C a s e ( 0 , V_BASE ) ; } switch ( version ) { case V_BASE : break ; //Do Nothing case V_INSTRUMENT : ... InsertCall ( a na l ys i s_ r ou t in e ) ; break ; } 2 B − 4 6 0 − 8 T 2T 3T Program Execution Time (tprog) DBI Disabled Figure 1: Rate-based DBI [4]. 10 12 14 16 } Listing 1: Instrumentation rtn of Trace Version [4]. In [4], the authors studied three implementations of DIME; Trace Version, Trace Version Conditional , and Trace Conditional . Trace Version checks for budget availability at each instrumentation point (through an extra analysis routine) and makes use of Pin’s trace versioning APIs to enable and disable instrumentation. The implementation of Trace Version will be discussed later in this section. Trace Version Conditional has a similar implementation to Trace Version but with a reduced frequency of budget checking in the DBIdisabled state. In Trace Conditional , the instrumentation routine checks the available budget using a simple if statement in the instrumentation routine. Although Trace Version has the highest budget-checking overhead (compared to the other implementations), it strictly respects the budget and has full budget utilization. Trace Version Conditional , compared to Trace Version, has lower budget-checking overhead but lower budget utilization. Trace Conditional has the lowest budget-checking overhead which leads to loose budget respect. Also, Trace Conditional has another source of high run-time overhead which is the overshoots. An overshoot occurs when the instrumentation time exceeds the instrumentation budget. DIME shows an average reduction in overhead by 12, 7, and 3 folds, for the three implementations consecutively, compared to native Pin. Moreover, Trace Version provides good instrumentation coverage when the instrumentation-budget value is reasonable (10% for example). Instrumentation coverage is the ratio of the output of DIME to that of native Pin. For the reasons mentioned, we focus on Trace Version in this paper although the suggested approaches work for the other two implementations. Trace Version uses Pin’s trace versioning APIs to check for budget at each instrumentation point, and enable/disable instrumentation accordingly. These APIs allow dynamic switching between multiple types (versions) of instrumentation at runtime. There is two instrumentation versions in DIME*; V INSTRUMENT refers to enabled instrumentation, and V BASE when instrumentation is disabled. When Pin switches versions, it creates a new trace starting from the current instruction. Listing 1 shows a pseudocode outline of Trace Version (favoring readability over optimality). To clarify, let Trace 1 be the sequence of instructions in Listing 2. Assume that Trace 1 has version = V INSTRUMENT, and “For each instrumentation point” means “For each instruction” in this example. Pin calls the instrumentation routine at every trace. The instrumentation routine inserts an inlined call to budget check() before every instruction in the trace. According to the switch case in Listing 1, the instrumentation routine inserts a call to the analysis routine before every instruction in the trace. The API InsertVersionCase() guarantees that the execution of the inserted analysis routine will occur, only if the output of budget check() matches the ID of the current version (which is 1 in this case). Directly after the execution of the instrumentation routine, budget check(), that is inserted before the first instruction, is executed. Assume that its output is 1 which means that the budget is currently larger than zero. In this case, Pin will execute the analysis routine that is inserted before the first instruction. Afterwards, Pin executes budget check() that is inserted before the second instruction. Assume that the budget is now fully consumed, so budget check() returns 0. Since the output mismatches the ID of the current trace, Pin will switch version to V BASE (i.e. disable instrumentation). Accordingly, Pin will create a new trace Trace 2, with version = V BASE, starting from the second instruction. Pin will then execute the instrumentation routine to instrument Trace 2 according to its version. Also, the analysis routine inserted before the second and the third instruction will be ignored i.e., not executed. mov eax , dword ptr [ rsp+0x30 ] and eax , 0 x10000000 mov dword ptr [ rsp+0x3c ] , eax Listing 2: Example (1) of a trace. 3. REDUNDANCY SUPPRESSION IN DIME* Both native Pin and DIME generate tracing information that might contain redundancies. Naik et al. in [27] pointed out that, in many applications, output traces contain many redundancies. For example, in many analysis tools, instrumenting each instruction once is sufficient since the information extracted is the same regardless of the number of times the instruction is executed or instrumented. In other words, an instruction can be executed and, hence, instrumented several times. Each time, the same information is extracted causing redundancies. Examples of these tools include branch profiling tools used for extracting code coverage and memory profiling tools used for building memory access patterns. Since DIME extracts partial tracing information, it can obtain higher instrumentation coverage through the avoidance of tracing redundant information. To respect the timing properties of a program, DIME disables the instrumentation when the instrumentation budget is consumed. Accordingly, DIME generates partial tracing information compared to native Pin. In other words, there exists a trade-off between the instrumentation budget and the instrumentation coverage. Hence, multiple runs of DIME are required to increase the instrumentation coverage and optimally achieve full coverage. From a performance point of view, it is preferable to minimize the number of required runs. For DIME, this implies obtaining the maximum possible coverage from each single run without violating the timing constraints. Accordingly, DIME should avoid tracing redundant instrumentation. In this paper, we specifically focus on the type of analysis tools that do not require tracing redundant information. DIME* should utilize the available instrumentation budget for extracting unique (non-redundant) information. To prohibit redundant instrumentation, DIME* should be able to identify the instrumented code regions. The minimum piece of information needed to identify a code region is the starting address. Thus, the basic idea is to enable DIME* to save the starting addresses of instrumented code regions in a log, and DIME* should then check the log before instrumenting a new code region. For the approach to be efficient, DIME* should: • Prevent re-instrumentation of a code region in the current run and all subsequent runs of the program under analysis. • Avoid increasing run-time overhead. • Avoid creating large-sized logs which increase DIME*’s memory consumption. Searching a large log may also result in increased run-time overhead. Both steps, saving to the log and searching it, take place in the instrumentation routine, so its overhead is expected to be negligible. We avoided adding these steps to the analysis routine which is the main source of overhead in Pin. In what follows, we discuss our approach for suppressing redundancies in DIME*. 3.1 Granularity of Logged Code Regions The first design aspect that we discuss is the granularity of the code regions to be recorded in the log. We can log addresses of code regions either at the instruction level or the trace level. It is inefficient to log the address of each instrumented instruction, since 1. This requires frequent access to the log which adds to run-time overhead. 2. This results in a large log size which consumes memory. 3. This leads to searching a large log which can delay program execution and add to the run-time overhead. An alternative to logging instruction address is to log addresses at a coarser granularity, the trace level. The instrumentation routine analyzes traces to insert analysis-routine calls. Recall that a trace is a sequence of program instructions that has a single entry point and may have multiple exit points. If Pin detects a jump to an instruction in the middle of a trace, Pin will create a new trace beginning at the target instruction. So, the instructions inside a trace are always in series i.e., uninterrupted by instructions from another trace. Thus, DIME* will save the trace starting address in addition to the length of the instrumented portion in the trace (hTrace Address, Trace Lengthi). Specifically, DIME* will save the relative starting address of the trace with respect to the trace’s image. This guarantees that saved addresses are deterministic between successive runs (especially for the traces of shared libraries). On the other side, as mentioned earlier in Section 2.3, trace version switching can cause Pin to create a new trace. Thus, some trace addresses might only exist in a subset of the runs. 3.2 Efficient Log Search The second design aspect is saving the trace addresses and the trace lengths in a manner that allows for efficient searching of the log. In this section, we propose three approaches for saving trace addresses and length. We compare among them qualitatively and quantitatively deriving unexpected results. We choose one of these approaches to provide DIME* with the capability of suppressing redundant instrumentations. 3.2.1 Hash-Table Log The first approach uses a hash-table as the log for saving instrumented traces. In this approach, DIME* saves the trace address to identify instrumented traces. Whenever DIME* instruments a trace, it adds the trace’s address to the hash-table. Also, before instrumenting any trace, DIME* searches for the trace address in the hash-table. Let A be the current trace and B be a trace in the log L; Then, DIME* will only instrument A, iff (address(A) 6= address(B))∀B ∈ L. The advantages of using a hash-table for logging traces are: • Fast logging (average case: constant; worst case: linear in the hash-table size). • Fast searching (average case: constant; worst case: linear in the hash-table size). • Low number of false negatives (false negatives will occur if DIME* prohibits instrumentation of an uninstrumented trace). For instance, let A be the current trace, where address(A) = 100 and length(A)=80. If the log contains trace B, where address(B) = 100 and length(B)=20, DIME* will prohibit the instrumentation of A. Thus, the instructions in the address range 120 to 180 will not be instrumented in any run. The disadvantage of this approach is that: • Using a hash-table enables DIME* to only compare trace addresses while ignoring the trace length. This results in false positives. A false positive will occur if DIME* allows instrumentation of a previously instrumented trace. For example, let A be the current trace, where address(A) = 150 and length(A)=20. DIME* may fail to find A in the log, although the log contains trace B such that address(B) = 100 and length(B) = 80. This means that trace A is previously instrumented as a part of trace B. Note that one trace being part of another happens due to the creation of new traces through version switching as explained earlier. Section 3.2.4 presents experimental results that support the listed advantages and disadvantages for the three approaches. 3.2.2 BST Log The second approach is using a binary search tree (BST) to log the addresses of the instrumented traces along with their lengths. Being sorted, the BST facilitates jumping to a specific range of addresses. When DIME* instruments a trace, it adds the trace to the log such that the trace address is the key and the trace length is the value. Before instrumenting a trace, DIME* searches the BST using the trace address. If not found, DIME* will jump to the log-entry that has the first smaller trace address compared to the current trace address. DIME* will then decide if the current address lies within the trace of the discovered log-entry. Let A be the current trace and B be a trace in the log L. DIME* will not instrument A, if ∃B ∈ L s.t. (address(B) ≤ address(A) < address(B) + length(B)). The advantage of using a BST for logging traces is: • Less false positives compared to the hash-table approach due to considering the lengths of the logged traces. The disadvantages of this approach, on the other hand, are: • Slower than the hash-table approach in the average case; the complexity of both saving and searching is log(N ). • Relatively high false negatives. Consider the following example. Assume the current trace is A = h100, 200i (i.e., address(A)=100 and length(A)=200), and the log entry B = h50, 80i in the log L. This approach will prevent instrumenting trace A since its starting address lies within the log entry B. This, however, will consequently prevent DIME* from instrumenting the uninstrumented portion of trace A i.e., from address 130 to address 300. Additionally, after the program execution and before saving the log to a file for use in subsequent runs, DIME* merges directly consecutive traces leading to a smaller log size. For example, if the log contains two log entries h100, 50i and h150, 50i, DIME* will merge them into one log entry h100, 200i. Merging log entries decreases the log size and, therefore, reduces the search time leading to less run-time overhead in subsequent runs of DIME*. 3.2.3 Merger BST The third approach utilizes a BST as well, but it addresses the second disadvantage of the previous approach. Using this approach, DIME* will prohibit instrumentation, only if the whole current trace is part of a log entry. Otherwise, DIME* allows instrumentation and merges the current trace with the log entry if needed. Let A be the current trace and B be a trace in the log L. DIME* will not instrument A, if ∃B ∈ L s.t. (address(B) ≤ address(A) < address(B) + length(B)∧address(A)+length(A) < address(B)+length(B)). For example, let the current trace be A = h100, 200i, and the log entry contains B = h50, 80i. In this approach, DIME* instruments trace A. Afterwards, DIME* merges trace A and B into one log entry h50, 250i to avoid redundancies in the log. The advantages of this approach are: • Less false negatives, compared to the BST approach. The disadvantages are: • Slower than the hash-table approach in the average case; the complexity of both saving and searching is log(N ). • Higher false positives than the BST approach since it allows re-instrumentation of some portions of a trace. As mentioned before, Section 3.2.4 provides experi- mentation that discusses these observations. Note that a trace address and length will be saved in the log, only if the trace is actually instrumented i.e., the trace’s version is V INSTRUMENT. 3.2.4 Evaluation of the Different Approaches In this section, we describe our experiments to evaluate the three log-search approaches. According to the results, we choose which approach to extend DIME with the feature of suppressing redundant instrumentation output. We experiment with two SPEC2006 C benchmark [14] programs (lbm and mcf ) for three runs. We later, in Section 4, use more SPEC benchmarks to evaluate the performance of modified DIME* over up to eight runs. The experiment uses a branch-profiling analysis tool which has a heavy-weight analysis routine. It prints out the jump, call, and return instructions in addition to the source address and the destination address. The tool is based on the branch target addr pintool that is available as a part of the Pin’s kit v2.12-56759. The pintool is modified to extract the branch profile of the whole program instead of only a part of it. A branch profiler is useful for investigating the code coverage of a program. Each experiment, in this section and Section 4, is conducted once due to the very long execution time when instrumenting the benchmarks on top of native Pin. For example, povray benchmark originally executes in 2.5 minutes, but on top of native Pin, it consumes four days of CPU time. The execution time of the other benchmark programs, on top of Native Pin and DIME*, will be discussed in Section 4. However, the runs of each DIME* experiment can be considered as repetitions since all the runs operate identically. In the initialization stage, there exists one minor difference between the first run and the following ones. The first run starts with an empty log while the following runs read the log from a file before launching and instrumenting the program. The evaluation of the proposed approaches is based on the following metrics: 1. Instrumentation Coverage: the ratio of the instrumentation output of DIME* to that of native Pin. Note that we consider only unique (non-redundant) traces. Increasing the instrumentation coverage is the main objective of the proposed approaches. 2. False positives: a false positive will occur if DIME* permits the instrumentation of a previously instrumented trace or trace-portion. This metric measures the ratio of false positives to the total number of instrumented traces in the current run. The ratio of false positives indicates the efficiency of the log searching approach in identifying previously instrumented traces. As the ratio of false positives decreases, the budget utilization increases and the number of required runs to maintain high coverage decreases. 3. False negatives: a false negative will take place when DIME* refuses to instrument a trace which was not instrumented before. The metric measures the ratio of false negatives to the total number of traces that got rejected by DIME* in the current run. This value includes the trace portions as well i.e., a part of the trace is instrumented but the other part is not. As the false negatives increase, the ability of the approach to maintain high coverage decreases. 4. Slow-down factor of the instrumented program: the ratio of the execution time of the dynamically instrumented benchmark to the execution time of the natively running benchmark. This metric examines the ability of DIME* to reduce run-time overhead, compared to Pin, while saving to and searching the log to suppress instrumentation redundancy. It also checks if the three approaches introduce different run-time overhead. Low run-time overhead is essential for the instrumentation of time-sensitive systems as discussed before. 5. Overshoots: an overshoot will occur when actual instrumentation time exceeds the budget. The magnitude of the overshoots shows how strictly modified DIME* respects the instrumentation budget. test r12 , r12 setnz byte ptr [ rsp+0x3b ] jnz 0 x7ffff7de26a8 mov eax , dword ptr [ rsp+0x30 ] and eax , 0 x10000000 ... call 0 x7ffff7df2850 another log-entry. Hence, DIME* allows instrumentation of this trace. Assume that enough instrumentation budget is available to instrument all the instructions in the trace. Thus, the trace address along with its length are saved in the log as h34192, 62i. The instrumentation-routine inserts analysis-routine calls for all the instructions in the trace. Assume that in the first run of DIME*, the first three instructions only execute and a jump (through jnz) occurs. In the second run, DIME* (BST and BST-Merger) prohibits instrumentation for the trace 34206 (starting from the mov instruction) since it lies inside the logged trace h34192, 62i. Accordingly, no information is extracted starting from the address 34206 since these instructions do not execute in the first run and DIME* prevents their instrumentation in the following runs. Although, the program runs with the same inputs, this can occur due to non-deterministic execution of some shared libraries such as libc and the Linux loader. For such shared libraries, execution can slightly change according to the processor state. In such cases, the BST and the Merger BST approaches fail to extract some information, thus decreasing their instrumentation coverage. Listing 3: Example (2) of a trace. Run−1 Run−2 Run−3 Coverage Percentage (%) 100 80 False Positives (%) 40 60 40 Run−1 Run−2 Run−3 30 20 10 0 Htable lbm Merger lbm Htable mcf BST mcf Merger mcf Approach − Benchmark 20 0 BST lbm (a) False Positives Htable lbm BST lbm Merger lbm Htable mcf BST mcf Merger mcf 60 Approach − Benchmark Figure 2 shows the instrumentation coverage of the three approaches with lbm and mcf consecutively. The hash-table approach guarantees the highest instrumentation coverage. After three runs, it achieves 97% of the instrumentation coverage of native Pin for lbm benchmark, and 98% for mcf. The coverage of BST is 83% and 80% for lbm and mcf consecutively. Finally, BST-Merger generates 90% and 88% of the instrumentation output for lbm and mcf consecutively. The low ratio of false negatives of the hash-table approach is one reason for achieving the highest coverage. The hash-table approach is a conservative one which favors re-instrumenting some trace portions over uninstrumenting them. Also, some scenarios lead to a decreased instrumentation coverage for the BST and Merger BST approaches compared to the hashtable approach. As mentioned previously, a trace can have multiple exits e.g. can include multiple jump instructions. Listing 3 is an example of a trace with multiple exits (contains jnz and call instructions). Assume the starting address of the trace is 34192 and the trace length is 62. Assume DIME* encounters this trace for the first time, and cannot find the address 34192 in the log as a key or as a part of False Negitives (%) Figure 2: Instrumentation Coverage Run−1 Run−2 Run−3 50 40 30 20 10 0 Htable lbm BST lbm Merger lbm Htable mcf BST mcf Merger mcf Approach − Benchmark (b) False Negatives Figure 3: Ratio of false positives and ratio of false negatives The ratio of false positives is shown in Figure 3a. The hash-table approach has the highest ratio with both lbm and mcf benchmarks. The BST-Merger approach has moderate values of false positives, whereas BST has approximately zero false positives. This means that BST accurately identifies the previously instrumented traces and efficiently utilizes the budget to instrument other traces. On the other hand, BST has a high ratio of false negatives, as shown in Figure 3b, which is an undesirable feature. BST-Merger sustains approximately zero false negatives, and hash-table has negligible values of false negatives ratio. The scenarios discussed in Section 3.2 explain the values in Figures 3a and 3b. Note that false-negatives ratio is more critical than false positives. Although false positives cause instrumentation redundancies, it is safer. False negatives prevent code portions from being instrumented in any run which can dramatically decrease the instrumentation coverage. The results show that there is a trade-off between false positives and false negatives. In such case, we prefer the approach that maintains low ratio of false negatives even if it has high ratio of false positives. Thus, the hash-table and the BSTMerger approaches outperform the BST one. Slow Down Factor 68x Run−1 Run−2 Run−3 67x 2x the three DIME* modifications are suitable for dynamically instrumenting time-sensitive systems. Comparing the three approaches to each other, none of them shows a significant overhead-decrease over the others. Consequently, run-time overhead is not a factor that differentiates among the three approaches. Figure 5 shows the overshoots’ magnitude for the three proposed approaches of DIME* over the execution time of the mcf benchmark while instrumenting it using the DIME* version of the branch-profiling pintool. The three approaches respect the instrumentation budget; the values for the most frequent overshoots lie below 4 microseconds. There is not significant differences in the overshoots’ magnitudes among the three approaches of DIME*. Thus, this metric is also not a factor to favor one approach over the others. Non-intuitively, the evaluation metrics reveal that the simplest approach, which is the hash-table one, results in the best instrumentation coverage results. Moreover, the hashtable approach provides low values of false negatives, maintains low run-time overhead, and respects the instrumentation budget. Accordingly, we choose the hash-table approach to support instrumentation-redundancy suppression in DIME*. 1x 4. 0 Native Pin Htable BST Merger Approach 4.1 (a) lbm benchmark Slow Down Factor 251x Run−1 Run−2 Run−3 250x 2x 1x 0 Native Pin Htable BST Merger Approach (b) mcf benchmark Figure 4: Slow-down factors. Figure 4a presents the slow-down factors of native Pin and the proposed approaches of DIME* with lbm benchmark. On top of native Pin, lbm runs 68x slower than the native execution. On the other hand, the hash-table approach of Pin achieves a slow-down of 1.4x, 1x, and 1x for three consecutive runs. The overhead of the BST approach is 1.5x, 1x, and 1x, while that of BST-Merger is 1.5x, 1x, 1x for three runs. In Figure 4b, native Pin slows down the execution 251x with mcf benchmark. Whereas, the slow-down factors of the hash-table approach for the three runs are 1.7x, 1x, and 1x. These of the BST are 1.6x, 1.7x, and 1x, and BSTMerger achieves slow-down of 1.9x, 1x, and 1x. To sum up, DIME* reduces the run-time overhead by at least 45 folds for lbm and 132 folds for mcf. These numbers reveal that the three modifications of DIME* are able to dramatically reduce the run-time overhead of native Pin. Thus, all of PERFORMANCE EVALUATION This section presents the experimentation of DIME* and discusses its performance. Experimental Setup We experiment with the SPEC2006 benchmark suite [14] including C and C++ integer and floating point programs. The experiments run on top of a workstation hosting a quadcore i7 3.4 GHz Intel processors with 8 MB of cache, and 16 GB of RAM. The operating system is an Ubuntu 12.04 patched with a real-time kernel v3.2.0-23 to convert Linux into a fully preemptible kernel. To obtain accurate results, we inhibit task migration between cores and lock core speed to the maximum frequency. The experimentation environment also maintains a real-time scheduling policy and priority. These modifications guarantee accurate results for performance evaluation and are not mandatory for DIME* correctness. The instrumentation objective is extracting the branch-profile of the program. We use the Pin kit v2.1256759 and gcc v4.6.3. The time-period parameter is set to one second and the instrumentation budget is set to 0.1 seconds for all the benchmark programs. Note that the experimentation included more benchmarks, however, these extra benchmarks are not reported since the execution time on top of native Pin exceeded twenty days. We evaluate the performance of DIME* using the following metrics: 1. Instrumentation Coverage: the ratio of the amount of unique extracted traces by DIME* to the amount of those extracted by native Pin. This metric demonstrates the ability of DIME* to extract the maximum possible amount of information while respecting the instrumentation budget. 2. Slow-down factor of the instrumented program: the ratio of the execution time of the dynamically instrumented benchmark to its original execution time (without instrumentation). This metric reflects the reduction of run-time overhead of DIME* compared to native Pin. 12 ● 8 ● ● ● 4 2 0 ● ● ● ● ●● ●●● ●●● ● ● ● ● ● ●● ● ● ●● ●● ● ● ●● ● ●● ● ● ●● ● ● ●●● ● ●●● ●● ● ●● ●● ● ● ●●●● ● ● ● ● ●● ● ●● ●● ●● ● ● ●●●●●● ● ●● ● ● ● ● ●● ●● ●● ● ● ● ● ● ●● ●● ●● ●● ●●●● ●●● ●● ● ● ● ●●● ●● ● ●● ● ● ●● ●● ●● ●●●● ● ●●●● ● ● ● ● ● ● ● ● ●●●●● ● ● ● ● ● ● ●● ●●●● ● ● ●●●● ●●● ● ● ● ●● ● ● ● ● ● ●● ●● ●● ● ●●●●● ●● ● ● ● ● ●●●● ● ●●● ● ● ● ● ●● ●● ● ● ● ●●● ● ● ● ● ● ● ● ●●● ● ● ●● ●●● ● ●●●● ● ● ●● ●● ● ●●● ● ●● ●● ●● ●● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●●●● ● ●● ● ● ● ● ●● ●● ● ●●● ● ●● ● ● ●● ● ●● ●● ●● ● ● ●● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ●● ● ● ●●● ● ● ● ● ●● ●●●● ●● ● ●●● ● ●●● ●●●● ●● ● ● ●● ● ● ●● ●● ●● ● ● ●●● ● ●● ● ● ●●● ●● ●●● ●● ●● ●● ● ●●● ● ● ● ● ● ● ●● ●●● ●● ● ●●●● ● ●● ●● ●● ● ●●●● ● ● ●● ● ● ● ●● ● ●●●●● ● ● ● ● ● ● ● ●● ● ● ●● ●● ●● ● ●● ● ● ● ●● ● ●● ●● ●●● ● ● ● ●● ● ●● ● ● ●●● ●● ●● ●●● ● ● ●● ●●● ●● ●● ● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ●● ● ● ● ●● ● ● ● ● ● ●● ● ●● ● 0 100 200 300 400 500 600 8 Overshoot (usec) ● 6 Overshoot (usec) Overshoot (usec) 10 8 6 4 2 0 700 ● ● ● ●● ● ●● ●● ● ● ●●●● ● ● ●●● ● ● ● ●● ●● ● ● ●● ●●● ●● ●●●●● ● ●● ●●● ●●●●● ● ● ● ● ● ●●●● ● ● ● ● ● ● ● ●● ● ●●● ● ● ●● ● ●● ● ●● ● ●● ●●●● ● ● ● ● ●● ●● ● ●●● ● ●●● ● ●● ●● ● ●● ●●● ●● ●● ● ● ● ●●● ● ●● ● ● ● ● ●● ● ● ● ● ●● ● ● ● ● ● ● ● ●●● ● ● ● ●● ● ● ● ● ● ● ● ●●●● ● ● ●●● ●● ● ●● ●● ● ●● ● ● ● ●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ● ●● ● ●● ●● ● ● ● ● ●● ● ●● ● ●●● ● ● ●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●●● ● ● ● ● ● ● ● ● ● ● ●●● ● ●●● ●● ● ●● ●● ● ● ●● ● ● ●●● ● ●●●● ● ● ● ●● ● ● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ●● ● ● ●● ●● ● ● ●● ● ●● ●● ●● ●● ●● ●●● ● ●●● ● ●●● ● ●● ● ●● ●● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ●●●●●●● ● ● ● ●● ●● ●●● ● ● ●● ● ● ●● ● ● ● ●●●●●● ●●●●●● ● ●● ● ●●●● ● ● ● ●●● ●● ● ●●●● ●●● ● ● ●●● ●●●●● ●●● ● ●● ●●●● ●● ●● ● ●●● ● ● ● ● ● ●● ● ●●●●●● ●●●●● ●● ●● ● ● 0 100 Execution Time 200 300 400 500 600 ● 6 ● ● ● ●● ● ● ●●● ● ● ● ● ● ● ● ● ●●● ●●●● ● ● ●● ●● ● ●● ● ●●● ● ●● ●● ●●●●● ●●● ●● ● ● ●●●●● ●● ● ●●●●● ● ●● ●● ● ● ● ●● ● ● ● ●● ● ● ● ● ●● ●● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ●● ●● ● ● ● ●● ●●● ●● ● ● ●● ● ●● ● ● ● ●●● ●● ● ● ●● ● ● ●● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●●●● ● ● ● ● ● ● ● ● ● ●●● ● ● ● ●●●● ●● ● ● ●● ● ●●● ● ●● ●●● ●● ● ● ● ● ● ●● ● ●● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ●● ● ● ●● ●● ● ● ●● ● ●● ● ●● ● ● ● ●● ● ● ● ●● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ●● ● ●● ●● ●● ● ●● ● ●● ●● ●● ● ● ● ●●●●●● ● ● ● ● ● ● ●● ●● ●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ●● ● ●● ●●● ● ●● ●●● ● ● ●● ●● ● ●● ● ● ● ● ● ●● ● ●● ● ● ●●● ● ● ●● ● ●● ●● ● ● ●● ● ●●●● ●●● ●● ● ● ● ●●●●● ● ●● ●● ●●●● ●● ● ● ● ● ● ● ●●● ●●● ●● ● ●● ● ● ●●● ● ● ●●●● ●● ● ●● ● ●● ●●●● ●● ● ●● ●● ● ● ● ●●● ● ●● ●● ● ●● ●● ●● ● ● ● ● ●● ● ● ●●● ● ● ●● ● ●● ●●● ● ● ● ●●●● ● ●●● ● ● ●● ● ● ● ●●● ● ● ●●●● ● ● ● ● ●●●●●●● ● ●● ● 4 2 0 700 0 100 200 Execution Time 300 400 500 600 700 Execution Time (a) Hash-table (b) BST (c) Merger BST Figure 5: Overshoots of the three approaches in the first run with the mcf benchmark. 4.2 Experimental Results Native Pin 100 Coverage Percentage (%) 90 80 70 60 795x 1733x 2971x 2438x 1738x 67x 251x 208x Slow−down Factor Run−1 Run−2 Run−3 Run−4 Run−5 Run−6 Run−7 Run−8 DIME* 8 6 50 4 40 2 0 30 namd xalan deal povray sphinx3 lbm mcf milc Benchmark 20 Figure 7: Slow-down factors of native Pin and DIME*. 10 milc mcf lbm sphinx3 povray dealII xalancbmk namd 0 Benchmark Figure 6: Instrumentation Coverage DIME* is capable of maintaining high instrumentation coverage. Figure 6 shows the ratio of the amount of the extracted instrumentation output through multiple runs of DIME* with respect to that extracted by native Pin. DIME* is capable of extracting 97% and 99% of the instrumentation output in four runs for dealII and mcf benchmarks consequently. In five runs, DIME* generates a coverage of 99% for both namd and lbm. It extracts 92% and 97% in the sixth run for milc and povray consequently. DIME* also extracts 98% when instrumenting xalancbmk for seven runs, and 91% of the instrumentation output of sphinx3 after eight runs. DIME* outperforms native Pin in terms of run-time overhead. It reduces the run-time overhead of dynamic instrumentation by one to three orders of magnitude compared to native Pin. Figure 7 shows the slow-down factor of native Pin, and the average slow-down factor of the eight runs of DIME* for each benchmark program. Note that the average slow-down factor is the geometric mean. Native Pin dramatically slows down the program execution. The average slow down of native Pin is 706x the original benchmark execution, with maximum value of 2971x and minimum value of 67x. The benchmarks’ continuous execution time on top of native Pin ranges from four hours to nine days with average of four days. On the other hand, the benchmarks on top of DIME* takes from three to 42 minutes with average of nine minutes. The average slow-down of DIME* is 1.5x, with maximum value of 8x and minimum value of 1x. Running a program multiple times on top of DIME* is less time-consuming than native Pin. More importantly, DIME* allows the program to maintain its timing properties (or extra-functional properties in general). Respecting such properties is essential for time-sensitive systems. Additionally, multiple runs of DIME* provide very high instrumentation coverage compared to native Pin. 5. CASE STUDIES This section demonstrates the scalability and the practicality of DIME* through two case studies. 5.1 VLC Case Study This case study reveals the usability of DIME* for instrumenting multi-threaded time-sensitive software. VLC [3], developed by the VideoLan organization, is a multi-platform media player. It consists of approximately 600 000 lines of code and uses dependencies of approximately three million lines of code. In this case study, we aim to extract the call context tree of VLC v2.0.8 while playing a high definition, 29.97 fps, 720x480, 1 Mbps bitrate video. The call context tree is useful for performance analysis and applying program optimizations [32]. The tool, used in this case study, is based on the DebugTrace pintool which is available in Pin’s v2.12 kit. We use the tool to extract the call traces, then we use the call traces to build a call context tree. The platform is an Ubuntu 12.04 machine hosting a quad-core i7 2.6 GHz Intel processors with 8 GB of RAM. For DIME*, we set the time period to one second and the budget to 10% which enables VLC to run the video smoothly. Table 1 shows the number of video blocks that VLC decodes for viewing frames, and the extracted percentage of the nodes and the edges of the call-context tree. The table lists the number of decoded blocks without instrumentation, with native Pin, and with DIME*. It also shows the coverage of DIME* compared to Pin. Our conclusion is that DIME* dramatically decreases the run-time overhead of dynamic instrumentation and maintains almost the same instrumentation coverage. On top of native Pin, VLC fails to maintain a continuous video playback. The video is unwatchable; only 37 video blocks (out of 594) are decoded. VLC generates multiple errors of dropping video frames due to very slow processing. On the other hand, DIME* enables VLC to play the video continuously. VLC decodes 574, 594, and 594 video blocks (out of 594) for the three runs consecutively. DIME* extracts 98% of the call context tree nodes and 96% of the edges. the quality of service (QoS) increases. The processing time reported excludes connection-establishing time. The table also shows the coverage of DIME* with respect to that of Pin. In this case study, DIME* extracts 97% of the analysis data while reducing the run-time overhead by 68 folds compared to native Pin. Originally, PostgreSQL processes all the transactions in 46 seconds. Native Pin causes a slowdown of 96x; PostgreSQL executes the same number of transactions in 1.2 hours. On the other hand, DIME* maintains slowdown of only 1.4x, 1.4x, and 1.3x in three runs consecutively. Decoded Blocks Nodes(%) Edges(%) Original 594 N/A N/A Native Pin 37 100% 100% DIME* (run 1) 574 95.7% 93.6% (run 2) 594 98% 96.2% (run 3) 594 98.2% 96.5% Table 1: Results for the VLC case study A program can be instrumented at the source code level either automatically or manually. In automatic instrumentation, a tool parses the program, may generate a CFG, and eventually insert instrumentation points. Multiple works [12, 16, 15] investigate static source-code time-aware instrumentation tools. On the other hand, manual instrumentation requires that the developer specifies the instrumentation locations [33]. Manual instrumentation is highly flexible, but the induced effect of instrumentation on the timing behavior is hard to estimate by the developer. Some instrumentation tools are also capable of inserting instrumentation points to binary executables, either statically or dynamically. QPT [19], EEL [20], and ATOM [34] are examples of static binary instrumentation tools. Static instrumentation is based on static analysis and, hence, cannot react to application changes at run time. Dynamic binary instrumentation, on the other hand, does not require any pre-processing of the program under analysis. Example of dynamic binary instrumentation tools that use code transformation during program execution include Dyninst [10] and Vulcan [11]. Most of these instrumentation tools, however, modify the native behavior of the program under analysis [9]. Other tools have software code caches and are able to dynamically compile binaries such as Pin [21], DynamoRIO [8], and Valgrind [28]. Superpin [38] is a parallelized version of Pin that reduces the overhead of dynamic binary instrumentation by utilizing multiple cores. The performance gain is limited by the number of cores and shared memory structures. Yu et al. [39] introduce MT-profiler, a multi-threaded profiling framework built on top of DynamoRIO to instrument parallel programs. Zhao et al. [40] introduce PiPA, a pipelined profiling and analysis tool for parallelizing dynamic instrumentation on multi-core platforms. Moseley et al [25] present a probebased application monitor which is injected to the original application under analysis. The approach we present in this work can make use of such parallelization techniques to reduce overhead as well. Upton et al. [37] introduce a buffering system for Pin to reduce overhead. Kumar et al. [18] present an instrumentation 5.2 PostgreSQL Case Study DIME* is useful for extracting sufficient analysis information while maintaining high quality of service (QoS). PostgreSQL [2] is a powerful object-relational database management system that supports SQL standards. PostgreSQL 9.1 consists of approximately one million lines of code. When an application sends a database request to PostgreSQL, a connection will be established, and a parser will check the query syntax and create a query tree. Then, an optimizer generates a query plan from the tree and sends the plan to the executor. Finally, the executor steps through the commands in the query plan to retrieve the required information or to make the required updates to the database. Pgbench [1] is a benchmarking tool for testing the performance of PostgreSQL. It runs a sequence of transactions multiple times in multiple database sessions. The objective of this case study is the extraction of the branch-profile of PostgreSQL while processing a total of 800 000 transactions. PostgreSQL runs 16 database sessions where each session consists of 50 000 transactions. The case study runs on an Ubuntu 12.04 platform hosting a quad-core i7 2.6 GHz Intel processors with 8 GB of RAM. We set the budget of DIME* to 7% and the time period to one second. These values enable DIME* to extract sufficient information while keeping high performance of PostgreSQL. Table 2 shows the performance of PostgreSQL while (1) running natively, (2) running on top of native Pin, and (3) running on top of DIME*. The total time consumed to process the 800 000 transactions is an indication of the performance. As the processing time increases, the degradation in Total Time (sec) Coverage(%) Original 46 N/A Native Pin 4419 100% DIME* (run 1) 65 42% (run 2) 65 75% (run 3) 61 97% Table 2: Results for the PostgreSQL case study 6. RELATED WORK optimizer for program monitoring and profiling. While these instrumentation approaches focus on reducing the overhead of instrumentation, they are unaware of the program’s timing requirements. They, however, are also orthogonal to our proposed approach. The work by Arnold and Ryder [5] is the most relevant to reducing the overhead of dynamic instrumentation following DIME. The authors’ approach involves duplicating code regions and using counter-based sampling to switch between the instrumented and non-instrumented versions of the code. Code duplication results in a large increase in code space. Since event-based sampling only samples events according to their frequency of occurrence, this results in a reduced instrumentation overhead. However, as explained in [7], event-based sampling can result in sampling bursts which can cause high degradation in performance Other samplingbased approaches are also used for performance optimizations [13]. These approaches either apply optimizations specific to the instrumentation objective or use compiler-specific information to perform optimizations. 7. CONCLUSION Dynamic binary instrumentation tools are used to analyze program behavior and extract debugging information at runtime. Most applications, however, cannot leverage existing tools for analysis or debugging purposes due to the performance degradation resulting from the instrumentation process. Time-sensitive applications, for instance, require a bound on the execution time overhead. In this paper, we propose DIME* that performs instrumentation only within a user-specified instrumentation budget. DIME* suppresses logging of redundant information to reduce the instrumentation overhead. The results show a reduction in the overhead of the instrumentation process by one to three orders of magnitude compared to native Pin while achieving up to 99% of the instrumentation coverage. DIME* was able to extract 97% of the call context tree of the VLC video player while playing a high definition video. VLC fails to provide a watchable video while being instrumented using native Pin. DIME* was also used for the branch profiling of the PostgreSQL database management system and was able to extract 97% of the instrumentation information in three runs. DIME* extracts this information in less than two minutes per run while native Pin takes 1.2 hours to extract the information. The presented case studies show the scalability of DIME* and its ability to limit the instrumentation overhead while achieving a high instrumentation coverage. 8. REFERENCES [1] Pgbench: Benchmarking Tool for PostgreSQL. http://wiki.postgresql.org/wiki/Pgbench. [2] PostgreSQL Global Development Group. http://www.postgresql.org/. [3] VLC Media Player. http://www.videolan.org/vlc/index.html. [4] P. Arafa, H. Kashif, and S. Fischmeister. Dime: Time-aware dynamic binary instrumentation using rate-based resource allocation. In Proc. of the 13th International Conference on Embedded Software (EMSOFT), Montreal, Canada, Sept 2013. [5] M. Arnold and B. G. Ryder. A Framework for Reducing the Cost of Instrumented Code. In Proc. of the ACM SIGPLAN Conf. on Programming language design and implementation (PLDI), 2001. [6] S. Bock, B. Childers, R. Melhem, D. Mosse, and Y. Zhang. Analyzing the Impact of Useless Write-backs on the Endurance and Energy Consumption of PCM Main Memory. In Performance Analysis of Systems and Software (ISPASS), 2011 IEEE International Symposium on, pages 56–65, 2011. [7] B. Bonakdarpour, S. Navabpour, and S. Fischmeister. Sampling-based Runtime Verification. In Proc. of the 17th Intl. Conf. on Formal Methods (FM), Jun. 2011. [8] D. Bruening, T. Garnett, and S. Amarasinghe. An Infrastructure for Adaptive Dynamic Optimization. In Proc. of the Intl. Symp. on Code Generation and Optimization (CGO), 2003. [9] D. Bruening, Q. Zhao, and S. Amarasinghe. Transparent Dynamic Instrumentation. SIGPLAN Not., 47(7), Mar. 2012. [10] B. Buck and J. K. Hollingsworth. An API for Runtime Code Patching. Int. J. High Perform. Comput. Appl., 14(4), Nov. 2000. [11] A. Edwards, H. Vo, and A. Srivastava. Vulcan: Binary Transformation in a Distributed Environment. Technical report, 2001. [12] S. Fischmeister and P. Lam. Time-Aware Instrumentation of Embedded Software. IEEE Transactions on Industrial Informatics, 2010. [13] N. Froyd, J. Mellor-Crummey, and R. Fowler. Low-overhead Call Path Profiling of Unmodified, Optimized Code. In Proc. of the 19th Annual Intl. Conf. on Supercomputing (ICS), 2005. [14] J. L. Henning. SPEC CPU2000: Measuring CPU Performance in the New Millennium. Computer, 33(7), 2000. [15] H. Kashif, P. Arafa, and S. Fischmeister. INSTEP: A Static Instrumentation Framework for Preserving Extra-functional Properties. In Proc. of the 19th IEEE Intl. Conf. on Embedded and Real-Time Computing Systems and Applications (RTCSA), Aug. 2013. [16] H. Kashif and S. Fischmeister. Program transformation for time-aware instrumentation. In Proc. of the 17th IEEE Intl. Conf. on Emerging Technologies & Factory Automation (ETFA), Sep. 2012. [17] M. Kim, M. Viswanathan, S. Kannan, I. Lee, and O. Sokolsky. Java-MaC: A Run-Time Assurance Approach for Java Programs. Form. Methods Syst. Des., 2004. [18] N. Kumar, B. R. Childers, and M. L. Soffa. Low Overhead Program Monitoring and Profiling. In Proc. of the 6th ACM SIGPLAN-SIGSOFT workshop on Program Analysis for Software Tools and Engineering (PASTE), 2005. [19] J. Larus. Efficient program tracing. Computer, 26(5), 1993. [20] J. R. Larus and E. Schnarr. EEL: Machine-Independent Executable Editing. SIGPLAN Not., 30, 1995. [21] C.-K. Luk, R. Cohn, R. Muth, H. Patil, A. Klauser, [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] G. Lowney, S. Wallace, V. J. Reddi, and K. Hazelwood. Pin: Building Customized Program Analysis Tools with Dynamic Instrumentation. In Proc. of the ACM SIGPLAN Conf. on Programming Language Design and Implementation (PLDI), 2005. J. M. Mellor-Crummey and T. J. LeBlanc. A Software Instruction Counter. In Proc. of the 3rd Intl. Conf. on Architectural Support for Programming Languages and Operating Systems (ASPLOS), 1989. L. J. Moore and A. R. Moya. Non-Intrusive Debug Technique for Embedded Programming. In Proc. of the 14th Intl. Symp. on Software Reliability Engineering (ISSRE), 2003. P. Mork. Techniques for Debugging Parallel Programs. Technical report, University of Miskolc. T. Moseley, A. Shye, V. Reddi, D. Grunwald, and R. Peri. Shadow Profiling: Hiding Instrumentation Costs with Parallelism. In Intl. Symp. on Code Generation and Optimization(CGO), Mar. 2007. T. Mytkowicz, A. Diwan, M. Hauswirth, and P. Sweeney. We have it Easy, but do we have it Right? IEEE Intl. Symp. on Parallel and Distributed Processing, 2008. M. Naik, H. Yang, G. Castelnuovo, and M. Sagiv. Abstractions from Tests. SIGPLAN Not., 47(1), Jan. 2012. N. Nethercote and J. Seward. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation. SIGPLAN Not., 42(6), Jun. 2007. W. Omre. Debug and Trace for Multicore SoCs. Technical report, ARM, 2008. A. Rico, A. Duran, F. Cabarcas, Y. Etsion, A. Ramirez, and M. Valero. Trace-driven Simulation of Multithreaded Applications. In Performance Analysis of Systems and Software (ISPASS), 2011 IEEE International Symposium on, pages 87–96, 2011. A. Ruiz-Alvarez and K. Hazelwood. Evaluating the Impact of Dynamic Binary Translation Systems on Hardware Cache Performance. In IEEE Intl. Symp. on Workload Characterization (IISWC), 2008. M. Serrano and X. Zhuang. Building Approximate Calling Context from Partial Call Traces. In Proc. of the 7th Annual IEEE/ACM Intl. Symp. on Code Generation and Optimization (CGO), 2009. B. Simon, D. Bouvier, T.-Y. Chen, G. Lewandowski, R. McCartney, and K. Sanders. Common Sense Computing (Episode 4): Debugging. Computer Science Education, 18(2), 2008. A. Srivastava and A. Eustace. ATOM: A System for Building Customized Program Analysis Tools. SIGPLAN Not., 39, 1994. G.-R. Uh, R. Cohn, B. Yadavalli, R. Peri, and R. Ayyagari. Analyzing Dynamic Binary Instrumentation Overhead. 2007. D. Upton and K. Hazelwood. Finding Cool Code: An Analysis of Source-level Causes of Temperature Effects. In Performance Analysis of Systems and Software (ISPASS), 2011 IEEE International Symposium on, pages 117–118, 2011. D. Upton, K. Hazelwood, R. Cohn, and G. Lueck. Improving Instrumentation Speed via Buffering. In Proc. of the Workshop on Binary Instrumentation and Applications (WBIA), 2009. [38] S. Wallace and K. Hazelwood. SuperPin: Parallelizing Dynamic Instrumentation for Real-Time Performance. In Intl. Symp. on Code Generation and Optimization (CGO), Mar. 2007. [39] Z. Yu, W. Zhang, and X. Tu. MT-Profiler: A Parallel Dynamic Analysis Framework Based on Two-stage Sampling. In Proc. of the 9th Intl. Conf. on Advanced Parallel Processing Technologies (APPT), 2011. [40] Q. Zhao, I. Cutcutache, and W.-F. Wong. PiPA: Pipelined Profiling and Analysis on Multicore Systems. ACM Trans. Archit. Code Optim., 7(3), Dec. 2010.
6cs.PL
1 On extractable shared information Johannes Rauh∗, Pradeep Kr. Banerjee∗, Eckehard Olbrich∗ , Jürgen Jost∗, and Nils Bertschinger† ∗ Max Planck Institute for Mathematics in the Sciences, Leipzig, Germany {jrauh,pradeep,olbrich,jjost}@mis.mpg.de † Frankfurt Institute for Advanced Studies, Frankfurt, Germany arXiv:1701.07805v3 [cs.IT] 10 Nov 2017 [email protected] Abstract We consider the problem of quantifying the information shared by a pair of random variables X1 , X2 about another variable S. We propose a new measure of shared information, called extractable shared information, that is left monotonic; that is, the information shared about S is bounded from below by the information shared about f (S) for any function f . We show that our measure leads to a new nonnegative decomposition of the mutual information I(S; X1 X2 ) into shared, complementary and unique components. We study properties of this decomposition and show that a left monotonic shared information is not compatible with a Blackwell interpretation of unique information. We also discuss whether it is possible to have a decomposition in which both shared and unique information are left monotonic. Keywords: Information decomposition; multivariate mutual information; left monotonicity; Blackwell order I. I NTRODUCTION A series of recent papers have focused on the bivariate information decomposition problem [1]–[6]. Consider three random variables S, X1 , X2 with finite alphabets S, X1 and X2 , respectively. The total information that the pair (X1 , X2 ) convey about the target S can have aspects of shared or redundant information (conveyed by both X1 and X2 ), of unique information (conveyed exclusively by either X1 or X2 ), and of complementary or synergistic information (retrievable only from the the joint variable (X1 , X2 )). In general, all three kinds of information may be present concurrently. One would like to express this by decomposing the mutual information I(S; X1 X2 ) into a sum of nonnegative components with a well-defined operational interpretation. One possible application area is in the neurosciences. In [7], it is argued that such a decomposition can provide a framework to analyze neural information processing using information theory that can integrate and go beyond previous attempts. For the general case of k finite source variables (X1 , . . . , Xk ), Williams and Beer [3] proposed the partial information lattice framework that specifies how the total information about the target S is shared across the singleton sources and their disjoint or overlapping coalitions. The lattice is a consequence of certain natural properties of 2 shared information (sometimes called the Williams–Beer axioms). In the bivariate case (k = 2), the decomposition has the form I(S; X1 X2 ) = SI(S; X1 , X2 ) + CI(S; X1 , X2 ) + U I(S; X1 \X2 ) + U I(S; X2 \X1 ), {z } | {z } | {z } | {z } | shared unique (X1 wrt X2 ) complementary (1) unique (X2 wrt X1 ) I(S; X1 ) = SI(S; X1 , X2 ) + U I(S; X1 \X2 ), (2) I(S; X2 ) = SI(S; X1 , X2 ) + U I(S; X2 \X1 ), (3) where SI(S; X1 , X2 ), U I(S; X1 \X2 ), U I(S; X2 \X1 ), and CI(S; X1 , X2 ) are nonnegative functions that depend continuously on the joint distribution of (S, X1 , X2 ). The difference between shared and complementary information is the familiar co-information [8] (or interaction information [9]), a symmetric generalization of the mutual information for three variables, CoI(S; X1 , X2 ) = I(S; X1 ) − I(S; X1 |X2 ) = SI(S; X1 , X2 ) − CI(S; X1 , X2 ). Equations (1) to (3) leave only a single degree of freedom, i.e., it suffices to specify either a measure for SI, for CI or for U I. Williams and Beer not only introduced the general partial information framework, but also proposed a measure of SI to fill this framework. While their measure has subsequently been criticized for “not measuring the right thing” [4]–[6], there has been no successful attempt to find better measures, except for the bivariate case (k = 2) [1], [4]. One problem seems to be the lack of a clear consensus on what an ideal measure of shared (or unique or complementary) information should look like and what properties it should satisfy. In particular, the Williams–Beer axioms only put crude bounds on the values of the functions SI, U I and CI. Therefore, additional axioms have been proposed by various authors [4]–[6]. Unfortunately, some of these properties contradict each other [5], and the question for the right axiomatic characterization is still open. The Williams–Beer axioms do not say anything about what should happen when the target variable S undergoes a local transformation. In this context, the following left monotonicity property was proposed in [5]: (LM) SI(S; X1 , X2 ) ≥ SI(f (S); X1 , X2 ) for any function f . (left monotonicity) Left monotonicity for unique or complementary information can be defined similarly. The property captures the intuition that shared information should only decrease if the target performs some local operation (e.g., coarse graining) on her variable S. As argued in [2], left monotonicity of shared and unique information are indeed desirable properties. Unfortunately, none of the measures of shared information proposed so far satisfy left monotonicity. In this contribution, we study a construction that enforces left monotonicity. Namely, given a measure of shared information SI, define SI(S; X1 , X2 ) := sup f :S→S ′ SI(f (S); X1 , X2 ), (4) where the supremum runs over all functions f : S → S ′ from the domain of S to an arbitrary finite set S ′ . By construction, SI satisfies left monotonicity, and SI is the smallest function bounded from below by SI that satisfies left monotonicity. 3 Changing the definition of shared information in the information decomposition framework Equations (1)–(3) leads to new definitions of unique and complementary information: ∗ U I (S; X1 \X2 ) := I(S; X1 ) − SI(S; X1 , X2 ), ∗ U I (S; X2 \X1 ) := I(S; X2 ) − SI(S; X1 , X2 ), ∗ ∗ ∗ CI (S; X1 , X2 ) := I(S; X1 X2 ) − SI(S; X1 , X2 ) − U I (S; X1 \X2 ) − U I (S; X2 \X1 ). ∗ In general, U I (S; X1 \ X2 ) 6= U I(S; X1 \ X2 ) := supf :S→S ′ U I(f (S); X1 \ X2 ). Thus, our construction cannot enforce left monotonicity for both U I and SI in parallel. ∗ ∗ Lemma 2 shows that SI, U I and CI are nonnegative and thus define a nonnegative bivariate decomposition. We study this decomposition in Section IV. In Theorem 1, we show that our construction is not compatible with a decision-theoretic interpretation of unique information proposed in [1]. In Section V, we ask whether it is possible to find an information decomposition in which both shared and unique information measures are left monotonic. Our construction cannot directly be generalized to ensure left monotonicity of two functions simultaneously. Nevertheless, it is possible that such a decomposition exists, and in Proposition 5, we prove bounds on the corresponding shared information measure. Our original motivation for the definition of SI was to find a bivariate decomposition in which the shared information satisfies left monotonicity. However, one could also ask whether left monotonicity is a required property of shared information, as put forward in [2]. In contrast, [4] argue that redundancy can also arise by means of a mechanism. Applying a function to S corresponds to such a mechanism that singles out a certain aspect from S. Even if all the Xi share nothing about the whole S, they might still share information about this aspect of S, which means that the shared information will increase. With this intuition, we can interpret SI not as an improved measure of shared information, but as a measure of extractable shared information, because it asks for the maximal amount of shared information that can be extracted from S by further processing S by a local mechanism. More generally, one can apply a similar construction to arbitrary information measures. We explore this idea in Section III and discuss probabilistic generalizations and relations to other information measures. In Section VI, we apply our construction to existing measures of shared information. II. P ROPERTIES OF I NFORMATION D ECOMPOSITIONS A. The Williams–Beer Axioms Although we are mostly concerned with the case k = 2, let us first recall the three axioms that Williams and Beer [3] proposed for a measure of shared information for arbitrarily many arguments: (S) SI(S; X1 , . . . , Xk ) is symmetric under permutations of X1 , . . . , Xk , (SR) SI(S; X1 ) = I(S; X1 ), (Symmetry) (Self-redundancy) (M) SI(S; X1 , . . . , Xk−1 , Xk ) ≤ SI(S; X1 , . . . , Xk−1 ), with equality if Xi = f (Xk ) for some i < k and some function f . (Monotonicity) Any measure of SI satisfying these axioms is nonnegative. Moreover, the axioms imply the following: 4 (RM) SI(S; X1 , . . . , Xk ) ≥ SI(S; f1 (X1 ), . . . , fk (Xk )) for all functions f1 , . . . , fk . (right monotonicity) Williams and Beer also defined a function Imin (S; X1 , . . . , Xk ) = X PS (s) min s i nX PXi |S (xi |s) log xi PS|Xi (s|xi ) o PS (s) (5) and showed that Imin satisfies their axioms. B. The C OPY example and the Identity Axiom Let X1 , X2 be independent uniformly distributed binary random variables, and consider the copy function C OPY (X1 , X2 ) := (X1 , X2 ). One point of criticism of Imin is the fact that X1 and X2 share Imin (C OPY (X1 , X2 ); X1 , X2 ) = 1 bit about C OPY (X1 , X2 ) according to Imin , even though they are independent. [4] argue that the shared information about the copied pair should equal the mutual information: (Id) SI(C OPY (X1 , X2 ); X1 , X2 ) = I(X1 ; X2 ). (Identity) Ref. [4] also proposed a bivariate measure of shared information that satisfies (Id). Similarly, the measures of bivariate shared information proposed in [1] satisfies (Id). However, (Id) is incompatible with a nonnegative information decomposition according to the Williams–Beer axioms for k ≥ 3 [2]. On the other hand, Ref. [5] uses an example from game theory to give an intuitive explanation how even independent variables X1 and X2 can have nontrivial shared information. However, in any case the value of 1 bit assigned by Imin is deemed to be too large. C. The Blackwell property and property (∗) One of the reasons that it is so difficult to find good definitions of shared, unique or synergistic information is that a clear operational idea behind these notions is missing. Starting from an operational idea about decision problems, Ref. [1] proposed the following property for the unique information, which we now propose to call Blackwell property: (BP) For a given joint distribution PSX1 X2 , U I(S; X1 \X2 ) vanishes if and only if there exists a random variable X1′ such that S − X2 − X1′ is a Markov chain and PSX1′ = PSX1 . (Blackwell property) In other words, the channel S → X1 is a garbling or degradation of the channel S → X2 . Blackwell’s theorem [10] implies that this garbling property is equivalent to the fact that any decision problem in which the task is to predict S can be solved just as well with the knowledge of X2 as with the knowledge of X1 . We refer to Section 2 in [1] for the details. Ref. [1] also proposed the following property: (∗) SI and U I depend only on the marginal distributions PSX1 and PSX2 of the pairs (S, X1 ) and (S, X2 ). This property was in part motivated by (BP), which also depends only on the channels S → X1 and S → X2 and thus on PSX1 and PSX2 . Most information decompositions proposed so far satisfy property (∗). 5 III. E XTRACTABLE I NFORMATION M EASURES One can interpret SI as a measure of extractable shared information. We explain this idea in a more general setting. For fixed k, let IM (S; X1 , . . . , Xk ) be an arbitrary information measure that measures one aspect of the information that X1 , . . . , Xk contain about S. At this point, we do not specify what precisely an information measure is, except that it is a function that assigns a real number to any joint distributions of S, X1 , . . . , Xk . The notation is, of course, suggestive of the fact that we mostly think about one of the measures SI, U I or CI, in which the first argument plays a special role. However, IM could also be the mutual information I(S; X1 ), the entropy H(S), or the coinformation CoI(S; X1 , X2 ). We define the corresponding extractable information measure as IM (S; X1 , . . . , Xk ) := sup IM (f (S); X1 , . . . , Xk ), (6) f where the supremum runs over all functions f : S 7→ S ′ from the domain of S to an arbitrary finite set S ′ . The intuition is that IM is the maximal possible amount of IM one can “extract” from (X1 , . . . , Xk ) by transforming S. Clearly, the precise interpretation depends on the interpretation of IM . This construction has the following general properties: 1) Most information measures satisfy IM (O; X1 , . . . , Xk ) = 0 when O is a constant random variable. Thus, in this case, IM (S; X1 , . . . , Xk ) ≥ 0. Thus, for example, even though the coinformation can be negative, the extractable coinformation is never negative. 2) Suppose that IM satisfies left monotonicity. Then, IM = IM . For example, entropy H and mutual information I satisfy left monotonicity, and so H = H and I = I. Similarly, as shown in [2], the measure of unique fI = U fI. fI defined in [1] satisfies left monotonicity, and so U information U 3) In fact, IM is the smallest left monotonic information measure that is at least as large as IM . The next result shows that our construction preserves monotonicity properties of the other arguments of IM . It follows that, by iterating this construction, one can construct an information measure that is monotonic in all arguments. Lemma 1. Let f1 , . . . , fk be fixed functions. If IM satisfies IM (S; f1 (X1 ), . . . , fk (Xk )) ≤ IM (S; X1 , . . . , Xk ) for all S, then IM (S; f1 (X1 ), . . . , fk (Xk )) ≤ IM (S; X1 , . . . , Xk ) for all S.  Proof. Let f ∗ = arg maxf IM (f (S); f1 (X1 ), . . . , fk (Xk )) . Then, IM (S; f1 (X1 ), . . . , fk (Xk )) = IM (f ∗ (S); f1 (X1 ), . . . , fk (Xk )) (a) ≤ IM (f ∗ (S); X1 , . . . , Xk ) ≤ sup IM (f (S); X1 , . . . , Xk ) = IM (S; X1 , . . . , Xk ), f where (a) follows from the assumptions. 6 As a generalization to the construction, instead of looking at “deterministic extractability,” one can also look at “probabilistic extractability” and replace f by a stochastic matrix. This leads to the definition IM (S; X1 , . . . , Xk ) := sup IM (S ′ ; X1 , . . . , Xk ), (7) PS ′ |S where the supremum now runs over all random variables S ′ that are independent of X1 , . . . , Xk given S. The function IM is the smallest function bounded from below by IM that satisfies (PLM) IM (S; X1 , X2 ) ≥ IM (S ′ ; X1 , X2 ) whenever S ′ is independent of X1 , X2 given S. (probabilistic left monotonicity) An example of this construction is the intrinsic conditional information I(X; Y ↓ Z) := minPZ ′ |Z I(X; Y |Z ′ ), which was defined in [11] to study the secret-key rate, which is the maximal rate at which a secret can be generated by two agents knowing X or Y , respectively, such that a third agent who knows Z has arbitrarily small information about this key. The min instead of the max in the definition implies that I(X; Y ↓ Z) is “anti-monotone” in Z. In this paper, we restrict ourselves to the deterministic notions, since many of the properties we want to discuss can already be explained using deterministic extractability. Moreover, the optimization problem (6) is a finite optimization problem and thus much easier to solve than Equation (7). IV. E XTRACTABLE S HARED I NFORMATION We now specialize to the case of shared information. The first result is that when we apply our construction to a measure of shared information that belongs to a bivariate information decomposition, we again obtain a bivariate information decomposition. Lemma 2. Suppose that SI is a measure of shared information, coming from a nonnegative bivariate information decomposition (satisfying Equations (1) to (3)). Then, SI defines a nonnegative information decomposition; that is, the derived functions ∗ U I (S; X1 \X2 ) := I(S; X1 ) − SI(S; X1 , X2 ), ∗ U I (S; X2 \X1 ) := I(S; X2 ) − SI(S; X1 , X2 ), and ∗ ∗ ∗ CI (S; X1 , X2 ) := I(S; X1 X2 ) − SI(S; X1 , X2 ) − U I (S; X1 \X2 ) − U I (S; X2 \X1 ) are nonnegative. These quantities relate to the original decomposition by a) SI(S; X1 , X2 ) ≥ SI(S; X1 , X2 ), ∗ b) CI (S; X1 , X2 ) ≥ CI(S; X1 , X2 ), ∗ c) U I(f ∗ (S); X1 \X2 ) ≤ U I (S; X1 \X2 ) ≤ U I(S; X1 \X2 ), where f ∗ is a function that achieves the supremum in Equation (4). 7 Proof. a) SI(S; X1 , X2 ) ≥ SI(S; X1 , X2 ) ≥ 0, ∗ b) CI (S; X1 , X2 ) = SI(S; X1 , X2 ) − CoI(S; X1 , X2 ) ≥ SI(S; X1 , X2 ) − CoI(S; X1 , X2 ) ≥ CI(S; X1 , X2 ) ≥ 0, ∗ c) U I (S; X1 \X2 ) = I(S; X1 ) − SI(S; X1 , X2 ) ≤ I(S; X1 ) − SI(S; X1 , X2 ) = U I(S; X1 \X2 ), ∗ U I (S; X1 \X2 ) = I(S; X1 ) − SI(S; X1 , X2 ) ≥ I(f ∗ (S); X1 ) − SI(f ∗ (S); X1 , X2 ) = U I(f ∗ (S); X1 \X2 ) ≥ 0, where we have used the data processing inequality. Lemma 3. 1) If SI satisfies (∗), then SI also satisfies (∗). 2) If SI is right monotonic, then SI is also right monotonic. Proof. (1) is direct, and (2) follows from Lemma 1. Without further assumptions on SI, we cannot say much about when SI vanishes. However, the condition that ∗ U I vanishes has strong consequences. ∗ Lemma 4. Suppose that U I (S; X1 \X2 ) vanishes, and let f ∗ be a function that achieves the supremum in Equation (4). Then, there is a Markov chain X1 — f ∗ (S) — S. Moreover, U I(f ∗ (S); X1 \X2 ) = 0. ∗ Proof. Suppose that U I (S; X1 \X2 ) = 0. Then, I(S; X1 ) = SI(S; X1 , X2 ) = SI(f ∗ (S); X1 , X2 ) ≤ I(f ∗ (S); X1 ) ≤ I(S; X1 ). Thus, the data processing inequality holds with equality. This implies that X1 − f ∗ (S) − S is a Markov chain. The identity U I(f ∗ (S); X1 \X2 ) = 0 follows from the same chain of inequalities. ∗ Theorem 1. If U I has the Blackwell property, then U I does not have the Blackwell property. Proof. As shown in the example in the appendix, there exist random variables S, X1 , X2 and a function f that satisfy 1) S and X1 are independent given f (S). 2) The channel f (S) → X1 is a garbling of the channel f (S) → X2 . 3) The channel S → X1 is not a garbling of the channel S → X2 . We claim that f solves the optimization problem (4). Indeed, for an arbitrary function f ′ , SI(f ′ (S); X1 , X2 ) ≤ I(f ′ (S); X1 ) ≤ I(S; X1 ) = I(f (S); X1 ) = SI(f (S); X1 , X2 ). Thus, f solves the maximization problem (4). 8 If U I satisfies the Blackwell property, then (2) and (3) imply U I(f (S); X1 \X2 ) = 0 and U I(S; X1 \X2 ) > 0. On the other hand, ∗ U I (S; X1 \ X2 ) = I(S; X1 ) − SI(S; X1 , X2 ) = I(S; X1 ) − SI(f (S); X1 , X2 ) = I(S; X1 ) − I(f (S); X1 ) + U I(f (S); X1 \X2 ) = 0. ∗ Thus, U I does not satisfy the Blackwell property. Corollary 2. There is no bivariate information decomposition in which U I satisfies the Blackwell property and SI satisfies left monotonicity. ∗ Proof. If SI satisfies left monotonicity, then SI = SI. Thus, U I = U I cannot satisfy the Blackwell property by Theorem 1. V. L EFT M ONOTONIC I NFORMATION D ECOMPOSITIONS Is it possible to have an extractable information decomposition? More precisely, is it possible to have an information decomposition in which all information measures are left monotonic? The obvious strategy of starting with an arbitrary information decomposition and replacing each partial information measure by its extractable analogue does not work, since this would mean increasing all partial information measures (unless they are extractable already), but then their sum would also increase. For example, in the bivariate case, when SI is replaced by a larger function SI, then U I needs to be replaced by a smaller function, due to the constraints (2) and (3). As argued in [2], it is intuitive that U I be left monotonic. As argued above (and in [5]), it is also desirable that SI be left monotonic. The intuition for synergy is much less clear. In the following, we restrict our focus to the bivariate case and study the implications of requiring both SI and U I to be left monotonic. Proposition 5 gives bounds on the corresponding SI measure. Proposition 5. Suppose that SI, U I and CI define a bivariate information decomposition, and suppose that SI and U I are left monotonic. Then, SI(f (X1 , X2 ); X1 , X2 ) ≤ I(X1 ; X2 ) (8) for any function f . Before proving the proposition, let us make some remarks. Inequality (8) is related to the identity axiom. Indeed, it is easy to derive Inequality (8) from the identity axiom and from the assumption that SI is left monotonic. Although Inequality (8) may not seem counterintuitive at first sight, none of the information decompositions proposed so far satisfy this property (the function If from [12] satisfies left monotonicity and has been proposed as a measure of shared information, but it does not lead to a nonnegative information decomposition). 9 Proof. If SI is left monotonic, then SI(f (X1 , X2 ); X1 , X2 ) ≤ SI(C OPY (X1 , X2 ); X1 , X2 ) = I(C OPY (X1 , X2 ); X1 ) − U I(C OPY (X1 , X2 ); X1 \X2 ). If U I is left monotonic, then U I(C OPY (X1 , X2 ); X1 \X2 ) ≥ U I(X1 ; X1 \X2 ) = I(X1 ; X1 ) − SI(X1 ; X1 , X2 ). Note that I(X1 ; X1 ) = H(X1 ) = I(C OPY (X1 , X2 ); X1 ) and SI(X1 ; X1 , X2 ) = I(X1 ; X2 ) − U I(X1 ; X2 \X1 ) = I(X1 ; X2 ). Putting these inequalities together, we obtain SI(f (X1 , X2 ); X1 , X2 ) ≤ I(X1 ; X2 ). VI. E XAMPLES In this section, we apply our construction to Williams and Beer’s measure, Imin [3], and to the bivariate measure f proposed in [1]. of shared information, SI, First, we make some remarks on how to compute the extractable information measure (under the assumption that one knows how to compute the underlying information measure itself). The optimization problem (4) is a discrete optimization problem. The search space is the set of functions from the support S of S to some finite set S ′ . For the information measures that we have in mind, we may restrict to surjective functions f , since the information measures only depend on events with positive probabilities. Thus, we may restrict to sets S ′ with |S ′ | ≤ |S|. Moreover, the information measures are invariant under permutations of the alphabet S. Therefore, the only thing that matters about f is which elements from S are mapped to the same element in S ′ . Thus, any function f : S → S ′ corresponds to a partition of S, where s, s′ ∈ S belong to the same block if and only if f (s) = f (s′ ), and it suffices to look at all such partitions. The number of partitions of a finite set S is the Bell number B|S| . The Bell numbers increase super-exponentially, and for larger sets S, the search space of the optimization problem (4) becomes quite large. For smaller problems, enumerating all partitions in order to find the maximum is still feasible. For larger problems, one would need a better understanding about the optimization problem. For reference, some Bell numbers include: n 3 4 6 10 Bn 5 15 203 115975 . As always, symmetries may help, and so in the C OPY example discussed below, where |S| = 4, it suffices to study six functions instead of B4 = 15. We now compare the measure I min , an extractable version of Williams and Beer’s measure Imin (see Equation (5) f an extractable version of the measure SI f proposed in [1]. For the latter, we briefly above), to the measure SI, recall the definitions. Let ∆ be the set of all joint distributions of random variables (S, X1 , X2 ) with given state 10 TABLE I Shared information about f (X1 , X2 ) for various functions f (in bits). f C OPY A ND/O R Imin I min f SI f SI 1 1 0 1/2 3/4 log 4/3 3/4 log 4/3 3/4 log 4/3 3/4 log 4/3 X OR 0 0 0 0 S UM 1/2 1/2 1/2 1/2 X1 0 0 0 0 f1 1/2 1/2 0 0 spaces S, X1 , X2 . Fix P = PSX1 X2 ∈ ∆. Define ∆P as the set of all distributions QSX1 X2 that preserves the marginals of the pairs (S, X1 ) and (S, X2 ), that is,  ∆P ..= QSX1 X2 ∈ ∆ : QSX1 = PSX1 , QSX2 = PSX2 , ∀ (S, X1 , X2 ) ∈ ∆ . Then, define the functions fI(S; X1 \X2 ) ..= min IQ (S; X1 |X2 ), U Q∈∆P fI(S; X2 \X1 ) ..= min IQ (S; X2 |X1 ), U Q∈∆P f SI(S; X1 , X2 ) ..= max CoIQ (S; X1 , X2 ), Q∈∆P f CI(S; X1 , X2 ) ..= I(S; X1 X2 ) − min IQ (S; X1 X2 ), Q∈∆P where the index Q in IQ or CoIQ indicates that the corresponding quantity is computed with respect to the joint f satisfies the Blackwell property and the identity axiom [1]. distribution Q. The decomposition corresponding to SI f= f SI f can be characterized as the smallest measure fI is left monotonic, but SI f is not [2]. In particular, SI 6 SI. U f is the smallest left monotonic measure of shared of shared information that satisfies property (∗). Therefore, SI information that satisfies property (∗). Let X1 = X2 = {0, 1} and let X1 , X2 be independent uniformly distributed random variables. Table I collects values of shared information about f (X1 , X2 ) for various functions f (in bits). The function f1 : {00, 01, 10, 11} → {0, 1, 2} is defined as f1 (X1 , X2 ) :=   X1 ,  2, if X2 = 1, if X2 = 0. The S UM function is defined as f (X1 , X2 ) := X1 + X2 . Table I contains (up to symmetry) all possible non-trivial functions f . The values for the extractable measures are derived from the values of the corresponding non-extractable measures. Note that the values for the extractable versions differ only for C OPY from the original ones. In these examples, I min = Imin , but as shown in [5], Imin is not left monotonic in general. 11 VII. C ONCLUSIONS We introduced a new measure of shared information that satisfies the left monotonicity property with respect to local operations on the target variable. Left monotonicity corresponds to the idea that local processing will remove information in the target variable and thus should lead to lower values of measures which quantify information about the target variable. Our measure fits the bivariate information decomposition framework; that is, we also obtain corresponding measures of unique and synergistic information. However, we also have shown that left monotonicity for the shared information contradicts the Blackwell property of the unique information, which limits the value of a left monotonic measure of shared information for information decomposition. We also presented an alternative interpretation of the construction used in this paper. Starting from an arbitrary measure of shared information SI (which need not be left monotonic), we interpret the left monotonic measure SI as the amount of shared information that can be extracted from S by local processing. Our initial motivation for the construction of SI was the question to which extent shared information originates from the redundancy between the predictors X1 and X2 or is created by the mechanism that generated S. These two different flavors of redundancy were called source redundancy and mechanistic redundancy, respectively, in [4]. While SI cannot be used to completely disentangle source and mechanistic redundancy, it can be seen as a measure of the maximum amount of redundancy that can be created from S using a (deterministic) mechanism. In this sense, we believe that it is an important step forward towards a better understanding of this problem and related questions. A PPENDIX : C OUNTEREXAMPLE IN T HEOREM 1 Consider the joint distribution f (s) s x1 x2 Pf (S)SX1 X2 0 0 0 0 1/4 0 1 0 1 1/4 0 0 1 0 1/8 0 1 1 0 1/8 1 2 1 1 1/4 and the function f : {0, 1, 2} → {0, 1} with f (0) = f (1) = 0 and f (2) = 1. Then, X1 and X2 are independent uniform binary random variables, and f (S) = A ND (X1 , X2 ). In addition, S − f (S) − X1 is a Markov chain. By symmetry, the joint distributions of the pairs (f (S), X1 ) and (f (S), X2 ) are identical, and so the two channels f (S) → X1 and f (S) → X2 are identical, and, hence, trivially, one is a garbling of the other. However, one can check that the channel S → X1 is not a garbling of the channel S → X2 . This example is discussed in more detail in [13]. R EFERENCES [1] N. Bertschinger, J. Rauh, E. Olbrich, J. Jost, and N. Ay, “Quantifying unique information,” Entropy, vol. 16, no. 4, pp. 2161–2183, 2014. [2] J. Rauh, N. Bertschinger, E. Olbrich, and J. Jost, “Reconsidering unique information: Towards a multivariate information decomposition,” in Proc. IEEE ISIT, 2014, pp. 2232–2236. 12 [3] P. Williams and R. Beer, “Nonnegative decomposition of multivariate information,” arXiv:1004.2515v1, 2010. [4] M. Harder, C. Salge, and D. Polani, “A bivariate measure of redundant information,” Phys. Rev. E, vol. 87, p. 012130, Jan 2013. [5] N. Bertschinger, J. Rauh, E. Olbrich, and J. Jost, “Shared information — new insights and problems in decomposing information in complex systems,” in Proc. ECCS 2012. Springer, 2013, pp. 251–269. [6] V. Griffith and C. Koch, “Quantifying synergistic mutual information,” in Guided Self-Organization: Inception, M. Prokopenko, Ed. Springer Berlin Heidelberg, 2014, vol. 9, pp. 159–190. [7] M. Wibral, V. Priesemann, J. W. Kay, J. T. Lizier, and W. A. Phillips, “Partial information decomposition as a unified approach to the specification of neural goal functions,” Brain and Cognition, vol. 112, pp. 25 – 38, 2017, perspectives on Human Probabilistic Inferences and the ’Bayesian Brain’. [Online]. Available: http://www.sciencedirect.com/science/article/pii/S027826261530021X [8] A. J. Bell, “The co-information lattice,” in Proc. Fourth Int. Symp. Independent Component Analysis and Blind Signal Separation (ICA 03), 2003. [9] W. McGill, “Multivariate information transmission,” IRE Trans. Inf. Theory, vol. 4, no. 4, pp. 93–111, 1954. [10] D. Blackwell, “Equivalent comparisons of experiments,” The Annals of Mathematical Statistics, vol. 24, no. 2, pp. 265–272, 1953. [11] U. Maurer and S. Wolf, “The intrinsic conditional mutual information and perfect secrecy,” in Proc. IEEE ISIT, 1997. [12] V. Griffith, E. K. P. Chong, R. G. James, C. J. Ellison, and J. P. Crutchfield, “Intersection information based on common randomness,” Entropy, vol. 16, no. 4, pp. 1985–2000, 2014. [13] J. Rauh, P. K. Banerjee, E. Olbrich, J. Jost, N. Bertschinger, and D. Wolpert, “Coarse-graining and the blackwell order,” arXiv:1701.07805, 2017.
7cs.IT
Department of Computer Science and Software Engineering Comparative Studies of 10 Programming Languages within 10 Diverse Criteria Jiang Li Concordia University Montreal, Quebec, Concordia [email protected] Mingzhi Liu Concordia University Montreal, Quebec, Concordia [email protected] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Sleiman Rabah Concordia University Montreal, Quebec, Concordia [email protected] Yuanwei Lai Concordia University Montreal, Quebec, Concordia [email protected] 1/139 This page was intentionally left blank COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 2/139 Abstract There are many programming languages in the world today.Each language has their advantage and disavantage. In this paper, we will discuss ten programming languages: C++, C#, Java, Groovy, JavaScript, PHP, Schalar, Scheme, Haskell and AspectJ. We summarize and compare these ten languages on ten different criterion. For example, Default more secure programming practices, Web applications development, OO-based abstraction and etc. At the end, we will give our conclusion that which languages are suitable and which are not for using in some cases. We will also provide evidence and our analysis on why some language are better than other or have advantages over the other on some criterion. 1 Introduction Since there are hundreds of programming languages existing nowadays, it is impossible and inefficient to put effort on analyzing each languages. But we can classify the some representative categories of languages and make deep research on them according to some certain criteria. Thus our research problem is aiming to compare and contrast 10 languages according to 10 specified criteria with the purpose of determining the suitability and applicability of the languages for each criterion, distinguish them their pros and cons, evaluate and explore the related features on those languages, illustrate the points either with code examples or related work. In our project, we will evaluate our languages based on following criteria: 1. Default more secure programming practices 2. Web applications development 3. Web services design and composition 4. OO-based abstraction 5. Reflection 6. Aspect-orientation 7. Functional programming 8. Declarative programming 9. Batch scripting 10. UI prototype design Depends on your choice of languages, some of them may have something in common on certain aspect while some part may totally different. 1.1 Related work In order to complete our comparison work, we do some relevant search among conference papers, text books, Wikipedia, official websites and discuss with classmate and teacher in courses. 1.2 Overview The rest of this paper is organized as follows. First we introduce the formatting basics in SecCOMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 3/139 tion 1.3 and Section 1.4. We then briey introduce the languages being compared in Section 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 1.12, and Section 1.13. Next, we present our analysis of the criteria in Section 2 for pair-wise comparison of the assigned languages. We then move on to macro analysis and synthesis of our results in a consolidated form in Section 3. We conclude and outline our future work plans in Section 4 and Section 4.1 respectively. 1.3 Programming Language 1.4 C++ C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. Some people say that C++ is a middle language because it has the features of high-level and low-level language. As one of the most popular programming languages in the world, C++ is widely used in the software industry.[1] C++ is also used for hardware designto analyze structure. Some of its application domains include systems software, application software, device drivers, embedded software, high-performance server and client applications, and entertainment software such as video games. 1.5 AspectJ AspectJ is a general-purpose Aspect-Oriented extension to java programming language [2]. It was created at Palo Alto Research Center Incorporated (PARC), now it is an open source project and part of the Eclipse Foundation. AspectJ has everything that Java has and more which means every valid Java program is also a valid AspectJ program [2]. The main goal of AspectJ development is modularizing crosscutting concerns such as logging, error checking and handling, synchronization, context-sensitive behavior, performance optimizations, monitoring and logging, debugging support, and multi-object protocols [4]. Aspect-oriented programming (AOP) is a programming paradigm built on top of the objectoriented paradigm and aims to modularize crosscutting concerns [2] by isolating secondary functions from the program’s business logic [3]. AOP enhances code readability and reuse. AspectJ compiler produces java bytecode, an AspectJ program can run on any Java compatible virtual machine. The runtime library “aspectjrt.jar” is required to run any AspectJ program. AspectJ development tool (AJDT) is a plug-in for the Eclipse IDE which can be used to compile and run AspectJ programs. 1.6 Haskell Haskell is an advanced, standardized, general-purpose purely functional programming language incorporating many recent innovations in programming language design. Haskell provides higherorder functions, non-strict semantics, static polymorphic typing, user-defined algebraic datatypes, pattern-matching, list comprehensions, a module system, a monadic I/O system, and a rich set of primitive datatypes, including lists, arrays, arbitrary and fixed precision integers, and floating-point numbers. In Haskell, a function is a primary control construct of the programming language. It allows rapid development of robust, concise, correct software. Haskell is easier to produce flexible, maintainable high-quality software due to its strong support for integration with other languages, builtin concurrency and parallelism, debuggers, profilers, rich libraries and an active community. [5] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 4/139 1.7 PHP PHP is a wide use general purpose scripting language which used to make dynamic interact web pages. It can embedded with HTML source document used in server side. Influenced by C, Perl, Java, C++, thus it support multiple paradigm in programming, such as object-oriented (OO) and imperative. In the meantime, its type system is loosing typing and dynamic type checking. As the updates of version, it supports more new features to make the PHP more functional and diversify. Now, the latest version is PHP 5.33, and will be used in the following. 1.8 Scheme Scheme is a general-purpose, functional and multi-paradigm programming language. Scheme derives some of its dialects and features from LSIP. Scheme is primarily intended to be a functional programming language; it supports lambda calculus, lexical scope and recursion. Today, Scheme is almost every where: it is used in many software development projects such as text editors, compilers optimization, expert systems, etc [9]. There are many implementations of Scheme providing different features [6] based on IEEE Scheme standards. The Gambit project provides the Gambit-C compiler as part of Gambit programming system. Gambit-C generates portable C code and executable [7]. PLT Scheme (known as Racket project) is one of Scheme implementations which provides a massive set of libraries for supporting many features such as GUI, macros, classes and objects and many more [8]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 5/139 1.9 Groovy Groovy is an agile and dynamic language for the Java Virtual Machine. It has some features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform.[10] Groovy uses a Java-like bracket syntax. Groovy compiles into Java bytecode and extends the Java API and libraries. It runs on Java 1.4 or newer. Most Java code is also syntactically valid Groovy.Groovy support XML and HTML. 1.10 Java Java is a powerful, platform independent, object-oriented, strongly-type, interpreted and compiled, general-purpose programming language with build-in automatic memory management. It is a programming language originally developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. It is intended to let application developers "write once, run anywhere". Java is currently one of the most popular programming languages in use, and is widely used from application software to web applications. [11] 1.11 JavaScript JavaScript is a small, lightweight, prototype-based object-oriented, interpreted, cross-platform scripting language. Today, it is the most popular http://en.wikipedia.org/wiki/Scripting_languagescripting language on the internet, and works in all major browsers, such as IE, Firefox, Chrome, Opera, and Safari. JavaScript was designed to add interactivity to HTML pages and usually is embedded directly into HTML pages. But it may also be used at outside webpage, such as server side. 1.12 Scala Scala is a general purpose programming languages which support multiple paradigms. It extends the object-oriented characteristic with functional extension. It integrated many other languages features to itself. It is designed to express common programming patterns in a concise, elegant, and type-safe way [12]. The Scala run its code on the JVM, which is byte code compatible with Java. That is to say you can utilize all the libraries or existing resource in Java. This not only can benefit the java programmer to make productive and efficient product using Scala, it gives a higher start point for Scala completive with other programming languages. Although it seems Scala integrate with Java seamlessly, Scala is not a subset of java, it has much more features rather than Java. Now the latest version of Scala is 2.80. And will be used in the following. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 6/139 1.13 C# C# is modern, general-purpose and multi-paradigm programming language enclosing objectoriented, imperative, functional, generic, event-driven and component-oriented programming styles (DLLs and Assemblies). It was designed by Andres Hejlsberg (the creator of Turbo Pascal), developed by Microsoft and first released in July 2000. C# was developed specially for the .NET platform with a main goal to provide a simple, powerful and a strongly-typed programming language allowing programmers to quickly build a wide range of applications for the .NET platform [13]. The .NET platform is composed of a Common Language Runtime (CLR) and a large rich class library known as the .NET Framework (DLLs files). The .NET Framework provides a wide powerful range of features, among them: multi-threading, user interface prototyping, database connectivity, web application and service-oriented application development. The CLR is the core component of the .NET platform and the execution environment in which all the managed code runs. The CLR is the Microsoft’s JVM equivalent that supports several programming languages and performs services such as memory management, exception handling, garbage collection, security and interaction with the operating-system services. The CLR provides a common development environment enabling developers to build applications using different languages such as C#, VB, C++, F# and Python, etc. C# code source is compiled to an intermediate language presentation called Microsoft Intermediate Language (MSIL) and it is the Java byte-code’s equivalent. MSIL is translated into machine code by the CLR at run-time. C# has an advantage over Java which is high interoperability with other languages such as C/C++, Python, VB.NET, etc [14]. C# can be used to develop the following types of applications [14]: • Command line application, aka console applications with a text-based interface (text user interface), that can be run using a Command Line Interface e.g MS DOS. • Windows applications for developing GUI using Windows Forms or the new Windows Presentation Foundation (WPF) which is first released with the .NET Framework 3.0 that enables rendering user interfaces. • Web applications such as Websites using ASP.NET technology, Web Services and serviceoriented application using Windows Communication Foundation (WCF) framework. The .NET Framework needs to be installed in order to run application written in C#. Microsoft’s Visual C# Integrated Development Environment (IDE) is used to create such applications. It provides a set of built in tools such as a C# compiler, a user interface designer for web and GUI development and also a powerful debugger. C# has been approved as a standard by the European Computer Manufacturers Association (ECMA) (ECMA-334) [15] [13]. Mono is an open source project which aims to create a cross-platform implementation of the .NET platform based on the EMCA standard. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 7/139 2 Analysis 2.1 AspectJ vs C# 2.1.1 Source code size The following examples consist of the Hello World program; they also show AsepctJ and C# syntax. We conclude that both languages have nearly the same syntax. Thus, the source code size is little bigger in AspectJ in this examples but also the have nearly the same compilation time. /** * Example illustrating a simple aspect * * @author Sleiman Rabah */ public aspect HelloFromAspectJ { // Intercepts the main method execution pointcut mainMethod() : execution(public static void main(String[])); // Will be executed at the end of the main method after() returning : mainMethod() { System.out.println("Hello from AspectJ"); } } /** * A Java class. * * @author Sleiman Rabah */ public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world!"); } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 8/139 Hello word program in C# showing its syntax. Hello word program in C# showing its syntax. using System; // A "Hello World" program in C# namespace HelloWorld { /// <summary> /// <autor>Sleiman Rabah</autor> /// </summary> class Hello { static void Main() { System.Console.WriteLine("Hello World!"); } } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 9/139 2.1.2 Default more secure programming practices “Our civilization runs on software” __ Bjarne Stroustrup Our reliance on software to automate things has resulted in including software in every industry from healthcare, education, aviation to defense. But the question remains how often programs don’t correctly work due to software bugs? And, can we develop better more robust software? Most of software bugs come from data mishandling (data conversion), unnecessary code and unsecure input and output handling. AspectJ and C# are both strongly-typed languages and were designed to be secure; hence their type systems play a very important role in developing secure programs by ensuring the type-safety. AspectJ is statically typed language, but it does support some kind of dynamic typing such as down casting. Since .NET 4.0, C# supports dynamic-type checking after the introduction of the dynamic keyword. Dynamic type-checking can be disabled in C# by using an unsafe code block marked as unsafe (using the keyword unsafe)[16]. AspectJ and C# also derive a set of features from C and C++ except pointers which has eliminated a major problem: manual memory management. The JVM and the CLR have similar run-time services. As part of their specification, they manage code execution, automatic memory management (Garbage Collection, memory allocation and de-allocation) and exception handling. Garbage collection is an automatic memory management mechanism; it eliminates some bugs related to manual memory management such as dangling pointers and double free bugs (freeing a pointer twice) [17]. Both AspectJ and C# provide an exception handling mechanism allowing preventing application from crashing at run-time. Contrarily to AspectJ/Java primitive data type, C# has value types (used to store values) which are objects found in the System namespace [18]. Run-time bounds checking are provided by both Aspect and C# [19]. Bounds checking are used to control data structure manipulation such as arrays. To ensure total safety in AspectJ applications, programmers have to be well experimented when expressing crosscutting. A minimal logical mistake can result in total system failure [20]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 10/139 Default more secure programming features, AspectJ vs C# Feature Memory management Bounds checking Static Type checking Dynamic Type checking Type safety Exception handling Compiled/Interpreted Conditional compilation Assertions AspectJ Yes, provided by the JVM C# Yes, provided by the CLR Yes, also for array bounds Yes, for arrays and data (raise IndexOutOfRange structure. exception), buffer overflow. It can be disabled in C# [25] Yes, at compile time. Yes at compile time. Partial dynamic checking, Yes, since C# 4.0 i.e down casting. Also, (.NET System.Dynamic when using reflection. namespace) Yes, C# is strongly typed. Yes, Based on Java’s access The unsafe keyword can be rules. used for allowing pointers use. Yes, exceptions can be thrown in pointcuts. Yes, Within tryHandlers are used to catch catch/finally block. exceptions in AspectJ. Multiple catch blocks is Within try-catch/finally supported in C#. block in Java code. Compiled, and the JavaCompiled, Interpreted by byte code interpreted by a the CLR JVM compliant. Yes (using SCoPE Yes (using preprocessor compiler, conditional directives)[21] pointcut evaluator) [23] Yes, temporal assertions at Yes, Managed code run-time[24] assertions [22] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 11/139 2.1.3 Web applications development ASP.NET/C#: As part of the .NET Framework, ASP.NET is a new web development model and the successor of Aspect Server Pages (ASP) technology. ASP.NET enables developers to build a wide variety of secure server-side and browser-based applications such as e-commerce, dynamic websites, and e-learning applications. ASP.NET is compiled and run on the .NET platform where it takes advantage of the CLR secure and powerful environment and its multi-programming languages support. ASP.NET is more and more widely used in software industry thanks to the Visual Studio .NET IDE which is excellent for rapidly building variety of applications in a Rapid Application Development (RAD) environment. C# language is mainly and heavily used to develop such applications due to its power, features and simplicity. There are plenty of open source web applications project written in C# and ASP.NET that can be found in the Codeplex [26] repositories such as Customer Relationship Management (CRM) “e.g ASP.NET CRM” [27], Content Management System (CMS) and e-commerce such as nopCommerce which is the best available open source .NET based solution, also written in C# [28]. ASP.NET has received a lot of criticism because it was first released with a Technology called Web Forms technology which aims to separate HTML code and stuff from application logic, and reduce code by using the data binding capabilities of the server-side .NET control. Web Forms applications are not flexible, but difficult to test and not extendable because they use what is called server-based forms. ASP.NET MVC was released first in 2007 as an alternative to the Web Forms that enables creation MVC-based web applications. AspectJ/J2EE: Java 2 Platform Enterprise Edition (J2EE) technology is not only suited to build dynamic websites but also enterprise applications and server applications. Its simplicity, complete portability on any operating-system and design made it widely popular. J2EE includes/uses APIs such as Java Database Connectivity (JDBC) Database Connectivity which allows applications to interact with databases, Remote Method Invocation (RMI) for building distributed applications and many more. Java security and portability makes J2EE to be the first choice for developing online banking systems and transactional/e-commerce web applications. AspectJ can be applied/coupled to J2EE in the development of web applications where aspects are used to isolate secondary concerns (such as error-handling and logging), improve the flexibility of your code and reduce the code source size [29]. AspectJ/J2EE applications are clean, easy to maintain and to debug. SpringSource dm Server is open source solution which is used to develop enterprise applications that use AspectJ in order to either simplify enterprise application or implement different crosscutting functionalities. AspectJ is heavily used with Spring Framework [30]. AspectJ can be used in Java Servlet [31] AspectJ/J2EE vs C#/ASP.NET: J2EE is more mature than ASP.NET [32], thus, it supports AOP using different tools/language such as AspectJ and JBoss AOP framework and it has been adopted by various firms and foundation such as IBM, SAP, Oracle and Apache Software Foundation for developing a wide range of server applications such as WebSphere. Because of Microsoft’s products bad reputation in term of security, Java applications became more popular to adopt in developing critical web applications, but it seems that the new .NET infrastructure has been evolved where new security features have been introduced to the .NET framework and CLR environment such as role-based security and authentication. ASP.NET applications are deployed on Microsoft’s Internet Information Services (IIS) and requires the .NET platform to be installed. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 12/139 Web applications: AspectJ vs C# Feature Dynamic Web Pages Web Server Web Framework/Libraries Session management Security Model-View-Controller Database interaction Secure Sockets Layer support AspectJ Yes, injection Aspectj code in JSP pages Tomcat, JBoss, GlassFish Using J2EE, Spring or Struts framework. Yes, i.e using Spring which provides SessionManagementFilter class and concurrency control [33]. Yes, Java web applications run in what is called container, Each application has its container. Thus, the JVM add By adding AspectJ’s aspects to J2EE/Spring/Struts applications. C# Yes, as code behind ASP.NET web pages. IIS on Windows OS Mono (Apache, Nginx) Using .NET Framework on Windows and Mono ASP.NET Linux and Unixbased OSs. Yes, provided by ASP.NET State management. Yes (ASP.NET Security Architecture [sr-4]) ASP.NET MVC 1.0/2.0 Yes, using ADO.NET library Yes, SSL certificate can be Yes using OpenSSL library. generated and used to on IIS server. Yes, using the JDBC library COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 13/139 2.1.4 Web services design and composition AspectJ doesn’t provide an API for building web services, but it can be very useful in combination with other framework like spring [30] for building web applications. Web Services, can be seen also as distributed distant programs that communicate together via HTTP. A distributed system is a collection of independent computers that appears to its users as a single coherent system [35]. One program can be piped to another and so on resulting in kind of a complex program’s network. As results, many issues will obviously appear and force programmers to take in consideration. Some of these issues are: communication, fault tolerance, synchronization and security [36]. AOP is the solution to reduce distributed systems’ complexity and improve their efficiency by modularizing crosscutting concerns mentioned before. A group of aspects can be added to an existing system with a main task to observe the system’s pipeline. For example, “when part of the system fails, a new behaviour emerges which uses certain aspects along with the rest of the system” [36]. .NET Framework provides the System.Web.Services namespace which enables programmers to write XML Web Services (WS) that are available over the Web. Windows Communication Foundation (WCF) is an API for building service-oriented applications (SOA) in a unified programming model; it was released with .NET 3.0. WCF is based on the SOA principles which enable distributed applications to communicate together via SOAP messages. Visual Studio IDE is a great tool to create Web Services: the WSDL file is generated and maintained automatically as soon as the code changes, also it provides tools for testing and debugging a WS at run-time [37]. Microsoft BizTalk Server provides services to services that enable different distributed applications/web services to communicate together. BizTalk is based on adapters that support different communication protocol such as HTTP, FTP and SOAP [37]. Unfortunately, the .NET solution is not flexible enough and it is far from benefiting from the AOP approach to modularize crosscutting concerns. There are no mainstream AOP solutions that are suitable for the .NET framework. AspectJ is a cross-platform language that can run on any platform and can be coupled with Java’s technology for building either web applications or distributed ones. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 14/139 Web Services: AspectJ vs C# Feature Web Services including(SOAP, WSDL, UDDI) AspectJ Yes. i.e using Apache XML-RPC for Java library [38] or Spring Web Services, JAX-WS 2.1) Web services security Yes. HTTPS, above libraries support “XMLbased standards” such as WS-Policy, WS-Security and WS-Transfer standards) Web Services pipeline watching. Using AspectJ and J2EE framework, two or more web services can communicate together by linking them as a network. Web Services composition COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai C# Yes. using ASPT.NET web services and .NET’s System.Web.Services namespaces for Windowsbased WS [42] and Mono project’s Web Services on other OSs (Linux/Unix, Mac) Yes, HTTPS Encryption and signing with SSL[39], WS-Policy, WS-Security standards support) Using ASP.NET web services. Also a network of web services is possible by making two or more WS talking together. 15/139 2.1.5 OO-based abstraction AspectJ is an aspect-oriented programming language; it is an extension to OO. “Aspects are the central unit in AspectJ” [2]. Aspects and classes have many similarities: they share some common elements such as methods and fields, but also aspects introduce the one that is related to AOP: pointcuts and advices. Like classes, an aspect can be extended, but only abstract aspects can be extended. Unlike classes, the main goal of using aspects is to modularize crosscutting concerns. C# is a pure object-oriented programming language; in C# everything is an object. Every declared type (object) implicitly or explicitly inherits from the System.Object class. It supports all object orientation concepts: abstraction (classes), encapsulation, polymorphism and inheritance. Also, C# supports interfaces, abstracts classes and has introduced partial classes (the class’s source code can be split over two or more files) [41]. Multiple inheritance is not supported in C#. C# provides properties, also called accessors (Java’s getter and setter equivalent) which are class members that provide access either to read or write private fields’ values. C# is suitable to build object-oriented-based applications. C# is designed to be an object-oriented while AspectJ is designed as an aspect-oriented. OO-based abstraction, Aspectj vs C# Feature Central unit AspectJ Structural elements Pointcuts, Advices, InterType declarations for declaring aspect’s members (fields, methods, and constructors) Aspects, abstract Aspects Multiple inheritance No (Aspect Inheritance) Polymorphism Partial Classes Structs support Instantiation Aspectual polymorphism [44]. Method overloading, method overriding, virtual method. By default AspectJ methods are virtual (nonstatic methods). Using Inter-type declaration. No, but it provides Intertype declarations (aka open classes) as alternative. No, doesn’t support Structs declaration. Aspect instantiation: not COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai C# Classes, interfaces, abstract classes Constructors, Destructors, Methods, Fields (attributes), Delegates, Properties, Indexes, Events, Finalizes, Operators, Nested Classes. No, can be done by using Interface implementation as work around. Yes, through inheritance, based on Base Type and Sub Type relation. Method overloading, method overriding. C# provides the virtual Keyword which is derived from C++. Yes, separation of code (class definition split into two or more source files. Yes, derived from C++ with enhanced features. Yes, Class instantiation 16/139 Extension/Inheritance Accessibility control directly instantiated. You cannot use the new keyword to instantiate an aspect. Yes, “Aspect extension” Aspects can extend classes and implement interfaces, but Aspects can extend only abstract Aspects. Yes, privileged for Aspects, private, public and protected for inter-type members. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai using the new keyword. Yes, “class extension”. A class may extend another class and may implement one or more interface. Extension methods feature is supported since C# 3.0 but it requires a static class and static method to do so [43]. Yes, C# provides private, public, protected, internal, sealed and protected internal keywords. 17/139 2.1.6 Reflection In AspectJ, join point information is accessed via reflection. There are two types [2]: • dynamic information (dynamic crosscutting): this type of information changes after each call of the same join points. Dynamic information result in the program’s dynamic flow. • static information (static crosscutting): is said fixed and doesn’t change between multiple execution. AspectJ provides three objects to be used in advice body: thisJointPoint, thisjoinPointStaticPart, thisEnclosingJoinPointStaticPart. These objects are similar to this keyword in C# or Java which provides access to the current object being executed [2] [45]. Since AspectJ 5, a new reflection API is provided similar to java.lang.reflect package. To use this API, code should be compiled by the AspectJ 5 compiler and runs under Java 5 environment [46]. .NET components are pre-compiled modules with a .DLL extension (Dynamic Link Library), they are also known as assemblies which are the smallest unit of execution in the CLR environment. Thanks to the .NET CLR dynamic services, especially the loader manager, these components can be loaded at run-time into the memory and used by different applications directly or through reflection [47]. C# allows reflective programming in different manners. Reflection in C# can be used for loading assemblies (DLLs) in order to instantiate some of their types. Custom Attributes, which are a special form of customizable code annotation and an extension to the reflection model “similar to Java 1.5 annotation”, contain metadata information that can be attached to classes or methods and they are accessed at run-time through reflection. The .NET framework provides the System.Reflection.Emit namespace for code generation at run-time “emitting dynamic methods and assemblies”. This namespace provides developers many capabilities such as define assemblies at run-time and saving them to disk, define new types and create instances of these types also at run-time and so on [47]. There are some Java’s equivalent libraries available that can be used in AspectJ applications such as ASM http://asm.ow2.org and BCEL http://jakarta.apache.org/bcel. These libraries provide similar services to the .NET’s Reflection.Emit namespace for generating byte-code at run-time. Accessing information dynamically is not suggested in certain applications; reflection has a poor performance and it is unsafe without static type checking [2]. C# provides more features to do reflective programming than AspectJ. AspectJ is not flexible enough to create or modify aspects on the fly (at run-time). For code security reason, AspectJ’s joint cuts have to be well tested since they are plugged in a way to the program flow which is difficult to do using reflection. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 18/139 Reflection, AspectJ vs C# Feature Access to program’s metadata AspectJ Yes, since AspectJ 5.0. Annotation-based development style. C# Yes, accessing Attributes through reflection using System. Reflection namespace. Yes, using .NET’s System.Reflection.Emit namespace. AspectJ doesn’t provide such feature. Can be done using the following librairies. ASM http://asm.ow2.org and BCEL http://jakarta.apache.org/bcel. Dynamic method invocation Using thisJoinPoint to access Yes, method invocation at the current join point for the run-time through reflection advice through reflection. [48]. Generation code at run-time COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 19/139 2.1.7 Aspect-orientation AspectJ, natively, is an aspect-oriented programming language. AspectJ implements the joint-point model and inter-type declaration implementation. AspectJ has been adopted as a mainstream programming language and there are numerous articles that have been written about it [49]. It is an active project and it is present in many important development projects and domains such as banking systems and web transactional applications where security and logging are implemented in a modular way using aspects [4]. C# doesn’t officially provide an implementation of AOP. There are some open source projects [51] but it seems there are no longer active. As it mentioned on the AspectDNG project’s website: “the project is not supported any more due to .NET rapid changes” [50]. Due to the .NET platform closed source and its proprietary license. Aspect-orientation, AspectJ vs C# Feature Aspect-oriented programming Modularity AspectJ Natively, it is an aspectoriented programming language Isolate crosscutting concerns in a modular way. C# Partially, there are some nomainstream projects implementing AOP for C#. It is Difficult some times impossible to isolate crosscutting concerns from the program’s business logic. Can produce pure uncoupled code Can’t isolate code that crosscut over modules. Partially, can be done using DLLs in order to reduce code coupling degree. Not applicable since there is no mainstream AO solution for C#. Code reusability Security Securing UI by detecting Single-Thread UI’s rule and web services pipelines failure. Errors handling/Logging Cleaner way to handle and log exceptions COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Exceptions are handled in try-catch blocks and logged within this scope. 20/139 2.1.8 Functional programming C# and AspectJ are both imperative programming language which means a program written in one of them consists of sequence of steps/commands that should be executed one by one (step by step), so programs can be seen as a sequence of operations. C# supports generic classes, generic delegates which are object-oriented and type-safe functions pointers (similar to function pointers in C++) and anonymous methods [52] which is an advantage over AspectJ (see Example #1 below). AspectJ doesn’t support delegates but does support generic classes. Also, AspectJ doesn’t allow passing a function as parameter to another function. Some functional programming style in AspectJ can be done either by using libraries or by using higher-order functions and lazy functional programming [53]. Interfaces and inner classes can be used as a work around to pass functions as parameters [54]. This practice is not encouraged since this will result in a code much bigger and complex which is not easy to understand by someone who is not familiar with functional programming. C# has more features for supporting functional programming than AspectJ. Language integrated query (LINQ) has been released with the .NET Framework 3.5 which provides a powerful way to query data in a functional programming style [55]. Recursion is another concept of functional programming that requires functions, also methods, to invoke themselves. C# does support recursion without issues [56] while using it in AspectJ has resulted in major problem: infinite recursion. “if no special precautions are taken, aspects which advise other aspects can easily and unintentionally advise themselves.” [57] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 21/139 Functional programming features: AspectJ vs C# Feature Type inference Lambda expression Anonymous methods Higher-order functions Closure First-class functions(delegates) Recursion AspectJ C# No, planned for Java 7 Yes, functional programming’s features have been introduced in C# 3.0 Yes, since C# 3.0 using LINQ library and System.Linq.Expression namespace Yes, since C# 2.0 where functional programming features has been introduced. Yes using C# delegates. Using interfaces as a work around. No, use inner classes as work around Using interfaces as work around No, not popular enough an open source project for OpenJDK [58]) No, AspectJ doesn’t support delegates, lazy functional programming can be used as work around [53]. Not secure as in C# [57] due to infinite methods loop. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Yes, since C# 3.0 Yes, delegates are C++’s function pointers equivalent. Yes it is fully supported. Can be done using C#’s methods. 22/139 Example #1: An example showing how to use anonymous functions in C# using System; namespace Program { /// <summary> /// <autor>Sleiman Rabah</autor> /// </summary> class Program { static void Main() { // Anonymous function to calculate the square of // two integer. //the first int is the x' type //the second int is the return type Func<int, int> square = x => x * x; Console.WriteLine(square(7)); // Will output 49 } } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 23/139 2.1.9 Declarative programming AspectJ and C# enable programmers to specify metadata that can be associated to some elements in the source code and can be retrieved/consulted at run-time through reflection. They both provide a mechanism to define declarative tags that can be added to classes, methods or variables. This mechanism enables declarative programming style to be used in both languages. It consists in declaring data and rules rather than coding them explicitly. AspectJ provides what is called Annotations [59] while C# provides Attributes [60]. Programmers can use pre-defined Annotations or Attributes and also they can create their own customized ones. C# does better support declarative programming than AspectJ since it provides ways to mix imperative and declarative code using LINQ. LINQ can be used to query data from databases (LINQ to SQL), XML (LINQ to XML) and many more [55] (see Example #2 below). Also, C# 4.0 has introduced dynamic programming with the dynamic keyword which can be used to work on data type. Some new technologies have introduced new ways to build UIs based on declarative programming principles such as XAML which was invented by Microsoft for the .NET Framework [61]. Also there are plenty of open source project which are equivalent to XAML and provide the same features as XAML does. Among them we find YAML [62] which is widely used to build AspectJ Swing GUIs. Using these languages, developers can define UI’s elements and their properties outside the source code. Declarative programming, AspectJ vs C# Feature Tags on methods/fields/classes LINQ equivalent? Dynamic programming (Dynamic type checking) Declarative programming based on XML [41] AspectJ C# AspectJ/Java Annotations C# Attributes Yes, system.data.linq library should be used and referenced. Yes – since C# 3.0 (var No, AspectJ doesn’t provide keyword) and C# 4.0 such features. (dynamic keyword) YAML, SwiXML Using XAML technology which is available since .NET 3.0 and WPF Additional libraries, lamdaJ [63] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 24/139 Example #2: An example showing declarative programming using C# and LINQ using System; using System.Collections.Generic; // Importing the LINQ DLL using System.Linq; using System.Text; namespace LinqSample { /// <summary> /// <autor>Sleiman Rabah</autor> /// </summary> class Program { static void Main(string[] args) { // Check if a number in a list of integer is odd using LINQ // if yes it will result in a list of odd numbers List<int> collection = new List<int> { 1, 2, 3, 4, 5, 6, 7 }; var results = collection.Where(num => num % 2 != 0); foreach (var num in results) { Console.WriteLine("Results:" + num); // Will output 1,3, 5, 7 } // Using "SQL" style to print element from an array // which are <= to 7 using LINQ int[] numbers = { 3, 2, 13, 15, 5, 7}; var lowNums = from n in numbers where n <= 7 select n; Console.WriteLine("Numbers <= 7:"); foreach (var num in lowNums) { Console.WriteLine(num); } } } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 25/139 2.1.10 Batch scripting Console applications, or command line applications (CLA), are programs that take commands and arguments as input, process them and output result/display messages at the command line. CLA often are executed from the command line and are said text-based applications which use a TUI (stands for Text User Interface) to interact with users/other programs using system calls in order to read their commands from the command line and achieve certain tasks like processing files, querying databases, etc. Before commands processing, commands and arguments are checked and validated to be sure that they meet certain constraints. Example of validation can be arguments’ data type, commands names whether if they are syntactically correct, arguments count for a given command and so on. CLA can be done using both AspectJ/Java and C# [64] they both provide this possibility: commands and arguments are received as parameters at the program’s entry point which is the main method, usually they are received as an array of strings. The only difference is that the main method name has to be capitalized due to the C#/.NET naming convention (Pascal case) [65]. The method main signature is as follow: AspectJ: public static void main(string[] args) C#: public static void Main(string[] args) Building CLA using both languages is a secure solution since they both are type-safe and they provide an exception handling mechanism which can be used when processing commands. While processing a file for example, an exception can be thrown and the program will stop executing. These type applications have some limitations [66]: they are not flexible enough because they are compiled and usually deployed as executables with extension .exe in case of C# and a .jar in case of Java. If any changes in the code have been done in an existing application/program, it has to be recompiled and re-deployed for the changes to take place which is often a disadvantage since all users have to be notified about changes and required to update their installed copies. There are also other limitations: they are not user-friendly and they usually target a set of trained/experimented users. On the other hands, because they are efficient and they run faster, console applications are suitable for applications that need bigger processing resources especially because there are no graphics rendering/drawing and so on [66]. Also, both languages AspectJ/Java and C# enable to developers to write programs that can invoke/execute external commands and programs. One program can execute another program while it runs, to do so, a program creates a process to run the desired program (as illustrated in example #3 below ). Pipeline can be used to redirect CLA output to another command or CLA. For example, under Linux operating system, we can run a CLA and use the grep command. e.g [prompt]$ java myProgram | grep [search pattern] AspectJ can be coupled with Java to build a wide variety of CLA or added to an existing application in order to advantage of AOP in such application. Exception can be logged in files using AspectJ to be later analyzed and debugged. CLA written in AspectJ or C# can be automated and scheduled to be executed at a given point in time. Script automation is a useful and common way to automate things such as daily reports generation, job alerts and so on. This can be done using Scheduled Tasks tool in Windows or using crontab on Linux/Unix system. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 26/139 AspectJ is more suitable/better to build and deploy portable (cross-platform) CLA since such applications can profit from the AOP’s features and AspectJ’s portability. Batch scripting, AspectJ vs C# Feature Run external programs/external commands Tasks automation Accept command line arguments Need to be recompiled after changing the code source AspectJ Yes, using Java’s Process and Runtime classes. Yes, can be executed as stand alone and executed on a scheduled basis. Yes as parameters for the main method. C# Yes, using Process class in System.Diagnostics namespace. Yes, can be executed as stand alone and executed on a scheduled basis. Yes as parameters for the Main method. i.e i.e public static void main(string[] args) public static void Main(string[] args) Yes, code should be recompiled in order to source code changes take effect. Yes, code should be recompiled in order to source code changes take effect. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 27/139 Example #3 A simple example showing how to execute a program from another program in C# using System; using System.Diagnostics; using System.ComponentModel; namespace LaunchProcessSample { /// <summary> /// <autor>Sleiman Rabah</autor> /// </summary> class ProcessLauncher { public static void Main(string[] args) { // instantiate the System.Diagnostics.Process class Process myProcess = new Process(); try { // Tell whether the new process will be executed // using Shell or not myProcess.StartInfo.UseShellExecute = false; // Fill out the process name to be started: // often it is a program e.g: notepad myProcess.StartInfo.FileName = "notepad.exe"; myProcess.StartInfo.CreateNoWindow = true; // Run/launch the process myProcess.Start(); } catch (Exception e) { Console.WriteLine("A problem has occured while starting the process " + e.Message); } } } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 28/139 2.1.11 UI prototype design Abstract Window Toolkit (AWT) was the first Java’s technology/component set for building graphical user interfaces (GUI). AWT UIs were very slow to run with limited functionalities due to the small number of provided components. Just-in-time compilers (JIT) were introduced in order to improve applications’ execution and performance and Java Foundation Classes (JFC) technology was released also to improve productivity and to provide a new rich set of components. JFC provides a group of features and graphic functionalities that can be mixed together for building powerful and extendable desktop applications. Among these features are internationalization which enables to build applications that support different languages and cultural conventions, pluggable look-and-feel which allows to choose a look among wide choices of look and feel and themes on different platform/operating systems (GTK+, Motif, Windows, Macintosh) and many more. As part of JFC, Java Swing is an API which provides a set of GUI components such as buttons, tables, text box and features for printing, drag and drop, customizing components layout and many more [67]. AspectJ-based Swing enables developers to build either document interface (MDI) using the JdesktopPane container and JinternalFrames or single document interface (SDI) GUIs. The NetBeans IDE provides a user interface designer (UID) allowing developers to design/prototype GUIs. Also, there are some plug-in for the Eclipse IDE which can be used to design interfaces with Swing. On the other hand, the .NET Framework was first released with the Windows Forms (WinForms) API as a part of it. WinForms is not flexible enough and is said platform-dependent since it is built upon the Windows API (the famous WinAPI or Win32 API) which resulted in a bad design and it doesn’t support the model-view-controller architecture. To resolve this problem and push further the UI development, Microsoft has introduced the Windows Presentation Foundation (WPF) a new revolutionary technology for building platform-independent GUIs, [68]. WPF provides much better functionalities than Swing including animations, data templates, effects, templates and many more. Also, WPF is based on the XAML (Extensible Application Markup Language) which is a new declarative language where developers can either manually or using the UI designer describe/declare the properties of the UI’s controls and components without the use of the traditional imperative programming [68]. The main goal of XAML is to isolate the graphical content from the code which resulted in a cleaner and better understandable and maintainable code. WinForms and WPF are not part of .NET’s Base Class Library (BCL) which means they are not standardized as of the ECMA/ISO standards. To build applications using the WinForms the System.Windows.Forms.dll library should be used and referenced, same for WPF where the System.Windows.dll is required. AspectJ-based Swing is built-in Java and no libraries/references are needed to do so (it can be directly imported using the import keyword i.e import javax.swing.*)[68]. Visual Studio C# comes with a user interface designer (UID) and Toolbox which enable users to add control/components such as buttons, text box, menus, toolbars and so on to the design interface and set their properties and their events handlers. Swing, WinForms and WPF are popular and used in different development projects, but nowadays, Microsoft’s technologies are more popular and suitable to build desktop applications. WinForms or WPF have a high interoperability with the MS SQL Server database system. C# has a lot of advantages over AspectJ-based Swing for prototyping UIs, a WPF code can be simply embedded in a web ASP.NET application without any configuration since WPF can be executed in any browser [69]. There are some discussions and rumors over the web that AspectJ/Java Swing is dead and it is no longer used in development projects: before Java 1.5, Java Swing left a bad perception behind. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 29/139 Java Swing library has a single thread-safety rule: it uses a single thread to access all UI’s components through the event-dispatching thread [2, chap.11]. This restriction is a problem in complex applications, for example, if a thread is performing database queries and you want to update the UI components. AspectJ resolves this problem: you can write an aspect to detect any violations to this rule [2, chap.11]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 30/139 Comparing Java Swing and Windows Forms/WPF APIs Feature Graphical user interface Built-in? Look and feel 2D and 3D support Drag and Drop support Components’ Layout Management Multiple document interface (MDI) Model-View-Controller Declarative GUI development [41] Performance IDE/UI designer Rich Web UI Development Deployment Single thread of execution Event handling mechanism AspectJ Yes, using Java’s built-in Swing and AWT libraries. C# Yes, using .NET’s Windows Forms and WPF libraries. Built on top of the Base Class Library You need to import/reference Yes, part of Java System.Windows.Forms.dll for Foundation Classes WinForms and System.Windows.dll WPF. WPF only on Windows platform [70] Yes such as GTK+, Motif, Not flexible enough in WinForms. Windows, Macintosh, etc Full customizable UI support in themes. WPF Yes – Java 2D API Yes, using WPF framework Yes, using Java.awt.dnd Partially, only using WPF package. framework [71] Yes, this can be done Yes, i.e Border/Grid layout, automatically using Visual etc. Studio’s UI designer. Yes, using, Yes, provided by AWT System.Windows.Forms.MdiLayout class. Yes in components such as WinForms no, WPF Model-ViewJTable and JList, etc. ViewModel [72] Glade XML, SwiXML: not popular yet as much as Using XAML technology XAML Improved execution on windows Relatively Slow Fast Visual Studio C# and NetBeans, Plugins for SharpDevelop for Windows, Eclipse IDE MonoDevelop . Silverlight framework on windows Yes, using JavaFX and Moonlight implementation for framework. Linux and other Unix-based OSs. .NET Assemblies: (executables Jar archive (.jar files) and libraries, .exe and DLLs) Windows Forms (Not by default, but by applying the STAThread Yes, Swing library’s singleattribute to the Main method). thread rule, thread-safe[73] WPF use by default a single thread of execution. Only Event Listeners, Yes, Event Handlers and Delegates provided by java.awt.event support package COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 31/139 2.2 C++ vs Groovy 2.2.1 Source code size Hello world in C++ #include <iostream> using namespace std; int main(int argc, char *argv[]) { cout << "Hello, World!\n"; } Hello world in Groovy println "Hello, world!" COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 32/139 2.2.2 Default more secure programming practices First of all, C++’s type strength is strong. C++ language places severe restrictions on the intermixing that is permitted to occur, preventing the compiling or running of source code which uses data in what is considered to be an invalid way. Secondly, C++’s type safety is unsafe. C++ can discourage or prevent some type errors. For example, C++ can prevent result from attempting to perform operations on values that are not of the appropriate data type [74]. Thirdly, C++’s type checking is static. C++ allows many type errors to be caught early in the development cycle. It eliminates the need to repeat type checks every time the program is executed. Program execution may also be made more efficient by omitting runtime type checks and enabling other optimizations. But it has some disadvantage, E.g, C++ will reject some programs that may be well-behaved at run-time, but that cannot be statically determined to be well-typed [74]. Finally, C++ doesn’t have garbage collector, in some sense, it will cause dangling pointer bugs, double free bugs and certain kinds of memory leaks. First of all, Groovy’s type strength is also strong which means that Groovy specify one or more restrictions on how operations involving values having been executed. Secondly, Groovy’s type safety is also safe. It is just like C++ [74]. Finally, Groovy’s type checking is dynamic. Compare to C++, Groovy is more flexible but fewer guarantees, because Groovy accepts and attempts to execute some programs which may be thought as invalid by C++. Groovy may result in runtime type errors. Compare to C++, Groovy make fewer "compile-time" checks on the source code. On the other hand, Groovy’ type checking is more sophisticated [74]. 2.2.3 Web applications development C++ uses Wt and CppCMS as an open source web application framework to support the development of web applications. It supports Ajax ,template framework ,caching frameworks and security framework, but doesn’t support DB migration framework [76]. It also support MVC framework [75]. It provides SQL library and Wt::Dbo for ORM and uses boost. test in testing framework [76] [77]. This is a example of web application in C++: COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 33/139 // Displays the current date and time in a Web browser. #include <iostream> using std::cout; #include <ctime> // definitions of time_t, time, localtime and asctime using std::time_t; using std::time; using std::localtime; using std::asctime; int main() { time_t currentTime; // variable for storing time cout << "Content-Type: text/html\n\n"; // output HTTP header // output XML declaration and DOCTYPE cout << "<?xml version = \"1.0\"?>" << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" " << "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">"; time( &currentTime ); // store time in currentTime // output html element and some of its contents cout << "<html xmlns = \"http://www.w3.org/1999/xhtml\">" << "<head><title>Current date and time</title></head>" << "<body><p>" << asctime( localtime( &currentTime ) ) << "</p></body></html>"; return 0; } // end main Groovy uses Grails as an open source web application framework to support the development of web applications.Grails supports Ajax ,template framework and caching frameworks, but dosenot support form validation framework.It uses active record patten technology for MVC framework.It provides GORM, Hibernate for ORM and uses multiple plugins in DB migration framework [78]. Compare to C++,Grails will take more time to write a program and is more complexity.In some condition,the speed of excution is slow. It is neither high performance nor easy to program.But Grails is more secure and have more feature [79]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 34/139 2.2.4 Web services design and composition Groovy, as befits a sprightly young scripting language for the Java Virtual Machine, can do XML in a way that is relatively free of bloat and allows the developer to focus on the real problem at hand [80]. Groovy also support WS,SOAP and WSDL [81] [82] [83]. GroovyWS comes with two sets of APIS that are briefly described below using a simple example:Publishing a web-service and Consuming a web service [84]. Compare to C++ in XML, the best part about the Groovy code is not that it is shorter than the equivalent C++ code — only five line. The Groovy code is that it is far more expressive. You can write directly with the XML.The following code show parsing an XML in Groovy,with shorter code: def langs = new XmlParser().parse("languages.xml") println "type = ${langs.attribute("type")}" langs.language.each{ println it.text() } //output: type = current Java Groovy JavaScript C++ is implemented with gSOAP toolkit for SOAP/XML Web services and generic (non-SOAP) C++ XML data bindings. The toolkit analyzes WSDLs and XML schemas (separately or as a combined set) and maps the XML schema types and the SOAP messaging protocols to easy-to-use and efficient C and C++ code 85. It also supports exposing (legacy) C++ applications as SOAP/XML Web services by auto-generating XML serialization code and WSDL specifications. Or you can simply use it to automatically convert XML to/from C++ data. The toolkit supports options to generate pure ANSI C or C++ with or without STL [86][87]. The gSOAP toolkit is speed, reliability and flexibility, coupled with a proven track record and used by some of the largest technology vendors makes it an ideal platform to develop applications using Web services and XML processing.The gSOAP toolkit offers a comprehensive and transparent C++ XML data binding solution through autocoding techniques [86]. This saves developers substantial time to implement SOAP/XML Web services in C/C++. In addition, the use of XML data bindings significantly simplifies the use of XML in applications by automatically mapping XML to C/C++ data types. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 35/139 2.2.5 OO-based abstraction Groovy is a pure OO language in which everything is an object. Groovy enables one class to extend another, just as interfaces can. Groovy also support abastract class and interface. In Groovy a class can derive from only one class, but a class can implement multiple interfaces ,in other words, it supports multiple inheritance of types, but only single inheritance of implementation [87] [88]. C++ support OO programming paradigm, it supports inheritance, abstract class and interface. It also supports encapsulation.Full multiple inheritance, including virtual inheritance.Support abstract class,interface and encapsulation [91]. C++ methods can be declared as virtual functions, which means the method to be called is determined by the run-time type of the object [89][90]. 2.2.6 Reflection Many programming languages provide built-in reflection mechanism. For example, in Java there is special package java.lang.reflect and in Groovy, org.codehaus.groovy.reflection. But unfortunately C++ doesn't support reflection [92]. Reflection requires some metadata about types to be stored somewhere that can be queried. Since C++ compiles to native machine code and undergoes heavy changes due to optimization, high level view of the application is pretty much lost in the process of compilation, consequently, it won't be possible to query them at run time. Groovy has the capability of reflection, which enables you to gather information about your script at runtime, including peer into any class or object and obtain detailed information on its properties, methods, interfaces, and constants [84] For example,Groovy can examine the interfaces, public fields and their types, check if a class is a class or an interface. When a class is unknown at compile time,Groovy can use reflection to create objects. Groovy can also use reflection on the reflection classes themselves [93]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 36/139 2.2.7 Aspect-orientation Bascally, C++does not support aspect-orientation directly.But AspectC++, an aspect-oriented extension of C++ languages,support aspect-orientation. It is based on source-to-source translation, translating AspectC++ source code to C++.It allows modularizing cross-cutting concerns in a single module, an aspect. AspectC++ provides a join point API to provide and access to information about the join point [94][95]. Compare to Groovy, A major different is the modified join point model, which allows to have class, object and control flow join points. The result is a more coherent language design. While it was necessary to make some visible changes to the syntax and grammar of Groovy, we have preserved most language concepts [96]. This should enable users experienced with Groovy and C++ to get familiar with AspectC++ without much effort.However,there are some disavantage on AspectC++.The prototype implementation of an AspectC++ compiler is still in an early stage. The compiler cannot yet deal correctly with all AspectC++ language constructs in all possible contexts [97]. Groovy supports AOP. Adding AOP-like features into Groovy code is as simple as implementing the GroovyInterceptable interface.Any Groovy object that implements this interface will automatically have all of its method calls routed through its invokeMethod()Groovy AOP can provide a shortcut for getter and setter [98]. Tt is easy to implement the powerful features of AOP in Groovy. It's not too difficult to envision how such a capability could be built into an application to handle a lot of the boiler plate code that tends to crowd non AOP applications. 2.2.8 Functionnal programming Groovy is not a functional-only programming language,but it support functional programming. Groovy's functions can be used to define functions which contain no imperative steps [99]. Groovy use lazy evaluation and they typically hide away the hard bits so you don't need to know what magic is happening on your behalf. FC++ is a library for doing functional programming in C++. The library provides a general framework to support various functional programming aspects such as higher-order polymorphic functions, currying, lazy evaluation, [100] and lambda. In addition to the framework, FC++ also provides a large library of useful functions and data types [101]. 2.2.9 Declarative programming Declarative programming is often defined as any style of programming that is not imperative. A number of other common definitions exist that attempt to give the term a definition other than simply contrasting it with imperative programming.Both C++ and Groovy do not support the declarative programming paradigm [102], since they are both support imperative paradigm,which requires an explicitly provided algorithm.In the declarative programming,the program is structured as a collection of properties to find in the expected result, not as a procedure to follow. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 37/139 2.2.10 Batch scripting Groovy is a scripting language and can be used for command line shell scripting. The simplest way to invoke an external process in Groovy is to use the execute() command on a string [103]. For example, to execute maven from a groovy script run this: "cmd /c mvn".execute().The 'cmd /c' at the start invokes the Windows command shell [105]. The command line is short and clear.Since mvn.bat is a batch script you need this. For Unix you can invoke the system shell [104][84]. C++ is a scripting language and can be used for command line shell scripting.The code use to write command in C++ is more complex and sophosticated and Groovy.Here is the example: string getStdoutFromCommand(string cmd) { // setup string data; FILE *stream; char buffer[MAX_BUFFER]; // do it stream = popen(cmd.c_str(), "r"); while ( fgets(buffer, MAX_BUFFER, stream) != NULL ) data.append(buffer); pclose(stream); // exit return trim(data); } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 38/139 2.2.11 UI prototype design One of the application development for C++ doing UI is Qt.The Qt toolkit is a C++ class library and a set of tools for building multiplatform GUI programs using a “write once, compile anywhere” approach. Qt lets programmers use a single source tree for applications that will run on Windows 95 to XP. Compare to Swing/AWT,the program code used in Qt is considerably more intuitive. This is because Swing enforces the use of a Model-View-Controller architecture (MVC) while Qt supports, but does not enforce, such an approach. Qt supports the development of sophisticated user interfaces.Qt has better tool than Swing/AWT. Qt does not enforce particular programming paradigms as Swing/AWT does [106]. Groovy uses Swing/AWT to provide a graphical user interface (GUI) for Groovy programs. The Abstract Window Toolkit (AWT) is Java's original platform-independent windowing, graphics, and user-interface widget toolkit. Swing was developed to provide a more sophisticated set of GUI component than the earlier Abstract Window Toolkit [107]. Compare to Qt,the program code used in Swing/AWT is less intuitive and flexible. Swing/AWT also supports the development of sophisticated user interfaces. Swing/AWT has some problems with runtime- and memory-efficiency which are also problem of Groovy [109]. Swing/AWT may be appropriate for certain projects, especially those without GUIs or with limited GUI functionality. Qt is an overall superior solution, particularly for GUI applications [108]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 39/139 2.3 Haskell vs Java 2.3.1 Source code size Not that the “source code size” criteria is present as one of the official criteria. However, code size may effect the compile performance. While a language are interpreted, the larger code may take more compile time. Moreover, due to the store space and memory size limitation, large source code may also overall running performance. The following code examples show the code size of Haskell and Java. module Main where main :: IO () main = putStrLn "Hello, World!" Listing 1: Example Haskell program public class HelloWorld { public static void main(String args[]) { System.out.println("Hello world!"); } } Listing 2: Example Java Program From these two sample codes, It is clear that source code size of Java (see Listing 2) is longer than that of Haskell (see Listing 1) 2.3.2 Default more secure programming practices I am talking secure programming practices by type system, memory management, and exception handling. 2.1.2.1 Type system Haskell has a strong, static, and automatically inferred type system based on Hindly-milner type inference. Firstly, all types in Haskell are strong. Type system of Haskell prevent program from certain kinds of type errors coming from trying to write expressions that don't make sense. Another aspect of Haskell's view of strong typing is that it will not automatically coerce values from one type to another. For example, the following codes are valid in Java: int a = 10; double b = (double) a; Listing 3: Java explicit casts COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 40/139 But, this is invalid in Haskell, and Haskell compiler will raise a compilation error. Secondly, in Haskell, type checking is performed during compile-time. The compiler knows the type of every value and expression at compile time, before any code is executed. A Haskell compiler or interpreter will detect type error, and reject our code with an error message running. Haskell's combination of strong and static typing makes it impossible for type errors to occur at runtime. Finally, a Haskell compiler can automatically deduce the types of almost all expressions in a program. Haskell allows programmer to explicitly declare the type of any value, but the presence of type inference means that this is almost always optional, not something we are required to do.[110] The Java programming language is also a strongly and statically typed language. Java require all variables and expressions to have a defined type that is known at compile time. However, other than Haskell, Java supports the use of explicit casts of arithmetic values to other arithmetic types like shown in Codes3. Moreover, Java does not support automatically inferred type system. That means programmers has to declare the types they intend a method or function to use. 2.1.2.2 Memory management Haskell's computation model is very different from that of conventional languages. Data are immutable that means the only way to store every next operation's result is to create new value.[111] Especially, every iteration of a recursive computation creates new values. Therefore, Haskell computations produce a lot of memory garbage - much more than conventional imperative languages. However, GHC is able to efficiently manage garbage collection. The trick is that immutable data never points to younger values. [110] Due to this key property, Haskell uses a simplified garbage collection. At anytime GHC can scan the last values created and free those that are not pointed to from the same set. Java 2 uses a great automatic memory management in the object lifecycle, thereby keeping the developer from the complexity of explicit memory management. In Java, memory is only allocated to objects, and there is not explicit allocation of memory. At runtime, Java employs a garbage collector that reclaims the resources used by an object once it determines that object is not used in the future. This automatic process makes it safe to throw away unneeded object references because the garbage collector does not collect the object if it is still needed elsewhere. Therefore, in Java the act of letting go of unneeded references never runs the risk of deallocating memory prematurely. [112] 2.1.2.3 Exception Handling Haskell can use monad Maybe and Either type to achieve exception handling. The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). Maybe easily handle errors or exceptional cases without resorting to drastic measures such as error [113]. The Either type is similar to the Maybe type, with one key difference: it can carry attached data both for an error and a success ("the Right answer").[114] Appendix 1 show how Maybe and Either handle Haskell exception. In Java, all exceptions are objects. That is when an exception is thrown, an object is thrown. However, not any object can be thrown -- only those objects whose classes descend from Throwable. Throwable serves as the base class for an entire family of classes, declared in java.lang, and all exception is subclass of Throwable. Throwable has two direct subclasses, Exception and Error. Exceptions are thrown to signal abnormal conditions that can often be handled by some catcher, though it's possible they may not be caught and therefore could result in a dead thread. Errors usually introduce system internal situation, and are thrown for more serious problems, such as OutOfMemoryError, that may COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 41/139 not be so easy to handle. In general, Java code only throw exceptions, not errors. Figure 1 show A partial view of the Throwable family. Figure 1: A partial view of the Throwable family. In addition to throwing objects whose classes are declared in java.lang, Java programmer can also throw objects of own design by declaring new class as a subclass of some member of the Throwable family. To catch an exception, Java uses a try block with one or more catch clauses. Each catch clause specifies one exception type that it is prepared to handle. The try block places a fence around some code that may throw exceptions. If the code delimited by the try block throws an exception, the associated catch clauses will be examined by the Java virtual machine. If the virtual machine finds a catch clause that is prepared to handle the thrown exception, the program continues execution starting with the first statement of that catch clause. Appendix 2 is a sample code to show how Java handle a exception. 2.3.3 Web applications development Web applications are nature distributed applications running on more than one computer and can be access through a network or server. Specifically, web applications are accessed with a web browser and are popular because of the ease of using the browser as a user client. [115] There are many approaches to Haskell web programming, such as Web Authoring System Haskell (WASH), Haskell Application Server (HAppS), Happstack, and Haskell Server Pages (HSP). WASH is a domain-specific embedded language with type-safe forms handling and threads continuation through client. This gives good back-button and session splitting properties. HApps is a complete system including web server in one program with using of XSLT for output. Happstack is the successor to HAppS. It is a complete system including a web server and database system in one program. It has many template options including HSP, HStringTemplate, Hamlet, XSLT, and more! Haskell Server Pages (HSP) uses preprocessor with dynamic compilation to make XML tags into Haskell expressions. Moreover, another simple, portable, and relatively light-weight approach to Haskell web programming is a CGI library and an XHTML combinator library. Here is a very simple COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 42/139 example which just outputs some static HTML using CGI library and XHTML. Appendix 3 shows two simple examples. The first one just outputs some static HTML, and the second one show how to get user input. [116] Java uses J2EE platform to create web applications. There are too many Java technologies can be used to create web applications, such as Java servlet API, JavaServer Pages, JavaServer Pages Standard Tag Library, JavaServer Faces Technology, Java Message Service API, and so on. In a Java web application, components are either Java servlets, JSP pages, or Web service endpoints. The interaction between a Web client and a Web application is illustrated in Figure 2. Figure 2, Java Web Application Request Handling [10] The client sends an HTTP request to the Web server. A Web server that implements Java Servlet and JavaServer Pages technology converts the request into an HTTPServletRequest object and then delivered to a Web component, which can interact with JavaBeans components or a database to get dynamic content. The Web component can then generate an HTTPServletResponse or it can pass the request to another Web component. Finally a Web component generates a HTTPServletResponse object. The Web server converts this object to an HTTP response and returns it to the client. Appendix 4 show JavaServlet handle HttpServlet Request and send HttpServlet Response. 2.3.4 Web services design and composition Since a large Haskell function is composed of a number of smaller functions, it is ideal for composing services. In order to compose service operations, it is necessary to enable the viewing of services as side-effecting functions in Haskell. Many features in Haskell also provide an ideal platform on which various data-processing applications can be elegantly constructed, and this motivates the ability to create atomic services in Haskell. The Haskell Application Interoperation Framework/Architecture (HAIFA) is a library providing the basic components for web-based interoperability, in the form of a service modeling framework. Firstly, the Simple Object Access Protocol (SOAP) can help to set webservice architecture. Secondly, HaXML, the most well know XML library for Haskell, provides COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 43/139 Haskell2Xml type-class, which performs serialization and deserialization of Haskell types to XML. After created a suitable XML serializer, user can build a client side service interoperation, and then publish the Haskell function as service[117]. Java has been a powerful development platform for Service-Oriented Architecture (SOA) since 2006. Java EE 5, released in May 2006, significantly enhanced the power and usability of the Web Services capabilities on the application server. Java API for XML-based RPC (JAX-RPC) is a technology for building Web services and clients that use remote procedure calls (RPC) and XML. Often used in a distributed client-server model, an RPC mechanism enables clients to execute procedures on other systems. JAX-RPC provides an easy to develop programming model for development of SOAP based Web services [118] In JAX-RPC, a remote procedure call is represented by an XML-based protocol such as SOAP. The SOAP specification defines the envelope structure, encoding rules, and conventions for representing remote procedure calls and responses. These calls and responses are transmitted as SOAP messages (XML files) over HTTP. JAX-RPC can provide a big advantage for both client side and service side -- the platform independence of the Java programming language. Moreover, JAX-RPC is not restrictive. That is a JAX-RPC client can access a Web service not running on the Java platform, and vice versa. [119] 2.3.5 OO-based abstraction Contrast subtype polymorphism of object-oriented languages, Haskell provides type-class-bounded and parametric polymorphism. Ad-hoc polymorphism (user-defined overloading) can be handled by a powerful abstraction mechanism provided by type classes. The basic idea behind type classes is that class declarations allow one to group together related methods (overloaded functions), and instance declarations prove that a type is in the class, by providing appropriate definitions for the methods. Here are some standard Haskell declarations.[120] class Eq a where (==)::a->a->Bool instance Eq Int where (==) = primIntEq instance Eq a => Eq [a] where (==) [] [] = True (==) (x:xs) (y:ys) = (x==y) && (xs==ys) (==) _ _ = False Listing 4: standard Haskell declarations[120] And then, we can extend the type class hierarchy by introducing new subclasses. class Eq a => Ord a where (<)::a->a->Bool) instance Ord Int where ... instance Ord a => Ord [a] where ... Listing 5: introducing new subclasses[120] The above class declaration introduces a new subclass Ord which inherits all methods of its superclass Eq. For brevity, we ignore the straightforward instance bodies. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 44/139 Moreover, the OO features are introduced in Haskell as the O'Haskell library, based on the HList library of extensible polymorphic records with first-class labels and subtyping. Not only O'Haskell provides the conventional OO features, it has also language-engineered several features that are either bleeding-edge or unattainable in mainstream OO languages [121]: for example, first-class classes and class closures; statically type-checked collection classes with bounded polymorphism of implicit collection arguments; multiple inheritance with user-controlled sharing; safe co-variant argument subtyping.[122]The Appendix 5 show an O'Haskell sample code. Java languages designed mainly for Object-Oriented programming. It support all features of OO programming technique, such as data abstraction, encapsulation, modularity, polymorphism, and inheritance. The Appendix 6 show an Java sample code 2.3.6 Reflection Haskell supports some kinds of reflection such as monads. A monadic-style functional program allows the imperative, behavioral view of a computational effect to be identified with a declarative, databased view in a uniform way. Monadic reflection looks like a formal bridge between the two views. It refines the identification into an observational isomorphism, with explicit reification and reflection functions mediating between views. Such a separation allows the programmer to reason robustly about monadic effects according to the declarative view, while implementing the imperative view much more efficiently in terms of lower-level control and state manipulations. [123] Monadic reflection is essentially a grammar for describing layered monads or monad layering. In Haskell describing also means constructing monads. This is a higher level system so the code looks like functional but the result is monad composition - meaning that without actual monads (which are non-functional) there's nothing real / runnable at the end of the day. Reflection is a feature in the Java programming language. It allows an executing Java program to observe, examine, and modify internal properties of the program. For example, it's possible for a Java class to obtain the names of all its members and display them. One tangible use of reflection is in JavaBeans, where software components can be manipulated visually via a builder tool. The tool uses reflection to obtain the properties of Java components (classes) as they are dynamically loaded. The following code show how Java reflection working // Without reflection String stringObj = "This is a string"; system.out.println("Length of string is: "+stringObj.length()); // With reflection Class cls = Class.forName("java.lang.String"); Method method = cls.getDeclaredMethod("length", new Class[]{}); int length = (Integer)method.invoke(stringObj, new Object[]{}); system.out.println("Length of string is: "+length); Listing 6: Java Reflection 2.3.7 Aspect-orientation COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 45/139 Type classes can help Haskell to achieve Aspect-Oriented Programming (AOP). Type classes provide some form of type-safe cast to encode AOP in the setting of a strongly typed language by exploiting GHC’s overlapping instances. AOP Haskell extends the Haskell syntax by supporting top-level aspect definitions of the form: N@advice #f1, …, fn# :: ( C => t ) = e In the definitions, N is the name of the aspect, and each fi is function symbols as joinpoint. C => t is type annotation following the Haskell syntax for types. e is the advice body following Haskell syntax for expressions. The advice will be applied if the type of joinpoint fi is an instance of t such that constrains C are satisfied. And then, by turning advice into type class instance and instrument joinpoints with calls to a “weaving” function – a process that intercept calls to joinpoints and re-direct the control flow to the advice bodies - AOP idioms can be translated to type classes as supported by the Glasgow Haskell Compiler (GHC). Appendix 7 show a AOP Haskell example [120] Java has a simple and practical extension, AspectJ, which provide aspect-oriented programming (AOP) capabilities for Java. This allows developers to reap the benefits of modularity for concerns that cut across the natural units of modularity. Like any other aspect-oriented compiler, the AspectJ compiler includes a weaving phase that unambiguously resolves the cross-cutting between classes and aspects. AspectJ implements this additional phase by first weaving aspects with regular code and then calling the standard Java compiler.[124] Appendix 8 show a AspectJ example and its running output COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 46/139 2.3.8 Functional programming Haskell is an advanced purely functional programming language. The underlying model of computation is mathematical concept of a function, and programs are executed by evaluating expressions. In Haskell, functions are first-class, which means that they are treated like any other values and can be passed as arguments to other functions or be returned as a result of a function. Being first-class also means that it is possible to define and manipulate functions nested in code blocks. Special attention needs to be given to nested functions, called closures that reference local variables from their scope. If such a function escapes their block after being returned from it, the local variables must be retained in memory, as they might be needed later when the function is called. Usually it is not possible to determine statically the moment of release, which means that an automatic memory management technique has to be used. The following code is a simple Haskell function define. hyp :: Float → Float → Float hyp x y = sqrt (x*x + y*y) Listing 7: function define in Haskell Basically, Java does not allow composition of functions. In functional programming languages such as Haskell, functions are first-class, while in Java, class is first-class. However, a extension library, Functional Java provide optional functional programming in Java. The library implements several advanced programming concepts that assist in achieving composition-oriented development.[125] The following code is a example of Functional Java final Array<Integer> a = array(3, 2, 1); final Array<Integer> b = a.map({int i => i + 2}); arrayShow(intShow).println(b); //{5,4,3} Listing 8: Functional Java 2.3.9 Declarative programming In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. [126]That means the language focus on what need to do and not how to do. As a pure functional language, Haskell support declarative programming. The following code shows how to write code in declaration style. filter :: (a → Bool ) → [a] → [a] filter p [ ] = [ ] filter p (x:xs ) | p x = x : rest | otherwise = rest where rest = filter p xs Listing 8: filter function with Declaration style COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 47/139 From this example, we can see that declaration style define a function by many equations, and each equation uses pattern matching and/or guards to identify the cases it covers. Java is an imperative programming language which gives a list of instructions to execute in a particular order. However, JDK 1.5 release a powerful language construct, annotation. Annotation is a generic mechanism for adding tags with data (metadata) with program elements such as classes, methods, fields, parameters, local variables, and packages.[127] By annotation, declarative programming style can be introduced into Java language. The following codes show how to declaring an annotation and how to use it. // Declaring an Annotation Package njunit.annotation; import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) public @interface UnitTest { String value(); } //Using an @UnitTest annotation import njunit.annotation.*; public class Example { @UnitTest(value="Test 1. This test will pass.") public void pass() { assert 10 > 5; } @UnitTest("Test 2. This test will fail.") public void fail() { assert 10 < 5; } } Listing 9: Example of Java Annotation[130] 2.3.10 Batch scripting Both Haskell and Java can create batch scripting because they can process external commands in automated mater. For example, Haskell can use function system and rawSystem to executing an external command. The basic synopsis of system and rawSystem are: COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 48/139 system :: String IO ExitCode rawSystem :: String [String] ->IO ExitCode Listing 10: synopisis of system and rawSystem[128] In Linux system we can play them like: system “ls -l” rawSystem “ls” [“-l”] Listing 11: Example of system and rawSystem In Java, Runtime class can be used to executing an external command. The following is an example. import java.io.*; public class someClass { public static void main(String[] args) { try { Process proc = Runtime.getRuntime().exec("ls -l"); InputStream p = proc.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(p)); String line; while((line=reader.readLine()) != null){ System.out.println(line); } } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } } Listing 12: Example of Java Runtime 2.3.11 UI prototype design There are several GUI toolkits available for Haskell. However, there is no standards one and all are more or less incomplete. Generally, there are three level Haskell GUI library, low-level, mediumlevel, and high-level. Low-level,such as GLFW, GLUT, TclHaskell, Win32, and X11, are going well, but it is doing everything in the IO monad. High-level abstractions, such as FG, FranTk, Fruit, COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 49/139 Fudgets, Grapefruit, GuiTV, Phooey, and wxFruit, are pretty experimental[116]. The medium-level, such as wxHaskell, Gtk2Hs, hoc, and qtHaskell, can support Haskell GUI.[128] wxHaskell is a portable and native GUI library for Haskell, which provides a interface to wxWidgets toolkit[129]. Gtk2Hs is a GUI library for Haskell based on Gtk+ which is an extensive and mature multi-platform toolkit for creating graphical user interfaces. [131] HOC (documentation at sourceforge) - provides a Haskell to Objective-C binding which allows users to access to the Cocoa library on MacOS X [132] qtHaskell is is a set of Haskell bindings for the Qt Widget Library from Nokia[133] Appendix 11 shows how to build GUI using Gtk2Hs.[134] In Java, there are two components to support GUI design, AWT and Swing. AWT, Abstract Window Toolkit, is Java's original platform-independent windowing, graphics, and user-interface widget toolkit. The AWT is now part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program. Swing is a built-in GUI component technology of the Java platform. It is successor to AWT. Swing replaces some function of AWT such as using javax.swing.JTextField instead of java.awt.TextField. On the other hand, Swing builds on AWT. For example JtextField is descendant of java.awt.Container. Appendix 10 give a sample code of Java Swing COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 50/139 2.4 PHP vs Scala 2.4.1 Source code size Hello world in PHP <?php echo "Hello, world!"; ?> Hello world in Scala object HelloWorld extends Application { println("Hello, world!") } 2.4.2 Default more secure programming practices PHP is a loosing typing and dynamic checking language and the type safety is not that safe. It enforces run-time checking which can provide flexibility to try evaluating compile time error type. PHP does not require (or support) explicit type definition in variable declaration; a variable’s type is determined by the context in which the variable is used [135]. PHP 5.3 introduces garbage collection (GC) to handle the memory allocation and de-allocation problems. In PHP, when there is no variable points to the object, those kinds of objects would be considered as garbage, and it will automated freed in the memory, which avoid the memory leak. When one PHP session is ended, the memory space occupied by those sessions will be destroyed. All the objects in the current applications would also be destroyed in the meantime. Generally, the process of GC in PHP is followed by the start of one session. When session is end, it automatically destroys those files [136]. PHP is popular with its strong extension API after PHP 3.0, which support PHP wrapping with some other existing library functions for certain purpose. This rich API will help PHP integrate with other more completely. As PHP is usually used as a web server module, you should be aware that PHP might be used in threaded an environment which means that global variables might lead to rare conditions [137]. When small PHP program’s leak would not be a big problem to OS. If PHP associate with server service(i.e Apache server), it would be a long term running period, then the memory leak would be huge problem to the OS. Even if your program is well-written format to avoid leak issue, it is necessary to have some memory management to avoid them. With the help of extension API, PHP COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 51/139 can avoid that leak problem. In extension API (the Zend engine), it provides a set of wrapper function (Like emalloc (), efree () similar to the method malloc (), free () in C language) to handle the memory problems [138]. PHP do support exception handling like java using “try-catch-throw” style to deal with various of types of errors [139]. Static typing, or compile-time type checking, helps you define and verify interface contracts at compile time. Although Scala is static typing languages, unlike some of the other statically typed languages, does not expect you to provide redundant type information. You don’t have to specify a type in most cases, and you certainly don’t have to repeat it. At the same time, Scala will infer the type (Type inference) and verify proper usage of references at compile time. Scala is considered as a type safety languages. You will gain two benefits from Scala type system [140]: 1. The compile time checking will give you confidence that the complied code meets certain defense expectation. 2. Help you express the expectation on your API in a complier-verifiable format Scala runs on top of JVM which means that your code is compiled into bytecode. That in turn means that JVM uses garbage collection as your Scala program is running - garbage collector (GC) cleans up the memory when objects you allocated in your code become obsolete [141]. Scala also supports a java-like style exception handling, which using “try {…} catch {…}” block to handle error exceptions. But it would not so effectively to handle the run-time exception [142] In sum up on this criterion, PHP is dynamic type with weak type strength, while Scala is static type with strong type strength and support type inference. Although dynamic type provides flexibility to PHP type system, it also brings unsafe factors. In the memory management part, Scala is only support the garbage collection type, while PHP can gain support from the extension API(zend engine) to have flexibility deal with specified problems(multiple-threading problems). Both languages provide similar syntax exception handling. 2.4.3 Web applications development PHP is associated with HTML to serve as dynamic website development tools.PHP runs on the Apache server to collect user data via HTML form and process them on the server side. After interpreted by web server, it generate website. The PHP web application will collect the user information and store them in the session, thus it is necessary to verify the validity of user information, especially in case of tamping by hacker. Thus, it requires some security issues at the server end. For instance, safety handling the user input in registration validates the user URL etc. This technique would make scripts safer. There are two common forms to for PHP to organize website safety: “one script for serves all” and “one script serve one function”. Whatever forms you take, validate every element from outside the server end. It comes with the following possible benefits for developing web application using PHP [143]: • It is especially design for the web, generally for the server end. • It is a robust and proven platform. • Since this is an open-source, it is constantly upgraded through community development. • It is also highly customizable, and it is easily adaptable to suit for all uses. • The web application in PHP reduces the web application development costs further. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 52/139 Lift is a free leading web application framework that aims to deliver benefits similar to Ruby on Rails. But it is written in Scala, not Ruby. The use of Scala means that any existing Java library and Web container can be used in running Lift applications [144]. Lift applications benefit from native support for advanced web development techniques such as Comet and Ajax. And lift is often used for commercial websites. Now the latest version of Lift 2.0, which provide more industrial optimization and support. It comes with following possible benefits that Lift-based application [144]: • Lift is like a breath of fresh air: concise, elegant and robust • Lift's high performance and scalability • Lift's built-in support for REST and other web services • Lift's use of Scala's type-safety so your tests can focus on business logic. • Built-in security means more time focusing on your application and less time being defensive about parameter tampering, SQL injection, Cross Site Scripting and other nasty attacks. 2.4.4 Web services design and composition Web services are typically application programming interfaces (API) or Web APIs that are accessed via Hypertext Transfer Protocol (HTTP) and executed on a remote system hosting the requested services. Web services tend to fall into one of two camps: big Web services and RESTful Web services.” Big Web services" use Extensible Markup Language (XML) messages that follow the SOAP standard and have been popular with traditional enterprise [145]. In PHP 5, all XML extensions have been rewritten to use the superb libxml2 XML toolkit. PHP 5 comes with a SOAP extension ext/soap, which has even more features than PEAR::SOAP, and is written in C instead of PEAR::SOAP, which is written in PHP. [14] PHP 5 do supports web service design and composition, and support different protocols such as OAuth, SCA, SOAP and XML-RPC [146]. PHPXMLRPC is PHP library for implanting the function of XML-RPC.It designed for ease of use, flexicibility, and completeness. But this library does not consider the speed and memory management issues. With the support for XML-RPC, it enable distributed systems and system interoperability, it allows applications call the methods in other place no matter what machine is, what language written with. Such as C++ function can call the PHP methods. This achieves the purpose of web service. New XML support makes PHP the best language available for processing XML and, coupled with new SOAP support, an ideal platform for creating and using Web Services [147]. Scala do support the Web service building. Scala's notion of pattern matching naturally extends to the processing of XML data with the help of right-ignoring sequence patterns. In addition, Scala’s XM; support is partly from library, with some built-in syntax support. It allows using inline-XML that makes XML in Scala in a convenient form. Since Scala can seamlessly integrate with Java’s library, thus Scala can using the XML-RPC in Java, which is a java implementation of XML-RPC protocol for web service purpose. In this context, sequence comprehensions are useful for formulating queries. These features make Scala especially ideal for web services [148]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 53/139 [18] Listing 1 How XML-RPC work 2.4.5 OO-based abstraction Both PHP and Scala do support OO-based abstraction. PHP 5 support Object Oriented programming (OOP) paradigm, it supports single inheritance, interface (abstract method and class). It also supports encapsulation. The purpose of inheritance in PHP is to inherit the characteristic of the base class that does make code reusable and structural. Using keyword “new” to instantiate a new object from non-abstract class and keyword “extends” to declare which class inherits from which class. That’s somewhat similar way to Java. PHP also support abstract class, which any class extends an abstract class must create an interface (Interface in PHP will define your own common structures and can not be instantiated itself) of the parent abstract methods. Additionally, in order to achieve some level of encapsulation purpose, PHP use some keywords (public, private, protected) to manipulate the visibility of class members (properties or methods). In the source code example A1 [149], it simplify illustrate an abstract class example. Scala is a pure OO language, everything in Scala is an object. It supports single inheritance and traits, which is like optional implemented interfaces. It is quit similar to the interfaces in Java, traits are used to define objects by specifying the signature of the supported methods. It is allowed for traits to be partially implemented, while there is not allowed to implement the abstract class in PHP. This implies that you can define default implementation for some methods. [151] Compared with the classes, trait may not require constructor parameter. It also provides similar way to encapsulate data members as PHP did. In the source code example A2 [152], it give a trait version that implement abstract class. To sum up, two languages have similar way in OO-based abstraction. Compared to PHP, Scala have more advanced OOP characteristics (such as Case Classes, Traits, and Companion Objects) which make the data member more flexible in the OO framework. 2.4.6 Reflection Reflection is the process by which a computer program can observe and modify its own structure and behavior. A reflection-oriented program component can monitor the execution of an enclosure of code and can modify itself according to a desired goal related to that enclosure. This is typically accomplished by dynamically assigning program code at runtime [153]. PHP 5 comes with a complete and rich reflection API that adds the ability to reverse-engineer classes [154], interfaces, functions, methods and extensions. Additionally, the reflection API offers ways to retrieve doc comments for functions, classes and methods. Using reflection is actually let COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 54/139 you know how things actually worked. Reflection itself is handled through various classes, the root of which is the ReflectionClass. There's other class like ReflectionExtension, ReflectionFunction, ReflectionMethod, ReflectionObject, Reflection Parameter [155]. Scala supports the same reflection capabilities that Java and .NET support. [156] The syntax in Scala would be somewhat different depending on the cases. The following code [157] segment shows that some reflection methods in JVM, through java.lang.Object and java.lang.Class: Listing2 Reflections on Scala using Traits trait T[A] { val vT: A def mT = vT } class C extends T[String] { val vT = "T" val vC = "C" def mC = vC class C2 trait T2 } val c = new C val clazz = c.getClass // method from java.lang.Object val clazz2 = classOf[C] // Scala method: classOf[C] ~ C.class val methods = clazz.getMethods // method from java.lang.Class<T> COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 55/139 2.4.7 Aspect-orientation Aspect Oriented Programming is new programming paradigm which enables you to effectively implement crosscutting concerns in new and also existing programming without changing the original code. Unfortunately, it is possible in complied programming languages, but not for scripting language. Since the PHP is a scripting language, the written code is interpreted, not complied in the server end. In PHP5, it brings to new approach to solve the weaving problems. To solve this problem of weaving before executing the program, some implementations, of the AspectOriented Programming paradigm in PHP, use another script to read the file that is interpreted firstly, and then all Advices are added on the designated locations in the code. After this, the newly created file is interpreted. This requires another script, time to read the original file, a lot of find and replace operations and finally interpreting a non-optimized new file. This can really slow down the execution time of the PHP code, especially with large programs with a lot of Aspects. Another common used solution is to add some libraries to the PHP interpreter. These libraries then take care of the weaving before executing the file. This solution doesn’t remarkably slow down the interpretation and execution process, but needs some extra skills to create the library. Furthermore the PHP installation on the server is modified to enable these libraries. That can result in less stable services. In the source code example A3 [158], it is the second way which provide external library to help achieve the AOP purpose into PHP. Scala have the ability to interoperate with AspectJ, an extension of Java, which supports Aspectoriented programming [159]. When using AspectJ in Scala, we have mentioned some detail issues: how to reference Scala execution points and how to invoke Scala code as advice Scala traits is a better choice rather than using AspectJ for the purpose of AOP [159]. However, Scala doesn’t have a point cut language, like AspectJ. Using aspect would be more suitable for more “pervasive modification” (e.g. Tracing, police enforcement, security) while using trait is no need to worry about other language (traits is not from the Java or .NET) and fits your entire requirement. [160] In the source code example A4[161], it is an aspect that logs methods calls to the Complex class. In sum up, Scala provide two ways to achieve AOP purpose: Built in approach (using traits) or Aspect approach (using Aspect), while PHP also provide two ways to handle AOP, but seems rather complicated than Scala did. 2.4.8 Functional programming Since PHP 5.3 support Closure, then PHP can support functional programming with more convenience. Before the Closure come, we need to implement curry function (curry is not built-in function in PHP, need to be defined by developer) to achieve the same goal as Closure, which is a technique to transform functions from multiple arguments to one argument. Assume the following code segment [162]: $add2 = curry ($add, 2); // returns a new function reference, to add (), bound with 2 as the first //argument $add2 (8); // return 10 Listing 3 using curry method for functional programming purpose COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 56/139 Scala support functional programming paradigm.Scala is also a functional language in the sense that every function is treating as value. Scala provides a lightweight syntax for defining anonymous functions, it supports higher-order functions, it allows functions to be nested, and supports currying. Scala's case classes and its built-in support for pattern matching model algebraic types used in many functional programming languages. [163] In the following code segment, it is the code example of high-order function of Scala [165]: def increment(x:Int) = x + 1 def handler( f:Int => Int) = f(2) println( handler( increment )) //pass the function as value Listing 4 High order function Scala uses the keyword lazy defers the initialization of a variable until this variable is used. Evaluation of delimited continuations is supported in version 2.8. Tail call optimization is not supported completely, because the JVM lacks tail call support. In simple cases, the Scala compiler can optimize tail calls into loops [166]. In the following code segment, it is code example of lazy evaluation in Scala [167] (Since Scala is not default lazy evaluation, it requires keyword “lazy” to evaluate when in needed): Listing 5 Lazy def lazyMultiply(x: => y:) = { lazy val y = x * x } evaluation 2.4.9 Declarative programming Compared to imperative programming, the main point of declarative programming to focus on what to do, and do not concern on how the steps should be. PHP is a scripting language which can support declarative programming paradigm under the help of annotation. Annotation can be used by tools or libraries which do not affect the semantic structure of program; it adds metadata to the properties (classes, methods) [169]. In addition, PHP can embelled with HTML, which is a declarative user markup language just to tell what the server end should do to support the interface [170], Since Java can support declarative programming through annotation and reflection [171], and Scala do support both techniques, thus, we consider Scala do also support declarative programming, may have somewhat different in code syntax. 2.4.10 Batch Scripting PHP is a scripting language which more than just web application and can be used for command line shell scripting. PHP supports a CLI SAPI (a layer that PHP interact with other web server (i.e. Apache and M$ IIS)) through as of PHP 4.3.0. The main focus of this SAPI is for developing shell applications with PHP. That is to say we can use CLI as command-line tools same as the standalone server application. This make PHP look more like traditional scripting languages. It is possible to write shell scripts using CGI version of PHP, although CGI have some significant different (In CLI, no header written to the output) with the CLI in web server integration. For the reason of accessibility COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 57/139 (default installed) and consistent, developer prefer using CLI to write PHP shell scripts. [40] In the following, it tells PHP to execute specified files: Listing 6 $ php -f comp6411script.php execute the .php file in command line Scala is similar to PHP, which its program can also run as a shell script as a batch command. For instance, The “scalac” command compiles one or multiple Scala source files and generates Java bytecode on the base of JVM, which the Scala complier work similar to Javc(java complier) [172] > scalac HelloWorld.scala Listing 7 execute the .scala file in command line 2.4.11 UI prototype design PHP itself does not support UI prototype design generally, PHP was embelled into HTML file to invoke HTML’s features to obtain the graphical interface purpose. Strictly speaking, we should say PHP does not support UI prototype design directly. But after the coming of the PHP-GTK, it reduces the dependence on the UI purpose with HTML. That is to say, we can use PHP create stand-alone GUI application. PHP-GTK [173] is an extension for the PHP programming language that implements language bindings for GTK+. It provides an object-oriented interface to GTK+ classes and functions and greatly simplifies writing client-side cross-platform GUI applications.PHP. We can use this tools create windows, buttons, and text without help by another program (i.e. browser, and text editor). COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 58/139 // show an window using gtk library <?php $window= new GtkWindow(); $window->connect_object(‘destroy’,array(‘gtk’, ‘main_quit’)); $windown->show(); gtk::main(); ?> Listing 8: A Simple Application in PHP-GTK [174] Scala’s graphical user interface (GUI) development is heavily depending on the Java GUI library. It works well with Java AWT, swing. But there are some swing Scala library to choose like: ScalaGUI [174], scala-swing (Scala API). package example import scala.gui._ // import from Scala library object application extends scala.gui.Application { val mainWindow = new container.Window { val press = new widget.Button { text = "Press me, please" subscribe(this) toplevel eventloop { case this.Click() => field.text = "Wow! Someone pressed me." } } Listing 9: A simple segment for create a window and button using ScalaGUI But in general case, invoking Java GUI is more convince and with rich library choice. Because there are not much Scala built-in GUI library for use in the API. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 59/139 2.5 Scheme vs JavaScript 2.5.1 Source code size Hello world in Scheme (display "Hello World!") Scheme Code sample Hello world in JavaScript document.write('Hello World!'); Javascript Code sample 2.5.2 Default more secure programming practices Type system: Scheme uses strongly but dynamically typed variables. In Scheme, a variable can refer to a value of any type, and the majority of its type checking is performed at run-time. However, at runtime, Scheme rejects any operations which attempt to disregard data types. However, Javascript uses weakly and dynamically typed variables. That is, In Javascript, any kind of variables can be stored into a variable. Programmers just need to simply declare a variable without assigning it a type Memory Management: Both Scheme and Javascript uses automatic garbage collection for heap memory management. That is, Scheme memory management system can scan and reclaim all dead objects, i.e. objects that will not be used in future, automatically. This frees the programmer from having to explicitly deallocate memory themselves. Exception Handling: A continuation reifies an instance of a computational process at a given point in the process's execution. It contains information such as the process's current stack (including all data whose lifetime is within the process e.g. "local variables"), as well the process' point in the computation [176]. In Scheme, Continuations can form the basis for implementing a simple throw/try/catch-style exception handling mechanism in just a few lines. However, things get rather more complicated if the mechanism is to work in programs that themselves use continuations. Therefore, several Schemes come with built-in exception handling capabilities [177] Javascript provide an exception handling mechanism allowing preventing application from crashing at run-time. Programmers can use try-catch to handle exception. 2.5.3 Web applications development Many implementation of Scheme can be used to develop a web application, and Schemes with an FFI (foreign function interface) can also support web programming. For example, openScheme and COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 60/139 RScheme have build-in CGI, incoming and outgoing HTTP, and HTML generation [178]. PLT Scheme has several web programming packages available, such as complete web server, CGI, MIME, and cookie handling. Gauche also has cgi and html generation bits in its standard library. JScheme can work in a similar way to Java Server Pages. Mod_lisp is an Apache module to easily write web applications in Lisp/Scheme[179]. LAML is a Scheme-based set of libraries for server side web programming. [180] Originally, Javascript for a web application are created to run on client-side, refer to Client-side Javascript (CSJA). Now, server-side Javascript (SSJA) is available. The first implementation of SSJS was Netscape's LiveWire, which was included in their Enterprise Server 2.0 back in 1996. Since then, a number of other companies have followed suit in offering an alternative to the usual server-side technologies, such as ASP of Microsoft and Jaxer of Aptana. These system support Javascript for accessing database, file system, send email and so on. 2.5.4 Web services design and composition Racket (or PLT Scheme) programming language has a massive set of libraries and tools which are suitable for specific domains such as web applications development, querying databases (MySQL.plt) and batch scripting and user interface prototyping [181]. Scheme does support HTTP transactions also it does support web development aside CGI programming. Scheme support also XML documents parsing and writing which is an advantage for supporting web services transactions [182]. Racket provides the xml library for parsing and generating XML documents which are represented in a structure type called X-pression [183]. Scheme does support web services [184]. Using Scheme, you can call web services methods through CGI programming facilities. Using Scheme, Amazon Web services (AWS) can be called in order to retrieve data from Amazon’s database [185]. There is an implementation of Scheme called Gambit which enables to write a stand alone executable web service. This implementation requires the Gambit-C which is a compiler that generates portables C code [186]. JavaScript is a scripting language which runs in web browser as part of them. In web applications, mostly, it is used on the client-side to ensure data validation and interaction with Document Object Model by embedding it within HTML tags. There are some implementations for JavaScript that run on the server-side. Thus, using Ajax API, a web application can communicate asynchronously with a web server in an interactive mode. This communication enables you to retrieve data form the web server using the XMLHttpRequest object [187]. JavaScript enables to call web services using Ajax (the XMLHttpRequest object) in order to retrieve customized data. Yahoo! and Amazon web services are a popular example for building XMLHttpRequest-based web services client in JavaScript [188]. 2.5.5 OO-based abstraction COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 61/139 Scheme support Object-Oriented programming, because it always pass message within the body, just like objects passing. In Scheme, it provides a procedural way to express its OOP features. Instantiate an object instance is represented as a procedure which project operation to methods while a method is somewhat like put the parameter into operation then perform operation on instance [189]. And it also support inheritance and polymorphism (by virtual method).In the listing 1 [190], it shows a class y inherit class x.Some Schemes implementation have their own built-in OO system (i.e. MacScheme, Feel, Oaklisp, XScheme, and PC-Scheme [191]). Most of these are similar to the Common Lisp Object System (CLOS), while others are conceptually closer to C++ and Java. Kawa is fully integrated with the Java object system, i.e. it allows Java classes to be defined and extended in Scheme [192]. The OOP syntax in different implementation of Scheme may vary depends on how it interoperates with the OO concept. In addition, the Scheme provides local encapsulation by closures. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 62/139 (define (y) (let ((super (new-part x)) (self 'nil)) (let ((y-state 2) ) (define (get-state) y-state) (define (set-self! object-part) (set! self object-part) (send 'set-self! super object-part)) (define (self message) (cond ((eqv? message 'get-state) get-state) ((eqv? message 'set-self!) set-self!) (else (method-lookup super message)))) self))) ; end y Listing 1 Class inheritance: Class y inherit from x JavaScript support OO-based abstraction (inheritance, polymorphism, encapsulation), although it is not a pure OO languages. Unlike Scheme, JavaScript have similar way in syntax with traditional OO language (i.e. java) which would be friendly adapted by java developer. In JavaScript, the straightforward way for constructing OO is the build-in object data type. In JavaScript, objects are implemented as a collection of named properties. Being an interpreted language, JavaScript allows for the creation of any number of properties in an object at any time. Everything is object in JavaScript, except for the primate data types and it classifies 3 types object (native objects, user-defined objects, and host objects (for browser purpose)). In JavaScript, each Object can inherit properties from another object, just like you extend the class for reuse purpose, called its prototype. When evaluating an expression to retrieve a property, JavaScript will check the properties which defined in the object firstly. If it is not found, it then looks at the object's prototype to see if the property is defined there. This continues up the prototype chain until reaching the root prototype [193] . Each object is associated with a prototype which comes from the constructor function from which it is created. The polymorphism achieved by calling correct name properties to involved the appropriate function for corresponding prototype. In the listing 2 [194], it shows a segment of polymorphism include using prototype and methods calls: COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 63/139 function A() { this.x = 1; } A.prototype.DoIt = function() // Define Method { this.x += 1; } function B() { this.x = 1; } B.prototype.DoIt = function() // Define Method { this.x += 2; } a = new A; b = new B; a.DoIt(); b.DoIt(); document.write(a.x + ', ' + b.x); Listing 2 Polymorphism in JavaScript 2.5.6 Reflection Scheme dose not support the reflection directly, But since scheme is dynamic type, it provide scheme predicates to determine the object type or the equivalence of two objects (using eq?, eqv?, and equal? as predicates) However, it is somewhat different than we expected, which rule is as follow: Two objects of different types (booleans, the empty list, pairs, numbers, characters, strings, vectors, symbols, and procedures) are distinct. Two objects of the same type with different contents or values are distinct. Thus we need to find a way to fix it. Scheme enables us using marco to reach the function of reflections. Some research paper [195] implements a marco-implemented extension PLT-Scheme for object-oriented programming which can interoperate with Java. That’s means we can invoked Java’s library within the PLT-scheme environment, so that invoked the reflection API is possible. Unlike the complicated implementation of Scheme in reflection, JavaScript provide a simple way to do that: do-in statement. Compared to other Scheme, it does not require extra libaries, no namespace, no particular implemented classes, or any other help from other languages. The syntax is just stratiforward: For (var member in obj){ alert(member); }; Listing 3 for-in statement The Listing 4 [196] shows a example for reflection which return the object’s properties and sort them. function getMembers(obj) { var members = new Array(); var i = 0; COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 64/139 for (var member in obj) { members[i] = member; i++; } return members.sort(); } Listing 4 reflection in JavaScript 2.5.7 Aspect-orientation PLT Scheme supports AOP and its macro system provides especially powerful support for linguistic extensions. Macro system provides a lightweight implementation of aspects.In Scheme, we can easily define language extensions using its macro system [200]. Scheme macros are effectively functions that rewrite syntax trees; they are more powerful than lexical macros. Scheme macros can define and export the new syntactic forms “around” and “fluid-around” which is frequently used in AOP [199]. The figures below shows an implementation of aspect-scheme for statically -scoped aspects, with base language PLT Scheme. (module aspect-scheme mzscheme ;; previous dynamic aspects part elided ;; statically-scoped aspects (define-syntax (around stx) (syntax-case stx () [( pc adv body) (syntax (w-c-m ’static-aspects (cons (make-aspect pc adv) (current-static-aspects)) body))])) (define-syntax (lambda/static stx) (syntax-case stx () [( params body . . . ) (syntax (let ([aspects (current-static-aspects)]) (_ params (w-c-m ’static-aspects aspects (begin body . . . )))))])) JavaScript is not really a place where AOP is used heavily or needed, since the use of callbacks already provides some level of separation of concerns. AOP may have limited utility in JavaScript.But with the JavaScript libraries such as jQuery, Javasrcipt can achieve decent separation of concerns [198]. jQuery also supports the use of custom events, which may be used in a similar manner to some AOP advice types. Indeed, the Ajax Events available for hooking into using jQuery already provide some sort of AOP-like functionality [197]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 65/139 COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 66/139 2.5.8 Functional programming Scheme is a functional programming and support closures with environment.. But scheme is not a pure functional programming which means that there are no variables, no assignment or side effects. Scheme use static scoping; nonlocal references in a function are resolved at the point of function definition. Static scoping is implemented by associating a closure [201]. Scheme characteristics: · Supports functional programming - but not on an exclusive basis · Functions are first class data objects · Uses static binding of free names in procedures and functions · Types are checked and handled at run time - no static type checking · Parameters are evaluated before being passed - no lazyness JavaScript uses functional as a library for functional programming. It defines the standard higherorder functions such as map, reduce, and select [202]. It also defines functions such as curry, rcurry, and partial for partial function application; and compose, guard, and until for function-level programming. And all these functions accept strings, such as 'x -> x+1', 'x+1', or '+1' as synonyms for the more verbose function(x) {return x+1}. All functions in Javascript are objects [203]. Javascript has the ability to write anonymous functions, or functions without a name. It can also pass functions as argument to other functions.Here is an example. var passFunAndApply = function (fn,x,y,z) { return fn(x,y,z); }; var sum = function(x,y,z) { return x+y+z; }; alert( passFunAndApply(sum,3,4,5) ); // 12 JavaScript is not one of the languages that use a variety of techniques to optimize function calls.Because of that, invoking a function in javascript is slow. Most current JavaScript implementations are slow with recursion and closures…two cornerstones of functional programming. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 67/139 2.5.9 Declarative programming Although scheme support funtional programming and the funtional is a subset of declarative language, the scheme language doesn’t support declarative programming. Declarative language suits when there is an implicit "behind the scenes" procedure or process that's going to do something uniform with the assertions or statements presented [204]. Scheme focus on what information is desired and what transformations are required. A functional language can help organize the expression of computation [205]. JavaScript is an implementation of the ECMAScript language standard and is typically used to enable programmatic access to computational objects within a host environment. JavaScript supports all the structured programming syntax in C (e.g., if statements, while loops, switch statements, etc.) [205]. Meanwhile, Structured programming can be seen as a subset or subdiscipline of imperative programming, one of the major programming paradigms. However, imperative programming which requires an explicitly provided algorithm is used in opposition to declarative programming, which expresses what needs to be done, without prescribing how to do it in terms of sequences of actions to be taken. Therefore, We could show Javascript doesn’t support declarative programming [205]. 2.5.10 Batch Scripting The Racket project provides useful libraries that enable developers to write scripts and automate tasks such as file processing (text or XML files) zip files creation using Racket’s gzip library and so on. Thus, Racket has what is called port which is an Input and Output stream for receiving or redirecting data to a file or a terminal [206]. This is a helpful technique that allows scripts to receive arguments as parameters. Rackets files could have on of these extensions (rkt, .rktl, .rktd, .scrbl, .plt, .ss, .scm) and can run on Windows or on a Unix-based system as executables. This feature enables Racket to be used for batch scripting. Natively, JavaScript it was designed to run inside a web browser. For security reason, JavaScript doesn’t provide support for Batch scripting. Internet Explorer (IE) browser provides ActiveXObject which enables to execute an external program from a web browser as shown in the code snippet below. To do so, the security settings should be changed in order to enable ActiveX support. This approach is not supported by other web browsers. In addition, JavaScript enables you to automate some of web browser’s functionalities. For example opening pop-up windows or bookmarking a web page [205]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 68/139 Running Notepad using JavaScript from Internet Explorer. <script language="javascript" type="text/javascript"> function runNotepad() { var shell = new ActiveXObject("WScript.shell"); shell.run("notepad.exe", 1, true); } </script> 2.5.11 UI prototype design There are many GUI and graphics libraries to support scheme for UI prototype design such as Racket Graphics Toolkit. Javascript is designed to add interactivity to HTML pages. So, it can support DHTML to create user interface and handle user action. 3 Consolidated Analysis and Synthesis of the Results COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 69/139 Default more secure programming practices Criteria 1 Features/PL Memory management C++ Yes(Manual memory management) Bounds checking Static Type checking Dynamic Type checking Type safety: Strong/weak Yes [232] No[233] N/A – not considered Exception handling N/A - not considered Compiled/ Interpreted N/A - not considered Conditional compilation N/A - not considered Assertions N/A - not considered AspectJ Yes, provided by the JVM Garbage collection, provided by the GHC Yes, for arrays and data structure. Yes, run time bounds checking Yes check on compile time PHP Default using GC(by PHP 5.3) or Manual(by extension API) Yes, run time bounds checking No, PHP is dynamic type checking [213] No, Haskell does not support casting Yes [214] (no type cascading) Partial dynamic checking, i.e down casting. Yes, , strongly type Not that safe(running time type checking may not efficient to avoid type error) Yes, , strongly type Yes, but more complex than Java Yes, using try-catch and can throw any kind of exception Yes, using try-catch with build-in Exception class Compiled or Interpreted by the GHC Interpreted by web server(i.e. Apache) Compiled to byteCode, and than interpreted by JVM Yes, but need to set in GHC options [207] Yes(but rarely used) Yes, but need some tricks[1] User self-defined Support(by PHP 4) Yes, Java support assert Yes, at compile time. Partial dynamic checking, i.e down casting. Also, when using reflection. Yes, Based on Java’s access rules. Yes, exceptions can be thrown in pointcuts. Handlers are used to catch exceptions in AspectJ. Within trycatch/finally block in Java code. Compiled, and the Javabyte code interpreted by a JVM compliant. Yes (using SCoPE compiler, conditional pointcut evaluator) Yes, temporal assertions at run-time[24] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Haskell 70/139 Scheme Garbage collection Yes, run time bounds checking Yes, check on compile time Default more secure programming practices Criteria 1 Features/PL Memory management Bounds checking Static Type checking Dynamic Type checking Type safety: Strong/weak Exception handling C# Yes, provided by the CLR Yes, also for array bounds (raise IndexOutOfRange exception), buffer overflow. It can be disabled in C# [25] Yes at compile time. Yes, since C# 4.0 (.NET System.Dynamic namespace) and dynamic keyword Yes, C# is strongly typed. The unsafe keyword can be used for allowing pointers use. Yes, Within trycatch/finally block. Multiple catch blocks is supported in C#. Compiled/ Interpreted Compiled, Interpreted by the CLR Conditional compilation Yes (using preprocessor directives)[21] Yes, Managed code assertions [22] Assertions Groovy JavaScript Yes (Garbage collection Garbage collection Java Garbage collection, provided by the JVM Scala Garbage collection by JVM Yes, run time bounds checking Yes, run time bounds checking Yes, run time bounds checking Yes [233] No Yes, check on compile time Yes, Scala support static type checking[215] Yes [233] a variable can hold an object of any type and cannot be restricted Partial dynamic checking, i.e down casting. Strong[215] (with type cascading ) No, weakly type Yes, , strongly type Safe, it is strongly type system Yes, using try-catch and can throw any kind of exception Yes, using try-catch with build-in Exception class Yes, using try-catch, but exceptions are not checked so effectively N/A - not considered N/A - not considered Try-catch block N/A - not considered Interpreted N/A - not considered Not support N/A - not considered User self-defined COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Compiled to byteCode, and than interpreted by JVM Yes, but need some tricks [208] Yes, Java support assert 71/139 Complied by JVM Yes(with the help of compiler flag) [217] Support, using assert, require and assume Web applications development Criteria 2 Features/PL C++ Dynamic Web Pages CSP Web Server Web Framework/Librari es Session management Security Model-ViewController Database interaction Secure Sockets Layer support Using Platinum, Reason, Evocosm, ACF. N/A - not considered N/A - not considered Wt/CppCMS/ffead N/A - not considered N/A - not considered N/A - not considered AspectJ Haskell Yes, injection Aspectj code in JSP pages Haskell Server Pages (HSP) Tomcat, JBoss, GlassFish Haskell Application Server (HAppS) Using J2EE, Spring or Struts framework. Yes, i.e using Spring which provides SessionManagementFilt er class and concurrency control [33]. Yes, Java web applications run in what is called container, Each application has its container. Thus, the JVM add By adding AspectJ’s aspects to J2EE/Spring/Struts applications. Yes, using the JDBC library Yes using OpenSSL library. N/A - not considered COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Snap, Turbinado web framework Yes, Snap have build-in session management. Yes Turbinado MVC framework PHP Support, the code behind php web page Apache, Microsoft IIS Many (i.e. Zend, Symfony, etc…) Yes, using $_SESSION variable Not that safe(require extra session management to avoid hacking and hijacking) Symfony/Mojavi/CakeP HP[218] Mysql Yes (HaskellDB) Yes, (hOpenSSL) Yes(use open SSL function) [219] Yes(store in user session) 72/139 Scheme PLT Scheme can create web page directly PLT Scheme web server SHP framework PLT Scheme libsm6 package Yes, PLT provides a Scheme interface to some of the OpenSSL functionality through its openssl collection SHP framework support MVC Yes (some package in PLaneT) Yes, openSSl Web applications development Criteria 2 Features/PL Dynamic Web Pages Web Server Web Framework/Librari es Session management Security Model-ViewController Database interaction Secure Sockets Layer support C# Yes, as code behind in ASP.NET web pages. IIS on Windows OS Mono (Apache, Nginx) Using .NET Framework on Windows and Mono ASP.NET Linux and Unix-based OSs. Yes, provided by ASP.NET State management. Yes (ASP.NET Security Architecture [34]) ASP.NET MVC 1.0/2.0 Yes, using ADO.NET library Yes, SSL certificate can be generated and used to on IIS server. Groovy JavaScript Java JSP Using Server-Side JavaScript (SSJS) [jh-4] JSP IIS, Apache Tomcat, JBoss, GlassFish N/A - not considered Mainly using Grails Framework. JAXER J2EE framework N/A - not considered Yes, using Jaxer.session Yes, are represented by an HttpSession object. N/A - not considered Yes Yes Yes, can create MVC structure using Jaxer J2EE/Spring/Struts N/A - not considered Yes, Jaxer.DB Yes (JDBC) N/A - not considered Yes Yes, JavaSSL [209] Grails COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 73/139 Scala Support Tomcat, Glassfish Not much(mainly use Lift) Yes, Session Actors Safe Spring/Pinky JDBC Yes, can using java ssl support Web services design and composition Criteria 3 Features/PL Web Services including(SOAP, WSDL, UDDI) Web services security C++ Yes. Supported by gSOAP toolkit. Yes.Support HTTPS and WS-Security: authentication,tokens, digital signatures Web Services composition N/A - not considered AspectJ Yes. i.e using Apache XML-RPC for Java library [38] or Spring Web Services, JAX-WS 2.1) Yes. HTTPS, above libraries support “XMLbased standards” such as WS-Policy, WSSecurity and WSTransfer standards) Web Services pipeline watching. Using AspectJ and J2EE framework, two or more web services can communicate together by linking them as a network. An application written in AspectJ can ensure the WS pipeline COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Haskell Yes. i.e using HAIFA PHP Yes(XML-RPC for PHP [220] ) Scheme Yes, Scheme supports web services but it requires CGI processing utilities [244]. Yes, hopenSSL help Haskell for HTTPS encrypt. Partially support(limited by soap interaction with WSDL) [221] Yes, PLT Scheme provides an openssl collection as part of it [255]. N/A - not considered Yes(declared by PHParray or policy files or inline with WDSL [222]) 74/139 Yes, Scheme web services can be built as a web services network where one or more web services can communicate together. Web services design and composition Criteria 3 Features/PL Web Services including(SOAP, WSDL, UDDI) Web services security Web Services composition C# Yes. using ASPT.NET web services and .NET’s System.Web.Services namespaces for Windows-based WS and Mono project’s Web Services on other OSs (Linux/Unix, Mac) Yes, HTTPS Encryption and signing with SSL[39], WS-Policy, WS-Security standards support) Using ASP.NET web services. Also a network of web services is possible by making two or more WS talking together. Groovy Yes. (Supported by Grails) Yes, rely on simple keystores or Spring Security for authorization and authentication.(since version 0.5) N/A - not considered COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai JavaScript Yes, it is possible using an AJAX/XMLHttpReques t-based web service client [sr-13]. Gmail and Google services are good examples. Java Yes. i.e using Apache XML-RPC for Java library [JL-6] or Spring Web Services, JAX-WS 2.1) Scala Yes(Apache XMLRPC[223]) Yes, Ajax can be used with any dynamic web programming language that support HTTPS protocol (SSL). Yes. HTTPS, above libraries support “XMLbased standards” such as WS-Policy, WSSecurity and WSTransfer standards) Web Services pipeline watching. support No, JavaScript doesn’t support web services composition. We can only consume web services using JavaScript. Yes(by Apache Axis2) [224] J2EE WS composition. 75/139 OO-based abstraction Criteria 4 Features/PL Central unit C++ Classes Structural elements N/A - not considered AspectJ Aspects, abstract Aspects Pointcuts, Advices, Inter-Type declarations for declaring aspect’s members (fields, methods, and constructors) Multiple inheritance Yes [235] No (Aspect Inheritance) Aspectual polymorphism [44]. Method overloading, method overriding, virtual method. By N/A - not considered default AspectJ methods are virtual (non-static methods). Using Intertype declaration. Partial Classes No, but it provides Inter-type declarations N/A - not considered (aka open classes) as alternative. Structs support No, doesn’t support N/A - not considered Structs declaration. Instantiation Aspect instantiation: not directly instantiated. N/A - not considered You cannot use the new keyword to instantiate an aspect. Extension/ Yes, “Aspect extension” Inheritance N/A - not considered Aspects can extend COMP 6411 - A Comparative studies of programming languages classes and implement Haskell Type class PHP Classes(by PHP 5) Scheme Meta Classes Methods, fields Type, Methods, Member Meta Object Protocol, simple-object. Yes, We have multiple inheritance if the instance consults multiple components (not including itself) for behavior. Yes, Haskell support multiple type class inheritance No(implemented by interface) Yes. The class methods defined by a Haskell class correspond to virtual functions. type class based overloading. Yes or No, because PHP is weakly type, and does not care about variable type. PHP does not support same function name with different parameter N/A - not considered Public/private/protected N/A - not considered No, all member function has to write together N/A - not considered Support(by Symphony struts) N/A - not considered Instantiate class object using keyword “new” N/A - not considered Polymorphism Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai No. Haskell does not support it No, doesn’t support Structs declaration. Yes, use instance keyword Yes, Haskell supports a notion of class extension 76/139 Accessibility control Public/private keyword interfaces, but Aspects can extend only abstract Aspects. Yes, privileged for Aspects, private, public and protected for intertype members. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai NO, module system must be used to hide or reveal components of a class. Yes(wrapping with C++ classes) [225] 77/139 N/A - not considered OO-based abstraction Criteria 4 Features/PL Central unit Structural elements Multiple inheritance Polymorphism Partial Classes Structs support Instantiation C# Classes, interfaces, abstract classes Constructors, Destructors, Methods, Fields (attributes), Delegates, Properties, Indexes, Events, Finalizes, Operators, Nested Classes. No, can be done by using Interface implementation as work around. Yes, through inheritance, based on Base Type and Sub Type relation. Method overloading, method overriding. C# provides the virtual Keyword which is derived from C++. Yes, separation of code (class definition split into two or more source files. Yes, derived from C++ with enhanced features. Yes, Class instantiation using the new keyword. Groovy JavaScript Java Classes Function Class Constructors, Methods, fields, traits, case class N/A - not considered Variable, function Constructors, Methods, Members. No, can be done by using Interface implementation. Yes, it support multiple inheritance No, but can implement multiple interface No(can use traits to implement) N/A - not considered Yes, basic feature for OOP. Method overloading. By default methods are virtual. Yes, Scala support type polymorphism. Yes, Scala support function overloading N/A - not considered N/A - not considered N/A - not considered N/A - not considered N/A - not considered Yes, can declare interface in a file and implement it in another file. No, doesn’t support Structs declaration. N/A - not considered N/A - not considered Yes, Class instantiation using the new keyword. Extension/ Inheritance Yes, “class extension”. A class may extend another class and may N/A - not considered implement one or more COMP 6411 - A Comparative studies of programming languages interface. Extension Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Scala Classes Yes, a class can extend a abstract class. N/A - not considered 78/139 Public/package/private/ protected Yes(by Scala 2.73 provide partial functions) Support(require external build tool for Scala) [226] Instantiate object using keyword “new” Accessibility control methods feature is supported since C# 3.0 but it requires a static class and static method to so [43]. Yes, C# provides private, public, protected, internal, sealed and protected internal keywords. Public/private keyword COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai N/A - not considered Yes, private, public and protected for inter-type members. 79/139 Can extend abstract class Reflection Criteria 5 Features/PL Access to program’s metadata C++ Yes. [234] Generation code at run-time Yes. [236] Dynamic invocation N/A - not considered AspectJ Yes, since AspectJ 5.0. Annotation-based development style. Haskell Yes, Monadic reflection AspectJ doesn’t provide such feature. Can be done using the following librairies. ASM http://asm.ow2.org and BCEL http://jakarta.apache. org/bcel Using thisJoinPoint to access the current join point for the advice through reflection. No, compile-time reflection COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai N/A - not considered PHP Yes(by using annotations and reflection API supported by PHP 5.3) Yes(after PHP 5.3, it provide runtime configuration ) N/A - not considered 80/139 Scheme Yes, access through library. Yes[ N/A - not considered Reflection Criteria 5 Features/PL Access to program’s metadata Generation code at run-time Dynamic invocation C# Yes, accessing Attributes through reflection using System. Reflection namespace. Yes, using .NET’s System.Reflection.Emi t namespace. Yes, method invocation at run-time through reflection [48]. Groovy JavaScript Yes, can access directly Java Yes, since Java 5.0. Annotation-based development style. Yes, compile-time reflection Yes, such as JUnit. Yes [237] N/A - not considered N/A - not considered N/A - not considered Yes [236]. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Scala Yes(by reflection API) No, compile time 81/139 N/A - not considered Aspect orientation Criteria 6 Features/PL Aspect-oriented programming C++ AspectJ Natively, it is an aspect-oriented programming language Require extra compiler supported Modularity isolate crosscutting but need extra compiler support. Isolate crosscutting concerns in a modular way. Haskell AOP Haskell is an AOP extension for Haskell Yes, same as AspectJ. Code reusability N/A - not considered Security Secure(base on java platform) Errors handling/Logging N/A - not considered Can produce pure uncoupled code Securing UI by detecting SingleThread UI’s rule and web services pipelines failure. N/A - not considered Cleaner way to handle and log exceptions N/A - not considered COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai PHP Require extra library supported isolate crosscutting but need extra aop library support. invoked external library to achieve Scheme Yes, as the family of languages with AOP features includes not only academic languages such as Scheme and ML but also industrially popular languages such as Python and Perl, defining aspects in this context takes on immediacy and importance Yes, object based message passing, Many Schemes provide their own modularization facilities. N/A - not considered Require extra library support N/A - not considered N/A - not considered Provide exception API by PHP 5.0 or wrapper functions 82/139 N/A - not considered Aspect orientation Criteria 6 Features/PL Aspect-oriented programming Modularity C# Partially, there are some no-mainstream projects implementing AOP for C#. Difficult some times impossible to isolate crosscutting concerns from the program’s business logic. Groovy Natively, it is an aspect-oriented programming language Same as AspectJ, provide crosscutting for handling on aspect JavaScript Java Yes, AspectJS is an AspectJ is extension open source and free of Java for AOP framework for AOP in Javascript Yes, we use the main module as the central point through which Same as AspectJ data is delivered to and from other modules Scala Natively AspectJ) Support(by Same as AspectJ, provide crosscutting for handling on aspect Code reusability Security Errors handling/Logging Can’t isolate code that crosscut over modules. Partially, N/A - not considered can be done using DLLs in order to reduce code coupling degree. Not applicable since Require extra there is no mainstream complier support AO solution for C#. Exceptions are handled in try-catch N/A - not considered blocks and logged within this scope. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai N/A - not considered Same as AspectJ Less coupled code N/A - not considered Same as AspectJ Secured by its access control N/A - not considered Same as AspectJ N/A - not considered 83/139 Functional programming Criteria 7 Features/PL Type inference C++ AspectJ No, planned for Java 7 N/A - not considered Lambda expression Anonymous methods Higher-order functions Yes [238] [239] Yes [239] Closure N/A - not considered First-class functions(delegat es) Recursion N/A - not considered Yes Using interfaces as a work around. No, use inner classes as work around Using interfaces as work around No, not popular enough an open source project for OpenJDK [58]) No, AspectJ doesn’t support delegates, lazy functional programming can be used as work around [53]. Not secure as in C# [57] due to infinite methods loop. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Haskell Yes, Haskell is not necessary to write for each variable Yes Yes, using a concise syntax Yes, Haskell can pass function as parameter and return function Yes, PHP Scheme Not support Yes(since PHP5.3) Yes(since PHP5.3) [227] Yes, PHP can assign function to variable which can be pass as parameters Yes(since PHP5.3) Yes [282] Yes [281] [283] N/A - not considered Yes[JL - 3] Yes, function is first class object N/A - not considered Yes, Haskell using recursion to support loop Yes 84/139 Yes [284] Functional programming Criteria 7 Features/PL Type inference Lambda expression Anonymous methods Higher-order functions Closure First-class functions(delegat es) Recursion C# Groovy Yes, functional programming’s N/A - not considered features have been introduced in C# 3.0 Yes, since C# 3.0 using LINQ library, No [239] [240] System.Linq.Expressio n namespace Yes, since C# 2.0 where this feature has N/A - not considered been introduced. Yes using C# delegates. JavaScript N/A - not considered Yes [281] N/A - not considered Yes [240] Yes [285] N/A - not considered N/A - not considered N/A - not considered N/A - not considered Yes Yes [286] Yes, since C# 3.0 Yes, delegates are C++’s function pointers equivxalent. Yes it is fully supported. Can be done using C#’s methods. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Java Functional Java – a extension of Java, but each variable has to assign a type No, Java does not support it No, Java has anonymous classes, but do not support anonymous functions Java cannot pass function and return function No, but Java simulate some features of closures [211] No, function is not first class object for Java Scala Yes Yes, defined in a very succinct fashion [227] Yes, Scala provides a relatively lightweight syntax for defining anonymous functions [277] Yes, can pass function and return function [227] Yes Yes [278] Yes, Java function can N/A - not considered call itself 85/139 Declarative programming Criteria 8 Features/PL Tags on methods/fields/ classes LINQ equivalent? Dynamic programming (Dynamic type checking) Declarative programming based on XML [41] C++ AspectJ Haskell PHP N/A AspectJ/Java Annotations Annotations annotations N/A Additional libraries, lamdaJ [63] Yes, basic feature Yes (require extra implementation support). N/A No, AspectJ doesn’t provide such features. No, Haskell is static type checking Yes Yes, Scheme is dynamic typing N/A YAML, SwiXML Yes, HAXML Symphony YAML XML Schema COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 86/139 Scheme LINQ for R6RS Scheme[287] Declarative programming Criteria 8 Features/PL Tags on methods/fields/ classes C# Using C# Attributes Yes, system.data.linq LINQ equivalent? library should be used and referenced. Dynamic Yes – since C# 3.0 programming (var keyword) and C# (Dynamic type 4.0 (dynamic checking) keyword) Declarative Using XAML programming technology which is based on XML available since .NET [41] 3.0 and WPF Groovy N/A - not considered N/A - not considered N/A - not considered JavaScript Java Scala N/A - not considered Annotations annotations N/A - not considered Additional libraries, lamdaJ No N/A - not considered YAML, SwiXML N/A - not considered COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai N/A - not considered 87/139 Yes No(static type checking) Bad support on XML [228] Batch scripting Criteria 9 Features/PL Run external programs/external commands C++ Yes [241] Tasks automation Yes(by COM objects) Accept command line arguments Yes [242] Need to be recompiled after changing the code source Not compared AspectJ Yes, using Java’s Process and Runtime classes. Haskell Yes, using system or rawsystem function Yes, can be executed as stand alone and executed on a scheduled basis. Yes Yes as parameters for the main method. i.e public static void main(string[] args) Yes Yes, code should be recompiled in order to source code changes take effect. Yes COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai PHP Yes, such as exec, system Yes(use cur command) Yes(by PHP CLI script) Yes [230] 88/139 Scheme Yes, using scheme/system [279] library which allows running external commands and programs. Yes, Racket’s files can be executed as standalone programs on Windows or on any Unix-based OSs. Yes, on Unix-based terminal or MS DOS using scheme/cmdline from Racket libraries [279]. Yes, need to recompile Racket scripts. Batch scripting Criteria 9 Features/PL C# Run external Yes, using Process programs/external class in commands System.Diagnostics namespace. Tasks automation Yes, can be executed as stand alone and executed on a scheduled basis. Accept command Yes as parameters for line arguments the Main method. i.e public static void Main(string[] args) Has to recompile Yes, code should be after changing the recompiled in order to code source source code changes take effect. Groovy Yes [243] Yes(by Groovy Monkey) Yes(using groovy script and listen mode) N/A - not considered COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai JavaScript Only with Internet Explorer using ActiveXObject. Java Yes, using Runtime class Yes, Yes, nearly in every web browsers with support for JavaScript. No, JavaScript run with a browser and not from the command line. No, no need to recompile JavaScript after changing the source code Scala Yes Yes Yes Yes Yes 89/139 Yes UI prototype design Criteria 10 Features/PL Graphical user interface C++ Yes, using Qt, a C++ class library. Built-in? N/A - not considered Look and feel N/A - not considered 2D and 3D support Yes using OpenGL AspectJ Haskell Yes, using Java’s built-in Swing and AWT libraries. WxHaskell, Gtk2Hs, HOC, qtHaskell and so on Yes, part of Java Foundation Classes Yes such as GTK+, Motif, Windows, Macintosh, etc themes. No, all are extension of Haskell N/A - not considered Yes, using Java.awt.dnd package. Components’ Layout Management N/A - not considered Yes, i.e Border/Grid layout, etc. Multiple document interface (MDI) Model-ViewController Yes using QT Support but not enforce. Declarative GUI development [41] N/A - not considered Performance N/A - not considered IDE/UI designer N/A - not considered Rich Web UI Development Deployment N/A - not considered N/A - not considered Single thread of execution N/A - not considered Event handling mechanism N/A - not considered COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai Yes, provided by AWT NetBeans, Plugins for Eclipse IDE Yes, using JavaFX framework. Jar archive (.jar files) Yes, Swing library’s single-thread rule, threadsafe[73] Only Event Listeners, provided by java.awt.event package or Yes, Racket Graphics Toolkit, PLT MrEd Graphical Toolbox Yes(using PHP-GTK+ by PHP 4.0) No, Yes Yes, FRAN [212] Yes, Gtk2Hs support D&D Yes, using layout container Yes, wxHaskell has basic MDI support Yes in components such as JTable and JList, etc. Glade XML, SwiXML: not popular yet as much as XAML Relatively Slow Yes(PHP-GTK embelled with HTML) Scheme More complex than Java Yes – Java 2D API Drag and Drop support PHP Yes, PHP-GTK 2 N/A - not considered Yes Yes, using frame% Yes, Racket GUI Application Framework Yes Yes, FranTk Yes – sgl library to support 3D Yes, pasteboard in MrEd [1] Yes, specifies the layout of a window by assigning each GUI element to a parent containerrs [2] GTK+ Working well on both Linux and windows Relatively Slow Glade Zend, Dreamware Using XAML Provide good memory performance WinScheme Editor HsWTK Yes .hs file Yes, Event Listeners Yes. Yes, PHP does not support multiple thread N/A - not considered Yes, Event Handlers N/A N/A 90/139 UI prototype design Criteria 10 Features/PL Graphical user interface Built-in? Look and feel 2D and 3D support Drag and Drop support Components’ Layout Management Multiple document interface (MDI) Model-ViewController Declarative GUI development [41] Performance IDE/UI designer Rich Web UI Development Deployment Single thread of execution Event handling mechanism C# Groovy JavaScript Java Yes, using .NET’s Windows Forms and WPF libraries. Built on top of the Base Class Library You need to import/reference System.Windows.Forms.dll for WinForms and System.Windows.dll WPF. WPF only on Windows platform [70] Yes, using Java’s built-in Swing and AWT libraries. Support DHTML to implement GUI Yes, using Java’s built-in Swing and AWT libraries. Yes(using ScalaGUI) Javascript has not built in GUI library. Yes, part of Java Foundation Classes Yes(using ScalaGUI, not much library as Java GUI) Very flexible, and easy to implement powerful UI on webpage, Javascript can support Html to show 2D graphic Yes such as GTK+, Motif, Windows, Macintosh, etc themes. Yes – Java 2D API and Java 3D API N/A - not considered No, does not support Yes, java.awt.dnd N/A - not considered N/A - not considered Yes, base on DHTML and Css Yes, Several AWT and Swing classes provide layout managers N/A - not considered Yes, using Java Swing library. No Yes, using JDesktopPane N/A - not considered Yes,enforce by Swing No Yes in components such as JTable and JList, etc. N/A - not considered N/A - not considered No, using XAML Javascript is a slow language Relatively Slow NetBeans, Plugins for Eclipse IDE N/A - not considered Not flexible enough in WinForms. Full customizable UI support in WPF N/A - not considered Yes, using WPF framework N/A - not considered Partially, only using WPF framework [71] Yes, this can be done automatically using Visual Studio’s UI designer. Yes, using, System.Windows.Forms.MdiLayout class. WinForms no, WPF Model-ViewViewModel [72] Using XAML technology Improved execution on windows Fast Visual Studio C# and SharpDevelop for Windows, MonoDevelop . Silverlight framework on windows and Moonlight implementation for Linux and other Unix-based OSs. .NET Assemblies: (executables and libraries, .exe and DLLs) Windows Forms (Not by default, but by applying the STAThread attribute to the Main method). WPF use by default a single thread of execution. Yes, Event Handlers and Delegates support N/A - not considered No N/A - not considered Yes, Javascript can only run in single thread N/A - not considered Yes, using JavaFX framework. Scala java GUI N/A - not considered N/A - not considered XAML Slow as java graphic Scala for eclipse, Net beans Silverlight framework on windows and Moonligh implementation for Linux and other Unix-based OSs. [ Jar archive (.jar files) N/A - not considered N/A - not considered Yes, Javascript can only run in single thread Yes, Swing library’s singlethread rule, thread-safe[46] N/A - not considered N/A - not considered Yes, can handle event coming from webpage Only Event Listeners N/A - not considered COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 91/139 o 3.1 Criteria 1: Default more secure programming practices The comparison tables show that the compared languages have different type system. Some of them are strongly typed and others are weakly typed. PHP, Groovy and JavaScript are dynamic typed which is not secure enough because type checking is performed at run-time. In C# 4.0, it is possible to use dynamic typing using the dynamic keyword. C#, Java, Haskell and Scalar are said strongly typed. Among these languages, only C++ doesn’t provide automatic memory management mechanism such as garbage collection and memory layout, etc which is not safe. In C++ dangling pointers, memory leak and double pointers free are well known issues where programmers are called to pay more attention to prevent them. All languages provide an exception handling mechanism for detecting errors and prevent applications from crashing. C# and Java have the best exception handling implementation by providing a set of customized exception classes. Haskell support exception handling, but it is a complex task to achieve. 3.2 Criteria 2: Web applications development We have found that all 10 languages support web applications development. However, we have found that ASP.NET/C#, PHP, Java/J2EE are particularly suited for easy web design. It is difficult to say which one is better than others. These three technologies provide powerful feature and have been adopted in large web applications development project. Thus, during the last decade they also gained popularity. PHP is an easiest language to learn, but it seems that it is not safe enough and doesn’t provide a strong type safety since it is dynamically typed. We have found out also that the remaining languages can also be used in web applications as CGI scripts, but are quite inconvenient and error-prone to program in them, maintain, and deploy. Hence, they require external libraries which are hard to configure, maintain and deploy. 3.3 Criteria 3: Web services design and composition PHP, Java, C#, Groovy and Scala enable developers to write web services. As shown in the comparison tables, we have found that ASP.NET/C#, PHP, Java/J2EE are particularly suited for developing WS. It is seems that Java/J2EE is better than others languages. Java is crossplatform and can be coupled with AspectJ to implement a secure, stable composed web services. ASP.NET/C# is an easiest language to learn. Visual Studio is a powerful IDE which provides helpful features for building and debugging web services applications. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 92/139 Also, we have found that is possible to build such applications using the remaining languages. But it is painful since they are natively not designed/suited for kind of applications and some external libraries are required to do so. 3.4 Criteria 4: OO-based abstraction According to our comparison table, Java, C#, Groovy, Scala are pure object-oriented programming languages. C++, PHP 5.0 also support OO development but they are not pure OOP and don’t provide all OO features found in Java and C#. C# and Java are particularly more suited for OO development. It is difficult to say which one is better than others. But C# has introduced more OO features such as Properties, Indexers, delegates, etc. Java and C# have a similar syntax and they are easy to learn, and both are strongly typed. Other partially support OOP, but in some of them OOP has been introduced lately or as extension libraries. However, they are not suited to be adopted in a large OO development project. 3.5 Criteria 5: Reflection Our comparison tables let us conclude that all compared languages support reflection and provide different mechanism to implement it. Some of them don’t require external libraries especially C# which provides the System.Reflection.Emit namespace that allow to generate code at run-time. AspectJ and Java indirectly provide this feature using external libraries such as ASM and BCEL. For others languages, reflection is supported but not mainly used in development. 3.6 Criteria 6: Aspect-orientation Based on our research, AspectJ was the first aspect-oriented language. Since it extends Java, it gained a wide popularity and has become mainstream language for AOP. Other languages may support AO if there are extensions available. For example, Groovy, Haskell and Scala have already mainstream extension for AOP. Unfortunately, there are no mainstream AOP extension for C#. To learn AspectJ, programmers have to be familiar with Java language since it inherits syntax and features from Java. C++ is not suited to AOP. Dealing with pointers in AO it is not safe enough and can result in memory issues. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 93/139 3.7 Criteria 7: Functional programming Obviously, Haskell and Scheme are natively functional programming languages. They provide all functional programming features, especially Haskell which is pure functional language. Basically Java, Groovy, AspectJ and Scala don’t support functional programming. Type inference is planned to be released with Java 7. C# 3.0 has been introduced with the release of LINQ which provides functional programming capabilities such as lambda expression, anonymous methods, and type inference and high-order functions. 3.8 Criteria 8: Declarative programming Our tables prove that Haskell is the best language to support declarative programming. Haskell is pure functional programming language with minimized side effect. Other languages provide what is called annotation mechanism which is considered as declarative approach since programmers provide information used by the program at run-time. A new declarative methodology has been introduced as extension to OOP based on XML technology. XAML was the first one introduced by Microsoft which enables developers to describe structured values and objects before coding. C# is the best language which is suited for mixing OOP and declarative style using LINQ services especially for querying database and XML files. 3.9 Criteria 9: Batch scripting According to our comparison studies, batch scripting is possible in all languages except JavaScript which is possible using ActiveXObject and Internet Explorer browser. PHP, C#, Scala and Java are the best. A program written in one of them can be automated (scheduled using Scheduled tasks in Windows and Crontab in a Unix-based system). PHP and C# are used to automate report generation such as sales report, job alerts, etc. PHP is more suited one since is not compiled, so if some changes has occurred on the source code, there is no need to recompile an already deployed script. 3.10 Criteria 10: UI prototype design After comparing more than ten features, we have found that is possible to create UI in any one of these 10 languages. C#, Java, Scala, Groovy and AspcetJ are particularly suited for GUI design. Java, Scala, Groovy and AspectJ GUIs are based on Java AWT/Swing libraries. There are a lot of extension libraries to support GUI design in Haskell but these libraries are not standardized and it is hard to make them working together. We conclude that PHP and JavaScript are more suitable for web pages UI design since they can easily mixed/embedded in HTML code. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 94/139 C# is the most suitable for designing and developing GUI. Visual Studio IDE provides a UI designer with a big set of pre-built component. Thus, C# can use WPF technology to create powerful highly customizable UIs. 4 Conclusion We have performed a thorough and detailed comparison of our selected programming languages to study within the specified criteria. We have found that, by their native design, each language is suited for a specific field. Some of them can be fully applied to the compared criteria without extensions. C# and Java have demonstrated that they are the more suitable for both web and desktop applications development. They are strongly typed which enable to write more secure programs. On the other hands, AspectJ as an extension of Java language is the best mainstream aspect-oriented language. PHP and JavaScript are particularly suitable for web development. Haskell and Scheme are better for functional programming. C++ is more suitable for system development and desktop applications. Scala and Groovy have extended Java. 4.1 Future work We'd like to refine our analysis of our languages within the stated criteria further as we become more familiar with them over time. We also plan on expanding our analysis onto other criteria and languages and provide more programming snippets as proof-of-concept illustrations. 4.2 Acknowledgments We would like to acknowledge the following people and entities who made this work possible: - Faculty of Engineering and Computer Science, Concordia University, Montreal, Canada. - Concordia University Libraries for access to the invaluable digital libraries of ACM, IEEE, Springer and others to do our research. - Wikipedia contributors with the wealth of information. - Our poor families, wives, husbands, children, parents, and pets to help us to get through the suering and sleepless nights and oer all their help and understanding while we were away from them while doing this project. Our POD, Yi Ji, for the introductions into AspectJ and Java reflection. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 95/139 Acronym and abbreviation IDE: Integrated Development Environment CLR: Common Language Runtime JVM: Java Virtual Machine DOS: Disk Operating System GUI: Graphical User Interface WPF: Windows Presentation Foundation API: Application Programming Interface WCF: Windows Communication Foundation RAD: Rapid Application Development API: Application Programming Interface JDBC: Java Database Connectivity SOA: Service Oriented Architecture J2EE: Java 2 Enterprise Edition TUI: Text User Interface CLA: Command Line Application MDI: JFC: LINQ: UI: BCL: Multiple Document Interface Java Foundation Classes Language Integrated Query User Interface Basic Class Library COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 96/139 References [1] The C++ Resources Network, http://www.cplusplus.com/ [2] AspectJ in Action, Practical Aspect-Oriented Programming, Ramnivas Laddad. ISBN: 1930110936 [3] Programming paradigm, Wikipedia, http://en.wikipedia.org/wiki/Programming_paradigm [4] AspectJ projecrt, Eclipse foundation, http://www.eclipse.org/aspectj/ [5] Haskell project, http://www.haskell.org/ [6] Scheme implementation choices, http://web.mit.edu/~axch/www/scheme/choices.html [7] Gambit project, http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Main_Page [8] PLT Scheme project, http://www.plt-scheme.org/ [9] The Scheme programming language, http://www.scheme.com/tspl3/ [10] Groovy (programming language), Wikipedia, http://en.wikipedia.org/wiki/Groovy_(programming_language) [11] Java programming language, http://en.wikipedia.org/wiki/Java_%28programming_language%29#Practices [12] [17] Introducing the Scala, “The Scala Programming languages”. Retrieve from: http://www.scala-lang.org/node/25 [13] Visual C# Developer Center, http://msdn.microsoft.com/en-ca/vcsharp/default.aspx [14] C# programming language , wikiepdia, http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29 [15] ECMA standard, http://www.ecma-international.org/default.htm [16] Unsafe Code Tutorial, http://msdn.microsoft.com/en-us/library/aa288474%28VS.71%29.aspx [17] Garbage collection (computer science), Wikipedia, http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29 [18] Data Types (C# Programming Guide), http://msdn.microsoft.com/en-us/library/ms173104%28VS.80%29.aspx [19] Bounds checking, Wikipedia, http://en.wikipedia.org/wiki/Bounds_checking [20] COMP 6411 lecture notes, Joey Paquet and Serguei A. Mokhov. [21]Comaparison of Java and C#, http://en.wikipedia.org/wiki/Comparison_of_Java_and_C_Sharp#Conditional_compilation [22]Assertions in Managed Code, http://msdn.microsoft.com/en-us/library/ttcc4x86%28v=VS.71%29.aspx [23]Static Conditional Pointcut Evaluator for AspectJ, http://www.graco.c.u-tokyo.ac.jp/ppp/index.php?Projects%2Fscope [24] J-LO, the Java Logical Observer, A tool for runtime-checking temporal assertions, http://www.sable.mcgill.ca/~ebodde/rv//JLO/ [25] MSDN’s blog, Array Bounds Check Elimination in the CLR, http://blogs.msdn.com/b/clrcodegeneration/archive/2009/08/13/array-bounds-check-eliminationin-the-clr.aspx [26] Project Hosting for Open Source Software, http://www.codeplex.com/ [27] Asp.net CRM, http://crm.codeplex.com/ [28] nopCommerce. Open Source online shop e-commerce solution, http://nopcommerce.codeplex.com/ [29] Lesiecki, N. "Applyinq AspectJ to J2EE application development," Software, IEEE , vol.23, no.1, pp.24-32, Jan.-Feb. 2006 doi: 10.1109/MS.2006.1 [30] SpringSourse Tool Suite, http://www.springsource.org/ [31] Frequently Asked Questions, Eclipse network resource http://www.eclipse.org/aspectj/doc/released/faq.php#q:aspectjandj2ee [53-] [32] J2EE vs. Microsoft.NET, http://media.techtarget.com/tss/static/articles/pdf/J2EE-vs-DotNET.pdf [33] SpringSource, Spring project, COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 97/139 http://static.springsource.org/spring-security/site/docs/3.0.x/reference/session-mgmt.html [34]ASP.NET Security Architecture, http://msdn.microsoft.com/en-us/library/yedba920.aspx [35] Tanenbaum, A. S. and van Steen, M. “Distributed Systems: Principles and Paradigms” [36] Sasa Subotic and Judith Bishop :"Emergent behaviour of aspects in high performance and distributed computing" ,Year of Publication: 2005,ISBN:1-59593-258-5 [37] Conceptual Overview, http://msdn.microsoft.com/en-us/library/ms731190.aspx [38] Apache XML-RPC project, http://ws.apache.org/xmlrpc/ [39] HTTP Security and ASP.NET Web Services, http://msdn.microsoft.com/en-us/library/ms996415.aspx [41] Object-Oriented Programming (C# and Visual Basic), http://msdn.microsoft.com/enus/library/dd460654.aspx [42] System.Web.Services Namespace, http://msdn.microsoft.com/en-us/library/9xe4bs0s.aspx [43] Extension Methods (C# Programming Guide), http://msdn.microsoft.com/en-us/library/bb383977.aspx [44] Erik Ernst and David H. Lorenz: "Aspects and polymorphism in AspectJ", Year of Publication: 2003, ISBN:1-58113-660-9 [45] New Reflection Interfaces, http://www.eclipse.org/aspectj/doc/next/adk15notebook/reflection.html [46] AspectJ, Eclipse network resource, http://www.eclipse.org/aspectj/doc/released/faq.php [47] Reflection Overview, http://msdn.microsoft.com/en-us/library/f7ykdhsy%28v=VS.80%29.aspx [48] MSDN, Reflection the C# programming guide, http://msdn.microsoft.com/en-us/library/ms173183%28VS.80%29.aspx [49] ASpectJ publications, http://dev.eclipse.org/viewcvs/indextech.cgi/aspectj-home/publications.html [50] Tigris.org Open Source Software Engineering Tools, http://aspectdng.tigris.org/ [51] Operating system + middleware, http://www.dcl.hpi.uni-potsdam.de/research/loom/ [52] "Delegates and functional programming in C#", David R. Naugler Southeast Missouri State University, Cape Girardeau, MO, 2004 [53] "Lazy functional programming in Java ", Anthony H. Dekker Defence Science and Technology Organisation, Canberra ACT SSN:0362-1340 [54] "Functional programming in Java", David R. Naugler, Southeast Missouri State University Cape Girardeau MO, ISSN:1937-4771 [55] Functional Programming for Everyday .NET Development, http://msdn.microsoft.com/en-us/magazine/ee309512.aspx [56] C# Recursion, http://www.meshplex.org/wiki/C_Sharp/Recursion [57] Avoiding Infinite Recursion with Stratified Aspects, http://www.sable.mcgill.ca/~ebodde/meta/ [58] Project Lambda, http://openjdk.java.net/projects/lambda/ [59] An Annotation Based Development Style, http://www.eclipse.org/aspectj/doc/next/adk15notebook/ataspectj.html [60] Introduction to Attributes, http://msdn.microsoft.com/en-us/library/Aa288059 [61] XAML Overview (WPF), http://msdn.microsoft.com/en-us/library/ms752059.aspx [62] YAML, Wikipedia, http://en.wikipedia.org/wiki/YAML [63] Lambdaj, http://code.google.com/p/lambdaj/ [41] Louridas, P.; , "Declarative GUI Programming in Microsoft Windows," Software, IEEE , vol.24, no.4, pp.16-19, July-Aug. 2007 doi: 10.1109/MS.2007.105 [38] [64] Basic Console Application (C#), http://msdn.microsoft.com/en-us/library/bb251798.aspx [65] Capitalization Styles, http://msdn.microsoft.com/en-us/library/x2dbyw72%28v=VS.71%29.aspx [66] Text-based (computing), Wikipedia, http://en.wikipedia.org/wiki/Text-based_%28computing%29 [67] Java SE Desktop Overview, http://java.sun.com/javase/technologies/desktop/ [68] Windows Forms, Wikipedia, http://en.wikipedia.org/wiki/Windows_Forms [69] Windows Presentation Foundation on the Web: Web Browser Applications, http://msdn.microsoft.com/en-us/library/aa480223.aspx#wpfandwbas_topic1 COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 98/139 [70] Mono project, WPF, http://www.mono-project.com/WPF [71] MSDN, .Net framework 4, Drag and Drop Overview, http://msdn.microsoft.com/en-us/library/ms742859.aspx [72] WPF Apps With The Model-View-ViewModel Design Pattern, http://msdn.microsoft.com/enus/magazine/dd419663.aspx [73] Threads and Swing, http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html [74] Comparison of programming languages, Wikipedia, http://en.wikipedia.org/wiki/Comparison_of_programming_languages [75] Web Applications, http://msdn.microsoft.com/en-us/library/ms235434(VS.80).aspx [76] WT, http://www.webtoolkit.eu/wt [77] C++ Applications, http://www2.research.att.com/~bs/applications.html [78] Web Development in Groovy using Groovlets, http://www.javabeat.net/articles/58-webdevelopment-in-groovy-using-groovlets-1.html [79] Groovy and Grails – A Getting Started Guide, http://www.indicthreads.com/1481/groovy-andgrails-a-getting-started-guide/ [80] Groovying XML, http://www.techbookreport.com/tutorials/groovy_xml_01.html [81] GroovyWS,The Groovy Resources Network, http://groovy.codehaus.org/GroovyWS [82] Groovy SOAP, The Groovy Resources Network, http://groovy.codehaus.org/Groovy+SOAP [83] Practically Groovy: Building, parsing, and slurping XML, http://www.ibm.com/developerworks/java/library/j-pg05199/index.html [84] Savage, W. J. (W. John). Groovy programming : an introduction for Java developers. Amsterdam ; Boston : Morgan Kaufmann Publishers. [85] WS-Eventing for WCF , http://www.codeproject.com/KB/WCF/WSEventing.aspx [86] The gSOAP Toolkit for SOAP Web Services and XML-Based Applications , http://gsoap2.sourceforge.net/ [87] Walkthrough: Creating an XML Web Service Using C++ and the CLR, http://msdn.microsoft.com/en-us/library/a86z84tw(VS.80).aspx [88] JN3025-Inheritance, The Groovy Resources Network, http://groovy.codehaus.org/JN3025Inheritance [89] Abstract Classes (C++), http://msdn.microsoft.com/en-us/library/c8whxhf1.aspx [90] Abstract classes(IBM) , http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/lang uage/ref/cplr142.htm [91] Liang, Y. Daniel. Introduction to programming with C++. Upper Saddle River, NJ ; Montreal : Prentice Hall. [92] Q&A for professional and enthusiast programmers , http://stackoverflow.com/questions/359237/why-does-c-not-have-reflection [93] JN3535-Reflection, The Groovy Resources Network, http://groovy.codehaus.org/JN3535Reflection [94] AspectC++, Wikipedia, http://en.wikipedia.org/wiki/AspectC%2B%2B [95] The Home of AspectC++, http://www.aspectc.org/Home.1.0.html [96] Groovy AOP, http://chanwit.blogspot.com/2007/12/groovy-aop-part-4-getter-and-setter.html [97] Easy AOP with GroovyInterceptable, http://www.justinspradlin.com/programming/easy-aop-withgroovyinterceptable/ [98] Suman Roychoudhury, Jeff Gray, Jing Zhang, Purushotham Bangalore, and Anthony Skjellum. A Program Transformation Technique to Support AOP within C++ Templates. Dept. of Computer and Information Sciences, University of Alabama at Birmingham, Alabama, USA [99] Functional Programming with Groovy, The Groovy Resources Network, http://groovy.codehaus.org/Functional+Programming+with+Groovy [100] Functional Programming in C++, http://www.cc.gatech.edu/~yannis/fc++/ COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 99/139 [101] Boost.FC++, http://www.cc.gatech.edu/~yannis/fc++/boostpaper/fcpp.html [102] Imperative programming, Wikipedia, http://en.wikipedia.org/wiki/Imperative_programming [103] How to make System command calls in Java/Groovy, http://stackoverflow.com/questions/2701547/how-to-make-system-command-calls-in-java-groovy [104] Windows Services, The Groovy Resources Network, http://groovy.codehaus.org/Windows+Services [105] robertbody C++ & *.BAT, http://www.robertbody.com/prog/cpp-bat.html [106] GUI Programming with Groovy, The Groovy Resources Network, http://groovy.codehaus.org/GUI+Programming+with+Groovy [107] The Groovy Resources Network, http://groovy.codehaus.org/api/index.html [108] Abdul-Jawad, Bashar. Groovy and Grails recipes. Berkeley, Calif. : Apress ; New York, N.Y. : Distributed to the book trade worldwide by Springer-Verlag New York. [109] König, Dierk. Groovy in action. Greenwich, [Conn.] : Manning. [110] Bryan O'Sullivan, Don Stewart, and John Goerzen(2008). Real World Haskell, (Chapter 17) O'Reilly Media [111] Haskell project, memory management, http://www.haskell.org/haskellwiki/GHC/Memory_Management [112] Sun Microsystems (April 2006), Memory Management in the Java HotSopt Virtual Machine [113] Haskell project, documentation, http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Data-Maybe.html [114] Bryan O'Sullivan, Don Stewart, and John Goerzen(2008). Real World Haskell, (Chapter 19) O'Reilly Media [115] Wikipedia, Web application, http://en.wikipedia.org/wiki/Web_application [116] Practical web programming in Haskell, Haskell wiki http://www.haskell.org/haskellwiki/Practical_web_programming_in_Haskell [117] Eric Armstrong , Jennifer Ball, Stephanie Bodoff, Debbie Bode, Carson, Ian Evans, Dale Green, Kim Haase, Eric Jendrock , J2EE 1.4 Tutalial, 2004 [118] Simon Foster, University of Sheffield, HAIFA : An XML Based Interoperability Solution for Haskell [119] Java API for XML-Based RPC (JAX-RPC), http://java.sun.com/webservices/jaxrpc/overview.html [120] Martin Sulzmann, Meng Wang, Aspect-Oriented Programming with Type Classes [121] Haskell's overlooked object system, http://homepages.cwi.nl/~ralf/OOHaskell/ [122] Oleg Kiselyov, Ralf lammel, Haskell's overlooked object system, 10 Sep, 2005[123] Andrzej Filinski, Monadic Reflection in Haskell, Datalogisk institut, Københavns Universitet, 2006 [124] Aspect-Oriented Programming in Java, http://www.voelter.de/data/articles/aop/aop.html [125] Functional Java project, http://functionaljava.org/ [126] Declarative programming, Wikipedia, http://en.wikipedia.org/wiki/Declarative_programming [127] Declarative Programming in Java using Annotations and Reflection, http://www.riedquat.de/articles/javaDecl [128] System.Cmd, http://www.haskell.org/ghc/docs/6.12.1/html/libraries/process-1.0.1.2/SystemCmd.html [129] Applications and libraries/GUI libraries, http://www.haskell.org/haskellwiki/Applications_and_libraries/GUI_libraries [130] Declarative Programming in Java, http://onjava.com/pub/a/onjava/2004/04/21/declarative.html [131] Haskell, http://www.haskell.org/haskellwiki/WxHaskell [132] Gtk2Hs, http://haskell.org/gtk2hs/ [133] Haskell/GUI, Wikepedia, http://en.wikibooks.org/wiki/Haskell/GUI [134] QtHaskell, http://qthaskell.berlios.de/ [135] Garbage collection, Retrieve from: COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 100/139 http://phparch.cn/index.php/php/62-articles-and-reviews/299-PHP%E4%B9%8B%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6 [136] Basic memory management, PHP Manual, Retrieve from: http://www.php.net/manual/en/internals2.memory.management.php [137] [13] Web service, Wikipedia, Retrieve: http://en.wikipedia.org/wiki/Web_service#cite_note-0 [138] A.Gutsmans, S.S Bakken and D.Rethans,Chpater 15.2 Memory Management, PHP 5 Power programming, Indianapolis: Prentice Hall [139] PHP exception handling, Retrieve from: http://www.microshell.com/programming/php/php-exception-handling/ [140] D.Wampler and A. Payne (2009), Chapter 5 sensible typing ,Programming in Scala,O’REILLY [141] M.Huniewicz, Scala-performance-garbage collection analysis, Retrieve from:http://blog.m1key.me/2010/04/scala-performance-garbage-collection.html [142] J.EICHAR, Exception handling, Retrieve from:http://daily-scala.blogspot.com/2009/09/exception-handling.html [143] PHP Web application, Retrieve from: http://en.wikipedia.org/wiki/PHP [144] D.Polak, Lift 1.0 released, Scala Blog Retrieve from: http://www.scala-blogs.org/2009/02/lift-10-released.html [145] A.Gutsmans, S.S Bakken and D.Rethans, chapter 1.3.1 XML and Web Services, chapter 8.7 PHP’s SOAP Extension, PHP 5 Power programming, Indianapolis: Prentice Hall [146] Web service, PHP Manual, Retrieve from: http://www.php.net/manual/en/refs.webservice.php [147] A.Gutsmans, S.S Bakken and D.Rethans, Forword, PHP 5 Power programming(pp.xii), Indianapolis: Prentice Hall [148] http://www.scala-lang.org/node/25 [149] XML-RPC working graph, Retrieve from: http://www.xmlrpc.com/ [150] K.Waterson, Abstract Classes, Retrieve from: http://phpro.org/tutorials/Object-Oriented-Programming-with-PHP.html [151] Tours of Traits, Retrieve from: http://www.scala-lang.org/node/126 [152] Tours of Traits, Retrieve from: http://www.scala-lang.org/node/126 [153] Reflection (Computer Science), Wikipedia, Retrieve from: http://en.wikipedia.org/wiki/Reflection_%28computer_science%29#PHP [154] Reflection, Retrieve from: http://www.tuxradar.com/practicalphp/16/4/0 [155] The Reflection class, PHP Manual. Retrieve from:http://www.php.net/manual/en/class.reflection.php [156] Chapter 12 Scala type system, programming Scala [157] Sample code example for Scala reflection, Retrieve from: http://gpiancastelli.altervista.org/scala-it/esempi/cap-12/jvm-script.scala [158] D.Sheiko, Aspect-Oritented Programming in PHP, Retrieved from: http://www.weberdev.com/ViewArticle/Aspect-Oriented-Programming-and-PHP [159] D.Wampler and A. Payne (2009), chapter 14: Scala tools, libraries, and IDE support: Java library interpretability, Programming in Scala (pp.369-381), O’REILLY [160] D. Wamper, Trait vs. Aspects in Scala, 2008, Retrieve from: http://blog.objectmentor.com/articles/2008/09/27/traits-vs-aspects-in-scala [161] D.Wampler and A. Payne (2009), chapter 14: Scala tools, libraries, and IDE support: Java library interpretability, Programming in Scala (pp.378-379), O’REILLY Available on: http://gpiancastelli.altervista.org/scala-it/esempi/cap-14/aspectj/complex.scala http://gpiancastelli.altervista.org/scala-it/esempi/cap-14/aspectj/complex-main.scala http://gpiancastelli.altervista.org/scala-it/esempi/cap-14/aspectj/LogComplex.aj [162] T.K Nieleson, The state of functional programming in PHP, Retrieve:http://www.sitepoint.com/blogs/2007/12/15/the-state-of-functional-programming-in-php/ [163][164][165]E.Begoli, Scala vs. F#: Comparing with functional programming features, 2010, Retrieve:http://www.developer.com/article.php/3883051/Scala-vs-F-Comparing-FunctionalProgramming-Features.htm [166] Scala (Programming language), Wikipedia Retrieve: http://en.wikipedia.org/wiki/Scala_(programming_language)#Functional_programming COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 101/139 [168] F.Kleine and S.Schmidt, Declarative Development using Annotations in PHP [pdf document], international PHP 2007 conference-spring edition [169] Declarative Programming, Wikipedia Retrieve from: http://en.wikipedia.org/wiki/Declarative_programming [170] Declarative Programming in Java using Annotation and reflection, Retrieve from:http://www.riedquat.de/articles/javaDecl [171] A.Gutsmans, S.S Bakken and D.Rethans, Chapter 16.2 PHP shell scripts,PHP 5 Power programming, Indianapolis: Prentice Hall [172] A.Gutsmans, S.S Bakken and D.Rethans, Chapter 14 Scala Tools, Libraries and IDE Support: CommandLineTool, PHP 5 Power programming, Indianapolis: Prentice Hall [173] S.Mattocks (2010), introduction, Pro PHP-GTK, Apress [174] S.Mattocks (2010), Chapter1 introduction php-gtk, Pro PHP-GTK (p11), Apress [175] ScalaGUI, ScalaWiki, Retrieve from: http://scala.sygneca.com/code/scalagui [176] Continuation, Wikipedia, http://en.wikipedia.org/wiki/Continuation [177] Scheme-faq-programming, http://community.schemewiki.org/?scheme-faq-programming [178] Rscheme, Wikipedia, http://en.wikipedia.org/wiki/RScheme [179] Mod_lisp, http://www.fractalconcept.com/asp/npl5/sdataQG97Qx90SRn$DM==/sdataQuvY9x3g$ecX [180] The LAML, http://www.cs.aau.dk/~normark/laml/ [181] The Racket project, http://racket-lang.org/ [182] http://classes.eclab.byu.edu/330/wiki/index.cgi?XMLandScheme [183] http://docs.racket-lang.org/xml/index.html [184] http://okmij.org/ftp/Scheme/search-mslib.scm [185] http://classes.eclab.byu.edu/330/wiki/index.cgi?SchemeAndAmazon [186] http://www.devx.com/opensource/Article/42778/1763/page/5 [187] Aptana project, Wikipedia, http://en.wikipedia.org/wiki/Aptana [188] Make Yahoo! Web Service REST Calls with JavaScript and XMLHttpRequest, http://developer.yahoo.com/javascript/howto-ajax.html [189] N.Adams and J.Rees, Object-oriented programming in scheme [190] A class y that inherits from x, http://www.cs.aau.dk/~normark/prog3-03/html/notes/oop-schemeself-demo-note-program-2.html [191] How do I do object-oriented programming in Scheme, http://www.faqs.org/faqs/schemefaq/part1/section-6.html [192] Object-Oriented programming systems in Scheme, http://www.cs.indiana.edu/schemerepository/code.oop.html [193] JavaScript Object-Oriented Programming, http://articles.sitepoint.com/article/orientedprogramming-2/4 [194] Object Oriented Programming in JavaScript, http://mckoss.com/jscript/object.htm [195] K.E Gary and Mathew Flatt, Compiling Java to PLT Scheme [196] Reflection in Javascript, http://lpetr.org/blog/archives/reflection-in-javascript [197] Scheme (programming language), wikipedia, http://en.wikipedia.org/wiki/Scheme_(programming_language) [198] Lambda calculus, Wikipedia, http://en.wikipedia.org/wiki/Lambda_calculus [199] Functional programming, Wikipedia, http://en.wikipedia.org/wiki/Functional_programming [200] Frequently Asked Questions for comp.lang.functional, http://www.cs.nott.ac.uk/~gmh/faq.html [201] Functional Javascript , http://www.hunlock.com/blogs/Functional_Javascript [202] Category:Functional languages, http://en.wikipedia.org/wiki/Category:Functional_languages [203] The Relation Reflection Scheme, http://onlinelibrary.wiley.com/doi/10.1002/malq.200710035/pdf [204] JavaScript, Wikipedia, http://en.wikipedia.org/wiki/JavaScript [205] Structured programming, Wikipedia, http://en.wikipedia.org/wiki/Structured_programming [205] http://www.tildemark.com/programming/javascript/adding-bookmark-this-to-your-websiteusing-javascr.html COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 102/139 [206] The Racket project, http://racket-lang.org/ [207] Adding Bookmark This link to your website using javascript, http://www.haskell.org/ghc/docs/6.10.2/html/users_guide/options-phases.html [208] Comparison of Java and C Sharp, Wikipedia, http://www.javapractices.com/topic/TopicAction.do?Id=64 [209] Bpsinfo.com, http://www.bpsinfo.com/javassl/ [210] Haskell/Polymorphism, Wikibooks, http://en.wikibooks.org/wiki/Haskell/Polymorphism [211] Closure (computer science), Wikipedia, http://en.wikipedia.org/wiki/Closure_%28computer_science%29#Java [212] Fran version 1.16, http://conal.net/Fran/ [213][214][215][216] Comparison of programming languages, Wikipedia, http://en.wikipedia.org/wiki/Comparison_of_programming_languages#Type_systems [217] Meta-Programming with Scala: Conditional Compilation and Loop Unrolling, http://michid.wordpress.com/2008/10/29/meta-programming-with-scala-conditionalcompilation-and-loop-unrolling/ [218] Top 10 PHP MVC frameworks, http://www.mustap.com/phpzone_post_73_top-10-phpmvc-frameworks [219] PHP introduciton, http://www.php.net/manual/en/intro.openssl.php [220] http://phpxmlrpc.sourceforge.net/ [221] S.Abeysinghe, PHP Web Services: Getting Started, retrieve: http://wso2.org/library/3032 [222] The apache software foundation, http://ws.apache.org/axis2/ [223] Using Scala to update LiveJournal tags, http://rafaelnaufal.com/blog/2009/05/23/usingscala-to-update-livejournal-tags-part-i/ [224] WS-SecurityPolicy With PHP, http://www.dimuthu.org/blog/2008/11/19/wssecuritypolicy-with-php/ [225] http://devzone.zend.com/article/4486 [226] scala-on-struts, http://github.com/leonm/scala-on-struts [227] Scala vs. F#: Comparing Functional Programming Features, http://www.developer.com/article.php/3883051/Scala-vs-F-Comparing-FunctionalProgramming-Features.htm [228] Working with Scala’s XML Support, http://www.codecommit.com/blog/scala/workingwith-scalas-xml-support [230] http://www.web-tech-india.com/articles/php/compiling_php_apache/#why [231] http://days2010.scala-lang.org/node/92 [232] Comparison of programming languages, Wikipedia, http://en.wikipedia.org/wiki/Comparison_of_programming_languages COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 103/139 [233] Type system, Wikipedia, http://en.wikipedia.org/wiki/Type_system [234] Reflection (computer science), Wikipedia, http://en.wikipedia.org/wiki/Reflection_(computer_science) [235] Multiple Inheritance and virtual Base Classes , http://www.deitel.com/articles/cplusplus_tutorials/20060225/virtualBaseClass/ [236] Reflection in C++, http://msdn.microsoft.com/en-us/library/y0114hz2(VS.80).aspx [237] Introduction, http://www.garret.ru/cppreflection/docs/reflect.html [238] Functional Programming in C++ , http://www.cc.gatech.edu/~yannis/fc++/ [239] Functional programming, Wikipedia, http://en.wikipedia.org/wiki/Functional_programming [240] Functional Programming with Groovy , http://groovy.codehaus.org/Functional+Programming+with+Groovy [241] Calling external program in C++ , http://www.velocityreviews.com/forums/t287554-calling-external-program-in-c.html [242] shell commands and c++ , http://forums.macrumors.com/archive/index.php/t-92081.html [243] Executing external processes in Groovy , http://startbigthinksmall.wordpress.com/2010/04/23/antexec-executing-external-processes-ingroovy/ [244] http://classes.eclab.byu.edu/330/wiki/index.cgi?SchemeAndAmazon [255] http://www.plt-scheme.org/software/openssl/ [266] http://javascriptsoapclient.codeplex.com/ [277] http://www.scala-lang.org/node/133 [278] http://en.wikipedia.org/wiki/First-class_function [279] http://docs.racket-lang.org/scheme/index.html?q=arguments [280] The Relation Reflection Scheme, http://onlinelibrary.wiley.com/doi/10.1002/malq.200710035/pdf [281] Scheme (programming language), wikipedia, http://en.wikipedia.org/wiki/Scheme_(programming_language) [282] Lambda calculus, http://en.wikipedia.org/wiki/Lambda_calculus [283] Functional programming, http://en.wikipedia.org/wiki/Functional_programming [284] Frequently Asked Questions for comp.lang.functional, http://www.cs.nott.ac.uk/~gmh/faq.html [285] Functional Javascript , http://www.hunlock.com/blogs/Functional_Javascript [286] Category:Functional languages, http://en.wikipedia.org/wiki/Category:Functional_languages [287] Wisdom and Wonder, http://www.wisdomandwonder.com/link/1027/linq-for-r6rs-scheme COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 104/139 Appendix A Source code Examples C# Console application: Simple calculator written in C# using Windows Forms: COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 105/139 namespace COMP6411.GuiPrototype { partial class Form1 { /// <summary> /// Required designer variable. /// /// <autor>Sleiman Rabah</autor> /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 106/139 #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnCalculate = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.txtNumber1 = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.txtNumber2 = new System.Windows.Forms.TextBox(); this.txtResult = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.lstErrors = new System.Windows.Forms.ListBox(); this.btnClear = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); this.btnCalculate.Location = new System.Drawing.Point(211, 174); this.btnCalculate.Name = "btnCalculate"; this.btnCalculate.Size = new System.Drawing.Size(75, 35); this.btnCalculate.TabIndex = 0; this.btnCalculate.Text = "Calculate"; this.btnCalculate.UseVisualStyleBackColor = true; this.btnCalculate.Click += new System.EventHandler(this.btnCalculate_Click); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 83); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(74, 17); this.label1.TabIndex = 1; this.label1.Text = "Number 1:"; // // txtNumber1 // this.txtNumber1.Location = new System.Drawing.Point(86, 78); this.txtNumber1.Name = "txtNumber1"; this.txtNumber1.Size = new System.Drawing.Size(100, 22); this.txtNumber1.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(6, 119); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(74, 17); this.label2.TabIndex = 3; COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 107/139 this.label2.Text = "Number 2:"; // // txtNumber2 // this.txtNumber2.Location = new System.Drawing.Point(86, 116); this.txtNumber2.Name = "txtNumber2"; this.txtNumber2.Size = new System.Drawing.Size(100, 22); this.txtNumber2.TabIndex = 4; // // txtResult // this.txtResult.Location = new System.Drawing.Point(86, 175); this.txtResult.Name = "txtResult"; this.txtResult.Size = new System.Drawing.Size(100, 22); this.txtResult.TabIndex = 5; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(25, 175); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(55, 17); this.label3.TabIndex = 6; this.label3.Text = "Results"; // // groupBox1 // this.groupBox1.Controls.Add(this.btnClear); this.groupBox1.Controls.Add(this.txtResult); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.btnCalculate); this.groupBox1.Controls.Add(this.txtNumber1); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.txtNumber2); this.groupBox1.Location = new System.Drawing.Point(28, 24); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(310, 215); this.groupBox1.TabIndex = 7; this.groupBox1.TabStop = false; this.groupBox1.Text = "Enter two numbers:"; // // lstErrors // this.lstErrors.FormattingEnabled = true; this.lstErrors.ItemHeight = 16; this.lstErrors.Location = new System.Drawing.Point(12, 267); this.lstErrors.Name = "lstErrors"; this.lstErrors.Size = new System.Drawing.Size(362, 116); this.lstErrors.TabIndex = 8; // // btnClear // COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 108/139 this.btnClear.Location = new System.Drawing.Point(211, 129); this.btnClear.Name = "btnClear"; this.btnClear.Size = new System.Drawing.Size(75, 29); this.btnClear.TabIndex = 7; this.btnClear.Text = "Clear"; this.btnClear.UseVisualStyleBackColor = true; this.btnClear.Click += new System.EventHandler(this.btnClear_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(392, 424); this.Controls.Add(this.lstErrors); this.Controls.Add(this.groupBox1); this.Name = "Form1"; this.Text = "COMP6411 - GUI Prototype"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); } #endregion private private private private private private private private private private System.Windows.Forms.Button btnCalculate; System.Windows.Forms.Label label1; System.Windows.Forms.TextBox txtNumber1; System.Windows.Forms.Label label2; System.Windows.Forms.TextBox txtNumber2; System.Windows.Forms.TextBox txtResult; System.Windows.Forms.Label label3; System.Windows.Forms.GroupBox groupBox1; System.Windows.Forms.ListBox lstErrors; System.Windows.Forms.Button btnClear; } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 109/139 using using using using System; System.Collections.Generic; System.Linq; System.Windows.Forms; namespace COMP6411.GuiPrototype { /// <summary> /// <autor>Sleiman Rabah</autor> /// </summary> static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 110/139 using System.ComponentModel; using System.Data; UI Application: usingC# System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace COMP6411.GuiPrototype { /// <summary> /// /// A UI from which calculates two integer. /// /// <author> Sleiman Rabah</author> /// </summary> public partial class Form1 : Form { public Form1() { InitializeComponent(); } /// <summary> /// Calculate the results based on the user entred values. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCalculate_Click(object sender, EventArgs e) { int result = 0; try { if (this.txtNumber1.Text != "" || this.txtNumber2.Text != "") { result = Int32.Parse(txtNumber1.Text) + Int32.Parse(this.txtNumber2.Text); this.txtResult.Text = result.ToString(); } } catch (Exception ex) { this.lstErrors.Items.Add(ex.Message); } } /// <summary> /// Clear the UI fields. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClear_Click(object sender, EventArgs e) { this.txtNumber2.Text = String.Empty; this.txtNumber1.Text = String.Empty; this.txtResult.Text = String.Empty; this.lstErrors.Items.Clear(); } } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 111/139 C# Console application: Launching processes/executing a program from a C# code. using System; using System.Diagnostics; using System.ComponentModel; namespace COMP6411.ProcessLauncher { /// <summary> /// <autor>Sleman Rabah</autor> /// </summary> class ProcessLauncher { // Notepad command. public static string szNotepade = "-note"; // Calculator command. public static string szCalculator = "-calc"; public static string szNone = "-err"; public static void Main(string[] args) { try { if (IsValid(args)) { // instantiate the System.Diagnostics.Process class Process myProcess = new Process(); // Tell whether the new process will be executed // using Shell or not myProcess.StartInfo.UseShellExecute = false; // Fill out the process name to be started: // often it is a program e.g: notepad if (args[0].Equals(ProcessLauncher.szCalculator)) { myProcess.StartInfo.FileName = "calc.exe"; } else if (args[0].Equals(ProcessLauncher.szNotepade)) { myProcess.StartInfo.FileName = "notepad.exe"; } else { myProcess.StartInfo.FileName = "no_one.exe"; } myProcess.StartInfo.CreateNoWindow = true; // Run/launch the processs myProcess.Start(); } else { // If arguments are invalid, display usage. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 112/139 Console.WriteLine("Usage: ProcessLauncher.exe [arg1]"); Console.WriteLine("\t -calc to run Calculator"); Console.WriteLine("\t -note to run Notepad"); Console.WriteLine("\t -err to raise an error"); } } catch (Exception e) { Console.WriteLine("A problem has occured while starting the process " + e.Message); } } /// <summary> /// Validates user commands. /// </summary> /// <param name="args">an array containing user's commands</param> /// <returns>boolean indicating whether commands are valid or not</returns> public static bool IsValid(string[] args) { if (args.Length == 1 ) { if ((args[0].Equals(ProcessLauncher.szCalculator) ||args[0].Equals(ProcessLauncher.szNotepade)) || args[0].Equals(ProcessLauncher.szNone)) { return true; } } return false; } } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 113/139 UI application in AspectJ and Java Swing: Same application as shown above (using C# and Windows Forms) package com.comp6411.aspect.gui; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.WindowConstants; /** * * A class for building a Swing-based GUI. * It calculates two integers. * * @author Sleiman Rabah */ public class CalculatorSample extends javax.swing.JFrame { private JPanel jPanel1; private JButton btnCalculate; private JTextArea txtErrors; private JTextField txtNumber2; private JTextField txtNumber1; private JTextField txtResult; private JLabel lblNumber2; private JLabel lblNumber1; private JLabel lblResult; private JPanel jPanel2; COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 114/139 private JButton btnClear; /** * Auto-generated main method to display this JFrame */ public static void main(String[] args) { CalculatorSample inst = new CalculatorSample(); inst.setLocationRelativeTo(null); inst.setVisible(true); } public CalculatorSample() { super(); initGUI(); } private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jPanel1 = new JPanel(); jPanel1.setLayout(new GridLayout(0, 2)); getContentPane().add(jPanel1, BorderLayout.NORTH); // -lblResult = new JLabel(); lblResult.setText("Result: "); // -lblNumber1 = new JLabel(); lblNumber1.setText("Enter Number 1:"); // -txtNumber2 = new JTextField(); // -lblNumber2 = new JLabel(); lblNumber2.setText("Enter Number 2:"); // -txtNumber1 = new JTextField(); //-txtResult= new JTextField(); // -btnCalculate = new JButton(); btnCalculate.setText("Calculate"); btnCalculate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { calculateResult(); } }); // -btnClear = new JButton(); btnClear.setText("Clear"); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearFields(); } }); // -jPanel1.add(lblNumber1); jPanel1.add(txtNumber1); jPanel1.add(lblNumber2); jPanel1.add(txtNumber2); COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 115/139 jPanel1.add(lblResult); jPanel1.add(txtResult); jPanel1.add(btnCalculate); jPanel1.add(btnClear); jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignOnBaseline(true); getContentPane().add(jPanel2, BorderLayout.SOUTH); jPanel2.setLayout(jPanel2Layout); jPanel2.setPreferredSize(new java.awt.Dimension(492, 136)); txtErrors = new JTextArea(); jPanel2.add(txtErrors); txtErrors.setPreferredSize(new java.awt.Dimension(450, 102)); } pack(); this.setSize(500, 417); this.setResizable(false); } catch (Exception e) { // add your error handling code here e.printStackTrace(); } } /** * Clear text fields. */ public void clearFields() { this.txtNumber1.setText(""); this.txtNumber2.setText(""); this.txtErrors.setText(""); this.txtResult.setText(""); } /** * Calculate the result and update the UI fields. */ public void calculateResult() { try { int result = 0; result = Integer.parseInt(this.txtNumber1.getText()) + Integer.parseInt(this.txtNumber2.getText()); this.txtResult.setText(""+ result); } catch (Exception e) { this.txtErrors.setText("An error has occured, only number are allowed: "+ e.getMessage()); } } } package com.comp6411.aspect.gui; import java.util.logging.Level; import java.util.logging.Logger; import org.aspectj.lang.Signature; COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 116/139 /** * * An aspect that intercepts the GUI methods and handles its exceptions. * * @author Sleiman Rabah * */ public aspect AspectGuiSample { Logger logger = Logger.getLogger("Log MethodEntries"); /** * Pointcut on public methods. */ pointcut all_publics(): call(public * CalculatorSample.*(..)); /** * Pointcut to handle exception. */ pointcut exceptionHandler() : call(* *.*(..)) && !within(AspectGuiSample); /** * Catch and log any exception. * * @param ex the exception thrown in ProcessLauncher.java */ after() throwing(Throwable ex) : exceptionHandler(){ logger.setLevel(Level.WARNING); Signature methodSignature = thisJoinPoint.getSignature(); System.err.println("AspectJ has caught an exception in method: "+ methodSignature.getDeclaringTypeName() + "." + methodSignature.getName()); System.err.println("AspectJ-Exception Trace:" + ex.getMessage()); //-logger.info(methodSignature.getDeclaringType().getName()); } /** * Advice to log methods entering: All called Swing methods will be displayed. * NOTICE: extra stuff can be done if desired before entring a method. */ before(): all_publics() { Signature methodSignature = thisJoinPoint.getSignature(); System.out.println("Entring method:" + methodSignature.getName()+ "()"); } /** COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 117/139 * Advice to log methods' execution ending: also, All called Swing methods will be displayed. * * NOTICE: extra stuff can be done if desired after returning from a method. */ after() returning() : all_publics() { Signature methodSignature = thisJoinPoint.getSignature(); System.out.println("Leaving method: "+ methodSignature.getName()+ "()"); } } Console application in AspectJ: package com.comp6411.aspect.batchscripting; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * A class which creates a process and runs a program in it. * * @author Sleiman Rabah */ public class ProcessLauncher { /** * Notepad command. */ public static String szNotepade = "-note"; /** * Calculator command. */ public static String szCalculator = "-calc"; public static String szNone = "-err"; public static void main(String[] args) throws IOException { if (ProcessLauncher.isValid(args)) { if (args[0].equals(ProcessLauncher.szCalculator)) { new ProcessLauncher().launchProcess("calc.exe"); } else if (args[0].equals(ProcessLauncher.szNotepade)) { new ProcessLauncher().launchProcess("notepad.exe"); } else { new ProcessLauncher().launchProcess("no_one.exe"); } } else { // If arguments are invalid, display usage. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 118/139 System.out.println("Usage: ProcessLauncher [arg1]"); System.out.println("\t -calc to run Calculator"); System.out.println("\t -note to run Notepad"); System.out.println("\t -err to raise an error"); } } /** * * @param iPorgramToRun The name of the program to be executed. * @throws IOException Throws an exception if failed to execute the process. */ public void launchProcess(String iPorgramToRun) throws IOException { Runtime myRunTime = Runtime.getRuntime(); Process myProcess = myRunTime.exec(iPorgramToRun); } /** * A method which validates entered command (user's commands) * * @param args An array containing user's commands * @return Boolean indicating whether commands are valid or not */ public static boolean isValid(String[] args) { if (args.length == 1) { if ( args[0].equals(ProcessLauncher.szCalculator) || args[0].equals(ProcessLauncher.szNotepade) || args[0].equals(ProcessLauncher.szNone) ){ return true; } } return false; } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 119/139 package com.comp6411.aspect.batchscripting; import java.util.logging.Level; import java.util.logging.Logger; import org.aspectj.lang.Signature; /** * An aspect which handles ProcessLaunchers's exceptions. * * @author Sleiman Rabah */ public aspect AspectProcessLauncher { Logger logger = Logger.getLogger("Log MethodEntries"); /** * Pointcut on public methods. */ pointcut all_publics(): call(public * ProcessLauncher.*(..)); /** * Pointcut to handle exception. */ pointcut exceptionHandler() : call(* *.*(..)) && !within(AspectProcessLauncher); /** * Catch and log any exception. * * @param ex the exception thrown in ProcessLauncher.java */ after() throwing(Throwable ex) : exceptionHandler(){ logger.setLevel(Level.WARNING); Signature methodSignature = thisJoinPoint.getSignature(); System.err.println("AspectJ has caught an exception: "+ methodSignature.getName()); System.err.println("AspectJ-Exception Trace:" + ex.getMessage()); //-logger.info(methodSignature.getDeclaringType().getName()); } /** * Advice to log methods entering. */ before(): all_publics() { Signature methodSignature = thisJoinPoint.getSignature(); System.out.println("Entring method:" + methodSignature.getName()+ "()"); } /** * Advice to log methods' execution ending. */ COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 120/139 after() returning() : all_publics() { Signature methodSignature = thisJoinPoint.getSignature(); System.out.println("Leaving method: "+ methodSignature.getName()+ "()"); } } A1.PHP Criteria 4 The following program was compiled and run using the Zend Development Environment available at http://www.zend.com/en/downloads/ with the following options. To execute it run the following: File-NEWFILE, then write code in Editor, Menu-Debug-Go. //Inheritance, Abstract Class, interface, encapsulation sample in PHP <?php abstract class mathematics{ /*** child class must define these methods ***/ abstract protected function getMessage(); abstract protected function addTwo($num1); /** * method common to both classes **/ public function showMessage() { echo $this->getMessage(); } } /*** end of class ***/ class myMath extends mathematics{ /** * Prefix to the answer * @return string **/ protected function getMessage(){ return "The anwser is: "; } /** * add two to a number * @access public * @param $num1 A number to be added to * @return int **/ public function addTwo($num1) { return $num1+2; } } /*** end of class ***/ /*** a new instance of myMath ***/ $myMath = new myMath; /*** show the message ***/ $myMath->showMessage(); /*** do the math ***/ echo $myMath->addTwo(4); COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 121/139 ?> A2. Scala Criteria4 The following program was compiled and run using the Scala-ide for eclipse (Eclipse 3.51 with JVM) which is available at http://www.scala-ide.org/ and http://www.eclipse.org/downloads/packages/release/galileo/sr2 with the following options. After installed the Scala PDT, build a scala project, and create file in the default package, put code in the scala file, then run them as Scala application. //Inheritance, interface, encapsulation in Scala package com.example trait Similarity { def isSimilar(x: Any): Boolean def isNotSimilar(x: Any): Boolean = !isSimilar(x) } class Point(xc: Int, yc: Int) extends Similarity { var x: Int = xc var y: Int = yc def isSimilar(obj: Any) = obj.isInstanceOf[Point] && obj.asInstanceOf[Point].x == x } object TraitsTest extends Application { val p1 = new Point(2, 3) val p2 = new Point(2, 4) val p3 = new Point(3, 3) println(p1.isNotSimilar(p2)) println(p1.isNotSimilar(p3)) println(p1.isNotSimilar(2)) } A3. PHP Criteria 6 The following program was compiled and run using the Zend Development Environment available at http://www.zend.com/en/downloads/ with the following options. To execute it run the following: Menu->File->NEWFILE, then write code in Editor, Menu->Debug->Go. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 122/139 <?PHP include("aop.lib.php"); // aop.lib.php is an external supported AOP library // , provide in the .zipfile with the submitted report $aspect1 = new Aspect(); $pc1 = $aspect1->pointcut("call Sample::Sample or call Sample::Sample2"); $pc1->_before("print 'PreProcess<br />';"); $pc1->_after("print 'PostProcess<br />';"); $pc1->destroy(); Class Sample { var $aspect; function Sample($aspect1) { $this->aspect = &$aspect1; Advice::_before($this->aspect); print 'Some business logic of Sample<br />'; Advice::_after($this->aspect); } function Sample2() { Advice::_before($this->aspect); print 'Some business logic of Sample2<br />'; Advice::_after($this->aspect); } } $Sample = new Sample(&$aspect1); $Sample->Sample2(); ?> A4. Scal a Crite ria 6 The followi ng progra m was compil ed and run using the Scalaide for eclipse (Eclips e 3.51 with JVM and AJDT plugin) which is available at http://www.scala-ide.org/ , http://www.eclipse.org/downloads/packages/release/galileo/sr2 , and http://www.eclipse.org/ajdt/downloads with the following options. After installed the Scala pdt and AJDT plug-in, create the Aspect project, then create a package , then put two .scala file into package. Then create an aspect in the package named LogComplex.aj. Finally, then run as Aspect program. // code-examples/ToolsLibs/aspectj/complex.scala package example.aspectj case class Complex(real: Double, imaginary: Double) { def +(that: Complex) = new Complex(real + that.real, imaginary + that.imaginary) def -(that: Complex) = new Complex(real - that.real, imaginary - that.imaginary) } // code-examples/ToolsLibs/aspectj/complex-main.scala package example.aspectj COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 123/139 object ComplexMain { def main(args: Array[String]) { val c1 = Complex(1.0, 2.0) val c2 = Complex(3.0, 4.0) val c12 = c1 + c2 println(c12) } } // code-examples/ToolsLibs/aspectj/LogComplex.aj // define point cut, advice for scala file. package example.aspectj; public aspect LogComplex { public pointcut newInstances(double real, double imag): execution(Complex.new(..)) && args(real, imag); public pointcut plusInvocations(Complex self, Complex other): execution(Complex Complex.$plus(Complex)) && this(self) && args(other); before(double real, double imag): newInstances(real, imag) { System.out.println("new Complex(" + real + "," + imag + ") called."); } before(Complex self, Complex other): plusInvocations(self, other) { System.out.println("Calling " + self + ".+(" + other + ")"); } after(Complex self, Complex other) returning(Complex c): plusInvocations(self, other) { System.out.println("Complex.+ returned " + c); } } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 124/139 C++ vs Grouvy: A.1 C++ Criteria 4 The following program was compiled and run using the GCC compiler in VC2008 which is available at http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e034391-8a4d-074b9f2bc1bf&displaylang=en. To execute it run the following code in the cpp file.. #ifndef FRUIT_H #define FRUIT_H #include<string> Using namespace std; Class Fruit { Public: Virtual void identify(){cout<<”Fruit”<<endl;} } Class Apple:public Fruit { Public: Void identify(){cout<<”Apple”<<endl;} } Class Orange:public Fruit { Public: Void identify(){cout<<”Orange”<<endl;} } #include<iostream> Using namespace std; #include<iomanip> #include “Fruit.h” Int main() { Fruit f; Apple a; Orange o; f.identify(); a.identify(); o.identify(); return 0; } COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 125/139 A.2 Groovy Criteria 4 The following program was compiled and run using the Groovy for eclipse (Eclipse 3.51 with JVM) which is available at http://groovy.codehaus.org/ and http://www.eclipse.org/downloads/packages/release/galileo/sr2 with the following options. After installed the Groovy, build a Groovy project, and create a Groovy class in the default package, put code in the class, then run them as Groovy application. abstract class A{ public int prev //field int signature //property abstract String sayFly(int k)//abastract method } class B extends A{ String sayBirds(int n){ "There are $n birds!" } String sayFly(int k){"There are $k flys!"} } def b= new B() //def a= new A() assert b.sayBirds(17) == 'There are 17 birds!' assert b.sayFly(10) == 'There are 10 flys!' b.signature= 19 assert b.signature == 19 //property 'signature' from A acts as part of B assert b.getSignature() == 19 A.3 C++ Criteria 6 COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 126/139 The following program was compiled and run using the GPL under VC2008 which is available at http://groovy.codehaus.org/ and http://www.aspectc.org/Download.2.0.html with the following options. After installed the AspectC++, build a project, and create a class in the default package, put code in the class, then run them as AspectC++ application. aspect Logging { ostream * _out ; // ordinary attributes public: void bind_stream (ostream *o) { _out = o; } // member function pointcut virtual logged_classes () = 0; // pure virtual pointcut // some advice advice execution(" % ...::%(...) ") && within( logged_classes ()) : before () { *_out << "executing " << JoinPoint :: signature () << endl; } }; A.4 Groovy Criteria 6 The following program was compiled and run using the Groovy for eclipse (Eclipse 3.51 with JVM) which is available at http://groovy.codehaus.org/ and http://www.eclipse.org/downloads/packages/release/galileo/sr2 with the following options. After installed the Groovy, build a Groovy project, and create a Groovy class in the default package, put code in the class, then run them as Groovy application. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 127/139 class SimplePOGO implements GroovyInterceptable { void simpleMethod1(){ System.out.println("simpleMethod1() called") } void simpleMethod2(String param1, Integer param2){ System.out.println("simpleMethod2(${param1},${param2}) called") System.out.println("sleeping...") Timer.sleep(2000) } def invokeMethod(String name, args){ System.out.println("time before ${name} called: ${new Date()}") //Get the method that was originally called. def calledMethod = SimplePOGO.metaClass.getMetaMethod(name, args) //The "?" operator first checks to see that the "calledMethod" is not //null (i.e. it exists). calledMethod?.invoke(this, args) System.out.println("time after ${name} called: ${new Date()}\n") } } simplePogo = new SimplePOGO() simplePogo.simpleMethod1() simplePogo.simpleMethod2("stringParam", 24) COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 128/139 A.1 Haskell, Criteria: Default secure programming practices, Exception handling part The following program show how Maybe handle exception divBy :: Integral a => a -> [a] -> Maybe [a] divBy _ [] = Just [] divBy _ (0:_) = Nothing divBy numerator (denom:xs) = case divBy numerator xs of Nothing -> Nothing Just results -> Just ((numerator `div` denom) : results) Use of Maybe [6] The following program show how Either handle exception divBy :: Integral a => a -> [a] -> Either String [a] divBy _ [] = Right [] divBy _ (0:_) = Left "divBy: division by 0" divBy numerator (denom:xs) = case divBy numerator xs of Left x -> Left x Right results -> Right ((numerator `div` denom) : results) Use of Either [6] A.2 Java, Criteria: Default secure programming practices, Exception Handling part The following program show Java exception handling. COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 129/139 public class sample{ public int divide( int a, int b){ if ( b == 0) throw new DivisionByZeroException( ); return a/b; } public static void main (String arg[]){ try{ int result = divide( 5, 0); } catch(DivisionByZeroException e){ system.out.println(e.getMessage()); } } } class DivisionByZeroException extends Exception{ DivisionByZeroException( ){ super(“Division by 0”); } DivisionByZeroException(String msg){ Super( msg ); } } Java exception handling A.3 Haskell, Criteria: Web application import Network.CGI import Text.XHtml page :: Html page = body << h1 << "Hello World!" cgiMain :: CGI CGIResult cgiMain = output $ renderHtml page main :: IO () main = runCGI $ handleErrors cgiMain Haskell web application 1 – out put text [7] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 130/139 import Network.CGI import Text.XHtml inputForm = form << [paragraph << ("My name is " +++ textfield "name"), submit "" "Submit"] greet n = paragraph << ("Hello " ++ n ++ "!") page t b = header << thetitle << t +++ body << b cgiMain = do mn <- getInput "name" let x = maybe inputForm greet mn output $ renderHtml $ page "Input example" x main = runCGI $ handleErrors cgiMain -- Get the value of an input variable, for example from a form. -- If the variable has multiple values, the first one is returned. getInput :: String -> CGI (Maybe String) Haskell web application 2 — Get user input [7] A.4 Java, Criteria: Web application import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public final class Hello extends HttpServlet { public void doGet( HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException { response.setContentType("text/html"); PrintWriter writer = response.getWriter(); writer.println("<html>"); writer.println("<head>"); writer.println("<title>A Sample Application</title>"); writer.println("</head>"); writer.println("<body>"); writer.println("Hello world"); writer.println("</body>"); writer.println("</html>"); } } Java web application — Output a text [7] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 131/139 A.5 Haskell, Criteria: OO-based abstraction shape newx newy self = do -- Create references for private state x <- newIORef newx y <- newIORef newy -- Return object as record of methods returnIO $ getX .=. readIORef x .*. getY .=. readIORef y .*. setX .=. writeIORef x .*. setY .=. writeIORef y .*. moveTo .=. (\newx newy -> do (self # setX) newx (self # setY) newy ) .*. rMoveTo .=. (\deltax deltay -> do x <- self # getX y <- self # getY (self # moveTo) (x + deltax) (y + deltay) ) .*. emptyRecord Object generator for shapes [13] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 132/139 rectangle newx newy width height self = do -- Invoke object generator of superclass super <- shape newx newy self -- Create references for extended state w <- newIORef width h <- newIORef height -- Return object as record of methods returnIO $ getWidth .=. readIORef w .*. getHeight .=. readIORef h .*. setWidth .=. (\neww -> writeIORef w neww) .*. setHeight .=. (\newh -> writeIORef h newh) .*. draw .=. do -- Implementation of the abstract draw method putStr "Drawing a Rectangle at:(" << self # getX << ls "," << self # getY << ls "), width " << self # getWidth << ls ", height " << self # getHeight << ls "\n" -- Rectangle records start from shape records .*. super Object generator for rectangles [13] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 133/139 circle newx newy newradius self = do super <- shape newx newy self ... returnIO ... .*. super Object generator for circles [13] myOOP = do -- Construct objects s1 <- mfix (rectangle (10::Int) (20::Int) 5 6) s2 <- mfix (circle (15::Int) 25 8) -- Create a homogeneous list of different shapes let scribble = consLub s1 (consLub s2 nilLub) -- Loop over list with normal monadic map mapM_ (\shape -> do shape # draw (shape # rMoveTo) 100 100 shape # draw) scribble Object construction and invocation as a monadic sequence [13] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 134/139 A.6 Java, Criteria: OO-based abstraction public class Shape{ protected int x; protected int y; public Shape(int x, int y){ this.x = x; this.y = y; } public int getX(){ return x; } public int getY(){ return y; } public void setX(int x){ this.x = x; } public void setY(int y){ this.y = y; } public void moveTo(int x, int y){ this.x = x; this.y = y; } public void rMoveTo(int deltaX, int deltaY){ this.x += deltaX; this.y += deltaY; } } Object generator for shapes public class Rectangle extends Shape{ private int w; private int h; public Rectangle (int x, int y, int w, int h){ super(x, y); this.w = w; this.h = h; } public int getW(){ return w; } public int getH(){ return h; } public void setW(int w){ this.w = w; } public void setH(int h){ this.h = h; } public void draw(){ system.out.println("Drawing a Rectangle at: " + x +", " + y + "Width: " + w + "Height: " + h); } } Object generator for rectangle COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 135/139 public class Circle extends Shape{ // similar to class Rectangle } Object generator for circle public class Main{ public static void main(String arg[]){ Shape s1 = new Rectangle(10, 20, 5, 6); Shape s2 = new Cirle(15, 25, 8); s1.draw(); s2.draw(); s1.moveTo(20, 30); s1.rMoveTo(10, 20); } } Main class A.7 Haskell, Criteria: Aspect-oriented import List(sort) insert x [] = [x] insert x (y:ys) | x <= y = x:y:ys | otherwise = y : insert x ys insertionSort [] = [] insertionSort xs = insert (head xs) (insertionSort (tail xs)) -- sortedness aspect N1@advice #insert# :: Ord a => a -> [a] -> [a] = \x -> \ys -> let zs = proceed x ys in if (isSorted ys) && (isSorted zs) then zs else error "Bug" where isSorted xs = (sort xs) == xs -- efficiency aspect N2@advice #insert# :: Int -> [Int] -> [Int] = \x -> \ys -> if x == 0 then x:ys else proceed x ys AOP Haskell Example[12] COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 136/139 A.8 Java, Criteria: Aspect-oriented package com.reg.dev.aspects; public class HelloWorld { public void print() { System.out.println("Hello World"); } public static void main(String [] args) { HelloWorld hw = new HelloWorld(); hw.print(); } } //the aspect pointcuts are dynamically weaved to create the following output: Entering print Hello World Exiting print AspectJ Example and output COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 137/139 A.9 Haskell, Criteria: UI Prototype design import Graphics.UI.Gtk main :: IO () main = do initGUI window <- windowNew hbox <- hBoxNew True 10 button1 <- buttonNewWithLabel "Button 1" button2 <- buttonNewWithLabel "Button 2" set window [windowDefaultWidth := 200, windowDefaultHeight := 200, containerBorderWidth := 10, containerChild := hbox] boxPackStart hbox button1 PackGrow 0 boxPackStart hbox button2 PackGrow 0 onDestroy window mainQuit widgetShowAll window mainGUI Gtk2Hs sample and output A.10 Java, Criteria: UI Prototype design Sample code output COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 138/139 public class Example extends javax.swing.JFrame { public Example(){ initComponents();} private void initComponents() { mainFrame = new javax.swing.JFrame(); button1 = new javax.swing.JButton(); button2 = new javax.swing.JButton(); javax.swing.GroupLayout mainFrameLayout = new javax.swing.GroupLayout(mainFrame.getContentPane()); mainFrame.getContentPane().setLayout(mainFrameLayout); mainFrameLayout.setHorizontalGroup( mainFrameLayout.createParallelGroup(javax.swing. GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE)); mainFrameLayout.setVerticalGroup( mainFrameLayout.createParallelGroup(javax.swing. GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE)); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Packing"); button1.setText("Button 1"); button2.setText("Button2"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(button1,javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(button2, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(button1, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(button2, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pack(); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Example().setVisible(true); }}); } private javax.swing.JButton button1, button2; private javax.swing.JFrame mainFrame; } Java Swing sample Java Swing Sample codes COMP 6411 - A Comparative studies of programming languages Sleiman Rabah, Jiang Li, Mingzhi Liu, Yuanwei Lai 139/139
6cs.PL
1 Coordinate Dual Averaging for Decentralized Online Optimization with Nonseparable Global Objectives* arXiv:1508.07933v2 [math.OC] 20 May 2016 Soomin Lee, Angelia Nedić, and Maxim Raginsky Abstract—We consider a decentralized online convex optimization problem in a network of agents, where each agent controls only a coordinate (or a part) of the global decision vector. For such a problem, we propose two decentralized variants (ODAC and ODA-PS) of Nesterov’s primal-dual algorithm with dual averaging. In ODA-C, to mitigate the disagreements on the primal-vector updates, the agents implement a generalization of the local information-exchange dynamics recently proposed by Li and Marden [1] over a static undirected graph. In ODA-PS, the agents implement the broadcast-based push-sum dynamics [2] over a time-varying sequence of uniformly connected digraphs. We show that√the regret bounds in both cases have sublinear growth of O( T ),√ with the time horizon T , when the stepsize is of the form 1/ t and the objective functions are Lipschitzcontinuous convex functions with Lipschitz gradients. We also implement the proposed algorithms on a sensor network to complement our theoretical analysis. I. I NTRODUCTION Decentralized optimization has recently been receiving significant attention due to the emergence of large-scale distributed algorithms in machine learning, signal processing, and control applications for wireless communication networks, power networks, and sensor networks; see, for example, [3]– [8]. A central generic problem in such applications is decentralized resource allocation for a multiagent system, where the agents collectively solve an optimization problem in the absence of full knowledge about the overall problem structure. In such settings, the agents are allowed to communicate to each other some relevant estimates so as to learn the information needed for an efficient global resource allocation. The decentralized structure of the problem is reflected in the agents’ local view of the underlying communication network, where each agent exchanges messages only with its neighbors. In recent literature on control and optimization, an extensively studied decentralized resource allocation problem is one where the system objective function f (x) P is given as a sum n of local objective functions, i.e., f (x) = i=1 fi (x) where fi is known only to agent i; see, for example [9]–[25]. In this case, the objective function is separable across the agents, but the agents are coupled through the resource allocation *The work has been partially supported by the National Science Foundation under grant no. CCF 11-11342 and by the Office of Naval Research under grant no. N00014-12-1-0998. S. Lee and M. Raginsky are with the Department of Electrical and Computer Engineering, University of Illinois at Urbana-Champaign, Urbana, IL, 61801 USA. A. Nedić is with the Department of Industrial and Enterprise Systems Engineering, University of Illinois at Urbana-Champaign, Urbana, IL, 61801 USA. Their emails are {lee203,angelia,maxim}@illinois.edu. Portions of this work were presented at the 2015 American Control Conference and at the 2015 International Symposium on Mathematical Programming. vector x. Each agent maintains and updates its own copy of the allocation/decision vector x, while trying to estimate an optimal decision for the system problem. The vector x is assumed to lie in (a subset of) Rd , where d may or may not coincide with the number of agents n. Another decentralized resource allocation problem is the one where the system objective function f (x) Pn may not admit a natural decomposition of the form i=1 fi (x), and the resource allocation vector x = (x1 , . . . , xn ) ∈ Rn is distributed among the agents, where each agent i is responsible for maintaining and updating only a coordinate (or a part) xi of the whole vector x. Such decentralized problems have been considered in [26]–[30] (see also the textbook [31]). In the preceding work, decentralized approaches converge when the agents are using weighted averaging, or when certain contraction conditions are satisfied. Recently, Li and Marden [1] have proposed a different algorithm with local updates, where each agent i keeps estimates for the variables xj , j 6= i, that are controlled by all the other agents in the network. The convergence of this algorithm relies on some contraction properties of the iterates. Note that all the aforementioned algorithms were developed for offline optimization problems. Our work in this paper is motivated by the ideas of Li and Marden [1] and also by the broadcast-based subgradient push, which was originally developed by Kempe et al. [2] and later extended in [32] and in [15], [16] to distributed optimization. Specifically, we use the local information exchange model of [1] and [2], [15], [16], [32], but employ a different online decentralized algorithm motivated by the work of Nesterov [33]. We call these algorithms ODA-C (Online Dual Averaging with Circulation-based communication) and ODA-PS (Online Dual Averaging with Push-Sum based communication), respectively. In contrast with existing methods, our algorithms have the following distinctive features: (1) We consider an online convex optimization problem with nondecomposable system objectives, which are functions of a distributed resource allocation vector. (2) In our algorithms, each agent maintains and updates its private estimate of the best global allocation vector at each time, but contributes only one coordinate to the network-wide decision vector. (3) We provide regret bounds in terms of the true global resource allocation vector x (rather than some estimate on x by a single agent). For both ODA-C and ODA-PS, √ we show that the regret has sublinear growth of √order O( T ) in time T with the stepsize of the form 1/ t + 1. Our proposed algorithm ODA-PS is closest to recent papers [34], [35]. The papers proposed a decentralized algorithm for 2 online convex optimization which is very similar to ODAPS in a sense that they also introduce online subgradient estimations in primal [34] or dual [35] space into information aggregation using push-sum. In these papers, the agents share a common decision set in Rd , the objective functions Pnare separable across the agents at each time (i.e., ft (x) = i=1 fti (x) for all t), and the regret is analyzed in terms of each agent’s own copy of the whole decision vector x ∈ Rd . Moreover, an additional assumption is made in [34] that the objective functions are strongly convex. The paper is organized as follows. In Section II, we formalize the problem and describe how the agents interact. In Section III, we provide an online decentralized dual-averaging algorithm in a generic form and establish a basic regret bound which can be used later for particular instantiations, namely, for the two algorithms ODA-C and ODA-PS. These algo√ rithms are analyzed in Sections IV, where we establish O( T ) regret bounds under mild assumptions. In Section VI, we demonstrate our analysis by simulations on a sensor network. We conclude the paper with some comments in Section VII. Notation: All vectors are column vectors. For vectors associated with agent i, we use a subscript i such as, for example, xi , zi , etc. We will write xki to denote the kth coordinate value of a vector xi . We will work with the Euclidean norm, denoted by k·k. We will use e1 , . . . , en to denote the unit vectors in the standard Euclidean basis of Rn . We use 1 to denote a vector with all entries equal to 1, while I is reserved for an identity matrix of a proper size. For any n ≥ 1, the set of integers {1, . . . , n} is denoted by [n]. We use σ2 (A) to denote the second largest singular value of a matrix A. II. P ROBLEM FORMULATION Consider a multiagent system (network) consisting of n agents, indexed by elements of the set V = [n]. Each agent i ∈ V takes actions in an action space X, which is a closed and bounded interval of the real line.1 At each time, the multiagent system incurs a time-varying cost ft , which comes from a fixed class F of convex functions f : Xn → R. The communication among agents in the network is governed by either one of the two following models: (G1) An undirected connected graph G = (V, E): If agents i and j are connected by an edge (which we denote by i ↔ j), then they may exchange information with one another. Thus, each agent i ∈ V may directly communicate only with the agents in its neighborhood Ni , {j ∈ V : i ↔ j} ∪ {i}. Note that agent i is always contained in its own neighborhood. (G2) Time-varying digraphs G(t) = (V, E(t)), for t ≥ 1: If there exists a directed link from agent j to i at time t (which we denote by (j, i)), agent j may send its information to agent i. We use the notation Niin (t) and Niout (t) to denote the in and out neighbors of agent i at time t, respectively. That is, Niin (t) , {j | (j, i) ∈ E(t)} ∪ {i}, 1 Everything easily generalizes to X being a compact convex subset of a multidimensional space Rd ; we mainly stick to the scalar case for simplicity. Niout (t) , {j | (i, j) ∈ E(t)} ∪ {i}. In this case, we assume that there always exists a selfloop (i, i) for all agent i ∈ V. Therefore, agent i is always contained in its own neighborhood. Also, we use di (t) to denote the out degree of node i at time t. i.e., di (t) , |Niout (t)|. We assume B-strong connectivity of the graphs G(t) with some scalar B > 0, i.e., a graph with the following edge set tB [ EB (t) = E(i) i=(t−1)B+1 is strongly connected for every t ≥ 1. In other words, the union of the edges appearing for B consecutive time instances periodically constructs a strongly connected graph. This assumption is required to ensure that there exists a path from one node to every other node infinitely often even if the underlying network topology is timevarying. The network interacts with an environment according to the protocol shown in Figure 1. We leave the details of the signal generation process vague for the moment, except to note that the signals received by all agents at time t may depend on all the information available up to time t (including f1 , . . . , ft , as well as all of the local information exchanged in the network). Moreover, the environment may be adaptive, i.e., the choice of the function ft may depend on all of the data generated by the network up to time t. Parameters: base action space X; network graph G = (V, E); function class F For each round t = 1, 2, . . .: (1) Each agent i ∈ V selects an action xi (t) ∈ X (2) Each agent i ∈ V exchanges local information with its neighbors Ni (3) The environment selects the current objective ft ∈ F , and each agent receives a signal about ft Fig. 1. Online optimization with global objectives and local information. Let us denote the network action at time t by x(t) = (x1 (t), . . . , xn (t)) ∈ Xn . (1) We consider the network regret R(T ) at an arbitrary time horizon T ≥ 1: R(T ) , T X t=1 ft (x(t)) − infn y∈X T X ft (y). (2) t=1 Thus, R(T ) is the difference between the total cost incurred by the network at time T and the smallest total cost that could have been achieved with a single action in Xn in hindsight (i.e., with perfect advance knowledge of the sequence f1 , . . . , fT ) and without any restriction on the communication between the agents. The problem is to design the rule (or policy) each agent i ∈ V should use to determine its action xi (t) based on the 3 local information available to it at time t, such that the regret in (2) is (a) sublinear as a function of the time horizon T and (b) exhibits “reasonable” dependence on the number of agents n and on the topology of the communication graphs. The regret in (2) is defined over the true network actions of individual agents, i.e., xi (t)’s, rather than in terms of some estimates of x(t) by individual agents. This notion of regret, which, to the best of our knowledge has been first introduced in [30], is inspired by the literature on team decision theory and decentralized control problems: The online optimization is performed by a team of cooperating agents facing a time-varying sequence of global objective functions ft , which are (in contrast to decomposable P nondecomposable i i objectives i ft (x), where ft is only revealed to agent i). Communication among agents is local, as dictated by the network topology, so no agent has all the information in order to compute a good global decision vector x(t). By comparing the cumulative performance of the decentralized system to the best centralized decision achievable in hindsight, the regret in (2) captures the effect of decentralization. It also calls for analysis techniques that are different from existing methods in the literature. III. T HE BASIC ALGORITHM AND REGRET BOUND We now introduce a generic algorithm for solving the decentralized online optimization problem defined in Section II. The algorithm uses the dual-averaging subgradient method of Nesterov [33] as an optimization subroutine. Each agent i ∈ V generates a sequence {xi (t), zi (t)}∞ t=1 in n X × Rn , where the primal iterates xi (t) = (x1i (t), . . . , xni (t)) ∈ Xn and the dual iterates zi (t) = (zi1 (t), . . . , zin (t)) ∈ Rn are updated recursively as follows: 1 k k δ ui (t) + Fi,t (mi (t)) , k ∈ [n] ri i xi (t + 1) = Πψ Xn (Gi,t (zi (t + 1)), α(t)) zik (t + 1) = Euclidean norm k · k, i.e., for any x, y ∈ Xn we have 1 ¯ (5) ψ(y) ≥ ψ(x) + h∇ψ(x), y − xi + kx − yk2 , 2 ¯ denotes an arbitrary subgradient of ψ. where ∇ψ The dual iterate zi (t) computed by agent i at time t will be an estimate of the “running average of the subgradients” as seen by agent i, and will constitute an approximation of the true centralized dual-averaging subgradient update of Nesterov’s algorithm. The messages from Ni entering into the dual-space dynamics are crucial for mitigating any disagreement between the agents’ local estimates of what the network action should be. The primal iterate xi (t) of agent i at time t is an approximation of the true centralized primal point for the subgradient evaluation. Note that in (3a) the local update ui (t) based on the signal about ft affects affects only the ith coordinate of the dual iterate zi (t + 1), while all other coordinates with k 6= i remain untouched except for the averaging. The action of agent i at time t is then given by xi (t) = xii (t), i.e., by the ith component of the vector xi (t). A concrete realization of the algorithm (3a)-(3b) requires specification of the rules for computing the local update ui (t), k the messages exchanged by the agents, and the mappings Fi,t and Gi,t . In this paper, we present two different instantiations of this algorithm, namely, the circulation-based method inspired by [1] and the push-sum based method inspired by [2], [15], [16], [32]. We call these algorithms ODA-C (Online Dual Averaing with Circulation-based communication) and ODAPS (Online Dual Averaing with Push-Sum based communication) and detail them in Section IV and V, respectively. We now present a basic regret bound that can be used for any generic algorithm of the form (3a)-(3b) under the following assumption: Assumption 1: All functions f ∈ F are Lipschitz continuous with a constant L: |f (x) − f (y)| ≤ Lkx − yk (3a) (3b) with the initial condition zi (0) = 0 for all i ∈ V. In the dual update (3a), δik is the Kronecker delta symbol, ri > 0 is a positive weight parameter, ui (t) ∈ R is a local update computed by agent i at time t based on the received signal about ft , mi (t) are the messages received by agent i at time t [from agents in Ni under the model (G1) or from Niin (t) under k the model (G2)], and Fi,t , k ∈ [n], are real-valued mappings that perform local averaging of mi (t). In the primal update (3b), Gi,t : Rn → Rn is a mapping on dual iterates, {α(t)}∞ t=0 is a nonincreasing sequence of positive step sizes, and the n n mapping Πψ Xn : R × (0, ∞) → X is defined by   1 ψ (4) ΠXn (z, α) , arg min hz, xi + ψ(x) , α x∈Xn where ψ : Xn → R+ is a nonnegative proximal function. We assume that ψ is 1-strongly convex with respect to the for all x, y ∈ Xn . n Theorem 1: Let {xi (t)}∞ t=1 ⊂ X , i ∈ V, be the sequences of the agents’ primal iterates, let {u(t)}∞ t=1 with u(t) = (u1 (t), . . . , un (t)) be the sequence of the agents’ local n updates, and let {x̄(t)}∞ t=1 ⊂ X be generated as ! t X ψ x̄(t + 1) = ΠXn u(s), α(t) . (6) s=0 Then, under Assumption 1, the network regret R(T ) in (2) can be upper-bounded in terms of u(t) and x̄(t) as follows: for each T ≥ 1, T C 1X α(t − 1)ku(t)k2 + R(T ) ≤ 2 t=1 α(T ) | {z } (E1) +L T X n X T X √ kxi (t) − x̄(t)k + nDX k∇ft (x̄(t)) − u(t)k, t=1 i=1 | t=1 {z (E2) } | {z (E3) } 4 IV. ODA-C AND ITS REGRET BOUND where DX , supx,y∈X |x − y| is the diameter of the set X, and C , supx∈Xn |ψ(x)|. Remark Since ψ is a continuous function on the compact set Xn , C < ∞ by the Weierstrass theorem. We now introduce a decentralized online optimization algorithm which uses a circulation-based framework for its dual update rule (3a). We refer to this algorithm as ODA-C (Online Dual Averaing with Circulation-based communication). ODAC uses the network model (G1) for its communication. Proof: For any t and any y ∈ Xn we can write A. ODA-C ft (x(t)) − ft (y) Fix a vector r = (r1 , . . . , rn ) of positive weights and a nonnegative n×n matrix M , such that Mij 6= 0 only if j ∈ Ni , satisfying the following symmetry condition: = ft (x(t)) − ft (x̄(t)) + ft (x̄(t)) − ft (y) ≤ h∇ft (x(t)), x(t) − x̄(t)i + h∇ft (x̄(t)), x̄(t) − yi ≤ Lkx(t) − x̄(t)k + h∇ft (x̄(t)), x̄(t) − yi, (7) where the second step follows from convexity of ft , while the last step uses the fact that all f ∈ F are L-Lipschitz. Recalling that x(t) is the network action vector (see (1)), we have the following for the first term in (7): kx(t) − x̄(t)k = n X ri Mij = rj Mji , ≤ zik (t + 1) =  xi (t) − x̄i (t) ei kxi (t) − x̄(t)k, (8) i=1 where the equality follows from the definition of x(t) in (1) and x̄(t) = (x̄1 (t), . . . , x̄n (t)). The second term in (7) can be further expanded as h∇ft (x̄(t)), x̄(t) − yi = hu(t), x̄(t) − yi + h∇ft (x̄(t)) − u(t), x̄(t) − yi. (9) Now, from relation (6) we obtain ) ( t X 1 ψ(x) . hu(s), xi + x̄(t + 1) = arg min α(t) x∈Xn s=0 Therefore, by [36, Lemma 3], we can write (10) For the second term on the right-hand side of (9), we have h∇ft (x̄(t)) − u(t), x̄(t) − yi ≤ kx̄(t) − ykk∇ft (x̄(t)) − u(t)k √ ≤ nDX k∇ft (x̄(t)) − u(t)k. xi (t + 1) = 1 k δ ui (t) + zik (t) ri i n X  k k + Mij vj→i (t) − vi→j (t) , k ∈ [n] (13a) j=1 ψ ΠXn (zi (t + 1), α(t)) , Combining the estimates in Eqs. (7)-(11) and taking the supremum over all y ∈ Xn , we get the desired result.  Theorem 1 indicates that the regret will be small provided that (E1) The squared norms ku(t)k2 remain bounded. (E2) The agents’ primal variables xi (t) do not drift too much from the centralized vector x̄(t). (E3) The vectors u(t) stay close to the gradients ∇ft (x̄(t)). This theorem plays an important role in the sequel, since it provides guidelines for designing the update rule ui (t) and the k mappings Fi,t (·) and Gi,t (·). We will also see later that the centralized vector x̄(t) represents a “mean field” of the primal iterates xi (t) for i ∈ V at time t. (14) and feeds this signal back into the dynamics (13a). Note, however, that the execution of the algorithm will not change if the agents never directly learn the full function ft , nor even the full gradient ∇ft (x(t)), but instead receive the local gradient signal ∇ft (xi (t)). The messages vi→j (t) take the form k vi→j (t) = zik (t) (11) (13b) 1 n where (vj→i (t), . . . , vj→i (t)) ∈ Rn represents a vector of messages transmitted by agent j to agent i, provided that j ∈ Ni . Since i ∈ Ni , we may include the previous dual iterate k zi (t) and the outgoing messages vi→j (t) in mi (t). The dual update rule (13a) is inspired by the state dynamics proposed by Li and Marden [1], whereas the primal update rule (13b) is exactly what one has in Nesterov’s scheme [33]. To complete the description of the algorithm, we must speck ify the update policies {ui (t)} and the messages {vi→j (t)}. We assume that all agents receive a complete description of ft . Agent i then computes ui (t) = h∇ft (xi (t)), ei i, i ∈ [n], t ≥ 0. T T X 1X ψ(y) hu(t), x̄(t) − yi ≤ α(t − 1)ku(t)k2 + . 2 t=1 α(T ) t=1 (12) Then, ODA-C uses the following instantiation of the update rules in (3a)-(3b): i=1 n X i, j ∈ V. (15) for all t and all agents i, j ∈ V with j ∈ Ni . B. Regret of ODA-C with local gradient signals Let z̄(t) = (z̄ 1 (t), . . . , z̄ n (t)). Our regret analysis rests on the following simple but important fact: Lemma 1: The weighted sum z̄(t) , n X ri zi (t) i=1 evolves according to the linear dynamics z̄(t + 1) = z̄(t) + u(t),  where u(t) = u1 (t), . . . , un (t) . (16) 5 Remark We observe that the relation in (16) holds regardless k k of the choices of decisions vj→i (t) and vi→j (t). Moreover, we point out that if u(t) = ∇ft (x(t)), then the combination of (16) and (13b) will reduce to a centralized online variant of Nesterov’s scheme [37]. Proof: Let V k (t) denote the n × n matrix with entries k k k [V (t)]ij = vj→i (t) − vi→j (t). Then z̄ k (t + 1) = n X ≤ nL2 . It remains to estimate term (E3) in Theorem 1. To that end, we write k∇ft (x̄(t)) − u(t)k n X = h∇ft (x̄(t)) − ∇ft (xi (t)), ei iei i=1 ri zik (t + 1) ≤ i=1 = n X ri i=1   zik (t)    n X 1 Mij [V k (t)]ij + δik ui (t) +  ri j=1 = z̄ k (t) + uk (t) + tr[M̃ V k (t)], where M̃ is an n × n matrix with entries M̃ij = ri Mij . Since M̃ is a symmetric matrix, by (12), and V k (t) is skewsymmetric, tr[M̃ V k (t)] = 0, so we obtain (16).  Lemma 1 indicates that the vector z̄(t) can be seen as a “mean field” of the local dual iterates zi (t) for i ∈ V at time t. Also, if we define x̄(t + 1) , Πψ Xn (z̄(t + 1), α(t)), then from relation (16) we have x̄(t + 1) = Πψ Xn t X ! u(s), α(t) , s=0 which coincides with relation (6) in Theorem 1. This allows us to make use of Theorem 1 in analyzing the regret of this algorithm. Furthermore, the definition of x̄(t) and relation (14) indicate that u(t) will stay close to the centralized gradient ∇ft (x̄(t)), and as a consequence, the errors (E1) and (E3) in Theorem 1 will remain small. We now particularize the bound in Theorem 1 to this scenario under the following additional assumption: Assumption 2: All functions f ∈ F are differentiable and have Lipschitz continuous gradients with constant G: k∇f (x) − ∇f (y)k ≤ Gkx − yk, ∀f ∈ F; x, y ∈ Xn . Theorem 2: Under Assumptions 1–2, the regret of any algorithm of the form (13a)-(13b), and with u(t) computed according to (14), can be upper-bounded as follows: √ nGDX T X t=1 α(t − 1) n X n X 2 |h∇ft (xi (t)), ei i| i=1 ≤ n X i=1 k∇ft (xi (t))k2 ≤G n X kx̄(t) − xi (t)k, i=1 where we have exploited the fact that the gradients of all f ∈ F are G-Lipschitz. Now, by construction, kx̄(t) − xi (t)k ψ = Πψ Xn (z̄(t), α(t − 1)) − ΠXn (zi (t), α(t − 1)) ≤ α(t − 1)kz̄(t) − zi (t)k, where the last step follows from the fact that the map z 7→ Πψ Xn (z, α) is α-Lipschitz (see, e.g., [33, Lemma 1]). Substituting these estimates into the bound in Theorem 1, we get the result.  This bound indicates that, if the network-wide disagreement term behaves nicely, the regret R(T ) will be sublinear in T with a proper choice of the step size α(t). We illustrate this more specifically in the following corollary. Corollary 1: Suppose that the policies for computing k {ui (t)} and {vi→j (t)} are such that, for all t and for any sequence f1 , . . . , fT ∈ F, n X kzi (t) − z̄(t)k ≤ K i=1 for some finite constant K > 0 (which may depend on n and on other problem parameters). Then, the regret of the algorithm (13a)-(13b) is bounded by  2  T  X √ nL C R(T ) ≤ + K L + nGDX α(t − 1) + . 2 α(T ) t=1 kzi (t) − z̄(t)k. i=1 Proof: The terms on the right-hand side of the bound in Theorem 1 can be further estimated as follows. Since each ft ∈ F is L-Lipschitz, ku(t)k2 = k∇ft (x̄(t)) − ∇ft (xi (t))k i=1 1 In particular, if we choose α(t) = √t+1 for t ≥ 0, then the √ regret is of the order O( T ): √  √  √ R(T ) ≤ nL2 + 2K L + nGDX T + C T + 1. T nL2 X C R(T ) ≤ α(t − 1) + 2 t=1 α(T ) + L+ n X C. Full regret analysis We now show that the network-wide disagreement term is indeed upper-bounded by some constant. We recall that Mij 6= 0 only if j ∈ Ni . In addition to this, we posit the following assumptions on the pair (r, M ). Assumption 3: The positive weights r1 , . . . , rn sum to one: n X i=1 ri = 1 and ri > 0 for each i ∈ [n]. 6 The matrix M is row-stochastic, i.e., n X ≤ Therefore, Mij = 1 for each i ∈ [n]. 2 j=1 The conditions we have imposed on the pair (r, M ) are equivalent to saying that M is the transition probability matrix of a reversible random walk on G with invariant distribution r = (r1 , . . . , rn ) [38]. Let zk (t) = (z1k (t), . . . , znk (t)), k ∈ [n], t ≥ 0, (17) and ri . We state the following bound for Pn r∗ , min1≤i≤n 2 kz (t) − z̄(t)k : i i=1 Lemma 2: Under Assumptions 1 and 3, for the policy in (14)-(15) we have n X nL2 √ kzi (t) − z̄(t)k2 ≤ 3 r∗ (1 − 1 − λ)2 i=1 i=1 is the r-weighted `2 -norm of the vector f ∈ Rn , and where λ denotes the spectral gap of M [38], i.e., kf k2r − kM f k2r . kf k2r , hr,f i=0 inf n Proof: From the definitions of zi (t), z̄(t), and zk (t), we have n X kzi (t) − z̄(t)k2 = i=1 n X kzk (t) − z̄ k (t)1k2 . (18) k=1 Thus, we upper-bound the quantity on the right-hand side. From (15), we can rewrite the dynamics (13a) as follows: zk (t + 1) = M zk (t) + 1 uk (t)ek , rk (19) where zk (t) is defined in (17). By unrolling the dynamics (19) and (16) from time 0 to t and recalling that zi (0) = 0 for all i, we obtain: t−1 1 X t−s−1 z (t) = M uk (s)ek . rk s=0 k (20) Moreover, by the definition of z̄(t) in Eq. (16), we have z̄ k (t) = t−1 1 X rk uk (s). rk s=0 (21) t−1 1 X M t−s−1 ek − hr, ek i1 |uk (s)|. rk s=0 (22) By the properties of Markov matrices [38], for any f ∈ Rn , M t f − hr, f i1 2 ≤ 1 M t f − hr, f i1 r∗ 2 r k 2 kz (t) − z̄ (t)1k ≤ !2 t−1 t−s−1 1 X (1 − λ) 2 |uk (s)| 3/2 r∗ s=0 2 which proves the stated result.  Lemma 2 captures the effect of the underlying network topology via the spectral gap λ (also known as the Fiedler value), which captures the algebraic connectivity of the network. Since G is assumed to be connected, λ > 0. By combining Theorem 2 and Lemma 2, we can now provide a regret bound for ODA-C: Theorem 3: Let Assumptions 1–3 hold. With the choice 1 α(t) = √t+1 for all t ≥ 0, and under the policy (14)-(15), the distributed algorithm ODA-C achieves the following regret:  ! √ √ 2 nGDX 2 R(T ) ≤ nL 1 + 3/2 1+ T √ L r∗ (1 − 1 − λ) √ + C T + 1, Proof: By Lemma 2, the averaging policy (15) satisfies n X nL2 √ . kzi (t) − z̄(t)k2 ≤ 3 r∗ (1 − 1 − λ)2 i=1 Hence, by Jensen’s inequality, v u n n X u X kzi (t) − z̄(t)k ≤ tn kzi (t) − z̄(t)k2 i=1 i=1 Note that rk = hr, ek i. From (20) and (21), we have kzk (t) − z̄ k (t)1k ≤ k (23) L √ , r∗3 (1 − 1 − λ)2 where Assumption 1 is used in the last inequality. From this and relation (18), we obtain n X nL2 √ kzi (t) − z̄(t)k2 ≤ 3 , r∗ (1 − 1 − λ)2 i=1 v u n uX kf kr , t ri fi2 f ∈R M t−s−1 ek − hr, ek i1 (1 − λ)t−s−1 2 ≤ kek − hr, ek i1kr r∗ (1 − λ)t−s−1 = rk (1 − rk ) r∗ (1 − λ)t−s−1 . ≤ r∗ From relations (22) and (23), we obtain ≤ for every t ≥ 1, where λ= (1 − λ)t kf − hr, f i1k2r . r∗ nL . √ − 1 − λ) Therefore, the conditions of Corollary 1 hold with nL K = 3/2 , √ r∗ (1 − 1 − λ) and the stated result follows.  This shows that, for any fixed communication network G satisfying Assumption 3, the worst-case regret is bounded by √ O( T ). The constants also capture the dependence on the algebraic connectivity of the network via the spectral gap λ, as well as on the network size n. ≤ 3/2 r∗ (1 7 V. ODA-PS AND ITS R EGRET B OUND Also, we denote We now introduce another decentralized online optimization algorithm which uses the push-sum communication protocol for its dual update rule (3a). We refer to this algorithm as ODA-PS (Online Dual Averaing with Push-Sum based communication). ODA-PS uses the network model (G2) for its communication. A(t − 1 : t) , I, for all t ≥ 1. B. Regret of ODA-PS with local gradient signals For the regret analysis, we first study the dynamics of the dual iterates zi (t) and its “mean field” z̄(t) in the following lemma. We remind that z̄(t) = (z̄ 1 (t), . . . , z̄ n (t)) and zk (t) = (z1k (t), . . . , znk (t)), k ∈ [n]. A. ODA-PS For ODA-PS, each agent i maintains an additional scalar sequence {wi (t)}∞ t=1 ⊂ R. Then, this algorithm particularizes the update rule in (3a)-(3b) as Lemma 3: Let zi (0) = 0 for all i ∈ V. (a) The weighted sum n n X wi (t + 1) = [A(t)]ij wj (t) z̄(t) = (24a) j=1 zik (t + 1) = nδik ui (t) + n X [A(t)]ij zjk (t), k ∈ [n] evolves according to the linear dynamics (24b) z̄(t + 1) = z̄(t) + u(t), j=1 xi (t + 1) = Πψ Xn  zi (t + 1) , α(t) wi (t + 1)  (24c) where the weight matrix A(t) is defined by the out-degrees of the in-neighbors, i.e.,  1/dj (t) whenever j ∈ Niin (t) (25) [A(t)]ij = 0 otherwise. The matrix A(t) is column stochastic by construction. Note that the above update rules are based on a simple broadcast communication. Each agent i broadcasts (or pushes) the quantities wi (t)/di (t) and zi (t)/di (t) to all of the nodes in its out-neighborhood Niout (t). Then, in (24a)-(24b) each agent simply sums all the received messages to obtain wi (t + 1) and zi (t + 1). The update rule (24c) can be executed locally. Unlike ODA-C, the averaging matrix A(t) in ODA-PS does not require symmetry due to this broadcast-based nature of the push-sum protocol. However, the asymmetry requires uniformity of the positive weights ri across all agents (cf. Eq. (3a)). Here we simply use ri = 1/n. To complete the description of the algorithm, we must specify the update policies {ui (t)}. As in ODA-C, we assume that the signal agent i gets from the environment at time t is simply the i-th coordinate of the gradient of ft at the agents primal variable xi (t). Thus, we define: ui (t) = h∇ft (xi (t)), ei i, i ∈ [n], t ≥ 0, (26) i.e., the update performed by agent i at time t is the simply the i-th coordinate of the gradient of ft at the agent’s primal variable xi (t). We assume that each agent i initializes its updates with wi (0) = 1 and zi (0) = 0, while ui (0) can be any arbitrary value in X. We also recall that the local action of agent i at time t is given by the ith coordinate of xi (t), i.e., i x (t) = xii (t). For notational convenience, let us denote the products of the weight matrices A(t), . . . , A(s) by A(t : s), i.e., A(t : s) , A(t) · · · A(s) for all t ≥ s ≥ 0. 1X zi (t) n i=1 where u(t) = (u1 (t), . . . , un (t)). (b) For any i, k ∈ [n], the iterates in (24b) evolve according to the following dynamics zik (t) = n t−1 X [A(t − 1 : s + 1)]ik uk (s). s=0 Proof: (a) From relation (24b), we have for all k ∈ [n] n 1X k z (t + 1) n i=1 i   n n X 1 X k = nδi ui (t) + [A(t)]ij zjk (t) n i=1 j=1 z̄ k (t + 1) = = uk (t) + n n 1X k X [A(t)]ij zj (t) n j=1 i=1 = uk (t) + z̄ k (t), where the last equality follows from the columnstochasticity of the matrix A(t). The desired result follows by stacking up the scalar relation above over k. (b) By stacking up the equation (24b) over i, we have for all t ≥ 1 and k ∈ [n] zk (t + 1) = A(t)zk (t) + nuk (t)ek . By unrolling this equation from time 0 to t, we obtain zk (t) = A(t − 1 : 0)zk (0) +n =n t−1 X uk (s)A(t − 1 : s + 1)ek s=0 t−1 X uk (s)A(t − 1 : s + 1)ek , s=0 where the equalities follows from A(t − 1 : t) = I and the initial condition zi (0) = 0 for all i ∈ V. We get the desired result by taking the i-th component of this vector.  8 where we can always choose Lemma 3 tells us that the vector z̄(t) acts as a “mean field” of the dual iterates zi (t). Also, if we define x̄(t + 1) , Πψ Xn (z̄(t + 1), α(t)) , then from Lemma 3(a) we can see that x̄(t + 1) , Πψ Xn t X ! If in addition each G(t) is regular, we may choose √ β = 2 2, θ = (1 − 1/4n3 )1/B , or β= u(s), α(t) , s=1 which coincides with relation (6) in Theorem 1. We now particularize the bound in Theorem 1 in this scenario under the additional assumption on the Lipschitz continuous gradients (Assumption 2 in Section IV). Theorem 4: Under Assumptions 1-2, the regret of the algorithm (24a)-(24c) with the local update ui (t) of agent i computed according to (26) can be upper-bounded as follows: for all T ≥ 1, θ = (1 − 1/nnB )1/B . β = 4, √ 2, θ = max σ2 (A(t)), t≥0 whenever supt≥0 σ2 (A(t)) < 1. (b) The quantity   γ = inf min [A(t : 0)1]i t≥0 1≤i≤n satisfies 1 . nnB Moreover, if the graphs G(t) are regular, we have γ = 1. T The next lemma provides an upper-bound for 2 X C nL 2 Pn zi (t) α(t − 1) + R(T ) ≤ 2 t=1 α(T ) i=1 wi (t) − z̄(t) . Lemma 5: Let the sequences {zi (t)} and {wi (t)} be genT n X X √ zi (t) to the algorithm (24a)-(24b). Recall that + L + nGDX − z̄(t) . erated according α(t − 1) Pn wi (t) z̄(t) = n1 i=1 zi (t). Then, we have for all t ≥ 1, t=1 i=1  2 n 2 X Proof: Since the definition of u(t) in ODA-PS (cf. Eq. 2βL zi (t) 2 ≤ n − z̄(t) , (26)) coincides with that in ODA-C (cf. Eq. (14)), we can wi (t) γθ(θ − 1) i=1 reuse all the derivations in the proof of Theorem 2 except for where the constants β, γ and θ are as defined in Lemma 4. the network-wide disagreement term: Proof: From the definitions of zi (t), z̄(t) and zk (t), we kx̄(t) − xi (t)k have   2 zi (t) n n X n  k 2 ψ ψ X X zi (t) zi (t) = ΠXn (z̄(t), α(t − 1)) − ΠXn , α(t − 1) k − z̄(t) = − z̄ (t) . (28) wi (t) wi (t) wi (t) i=1 i=1 k=1 zi (t) ≤ α(t − 1) z̄(t) − , (27) Thus, we can upper-bound the quantity on the right-hand side. wi (t) By inspecting equation (24a), it is easy to see that for any where the last inequality follows from the α-Lipschitzian i ∈ V and t ≥ 1, we have ψ property of the map z 7→ ΠXn (z, α) [33, Lemma 1].  n n X X This bound tells us that the regret R(T ) will be sublinear in T wi (t) = [A(t − 1 : 0)]i` wi (0) = [A(t − 1 : 0)]i` . with proper choice of the step size α(t) if the network-wide `=1 `=1 disagreement term behaves nicely. Note that we can also make From this and Lemma 3, we have the following chain of use of Corollary 1 here if we can show relations: n X zi (t) zik (t) ≤ K, z̄(t) − − z̄ k (t) w (t) i i=1 wi (t) Pt−1 t−1 for some constant K > 0. n s=0 [A(t − 1 : s + 1)]ik uk (s) X Pn = − uk (s) `=1 [A(t − 1 : 0)]i` s=0 Pn Pn C. Full regret analysis t−1 X : s + 1)]ik − `=1 [A(t − 1 : 0)]i` `=1 [A(t − 1P = uk (s) n We now show that the network-wide disagreement term in `=1 [A(t − 1 : 0)]i` s=0 Theorem 4 is indeed upper-bounded by some constant. For P t−1 n X − 1 : s + 1)]ik − φi (t − 1)) doing this, we first restate a lemma from [16]. `=1 ([A(t Pn ≤ uk (s) Lemma 4: Let the graph sequence {G(t)} be B-strongly `=1 [A(t − 1 : 0)]i` s=0 ! connected. Then the following statements are valid. Pn (φ (t − 1) − [A(t − 1 : 0)] ) i i` n (a) There is a sequence {φ(t)} ⊆ R of stochastic vectors + `=1 Pn `=1 [A(t − 1 : 0)]i` such that the matrix difference A(t : s)−φ(t)10 for t ≥ s t−1 decays geometrically, i.e., for all i, j ∈ [n]. X βθt−s−2 + βθt−1 ≤ u (s) , (29) k γ |[A(t : s)]ij − φi (t)| ≤ βθt−s for all t ≥ s ≥ 0, s=0 γ≥ 9 where the inequalities follow from adding and subtracting φi (t − 1) and from Lemma 4. From relation (26), we have |uk (s)|2 = |h∇fs (xk (s)), ek i|2 ≤ k∇fs (xk (s))k2 ≤ L2 . Combining this and the fact that βθt−s−2 ≥ βθt−1 for all s = 0, . . . , t − 1, we further have 1 2 4 5 3 1 2 4 5 3 1 2 4 5 3 Fig. 2. Time-varying communication topology changing in cycle of three used for ODA-PS t−1 X 2βθt−s−2 2βL zik (t) − z̄ k (t) ≤ |uk (s)| ≤ . wi (t) γ γθ(θ − 1) s=0 Substituting this estimate in relation (28), we get the desired result.  By combining Theorem 4 and Lemma 5, we can now provide the regret bound of ODA-PS: Theorem 5: Let Assumptions 1–2 hold. With the choice 1 α(t) = √t+1 for all t ≥ 0, and under the policy (26), the distributed algorithm ODA-PS achieves the following regret:    √  √ √ nGDX 4β n 2 R(T ) ≤ nL 1 + 1 + T L γθ(1 − θ) √ + C T + 1, where the constants β, γ and θ are as defined in Lemma 4. Proof: By Jensen’s inequality, we have v u n n 2 X u X zi (t) zi (t) − z̄(t) ≤ tn − z̄(t) . wi (t) wi (t) i=1 i=1 Hence, using Lemma 5, we can estimate the network-wide disagreement term as follows: s  2 n X zi (t) 2βL − z̄(t) ≤ n3 wi (t) γθ(θ − 1) i=1 = 2βn3/2 L . γθ(θ − 1) Thus, the conditions of Corollary 1 with this modified network-wide agreement hold with √ K=n n 2βL . γθ(θ − 1) and the stated result follows.  The bound shows that, for any time-varying sequence of Bstrongly connected √ digraphs, the worst-case regret of ODA-PS is of order O( T ). The constants also capture the dependence on the properties of the underlying network, i.e., the number of nodes n and as well as the connectivity period B. The sensors are assumed to have a linear model of r(x) = Ax, where A ∈ Rm×p and m < p.2 At each time t, each sensor i ∈ V estimates its portion xi (t) ∈ Rpi of the target vector x ∈ Rp , and then takes a measurement qti ∈ Rmi , which is corrupted by observation error and possibly by modeling error. We assume all sources of errors can be represented as an additive noise, i.e., qt = Ax(t) + ζt , Pn where qt ∈ Rm with m = i=1 mi is a stacked vector of all qti ’s and ζt ∼ N (0, P ), where P is the noise covariance matrix. The regret is computed with respect to the least-squares estimate of the target locations at time T , i.e., x̂ = arg min x∈Xp T X ft (x), t=1 where ft (x) = 12 kAx − qt k2 . and we set X ∈ [−20, 20]. For ODA-C, we experiment with a n = 5 node cycle graph whose communication topology is given as: 1↔2↔3↔4↔5↔1 We set ri = 1/5, Mii = 1/2 for all i, and Mij = 1/4 if i ↔ j. For ODA-PS, we experiment with a time-varying sequence of digraphs with n = 5 nodes whose communication topology is changing periodically with period 3. The graph sequence is, therefore, 3-strongly connected. In Figure 2, we depict the repetition of the 3 corresponding graphs. The averaging matrices A(t) (cf. Eq. (25)) can be determined accordingly. We ran our algorithms once for each T ∈ [1000]. That is, for a given T , the iterates in the algorithms are updated from 1 t = 1 to t = T . We used step size α(t) = √t+1 for both algorithms. In Figure 3, we depict the average regret R(T )/T over time T of the distributed sensing problem when ODA-C and ODAPS are used, respectively. It shows that the regret is sublinear for both algorithms and the average R(T )/T goes to zero as the time increases. VI. S IMULATION R ESULTS Consider the problem of estimating some target vector x ∈ Rp using measurements from a network of n sensors. Each sensor i is in charge of estimating a subvector xi ∈ Rpi Pn of x, where pi  p and p = i=1 pi is some very large number. An example includes the localization of multiple targets, where in this case x ∈ Rp becomes a stacked vector of all target locations. When there are a number of spatially dispersed targets, we can certainly benefit from distributed sensing. VII. C ONCLUSION We have studied an online optimization problem in a multiagent network. We proposed two decentralized variants of Nesterov’s primal-dual algorithm, namely, ODA-C using circulation-based dynamics for time-invariant networks and 2 Although target localization is usually formulated as a nonlinear estimation problem [39], for considerations of simplicity one often employs a linearized model using a first-order Taylor expansion around the measurements; see, e.g., [40], [41]. 10 3000 2500 2500 2000 R(T )/T R(T )/T 2000 1500 1500 1000 1000 500 500 0 0 250 500 750 Iteration T 1000 0 0 250 500 750 Iteration T 1000 Fig. 3. The Average Regret R(T )/T vs. Iterations for Online Distributed Active Sensing using ODA-C (left) and ODA-PS (right) ODA-PS using broadcast-based push-sum protocol for timevarying networks. We have established a generic regret bound and provided its refinements for certain information exchange √ T ) when the policies. The regret is shown to grow as O( √ step size is α(t) = 1/ t + 1. For ODA-C, the bound is valid for a static connectivity graph and a row-stochastic matrix of weights M = [Mij ] which is reversible with respect to a strictly positive probability vector r. For ODA-PS, the bound is valid for a uniformly strongly connected sequence of digraphs and column-stochastic matrices of weights A(t) whose components are based on the out-degrees of neighbors. Simulation results on a sensor network exhibit the desired theoretical properties of the two algorithms. R EFERENCES [1] N. Li and J. R. Marden, “Designing games for distributed optimization,” IEEE J. Sel. Topics Signal Proc., vol. 7, pp. 230–242, 2013. [2] D. Kempe, A. Dobra, and J. Gehrke, “Gossip-based computation of aggregate information,” in 44th Annual IEEE Symposium on Foundations of Computer Science, vol. 44, 2003, pp. 482–491. [3] F. Bullo, J. Cortés, and S. Martı́nez, Distributed Control of Robotic Networks. Applied Mathematics Series. Princeton University Press, 2009. [4] M. Mesbahi and M. Egerstedt, Graph Theoretic Methods for Multiagent Networks. Princeton, NJ, USA: Princeton University Press, 2010. [5] S. Kar and J. Moura, “Distributed consensus algorithms in sensor networks: Quantized data and random link failures,” IEEE Trans. Signal Process., vol. 58, pp. 1383 –1400, 2010. [6] A. Martinoli, F. Mondada, G. Mermoud, N. Correll, M. Egerstedt, A. Hsieh, L. Parker, and K. Stoy, Distributed Autonomous Robotic Systems. Springer Tracts in Advanced Robotics, Springer-Verlag, 2013. [7] B. Zhang, A. Lam, A. Dominguez-Garcia, and D. Tse, “Optimal distributed voltage regulation in power distribution networks,” 2015, http://arxiv.org/abs/1204.5226. [8] T.-H. Chang, A. Nedić, and A. Scaglione, “Distributed constrained optimization by consensus-based primal-dual perturbation method,” IEEE Transactions on Automatic Control, vol. 59, pp. 1524–1538, 2014. [9] A. Nedić and A. Ozdaglar, “On the rate of convergence of distributed subgradient methods for multi-agent optimization,” in Proceedings of IEEE CDC, 2007, pp. 4711–4716. [10] B. Johansson, M. Rabi, and M. Johansson, “A simple peer-to-peer algorithm for distributed optimization in sensor networks,” in 46th IEEE Conference on Decision and Control, 2007, pp. 4705 –4710. [11] A. Nedić and A. Ozdaglar, “Distributed subgradient methods for multiagent optimization,” IEEE Transactions on Automatic Control, vol. 54, pp. 48–61, 2009. [12] S. S. Ram, A. Nedić, and V. V. Veeravalli, “Distributed stochastic subgradient projection algorithms for convex optimization,” Journal of Optimization Theory and Applications, vol. 147, pp. 516–545, 2010. [13] K. Srivastava and A. Nedić, “Distributed asynchronous constrained stochastic optimization,” IEEE Journal of Selected Topics in Signal Processing, vol. 5, pp. 772–790, 2011. [14] K. Tsianos, S. Lawlor, and M. Rabbat, “Consensus-based distributed optimization: Practical issues and applications in large-scale machine learning,” in 50th Allerton Conference on Communication, Control, and Computing, 2012, pp. 1543–1550. [15] ——, “Push-sum distributed dual averaging for convex optimization,” in 51st Annual Conference on Decision and Control, 2012, pp. 5453 – 5458. [16] A. Nedić and A. Olshevsky, “Distributed optimization over time-varying directed graphs,” IEEE Transactions on Automatic Control, vol. 60, pp. 601–615, 2015. [17] ——, “Stochastic gradient-push for strongly convex functions on timevarying directed graphs,” 2014, http://arxiv.org/abs/1406.2075. [18] E. Wei and A. Ozdaglar, “Distributed alternating direction method of multipliers,” in 51st IEEE Conference on Decision and Control and European Control Conference, 2012, pp. 5445–5450. [19] ——, “On the O(1/k) convergence of asynchronous distributed alternating direction method of multipliers,” in IEEE Global Conference on Signal and Information Processing, 2013, pp. 551–554. [20] D. Jakovetic, J. Xavier, and J. Moura, “Cooperative convex optimization in networked systems: Augmented lagrangian algorithms with directed gossip communication,” IEEE Transactions on Signal Processing, vol. 59, pp. 3889–3902, 2011. [21] D. Jakovetic, J. Xavier, and J. M. F. Moura, “Fast distributed gradient methods,” IEEE Transactions on Automatic Control, vol. 59, no. 5, pp. 1131–1146, May 2014. [22] Q. Ling and A. Ribeiro, “Decentralized dynamic optimization through the alternating direction method of multiplier,” IEEE Transactions on Signal Processing, vol. 62, pp. 1185–1197, 2014. [23] B. Gharesifard and J. Cortés, “Distributed continuous-time convex optimization on weight-balanced digraphs,” IEEE Transactions on Automatic Control, vol. 59, pp. 781–786, 2014. [24] D. Mateos-Nuñez and J. Cortés, “Distributed online convex optimization over jointly connected digraphs,” IEEE Transactions on Network Science and Engineering, vol. 1, pp. 23–37, 2014. [25] P. D. Lorenzo and G. Scutari, “Next: In-network nonconvex optimization,” 2016, http://arxiv.org/abs/1602.00591. [26] J. Tsitsiklis, “Problems in decentralized decision making and computation,” Ph.D. dissertation, Dept. of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, 1984. [27] J. Tsitsiklis, D. Bertsekas, and M. Athans, “Distributed asynchronous deterministic and stochastic gradient optimization algorithms,” IEEE Transactions on Automatic Control, vol. 31, pp. 803–812, 1986. [28] J. N. Tsitsiklis and M. Athans, “Convergence and asymptotic agreement in distributed decision problems,” IEEE Transactions on Automatic Control, vol. 29, pp. 42–50, 1984. [29] S. Li and T. Basar, “Distributed learning algorithms for the computation of noncooperative equilibria,” Automatica, vol. 23, pp. 523–533, 1987. [30] M. Raginsky, N. Kiarashi, and R. Willett, “Decentralized online convex programming with local information,” in Proceedings of the American Control Conference, 2011, pp. 5363–5369. [31] D. Bertsekas and J. Tsitsiklis, Parallel and Distributed Computation: Numerical Methods. Belmont, MA: Athena Scientific, 1997. [32] F. Benezit, V. Blondel, P. Thiran, J. Tsitsiklis, and M. Vetterli, “Weighted gossip: Distributed averaging using non-doubly stochastic matrices,” in IEEE International Symposium on Information Theory Proceedings (ISIT), 2010, pp. 1753 – 1757. [33] Y. Nesterov, “Primal-dual subgradient methods for convex problems,” Math. Program., Ser. B, vol. 120, pp. 221–259, 2009. [34] M. Akbari, B. Gharesifard, and T. Linder, “Distributed subgradient-push online convex optimization on time-varying directed graphs,” in 52nd Allerton Conference on Communication, Control, and Computing, 2014, pp. 264–269. [35] S. Hosseini, A. Chapman, and M. Mesbahi, “Online distributed optimization on dynamic networks,” 2014, http://arxiv.org/abs/1412.7215. [36] J. C. Duchi, A. Agarwal, and M. J. Wainwright, “Dual averaging for distributed optimization: convergence analysis and network scaling,” IEEE Transactions on Automatic Control, vol. 57, pp. 592–606, 2012. [37] L. Xiao, “Dual averaging methods for regularized stochastic learning and online optimization,” J. Machine Learning Res., vol. 11, pp. 2543–2596, 2010. [38] D. A. Levin, Y. Peres, and E. L. Wilmer, Markov Chains and Mixing Times. Amer. Math. Soc., 2008. [39] P. Stoica and J. Li, “Source localization from range-difference measurements,” IEEE Signal Processing Mag., pp. 63–66, November 2006. [40] L. Kleeman and R. Kuc, “Mobile robot sonar for target localization and classification,” International Journal of Robotics Research, vol. 14, no. 4, pp. 295–318, Aug 1995. [41] S. S. Ponda, “Trajectory Optimization for Target Localization Using Small Unmanned Aerial Vehicles,” Master’s thesis, Massachusetts Institute of Technology, 2008.
3cs.SY
arXiv:1707.02151v2 [math.GR] 15 Nov 2017 POINCARÉ PROFILES OF GROUPS AND SPACES DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA Abstract. We introduce a spectrum of monotone coarse invariants for metric measure spaces called Poincaré profiles. The two extremes of this spectrum determine the growth of the space, and the separation profile as defined by Benjamini–Schramm–Timár. In this paper we focus on properties of the Poincaré profiles of groups with polynomial growth, and of hyperbolic spaces, where we deduce a striking connection between these profiles and conformal dimension. One application of our results is that there is a collection of hyperbolic Coxeter groups, indexed by a countable dense subset of (1, ∞), such that Gs does not coarsely embed into Gt whenever s < t. Contents 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. Introduction Notation and framework Poincaré constants Poincaré profiles for metric measure spaces Regular maps and large scale equivalence Extremal profiles: growth and separation Dependency on p Poincaré profiles of groups with polynomial growth Upper bounds and large-scale dimension Trees Lower bounds for hyperbolic spaces with boundary Poincaré inequalities 12. Upper bounds for hyperbolic spaces with hyperplanes 13. Applications to buildings and symmetric spaces References 2 10 12 16 18 23 27 28 34 36 38 45 52 53 Date: November 16, 2017. The first and third authors were supported by the grant ANR-14-CE25-0004 “GAMME”. The first and second authors were supported in part by the NSF grant DMS-1440140 while in residence at the Mathematical Sciences Research Institute in Berkeley, California, during the Fall 2016 semester. The second author was also supported in part by EPSRC grant EP/P010245/1. 1 2 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA 1. Introduction A monotone coarse invariant of a collection of metric spaces X is a function Λ from X to a partially ordered set (P, ≤) with the property that Λ(X) ≤ Λ(Y ) whenever there is a coarse embedding of X into Y . The asymptotic dimension and the growth function are natural and well-studied examples of such invariants, and a more recent example is the separation profile of bounded degree graphs introduced by Benjamini–Schramm–Timár [BST12]. In this paper, we introduce a new family of monotone coarse invariants called the Lp -Poincaré profiles. We will only define the Poincaré profiles of graphs in the introduction; however, our results naturally extend to compactly generated locally compact groups and Riemannian manifolds with bounded geometry. The majority of the paper is presented in a more general context which includes all of these spaces. Inspired by work of the first author [Hum17], which gives an equivalent definition of the separation profile in terms of the Cheeger constant, for each p ∈ [1, ∞] we define the p-Poincaré constant of a finite graph Γ with vertex set V Γ and edge set EΓ to be ) ( ||∇f || p : f ∈ Map(V Γ → R), f 6≡ fΓ hp (Γ) = inf ||f − fΓ ||p where ∇f (x) = max {|f (x) − f (y)| : xy ∈ EΓ}, ||·||p is the usual pP norm in R|V Γ| and fΓ is the average |V Γ|−1 x∈V Γ f (x). It is worth noting that for bounded degree graphs hp (Γ) is bi-Lipschitz equivalent 1 to λ1,p (Γ) p , where λ1,p (Γ) denotes the smallest non-zero eigenvalue of the p-Laplacian on Γ (see Remark 3.8 below). Now we define the Lp -Poincaré profile of an infinite graph X to be ΛpX (r) = sup {|Γ| hp (Γ) : Γ ≤ X, |V Γ| ≤ r} . We consider Poincaré profiles up to the natural order . where f . g if there exists a constant C such that f (r) ≤ Cg(Cr + C) + C for all r, and f ≃ g if f . g and g . f . Often, the constant C will depend on p; to emphasise this we will use the notations .p and ≃p . A lower bound on the Lp -Poincaré profile corresponds to a “p-Poincaré inequality” for functions on a finite subgraph of the corresponding size.1 Poincaré inequalities have been intensively studied, particularly in the case of balls in doubling metric spaces, see [SC02, HK00] 1Technically these Poincaré inequalities are Neumann-type, rather than Dirichlet-type Poincaré inequalities which consider only functions which are 0 on POINCARÉ PROFILES OF GROUPS AND SPACES 3 and references therein. For finite graphs, there is a vast literature linking Cheeger constants and spectral gaps to such inequalities when p = 1, 2, see [Chu97, SC97]. Discrete Poincaré inequalities on balls in metric spaces have been studied before by, for example, Holopainen– Soardi [HS97] and Gill–Lopez [GL15]. Our approach differs in that we are working in a situation where global Poincaré inequalities do not necessarily hold, where measures need not be doubling, and where we have to consider inequalities on all subsets, not just balls. Our first important result is that these Poincaré profiles are monotone coarse invariants. Theorem 1. Let X, Y be graphs with bounded degree. If there is a regular map r : V X → V Y , then for all p ∈ [1, ∞], ΛpX .p ΛpY . A map r : V X → V Y is said to be regular if it is Lipschitz and supy∈V Y |r −1 (y)| < ∞. In particular every quasi-isometric or coarse embedding is regular. Thus for each p the Lp -Poincaré profile is a well-defined coarse invariant of a finitely generated group G. 1.1. Extremal cases. In the cases p = ∞ and p = 1 the Poincaré profile is easily understood in terms of the growth and separation profile respectively. Recall the growth function of a graph X: γX (k) is the maximum number of vertices contained in a closed ball B(x, k) of radius k centred at some vertex x ∈ V X. We define the inverse growth function: κX (r) is the smallest positive k such that γX (k) > r. At one extreme, p = ∞, the Poincaré profile detects inverse growth. s Proposition 2. For any bounded degree graph X, Λ∞ X (r) ≃ sup κ (s) . X 1≤s≤r From this, we may easily deduce Theorem 1 in the case p = ∞. At the other extreme we show that the L1 -Poincaré profile is equivalent to the separation profile, as introduced by Benjamini–Schramm–Timár [BST12]. The perspective we adopt of studying Poincaré profiles up to regular maps is inspired by their observation that separation is monotone under regular maps. We recall that the separation profile of an infinite graph X may be defined by sepX (r) = max {|Γ| h(Γ)} where the maximum is taken over all subgraphs Γ of X with at most r vertices, and h(Γ) is the Cheeger constant [Hum17]. Proposition 3. For any bounded degree graph X, Λ1X (r) ≃ sepX (r). the boundary of the subgraph in the ambient space. See Remark 4.2 for more details. 4 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA Remark 4. The case of p = 2 is also natural, being the largest spectral gap among subgraphs of a given size. The spectral gap can be used to bound mixing times of random walks on the subgraph. A related spectral profile was considered by Goel–Montenegro–Tetali [GMT06]. 1.2. Relating profiles. The following results are classical, and are likely to be easy exercises for experts; for completeness we present full proofs. Proposition 5. Let 1 ≤ p ≤ q < ∞. There exists a constant C = C(p, q) such that for every bounded degree graph X and every r we have ΛpX (r) ≤ CΛqX (r). In the opposite direction we have the following. Proposition 6. If Γ is a finite graph and p ∈ [1, ∞), then hp (Γ)p ≤ 2p h1 (Γ). Asymptotically this is sharp for balls in the 3-regular tree, as we will see in section 10. Proposition 5 cannot be extended to the case q = ∞ since there are bounded degree graphs containing expanders: combining the above propositions with results in [Hum17] we see that for every p ∈ [1, ∞), ΛpX (r)/r 6→ 0 as r → ∞ if and only if X contains an expander, while a bounded degree graph Y has at most exponential growth, so always satisfies Λ∞ Y (r) . r/ log(r). 1.3. Polynomial growth. Gromov’s celebrated polynomial growth theorem asserts that every finitely generated group with polynomial growth is virtually nilpotent. Results of Bass–Guivarc’h then show that for every group G of polynomial growth there is an integer d such that γG (r) ≃ r d [Gro81, Bas72, Gui73]. Theorem 7. Let G be a finitely generated group such that γG (r) ≃ r d . d−1 Then for all p ∈ [1, ∞], ΛpG (r) ≃p r d . When G is virtually abelian and p = 1 this follows from [BST12]; in all other cases it is new. To prove the lower bound on ΛpG (r) we calculate a lower bound on the separation profile using a Poincaré inequality and apply Propositions 3 and 5. For the upper bound we use a general result, Proposition 9.5, which holds for any bounded degree graph with finite Assouad–Nagata dimension (cf. [Hum17, Theorem 1.5]). Recall that by a classical result of Heintze [Hei74], every simply connected negatively curved homogeneous Riemannian manifold M is isometric to a connected Lie group of the form N ⋊ R equipped with a left-invariant Riemannian metric, where N is a simply connected nilpotent Lie group and the action of R on N is contracting. We POINCARÉ PROFILES OF GROUPS AND SPACES 5 immediately deduce from Theorem 7 that for every p ∈ [1, ∞], the d−1 Lp -Poincaré profile of such a manifold is bounded from below by r d , where d is the homogeneous dimension of N. As a special case of this we deduce the following lower bounds for rank one symmetric spaces. Corollary 8. Let K ∈ {R, C, H, O} be a real division algebra, and let X = Hm K be a rank-one symmetric space for m ≥ 2 (and m = 2 when K = O). Then, for all 1 ≤ p < ∞, we have ΛpX (r) &p r (Q−1)/Q where Q = (m + 1) dimR K − 2. It is worth noting at this point that Q is the conformal dimension of the boundary of X. For large p this bound is far from optimal as we will see in the next section. 1.4. Hyperbolic spaces. We begin by considering the case of an infinite 3-regular tree. Theorem 9. Let T be the infinite 3-regular tree. Then ΛpT (r) ≃p r for all p ∈ [1, ∞). p−1 p , Note that when p = ∞, ΛpT (r) ≃ r/ log(r) by Proposition 6.1. Using Theorem 9, together with results of Chou and Benjamini–Schramm on embeddings of trees into elementary amenable groups with exponential growth and non-amenable groups respectively [Cho80, BS97] we obtain the following corollary. Corollary 10. Let G be a finitely generated elementary amenable group with exponential growth or a finitely generated infinite non-amenable p−1 group. Then for all p ∈ [1, ∞), ΛpG (r) &p r p . We continue with a striking result which suggests a connection between conformal dimension of boundaries and a phase transition in the Poincaré profiles of hyperbolic groups. Theorem 11. Let G be a finitely generated hyperbolic group with equivariant conformal dimension Q (see Definition 12.4). For every ε > 0 ( Q−1 r Q +ǫ if p ≤ Q p ΛG (r) . p−1 if p > Q. r p If the equivariant conformal dimension  Q−1   r Q Q−1 1 p ΛG (r) . r Q log Q (r)   p−1 r p is attained, we have: if 1 ≤ p < Q if p = Q if p > Q. 6 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA In certain cases we are able to prove that these upper bounds are sharp. Our key examples are rank-one symmetric spaces, and a collection of groups Gm,n = hs1 , . . . , sm | sni , [s1 , s2 ], . . . , [sm−1 , sm ], [sm , s1 ]i, m ≥ 5, n ≥ 3 which occur as uniform lattices in the isometry groups of associated Fuchsian buildings ∆m,n , as studied by Bourdon and Bourdon–Pajot amongst others [Bou97, BP99]. Following the terminology of [Cap14] we call these Bourdon buildings. These groups are virtually torsion free [HW99], and commensurable to hyperbolic Coxeter groups when n is even [Hag06]. Theorem 12. Let X = Hm K be a rank-one symmetric space for K ∈ {R, C, H, O} and m ≥ 2 (with m = 2 when K = O), or let X be one of the groups Gm,n ; in either case, let Q be the Ahlfors regular conformal dimension of the boundary of X. Then  Q−1  if p < Q  r Q Q−1 1 p ΛX (r) ≃ r Q log(r) Q if p = Q   p−1 if p > Q r p , these sharp bounds for the separation profile In the case of Λ1Hm R appear in [BST12]. It is interesting to note that uniform lattices G in p−1 P SL(2, R) satisfy Λ1G (r) ≃ log(r) and ΛpG (r) ≃ r p for all p > 1, while p−1 non-uniform lattices H satisfy Λ1H (r) ≃ r p for all p ≥ 1. We have no other examples of this distinction between uniform and non-uniform lattices for any other p or for any groups of higher rank. We do not define the conformal dimension here, but comment that for a rank-one symmetric space Hm K we have Q = (m+1) dimR K−2 and for the groups Gm,n we have Q = 1 + log(n − 1)/arccosh((m − 2)/m), which takes a dense set of values in (1, ∞) as m, n vary. The upper bound in Theorem 12 is obtained by constructing specific functions on the boundary using an embedding of the space into a real hyperbolic space. The lower bound in Theorem 12 for rank-one symmetric spaces with p < Q follows from Corollary 8. For the groups Gm,n , and for the sharp case p = Q, we require the following more general result. Theorem 13. Suppose that X is a visual Gromov hyperbolic graph with a visual metric ρ on ∂∞ X that is Ahlfors Q-regular and admits a p-Poincaré inequality. Then for all q ≥ p, ΛqX (r) & r (Q−1)/Q . Moreover, if (∂∞ X, ρ) admits a Q-Poincaré inequality, then ΛQ X (r) & 1−1/Q 1/Q r log(r) . POINCARÉ PROFILES OF GROUPS AND SPACES 7 Here a “p-Poincaré inequality” is in the sense of Heinonen–Koskela [HK98], namely an analytic property of the compact metric space ∂∞ X. Such inequalities hold on boundaries of rank-one symmetric spaces, see e.g. [Jer86, HK98, MT10], so we can apply this lower bound to obtain an alternative proof of Corollary 8. For the groups Gm,n , the Poincaré inequalities are constructed in [BP99]. The sharp lower bounds on ΛQ X come from showing a suitable Poincaré inequality on annuli B(o, 2r) \ B(o, r) in X. It is interesting to observe that for p < Q, p = Q, and p > Q, the sharp lower bounds on Λp X are realised by embedded spheres, annuli and trees respectively. Finally, Theorems 9 and 12, together with the embedding theorem of Bonk–Schramm [BS00], imply that for every hyperbolic group G p−1 there is some p0 such that for all p > p0 , we have ΛpG (r) ≃ r p . The relationship between the infimal such p0 and the conformal dimension of the boundary of G is one of the most intriguing aspects of these profiles. 1.5. Consequences. By applying Theorem 12 to the groups Gm,n , we find a new collection of functions which can be obtained as separation profiles of finitely generated groups: Corollary 14. There exists a dense subset A of (0, 1) such that for all α ∈ A there is a hyperbolic group Gα with sepGα (r) ≃ r α . The key purpose of a monotone coarse invariant is to be able to distinguish situations in which one space cannot be coarsely embedded into another. There are few general tools to do this; asymptotic dimension is one and growth (or equivalently, the L∞ -Poincaré profile) is another. Here we present and discuss some results of this form which cannot be obtained by studying growth and/or asymptotic dimension. Corollary 15. If there is a coarse embedding of HkC into HlR , then l > 2k. Likewise, if there is a coarse embedding of HkH into HlR , then l > 4k + 2. To prove the analogous result for quasi-isometric embeddings, one can use the conformal dimension of the boundary, however, a coarse embedding does not necessarily induce a well-defined map between boundaries [BR13] so this approach cannot be expected to work. Using asymptotic dimension as an invariant one could only deduce that l ≥ 2k in the first case and l ≥ 4k in the second. By [BS00], every hyperbolic group quasi-isometrically embeds into some HkR . A natural obstruction to a coarse embedding Gk → HkR 8 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA is that the asymptotic dimension of Gk is greater than k. Poincaré profiles provide a different obstruction. Corollary 16. For every k there is a hyperbolic group Gk of asymptotic dimension 2 which does not coarsely embed into HkR . We can take Gk to be Gm(k),5 for some appropriately chosen m(k) and apply Theorem 12. It is in general very difficult to prove a statement of the form “a hyperbolic group H is not isomorphic to a subgroup of a hyperbolic group G”. One may use torsion or asymptotic dimension in certain cases, here we show that the Poincaré profiles can exclude subgroups when the two methods listed above fail. Corollary 17. There exists a collection of (torsion-free) hyperbolic groups (Gq )q∈Q with asymptotic dimension 2 such that whenever i < j there is no coarse embedding from Gi to Gj . In particular, Gi is not virtually a subgroup of Gj . Indeed, the groups Gm,n are virtually torsion-free so we may choose the Gq in Corollary 17 to be torsion-free. By results of Gersten, finitely presented subgroups of hyperbolic groups with cohomological dimension 2 (which equals the asymptotic dimension for torsion-free hyperbolic groups [BM91, BL07]) are hyperbolic but not necessarily quasiconvex. The fact that Gj is not a quasi-convex subgroup of Gi is immediate by considering the conformal dimension. Remark 18. By a recent result of Pansu [Pan16], if a hyperbolic group H coarsely embeds into a hyperbolic group G, then the “Lp cohomological dimension” of H is less than or equal to the conformal dimension of the boundary of G. In the cases of the Bourdon buildings and rank-one symmetric spaces, these two numbers turn out to coincide. This provides an alternative proof of Corollaries 15, 16 and 17. 1.6. About the proofs. The proof of the theorems described in the previous section employ a variety of techniques. In particular, the arguments needed for getting upper bounds are completely different than those for obtaining lower bounds. 1.6.1. Upper bounds. For groups with polynomial growth, our sharp upper bounds are obtained via an argument adapted from [Hum17] based on the fact that these groups have finite Assouad–Nagata dimension ([Hum17, Theorem 1.5] deals with the separation profile, corresponding to p = 1). Finite Assouad–Nagata dimension is a quantitative strengthening of finite asymptotic dimension. Contrary to the POINCARÉ PROFILES OF GROUPS AND SPACES 9 latter, finite Assouad–Nagata dimension is not monotone under coarse embedding (only quasi-isometric embedding) as it is sensitive to distortion of the metric. We come up with a new notion called finite measured dimension (see Definition 9.1), weaker than finite asymptotic dimension, which should be of independent interest. Our motivation here is that it is well adapted for providing upper bound on the Poincaré profiles. Obtaining upper bounds for hyperbolic groups is trickier, and occupies all of §12. We need three different arguments, depending whether p lies below, above, or equals the conformal dimension. We show that hyperbolic groups admit in some sense “many hyperplanes”, by using a theorem of Bonk–Schramm [BS00] to embed the group into a real hyperbolic space, which has an abundance of hyperplanes. We crucially use a version of Helly’s theorem for CAT(0) spaces. Our argument for small p is largely inspired from [BST12] where the separation profile of the real hyperbolic plane is computed. It consists in a symmetrization argument. For large p, we construct for every finite set A, a p-Dirichlet function whose restriction to A provides a good test function. 1.6.2. Lower bounds. Obtaining lower bounds for groups with polynomial growth follows from well-known Poincaré inequalities in balls. It is interesting that the functional analytic interpretation of the separation profile gives us new estimates for nilpotent groups without effort. The lower bounds for hyperbolic Lie groups and small p are obtained by considering parabolic closed nilpotent subgroups. The cases of Bourdon–Pajot buildings, and of the cases when p = Q, are more interesting and more subtle. For p < Q, we exploit the fact that their visual boundary satisfies (infinitesimal) Poincaré inequalities. We “pull down” these inequalities on a sphere of large radius in the space using a discretization argument developed in the first part of the paper. To get the sharp lower bound in the p = Q case, we use the Poincaré inequalities on spheres and a curve counting argument to find a new Poincaré inequalities on annuli. A similar but simpler curve counting argument gives the lower bound for the 3-regular tree, and hence all spaces in which it embeds. 1.7. Structure of the paper. The paper splits roughly into three parts. The first part introduces Poincaré profiles as monotone regular (in particular coarse) invariants. After introducing our notations and fixing the class of metric measure spaces under consideration, we present the more general definition of Poincaré constants in Section 3 and explain some basic properties. We then introduce Poincaré profiles and prove Theorem 1 in Sections 4 and 5 respectively. 10 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA The second part deals with relationships between Poincaré profiles. The descriptions of extremal profiles (Propositions 2 and 3) and the connection with separation (Proposition 6) are proved in Section 6, and the dependence on p (Proposition 5) is discussed in Section 7. The final part is dedicated to calculating profiles using the technology developed in the rest of the paper. Groups with polynomial growth (Theorem 7) are considered in Sections 8 and 9. For hyperbolic spaces, trees (Theorem 9), lower bounds (Theorem 13) and upper bounds are in Sections 10, 11 and 12 respectively, with applications (in particular, Theorem 12) discussed in Section 13. 1.8. Acknowledgements. We are grateful to Laurent Saloff-Coste and Anne Thomas for comments on earlier versions of this paper, and for pointing out a number of related references. 2. Notation and framework We first introduce notation to be used throughout the paper. Suppose f, g : S → [0, ∞) where S = N or S = [0, ∞). We write f u,v,... g if there exists a constant C > 0 depending only on u, v, . . . such that f (x) ≤ Cg(x) for all x ∈ S. If f u,v,... g and g u,v,... f then we write f ≍u,v,... g. We drop the subscripts if the constants are understood. We write f .u,v,... g if there exists a constant C > 0 depending only on u, v, . . . such that f (x) ≤ Cg(Cx + C) + C for all x ∈ S; similarly, we write f ≃u,v,... g if f .u,v,... g and g .u,v,... f . Given a subset A of a metric space (X, d) and some M ≥ 0 we define the closed M-neighbourhood of A to be [A]M = {x ∈ X : d(x, A) ≤ M} . Given a point x ∈ X and r ≥ 0 we denote by B(x, r) the closed metric ball of radius r centred at x. Let (Z, ν) be a measure space with positive finite measure. We denote the averaged integral by Z Z 1 − f dν = f dν. ν(Z) Z Z Given a function f ∈ Lp (X, µ), another measure µ′ such that f ∈ Lp (X, µ′ ) and a measurable subset Z ⊆ X we write Z  p1 p ′ ||f ||p,µ′ = |f (z)| dµ (z) and X POINCARÉ PROFILES OF GROUPS AND SPACES ||f ||Z,p = Z p |f (z)| dµ(z) Z  p1 11 . The L∞ norms ||·||∞,µ′ and ||·||Z,∞ are defined analogously. Given a graph Γ = (V Γ, EΓ) and a subset A ⊂ V Γ, the full (or induced) subgraph of Γ with vertex set A is the graph with vertex set A and edge set {xy ∈ E : x, y ∈ A}. The purpose of the remainder of this section is to introduce the class of spaces we will consider in this paper. Definition 2.1. A metric measure space is a triple (X, d, µ) where µ is a non-trivial, locally finite, Borel measure on a complete, separable metric space (X, d). The key examples are: graphs of bounded degree, Riemannian manifolds with bounded geometry and compactly generated locally compact groups, so we will make the following standing assumptions. We will assume throughout the paper that any metric measure space (X, d, µ) satisfies the following properties: • X has bounded packing on large scales2: if there exists r0 ≥ 0 such that for all r ≥ r0 , there exists Kr > 0 such that ∀x ∈ X, µ(B(x, 2r)) ≤ Kr µ(B(x, r)). We then say that X has bounded packing on scales ≥ r0 . • X is k-geodesic for some k > 0: for every pair of points x, y ∈ X there is a sequence x =Px0 , . . . , xn = y such that d(xi−1 , xi ) ≤ k for all i and d(x, y) = ni=1 d(xi−1 , xi ). Up to rescaling the metric and/or the measure we will assume that X is 1-geodesic and has bounded packing on scales ≥ r0 = 1. A subspace Z ⊂ X is always assumed to be 1-thick (a union of closed balls of radius 1), so in particular it has positive measure. We equip Z with the subspace measure and the induced 1-distance ( n ) X d(z, z ′ ) = inf d(zi−1 , zi ) i=1 where the infimum is taken over all sequences z = z0 , . . . , zn = z ′ , such that each zi ∈ Z and d(zi−1 , zi ) ≤ 1. Note that (as in the case of a disconnected subgraph) the induced 1-distance will take values in [0, ∞]. Remark 2.2. In the case of (the vertex set of) a bounded degree graph X, d is the shortest path metric and µ is the (vertex) counting 2If r0 = 0, then we simply say that X has bounded packing. 12 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA measure. Subspaces Z are (vertex sets of) 1-thick subgraphs equipped with the vertex counting measure and their own shortest path metric (the induced 1-distance). In a locally compact group G with compact generating set K, we equip G with a Haar measure (which is unique up to scaling) and the word metric d = dK . The reason for working with thick sets is justified by the following easy lemma (see [Tes08, Lemma 8.4]). Lemma 2.3. Assume X has bounded packing on scales ≥ r0 , and let A ⊂ X be r-thick for some r ≥ r0 . Then for all u > 0, µ([A]u ) u µ(A). 3. Poincaré constants Let (X, d) be a metric space and let a > 0. Given a measurable function f : X → R, we define its upper gradient at scale a to be |∇a f |(x) = sup |f (y) − f (y ′ )|. y,y ′ ∈B(x,a) Remark 3.1. We have slightly modified the notation from [Tes08], where the upper gradient was referred to as the “local norm of the gradient” and was denoted by |∇f |a . The changes in this paper are for brevity; in what follows k|∇a f |kp will simply be denoted by k∇a f kp . Definition 3.2. Let (Z, d, ν) be a metric measure space with finite measure and fix a scale a > 0. We define the Lp -Poincaré constant at scale a of Z to be k∇a f kp hpa (Z) = inf , f kf kp p fZ := Rwhere the infimum is taken over all f ∈ L (Z, ν) such that − f dν = 0 and f 6≡ 0. We adopt the convention that hp a (Z) = 0 Z whenever ν(Z) = 0. Before continuing we list some basic properties of the Poincaré constant. Lemma 3.3. Let (Z, d, ν) be a metric measure space with finite measure. (i) Let θ : (0, ∞) → (0, ∞) be a non-decreasing function, and let (Z ′ , d′ , ν ′ ) be a metric measure space such that (Z, ν) = (Z ′ , ν ′ ), and d′ (z1 , z2 ) ≤ θ(d(z1 , z2 )) for all z1 , z2 . Then for all a > 0, hpa (Z) ≤ hpθ(a) (Z ′ ). POINCARÉ PROFILES OF GROUPS AND SPACES 13 (ii) Let (Z ′ , d′ , ν ′ ) be a metric measure space where (Z, d) = (Z ′ , d′) and there exists some M ≥ 1 such that M −1 ν(A) ≤ ν ′ (A) ≤ Mν(A) for every measurable A ⊆ Z. Then for all a > 0, hpa (Z ′ ) ≤ 2M 2/p hpa (Z). Proof. Part (i) is immediate.R For part (ii), let f : X R→ R be a measurable function such that − f dµ = 0 and let m = − f dν ′ . We see that kf kp,ν ≤ 2kf − mkp,ν ≤ 2M 1/p kf − mkp,ν ′ The first inequality above is the C = −m case of inequality (3.5) proved in Lemma 3.4. On the other hand k∇f kp,ν ≤ M 1/p k∇f kp,ν ′ , so we are done.  To obtain a sensible definition of the Lp -Poincaré constant it is necessary to only consider functions whose average is zero and to choose a notion of gradient. In both cases there are multiple ways to do this. 3.1. Choice of average. Given a measure space (Z, ν) with finite positive measure, there are multiple ways to define the “average” of a measurable function f : (Z, ν) → R: R (1) the average fZ = −Z f dν, (2) a median mf : any value such that ν({f < mf }) ≤ ν(Z)/2 and ν({f > mf }) ≤ ν(Z)/2, (3) a p-energy minimizer: any value cp such that inf c ||f − c||p is attained for c = cp . There is a simple comparison between the average and any energy minimizer, so choosing (1) or (3) gives comparable Poincaré constants. Lemma 3.4. Let (Z, ν) be a measure space with finite positive measure, and let f : (Z, ν) → R be a measurable function. For every p ∈ [1, ∞) we have ||f − cp ||p ≤ ||f − fZ ||p ≤ 2 ||f − cp ||p . Proof. For any C ∈ R we have kf − fZ kp ≤ kf + Ckp + kC + fZ kp Z 1 C+ = kf + Ckp + ν(Z) f (z)dν(z) ν(Z) Z Z −1+1/p |C + f (z)|dν(z) ≤ kf + Ckp + ν(Z) 1/p (3.5) Z ≤ kf + Ckp + ν(Z) = 2kf + Ckp . −1+1/p kC + f kp k1kp/(p−1) 14 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA In addition, if C = cp , then kf − cp kp ≤ kf − fZ kp by definition.  In the case of p = 1, this lemma combines with the following to show that taking either averages or medians will yield comparable Poincaré constants. Lemma 3.6. Let (Z, ν) be a measure space with finite positive measure ν and let f : Z → R be a measurable function. Then a value c is a 1-energy minimizer c1 of f if and only if it is a median mf . Proof. For c′ > c, a calculation gives:  (3.7) kf − c′ k1 − kf − ck1 = (c′ − c) ν({f ≤ c}) − ν({f ≥ c′ }) Z + (c + c′ − 2f )dν. {c<f <c′ } If c minimizes kf − ck1 , (3.7) gives  0 ≤ (c′ − c) ν({f ≤ c}) − ν({f ≥ c′ }) + (c′ − c)ν({c < f < c′ }). Letting c′ → c, we get ν({f > c}) ≤ ν({f ≤ c}). The same argument applied to −f gives ν({f < c}) ≤ ν({f ≥ c}), so c is a median of f . Conversely, if c is a median for f , (3.7) gives kf − c′ k1 − kf − ck1 = (c′ − c) (ν({f ≤ c}) − ν({f > c})) Z ′ ′ + (c − c)ν({c < f < c }) + (c + c′ − 2f )dν. {c<f <c′ } Z ≥ (c′ − c)( 21 ν(Z) − 12 ν(Z)) + (2c′ − 2f ) ≥ 0, {c<f <c′ } so increasing c cannot lower kf − ck1 . The same argument applied to −f gives that the median c is also a minimizer for kf − ck1 .  Remark 3.8. For Γ a finite graph of constant degree d, λ1,p (Γ), the first eigenvalue may be calculated to be the inP of the p-Laplacianon Γ,  P p p fimum of / xy∈EΓ |f (x) − f (y)| x∈V Γ |f (x) − cp (f )| d over all non-constant f with cp (f ) the energy minimizer of f (see [Bou12]). Thus by Lemma 3.4 we have λ1,p (Γ) ≍ hp (Γ)1/p . 3.2. Comparison with Lipschitz gradient. Classical Poincaré inequalities on balls in Rn involve the Lp -norms of the usual gradient vector ∇f . For general metric spaces this makes no sense, but it is possible to define an analogue of the point-wise norm |∇f |. Given this, one can define what it means for a metric measure space to satisfy a Poincaré inequality in this infinitesimal sense (see Section 11). POINCARÉ PROFILES OF GROUPS AND SPACES 15 Let (Z, d, ν) be a metric measure space with finite (positive) measure. We define the Lipschitz gradient to be |f (x) − f (y)| Lipx (f ) = lim sup sup . h h→0 y∈B(x,h) Given a metric space (Z, d) we can define hpLip (Z) = inf ||Lipx (f )||p ||f ||p where the infimum is taken over all non-constant Lipschitz functions f : Z → R with average 0. Following §10.2 and §10.3 from [Tes08], one can show that—under suitable assumptions on a metric measure space—the Poincaré constant relative to the Lipschitz norm (for Lipschitz functions) is equivalent to the Poincaré constant with respect to the gradient at some fixed scale α > 0. Here, we will focus on one direction (the only one required in the paper, namely in the proof of Theorem 11.1) which relies solely on a bounded packing assumption: Proposition 3.9. Let (Z, d, ν) be a metric measure space with finite measure ≥ 1, let a > 0 and let C ≥ 1. Assume that for all x ∈ Z, ν(B(x, 2a)) ≤ Cν(B(x, a/2)). Then, hpLip (Z) C,a,p hpa (Z). Proof. We first need the following lemma: Lemma 3.10. Assume hpa (Z) ≤ 1/8. Let (Px )x be a family of probability measures on Z, such that Px is supported in B(x, a) for every x ∈ Z. Then there exists f ∈ L∞ such that k∇a f kp ≤ 4hpa (Z), kP f − (P f )Z kp R where P f (x) := f dPx . Proof. We start with f with average 0, fZ = 0, such that 1 k∇a f kp ≤ 2hpa (Z) ≤ . kf kp 4 Observe that kf − P f kp ≤ k∇a f kp ≤ 41 kf kp , from which we deduce that Z Z kf kp kf − P f kp ≤ . |(P f )Z | = − P f = − P f − f ≤ 1/p ν(Z) 4ν(Z)1/p Z Z 16 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA So k(P f )Z kp ≤ 41 kf kp and then we deduce by the triangle inequality that kf kp kP f − (P f )Z kp ≥ .  2 The rest of the proof of the proposition is similar to that of [Tes08, Theorem 10.9]. For the convenience of the reader we sketch it. Define a 1-Lipschitz map θ : Z × Z → R+ by θ(x, y) = d(y, B(x, a)c). For U ⊂ Z write Z θ(x, y) Px (U) = dν(y), U K(x) R where K(x) = B(x,a) θ(x, z)dν(z). Note that K(x) ≍C ν(B(x, a)), and that by assumption, ν(B(x, a)) ≍C ν(B(y, a)) as soon as d(x, y) < a. Since θ is 1-Lipschitz with respect to x, we see that for all f ∈ L∞ (Z), Lipx (P f ) C |∇a f |. Note that if hpa (Z) > 81 , then the statement of the proposition follows trivially. Hence we can assume that hpa (X) ≤ 81 . By Lemma 3.10 we deduce that there exists some function f such that kLipx (P f )kp C hpa (Z). kP f − (P f )Z kp Hence the proposition follows.  4. Poincaré profiles for metric measure spaces Our goal in this section is to generalise the Poincaré profile to the class of metric measure spaces defined in Section 2. Definition 4.1. Let (X, d, µ) be a metric measure space satisfying our standing assumptions, and fix some number a ≥ 2. We define the Lp -Poincaré profile ΛpX,a (r) of X at scale a to be the supremum of µ(A)hpa (A) over all subspaces A ⊂ X satisfying µ(A) ≤ r. If no such subspace exists, define ΛpX,a (r) = 0. Recall that by assumption, we only consider 1-thick subsets of X to be subspaces. Remark 4.2. As mentioned in the introduction, strictly speaking, we have defined the Lp -Neumann-Poincaré profile. We could alternatively define Lp -Dirichlet-Poincaré profiles using Dirichlet-Poincaré inequalities (considering the infimum over all functions which are 0 on the boundary of Γ in X, rather than those which have average 0). As defined above, the monotone coarse invariant we obtain detects only if the space has infinite diameter. A small modification to the definition POINCARÉ PROFILES OF GROUPS AND SPACES 17 (taking the infimum of µ(A)hpa (A) over all subspaces A ⊂ X satisfying µ(A) ≥ r) yields a coarse invariant (it is not even monotone under quasi–isometric embeddings) which detects isoperimetry (and in particular, Følner amenability) in the case p = 1. Dirichlet-type Poincaré inequalities were introduced in [Cou00, Section 7.2] where they are called Sobolev inequalities (see also [Tes08] for a related notion of Lp isoperimetric profile). They have been extensive studied in the cases p = 1, where they are equivalent to isoperimetric inequalities, and p = 2, where they govern the asymptotic behaviour of the probability of return of the simple symmetric random walk. We first prove that the Poincaré profile does not actually depend on the choice of a. Proposition 4.3. Assume that (Z, d, ν) is a finite metric measure space. Then for all a ≥ 2 and all p ∈ [1, ∞) we have hpa (Z) ≍a hp2 (Z). Proof. We claim that for any t ≥ 0, (4.4) ν ({|∇a f | ≥ t}) a ν  t |∇2 f | ≥ 5a  , and ν({|∇2 f | ≥ t}) ≤ ν({|∇a f | ≥ t}). Together these inequalities immediately imply the proposition. The second inequality is obvious. Let z ∈ Z, and let x, y ∈ B(z, a). Then one can easily check that our standing assumption implies that there exists a 1-path x = x0 , . . . , xn = y within B(z, a) such that n ≤ 5a. By the triangle inequality, this means 1 that for at least one 1 ≤ i ≤ n, |f (xi )−f (xi−1 )| ≥ 5a |f (x)−f (y)|. Now 1 ′ ′ for all z ∈ B(xi , 1) this implies that |∇2 f |(z ) ≥ 5a |f (x)−f (y)|. Hence there is a 1-thick subset which is 2a-dense in the set {|∇a f | ≥ t)} on which |∇2 f |(z ′ ) ≥ 5at . Thus, the left-hand inequality in (4.4) follows from Lemma 2.3.  Corollary 4.5. Assume that (X, d, µ) satisfies our standing assumptions. Then for all a, a′ ≥ 2 and all p ∈ [1, ∞) we have ΛpX,a ≍a,a′ ΛpX,a′ . Moreover, by Lemma 3.3, choosing a bi-Lipschitz equivalent metric and/or measure does not affect the Lp -Poincaré profile ΛpX,a for sufficiently large a (up to ≃). In particular this means that for a compactly generated locally compact group, the Lp -Poincaré profile does not depend on the choice of Haar measure or on the choice of compact generating set. 18 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA In light of Corollary 4.5, we now refer to ΛpX as the Lp -Poincaré profile of X, without the need to specify a scale. 5. Regular maps and large scale equivalence The goal of this section is to prove Theorem 1. Firstly, we formally introduce the notion of a coarse regular map and prove that the definition coincides with regular maps for bounded degree graphs. 5.1. Regular maps. We introduce a natural generalisation of a regular map between graphs suited to the context of metric measure spaces. In this section we show that Poincaré profiles are monotone non-decreasing under coarse regular maps. Definition 5.1. A map F : (X, d, µ) → (X ′ , d′ , µ′ ) is said to be coarse regular if it satisfies the following properties: (i) F is coarse Lipschitz: there exists an increasing function ρ+ : [0, ∞) → [0, ∞) such that for all x, y ∈ X, d(F (x), F (y)) ≤ ρ+ (d(x, y)); (ii) F is coarsely measure preserving: there exists δ0 such that for all δ ≥ δ0 and for all (1-thick) subspaces A ⊂ X, µ([A]δ ) ≍δ µ′ ([F (A)]δ ) ≍δ µ([F −1 (F (A))]δ ). The parameters of F are the constant δ0 as well as the function ρ+ . Remark 5.2. Coarse regular maps between spaces with bounded packing on large scales are stable under composition. In applications, coarse regular maps often are embeddings of the following kind. Definition 5.3. A coarse regular map F : (X, d, µ) → (Y, d, ν) is called a large-scale embedding if it is also a coarse embedding; there exists a function ρ− such that limt→∞ ρ− (t) = ∞ and for all x, y ∈ X, ρ− (d(x, y)) ≤ d(F (x), F (y)). If, in addition, [F (X)]C = Y for some C ≥ 0 (in other words, if F is a coarse equivalence), then F is called a large-scale equivalence. It is easy to see that the relation “there exists a large scale equivalence from X to Y ” is an equivalence relation among metric measure spaces. POINCARÉ PROFILES OF GROUPS AND SPACES 19 Lemma 5.4. Let X, X ′ be simplicial graphs of bounded degree equipped with the shortest path metrics and vertex counting measures. A map F : V X → V X ′ is regular in the sense of [BST12] if and only if it is coarsely regular as a map between metric measure spaces. Proof. If F is regular, then by definition there exists a constant K such that F is K-Lipschitz, the image of every set of measure m has measure at most m and the pre-image of every set of measure m has measure at most Km. Since X and X ′ have bounded degree, F is coarsely regular. Suppose F is coarsely regular, then it is ρ+ (1)-Lipschitz. Fix some suitable δ0 , let x′ = F (x) ∈ F (V X) and notice that the (1-thick) subspace A = [x]1 satisfies F −1 (x′ ) ≤ [F −1 (F (A))]δ δ |[A]δ | ≤ |[x]δ+1 | δ 1. Thus, F is regular.  The following proposition is the main goal of this section, and will be proved in §5.2. Proposition 5.5. Let F : X → X ′ be a coarsely regular map between metric measure spaces which satisfy our standing assumptions. Then for all p ∈ [1, ∞), ΛpX .p ΛpX ′ . Theorem 1 follows immediately from Lemma 5.4 and this proposition. Note that by Proposition 4.3 it suffices to prove ΛpX,a .p ΛpX ′ ,a′ . for some a, a′ ≥ 2. An important consequence of Proposition 5.5 is the following. Proposition 5.6. Let G and H be compactly generated locally compact groups, and let φ : H → G be a proper continuous morphism (i.e. ker φ is compact and φ(H) is a closed subgroup). We assume that both G and H are equipped with left-invariant Haar measures and word metrics with respect to some compact symmetric generating sets. Then, for all p ∈ [1, ∞), ΛpH .p ΛpG . If φ(H) is co-compact then ΛpH ≃p ΛpG . Proof. The morphism φ is a large-scale embedding hence it is coarsely regular. If φ(H) is co-compact then φ is a large-scale equivalence. The result then follows from Proposition 5.5.  5.2. Proof of Theorem 1. The argument behind the proof is as follows: given a coarse regular map F : X → X ′ which is ρ+ -coarse Lipschitz and coarsely measure preserving for all δ ≥ δ0 , and a subspace Z ⊆ X, we define M = max {ρ+ (1), δ0 } and build metric measure 20 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA space discretizations Y of Z and Y ′ of the 1-thick subspace [[F (Z)]M ]1 . By the definition of a coarse regular map and Lemma 2.3, µX (Z) ≍M µX ([Z]M ) ≍M µX ′ ([[F (Z)]M ]1 ). We then show that the process of taking a discretization yields spaces with equal measure and comparable Poincaré constants, and finally prove that Y and Y ′ have comparable Poincaré constants. The first step of the proof consists in constructing discretizations of our spaces. We fix some b ≥ M (which we refer to as the discretization parameter ). We let Y ⊂ Z be a maximal 3b-separated subset of Z. By S maximality Z is covered by the union of balls y∈Y B(y, 9b). We pick (measurably) a set Ay for each y ∈ Y with the following properties: • B(y, b) ⊂ Ay ⊂ B(y, 9b); • (Ay )y∈Y forms a measurable partition of Z. We equip Y with the subspace distance and the measure νY (y) = ν(Ay ). Let π : Z → Y be defined by “π(z) is the only y ∈ Y such that z ∈ Ay ”. Note that π is surjective, and a right-inverse of the inclusion j : Y → Z. Moreover, π −1 (y) = Ay for every y ∈ Y . Remark 5.7. Observe that the choice of b ensures that Y has bounded packing at all scales ≥ 0, and that both π and j are large-scale equivalences. In particular, if Y ′ is a similar discretization of [[F (Z)]M ]1 , then Ψ = π ′ ◦ F ◦ j is a coarse regular map. Moreover, if one chooses the discretization parameter b′ large enough, then Ψ is surjective. Our next goal is to compare the Poincaré constant of a subspace with that of its discretization. Lemma 5.8. Let (Z, d, ν) be a metric measure space with finite measure. Suppose (Y, d, νY ) is a discretization (with parameter b ≥ 2) of Z as above. Then for all a ≥ b, hpa (Y ) .a hp20a (Z), and hpa (Z) ≤ hp20a (Y ). R − f dν = 0. We define φ ∈ ℓ∞ (Y ) Proof. LetRf ∈ L∞ (Z) be such that Z R by φ(y) = −Ay f dν. Clearly −Y φdνY = 0 and kφ ◦ πkZ,p = kφkY,p. Write POINCARÉ PROFILES OF GROUPS AND SPACES R f (z) = φ(π(z)) + −Aπ(z) (f (z) − f (w))dν(w). Then Z Z − kf kZ,p ≤ kφ ◦ πkZ,p + ≤ kφkY,p + Z ≤ kφkY,p + Z p (f (z) − f (w)) dν(w) dν(z) Aπ(z) Z Z Z − 21 |f (z) − f (w)|p dν(w)dν(z) Aπ(z) |∇10a f |(z) p Z = kφkY,p + k∇10a f kp . !1/p !1/p 1/p On the other hand, it is immediate from the definitions that |∇a φ|(y) ≤ |∇20a f |(z) for all z ∈ Ay . We now prove the first inequality. If hp20a (Z) ≤ 21 , then for any ǫ ∈ (0, 1/6) we can find f as above so that k∇20a f kp 1 k∇20a f kp 2 ≥ . ≥ + ǫ ≥ hp20a (Z) + ǫ ≥ 3 2 kf kp kφkp + k∇20a f kp Thus k∇20a f kp ≤ 2kφkp and hp20a (Z) + ǫ ≥ 1 k∇a φkp ≥ hpa (Y ). 3kφkp 3 Since ǫ was arbitrary, hpa (Y ) ≤ 3hp20a (Z). Moreover, it is easy to see that hpa (Y ) .a 1 (a much more general statement is proved in Proposition 7.1), so if hp20a (Z) ≥ 12 , then hpa (Y ) .a hp20a (Z). R ∞ − ψdνY = The other direction is easier: given ψ ∈ ℓ (Y ), such that Y P 0 we define g = y∈Y ψ(y)1Ay , where 1Ay denotes the characteristic R function of Ay . We clearly have − gdν = 0 and kgkp = kψkp . Hence we are left with comparing the gradients. Z X p sup |g(z ′ ) − g(z ′′ )|p dν(z) k∇r gkp = ν(Ay )− Ay z ′ ,z ′′ ∈B(z,a) Y ≤ X ν(Ay ) Y ≤ X Y sup |g(z ′) − g(z ′′ )|p z ′ ,z ′′ ∈B(y,10a) νY (y) sup |ψ(y ′ ) − ψ(y ′′ )|p y ′ ,y ′′ ∈B(y,20a)∩Y = k∇20a ψkpp .  Now we compare the Poincaré constants of discrete spaces related by a sufficiently nice surjective coarse regular map. 22 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA Lemma 5.9. Let π : (Y, d, ν) → (Y ′ , d, ν ′ ) be a map between two discrete metric measure spaces with finite (non-degenerate) measures, and assume that: • π is surjective; • ν(π −1 (y ′)) = ν ′ (y ′). Then for all a ≥ 0 and C such that d(y, z) ≤ a implies d(π(y), π(z)) ≤ Ca, we have hpa (Y ) ≤ hpCa (Y ′ ). R Proof. Choose f ′ R∈ ℓ∞ (Y ′ ) such that f ′ dµ′ = 0 and let f = f ′ ◦ π. Clearly, we have f dµ = 0, and kf kp = kf ′ kp . Moreover, for every y ∈ Y , if y1 , y2 ∈ B(y, a) then π(y1 ), π(y2 ) ∈ B(π(y), Ca). So a straightforward computation shows that k∇a f kp ≤ k∇Ca f ′ kp .  As a result we obtain a version of Proposition 5.5 in the uniformly discrete case. Corollary 5.10. Let Ψ : (Y, d, ν) → (Y ′ , d, ν ′) be a surjective coarse regular map between uniformly discrete spaces, which have bounded packing at any scale. Then, for all a > 0, there exists C > 0 such that hpa (Y ) a hpCa (Y ′ ). Proof. The assumptions imply that Ψ is coarse Lipschitz, surjective, and such that ν(Ψ−1 (y ′)) ≍a ν ′ (y ′ ). Hence the corollary follows from Lemmas 3.3(ii) and 5.9: if we push the measure ν forward with Ψ to obtain a measure Ψ∗ ν on Y ′ we have hpa (Y, ν)  hpCa (Y ′ , Ψ∗ ν)  hpCa (Y ′ , ν ′ ).  Combining these results we are in a position to prove Proposition 5.5. Proof of Proposition 5.5. Let Z be a 1-thick subspace of X and define Z ′ = [[F (Z)]M ]1 where M = max {δ0 , ρ+ (1)}. Then Z ′ is a 1-thick subspace of X ′ and µ(Z) ≍M µ′ (Z ′ ). Let b, b′ be sufficiently large that the discretizations Y of Z and Y ′ of Z ′ satisfy the hypotheses of Lemma 5.8 for some suitable a = a(b, b′ ) ≥ 2 and so that Ψ = π ′ ◦ F ◦ j is surjective. Note that b and b′ may be chosen independently of the choice of subspace Z of X, hence a does not depend on Z. POINCARÉ PROFILES OF GROUPS AND SPACES 23 Applying Corollary 5.10 we see that there exists a constant C depending only on a such that hpa (Y ) a hpCa (Y ′ ). Now, by Lemma 5.8 hpa (Z) a,M hpC ′ a (Z ′ ) where a, M, C ′ do not depend on Z. Thus there is some M ′ depending only on M and Y ′ such that ΛpX,a (r) = sup {µ(Z)hpa (Z) : µ(Z) ≤ r} .a,M sup {µ′ (Z ′ )hpC ′ a (Z ′ ) : Z ′ = [[F (Z)]M ]1 , µ(Z) ≤ r} ≤ ΛpX ′ ,C ′ a (M ′ r). We conclude using Corollary 4.5.  6. Extremal profiles: growth and separation 6.1. Growth and the L∞ -Poincaré profile. In this section we give the proof of Proposition 2. Recall our standing assumptions: a metric measure space (X, d, µ) is 1-geodesic and has bounded packing at scales ≥ r0 = 1. Recall also that the growth function γX (k) is the supremum of the measures of balls of radius k in X, and the inverse growth function κX (n) is the infimal s such that there exists a ball B ⊂ X of radius s with measure > n. By assumption subspaces are 1-thick and equipped with a 1-geodesic metric. Proposition 6.1. Let (X, d, µ) be a metric measure space with unbounded growth function γX : [1, ∞) → (0, ∞), and let a ≥ 2. Then   s ∞ ΛX,a (r) ≃a sup : γX (1) ≤ s ≤ r , κX (s) where we interpret sup ∅ to be 0. o n In all our applications, the function sup κXs(s) : γX (1) ≤ s ≤ r will be equivalent to κXr(r) but in general this may not be the case. The proof requires a lemma. Lemma 6.2. Let Z be a subspace of X with diameter m and let a ≥ 2. 4a Then h∞ a (Z) ≤ m , and if every y, z ∈ Z can be joined by a 1-path of 1 length ≤ 2m then h∞ a (Z) ≥ 2m . Proof. Choose x, y ∈ Z such that d(x, y) ≥ m − δ, and define f (z) = d(x, z). It is clear that f (x) = 0 and f (y) ≥ m − δ, so ||f − fZ ||∞ ≥ m−δ , while ||∇a f ||∞ ≤ 2a by the triangle inequality. Thus h∞ a (Z) ≤ 2 4a for all δ > 0. m−δ For the second inequality, fix δ > 0 and let f ∈ L∞ (Z) satisfy inf z∈Z f (z) = 0. Choose y, z so that (f (z)−f (y))+δ ≥ supz∈Z |f (z)| = ||f ||∞ . 24 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA By our hypothesis there exists a sequence of points y = z0 , . . . , zk = z such that k ≤ 2m and d(zi , zi+1 ) ≤ 1 for all i. Therefore, ∇a f (zi ) ≥ 1 1 (||f ||∞ − δ) for some i, so ||∇a f ||∞ ≥ 2m (||f ||∞ − δ). Since we have 2m 1  ||f − fZ ||∞ ≤ ||f ||∞ , letting δ → 0, we see that h∞ a (Z) ≥ 2m . Proof of Proposition 6.1. The upper bound on Λ∞ X,a (r) follows immediately from Lemma 6.2. Indeed, if µ(Z) ≤ r then µ(Z)h∞ a (Z) .a µ(Z) µ(Z) ≤ , diam(Z) κ(µ(Z)) so if µ(Z) ≥ γX (1) we are done. We can ignore Z with µ(Z) bounded by any fixed constant like γX (1) since any f ∈ L∞ (Z) has a representative with k∇a f k∞ ≤ 2kf k∞ , and so µ(Z)h∞ a (Z) ≤ 2µ(Z) is bounded too. We now prove the lower bound. Let t ≥ 2 and choose xt ∈ X such that µ(B(xt , t)) ≥ 21 γX (t). Define Zt to be the 1-thick subspace [B(xt , t − 1)]1 . By Lemma 2.3 there is a constant C (which does not depend on t) such that µ(Zt ) ≤ µ(B(xt , t)) ≤ γX (t) ≤ Cµ(Zt ). γX (t) 2a 1 ∞ . By Lemma 6.2 h∞ a (Zt ) ∈ [ 4t , (t−1) ], so µ(Zt )ha (Zt ) ≍a t There exists s0 ≥ γX (1) so that for all s ≥ s0 , κX (s) ≥ 3. On any bounded interval in [γX (1), ∞), κX is ≥ 1 and so s/κX (s) is bounded, thus we may assume that s and r satisfy s0 ≤ s ≤ r. Repeating the above argument, we see that γX (t)/γX (t − 1) has a uniform upper bound which is independent of t. Let t = κX (s) − 1 ≥ 2, and so γX (t) ≤ s ≤ γX (t + 2)  γX (t). Thus for r ≥ s0 , Λ∞ X,a (r) a s γX (t)  . t κX (s)  6.2. Separation profiles of metric measure spaces. We wish to extend the Cheeger constant definition of separation [Hum17] to the setting of metric measure spaces (X, d, µ) which are 1-geodesic and has bounded packing at scales ≥ 1. Given a subspace A ⊂ X (which as usual we assume is 1-thick and equipped with the induced measure and induced 1-geodesic metric) we define the boundary at scale a ≥ 2 of A to be ∂a A = [A]a ∩ [Ac ]a with the usual notation Ac = X \ A. For clarity, given a subspace Z of X and A ⊂ Z, we also define the boundary at scale a of A in Z to be ∂aZ A = Z ∩ ∂a (A). Definition 6.3. Let (Z, d, ν) be a metric measure space, where ν(Z) is finite and let a ≥ 2. We define the Cheeger constant at scale a POINCARÉ PROFILES OF GROUPS AND SPACES 25 of Z to be  ν(Z) ν(∂a Ω) . : ν(Ω) ≤ ha (Z) = inf ν(Ω) 2 Let (X, d, µ) be a metric measure space. We define the function sepX,a (r) = sup {µ(Z)ha (Z)}, where the supremum is taken over all (1-thick) subspaces Z ⊆ X with µ(Z) ≤ r, and is 0 if no such subspaces exist.  Remark 6.4. If Γ is a finite graph of bounded degree D then the boundary at scale a has comparable size to the vertex boundary, so the usual (vertex) Cheeger constant h(Γ) satisfies h(Γ) ≍a,D ha (Γ). As a result, if X is an infinite graph of bounded degree D, then sepX,a ≃a,D sepX , where sepX is the usual separation function for graphs. (See [Hum17, Propositions 2.2, 2.4].) 6.3. Comparing Cheeger and L1 -Poincaré constants. Our next goal is to prove Proposition 3. Along the way we will also prove Proposition 6. Proposition 6.5. Let (X, d, µ) be a metric measure space and let a ≥ 2. Then 1 sepX,a ≤ Λ1X,a ≤ sepX,a . 2 We prove this by comparing the Cheeger constant and the L1 -Poincaré constant. Proposition 6.6. Let (X, d, µ) be a metric measure space. The following co-area formula holds for every non-negative measurable function f : X → R. Z Z µ (∂a {f > t}) dt (6.7) |∇a f |(x)dµ(x) = X R+ Proof. For every measurable subset A ⊂ X, we have Z (6.8) µ(∂a A) = |∇a 1A |(x)dµ(x). X Thus, (6.7) follows by integrating over X the following local equalities Z |∇a 1{f >t} |(x)dt. (6.9) |∇a f |(x) = R+ It remains to show that these equalities hold for all x ∈ X. Notice that |∇a 1{f >t} (x)| = 1 if and only if there exists y, y ′ ∈ B(x, a) with f (y) > t and f (y ′) ≤ t. In particular, |∇a 1{f >t} (x)| 26 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA equals one for t ∈ (inf B(x,a) f, supB(x,a) f ) and equals zero for t ∈ / [inf B(x,a) f, supB(x,a) f ]. Hence, Z |∇a 1{f >t} |(x)dt = sup f − inf f = |∇a f |(x), B(x,a) R+ B(x,a) which proves (6.9).  Using this co-area formula we can prove the required relation between ha (Z) and h1a (Z). Proposition 6.10. Let (Z, d, ν) be a metric measure space with finite positive measure ν and let a ≥ 2. Then h1a (Z) ≤ ha (Z) ≤ 2h1a (Z). Proof. Let Ω ⊂ Z such that ν(Ω) ≤ ν(Z)/2. We deduce from (6.8) that k∇a f k1 = ν(∂a Ω), where f = 1Ω . On the other hand,     ν(Ω) ν(Ω) + (ν(Z) − ν(Ω)) ≥ ν(Ω). kf − fZ k1 = ν(Ω) 1 − ν(Z) ν(Z) Hence h1a (Z) ≤ ha (Z). By Lemmas 3.4 and 3.6, for each δ > 0 we may choose f ∈ L1 (Z, ν) (with median 0) such that k∇a f k1 ≤ 2h1a (Z) + δ. kf k1 Let f+ = max{f, 0} and f− = min{f, 0}. For any s, s′ , t, t′ > 0 if ′ s+s′ ≤ C then st ≤ C or st′ ≤ C. Since kf k1 = kf− k1 + kf+ k1 and t+t′ k∇a f k1 = k∇a f+ k1 + k∇a f− k1 , we deduce that up to replacing f by −f , we have k∇a f+ k1 ≤ 2h1a (Z) + δ. kf+ k1 Hence using (6.7) and the fact that Z ν({f > t})dt, kf+ k1 = R+ we conclude that there exists some t ≥ 0 such that the subset Ωt = {f > t} satisfies ν(∂a Ωt ) ≤ 2h1a (Z) + δ. ν(Ωt ) This proves the second inequality. ha (Z) ≤  POINCARÉ PROFILES OF GROUPS AND SPACES 27 Proof of Proposition 6: The first half of the above proof can easily be adapted to prove that 21−p hpa (Z)p ≤ ha (Z). Hence, hpa (Z)p ≤ 2p h1a (Z).  7. Dependency on p In this section we prove Proposition 5. One trivial upper bound can always be put on Poincaré constants. Proposition 7.1. Let (Z, d, ν) be a metric measure space with ν(Z) finite. Assume there is no z ∈ Z with ν({z}) > 23 µ(Z). For all p ∈ 1 [1, ∞) and all a ≥ 2, hpa (Z) ≤ 2 · 3 p . Proof. By our standing assumptions (Definition 2.1), ν is measure isomorphic to a real interval and an at-most-countable collection of atoms. It is then easy to find a subset Y ⊂ Z satisfying 13 ν(Z) ≤ ν(Y ) ≤ 2 ν(Z). Let f be the characteristic function of Y . 3 1 and ||∇a f ||pp ≤ ν(Z), thus hpa (Z) ≤ 2·3 p .  Then ||f − fY ||pp ≥ ν(Z) 3·2p Equipped with this we are now able to study the relationship between different Poincaré profiles of the same space and prove Proposition 5. Proposition 7.2. Let (Z, d, ν) be a metric measure space with ν(Z) finite. Assume there is no z ∈ Z with ν({z}) > 32 ν(Z). Then for all 1 ≤ p ≤ q < ∞ and all a ≥ 2, hqa (Z) p,q hpa (Z). For all metric measure spaces (X, d, µ) (where µ is possibly infinite), and all 1 ≤ p ≤ q < ∞, ΛqX p,q ΛpX . Proof. Our goal is to prove that for any function g : Z → R, there is a function f : Z → R such that ||∇a g||q ||∇a f ||p p,q ≥ hpa (Z). ||g − gZ ||q ||f − fZ ||p Taking the infimum over all g would then yield the desired result. From this, we see that it suffices to consider all functions g which satisfy the upper bound ||∇a g||q ≤ 6 ||g − gZ ||q given by Proposition 7.1. By (3.5) we have that for all C ∈ R, 6 ||g − gZ ||q ≤ 12 ||g − C||q . For a ∈ R and p ≥ 1, write {a}p = sign(a)|a|p . For each C, define f C : Z → R by f C (z) = {g(z) + C}q/p , for some C ∈ R. Since fZC is a continuous function of C, we fix C so that fZC = 0. Set f = f C . For each z ∈ Z let (g + C)a (z) = sup {|g(z ′ ) + C| : d(z, z ′ ) ≤ a}. 28 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA By the mean value theorem (see e.g. Matoušek [Mat97, Lemma 4]), for every s, t ∈ R and α ≥ 1, |{s}α − {t}α | ≤ α(|s|α−1 + |t|α−1 )|s − t|. For each z ∈ Z we apply this to s = g(x) + C, t = g(y) + C, α = all pairs of points x, y ∈ B(z, a) and see that q−p 2q |∇a f |(z) ≤ (g + C)a (z) p |∇a g|(z). p q p for By the definition of ∇a , (g + C)a (z) ≤ |g(z) + C| + |∇a g| (z), so taking pth powers and integrating, we see that ||g + C||qq hpa (Z)p = ||f ||pp hpa (Z)p = ||f − fZ ||pp hpa (Z)p Z ≤ |∇a f | (z)p dν Z p Z 2q (|g(z) + C| + |∇a g| (z))q−p |∇a g|(z)p dν ≤ p Z  p Z  (⋆) 2q q−p q p q−p |g(z) + C| |∇a g| (z) dν + ||∇a g||q 2 ≤ p Z  (†) 2q q p  ≤ p ||g + C||qq−p ||∇a g||pq + 12q−p ||g + C||qq−p ||∇a g||pq p p,q ||g + C||qq−p ||∇a g||pq , where (⋆) follows from (s + t)α ≤ 2α (sα + tα ) for any s, t, α > 0, and (†) follows from Hölder’s inequality and ||∇a g||q ≤ 12 ||g + C||q . Rearranging, taking pth roots, and applying (3.5) we have ||g − gZ ||q ≤ 2 ||g + C||q p,q ||∇a g||q . hpa (Z)  Remark 7.3. There are graphs X of bounded degree containing expanders, and by Propositions 7.2 and 3, ΛpX (rn ) p Λ1X (rn ) ≍ sepX (rn )  rn on some unbounded subsequence (rn ) [Hum17], but Λ∞ X (r) ≃ r/ log(r) by Proposition 2, so one should not expect universal constants (independent of p, q) in the above proposition. 8. Poincaré profiles of groups with polynomial growth The goal of this section is to prove the lower bound in Theorem 7. Given a compactly generated locally compact group group G, with compact symmetric generating set K, let d = dK be the associated POINCARÉ PROFILES OF GROUPS AND SPACES 29 word metric and let µ be a left-invariant Haar measure. We refer to the triple (G, d, µ) as a metric measure CGLC group. By Lemma 3.3 and Corollary 4.5, the Lp -Poincaré profile of G is well-defined (up to ≃). Theorem 8.1. Let (G, d, µ) be a metric measure CGLC group. If there exists some m > 0 such that γ(r) ≍ r m , then for every p ∈ [1, ∞], m−1 ΛpG (r) &p r m . Note that the p = ∞ case follows immediately from Proposition 6.1. Moreover, by Proposition 7.2 ΛpG &p Λ1G for all p ∈ [1, ∞). Using Proposition 6.5 we see that Theorem 8.1 follows from Theorem 8.2. Let (G, d, µ) be a metric measure CGLC group. If µ(B(1, r)) ≍ r m then for all a, r sufficiently large, there is a subset Br of B(1, r) with measure at least 12 µ(B(1, r)) satisfying ha (Br ) a r −1 . This theorem will be our goal for the section. The proof is in three parts: the first part gives a general Poincaré inequality satisfied by any compactly generated locally compact group. Secondly we refine this inequality for groups with polynomial growth. In the third part we use this Poincaré inequality (specifically in the L1 setting) to obtain lower bounds on the Cheeger constant at scale a of metric balls. 8.1. A Poincaré inequality. Poincaré inequalities are well known to hold for groups with polynomial growth, see for example [SC02]. In this subsection we present a generalisation of [Kle10, Theorem 2.2] (attributed to Saloff-Coste and explicitly appearing in the L2 case in [DSC93]) to compactly generated locally compact groups in our framework. The proof below is also similar in nature to [HK00, Proposition 11.17] which is attributed to Varopoulos [Var87]. Theorem 8.3. Let (G, d, µ) be a metric measure CGLC group. Let ∆ : G → R be the modular function on G; i.e., for U ⊂ G and g ∈ G, µ(Ug) = µ(U)∆(g). Define ∆(K) = supg∈K ∆(g). For any p ≥ 1, a ≥ 1, for any metric ball B = B(x0 , R) of radius R and any function f ∈ L1 (G) we have the following: Z Z (2R)p µ(2B)∆(K)2R p |f (x) − fB | dµ(x) ≤ |∇a f | (x)p dµ(x), µ(B) B 3B where for λ > 0, λB = B(x0 , λR). Proof. We may assume x0 = e. Recall that |∇a f | (x) = sup {|f (y) − f (z)| : y, z ∈ B(x, a)} . 30 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA If a ≤ a′ then |∇a f | (x) ≤ |∇a′ f | (x) so it suffices to prove the result above for a = 1. For every z ∈ 2B, we choose a geodesic γz : {0, 1, . . . , k} → G with γz (0) = e and γz (k) = z. For x, y ∈ B(R), let z = x−1 y, and let |γz | = k be the length of the corresponding path. Then by the triangle and Hölder’s inequality, p |f (x) − f (y)| ≤ |γz | X p ≤ |γz | |∇1 f |(xγz (i)) p−1 i=1 |γz | X |∇1 f |(xγz (i))p . i=1 For fixed z ∈ 2B, consider the map F : (x, i) 7→ (xγz (i), i). This is clearly injective, so (x, i) 7→ xγz (i) is at most 2R-to-1, and Z X |γz | p |∇1 f |(xγz (i)) dµ(x) = B i=1 |γz | Z X i=1 = |∇1 f |(xγz (i))p dµ(x) B |γz | Z X i=1 |∇1 f |(x)p ∆(γz (i)−1 )dµ(x) B·γz (i) ≤ 2R sup ∆(g) g∈2B Z |∇1 f |(x)p dµ(x). 3B P Since 2B = K 2R we have g∈2B ∆(g) = ∆(K 2R ) ≤ ∆(K)2R , so Z Z Z p dµ(x2 ) p dµ(x1 ) |f (x1 ) − f (x2 )| |f − fB | dµ ≤ µ(B) B B B Z 1 ≤ |f (x1 ) − f (x2 )|p dµ(x1 )dµ(x2 ) µ(B) B×B Z Z |γz | X (2R)p−1 |∇1 f |(xγz (i))p dµ(z)dµ(x) ≤ µ(B) x∈B z∈2B i=1 Z Z (2R)p ∆(K)2R ≤ |∇1 f |(x)p dµ(x)dµ(z) µ(B) z∈2B x∈3B Z p 2R (2R) ∆(K) µ(2B) ≤ |∇1 f |(x)p dµ(x).  µ(B) 3B 8.2. CGLC groups with polynomial growth. We begin by refining the above Poincaré inequality. Lemma 8.4. If lim inf r→∞ 1r log(µ(B(1, r))) = 0, then G is unimodular. POINCARÉ PROFILES OF GROUPS AND SPACES 31 Proof. Suppose G is not unimodular, then there exists some g ∈ G such that ∆(g) > 1. Since ∆ is multiplicative, there is some k ∈ K with ∆(k) > 1. Now, for each n, Kk n ⊆ B(1, n + 1), so µ(B(1, n + 1)) > ∆(k)n µ(K), and therefore lim inf r→∞ 1r log(µ(B(1, r))) > 0.  From this we obtain the following refinement of a special case of Theorem 8.3. Corollary 8.5. If G has polynomial growth then there exists a constant C such that, for any p ≥ 1 and a ≥ 1, for any metric ball B = B(x0 , R) of radius R and any function f ∈ Lp (G) we have the following: Z Z p p |∇a f | (x)p dµ(x). (8.6) |f (x) − fB | dµ(x) ≤ CR B 3B Using this refined Poincaré inequality (specifically the case p = 1) we will now present a proof of Theorem 8.2 via a series of lemmas. The goal is to prove that any subset A of B such that both A ∩ B and Ac ∩ B have measure proportional to B must have large boundary inside B. It is not sufficient to apply the Poincaré inequality (8.6) to the characteristic function of A inside B as we cannot distinguish the contribution coming from the boundary of A in B with that coming from the boundary of B in X. The solution is to apply the Poincaré inequality (8.6) “deep inside” B. From this we will show that there is a large subset of B with sufficiently large Cheeger constant. This step is modelled on ideas from [Hum17] relating the cut size and Cheeger constant definitions of separation. Definition 8.7. Let X be a metric space, let x ∈ X, and let r, s ∈ R+ with s > r. The (r, s)-corona around x is the set Cr,s (x) = B(x, s) \ B(x, r). Lemma 8.8. Let (G, d, µ) be a metric measure CGLC group with γ(r) ≍ r m . For each δ ∈ (0, 1) there exists some ǫ > 0 such that for every x ∈ G and r sufficiently large, we have µ(Cr,(1+ǫ)r (x)) ≤ δµ(B(x, r)). Proof. By [Tes07, Lemma 24], there exist constants α, β > 0 independent of r such that µ (Cr−s,r (x)) ≥ αµ(Cr,r+s(x)) for every x ∈ G whenever 4β < s ≤ r. Let ǫ′ ∈ (0, 1), let r ≥ 8β and for each 1 ≤ i ≤ k = ⌊− log2 ǫ′ ⌋, let bi = µ(C(1−2i ǫ′ )r,r ). By construction bi+1 ≥ (1 + α)bi for all i ≥ 1, so bk ≥ (1 + α)k−1b1 . 32 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA Fix δ ∈ (0, 1). If µ(Cr,(1+ǫ′ )r ) > δµ(B(x, r)), then µ(Cr,(1+ǫ′)r ) ≥ δbk ≥ δ(1 + α)k−1 b1 . But, by [Tes07, Lemma 24], b1 ≥ αµ(Cr,(1+ǫ′)r ), so αδ(1 + α)k−1 ≤ 1. 1 Thus k ≤ log1+α ( αδ ) + 1, which implies that ǫ′ ≥ ǫα,δ := αδ . 4 log1+α (2) The conclusion of the lemma holds for all ǫ < ǫα,δ .  Lemma 8.9. Let (G, d, µ) be a metric measure CGLC group with γ(r) ≍ r m . There exist constants r0 , ǫ, k > 0 such that the following holds for all r ≥ r0 . For any A ⊂ B(x, r) with 41 γ(r) ≤ µ(A) ≤ 12 γ(r), there exists a point w ∈ B(x, r) such that B(w, 3ǫr) ⊂ B(x, r), and such that µ(B(w, ǫr) ∩ A) ≥ kγ(r) and µ(B(w, ǫr) ∩ Ac ) ≥ kγ(r). Proof. By Lemma 8.8, for all r sufficiently large, and ǫ sufficiently 1 small the corona C(1−3ǫ)r,r (x) has size < 10 γ(r) for every x ∈ X. Now 80 fix k > 0 such that γ(ǫr) ≥ 3 kγ(r) for all r ≥ r0 . Applying Lemma 8.8 with δ = k2 we deduce that k k γ(ǫr) ≤ γ(r), 2 2 holds whenever ǫ is sufficiently small and r sufficiently large. 3 Since µ(A ∩ B(x, (1 − 3ǫ)r)) ≥ 20 γ(r), there exists a point y ∈ 3 γ(ǫr) ≥ 2kγ(r). SimiB(x, (1 − 3ǫ)r)) such that µ(A ∩ B(y, ǫr)) ≥ 20 larly, there is some z ∈ B(x, (1 − 3ǫ)r)) such that µ(Ac ∩ B(z, ǫr)) ≥ 2kγ(r). Now, by our choice of k, for every v ∈ B(x, (1 − 3ǫ)r), (8.10) γ(ǫr + 1) − γ(ǫr) ≤ max {µ(A ∩ B(v, ǫr)), µ(Ac ∩ B(v, ǫr))} ≥ 21 γ(ǫr) ≥ 2kγ(r). Since y, z ∈ B(x, (1 − ǫ)r)) there is a sequence y = v0 , v1 , . . . , vl = z such that d(vi−1 , vi ) = 1, l ≤ 2r and {vi } ⊂ B(x, (1 − ǫ)r)). By (8.10), we see that the measure of the symmetric difference of B(vi , ǫr) and B(vi+1 , ǫr) is at most kγ(r) for all i. Choose i maximal such that µ(A ∩ B(vi , ǫr)) ≥ 2kγ(r). If i = l then we choose w = vl and the proof is complete. If i < l then µ(Ac ∩ B(vi+1 , ǫr)) ≥ 2kγ(r), but since the symmetric difference of B(vi , ǫr) and B(vi+1 , ǫr) has measure at most kγ(r), we see that µ(Ac ∩ B(vi , ǫr)) ≥ kγ(r) and we set w = vi .  With this lemma we can show that large subsets of balls have large boundaries inside the ball. POINCARÉ PROFILES OF GROUPS AND SPACES 33 Proposition 8.11. Let (G, d, µ) be a metric measure CGLC group with γ(r) ≍ r m . For every a sufficiently large, there exists a constant k = k(a) such that for every ball B of radius r, and any subspace A ⊂ B(x, r) with 14 γ(r) ≤ µ(A) ≤ 12 γ(r), we have µ(∂aB A) ≥ kr m−1 . Proof. Let A ⊂ B(x, r) = B be such that 41 µ(B) ≤ µ(A) ≤ 21 µ(B). By Lemma 8.9 there exists some w ∈ B(x, (1−3ǫ)r) such that µ(B(w, ǫr)∩ A), µ(B(w, ǫr) ∩ Ac ) ≥ kµ(A). Applying the Poincaré inequality (8.6) with p = 1 to the characteristic function 1A on the ball B(w, ǫr) we see that 1 kµ(A) ≤ Cǫrµ(∂aB(w,3ǫr) A). 2 Since B(w, 3ǫr) ⊆ B we deduce that there exists a constant k ′ > 0 (independent of r) such that k′  µ(∂aB A) ≥ µ(B). r The last step in this argument ensures that there is a large subset of the ball with suitable Cheeger constant at scale a. This is a generalisation of a similar result for graphs presented in [Hum17]. Proposition 8.12. Let (X, d, µ) be a metric measure space such that inf x∈X µ(B(x, 1)) = c > 0, and let a, r ≥ 2. If there exists a constant λ = λ(a, r) ≤ 14 and a ball B = B(x, r) of radius r, such that for any subspace A ⊂ B with 14 µ(B) ≤ µ(A) ≤ 21 µ(B), we have µ(∂aB A) ≥ λµ(A), then there exists some 1-thick subspace B ′ of B such that µ(B ′ ) ≥ 12 µ(B) and ha (B ′ ) ≥ λ2 . Proof. Fix B as above. Given any subset A0 of B such that µ(A0 ) ≤ 1 µ(B) and µ(∂a A0 ) < λ2 µ(B), we have µ(A0 ) < 41 µ(B) by assumption. 2 Let m be the supremum of the measures of all subsets A0 satisfying . the above, and let A1 be such a subset with measure at least m − 2c λ Define A′ = [B \ [A1 ]a ]1 ⊆ B \ A1 . Note that A′ is 1-thick and µ(A′ ) ≥ µ(B) − µ(A1 ) − µ(∂a A1 ) ≥ 85 µ(B). We wish to show that ha (A′ ) ≥ λ/2. Suppose for a contradiction that ′ there exists some subset E ⊂ A′ with µ(E) ≤ 21 µ(A′ ) and µ(∂aA E) < ′ λ µ(E). Since ∂aB E ⊆ ∂aA E ∪∂aB A1 , we have µ(∂aB (E ∪A1 )) < λ2 (µ(E)+ 2 µ(A1 )). From this we deduce that µ(E) + µ(A1 ) > 12 µ(B), or, if this is not the case, then µ(E) ≤ 2c by the choice of A1 . λ ′ In the second case we are done: ∂aA E contains a ball of radius 1, so ′ c ≤ µ(∂aA E) < λ2 µ(E) ≤ c which is a contradiction. Otherwise µ(E ∪ A1 ) ∈ ( 21 µ(B), 43 µ(B)) so E ′ = B \ (E ∪ A1 ) satisfies µ(E ′ ) ∈ ( 41 µ(B), 12 µ(B)) and µ(∂aB E ′ ) = µ(∂aB (E ∪ A1 )) < λ2 µ(B), which is also a contradiction.  34 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA Proof of Theorem 8.2. This follows immediately from Propositions 8.11 and 8.12 with λ = k/r.  9. Upper bounds and large-scale dimension The goal of this section is to obtain upper bounds on the Poincaré profiles of a metric measure space which is finite dimensional in the sense of the definition below. In doing so, we will prove that the lower bound for groups of polynomial growth in section 8 is sharp to complete the proof of Theorem 7. Definition 9.1. Let (X, d, µ) be a metric measure space. We say X has measurable dimension at most n (mdim(X) ≤ n) if, for S all r ≥ 0 we can write X = X0 ∪ · · · ∪ Xn and decompose each Xi = Xij so that each Xij is 1-thick, sup(µ(Xij )) < ∞ and d(Xij , Xij ′ ) ≥ r whenever j 6= j ′ . If mdim(X) ≤ n we define the function γn (r) to be the infimal value of sup(µ(Xij )) + 1 taken over all decompositions of X satisfying the above hypotheses. Notice that γn (r) is non-decreasing as a function of r. A simple comparison can be made with asymptotic dimension when the metric measure space has bounded geometry: for all r ≥ 0 there exists some Cr such that µ(B(x, r)) ≤ Cr for all x ∈ X. Lemma 9.2. Let (X, d, µ) be a metric measure space with bounded geometry. Then the asymptotic dimension of X is at least mdim(X). Proof. Suppose asdim(X) ≤ n. This implies that for all r ≥ 0 one S can decompose X = X0′ ∪ . . . ∪ Xn′ and further decompose each Xi′ = Xij′  so that sup diam(Xij′ ) = Kr < ∞ and d(Xij , Xij ′ ) ≥ r + 2 whenever j 6= j ′ . S Define Xij = y∈X ′ B(y, 1). Each Xij is 1-thick, it has diameter at ij most L = Kr + 2 and d(Xij , Xij ′ ) ≥ r whenever j 6= j ′ . Since X has bounded geometry, µ(Xij ) ≤ CL for all i, j.  Lemma 9.3. Let (X, d, µ) and (Y, d′ , µ′) be metric measure spaces and suppose Y has bounded packing at scales ≥ 1. If there exists a coarsely regular map F : X → Y , then mdim(X) ≤ mdim(Y ). Moreover, for all suitable n we have γnX .n γnY . Proof.SSuppose mdim(Y ) ≤ n. Then for all r ≥ 0 one can write n S r Y = i=0 j Yij where each Yijr is 1-thick, µ′ (Yijr ) ≤ C for some C and all i, j, and d′ (Yijr , Yijr ′ ) > ρ+ (r + 2) whenever j 6= j ′ . Let Xijr = [F −1 (Yijr )]1 . By Definition 5.1(i), d(Xijr , Xijr ′ ) > r whenever j 6= j ′ , and by (ii) µ(Xijr ) ≍ µ′ ([Yijr ]1 )  µ′ (Yijr ) by Lemma 2.3.  POINCARÉ PROFILES OF GROUPS AND SPACES 35 Remark 9.4. One can remove the assumption that Y has bounded packing at scales ≥ 1 by removing the assumption that each Xij is 1-thick in the definition of measurable dimension. Proposition 9.5. Let (X, d, µ) be a metric measure space with µ(X) = ∞ and measurable dimension at most n. For all δ > 0, ΛpX (r) .n sup {γn (t + δ)/t : γn (t) ≤ r/(4n + 4)} . Proof. If γn is bounded then µ is bounded, which is a contradiction. Choose s > 4(n + 1)γn (0) and assume µ(A) = s ≤ r. Fix δ > 0 and find t so that 4(n + 1)γn (t) ≤ µ(A) ≤ 4(n + 1)γn (t + δ). Select a decomposition of X into sets Xijt as above where µ(Xijt ) ≤ γn (t) for all i, j. 1 Then there exists some i such that µ(A ∩ Xi ) ≥ n+1 µ(A) ≥ 4γn (t). Without loss of generality, assume i = 0. Choose J so that [ µ(A) µ(A) t X0′ := X0j satisfies ≤ µ(A ∩ X0′ ) ≤ . 4(n + 1) 2(n + 1) j∈J Set X0′′ = X0t \ X0′ and let ft : A → R be the function f (x) = 1 min {t, dX (x, X0′ )}. t R p Now ft is 1t -Lipschitz, so A |∇2 f |p ≤ 2tp µ(A). Since f takes values in [0, 1] and has value 0 on XR0′ and value 1 on X0′′ each of measure 1 µ(A). ≥ µ(A)/4(n + 1), we see that A |f − fR |p dµ(x) ≥ ( 21 )p 4(n+1) 4 1 p 2 Thus, ha (A) ≤ t (n + 1) n t . As this holds for every measurable A ⊂ X of finite measure the result follows.  Remark 9.6. Under nice circumstances, for instance when a space X has a cobounded isometry group, and finite asymptotic dimension where the Kr can be bounded by an affine function of r (sometimes called linearly controlled or asymptotic Assouad–Nagata dimension), the function γn (sr + δ)/sr is equivalent (up to ≃) to r/κ(r) where κ is the inverse growth function. This is easily deduced from the argument in the proof of Proposition 6.1. Proof of Theorem 7. Let (G, d, µ) be a CGLC metric measure group with µ(B(1, r)) ≍ r m . Such groups have finite asymptotic Assouad– Nagata dimension ([Bre14, Theorem 1.2] and [HP13, Theorem 5.5]), so m−1 by Proposition 9.5, ΛpG (r) . r m for all p ≥ 1. The lower bound is proved in Theorem 8.1.  Example 9.7. As another example, for X equal to the product of two 3-regular trees we have ΛpX (r) ≃ r/ log(r) for all p ∈ [1, ∞]: The case p = ∞ follows immediately from Proposition 2. By [BST12, Theorem 36 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA 3.1] and Proposition 6.5, the lower bound holds when p = 1, so the lower bound for general p follows from Proposition 7.2. For the upper bound, X has exponential growth, a cobounded isometry group, and asymptotic Assouad–Nagata dimension 2, so by Proposition 9.5, ΛpX (r) . r/ log(r) for all p ≥ 1. 10. Trees In this section, we calculate the Poincaré profile for regular trees. Theorem 10.1 (Theorem 9). Let T be the infinite 3-regular tree. Then for every p ∈ [1, ∞), ΛpT (r) ≍p r (p−1)/p . For p = 1 this is immediate from [BST12]. This theorem immediately implies the following corollary for groups admitting quasi-isometric embeddings of such trees. Corollary 10.2. If (G, d, µ) is a CGLC measure group which is nonamenable, non-unimodular, or is compact-by-elementary amenable and has exponential growth, then for any p ≥ 1, ΛpG (r) &G,p r (p−1)/p . Proof. In the first two cases this follows from [BS97], and in the third from [Cho80].  In this section, for a graph X, and a function f : V X → R, we define |∇f | : EX → R as |∇f |(e) = |f (x) − f (y)| where e ∈ EX has endpoints x, y ∈ V X. If X has maximum vertex degree d then for each p ≥ 1, !1/p X k∇2 f kp ≍d k∇f kp = . |∇f |(e)p e∈EX A key step in proving Theorem 10.1 is to reduce to an estimate on complete graphs in the spirit of, for example, Spielman [Spi15, Section 4.7]. Proposition 10.3. For any r ∈ N, r ≥ 2 and p ∈ [1, ∞), letting Kr denote the complete graph on r vertices, we have   k∇f kp 1/p : f : V Kr → R, f 6≡ fKr p r 1/p . r ≤ inf kf − fKr kp POINCARÉ PROFILES OF GROUPS AND SPACES 37 Proof. Let f : V Kr → R be any non-constant function on Kr . Then kf − fKr kpp = X x 1X f (y) f (x) − r y p 1 X X ≤ p |f (x) − f (y)| r x y !p ! 1 X X |f (x) − f (y)|p r p−1 ≤ p r x y = r −1 k∇f kpp . This proves the first inequality; the second can be seen by considering a function which is 1 and −1 on one vertex each, and zero everywhere else.  Proof of Theorem 10.1. First we show the upper bound, which is relatively simple. Suppose A ⊂ T is a graph of size |A| = r; we can find a vertex x so that on deleting this vertex, all remaining connected components have size ≤ r/2. Group these components into sets U, V of size ∈ [r/4, 3r/4]. Let f : A → [−1, 1] be identically −1 on U, 1 on V and 0 on x. Clearly kf − fA kpp ≥ 41 r, and since ∇f is only non-zero on edges adjacent to x, k∇f kpp ≤ 3. Thus hp (A) ≤ (12/r)1/p and Λp (r) = sup |A|hp (A) ≤ 12r (p−1)/p . |A|≤r Second, we show the lower bound. For any r > 0 there exists a ball B = B(x0 , t) ⊂ T of size ≍ 2t ≍ r, so we can assume r = |B| and it then suffices to show that hp (B)  |B|−1/p , with constant independent of B. Let Kr be the complete graph on r vertices. Suppose that a nonconstant function f : B → R is given. Consider f as a function on the complete graph Kr = K|B| . In light of Proposition 10.3, to show that hp (B)  |B|−1/p , it suffices to show that X 1 X |∇f (e)|p ≥ |f (x) − f (y)|p, 2 2|B| e∈EB x,y∈B for then hp (B)  |B|−2/p r 1/p  |B|−1/p . Now for each x, y ∈ B, let γxy P be the simple path in T joining x to y. Observe that |f (x) − f (y)| ≤ e∈γxy |∇f (e)|. 38 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA For each e ∈ EB, let Ne be the number of such simple paths that pass through e. Observe that Ne ≍ 2t · 2t−d(x0 ,e) , where d(x0 , e) is the distance from the centre of the ball to the edge e. Using Hölder’s inequality, we have  p X X X  |f (x) − f (y)|p ≤ |∇f (e)| x,y∈B e⊂γxy x,y∈B = X x,y∈B ≤ X x,y∈B  X  e⊂γxy   X e⊂γxy 1/(p−1) p |∇f (e)|Ne−1/p Ne1/p   |∇f (e)|p Ne−1   X e⊂γxy p−1 Ne1/(p−1)  For each simple path, Ne takes values in (two) geometric series, with ratio depending only on p and maximum value  (22t )1/(p−1) ≍ |B|2/(p−1) , and so the sum inside the second parentheses above is also  |B|2/(p−1) . Thus, X X X |f (x) − f (y)|p  |∇f (e)|pNe−1 |B|2 x,y∈B x,y∈B e∈γxy ≤ 2|B|2 X |∇f (e)|p , e∈B and so we are done.  11. Lower bounds for hyperbolic spaces with boundary Poincaré inequalities In this section we find lower bounds on Poincaré profiles for hyperbolic groups whose boundaries admit Poincaré inequalities in the sense of Heinonen and Koskela (Theorem 13). In section 13 we will apply these results to rank 1 symmetric spaces, and a family of hyperbolic buildings studied by Bourdon and Pajot. Suppose a metric space (Z, ρ) is Ahlfors Q-regular, i.e. there is a measure µ on Z so that for every ball B(z, r) in Z with r ≤ diam(Z), we have µ(B(z, r)) ≍ r Q . (We may take µ to be the Hausdorff Q-measure on Z.) For p, q ≥ 1, we say (Z, ρ) admits a (q, p)-Poincaré inequality (with constant L ≥ 1) if for every Lipschitz function f : Z → R and POINCARÉ PROFILES OF GROUPS AND SPACES every ball B(z, r) ⊂ Z, Z 1/q Z q − |f − fB(z,r) | dµ ≤ Lr − B(z,r) p (Lipx f ) dµ(x) B(z,Lr) R where for U ⊂ Z, fU = −U f dµ = 1 µ(U ) U 1/p , f dµ, and |f (y) − f (x)| . r y∈B(x,r) Lipx f = lim sup sup r→0 R 39 If q = 1, we say Z admits a p-Poincaré inequality. By Hölder’s inequality, if Z admits a p-Poincaré inequality, it admits a q-Poincaré inequality for all q ≥ p. Moreover, since Z is doubling, it will admit (q, q)-Poincaré inequalities for all q ≥ p by [HK00, Theorem 5.1]. A geodesic metric measure space (X, d, µ) is Gromov hyperbolic if it is δ-hyperbolic for some δ ≥ 0: for every geodesic triangle T = (γ1 , γ2, γ3 ), we have γ1 ⊆ [γ2 ∪ γ3 ]δ . It is visual if there exists x0 ∈ X and C ≥ 0 so that every x ∈ X belongs to a C-quasi-geodesic ray γ : [0, ∞) → X with γ(0) = x0 . Gromov hyperbolic metric spaces have a boundary at infinity ∂∞ X which comes with a family of metrics: if X is visual with respect to x0 , a visual metric ρ on ∂∞ X based at x0 ∈ X with visibility parameter ǫ > 0 is a metric satisfying ρ(·, ·) ≍ exp(−ǫ(·|·)x0 ), where (·|·)x0 denotes the Gromov product with respect to x0 . For more background and discussion, see [BS00, BP03]. We can now state the first main result of this section (cf. Theorem 13). Theorem 11.1. Suppose that X is a visual Gromov hyperbolic graph with a visual metric ρ on ∂∞ X that is Ahlfors Q-regular and admits a p-Poincaré inequality. Then for all q ≥ p, ΛqX (r) & r 1−1/Q . By taking discretizations, one can apply this result to rank-1 symmetric spaces, amongst other examples. Proof. Consider ∂∞ X with the metric ρ, which admits a p-Poincaré inequality with some constant L ≥ 1. As a consequence, (∂∞ X, ρ) is quasi-convex, so ρ is bi-Lipschitz equivalent to a geodesic metric. Therefore we may assume that ρ is geodesic, and so our standing assumptions hold. Following Bourdon–Pajot [BP03, Section 2.1], we ensure that Z = (∂∞ X, ρ) has diameter 1/2 by rescaling, and define a graph Γ which approximates Z: Γ has vertex set {zti : t ∈ N, 1 ≤ i ≤ k(t)} where for k(t) each t ∈ N, Γt = {zt1 , . . . , zt } is a maximal e−t -separated net in Z. To each zti we associate a ball B(zti , e−t ) ⊂ Z, and we join zti and zuj by an edge if and only if |t − u| ≤ 1 and B(zti , e−t ) ∩ B(zuj , e−u ) 6= ∅. 40 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA By Bourdon–Pajot [BP03, Proposition 2.1, Corollary 2.4], Γ, with the path metric d, is a bounded degree hyperbolic graph which is quasiisometric to X, and so it suffices to show the Poincaré profile bound for Γ. We now consider the sequence Zt = (Z, ρt , µt ) of metric measure spaces, where ρt = 6et ρ, and µt = eQt µ. Note that µt (Zt ) ≍ eQt . We deduce from the Poincaré inequality satisfied by Z that Zt satisfies for any Lipschitz function f on Zt , for all q ≥ p 1/q Z Z 1/q q q t − |f − fZt | dµt  e − (Lipx f ) dµt (x) , and therefore that hqLip (Zt )  e−t with constant independent of t. By Proposition 3.9, this implies that hq2 (Zt )  e−t . Now equip Γt with the counting measure and the distance induced from its inclusion in Zt . Since Γt is a maximal 6-separated subset of Zt , we can find a partition G Aγ , Zt = γ∈Γt where Bρt (γ, 2) ⊂ Aγ ⊂ Bρt (γ, 18). By the Ahlfors regularity of Zt , µ(Aγ ) ≍ 1. Hence by Lemmas 5.8 and 3.3(ii), we deduce that hq40 (Γt , ρt )  e−t . In order to conclude, we need to show that there exists a constant C such that two vertices x, y ∈ Γt such that ρt (x, y) ≤ 40 satisfy d(x, y) ≤ C (where d(x, y) is their distance in Γ). Indeed, that will show that hqC (Γt , d)  e−t , (11.2) and since |Γt | ≍ eQt , ΛqΓ (r)  r 1−1/Q . By [BP03, Lemma 2.2], for x, y ∈ Γ corresponding to balls Bx , By ⊂ Z, e−(x|y) ≍ diam(Bx ∪ By ), where (x|y) denotes the Gromov product with respect to the base point z11 . For x, y ∈ Γt , we have (x|y) equal to t − 21 d(x, y) up to a uniform additive error, and diam(Bx ∪ By ) ≍ e−t + ρ(x, y), so 1 e−t e 2 d(x,y) ≍ diam(Bx ∪ By ) ≍ e−t + ρ(x, y). POINCARÉ PROFILES OF GROUPS AND SPACES 41 e−t implies that d(x, y)  1, which completes the Thus, ρ(x, y) ≤ 40 6 proof of Theorem 11.1.  We will see in section 13 that for many spaces, Theorem 11.1 gives sharp lower bounds for ΛqX when q ∈ [1, Q). For q = Q, however, one can do better. Theorem 11.3. Suppose that X is a visual Gromov hyperbolic graph with a visual metric ρ on ∂∞ X that is Ahlfors Q-regular and admits a 1−1/Q Q-Poincaré inequality. Then ΛQ log(r)1/Q . X (r) & r Proof. We continue with the notation of the proof of Theorem 11.1. Given s < t ∈ N, let Bs,t be the full subgraph of Γ containing the layers Γs+1 , Γs+2 , . . . , Γt . (Later we will take s = ⌊t/2⌋.) The strategy of the proof is to use the Poincaré inequality in each layer to get a stronger constant for all of Bs,t . Let us be given a function f : Bs,t → R, i.e. a function on V Bs,t . For x ∈ Γ, define ix ∈ N to satisfy x ∈ Γix . Given x ∈ Γ and i ≤ ix , let πi (x) ∈ Γi be (one of) the points in Γi so that the point in Z corresponding to x lies in the ball of radius e−i corresponding to πi (x); the allowed choices of πi (x) are all at distance 1 from each other. For i = s + 1, . . . , t, there are i − s layers in Bs,t with labels ≤ i. Lemma 11.4. There is an assignment Bs,t → N that maps each x ∈ Bs,t to a layer cx ∈ {s + 1, . . . , ix }, so that for any z ∈ Bs,t and any c, i with c ≤ iz ≤ i ≤ t we have eQ(i−iz ) eQ(t−s) (11.5) |{x ∈ Γi : πiz (x) = z and cx = c}|  ≤ , i−s t−s where the constant of ‘ ’ is independent of s, t, z, c and i. This follows from a colouring argument that we defer until later. Similarly to the proofs in Section 10, we bound p kf − (11.6) fBs,t kpp 1 X f (x) − f (y) = |Bs,t| y x 1 XX ≤ |f (x) − f (y)|p. |Bs,t| x y X (We refrain from setting p = Q at present to clarify the role this plays in the proof.) At a cost of multiplying by 2, we can restrict to sum only over x, y where ix ≤ iy . In particular, cx ≤ iy . Given such x, y, we consider the path αx that follows x, πix −1 (x), . . . , πcx (x), and also the path βx,y that follows along πcx (y), πcx +1 (y), . . . , πiy −1 (y), y. 42 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA Continuing from (11.6), since X |f (x) − f (y)| ≤ |∇1 f |(z) z∈αx ! + |f (πcx (x)) − f (πcx (y))| X + ! |∇1 f |(z) , z∈βx,y we use the inequality (a+ b+ c)p ≤ 3p (ap + bp + cp ) to find the following: 1 X (11.7) kf − fBs,t kpp  |Bs,t | x,y ix ≤iy X |∇1 f |(z) z∈αx !p +  p 1 XX 1 X |∇1 f |(z) . |f (πcx (x)) − f (πcx (y))|p + |Bs,t | x,y |Bs,t| x,y z∈β ix ≤iy x,y ix ≤iy We denote the resulting three terms of the sum by S1 , S2 , and S3 . For each z ∈ Bs,t , let Mz be the number of pairs (x, y) so that αx passes through z, and likewise Nz for βx,y . Let us bound the first term of (11.7), S1 . !p 1 X X S1 = |∇1 f |(z)Mz−1/p Mz1/p |Bs,t| x,y z∈α x ix ≤iy 1 X ≤ |Bs,t | x,y ix ≤iy X z∈αx |∇1 f |(z)p Mz−1 ! X Mz1/(p−1) z∈αx !p−1 when p > 1. If z ∈ Γs+j for some j ∈ {1, . . . , t − s}, then by (11.5) the number of possible choices of x is  t X i=s+j j eQ(i−s−j) j Q(t−s−j)  e i−s t−s and there are ≤ |Bs,t | possible choices of y so that z ∈ αx . Thus Mz  j eQ(t−s) |Bs,t | j Q(t−s−j) e |Bs,t| = Qj · . t−s e t−s POINCARÉ PROFILES OF GROUPS AND SPACES 43 P For any p > 1, j≥1 (je−Qj )1/(p−1) is bounded by some constant depending only on Q and p. Whether p > 1 or p = 1, we get that ! eQ(t−s) X X S1  |∇1 f |(z)p Mz−1 t − s x,y z∈α x ix ≤iy Q(t−s) = e t−s X z  |∇1 f |(z)p  X x,y:ix ≤iy ,z∈αx  Mz−1  = eQ(t−s) k∇1 f kpp . t−s A very similar calculation lets us bound S3 : if z ∈ Γs+j for some j |Bs,t| possible choices j ∈ {1, . . . , t − s}, then by (11.5) there are  t−s Q(t−s−j) of x and  e possible choices of y so that z ∈ βx,y . Thus j eQ(t−s) |Bs,t | j Q(t−s−j) |B | · e = · , Nz  s,t t−s eQj t−s and the rest of the calculation goes through as before to give S3  1 Q(t−s) e k∇1 f kpp . t−s It remains to bound S2 . Suppose we have x′ , y ′ ∈ Γs+j for some j ∈ {1, . . . , t − s}. Let Px′ ,y′ be the number of pairs x, y ∈ Bs,t so that ix ≤ iy and πcx (x) = x′ and πcx (y) = y ′ . Using again (11.5), we can bound Px′ ,y′ by the product of the number of choices of x, which is 1 Q(t−s−j)  t−s e , and the number of choices of y, which is  eQ(t−s−j) . Thus 1 X |f (πcx (x)) − f (πcx (y))|p S2 = |Bs,t | x,y ix ≤iy t−s 1 X = |Bs,t | j=1 (11.8)  X Px′ ,y′ |f (x′ ) − f (y ′)|p x′ ,y ′ ∈Γs+j t−s e2Q(t−s) X −2Qj X e (t − s)|Bs,t| j=1 x′ ,y ′ ∈Γ |f (x′ ) − f (y ′)|p . s+j Fixing for a moment our choice of j, let fj be the average value of f restricted to Γs+j . Assuming Z = (∂∞ X, ρ) satisfies a p-Poincaré inequality, we apply (11.2) to Γs+j to obtain: X X p |f (x′ ) − fj |  ep(s+j) |∇C f |(x′ )p . x′ ∈Γs+j x′ ∈Γs+j 44 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA Applying this twice, we have that X X |f (x′ ) − f (y ′)|p ≤ 2p (|f (x′ ) − fj |p + |f (y ′) − fj |p ) x′ ,y ′ ∈Γs+j x′ ,y ′ ∈Γs+j  ep(s+j) |Γs+j | X |∇C f |(x′ )p . x′ ∈Γs+j Since |Γs+j | ≍ eQ(s+j), and |Bs,t| ≍ eQt , on substituting this back in to (11.8), we get t−s e2Q(t−s) X −2Qj p(s+j) Q(s+j) X S2  e e e |∇C f |(x′ )p (t − s)|Bs,t| j=1 ′ x ∈Γs+j ≍ t−s eQt+(p−Q)s X (p−Q)j X e |∇C f |(x′ )p . t − s j=1 ′ x ∈Γs+j Provided p = Q, this simplifies to eQt k∇C f kQ Q. t−s Our bounds for S1 and S3 are dominated by our bounds for S2 , so we set s = ⌊t/2⌋ and conclude by (11.7) that S2  kf − fBs,t kQ Q  eQt |Bs,t | k∇C f kQ k∇C f kQ Q ≍ Q. t log |Bs,t |  It remains to show the colouring argument giving (11.5). Proof of Lemma 11.4. Recall that we are defining a colouring map Bs,t → {s + 1, . . . , t}, x 7→ cx . For each i ∈ {s+1, . . . , t}, the vertices of Γi correspond to a maximal e−i -separated net in Z. By Ahlfors Q-regularity, there exists C so that the number of e−i separated points in any r-ball in Z is ≤ C(r/e−i )Q = Cr Q eiQ . So if we let ri = 12 (i − s)1/Q C −1/Q e−i , we guarantee that any ri -ball in Z meets at most (i − s) points corresponding to vertices of Γi . Define Γi → {s + 1, . . . , i}, x 7→ cx to be any mapping so that no two points at distance ≤ ri in Z are mapped to the same value. The existence of such a mapping follows from Zorn’s lemma applied to the collection of all such partially defined functions. Doing this for each i, we obtain our mapping Bs,t → {s+1, . . . , t}. To verify that (11.5) holds, observe that for any z ∈ Bs,t and c, i satisfying c ≤ iz ≤ i ≤ t the set {x ∈ Γi : πix (x) = z and cx = iz } is an ri separated set in B(z, e−iz ) ⊂ Z, therefore by Ahlfors regularity it has POINCARÉ PROFILES OF GROUPS AND SPACES cardinality  −iz Q  Q e−iz e eQ(i−iz ) eQ(t−s)   = ≤ . ri (i − s)1/Q e−i (i − s) t−s 45  12. Upper bounds for hyperbolic spaces with hyperplanes In this section we present an approach to finding upper bounds on the Lp -Poincaré profiles of hyperbolic spaces. Our hypotheses are as follows: (1) (X, d, µ) is a δ-hyperbolic geodesic metric measure space, and it is visual with respect to a given point x0 ∈ X: there exists C ≥ 0 so that every x ∈ X belongs to a C-quasi-geodesic ray γ : [0, ∞) → X with γ(0) = x0 . (2) There exists a constant h(X) > 0 (called the volume entropy) and a constant C ≥ 0 such that for every R > 0, h(X)R − C ≤ loge (µ(BR (x0 ))) ≤ h(X)R + C. (3) There is a visual metric ρ on ∂∞ X based at x0 ∈ X with visibility parameter ǫ > 0; i.e., ρ(·, ·) ≍ exp(−ǫ(·|·)x0 ), where (·|·)x0 denotes the Gromov product with respect to x0 . For our last hypothesis, we require the following notion. Definition 12.1. Let (X, d) be a metric space and x0 ∈ X. For C ≥ 1, a subset A ⊆ X is said to be a C-asymptotic shadow of x0 if, for every x ∈ A there is a C-quasi-geodesic ray γx : [0, ∞) → X with γx (0) = x0 and d(γx (rx )) = x for some rx , and γx [rx , ∞) ⊆ A. (Recall that a C-quasi-geodesic ray is a (C, C)-quasi-isometric embedding of [0, ∞).) The final hypothesis only needs to hold for large a, where a ≥ 2 is the constant of thickness in Definition 4.1. Let Isomµ (X) be the group of µ-preserving isometries of X. (4) There exist constants κ, N, C > 0 such that for any a-thick subspace Z of X with measure at least N, there is some ψ ∈ Isomµ (X), and there exist two measurable subsets H ± of X which are C-asymptotic shadows of x0 , and satisfy the inequalities ρ(∂∞ H + , ∂∞ H − ) ≥ κ, µ(ψ(Z)∩H + ) ≥ κµ(Z) and µ(ψ(Z)∩ H − ) ≥ κµ(Z). These properties are satisfied for suitable geometric actions of a hyperbolic group, as we will see in subsection 12.2. Proposition 12.2. If G is a non-elementary hyperbolic group which acts geometrically and on a space (X, d, µ) and preserving µ, then for 46 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA any x0 ∈ X and visual metric ρ on ∂∞ X based at x0 with visual parameter ǫ, (X, d, µ) satisfies properties (1)–(4) for suitable δ, C and h(X). Moreover, (∂∞ X, ρ) is Ahlfors h(X)/ǫ-regular. Properties (1)–(3) are already known to hold in this generality, so our efforts will be focused on property (4). Given these properties, we find the following bounds on the Poincaré profile of X. Note that Theorem 12.3. Suppose X satisfies conditions (1)–(4) above for some fixed δ, C, ǫ, κ, N and set Q = h(X)/ǫ. Then we have the following bounds on ΛpX :  Q−1  if p < Q,  r Q p−1 1 p ΛX,a (r) .δ,C,κ,N r p log(r) p if p = Q,   p−1 if p > Q. r p To find the best bound possible for the Poincaré profiles ΛpG of a hyperbolic group G, it is natural to consider the following concept. Definition 12.4. The equivariant conformal dimension of a hyperbolic group G is defined to be the infimum of the Hausdorff dimension of (∂∞ X, ρ) where ∂∞ X is the boundary of a space X on which G acts geometrically and ρ is a visual metric on ∂∞ X. We say the equivariant conformal dimension is attained if the infimum is realised. Equivalently, we minimise h(X)/ǫ over all such actions, metrics and permissible visibility parameters. Using Proposition 12.2 and Theorem 12.3 we are now ready to prove Theorem 11. Corollary 12.5. Let G be a hyperbolic group and let Q be its equivariant conformal dimension. Then, for any ǫ > 0, ( Q−1 r Q +ǫ if p ≤ Q p ΛG (r) . p−1 if p > Q. r p If the equivariant conformal dimension  Q−1   r Q Q−1 1 p ΛG (r) . r Q log Q (r)   p−1 r p is attained, we have: if 1 ≤ p < Q if p = Q if p > Q. 12.1. Helly’s theorem and centrepoints. Inspired by the arguments presented in [BST12, Section 4], we show that finite measure thick subsets of real hyperbolic spaces have “medians”. To find a suitable centrepoint of a subset, we use Helly’s theorem (cf. [MTTV97]). POINCARÉ PROFILES OF GROUPS AND SPACES 47 The version suitable for our needs is the following variation on a result of Ivanov [Iva14]. Theorem 12.6 (Ivanov). Let X be a uniquely geodesic space of compact topological dimension k < ∞ (for example, a CAT(0) space of geometric dimension k). Let H be a (possibly infinite) collection of closed convex subsets of X, with the property that there exists a compact convex set Y ⊂ X so thatTfor any HT 1 , . . . , Hk+1 ∈ H we have Y ∩ H1 ∩ · · · ∩ Hk+1 6= ∅. Then H∈H H ⊃ H∈H H ∩ Y 6= ∅. Proof. If not, then for any y ∈ Y there exists Hy ∈ H with y ∈ / Hy . Since Y is compact, for some y1 , . . . , ym we have that {X \ Hyi }i=1,...,m is a finite subcover of the open cover {X \Hy }y∈Y of Y . By assumption, any k + 1 of the finite collection of convex sets {Y, Hy1 , . . . , Hym } have non-empty intersection (in Y ), and so Helly’s Theorem [Iva14, Theorem 1.1] implies that there exists y ∈ Y ∩ Hy1 ∩ · · · ∩ Hym 6= ∅. This is a contradiction, since y is not covered by {X \ Hyi }i=1,...,m .  Lemma 12.7. (Centrepoint theorem) Let a > 0. There exists a constant c = c(k, a) > 0 such that for any a-thick subset Z of HkR with finite measure, there is a point x ∈ HkR such that for any half-space H of HkR containing x, we have µ(H ∩ Z) ≥ cµ(Z). S Proof. By assumption Z = i∈I B(zi , a) for some {zi }i∈I ⊂ Z. Let Z ′ be an 2a-separated 4a-net in {zi : i ∈ I}. It follows that |Z ′ | ≍a µ(Z) since |Z ′ | µ(B(zi , a)) ≤ µ(Z) ≤ |Z ′ | µ(B(zi , 5a)) for some (any) zi . Let Y be a large closed (convex) ball containing Z ′ . Let Z be the k set of all closed half-spaces of HkR containing more than k+1 |Z ′ | of the points in Z ′ . Thus the intersection of any k + 1 of the sets in Z has non-empty intersection with Y . k Applying Theorem 12.6, and T the fact that HR has geometric dimension k, there exists some x ∈ H∈Z H. Thus for any half-space H ⊂ HkR k |Z ′ | we have x ∈ H. It is a short exercise to see with |H ∩ Z ′ | > k+1 k that x is contained in every half-space H such that |Z ′ ∩ H| > k+1 |Z ′ | if 1 and only if every half-space H containing x satisfies |Z ′ ∩ H| > k+1 |Z ′ |. ′ Let H be a half-space containing x and let ZH = Z ′ ∩ H. It is clear 1 ′ that µ(B(z, r) ∩ H) ≥ 2 µ(B(z, r)) for any z ∈ ZH and any r ≥ 0, so µ(Z ∩ H) ≥ µ(B(z, a)) ′ |Z | ≍k,a µ(Z). 2(k + 1)  We can use a measure-preserving isometry to move such a centrepoint x to the origin o ∈ HkR in the Poincaré ball model, and now show that hypothesis (4) of Theorem 12.3 is satisfied for HkR . 48 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA Lemma 12.8. There exist constants κ, C > 0 so that for any athick subset Z ⊂ HkR , and o ∈ HkR a centrepoint of Z, there exist C-asymptotic shadows of o denoted by H − , H + ⊂ HkR so that we have ρ(∂∞ H − , ∂∞ H + ) ≥ κ and that µ(Z ∩ H − ), µ(Z ∩ H + ) ≥ κµ(Z). Proof. Fix a > 0 and c = c(k, a) > 0 the constants from Lemma 12.7. Let H ⊂ HkR be a hyperplane containing o, and let α > 0. We denote by H α the union of all two-sided geodesics passing through o and with end points in the α-neighbourhood of the boundary ∂∞ H ⊂ ∂∞ HkR = Sk−1 . We start with an argument inspired by the proof of [BST12, Proposition 4.1]. Consider for every r > 0 the sphere Sr = {x ∈ HkR , d(x, o) = r} equipped with its Riemannian measure νr . Note that νr (Sr ∩ H α ) = η(α)νr (Sr ) for some increasing function η satisfying limα→0 η(α) = 0. We now fix α > 0 so that η(α) ≤ 2c . Recall that hyperplanes passing through o are characterized by their normal vector at o, and therefore are parametrized by the projective space P k−1 . We consider the Lebesgue probability measure ν on P k−1. Given θ ∈ P k−1 we define Hθ to be the hyperplane through o with normal vector θ. Recall that Z ⊂ HkR is a measurable subset of finite measure, so for each r Z νr (Sr ∩ H α ) νr (Z ∩ Hθα ∩ Sr )dν(θ) = νr (Z ∩ Sr ) = νr (Z ∩ Sr )η(α). νr (Sr ) P k−1 Integrating over r, we deduce that Z µ(Z ∩ Hθα )dν(θ) = µ(Z)η(α), P k−1 and so for some hyperplane HZ we have µ(Z ∩ HZα ) ≤ µ(Z)η(α) ≤ c µ(Z). 2 Let H − , H + be the two connected components of the complement of α HZ ; these are convex and asymptotic shadows of o, and satisfy µ(H − ∩  Z), µ(H + ∩ Z) ≥ 2c µ(Z). Moreover, ρ(∂∞ H − , ∂∞ H + ) ≥ 2α. 12.2. Hyperbolic groups and centrepoints. In this subsection, we prove Proposition 12.2. Proof of Proposition 12.2. Property (1) follows from a standard argument with the Arzela–Ascoli theorem, see e.g. [BS00]. Property (2) follows from [Coo93, Theorem 7.2], and (∂∞ X, ρ) is Ahlfors Q-regular with Q = 1ǫ h(X). Property (3) is the definition of a visual metric, so it remains only to show that property (4) is satisfied. POINCARÉ PROFILES OF GROUPS AND SPACES 49 We require a probably well-known basic fact about convex hulls of quasi-convex subsets of real hyperbolic spaces. Recall that a subset Y of a geodesic metric space is K-quasi-convex if every geodesic that connect a pair of points of Y lies within the K-neighbourhood of Y . It turns out that in real hyperbolic spaces, quasi-convex subsets are “nearly” convex in a stronger sense: Lemma 12.9. Given K ≥ 0, there exists N = N(K, k) such that for every K-quasi-convex subset Z ⊂ HkR , the convex hull of Z is contained in the N-neighbourhood of Z. Proof. Note that in Klein model of HkR , the hyperbolic convex hull coincides with the Euclidean one. By Carathéodory’s theorem, we deduce that any point of the convex hull of Z is a convex combination of some points z1 , . . . , zm ∈ Z, with m ≤ k + 1. Using the quasiconvexity of Z, the lemma follows by induction on m.  We now show that (4) holds for X. Let X be a δX -hyperbolic Cayley graph of the hyperbolic group G. By a result of Bonk–Schramm [BS00], there exists constants k ∈ N, λψ ≥ 1, Cψ ≥ 0 and a (λψ , Cψ )-quasiisometric embedding ψ : X → HkR . By post-composing ψ with an appropriate element of Isomµ (HkR ) if necessary, we may assume ψ(1) = o, the origin in the Poincaré ball model of HkR . Given a finite subset Y of V X, define Y ′ ⊂ HkR to be the closed 2-neighbourhood of ψ(Y ). By Lemma 12.7, there is a constant c = c(k) > 0 and a point x′ ∈ HkR such that for any half-space H of HkR containing X we have µ(H ∩ Y ′ ) ≥ cµ(Y ′ ). Such x′ is contained in the convex hull of ψ(Y ), so by Lemma 12.9, dHkR (x′ , ψ(x)) ≤ N(k) for some x ∈ X. By applying a left-translation in G (by an element g) we may assume x = 1, while by applying an isometry φ ∈ Isom(HkR ), we may assume x′ = o. Define f = φ ◦ ψ ◦ g −1 : X → HkR and let ∂∞ f be the induced map ∂∞ f : ∂∞ X → Sk−1 , where ∂∞ X is endowed with a visual metric ρ based at 1 and Sk−1 = ∂∞ HkR is endowed with the Euclidean (visual) metric ρEuc . By Lemma 12.8, there exist constants κ, C and C-asymptotic shadows of o denoted H ± so that ρEuc (∂∞ H − , ∂∞ H + ) ≥ 4κ and that µ(Y ′ ∩ H ± ) ≥ 4κµ(Y ′ ). Since f (1) = o, it follows that ρ(∂∞ f −1 [∂∞ H − ]κ , ∂∞ f −1 [∂∞ H + ]κ ) ≥ κ′ for some κ′ > 0 which does not depend on the choices of φ and g used to construct f . (It is not a priori obvious that either of ∂∞ f −1 [∂∞ H ± ]κ is non-empty.) 50 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA ± Define HX to be the set of all points y ∈ X \ B(1, R) contained in the A-neighbourhood of the set of all geodesic rays in X from 1 to a point in ∂∞ f −1 ([∂∞ H ± ]κ ), where A and R are determined below. We claim that there exist A, R so that if y ∈ Y satisfies dX (1, y) ≥ ± R and B(f (y), 2) ∩ H ± 6= ∅, then y ∈ HX . Let z ∈ H ± satisfy dHkR (z, f (y)) ≤ 2, and let γ be the unique geodesic ray in HkR starting at o and containing z (we assume y is sufficiently far from 1 that z 6= o); denote the boundary point of γ by ζ. Since X is CX -visual for some CX , there exists a CX -quasi-geodesic ray β in X from 1 that contains y; denote by η the boundary point of β in ∂∞ X. The Gromov product of ζ and ∂∞ f (η) (relative to o) is bounded from below by dHkR (o, f (y)) up to a uniform additive error, so by insisting that dX (1, y) ≥ R is sufficiently large, we may assume that ρEuc (ζ, ∂∞ f (η)) ≤ κ, hence ∂∞ f (η) ∈ [∂∞ H ± ]κ . By the Morse Lemma, β is contained in a uniform neighbourhood of a geodesic ray from 1 to η, and hence for a ± suitable choice of A will be contained in HX outside B(1, R). For these ± choices of R, A we have that y ∈ HX as desired. From this, and the fact that f is a quasi-isometry with fixed con± stants, it follows that there exist η, η ′ > 0 so that |Y ∩ HX | ≥ ηµ(Y ′ ∩ ± ′ ′ H ) ≥ ηκµ(Y ) ≥ ηκη |Y |. The proof of Proposition 12.2 is complete.  12.3. Upper bounds for the Poincaré profile. Proof of Theorem 12.3. Let x0 ∈ X and a ≥ 2 be fixed so that (4) holds. Let Z be an a-thick subspace of X of sufficiently large finite measure (to be determined later). Apply (4) to move Z; without loss of generality we may assume that ψ = id. Let H ± be the corresponding C-asymptotic shadows of x0 . Define ∂∞ φ : (∂∞ X, ρ) → [0, 1] by ∂∞ φ(z) = min{1, max{0, κ3 ρ(z, ∂∞ H − ) − 1}}; this is a κ3 -Lipschitz function so that ∂∞ φ is zero on [∂∞ H − ]κ/3 and one on [∂∞ H + ]κ/3 . We choose a function φ : X → [0, 1] by setting φ(x) = ∂∞ φ(η) where η ∈ ∂∞ X is the endpoint of some C-quasi-geodesic γx : [0, ∞) → X with γx (0) = x0 and γx (t) = x for some t. Regardless of the choices made in defining this function we have the following control: for any x, y ∈ X with d(x, y) ≤ C ′ there exists K = K(δ, C, C ′, ρ, κ) so that (12.10) |φ(x) − φ(y)| ≤ K exp(−ǫd(x, x0 )). POINCARÉ PROFILES OF GROUPS AND SPACES 51 By a similar argument, there exists L > 0 so that if d(x, x0 ) ≥ L and x ∈ H − then the endpoint η of γx used to define φ(x) satisfies ρ(η, ∂∞ H − ) ≤ κ/3, and so φ(x) = 0. Likewise, if x ∈ H + and d(x, x0 ) ≥ L then φ(x) = 1. By assuming that µ(Z) is greater than κ2 µ(B(x0 , L)), we know—by assumption (4)—that µ(Z ∩ H − \ B(x0 , L)) and µ(Z ∩ H + \ B(x0 , L)) are both ≥ κ2 µ(Z). Switching the roles of H ± if necessary, we assume φZ ≥ 1/2 and so (12.11) ||φ − φZ ||pZ,p ≥ |φZ |p µ(Z ∩ H − \ B(x0 , L)) ≥ 2−p−1κµ(Z). We now bound ||∇a φ||B,p on the ball B = B(x0 , r). Since we have µ(B(x0 , R)) ≍ exp(h(X)R), (12.10) gives Z r p (12.12) ||∇a φ||B,p K,κ,p exp(h(X)t) exp(−pǫt)dt. t=0 We now consider the three cases for p separately. (Recall that h(X) = ǫQ.) Case 1, p > Q: Equation (12.12) gives that ||∇a φ||pX,p is bounded by some constant D only depending on K, κ and p, so (12.11) gives hpa (Z) K,κ,p µ(Z)−1/p for any subspace Z and the case p > Q follows. Case 2, p < Q: The function φ is no longer a p-Dirichlet, but its gradient is well-behaved. Indeed, (12.10) gives |∇a φ|(x)  exp(−ǫd(x, x0 )), so (12.13) k∇a φkpB,p  k exp(−ǫd(·, x0 ))kpZ,p. Now we wish to put an upper bound on ||∇a φ||pZ,p / ||φ − φZ ||pZ,p , which by (12.11) is bounded by ||∇a φ||pZ,p /µ(Z) up to a uniform multiplicative error. Thus by (12.13) it suffices to maximize ||exp(−ǫd(·, x0 ))||pZ,p among all sets Z with the same measure. But, up to a uniform multiplicative error, ||exp(−ǫd(·, x0 ))||pZ,p is maximised when d(·, x0 ) is minimised as a function from Z to R. Clearly this occurs when Z is a metric ball centred at x0 . By (12.12), for Z = B(x0 , r), (12.14) ||∇a φ||pZ,p  exp(h(X)r) · exp(−pǫr) ≍ µ(Z) · µ(Z)−p/Q , thus hpa (Z)  µ(Z)−1/Q and the bound on ΛpX,a (µ(Z)) follows. Case 3, p = Q: If p = Q then the same argument as in Case 2 shows that inequality (12.14) is maximised for a metric ball, so Z r p ||∇a φ||Z,p  exp(h(X)t) exp(−pǫt)dt = r ≍ log(µ(Z)), t=0 52 DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA so hpa (Z)  log(µ(Z))1/p ·µ(Z)−1/p and thus the bound on ΛpX for p = Q follows.  13. Applications to buildings and symmetric spaces We use results from Sections 11 and 12 to calculate Poincaré profiles of buildings and rank-one symmetric spaces (Theorem 12). Bourdon and Pajot [BP99] showed that a family of Fuchsian buildings earlier studied by Bourdon [Bou97] have boundaries that admit 1-Poincaré inequalities. Definition 13.1. Let m ≥ 5, n ≥ 3 be given. Let R be the regular, right-angled hyperbolic polygon with m sides. Let I = Im,n be the Fuchsian building where the chambers are isometric to R, each edge is adjacent to n copies of R, and the vertex links are copies of the complete bipartite graph with n, n vertices. The group Gm,n = hs1 , . . . , sm | sni , [si , si+1 ] ∀ii, where indices are modulo m, acts cellularly and geometrically on Im,n . By [BP99, Theorem 1.1], ∂∞ Gm,n = ∂∞ Im,n carries an Ahlfors Qm,n regular metric, where Qm,n = 1 + log(n − 1)/arccosh((m − 2)/m) ∈ (1, ∞), and which admits a 1-Poincaré inequality in the sense of Heinonen–Koskela (Section 11). The apartments in Im,n are each copies of the hyperbolic plane tiled by right-angled regular m-gons. As such, they have separation at least log(r); the boundary geometry lets us find much larger lower bounds. Theorem 13.2. Given m ≥ 5, n ≥ 3, and p ∈ [1, ∞),  1−1/Qm,n  if p < Qm,n r p 1−1/Q 1/Q m,n m,n ΛIm,n (r) ≃p r log(r) if p = Qm,n  r 1−1/p if p > Qm,n . Proof. The lower bounds follow from Theorem 11.1 for p < Qm,n , Theorem 11.3 for p = Qm,n and Corollary 10.2 for p ≥ Qm,n . The upper bounds follow from Corollary 12.5.  Finally, we calculate the Poincaré profiles of rank-one symmetric spaces. The case of p = 1 for HkR is dealt with by [BST12, Proposition 4.1] and Proposition 6.5, but all other cases are new. Theorem 13.3. Let K ∈ {R, C, H, O} be a real division algebra, and let X = Hm K be a rank-one symmetric space for m ≥ 2 (and m = 2 POINCARÉ PROFILES OF GROUPS AND SPACES 53 when K = O). Let Q = (m + 1) dimR K − 2, then  Q−1  if p < Q  r Q Q−1 1 p ΛHm (r) ≃ r Q log(r) Q if p = Q K   p−1 r p if p > Q Proof. The boundary of a rank-one symmetric space carries a visual metric that is Ahlfors Q-regular for the given exponent, and satisfies a 1-Poincaré inequality. The result then follows from Theorem 11.1, Theorem 11.3, Corollary 10.2, and Theorem 12.3.  References [Bas72] [BL07] [BM91] [Bou97] [Bou12] [BP99] [BP03] [BR13] [Bre14] [BS97] [BS00] [BST12] [Cap14] [Cho80] [Chu97] H. Bass. The degree of polynomial growth of finitely generated nilpotent groups. Proc. London Math. Soc. (3), 25:603–614, 1972. S. V. Buyalo and N. D. Lebedeva. Dimensions of locally and asymptotically self-similar spaces. Algebra i Analiz, 19(1):60–92, 2007. M. Bestvina and G. Mess. The boundary of negatively curved groups. J. Amer. Math. Soc., 4(3):469–481, 1991. M. Bourdon. Immeubles hyperboliques, dimension conforme et rigidité de Mostow. Geom. Funct. Anal., 7(2):245–268, 1997. M. Bourdon. Un théorème de point fixe sur les espaces Lp . Publ. Mat., 56(2):375–392, 2012. M. Bourdon and H. Pajot. Poincaré inequalities and quasiconformal structure on the boundary of some hyperbolic buildings. Proc. Amer. Math. Soc., 127(8):2315–2324, 1999. M. Bourdon and H. Pajot. Cohomologie lp et espaces de Besov. J. Reine Angew. Math., 558:85–108, 2003. O. Baker and T. R. Riley. Cannon-Thurston maps do not always exist. Forum Math. Sigma, 1:e3, 11, 2013. E. Breuillard. Geometry of locally compact groups of polynomial growth and shape of large balls. Groups Geom. Dyn., 8(3):669–732, 2014. I. Benjamini and O. Schramm. Every graph with a positive Cheeger constant contains a tree with a positive Cheeger constant. Geom. Funct. Anal., 7(3):403–419, 1997. M. Bonk and O. Schramm. Embeddings of Gromov hyperbolic spaces. Geom. Funct. Anal., 10(2):266–306, 2000. I. Benjamini, O. Schramm, and Á. Timár. On the separation profile of infinite graphs. Groups Geom. Dyn., 6(4):639–658, 2012. P.-E. Caprace. Automorphism groups of right-angled buildings: simplicity and local splittings. Fund. Math., 224(1):17–51, 2014. C. Chou. Elementary amenable groups. Illinois J. Math., 24(3):396– 407, 1980. F. R. K. Chung. Spectral graph theory, volume 92 of CBMS Regional Conference Series in Mathematics. Published for the Conference Board of the Mathematical Sciences, Washington, DC; by the American Mathematical Society, Providence, RI, 1997. 54 [Coo93] DAVID HUME, JOHN M. MACKAY, AND ROMAIN TESSERA M. Coornaert. Mesures de Patterson-Sullivan sur le bord d’un espace hyperbolique au sens de Gromov. Pacific J. Math., 159(2):241–270, 1993. [Cou00] T. Coulhon. Random walks and geometry on infinite graphs. In Lecture notes on analysis in metric spaces (Trento, 1999), Appunti Corsi Tenuti Docenti Sc., pages 5–36. Scuola Norm. Sup., Pisa, 2000. [DSC93] P. Diaconis and L. Saloff-Coste. Comparison theorems for reversible Markov chains. Ann. Appl. Probab., 3(3):696–730, 1993. [GL15] J. T. Gill and M. Lopez. Discrete approximations of metric measure spaces of controlled geometry. J. Math. Anal. Appl., 431(1):73–98, 2015. [GMT06] S. Goel, R. Montenegro, and P. Tetali. Mixing time bounds via the spectral profile. Electron. J. Probab., 11:no. 1, 1–26, 2006. [Gro81] M. Gromov. Groups of polynomial growth and expanding maps. Inst. Hautes Études Sci. Publ. Math., (53):53–73, 1981. [Gui73] Y. Guivarc’h. Croissance polynomiale et périodes des fonctions harmoniques. Bull. Soc. Math. France, 101:333–379, 1973. [Hag06] F. Haglund. Commensurability and separability of quasiconvex subgroups. Algebr. Geom. Topol., 6:949–1024, 2006. [Hei74] E. Heintze. On homogeneous manifolds of negative curvature. Mathematische Annalen, 211:23–34, 1974. [HK98] J. Heinonen and P. Koskela. Quasiconformal maps in metric spaces with controlled geometry. Acta Math., 181(1):1–61, 1998. [HK00] P. Hajlasz and P. Koskela. Sobolev met Poincaré. Mem. Amer. Math. Soc., 145(688):x+101, 2000. [HP13] J. Higes and I. Peng. Assouad-Nagata dimension of connected Lie groups. Math. Z., 273(1-2):283–302, 2013. [HS97] I. Holopainen and P. M. Soardi. p-harmonic functions on graphs and manifolds. Manuscripta Math., 94(1):95–110, 1997. [Hum17] D. Hume. A continuum of expanders. Fund. Math., 238:143–152, 2017. [HW99] T. Hsu and D. T. Wise. On linear and residual properties of graph products. Michigan Math. J., 46(2):251–259, 1999. [Iva14] S. Ivanov. On Helly’s theorem in geodesic spaces. Electron. Res. Announc. Math. Sci., 21:109–112, 2014. [Jer86] D. Jerison. The Poincaré inequality for vector fields satisfying Hörmander’s condition. Duke Math. J., 53(2):503–523, 1986. [Kle10] B. Kleiner. A new proof of Gromov’s theorem on groups of polynomial growth. J. Amer. Math. Soc., 23(3):815–829, 2010. [Mat97] J. Matoušek. On embedding expanders into lp spaces. Israel J. Math., 102:189–197, 1997. [MT10] J. M. Mackay and J. T. Tyson. Conformal dimension: theory and application, volume 54 of University Lecture Series. American Mathematical Society, Providence, RI, 2010. [MTTV97] G. L. Miller, S.-H. Teng, W. Thurston, and S. A. Vavasis. Separators for sphere-packings and nearest neighbor graphs. J. ACM, 44(1):1–29, 1997. [Pan16] P. Pansu. Large scale conformal maps. Preprint, page arXiv:1604.01195, 2016. POINCARÉ PROFILES OF GROUPS AND SPACES [SC97] [SC02] [Spi15] [Tes07] [Tes08] [Var87] 55 L. Saloff-Coste. Lectures on finite Markov chains. In Lectures on probability theory and statistics (Saint-Flour, 1996), volume 1665 of Lecture Notes in Math., pages 301–413. Springer, Berlin, 1997. L. Saloff-Coste. Aspects of Sobolev-type inequalities, volume 289 of London Mathematical Society Lecture Note Series. Cambridge University Press, Cambridge, 2002. D. Spielman. Spectral Graph Theory. 2015. Available from http://www.cs.yale.edu/homes/spielman/561. R. Tessera. Volume of spheres in doubling metric measured spaces and in groups of polynomial growth. Bull. Soc. Math. France, 135(1):47–64, 2007. R. Tessera. Large scale Sobolev inequalities on metric measure spaces and applications. Rev. Mat. Iberoam., 24(3):825–864, 2008. N. Th. Varopoulos. Fonctions harmoniques sur les groupes de Lie. C. R. Acad. Sci. Paris Sér. I Math., 304(17):519–521, 1987. Mathematical Institute, University of Oxford, Oxford, OX2 6GG. E-mail address: [email protected] School of Mathematics, University of Bristol, Bristol, BS8 1TX. E-mail address: [email protected] Université Paris-Sud, Orsay, France. E-mail address: [email protected]
4math.GR
Attention-Based Models for Speech Recognition Dzmitry Bahdanau Jacobs University Bremen, Germany arXiv:1506.07503v1 [cs.CL] 24 Jun 2015 Jan Chorowski University of Wrocław, Poland [email protected] Dmitriy Serdyuk Université de Montréal Kyunghyun Cho Université de Montréal Yoshua Bengio Université de Montréal CIFAR Senior Fellow Abstract Recurrent sequence generators conditioned on input data through an attention mechanism have recently shown very good performance on a range of tasks including machine translation, handwriting synthesis [1, 2] and image caption generation [3]. We extend the attention-mechanism with features needed for speech recognition. We show that while an adaptation of the model used for machine translation in [2] reaches a competitive 18.7% phoneme error rate (PER) on the TIMIT phoneme recognition task, it can only be applied to utterances which are roughly as long as the ones it was trained on. We offer a qualitative explanation of this failure and propose a novel and generic method of adding location-awareness to the attention mechanism to alleviate this issue. The new method yields a model that is robust to long inputs and achieves 18% PER in single utterances and 20% in 10-times longer (repeated) utterances. Finally, we propose a change to the attention mechanism that prevents it from concentrating too much on single frames, which further reduces PER to 17.6% level. 1 Introduction Recently, attention-based recurrent networks have been successfully applied to a wide variety of tasks, such as handwriting synthesis [1], machine translation [2], image caption generation [3] and visual object classification [4].1 Such models iteratively process their input by selecting relevant content at every step. This basic idea significantly extends the applicability range of end-to-end training methods, for instance, making it possible to construct networks with external memory [6, 7]. We introduce extensions to attention-based recurrent networks that make them applicable to speech recognition. Learning to recognize speech can be viewed as learning to generate a sequence (transcription) given another sequence (speech). From this perspective it is similar to machine translation and handwriting synthesis tasks, for which attention-based methods have been found suitable [2, 1]. However, compared to machine translation, speech recognition principally differs by requesting much longer input sequences (thousands of frames instead of dozens of words), which introduces a challenge of distinguishing similar speech fragments2 in a single utterance. It is also different from handwriting synthesis, since the input sequence is much noisier and does not have as clear structure. For these reasons speech recognition is an interesting testbed for developing new attention-based architectures capable of processing long and noisy inputs. Application of attention-based models to speech recognition is also an important step toward building fully end-to-end trainable speech recognition systems, which is an active area of research. The 1 2 An early version of this work was presented at the NIPS 2014 Deep Learning Workshop [5]. Explained in more detail in Sec. 2.1. 1 dominant approach is still based on hybrid systems consisting of a deep neural acoustic model, a triphone HMM model and an n-gram language model [8, 9]. This requires dictionaries of hand-crafted pronunciation and phoneme lexicons, and a multi-stage training procedure to make the components work together. Excellent results by an HMM-less recognizer have recently been reported, with the system consisting of a CTC-trained neural network and a language model [10]. Still, the language model was added only at the last stage in that work, thus leaving open a question of how much an acoustic model can benefit from being aware of a language model during training. In this paper, we evaluate attention-based models on a phoneme recognition task using the widelyused TIMIT dataset. At each time step in generating an output sequence (phonemes), an attention mechanism selects or weighs the signals produced by a trained feature extraction mechanism at potentially all of the time steps in the input sequence (speech frames). The weighted feature vector then helps to condition the generation of the next element of the output sequence. Since the utterances in this dataset are rather short (mostly under 5 seconds), we measure the ability of the considered models in recognizing much longer utterances which were created by artificially concatenating the existing utterances. We start with a model proposed in [2] for the machine translation task as the baseline. This model seems entirely vulnerable to the issue of similar speech fragments but despite our expectations it was competitive on the original test set, reaching 18.7% phoneme error rate (PER). However, its performance degraded quickly with longer, concatenated utterances. We provide evidence that this model adapted to track the absolute location in the input sequence of the content it is recognizing, a strategy feasible for short utterances from the original test set but inherently unscalable. In order to circumvent this undesired behavior, in this paper, we propose to modify the attention mechanism such that it explicitly takes into account both (a) the location of the focus from the previous step, as in [6] and (b) the features of the input sequence, as in [2]. This is achieved by adding as inputs to the attention mechanism auxiliary convolutional features which are extracted by convolving the attention weights from the previous step with trainable filters. We show that a model with such convolutional features performs significantly better on the considered task (18.0% PER). More importantly, the model with convolutional features robustly recognized utterances many times longer than the ones from the training set, always staying below 20% PER. Therefore, the contribution of this work is three-fold. For one, we present a novel purely neural speech recognition architecture based on an attention mechanism, whose performance is comparable to that of the conventional approaches on the TIMIT dataset. Moreover, we propose a generic method of adding location awareness to the attention mechanism. Finally, we introduce a modification of the attention mechanism to avoid concentrating the attention on a single frame, and thus avoid obtaining less “effective training examples”, bringing the PER down to 17.6%. 2 2.1 Attention-Based Model for Speech Recognition General Framework An attention-based recurrent sequence generator (ARSG) is a recurrent neural network that stochastically generates an output sequence (y1 , . . . , yT ) from an input x. In practice, x is often processed by an encoder which outputs a sequential input representation h = (h1 , . . . , hL ) more suitable for the attention mechanism to work with. In the context of this work, the output y is a sequence of phonemes, and the input x = (x1 , . . . , xL0 ) is a sequence of feature vectors. Each feature vector is extracted from a small overlapping window of audio frames. The encoder is implemented as a deep bidirectional recurrent network (BiRNN), to form a sequential representation h of length L = L0 . At the i-th step an ARSG generates an output yi by focusing on the relevant elements of h: αi = Attend(si−1 , αi−1 , h) gi = L X (1) αi,j hj (2) yi ∼ Generate(si−1 , gi ), (3) j=1 2 yi+1 yi si si-1 si+1 gi × αi-1,j-1 × αi-1,j hj-1 × gi+1 αi αi-1,j+1 × αi,j-1 × αi,j × αi,j+1 hj+1 hj Figure 1: Two steps of the proposed attention-based recurrent sequence generator (ARSG) with a hybrid attention mechanism (computing α), based on both content (h) and location (previous α) information. The dotted lines correspond to Eq. (1), thick solid lines to Eq. (2) and dashed lines to Eqs. (3)–(4). where si−1 is the (i − 1)-th state of the recurrent neural network to which we refer as the generator, αi ∈ RL is a vector of the attention weights, also often called the alignment [2]. Using the terminology from [4], we call gi a glimpse. The step is completed by computing a new generator state: si = Recurrency(si−1 , gi , yi ) (4) Long short-term memory units (LSTM, [11]) and gated recurrent units (GRU, [12]) are typically used as a recurrent activation, to which we refer as a recurrency. The process is graphically illustrated in Fig. 1. Inspired by [6] we distinguish between location-based, content-based and hybrid attention mechanisms. Attend in Eq. (1) describes the most generic, hybrid attention. If the term αi−1 is dropped from Attend arguments, i.e., αi = Attend(si−1 , h), we call it content-based (see, e.g., [2] or [3]). In this case, Attend is often implemented by scoring each element in h separately and normalizing the scores: αi,j ei,j = Score(si−1 , hj ), , L X = exp(ei,j ) exp(ei,j ) . (5) (6) j=1 The main limitation of such scheme is that identical or very similar elements of h are scored equally regardless of their position in the sequence. This is the issue of “similar speech fragments” raised above. Often this issue is partially alleviated by an encoder such as e.g. a BiRNN [2] or a deep convolutional network [3] that encode contextual information into every element of h . However, capacity of h elements is always limited, and thus disambiguation by context is only possible to a limited extent. Alternatively, a location-based attention mechanism computes the alignment from the generator state and the previous alignment only such that αi = Attend(si−1 , αi−1 ). For instance, Graves [1] used the location-based attention mechanism using a Gaussian mixture model in his handwriting synthesis model. In the case of speech recognition, this type of location-based attention mechanism would have to predict the distance between consequent phonemes using si−1 only, which we expect to be hard due to large variance of this quantity. For these limitations associated with both content-based and location-based mechanisms, we argue that a hybrid attention mechanism is a natural candidate for speech recognition. Informally, we would like an attention model that uses the previous alignment αi−1 to select a short list of elements from h, from which the content-based attention, in Eqs. (5)–(6), will select the relevant ones without confusion. 2.2 Proposed Model: ARSG with Convolutional Features We start from the ARSG-based model with the content-based attention mechanism proposed in [2]. This model can be described by Eqs. (5)–(6), where ei,j = w> tanh(W si−1 + V hj + b). w and b are vectors, W and V are matrices. 3 (7) We extend this content-based attention mechanism of the original model to be location-aware by making it take into account the alignment produced at the previous step. First, we extract k vectors fi,j ∈ Rk for every position j of the previous alignment αi−1 by convolving it with a matrix F ∈ Rk×r : fi = F ∗ αi−1 . (8) These additional vectors fi,j are then used by the scoring mechanism ei,j : ei,j = w> tanh(W si−1 + V hj + U fi,j + b) 2.3 (9) Score Normalization: Sharpening and Smoothing There are three potential issues with the normalization in Eq. (6). First, when the input sequence h is long, the glimpse gi is likely to contain noisy information from many irrelevant feature vectors hj , as the normalized scores αi,j are all positive and sum to 1. This makes it difficult for the proposed ARSG to focus clearly on a few relevant frames at each time i. Second, the attention mechanism is required to consider all the L frames each time it decodes a single output yi while decoding the output of length T , leading to a computational complexity of O(LT ). This may easily become prohibitively expensive, when input utterances are long (and issue that is less serious for machine translation, because in that case the input sequence is made of words, not of 20ms acoustic frames). The other side of the coin is that the use of softmax normalization in Eq. (6) prefers to mostly focus on only a single feature vector hj . This prevents the model from aggregating multiple top-scored frames to form a glimpse gi . Sharpening There is a straightforward way to address the first issue of a noisy glimpse by “sharpening” the scores αi,j . One way to sharpen the weights is to introduce an inverse temperature β > 1 to the softmax function such that , L X ai,j = exp(βei,j ) exp(βei,j ) , j=1 or to keep only the top-k frames according to the scores and re-normalize them. These sharpening methods, however, still requires us to compute the score of every frame each time (O(LT )), and they worsen the second issue, of overly narrow focus. We also propose and investigate a windowing technique. At each time i, the attention mechanism considers only a subsequence h̃ = (hpi −w , . . . , hpi +w−1 ) of the whole sequence h, where w  L is the predefined window width and pi is the median of the alignment αi−1 . The scores for hj ∈ / h̃ are not computed, resulting in a lower complexity of O(L + T ). This windowing technique is similar to taking the top-k frames, and similarly, has the effect of sharpening. The proposed sharpening based on windowing can be used both during training and evaluation. Later, in the experiments, we only consider the case where it is used during evaluation. Smoothing We observed that the proposed sharpening methods indeed helped with long utterances. However, all of them, and especially selecting the frame with the highest score, negatively affected the model’s performance on the standard development set which mostly consists of short utterances. This observations let us hypothesize that it is helpful for the model to aggregate selections from multiple top-scored frames. In a sense this brings more diversity, i.e., more effective training examples, to the output part of the model, as more input locations are considered. To facilitate this effect, we replace the unbounded exponential function of the softmax function in Eq. (6) with the bounded logistic sigmoid σ such that , L X ai,j = σ(ei,j ) σ(ei,j ) . j=1 This has the effect of smoothing the focus found by the attention mechanism. 4 Phoneme Error Rate [%] Dependency of error rate on beam search width. Baseline 19 Conv Feats Smooth Focus Dataset 18 ● dev 17 16 ● ● ● ● ● ● ● 1 2 5 10 20 50 100 ● 1 ● 2 test ● ● ● ● ● ● ● ● ● ● ● ● 5 10 20 50 100 1 2 5 10 20 50 100 Beam width Figure 2: Decoding performance w.r.t. the beam size. For rigorous comparison, if decoding failed to generate heosi, we considered it wrongly recognized without retrying with a larger beams size. The models, especially with smooth focus, perform well even with a beam width as small as 1. 3 Related Work Speech recognizers based on the connectionist temporal classification (CTC, [13]) and its extension, RNN Transducer [14], are the closest to the ARSG model considered in this paper. They follow earlier work on end-to-end trainable deep learning over sequences with gradient signals flowing through the alignment process [15]. They have been shown to perform well on the phoneme recognition task [16]. Furthermore, the CTC was recently found to be able to directly transcribe text from speech without any intermediate phonetic representation [17]. The considered ARSG is different from both the CTC and RNN Transducer in two ways. First, whereas the attention mechanism deterministically aligns the input and the output sequences, the CTC and RNN Transducer treat the alignment as a latent random variable over which MAP (maximum a posteriori) inference is performed. This deterministic nature of the ARSG’s alignment mechanism allows beam search procedure to be simpler. Furthermore, we empirically observe that a much smaller beam width can be used with the deterministic mechanism, which allows faster decoding (see Sec. 4.2 and Fig. 2). Second, the alignment mechanism of both the CTC and RNN Transducer is constrained to be “monotonic” to keep marginalization of the alignment tractable. On the other hand, the proposed attention mechanism can result in non-monotonic alignment, which makes it suitable for a larger variety of tasks other than speech recognition. A hybrid attention model using a convolution operation was also proposed in [6] for neural Turing machines (NTM). At each time step, the NTM computes content-based attention weights which are then convolved with a predicted shifting distribution. Unlike the NTM’s approach, the hybrid mechanism proposed here lets learning figure out how the content-based and location-based addressing be combined by a deep, parametric function (see Eq. (9).) Sukhbaatar et al. [18] describes a similar hybrid attention mechanism, where location embeddings are used as input to the attention model. This approach has an important disadvantage that the model cannot work with an input sequence longer than those seen during training. Our approach, on the other hand, works well on sequences many times longer than those seen during training (see Sec. 5.) 4 Experimental Setup We closely followed the procedure in [16]. All experiments were performed on the TIMIT corpus [19]. We used the train-dev-test split from the Kaldi [20] TIMIT s5 recipe. We trained on the standard 462 speaker set with all SA utterances removed and used the 50 speaker dev set for early stopping. We tested on the 24 speaker core test set. All networks were trained on 40 mel-scale filterbank features together with the energy in each frame, and first and second temporal differences, yielding in total 123 features per frame. Each feature was rescaled to have zero mean and unit variance over the training set. Networks were trained on the full 61-phone set extended with an extra “end-of-sequence” token that was appended to each target sequence. Similarly, we appended an all-zero frame at the end of each input sequence to indicate the end of the utterance. Decoding was performed using the 61+1 phoneme set, while scoring was done on the 39 phoneme set. 4.1 Training Procedure One property of ARSG models is that different subsets of parameters are reused different number of times; L times for those of the encoder, LT for the attention weights and T times for all the other 5 FDHC0_SX209: Michael colored the bedroom wall with crayons. h# m ay kcl k kcl k el ah l er dcl d r bcl b eh ix dh dcl m ux w ao th kcl k l w ix r ey aa n s h# Figure 3: Alignments produced by the baseline model. The vertical bars indicate ground truth phone location from TIMIT. Each row of the upper image indicates frames selected by the attention mechanism to emit a phone symbol. The network has clearly learned to produce a left-to-right alignment with a tendency to look slightly ahead, and does not confuse between the repeated “kclk” phrase. Best viewed in color. parameters of the ARSG. This makes the scales of derivatives w.r.t. parameters vary significantly, and we handle it by using an adaptive learning rate algorithm, AdaDelta [21] which has two hyperparameters  and ρ. All the weight matrices were initialized from a normal Gaussian distribution with its standard deviation set to 0.01. Recurrent weights were furthermore orthogonalized. As TIMIT is a relatively small dataset, proper regularization is crucial. We used the adaptive weight noise as a main regularizer [22]. We first trained our models with a column norm constraint [23] with the maximum norm 1 until the lowest development negative log-likelihood is achieved.3 During this time,  and ρ are set to 10−8 and 0.95, respectively. At this point, we began using the adaptive weight noise, and scaled down the model complexity cost LC by a factor of 10, while disabling the column norm constraints. Once the new lowest development log-likelihood was reached, we fine-tuned the model with a smaller  = 10−10 , until we did not observe the improvement in the development phoneme error rate (PER) for 100K weight updates. Batch size 1 was used throughout the training. 4.2 Details of Evaluated Models We evaluated the ARSGs with different attention mechanisms. The encoder was a 3-layer BiRNN with 256 GRU units in each direction, and the activations of the 512 top-layer units were used as the representation h. The generator had a single recurrent layer of 256 GRU units. Generate in Eq. (3) had a hidden layer of 64 maxout units. The initial states of both the encoder and generator were treated as additional parameters. Our baseline model is the one with a purely content-based attention mechanism (See Eqs. (5)–(7).) The scoring network in Eq. (7) had 512 hidden units. The other two models use the convolutional features in Eq. (8) with k = 10 and r = 201. One of them uses the smoothing from Sec. 2.3. Decoding Procedure A left-to-right beam search over phoneme sequences was used during decoding [24]. Beam search was stopped when the “end-of-sequence” token heosi was emitted. We started with a beam width of 10, increasing it up to 40 when the network failed to produce heosi with the narrower beam. As shown in Fig. 2, decoding with a wider beam gives little-to-none benefit. 5 Results All the models achieved competitive PERs (see Table 1). With the convolutional features, we see 3.7% relative improvement over the baseline and further 5.9% with the smoothing. To our surprise (see Sec. 2.1.), the baseline model learned to align properly. An alignment produced by the baseline model on a sequence with repeated phonemes (utterance FDHC0 SX209) is presented in Fig. 3 which demonstrates that the baseline model is not confused by short-range repetitions. We can also see from the figure that it prefers to select frames that are near the beginning or 3 Applying the weight noise from the beginning of training caused severe underfitting. 6 Table 1: Phoneme error rates (PER). The bold-faced PER corresponds to the best error rate with an attention-based recurrent sequence generator (ARSG) incorporating convolutional attention features and a smooth focus. Model Dev Test Baseline Model 15.9% 18.7% 16.1% 18.0% Baseline + Conv. Features Baseline + Conv. Features + Smooth Focus 15.8% 17.6% RNN Transducer [16] N/A 17.7% HMM over Time and Frequency Convolutional Net [25] 13.9% 16.7% Figure 4: Results of force-aligning the concatenated utterances. Each dot represents a single utterance created by either concatenating multiple copies of the same utterance, or of different, randomly chosen utterances. We clearly see that the highest robustness is achieved when the hybrid attention mechanism is combined with the proposed sharpening technique (see the bottom-right plot.) even slightly before the phoneme location provided as a part of the dataset. The alignments produced by the other models were very similar visually. 5.1 Forced Alignment of Long Utterances The good performance of the baseline model led us to the question of how it distinguishes between repetitions of similar phoneme sequences and how reliably it decodes longer sequences with more repetitions. We created two datasets of long utterances; one by repeating each test utterance, and the other by concatenating randomly chosen utterances. In both cases, the waveforms were cross-faded with a 0.05s silence inserted as the “pau” phone. We concatenated up to 15 utterances. First, we checked the forced alignment with these longer utterances by forcing the generator to emit the correct phonemes. Each alignment was considered correct if 90% of the alignment weight lies inside the ground-truth phoneme window extended by 20 frames on each side. Under this definition, all phones but the heosi shown in Fig. 3 are properly aligned. The first column of Fig. 4 shows the number of correctly aligned frames w.r.t. the utterance length (in frames) for some of the considered models. One can see that the baseline model was able to decode sequences up to about 120 phones when a single utterance was repeated, and up to about 150 phones when different utterances were concatenated. Even when it failed, it correctly aligned about 50 phones. On the other hand, the model with the hybrid attention mechanism with convolutional features was able to align sequences up to 200 phones long. However, once it began to fail, the model was not able to align almost all phones. The model with the smoothing behaved similarly to the one with convolutional features only. We examined failed alignments to understand these two different modes of failure. Some of the examples are shown in the Supplementary Materials. We found that the baseline model properly aligns about 40 first phones, then makes a jump to the end of the recording and cycles over the last 10 phones. This behavior suggests that it learned to track its approximate location in the source sequence. However, the tracking capability is limited to the lengths observed during training. Once the tracker saturates, it jumps to the end of the recording. 7 ● Phoneme error rates on long utterances Baseline Phoneme error rate [%] 24 Decoding algorithm Conv Feats Smooth Focus Keep 20 ● ● ● ● 22 ● ● ● ● ● ● ● ● Keep 50 ● Win ± 150 Win ± 75 ● ● ● 20 ● ● ● 18 ● ● ● ● ● ● ● ● ● ● ● ● ● ● 3 6 9 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Dataset ● ● 3 6 9 ● Mixed Utt. 3 6 9 Same Utt. Number of repetitions Figure 5: Phoneme error rates obtained on decoding long sequences. Each network was decoded with alignment sharpening techniques that produced proper forced alignments. The proposed ARSG’s are clearly more robust to the length of the utterances than the baseline one is. In contrast, when the location-aware network failed it just stopped aligning – no particular frames were selected for each phone. We attribute this behavior to the issue of noisy glimpse discussed in Sec. 2.3. With a long utterance there are many irrelevant frames negatively affecting the weight assigned to the correct frames. In line with this conjecture, the location-aware network works slightly better on the repetition of the same utterance, where all frames are somehow relevant, than on the concatenation of different utterances, where each misaligned frame is irrelevant. To gain more insight we applied the alignment sharpening schemes described in Sec. 2.3. In the remaining columns of Fig. 4, we see that the sharpening methods help the location-aware network to find proper alignments, while they show little effect on the baseline network. The windowing technique helps both the baseline and location-aware networks, with the location-aware network properly aligning nearly all sequences. During visual inspection, we noticed that in the middle of very long utterances the baseline model was confused by repetitions of similar content within the window, and that such confusions did not happen in the beginning. This supports our conjecture above. 5.2 Decoding Long Utterances We evaluated the models on long sequences. Each model was decoded using the alignment sharpening techniques that helped to obtain proper forced alignments. The results are presented in Fig. 5. The baseline model fails to decode long utterances, even when a narrow window is used to constrain the alignments it produces. The two other location-aware networks are able to decode utterances formed by concatenating up to 11 test utterances. Better results were obtained with a wider window, presumably because it resembles more the training conditions when at each step the attention mechanism was seeing the whole input sequence. With the wide window, both of the networks scored about 20% PER on the long utterances, indicating that the proposed location-aware attention mechanism can scale to sequences much longer than those in the training set with only minor modifications required at the decoding stage. 6 Conclusions We proposed and evaluated a novel end-to-end trainable speech recognition architecture based on a hybrid attention mechanism which combines both content and location information in order to select the next position in the input sequence for decoding. One desirable property of the proposed model is that it can recognize utterances much longer than the ones it was trained on. In the future, we expect this model to be used to directly recognize text from speech [10, 17], in which case it may become important to incorporate a monolingual language model to the ARSG architecture [26]. This work has contributed two novel ideas for attention mechanisms: a better normalization approach yielding smoother alignments and a generic principle for extracting and using features from the previous alignments. Both of these can potentially be applied beyond speech recognition. For instance, the proposed attention can be used without modification in neural Turing machines, or by using 2–D convolution instead of 1–D, for improving image caption generation [3]. 8 Acknowledgments All experiments were conducted using Theano [27, 28], PyLearn2 [29], and Blocks [30] libraries. The authors would like to acknowledge the support of the following agencies for research funding and computing support: National Science Center (Poland), NSERC, Calcul Québec, Compute Canada, the Canada Research Chairs and CIFAR. Bahdanau also thanks Planet Intelligent Systems GmbH and Yandex. References [1] Alex Graves. Generating sequences with recurrent neural networks. arXiv:1308.0850, August 2013. [2] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv:1409.0473, September 2014. [3] Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhutdinov, Richard Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. arXiv:1502.03044, February 2015. [4] Volodymyr Mnih, Nicolas Heess, Alex Graves, et al. Recurrent models of visual attention. In Advances in Neural Information Processing Systems, pages 2204–2212, 2014. [5] Jan Chorowski, Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. End-to-end continuous speech recognition using attention-based recurrent NN: First results. arXiv:1412.1602 [cs, stat], December 2014. [6] Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv:1410.5401, 2014. [7] Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv:1410.3916, 2014. [8] Mark Gales and Steve Young. The application of hidden markov models in speech recognition. Found. Trends Signal Process., 1(3):195–304, January 2007. [9] G. Hinton, Li Deng, Dong Yu, G.E. Dahl, A Mohamed, N. Jaitly, A Senior, V. Vanhoucke, P. Nguyen, T.N. Sainath, and B. Kingsbury. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6):82–97, November 2012. [10] Awni Hannun, Carl Case, Jared Casper, Bryan Catanzaro, Greg Diamos, Erich Elsen, Ryan Prenger, Sanjeev Satheesh, Shubho Sengupta, Adam Coates, et al. Deepspeech: Scaling up end-to-end speech recognition. arXiv preprint arXiv:1412.5567, 2014. [11] S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural. Comput., 9(8):1735–1780, 1997. [12] Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. In EMNLP 2014, October 2014. to appear. [13] Alex Graves, Santiago Fernández, Faustino Gomez, and Jürgen Schmidhuber. Connectionist temporal classification: Labelling unsegmented sequence data with recurrent neural networks. In ICML-06, 2006. [14] Alex Graves. Sequence transduction with recurrent neural networks. In ICML-12, 2012. [15] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient based learning applied to document recognition. Proc. IEEE, 1998. [16] Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In ICASSP 2013, pages 6645–6649. IEEE, 2013. [17] Alex Graves and Navdeep Jaitly. Towards end-to-end speech recognition with recurrent neural networks. In ICML-14, pages 1764–1772, 2014. [18] Sainbayar Sukhbaatar, Arthur Szlam, Jason Weston, and Rob Fergus. Weakly supervised memory networks. arXiv preprint arXiv:1503.08895, 2015. [19] J. S. Garofolo, L. F. Lamel, W. M. Fisher, J. G. Fiscus, D. S. Pallett, and N. L. Dahlgren. DARPA TIMIT acoustic phonetic continuous speech corpus, 1993. [20] Daniel Povey, Arnab Ghoshal, Gilles Boulianne, Lukas Burget, Ondrej Glembek, Nagendra Goel, Mirko Hannemann, Petr Motlicek, Yanmin Qian, Petr Schwarz, and others. The kaldi speech recognition toolkit. In Proc. ASRU, pages 1–4, 2011. [21] Matthew D Zeiler. ADADELTA: An adaptive learning rate method. arXiv:1212.5701, 2012. [22] Alex Graves. Practical variational inference for neural networks. In J. Shawe-Taylor, R.S. Zemel, P.L. Bartlett, F. Pereira, and K.Q. Weinberger, editors, Advances in Neural Information Processing Systems 24, pages 2348–2356. Curran Associates, Inc., 2011. 9 [23] Geoffrey E Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012. [24] Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. arXiv preprint arXiv:1409.3215, 2014. [25] László Tóth. Combining time-and frequency-domain convolution in convolutional neural network-based phone recognition. In ICASSP 2014, pages 190–194, 2014. [26] Caglar Gulcehre, Orhan Firat, Kelvin Xu, Kyunghyun Cho, Loic Barrault, Huei-Chi Lin, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. On using monolingual corpora in neural machine translation. arXiv preprint arXiv:1503.03535, 2015. [27] James Bergstra, Olivier Breuleux, Frédéric Bastien, Pascal Lamblin, Razvan Pascanu, Guillaume Desjardins, Joseph Turian, David Warde-Farley, and Yoshua Bengio. Theano: a CPU and GPU math expression compiler. In Proceedings of the Python for Scientific Computing Conference (SciPy), June 2010. Oral Presentation. [28] Frédéric Bastien, Pascal Lamblin, Razvan Pascanu, James Bergstra, Ian J. Goodfellow, Arnaud Bergeron, Nicolas Bouchard, and Yoshua Bengio. Theano: new features and speed improvements. Deep Learning and Unsupervised Feature Learning NIPS 2012 Workshop, 2012. [29] Ian J. Goodfellow, David Warde-Farley, Pascal Lamblin, Vincent Dumoulin, Mehdi Mirza, Razvan Pascanu, James Bergstra, Frédéric Bastien, and Yoshua Bengio. Pylearn2: a machine learning research library. arXiv preprint arXiv:1308.4214, 2013. [30] Bart van Merriënboer, Dzmitry Bahdanau, Vincent Dumoulin, Dmitriy Serdyuk, David Warde-Farley, Jan Chorowski, and Yoshua Bengio. Blocks and fuel: Frameworks for deep learning. arXiv:1506.00619 [cs, stat], June 2015. 10 A Additional Figures Baseline FDHC0_SX209: Michael colored the bedroom wall with crayons. h# m ay kcl k kcl k el ah l er dcl d r bcl b eh dcl dhix ux m w ao th kcl k l w ix aa n h# ey s r aa n h# ey s r aa n h# ey s r Convolutional Features FDHC0_SX209: Michael colored the bedroom wall with crayons. h# m ay kcl k kcl k el ah l er dcl d r bcl b eh dcl dhix ux m w ao th kcl k l w ix Smooth Focus FDHC0_SX209: Michael colored the bedroom wall with crayons. h# m ay kcl k kcl k el ah l er dcl d r bcl b eh dcl dhix ux m w ao th kcl k l w ix Figure 6: Alignments produced by evaluated models on the FDHC0 SX209 test utterance. The vertical bars indicate ground truth phone location from TIMIT. Each row of the upper image indicates frames selected by the attention mechanism to emit a phone symbol. Compare with Figure 3. in the main text. 11 Baseline FAEM0_SI2022: What outfit does she drive for? h# dx w ah aw q f ix tcl d uh sh d iy dcl v f h# ay ao r v f h# ay ao r v f h# ay ao r Convolutional Features FAEM0_SI2022: What outfit does she drive for? h# dx w ah aw q f ix tcl d uh sh d iy dcl Smooth Focus FAEM0_SI2022: What outfit does she drive for? h# dx w ah aw q f ix tcl d uh sh d iy dcl Figure 7: Alignments produced by evaluated models on the FAEM0 SI2022 train utterance. The vertical bars indicate ground truth phone location from TIMIT. Each row of the upper image indicates frames selected by the attention mechanism to emit a phone symbol. Compare with Figure 3. in the main text. 12 Number of incorrectly aligned phones vs utterance length and model. Same Utt. Mixed Utt. 300 Baseline 200 100 0 400 300 Conv Feats Number of correctly aligned phones 400 200 100 0 0 200 400 600 0 200 400 600 Utterance length [phones] Figure 8: Close-up on the two failure modes of ARSG. Results of force-aligning concatenated TIMIT utterances. Each dot represents a single utterance. The left panels show results for concatenations of the same utterance. The right panels show results for concatenations of randomly chosen utterances. We compare the baseline network having a content-based only attention mechanism (top row) with a hybrid attention mechanism that uses convolutional features (bottom row). While neither model is able to properly align long sequences, they fail in different ways: the baseline network always aligns about 50 phones, while the location-aware network fails to align any phone. Compare with Figure 4 form the main paper. 13 14 Figure 9: The baseline network fails to align more than 3 repetitions of FDHC0 SX209. 15 Figure 10: The baseline network aligns a concatenation of 3 different utterances, but fails to align 5. 16 Figure 11: Forced alignment of 7 repetitions of the phrase “Michael colored” performed with the baseline model with windowing enabled (the alignment was constrained to ±75 frames from the expected position of the generator at the last step. The window is wider than the pattern and the net confuses similar content. Strangely, the first two repetitions are aligned without any confusion with subsequent ones – the network starts to confound phoneme location only starting from the third repetition (as seen by the parallel strand of alignment which starts when the network starts to emit the phrase for the third time). 17 Figure 12: The location-aware network correctly aligns 7 and 11 repetitions of FDHC0 SX209, butfails to align 15 repetitions of FDHC0 SX209. 18 Figure 13: The location-aware network aligns a concatenation of 3 different utterances, but fails to align 5. B Detailed results of experiments Table 2: Phoneme error rates while decoding with various modifications. Compare with Figure 5 from the main paper. Plain Keep 1 Keep 10 Keep 50 β = 2 Win. ±75 Win. ±150 dev 15.9% 17.6% 15.9% 15.9% 16.1% 15.9% 15.9% Baseline test 18.7% 20.2% 18.7% 18.7% 18.9% 18.7% 18.6% dev 16.1% 19.4% 16.2% 16.1% 16.7% 16.0% 16.1% Conv Feats 18.0% 18.7% 18.0% 18.0% test 18.0% 22.3% 17.9% dev 15.8% 21.6% 16.5% 16.1% 16.2% 16.2% 16.0% Smooth Focus test 17.6% 24.7% 18.7% 17.8% 18.4% 17.7% 17.6% 19
9cs.NE
Model Predictive Path Integral Control using Covariance Variable Importance Sampling arXiv:1509.01149v3 [cs.SY] 28 Oct 2015 Grady Williams1 , Andrew Aldrich1 , and Evangelos A. Theodorou1 Abstract— In this paper we develop a Model Predictive Path Integral (MPPI) control algorithm based on a generalized importance sampling scheme and perform parallel optimization via sampling using a Graphics Processing Unit (GPU). The proposed generalized importance sampling scheme allows for changes in the drift and diffusion terms of stochastic diffusion processes and plays a significant role in the performance of the model predictive control algorithm. We compare the proposed algorithm in simulation with a model predictive control version of differential dynamic programming. I. INTRODUCTION The path integral optimal control framework [7], [15], [16] provides a mathematically sound methodology for developing optimal control algorithms based on stochastic sampling of trajectories. The key idea in this framework is that the value function for the optimal control problem is transformed using the Feynman-Kac lemma [2], [8] into an expectation over all possible trajectories, which is known as a path integral. This transformation allows stochastic optimal control problems to be solved with a Monte-Carlo approximation using forward sampling of stochastic diffusion processes. There have been a variety of algorithms developed in the path integral control setting. The most straight-forward application of path integral control is when the iterative feedback control law suggested in [15] is implemented in its open loop formulation. This requires that sampling takes place only from the initial state of the optimal control problem. A more effective approach is to use the path integral control framework to find the parameters of a feedback control policy. This can be done by sampling in policy parameter space, these methods are known as Policy Improvement with Path Integrals [14]. Another approach to finding the parameters of a policy is to attempt to directly sample from the optimal distribution defined by the value function [3]. Other methods along similar threads of research include [10], [17]. Another way that the path integral control framework can be applied is in a model predictive control setting. In this setting an open-loop control sequence is constantly optimized in the background while the machine is simultaneously executing the “best guess” that the controller has. An issue with this approach is that many trajectories must be sampled in real-time, which is difficult when the system has complex dynamics. One way around this problem is to This research has been supported by NSF Grant No. NRI-1426945. The 1 authors are with the Autonomous Control and Decision Systems Laboratory at the Georgia Institute of Technology, Atlanta, GA, USA. Email: [email protected] drastically simplify the system under consideration by using a hierarchical scheme [4], and use path integral control to generate trajectories for a point mass which is then followed by a low level controller. Even though this approach may be successfull for certain applications, it is limited in the kinds of behaviors that it can generate since it does not consider the full non-linearity of dynamics. A more efficient approach is to take advantage of the parallel nature of sampling and use a graphics processing unit (GPU) [19] to sample thousands of trajectories from the nonlinear dynamics. A major issue in the path integral control framework is that the expectation is taken with respect to the uncontrolled dynamics of the system. This is problematic since the probability of sampling a low cost trajectory using the uncontrolled dynamics is typically very low. This problem becomes more drastic when the underlying dynamics are nonlinear and sampled trajectories can become trapped in undesirable parts of the state space. It has previously been demonstrated how to change the mean of the sampling distribution using Girsanov’s theorem [15], [16], this can then be used to develop an iterative algorithm. However, the variance of the sampling distribution has always remained unchanged. Although in some simple simulated scenarios changing the variance is not necessary, in many cases the natural variance of a system will be too low to produce useful deviations from the current trajectory. Previous methods have either dealt with this problem by artificially adding noise into the system and then optimizing the noisy system [10], [14]. Or they have simply ignored the problem entirely and sampled from whatever distribution worked best [12], [19]. Although these approaches can be successful, both are problematic in that the optimization either takes place with respect to the wrong system or the resulting algorithm ignores the theoretical basis of path integral control. The approach we take here generalizes these approaches in that it enables for both the mean and variance of the sampling distribution to be changed by the control designer, without violating the underlying assumptions made in the path integral derivation. This enables the algorithm to converge fast enough that it can be applied in a model predictive control setting. After deriving the model predictive path integral control (MPPI) algorithm, we compare it with an existing model predictive control formulation based on differential dynamic programming (DDP) [6], [13], [18]. DDP is one of the most powerful techniques for trajectory optimization, it relies on a first or second order approximation of the dynamics and a quadratic approximation of the cost along a nominal trajectory, it then computes a second order approximation of the value function which it uses to generate the control. this transformation we apply an exponential transformation of the value function II. PATH INTEGRAL CONTROL In this section we review the path integral optimal control framework [7]. Let xt ∈ RN denote the state of a dynamical system at time t, u(xt , t) ∈ Rm denotes a control input for the system, τ : [t0 , T ] → Rn represents a trajectory of the system, and dw ∈ Rp is a brownian disturbance. In the path integral control framework we suppose that the dynamics take the form: dx = f (xt , t)dt + G(xt , t)u(xt , t)dt + B(xt , t)dw (1) In other words, the dynamics are affine in control and subject to an affine brownian disturbance. We also assume that G and B are partitioned as:     0 0 G(xt , t) = ; B(xt , t) = (2) Gc (xt , t) Bc (xt , t) Expectations taken with respect to (1) are denoted as EQ [·], we will also be interested in taking expectations with respect to the uncontrolled dynamics of the system (i.e (1) with u ≡ 0). These will be denoted EP [·]. We suppose that the cost function for the optimal control problem has a quadratic control cost and an arbitrary state-dependent cost. Let φ(xT ) denote a final the terminal cost, q(xt , t) a state dependent running cost, and define R(xt , t) as a positive definite matrix. The value function V (xt , t) for this optimal control problem is then defined as: "  # Z T 1 T min EQ φ(xT ) + q(xt , t) + u R(xt , t)u dt u 2 t (3) The Stochastic Hamilton-Jacobi-Bellman equation [1], [11] for the type of system in (1) and for the cost function in (3) is given as: −∂t V = q(xt , t) + f (xt , t)T Vx 1 − VxT G(xt , t)R(xt , t)−1 G(xt , t)T Vx 2 1 + tr(B(xt , t)B(xt , t)T Vxx ) 2 (4) where the optimal control is expressed as: u∗ = −R(xt , t)−1 G(xt , t)T Vx (5) The solution to this backwards PDE yields the value function for the stochastic optimal control problem, which is then used to generate the optimal control. Unfortunately, classical methods for solving partial differential equations of this nature suffer from the curse of dimensionality and are intractable for systems with more than a few state variables. The approach we take in the path integral control framework is to transform the backwards PDE into a path integral, which is an expectation over all possible trajectories of the system. This expectation can then be approximated by forward sampling of the stochastic dynamics. In order to effect V (x, t) = −λ log(Ψ(x, t)) (6) Here λ is a positive constant. We also have to assume a relationship between the cost and noise in the system (as well as λ) through the equation: Bc (xt , t)Bc (x, t)T = λGc (xt , t)R(xt , t)−1 Gc (xt , t)T (7) The main restriction implied by this assumption is that B(xt , t) has the same rank as R(xt , t). This limits the noise in the system to only effect state variables that are directly actuated (i.e. the noise is control dependent). There are a wide variety of systems which naturally fall into this description, so the assumption is not too restrictive. However, there are interesting systems for which this description does not hold (i.e. if there are known strong disturbances on indirectly actuated state variables or if the dynamics are only partially known). By making this assumption and performing the exponential transformation of the value function the stochastic HJB equation is transformed into the linear partial differential equation: 1 Ψ(xt , t) q(xt , t) − f (xt , t)T Ψx − tr(Σ(xt , t)Ψxx ) λ 2 (8) Here we’ve denoted the covariance matrix ∂t Ψ = Bc (xt , t)Bc (xt , t)T as Σ(xt , t). This equation is known as the backward Chapman-Kolmogorov PDE. We can then apply the Feynman-Kac lemma, which relates backward PDEs of this type to path integrals through the equation: " ! # Z 1 T Ψ(xt0 , t0 ) = EP exp − q(x, t) dt Ψ(xT , T ) λ t0 (9) Note that the expectation (which is the path integral) is taken with respect to P which is the uncontrolled dynamics of the system. By recognizing that the term Ψ(xT ) is the 1 transformed terminal cost: e− λ φ(xT ) we can re-write this expression as:    1 (10) Ψ(xt0 , t0 ) ≈ EP exp − S(τ ) λ RT where S(τ ) = φ(xT ) + t0 q(xt , t)dt is the cost-to-go of the state dependent cost of a trajectory. Lastly we have to compute the gradient of Ψ with respect to the initial state xt0 . This can be done analytically and is a straightforward, albeit lengthy, computation so we omit it and refer the interested reader to [14]. After taking the gradient we obtain:    1 S(τ ) B(xt0 , t0 )dw ∗ −1 EP exp − λ   u dt = G(xt0 , t0 ) EP exp − λ1 S(τ ) (11) Where the matrix G(xt , t) is defined as: −1 R(xt , t)−1 Gc (xt , t)T Gc (xt , t)R(xt , t)−1 Gc (xt , t)T (12) Note that if Gc (xt , t) is square (which is the case if the system is not over actuated) this reduces to Gc (xt , t)−1 . Equation (11) is the path integral form of the optimal control. The fundamental difference between this form of the optimal control and classical optimal control theory is that instead of relying on a backwards in time process, this formula requires the evaluation of an expectation which can be approximated using forward sampling of stochastic differential equations. A. Discrete Approximation Equation (11) provides an expression for the optimal control in terms of a path integral. However, these equations are for continuous time and in order to sample trajectories on a computer we need discrete time approximations. We first discretize the dynamics of the system. We have that xt+1 = xt + dxt where dxt is defined as: √ dxt = (f (xt , t) + G(xt , t)u(xt , t)) ∆t + B(xt , t) ∆t (13) The term  is a vector of standard normal Gaussian random variables. For the uncontrolled dynamics of the system we have: √ dxt = f (xt , t)∆t + B(xt , t) ∆t (14) Another way we can express B(xt , t)dw which will be useful is as: B(xt , t)dw ≈ dxt − f (xt , t)∆t (15) PN Lastly we say: S(τ ) ≈ φ(xT )+ i=0 q(xt , t)∆t where N = (T − t)/∆t Then by defining p as the probability induced by the discrete time uncontrolled dynamics we can approximate (11) as: i h   dxt0 − f (x , t ) Ep exp − λ1 S(τ ) t 0 0 ∆t   u∗ = G(xt0 , t0 )−1 1 Ep exp − λ S(τ ) (16) Note that we have moved the ∆t term multiplying u over to the right-hand side of the equation and inserted it into the expectation. III. GENERALIZED IMPORTANCE SAMPLING Equation (16) provides an implementable method for approximating the optimal control via random sampling of trajectories. By drawing many samples from p the expectation can be evaluated using a Monte-Carlo approximation. In practice, this approach is unlikely to succeed. The problem is that p is typically an inefficient distribution to sample from (i.e the cost-to-go will be high for most trajectores sampled from p). Intuitively sampling from the uncontrolled dynamics corresponds to turning a machine on and waiting for the natural noise in the system dynamics to produce interesting behavior. In order to efficiently approximate the controls, we require the ability to sample from a distribution which is likely to produce low cost trajectories. In previous applications of path integral control [15], [16] the mean of the sampling distribution has been changed which allows for an iterative update law. However, the variance of the sampling distribution has always remained unchanged. In well engineered systems, where the natural variance of the system is very low, changing the mean is insufficient since the state space is never aggressively explored. In the following derivation we provide a method for changing both the initial control input and the variance of the sampling distribution. A. Likelihood Ratio We suppose that we have a sampling distribution with nonzero control input and a changed variance, which we denote as q, and we would like to approximate (16) using samples from q as opposed to p. Now if we write the expectation term (16) in integral form we get:    dxt R 0 − f (x , t) p(τ )dτ exp − λ1 S(τ ) t ∆t  R (17) exp − λ1 S(τ ) p(τ )dτ Where we are abusing notation and using τ to represent the discrete trajectory (xt0 , xt1 , . . . xtN ). Next we multiply both q(τ ) integrals by 1 = q(τ ) to get:    dxt R q(τ ) 0 exp − λ1 S(τ ) − f (x , t) t ∆t q(τ ) p(τ )dτ (18)  q(τ ) R exp − λ1 S(τ ) q(τ ) p(τ )dτ And we can then write this as an expectation with respect to q:  h i   dxt0 p(τ ) Eq exp − λ1 S(τ ) ∆t − f (xt , t) q(τ ) h (19)  )i Eq exp − λ1 S(τ ) p(τ q(τ ) We now have the expectation in terms of a sampling distribution q for which we can choose: i) The initial control sequence from which to sample around. ii) The variance of the exploration noise which determines how aggressively the state space is explored. p(τ ) However, we now have an extra term to compute q(τ ) . This is known as the likelihood ratio (or Radon-Nikodym derivative) between the distributions p and q. In order to derive an expression for this term we first have to derive equations for the probability density functions of p(τ ) and q(τ ) individually. We can do this by deriving the probability density function for the general discrete time diffusion processes P (τ ), corresponding to the dynamics: √ dxt = (f (xt , t) + G(xt , t)u(xt , t)) ∆t + B(xt , t) ∆t (20) The goal is to find P (τ ) = P (xt0 , xt1 , . . . xtN ). By conditioning and using the Markov property of the state space this probability becomes: P (xt0 , xt1 , . . . xtN ) = N Y i=1 P (xti |xti−1 ) (21) Now recall that a portion of the state space has deterministic dynamics and that we’ve partitioned the diffusion matrix as:   0 B(xt , t) = (22) Bc (xt , t) We can partition the state variables x into the deterministic (a) (c) and non-deterministic variables xt and xt respectively. (a) (a) (a) The next step is to conditionon xt+1 = F (xt , t) = xt + (a) (a) f (xt , t) + G (xt , t)ut dt since if this does not hold P (τ ) is zero. We thus need to compute: N Y i=1   (a) P xti |xti−1 , xti = F (a) (xti−1 , ti−1 (23) And from the dynamics equations we know that each of these one-step transitions is Gaussian with mean: f (c) (xt , t) + G(c) (xti , ti )u(xti , ti ) and variance: Σi = Bc (xti , ti )Bc (xti , ti )T ∆t. (24) Then under the condition that each Ati is invertible and each Γi is invertible, the likelihood ratio for the two distributions is: ! ! N N Y ∆t X |Ati | exp − Qi (31) 2 i=1 i=1 Proof: In discrete time the probability of a trajectory is formulated according to the (26). We thus have p(τ ) equal to:   PN z Σ z exp − ∆t i i i i=1 2 (32) p(τ ) = Zp (τ ) and q(τ ) equal to:   PN −1 T T exp − ∆t (z −µ ) A Σ A (z −µ ) ( ) i i i ti i i t i=1 2 i Zq (τ ) (33) Then dividing these two equations we have (c) dxt i ∆t (c) − f (xti , ti ), and µi = We then define zi = G(c) (xti , ti )u(xti , ti ). Applying the definition of the Gaussian distribution with these terms yields:   N exp − ∆t (z − µ )T Σ−1 (z − µ ) Y i i i i i 2 (25) P (τ ) = (2π)n/2 |Σi |1/2 i=1 And then using basic rules of exponents this probability becomes: ! N ∆t X T −1 −1 Z(τ ) exp − (zi − µi ) Σi (zi − µi ) (26) 2 i=1 QN n/2 Where Z(τ ) = |Σi |1/2 . With this equation i=1 (2π) in hand we’re now ready to compute the likelihood ratio between two diffusion processes. Theorem 1: Let p(τ ) be the probability density function for trajectories under the uncontrolled discrete time dynamics: √ dxt = f (xt , t)∆t + B(xt , t) ∆t (27) And let q(τ ) be the probability density function for trajectories under the controlled dynamics with an adjusted variance: dxt = (f (xt , t) + G(xt , t)u(xt , t)) ∆t+ √ BE (xt , t) ∆t (28) Where the adjusted variance has the form:   0 BE (xt , t) = At Bc (xt , t) Qi = T −1 µT i Σi µi (29) Where Γi is: Γ−1 i = Σ−1 i − −1 AT t i Σi A t i i i=1 (2π)n/2 |Σi |1/2 ) ! as: N ∆t X ζi exp − 2 i=1 ! (30) (34) Where ζi is:   −1 −1 T ζ i = zT AT (zi − µi ) (35) i Σi zi − (zi − µi ) t i Σi A t i Using basic rules of determinants it is easy to see that the term outside the exponent reduces to N N 1/2 Y Y (2π)n/2 |AT ) j Σ j Aj | |Aj | = (2π)n/2 |Σj |1/2 ) j=1 j=1 (36) So we need only show that ζi reduces to Qi . Observe that at every timestep we have the difference between two quadratic functions of zi , so we can complete the square to combine this into a single quadratic function. If we recall the definition of Γi from above, and define Λi = AT ti Σi Ati then completing the square yields: ζi = zi + Γi Λ−1 i µi T  Γ−1 zi + Γi Λ−1 i i µi T −1  (37) −1 −1 T −1 − µi Λi µi − Γi Λi µi Γi Γt Λi µi Now we expand out the first quadratic term to get: −1 −1 T −1 T −1 ζ i = zT i Γi zi + 2µi Λi zi + µi Λi Γi Λi µi −1 −1 −1 T −1 − µT i Λi µi − (Γi Λi µi ) Γi (Γi Λi µi ) And define zi , µi , and Σi as before. Let Qi be defined as: (zi − µi ) Γ−1 i (zi − µi ) T −1 + 2 (µi ) Σi (zi − µi ) + N 1/2 Y (2π)n/2 |AT ) t Σi A t i | p(τ ) q(τ ) (38) Notice that the two underlined terms are the same, except for the sign, so they cancel out and we’re left with: −1 T −1 T −1 ζ i = zT i Γi zi + 2µi Λi zi − µi Λi µi (39) Now define z̃i = zi − µi , and then re-write this equation in terms of z˜i : T −1 T −1 ζi = (z̃i + µi )T Γ−1 i (z̃i + µi ) + 2µi Λi (z̃i + µi ) − µi Λi µi (40) Then by re-defining the running cost q(xt , t) as: which expands out to: −1 T −1 T −1 ζi = z̃T i Γi z̃i + 2µi Γi z̃i + µi Γi µi −1 T −1 T −1 + 2µT i Λi z̃i + 2µi Λi µi − µi Λi µi (41) Which then simplifies to: −1 T −1 T −1 ζi = z̃T i Γi z̃i + 2µi Γi z̃i + µi Γi µi −1 T −1 + 2µT i Λi z̃i + µi Λi µi (42) −1 −1 Now recall that Γi = (Σ−1 , so we can split the i − Λi ) −1 quadratic terms in Γi into the Σ−1 and Λ−1 components. i i Doing this yields: −1 T −1 T −1 T −1 ζi = z̃T i Γi z̃i + 2µi Σi z̃i − 2µi Λi z̃i + µi Σi µi −1 T −1 T −1 − µT i Λi µi + 2µi Λi z̃i + µi Λi µi (43) and by noting that the underlined terms cancel out we see that we’re left with: ζi = −1 z̃T i Γi z̃i + −1 2µT i Σi z̃i + −1 µT i Σi µi (44) which is the same as: 1 T (z − µ) Γ̃−1 (z − µ) 2 (48) 1 T −1 T −1 + µ H (z − µ) + µ H µ 2 PN and S̃(τ ) = φ(xT ) + j=1 q̃(x, u, dx), we have: h   i t − f (x , t) Eq exp − λ1 S̃(τ ) dx t ∆t h  i u∗t = G(xt , t)−1 1 Eq exp − λ S̃(τ ) (49) Also note that dxt is now equal to: √ (f (xt , t) + G(xt , t)u(xt , t)) ∆t + B(xt , t) ∆t (50) q̃(x, u, dx) = q(xt , t) + So we can re-write dxt ∆t − f (xt , t) as:  G(xt , t)u(xt , t) + B(xt , t) √ ∆t (51) And then since G(xt , t) does not depend on the expectation we can pull it out and get the iterative update law: T T −1 T −1 (zi − µi ) Γ−1 i (zi − µi ) + 2µi Σi (zi − µi ) + µi Σi µi (45) And so ζi = Qi which completes the proof. The key difference between this proof and earlier path integral works which use an application of Girsanov’s theorem to sample from a non-zero control input is that this theorem allows for a change in the variance as well. In the expression for the likelihood ratio derived here −1 T −1 the last two terms (2µT i Σi (zi − µi ) + µi Σi µi ) are exactly the terms from Girsanov’s theorem. The first term T ((zi − µi ) Γ−1 i (zi − µi )), which can be interpreted as penalizing over-aggressive exploration, is the only additional term. B. Likelihood Ratio as Additional Running Cost The form of the likelihood ratio just derived is easily incorporated into the path integral control framework by folding it into the cost-to-go as an extra running cost. Note that the likelihood ratio appears in both the numerator and denominator of (16). Therefore, any terms which do not depend on the state can be factored out of the expectation and canceled. This QNremoves the numerically troublesome normalizing term j=1 |Atj |. So only the summation of Qi remains. Recall that Σ = λG(xt , t)R(xt , t)−1 G(xt , t). This implies that:  −1 Γ = λ G(xt , t)R(xt , t)−1 G(xt , t) (46)  −1 − AT G(xt , t)R(xt , t)−1 G(xt , t)T A Now define H = G(xt , t)R(xt , t)−1 G(xt , t)T and Γ̃ = λ1 Γ. We then have:  1 T Q= (z−µ) Γ̃−1 (z−µ)+2µT H−1 (z−µ)+µT H−1 µ λ (47) u∗t = G(xt , t)−1 G(xt , t)u(xt , t)  i h  Eq exp − λ1 S̃(τ ) B(xt , t) √∆t i h  + G(xt , t)−1 Eq exp − λ1 S̃(τ ) (52) C. Special Case The update law (52) is applicable for a very general class of systems. In this section we examine a special case which we use for all of our experiments. We consider dynamics of the form:   1 √ dxt = f (xt , t)∆t + G(xt , t) u(xt , t)∆t + √  ∆t ρ √(53) And for the sampling distribution we set A equal to νI. We also assume that Gc (xt , t) is a square invertible matrix. This reduces H(xt , t) to Gc (xt , t)−1 . Next the dynamics can be re-written as:   1  dxt = f (xt , t)∆t + G(xt , t) u(xt , t) + √ √ ∆t ρ ∆t (54) Then we can interpret √1ρ √∆t as a random change in the control input, to emphasize this we will denote this term as δu = √1ρ √∆t . We then have B(xt , t) √∆t = G(xt , t)δu. This yields the iterative update law as: h   i Eq exp − λ1 S̃(τ ) δu h  i u(xt , t)∗ = u(xt , t) + (55) Eq exp − λ1 S̃(τ ) which can be approximated as: PK u(xti , ti )∗ ≈ u(xti , ti ) +   1 exp − S̃(τ ) δui,k i,k k=1 λ   PK 1 exp − S̃(τ ) i,k k=1 λ (56) i) z − µ = G(xt , t)δu ii) Γ̃−1 = (1 − ν −1 )G(xt , t)−1 R(xt , t)G(xt , t) iii) H−1 = G(xt , t)−1 R(xt , t)G(xt , t)−1 Given these simplifications q̃ reduces to: (1 − ν −1 ) T δu Rδu 2 1 + uT Rδu + uT Ru 2 q̃(x, u, dx) = q(xt , t) + (57) This means that the introduction of the likelihood ratio simply introduces the original control cost from the optimal control formulation into the sampling cost, which originally only included state-dependent terms. IV. MODEL PREDICTIVE CONTROL ALGORITHM We apply the iterative path integral control update law, with the generalized importance sampling term, in a model predictive control setting. In this setting optimization and execution occur simultaneously: the trajectory is optimized and then a single control is executed, then the trajectory is re-optimized using the un-executed portion of the previous trajectory to warm-start the optimization. This scheme has two key requirements: i) Rapid convergence to a good control input. ii) The ability to sample a large number of trajectories in real-time. The first requirement is essential because the algorithm does not have the luxury of waiting until the trajectory has converged before executing. The new importance sampling term enables tuning of the exploration variance which allows for rapid convergence, this is demonstrated in Fig. 1. The second requirement, sampling a large number of trajectories in real-time, is satisfied by implementing the random sampling of trajectories on a GPU. The algorithm is given in Algorithm 1, in the parallel GPU implementation the sampling for loop (for k to K-1) is run completely in parallel. V. EXPERIMENTS We tested the model predictive path integral control algorithm (MPPI) on three simulated platforms (1) A cart-pole, (2) A miniature race car, and (3) A quadrotor attempting to navigate an obstacle filled environment. For the race car and quadrotor we used a model predictive control version of the differential dynamic programming (DDP) algorithm as a baseline comparision. In all of these experiments the controller operates at 50 Hz, this means that the open loop control sequence is re-optimized every 20 milliseconds. Algorithm 1: Model Predictive Path Integral Control Given: K: Number of samples; N : Number of timesteps; (u0 , u1 , ...uN −1 ): Initial control sequence; ∆t, xt0 , f , G, B, ν: System/sampling dynamics; φ, q, R, λ: Cost parameters; uinit : Value to initialize new controls to; while task not completed do for k ← 0 to K − 1 do x = xt0 ; for i ← 1 to N − 1 do xi+1 = xi + (f + G (ui + δui,k )) ∆t; S̃(τi+1,k ) = S̃(τi,k ) + q̃; for i ← 0 to N− 1 do  1 PK exp(− λ S̃( τi,k ))δui,k PK ui ← ui + ; 1 k=1 k=1 exp(− λ S̃( τi,k )) send to actuators(u0 ); for i ← 0 to N − 2 do ui = ui+1 ; uN −1 = uinit Update the current state after receiving feedback; check for task completion; A. Cart-Pole For the cart-pole swing-up task we used the state cost: q(x) = p2 + 500(1 + cos(θ))2 + θ̇2 + ṗ2 , where p is the position of cart, ṗ is the velocity and θ, θ̇ are the angle and angular velocity of the pole. The control input is desired velocity, which maps to velocity through the equation: p̈ = 10(u − ṗ). The disturbance parameter √1ρ was set equal .01 and the control cost was R = 1. We ran the MPPI controller for 10 seconds with a 1 second optimization horizon. The controller has to swing-up the pole and keep it balanced for the rest of the 10 second horizon. The exploration variance ν ν ν ν 300 Average Running Cost Where K is the number of random samples (termed rollouts) and S(τi,k ) is the cost-to-go of the kth rollout from time ti onward. This expression is simply a reward-weighted average of random variations in the control input. Next we investigate what the likelihood ratio addition to the running cost is. For these dynamics we have the following simplifications: 250 = 75 = 500 = 1000 = 1500 200 150 100 50 0 1.0 1.5 2.0 2.5 3.0 3.5 Number of Rollouts (Log Scale) 4.0 Fig. 1. Average running cost for the cart-pole swing-up task as a function of the exploration variance ν and the number of rollouts. Using only the natural system variance the MPC algorithm does not converge in this scenario. 10 B. Race Car In the race car task the goal was to minimize the objective function: q(x) = 100d2 + (vx − 7.0)2 . Where d is defined 2 x 2 + y6 − 1|, and vx is the forward (in as: d = | 13 body frame) velocity of the car. This cost ensures that the car to stays on an elliptical track while maintaining a forward speed of 7 meters/sec. We use a non-linear dynamics model [5] which takes into account the (highly non-linear) interactions between tires and the ground. The exploration variance was set to a constant ν times the natural variance of the system. The MPPI controller is able to enter turns at 10 MPC-DDP 5 0 −5 −5 −10 −15 −10 0 5 10 15 −10 −15 −10 −5 0 5 10 15 Fig. 3. Comparison of DDP (left) and MPPI (right) performing a cornering maneuver along an ellipsoid track. MPPI is able to make a much tigther turn while carrying more speed in and out of the corner than DDP. The direction of travel is counterclockwise. 9 DDP |vx | 8 MPPI |vx | DDP |vy | MPPI |vy | 7 6 5 4 3 2 1 30 Average Running Cost −5 MPPI 5 0 Velocity (m/s) parameter, ν, was varied between 1 and 1500. The MPPI controller is able to swing-up the pole faster with increasing exploration variance. Fig. 1 illustrates the performance of the MPPI controller as the exploration variance and the number of rollouts are changed. Using only the natural variance of the system for exploration is insufficient in this task, in that case (not shown in the figure) the controller is never able to swing-up the pole which results in a cost around 2000. DDP Solution ν = 50 ν = 100 ν = 150 ν = 300 25 0 0 10 20 Time (s) 30 40 50 Fig. 4. Comparison of DDP (left) and MPPI (right) performing a cornering maneuver along an ellipsoid track. MPPI is able to make a much tigther turn while carrying more speed in and out of the corner than DDP. 20 15 MPPI and DDP which guide the quadrotor through the forest as quickly as possible. The cost function for MPPI was 10 100 5 1.0 MPC-DDP 1.5 2.0 2.5 3.0 3.5 Number of Rollouts (Log Scale) 4.0 Fig. 2. Performance comparison in terms of average cost between MPPI and MPC-DDP as the exploration variance ν changes from 50 to 300 and the number of rollouts changes from 10 to 1000. Only with a very large increase in the exploration variance is MPPI able to outperform MPC-DDP. Note that the cost is capped at 25.0 60 close to the desired speed of 7 m/s and then slide through the turn. The DDP solution does not attempt to slide and significantly reduces its forward velocity before entering the turn, this results in a higher average cost compared to the MPPI controller. Fig. 2 shows the cost comparison between MPPI and MPC-DDP, and Figures 3 and 4 show samples of the trajectories taken by the two algorithms as well as the velocity profiles. 0 C. Quadrotor The quadrotor task was to fly through a field filled with cylindrical obstacles as fast as possible. We used the quadrotor dynamics model from [9]. This is a non-linear model which includes position, velocity, euler angles, angular acceleration, and the rotor dynamics. We randomly generated three forests, one where obstacles are on average 3 meters apart, the second one 4 meters apart, and the third 5 meters apart. We then separately created cost functions for both MPPI 80 40 20 0 20 40 60 80 100 0 20 40 60 80 100 Fig. 5. Left: sample DDP trajectory through 4m obstacle field, Right: Sample MPPI trajectory through the same field. Since the MPPI controller can directly reason about the shape of the obstacles it is able to safely pass through the field taking a much more direct route. 2 des 2 of the form: q(x) = 2.5(px − pdes x ) + 2.5(py − py ) + d 2 2 2 150(pz − pdes z ) + 50ψ + kvk +350 exp(− 12 ) + 1000C where (px , py , pz ) denotes the position of the vehicle. ψ denotes the yaw angle in radians, v is velocity, and d is the distance to the closest obstacle. C is a variable which indicates whether the vehicle has crashed into the ground or an obstacle. Additionally if C = 1 (which indicates a crash), the rollout stops simulating the dynamics and the vehicle remains where it is for the rest of the time horizon. We found that the crash indicator term is not useful for the MPC-DDP based controller, this is not surprising since the discontinuity it creates is difficult to approximate with a quadratic function. The term in the cost for avoiding obstacles in the MPCDDP P controller consists purely of a large exponential term: N 2000 i=1 exp(− 21 d2i ), note that this sum is over all the obstacles in the proximity of the vehicle whereas the MPPI controller only has to consider the closest obstacle. 18 MPPI MPC-DDP Time to Completion (s) 17 16 15 14 13 12 11 10 3m 4m Density Setting of Forest 5m ii) The use of a GPU to sample thousands of trajectories in real-time. The derivation of the likelihood ratio enables the designer of the algorithm to tune the exploration variance in the path integral control framework, whereas previous methods have only allowed for the mean of the distribution to be changed. Tuning the exploration variance is critical in achieving a high level of performance since the natural variance of the system is typically too low to achieve good performance. The experiments considered in this work only consider changing the variance by a constant multiple times the natural variance of the system. In this special case the introduction of the likelihood ratio corresponds to adding in a control cost when evaluating the cost-to-go of a trajectory. A direction for future research is to investigate how to automatically adjust the variance online. Doing so could enable the algorithm to switch from aggressively exploring the state space when performing aggressive maneuvers to exploring more conservatively for performing very precise maneuvers. R EFERENCES Fig. 6. Time to navigate forest. Comparison between MMPI and DDP. Since the MPPI controller can explicitly reason about crashing (as opposed to just staying away from obstacles), it is able to travel both faster and closer to obstacles than the MPC-DDP controller. Fig. 7 shows the difference in time between the two algorithms and Fig. 6 the trajectories taken by MPC-DDP and one of the MPPI runs on the forest with obstacles placed on average 4 meters away. Fig. 7. Simulated forest environment used in the quadrotor navigation task. VI. CONCLUSION In this paper we have developed a model predictive path integral control algorithm which is able to outperform a state-of-the-art DDP method on two difficult control tasks. The algorithm is based on stochastic sampling of system trajectories and requires no derivatives of either the dynamics or costs of the system. This enables the algorithm to naturally take into account non-linear dynamics, such as a non-linear tire model [5]. It is also able to handle cost functions which are intuitively appealing, such as an impulse cost for hitting an obstacle, but are difficult for traditional approaches that rely on a smooth gradient signal to perform optimization. The two keys to achieving this level of performance with a sampling based method are: i) The derivation of the generalized likelihood ratio between discrete time diffusion processes. [1] W. H. Fleming and H. M. Soner. Controlled Markov processes and viscosity solutions. Applications of mathematics. Springer, New York, 2nd edition, 2006. [2] A. Friedman. Stochastic Differential Equations And Applications. Academic Press, 1975. [3] Vicenç Gómez, Hilbert J Kappen, Jan Peters, and Gerhard Neumann. Policy search for path integral control. In Machine Learning and Knowledge Discovery in Databases, pages 482–497. Springer, 2014. [4] Vicenç Gómez, Sep Thijssen, Hilbert J Kappen, Stephen Hailes, and Andrew Symington. Real-time stochastic optimal control for multiagent quadrotor swarms. arXiv preprint arXiv:1502.04548, 2015. [5] R.Y Hindiyeh. Dynamics and Control of Drifting in Automobiles. PhD thesis, Stanford University, March 2013. [6] D. H. Jacobson and D. Q. Mayne. Differential dynamic programming. American Elsevier Pub. Co., New York, 1970. [7] H. J. Kappen. Linear theory for control of nonlinear stochastic systems. Phys Rev Lett, 95:200201, 2005. Journal Article United States. [8] I. Karatzas and S. E. Shreve. Brownian Motion and Stochastic Calculus (Graduate Texts in Mathematics). Springer, 2nd edition, August 1991. [9] Nathan Michael, Daniel Mellinger, Quentin Lindsey, and Vijay Kumar. The grasp multiple micro-uav testbed. Robotics & Automation Magazine, IEEE, 17(3):56–65, 2010. [10] E. Rombokas, M. Malhotra, E.A. Theodorou, E. Todorov, and Y. Matsuoka. Reinforcement learning and synergistic control of the act hand. IEEE/ASME Transactions on Mechatronics, 18(2):569–577, 2013. [11] R. F. Stengel. Optimal control and estimation. Dover books on advanced mathematics. Dover Publications, New York, 1994. [12] F. Stulp, J. Buchli, E. Theodorou, and S. Schaal. Reinforcement learning of full-body humanoid motor skills. In Proceedings of 10th IEEERAS International Conference on Humanoid Robots (Humanoids), pages 405–410, Dec 2010. [13] E. Theodorou, Y. Tassa, and E. Todorov. Stochastic differential dynamic programming. In American Control Conference, 2010, pages 1125–1132, 2010. [14] E. A. Theodorou, J. Buchli, and S. Schaal. A generalized path integral approach to reinforcement learning. Journal of Machine Learning Research, (11):3137–3181, 2010. [15] E.A. Theodorou and E. Todorov. Relative entropy and free energy dualities: Connections to path integral and kl control. In the Proceedings of IEEE Conference on Decision and Control, pages 1466–1473, Dec 2012. [16] Evangelos A. Theodorou. Nonlinear stochastic control and information theoretic dualities: Connections, interdependencies and thermodynamic interpretations. Entropy, 17(5):3352–3375, 2015. [17] Sep Thijssen and HJ Kappen. Path integral control and state-dependent feedback. Physical Review E, 91(3):032104, 2015. [18] E. Todorov and W. Li. A generalized iterative lqg method for locallyoptimal feedback control of constrained nonlinear stochastic systems. pages 300–306, 2005. [19] G. Williams, E. Rombokas, and T. Daniel. Gpu based path integral control with learned dynamics. In Neural Information Processing Systems - ALR Workshop, 2014.
3cs.SY
1 Fault Tolerance in Distributed Neural Computing arXiv:1509.09199v1 [cs.NE] 30 Sep 2015 Anton Kulakov, Mark Zwoliński, and Jeff Reeve Abstract—With the increasing complexity of computing systems, complete hardware reliability can no longer be guaranteed. We need, however, to ensure overall system reliability. One of the most important features of artificial neural networks is their intrinsic fault-tolerance. The aim of this work is to investigate whether such networks have features that can be applied to wider computational systems. This paper presents an analysis, in both the learning and operational phases, of a distributed feedforward neural network with decentralised event-driven time management, which is insensitive to intermittent faults caused by unreliable communication or faulty hardware components. The learning rules used in the model are local in space and time, which allows efficient scalable distributed implementation. We investigate the overhead caused by injected faults and analyse the sensitivity to limited failures in the computational hardware in different areas of the network. Index Terms—Fault-tolerance, graceful degradation, redundancy, neural networks. I. I NTRODUCTION The inevitable demand for ever more computational capability drives the creation of ever larger parallel distributed machines (e.g. the K computer has 705,024 cores [1] ), so that although the mean time to failure (MTTF) for the individual components can be very high (up to 106 hours [2]), the large number of components will inevitably lead to frequent failures – on average once every one and a half hours. Failures can also be caused by the fact that in large multi-processor systems the arrival of communication messages is not guaranteed or they can arrive late [3]. This requires new solutions for fault tolerance to allow the next generation of extreme-scale massively parallel computers to be used at their full-capacity. In recent years, it has been suggested that neural computing offers a model of fault-tolerant computing. In biological brains, neurons die without apparent loss of functionality of the whole system and by analogy, this principle has been applied to neural simulation engines (SpiNNaker [4], BlueBrain [5]). For instance, SpiNNaker will employ 50,000 chips (with 20 slow – 200 MHz – processors per chip) connected over a fast network (1 Gbps) and is based on a model of communication-centric computation, in contrast to conventional, calculation-centric computers with very fast processors (2 GHz) over not-so-fast networks. In order to maintain high communication speed and avoid deadlocks, a packet-dropping mechanism is used when a packet cannot be forwarded [6]. Artificial neural networks have been inspired by studies of the brain structure, where information is processed in a parallel and distributed way. Commonly used conventional sequential computing systems utilize one or a few sparselyinterconnected, high performance processing units. Neural Mark Zwolinski is with Electronics and Computer Science, University of Southampton, Southampton, SO17 IBJ, UK e-mail: [email protected] networks, in contrast, employ a large number of highly interconnected, very simple processing elements, where the computational power of the model comes above all from the interaction of all its units. The motivation for this work is to determine whether neural computing can be used as a paradigm for reliable systems running on unreliable hardware. We examine the fault-tolerant characteristics of parallel distributed processing networks with a feed-forward structure, in order to understand how the required fault tolerance can be achieved on systems with unreliable communications. The work investigates neural network performance under damage conditions and dynamics of weight change in a representative task. This paper is structured as follows. We first review related work in the field and outline several techniques to assure the fault tolerant behavior of neural networks. Then we define the key terms and concepts for general and comparable results as well as discussing the network structure and training techniques used in the experiments. Next we relate these findings to an analysis of the network’s structure. The implications of the findings for fault tolerance and its improvement are then discussed, before concluding. II. R ELATED W ORK A. Fault tolerance in neural networks Due to the multiplicity of individual units, neural networks contain more processing elements than is necessary to solve a problem. Moore [7] argued that because of the large number of components, neural computers would need to be designed with high quality components. In contrast, Mozer’s work [8] has shown that units may be simply removed from a network without damaging its performance. The loss of a few units would be unlikely to cause any noticeable decrease in accuracy of the overall performance in a large system. Tai in [9] showed that losses of up to 40% can be tolerated in the Hopfield model. This leads to the conclusion that due to the inherent overall fault tolerance, non-critical components within the neural network system need not be particularly reliable, as has been proposed by Belfore and Johnson [10]. Based on this conclusion, Chiu et al [11] proposed an algorithm to improve both the efficiency and fault-tolerance of a multilayer network. In their approach a unique measure of neuron relevance is used, according to which the least significant neurons are eliminated, whereas the most significant ones are duplicated. Carter and Segee [12] empirically showed that multilayer networks do not significantly reduce the level of tolerance after pruning. However, they also pointed out that this is not always the case. Despite inherent fault tolerance being provided by the distributed processing architecture, neural networks are not 2 always tolerant of the loss of processing elements [13]. Their conclusion is that often, instead of catastrophic failure under the influence of faults or noise affecting inputs and internal components, it is most likely that network performance will degrade gracefully. Furthermore, Segee et al showed in [14] that fault tolerance is influenced by the training algorithm used and even the initial state of the network. The implication is that if the number of network processing elements can be made large, then fault tolerance increases in the network automatically by virtue of the gross similarity with biological neural networks. The idea is that fault tolerance in a neural network is directly related to the redundancy introduced because of “spare capacity”, when the complexity of the problem is less than the computational capacity of the network. Nijhuis et al. [15] came to a similar conclusion, stating that fault tolerant behavior is not always self-evident but must be assured by an appropriate training scheme. Furthermore, [16] presents a procedure to build fault tolerant neural networks by replicating the hidden units. An analytical derivation of the minimum redundancy required in order to tolerate all possible single faults is presented in [17]. On the other hand, von Seelen and Mallot [18] discuss whether indeed a neural network’s reliability is caused by redundancy, both in terms of fault tolerance and graceful degradation. They assume that a neural network uses all of its resources to balance between computational accuracy and computation time. Thus redundancy is not identical to reserve capacity and neural networks utilize available resources to the full. Taking these sometimes contradictory findings into account, we have examined the fault tolerance of neural networks in both the training and operational phases, so as to be able to evaluate the system reliability when such networks are implemented on massively parallel hardware. Moreover, the published literature considers failures in the computational units; we are just as concerned with failures in the communication links. B. Concepts of Reliability The field of reliable and fault-tolerant computation is very wide, embracing many different architectural and operational features of neural network systems as well as several conceptual viewpoints. However, in the literature an inconsistent and often inaccurate use of key terms and concepts can be found, which can cause confusion and uncertainty. A categorization of the causes of failures affecting neural network reliability must be developed in order to omit non-precise terms and obtain general and comparable results. This section addresses the problem and defines key terms and concepts, used further in the paper. First of all, to describe the reaction of the network performance to faults, the terms graceful degradation and faulttolerance are often used. Unlike conventional computers, a neural system is often not adversely affected by faults or noise in internal components. Instead of failing catastrophically, the system continues delivering acceptable, although possibly reduced performance. Computational accuracy is allowed to degrade in a controlled manner as the fault severity increases. Such a low sensitivity to occurring faults instead of a complete failure is known as graceful degradation [19]. In contrast to graceful degradation, fault tolerance is the property that guarantees the proper operation of the system in the event of a failure (or several failures) within some of its components. It describes the robustness of the network function in the presence of degradation in the computational elements, such as broken connections or erroneously functioning processing elements. A common misunderstanding is that of confusing fault tolerance with robustness to noisy inputs. Fault tolerance is the ability of a system to continue to perform to specification in the presence of hardware faults, such as broken connections, connections with an erroneous weight, or neurons with inaccurate outputs. On the other hand, a system that continues coping with input noise and operates correctly despite errors in its inputs is termed a robust system. However, it is fault-tolerance, rather than robustness, that is associated with sensitivity to internal noise. Nijhuis in [15] refers to fault tolerance as hardware fault-tolerance and correspondingly to robust systems as data fault-tolerant systems. In this paper, we focus exclusively on hardware fault-tolerance, which describes a system’s sensitivity to faults that result in perturbations in network parameters or topology, but does not refer to noisy or partial input data. In fact, we believe that the sensitivity of a system to noisy inputs is both inappropriate and inconsistent for defining a fault-tolerant system. Another area of potential confusion is the stage at which errors start occurring. Carter in [13] distinguishes between two types of fault-tolerance in neural networks: an operational and a learning fault-tolerance. The sensitivity of network performance to permanent or transient faults occurring at the learning stage, is referred to as learning fault-tolerance. Whereas the operational fault-tolerance deals with the sensitivity of network performance to faults presented after learning has been accomplished in a fault-free environment. In this paper we pay primary attention to learning fault-tolerance. III. FAULT S IMULATION Neural networks are often treated as black-box systems. Measuring the degree of failure is based on the results at the output units for presented input data. We investigate what level of fault-tolerance the neural network can achieve given the faults that might occur during both learning and operation phases. In the case of a fault occurring during the learning phase, we consider how much longer it will take to train the network and how fault-tolerant the final version of the network will be. To address all of these issues, artificial faults can be introduced into the system. This section discusses the possible ways of introducing faults. A. Fault-tolerance Analysis In order to achieve a suitable analytical model of the reliability of a neural network system, a definition of various failure modes and their impacts on the system is required. This would lead to a firm foundation for further investigations of the 3 amount of fault tolerance exhibited by a neural network. However, taking into account the high level of inter-dependence of elements in the system on each other, this task is extremely complicated. Due to the difficulty in defining the effect of an individual unit or connection on the overall reliability of an entire system, we use empirical investigation. We consider a type of fault that is admittedly severe and correspond to the highest failure rates. It is often referred as “loss of weight” fault and occur in the case of open-circuits, [13]. Some authors refer to this fault as “stuck-at-0”, e.g. [19]. A classical example of an open-circuit fault can be imagined as a damaged neuron or connection, which can be related in biological terms to the continual loss of synapses in the brain. In simulation it is implemented by setting the selected weight to zero. B. Fault Injection Technique During each simulation, faults are probabilistically introduced and the degree of failure is evaluated according to some measure. The measure of reliability from many experiments can be plotted against the number of introduced faults injected into the system. The plot indicates the way the neural network model behaves depending upon the generic nature and the faults occurrence rate. Different plots can be compared and contrasted in order to judge the system’s sensitivity to different types and locations of faults. This facilitates evaluation of fault-tolerance when the type of fault and the rate of occurrence are known. The fault injection technique is convenient for indicating the isolated effects of individual faults. However it is impractical for evaluating the impact of multiple faults as their effects combine and are not independent. It is not realistic simply to add the impacts of single faults in order to imitate the effect of multiple faults due to non-predictable correlations between them. This complicates accurate prediction of the effect of all faults occurring together over a period of time in real use. Also another scenario is possible: that a system maintains an adequate performance despite a limited injection of faults. However, after a certain fault threshold is reached, the system may abruptly reduce its performance, which can lead to a total failure. Another complication is caused by the temporary nature of many faults, often called “transient” and “intermittent” faults. Transient faults are non-recurring and intermittent faults recur at, usually irregular, intervals. These faults are caused by several contributing factors, some of which may be effectively random, which occur simultaneously. The more complex the system or mechanism involved, the greater the likelihood of an intermittent fault. An estimation of the impact of temporal faults is unreliable and thus is out of the scope of this investigation. In conclusion, a fault injection method is useful for gaining a very basic indication of the reliability of a neural network system, though it may identify especially critical areas of a neural network which can then be protected against possible faults in any implementation. IV. E XPERIMENTAL A PPROACH In terms of fault tolerance, some neural networks and some training algorithms are better than others. If nothing is done to control the proper operation of the system in the event of a fault during training, the fault tolerance of the final network may be very random, depending on the problem, the chosen architecture, the data representation, and the learning examples. In this section we discuss the network structure, training technique and teaching procedure used in the experiment. A. Network Structure and Connectivity Training physically distributed neural networks with no shared memories and decentralized event-driven time management has always been a challenging issue. On one side, the absence of shared memory excludes data contentions. But at the same time there is no conscious control over the spike generation, emitting, storing, and processing. Each processor sequentially performs event processing in accordance with the temporal order of these events. Nothing ensures that events are processed in a correct order. Of all the existing neural network topologies, the feedforward neural network is probably the one most often used. This network topology consists of three or more layers: an input layer, an output layer and a number of hidden layers in between. Each layer contains a number of neurons, which are connected only with the neurons of the adjacent layers. Activity flows from input to output and the network topology contains neither cycles nor lateral connections. The input layer is present merely to increase the fan-out of the input data, whereas the hidden and output layers perform computations, as shown in Fig. 1. Commonly, the input data is represented in a binary form, corresponding either to the presence or absence of features. The actual process is based on the collective computations that are performed in the synapses and the neurons. At each synapse the incoming signal is multiplied by the corresponding connection strength, wij . At the neuron, these values are summed and compared to the threshold value: if the summed result exceeds the threshold value, a neuron emits a consecutive spike, otherwise it remains inactive. For nearly all problems, one hidden layer is sufficient. Using two hidden layers rarely improves the model, and may introduce a greater risk of convergence to a local minimum and there is no theoretical reason for using more than two hidden layers [20], [21]. Two hidden layers are, in principle, enough to perform any classification task [22], including highlevel abstractions (e.g. in vision, language, and other AI-level tasks) [23]. Here, the number of hidden layers is limited to one. In our approach, a special processor is dedicated to interacting with the environment and at the same time managing the work of other processors (e.g. network mapping, setting the synchronization barrier). The master processor only ‘knows’ which processors are dedicated to representation of the input and output neurons. A slave does not ‘know’ whether it contains input, hidden or output neurons. Each slave processor 4 Fig. 1. The architecture of a feed-forward neural network with n-input, m-hidden layer and l-output node. is idle until it receives a spike message (from another slave or the master processor). When the spike message is received, and the excitation conditions are met, a new spike messages are sent to the all known targets, determined a priori while creating the network. B. Network Training The dynamics of a neural network are determined by a rule, derived by Bosman et al [24]. This is a form of reinforcement learning, where the active weights are either incremented or decremented by a certain weight proportion based on the binary feedback signal in accordance with Hebbian learning. The signal represents the ‘success’ or ‘failure’ of a given output after each attempt to associate the correct output with a particular input. The important benefit of the model is the locality of all the necessary information about the states and the properties of the involved neurons for calculating weight alterations. This allows simulation of distributed neural networks with decentralized, asynchronous time management. A network usually has two different operating modes: training and operation. Identical faults are likely to have different effects during these two distinct phases. During the training stage, weights between the neurons are adapted in order to learn to reproduce a set of patterns, which represents the problem. The actual training stage of the neural network consists of many so-called training cycles. During each training cycle the network attempts to alter its weights in such a way that the output neurons produce an expected pattern. The network is said to function when all training pairs of patterns are correctly ‘memorized’. The number of training cycles depends on various factors such as (a) the complexity of the decision regions that is caused by the data itself; (b) the network topology, that is to say the number of layers and the number of neurons per layer; (c) the learning strategy, which consists of the choice of parameters in the training algorithm and the order of presentation of training patterns during learning; and (d) the rate of forgetting due to interference of the new learned data with that previously learned. In the case where the excitation conditions were met first time for the current input pattern, spike messages are sent to the post-synaptic neurons. At the same time another message containing the value of the membrane potential is sent to the pre-synaptic neuron from which the last spike message arrived, indicating that pre-synaptic neuron’s spiking activity led to the excitation of the post-synaptic neuron. The presynaptic neurons store this information in the activated array. If the excitation condition is not met for the first time for the current input pattern, the neuron informs the pre-synaptic neurons about the alteration of its value of membrane potential. In the case that it receives an inhibitory signal and is not active any more, the neuron sends another message to its postsynaptic neurons to warp back the neurons’s influence onto them, changing their state correspondingly. Finally, when the output neurons produce the expected output pattern, the master sends a message, which either reinforces the weights, if the received output corresponds to that expected, or reduces (‘deinforces’) the weights otherwise. Two arrays (activated and activatedBy ) contain all the necessary information for applying the learning rule described in [24]. When the weights are altered, a new cycle starts. Faults occurring during the learning stage help the network’s resilience to possible damage in the operation stage because of the more evenly distributed information between its weights [25]. This prevents the situation of random information distribution among the weights, when some connections are very influential on the network output (and thus also very sensitive to perturbations), whereas others are almost useless. C. Forgetting All natural cognitive systems gradually forgets previously learned information as new information is acquired. A similar effect is observed in artificial neural networks. While storing a large amount of input patterns into the network, interference of newly learned data with previously learned data occurs. It turns out that in the distributed computational nature of neural networks, the very virtue of the approach is at the same time the root cause of forgetting. The negative effect of the path interference arises when several input patterns are applied to the neural network to be memorized. The active paths overlap when the strongest connection from the different input patterns point to the same intermediary neurons. As a result, the learning of something new causes forgetting of old data. The challenge is how to keep the advantages of distributed computation while avoiding the problem of catastrophic forgetting. For this it is necessary to examine the basis of the phenomenon. There may be several reasons for such a situation. First of all, from the active input neuron the path of activity runs along the strongest synaptic connections to the corresponding output neurons. In certain situations an established path can be completely “wiped out” by an attempt to learn new data, so that the connection of the previously learned pattern is 5 m Errorl (W) = 1 X l (dk − ykl )2 . m (1) k=1 Then, the global error is defined as: v u p u1 X Errorl (W )). Error(W) = t p (2) l=1 So that when the actual output y l is equal to desired output d , the global error equals to zero. l V. S IMULATION R ESULTS The distributed neural network simulator was written in the C++ language using the Message Passing Interface library (MPI) for inter-processor communication. The simulated neural network consisted of an input layer, one hidden layer and an output layer. Decentralized event-driven time management without memory sharing was applied. Fig. 2. An example of path interference between A-C-D and B-C-E paths. Path A-C-D was formed at learning step tk and became the strongest one with weight efficacy wmax , at learning step tl affects the formation of B-C-E path with weight efficacy walt . no longer the strongest. Also a competition between the active path, formed in the previous steps, and the newly forming active path can occur. Such competition often erases or partially destroys the old path and correspondingly leads to forgetting of old data by the network. Corresponding to each input, the most probable signal propagation will follow the associated pattern. However, when the number of input patterns or the inter-connectivity level increases, the activity paths overlap, thereby destroying each other and corrupting the output result. The intuitive solution is a uniform distribution of active paths in the network. This can be achieved in two ways. Firstly, a negative influence of active path interference can be partially overcome by periodically shuffling the input-output pairs of patterns before feeding them into the network, as described in [26]. This approach assists in finding the most optimal weight values valid for all patterns and, additionally, network’s fault tolerance increases due to more even weight distribution throughout the network. D. Network Operation During the operation stage, weights are unalterable. The percentage of errors in recognizing the set of pre-learned patterns (xl , dl ), l = 1, ..., p will be called the global error and is calculated in the following way. Let wij represent the weight in the i-th row and j-th column of the weight matrix W. The n-dimentional input pattern is set on the input neurons, propagated through the network, transformed according to the current state of the weights and the corresponding m-dimensional output of the network y l is compared with the desired one dl . The error for the output neurons per pattern is calculated according to the formula: A. Fault Tolerance in Training Are all connections equally significant? To answer this question we investigated the weight alteration dynamics during the training process in order to identify the most and the least significant connections. Along with the network structure, the initial state of the weights has a large impact on the ability to learn and the resilience of a neural network. In this section we look into the optimal initial values of the weights. We constructed a small network of 20 neurons (for better visibility) and recorded the alteration of each weight, plotting the measured values against each simulation step. We noticed that training efficiency directly depends on the initial state of the network: weight equilibration before the learning phase significantly improves training process. This is demonstrated in Fig. 3. 1000 random inputs were applied to the network 10000 times before starting any measurements. For each input the “deinforcement” process was applied to the weights, modifying the overall distribution of their values in the network. We paid close attention to the weights of connections between input and hidden layers (see Fig. 4) and between hidden and output layers (see Fig. 5), as well as to the weight distribution at the three stages of simulation: 1) at the initial phase, which is reached after the mapping process; 2) after the network equilibration phase, when the weight deinforcement rule is applied to the network several times; 3) after the learning phase, when all the pattern pairs were successfully learned. The Gaussian distribution of weights can be found on the graphs at the initial phase of simulation. After equilibration is applied, the center of the distribution slightly shifts towards the left side for the connections between input and hidden layers and remains almost unaltered for the connections outgoing from the hidden layer. A significant difference between the weight distribution dynamics can be observed among input-hidden and hiddenoutput connections after the training phase. In the first one, 6 Fig. 3. Training efficiency dependence on the number of equilibration steps applied prior to training. During the training phase 4 different patterns were learned. The network size was 2000 neurons with 5 input and 5 output neurons and 90 % connectivity. during the training phase, distribution expands over the range from -0.1 to 1 with a center at 0.45 and a significant concentration of weights around 0.5. However, the weights in the input-hidden connections shrink considerably from being in the range from -4 to 4 at the initial stage to the range from -0.02 to 0.015 at the final stage with an unclear distribution centered around -0.002. This phenomenon can be explained in the following way. The input neurons tend to excite only a specific set of hidden neurons and concentrate their connection efficacy to a limited number of neurons. Because of this, a change of the formed active paths requires more effort but makes the connections more stable and insensitive to changes. This behavior can be seen in Fig. 6. The hidden neurons broaden their influence on the wide range of neurons, although having a comparatively low influence on them. These connections are more sensitive to the input changes and faster adapt the required firing pattern by exciting the right output neurons. Fig. 7 shows that weights are almost unalterable during the initial phase of simulation, eventually changing their weights at the final simulation phase. The input-hidden connections adapt faster due to their lower number and only after their weights are settled, the hiddenoutput connections start actively adapting. The adaptation process is shown in Fig. 6 and Fig. 7, where it is clearly visible that the hidden-output weights start adapting. Concluding, there are two levels of learning in the threelayer neural network. Whereas the weights of the input neurons are less sensitive to changes, they better retain the learned patterns as opposed to the weights of the hidden neurons, which being highly-alterable and rapidly adapting, easily ‘forget’ the learned patterns. This allows us to assume that input-hidden connections are more influential to the adaption of the required output connection compared to the hidden-output connections. Taking into account that connections with large weights are highly sensitive (according to [25]), their faulty behaviour is more critical for the proper operation of the network. Moreover, after the training phase is complete, a possible fault in the inputhidden connections is more devastating as it automatically leads to a faulty output in the corresponding post-synaptic nodes. To assess the fault-tolerance of the neural network during the training stage, the fault injection technique was applied. Fig. 8 shows the dependence of the number of learning steps on faults. The red line represents the dependence on the faulty nodes and the green line represents the dependence on the faulty synapses. The level of faults is represented in percents rather than by the actual number of faults as this provides a better representation of the scale of damage done to the network. The dependence is almost linear up until 0.3% for the network with damaged nodes and up until 0.25% for the network with damaged synapses. The faulty nodes reduce the learning speed more significantly comparing to the faulty synapses when the number of faults is small. However, this changes to the opposite after the level of faults reaches 0.4%, when the level of damage caused by faulty synapses becomes larger than by the faulty nodes. The value 0.4% represent the point when the number of faulty synapses introduced to the 7 Fig. 4. Weight distribution of input-hidden connections at the initial phase (a), after the equilibration phase (b), and after the learning phase (c). Fig. 5. Weight distribution of hidden-output connections at the initial phase (a), after the equilibration phase (b), and after the learning phase (c). network is equal to the number of faulty synapses caused by the faulty nodes. B. Fault Tolerance in Operation We assessed the fault-tolerance of the neural network during the operation phase. For this the fault injection technique was applied. In order to collect statistically valid data each simulation of the network of 2000 neurons (with 10 neurons dedicated to input and another 10 neurons to output, taught 20 pairs of patterns) was run 1000 times. Each time a certain number of faulty nodes was placed probabilistically according to the described fault injection technique and quality of the network output was measured by Eq. 2. The quality of output represents the global error and stands for the probability of receiving the expected output and is based on the maximum number of different bits between the expected patterns and the produced pattern. This experiment produced a plot of the neural network fault tolerance against the number of faulty nodes and synapses, by which the network reliability could then be judged. Fig. 9 shows the effect of faults injection while evaluating a set of 20 patterns. We presented the damage volume in percentage to the all possible damages in order to scale the amount of damage with the size of the physical implementation. The figure shows that performance degradation is in some sense graceful. According to the plot, 5% faulty nodes guarantees 60% correct output and 10% faulty nodes reduces the probability of the correct result to 50%. A network with 2% faulty nodes produces the correct result with a probability of 90%. Fig. 10 presents the zoomed area of Fig. 9. Any fault will influence the output to some degree since all components participate in any computation. This leads to graceful degradation being exhibited by most neural networks, i.e. neural networks will not suffer catastrophic failure, and also allows approaching failure to be detected by using a continuous reliability measure. The fault tolerance that results in this reliability is not inherent within neural networks: it does Fig. 6. Weight alteration of connections between input and hidden layers during the simulation progress (rotated for the best visibility). Fig. 7. Weight alteration of connections between hidden and output layers during the simulation progress (rotated for the best visibility). 8 VI. C ONCLUSIONS Fig. 8. Dependence of the number of learning steps required to learn 20 neurons by 500-neuron size network on the faults number injected at the network level during the learning process. The level of faults is presented in percents. Fig. 9. The quality of output against the amount of faulty neural network’s nodes while recalling pre-learned 20 patterns using the network of 2000 neurons. Faults do and will occur in a system over time, and there always will come a time when performance is below acceptable limits. The issue of fault tolerance is of particular importance for the creation of large distributed machines based on communication-centric computation. However unlike traditional computing techniques, the neural network approach does not insist on exact computation. There is the strongly nonlinear nature and the distribution of information or “knowledge” throughout all of the network. We presented a distributed feed-forward neural network, which is insensitive to intermittent faults caused by unreliable communication or faulty hardware components. A review of work examining the fault tolerance of neural networks has been presented along with several techniques assuring faulttolerant behavior. Also, various possible influences on the fault tolerance of neural networks were discussed. Among them, we show that uniform weight distribution offers the particular promise of more effective and faster training. We also show that reducing the connectivity between input and hidden layers is more advantageous prior to learning and the connections between hidden and output layers are less vulnerable to faults during learning and afterwards. Almost all of the units and connections participate in producing an output either directly or indirectly. Since it is difficult to exactly determine the required amount of processing units and their connections, their redundant number results in a higher degree of reliability. Thus the malfunctioning of a particular element of a system should not greatly affect the system’s function if there is sufficient redundancy. This analysis offers several more general lessons for building reliable systems on unreliable hardware. Clearly some redundancy is needed, and homogeneity is important, but selforganisation is also a necessary requirement. R EFERENCES Fig. 10. The quality of output against the amount of faulty neural network’s nodes while recalling pre-learned 20 patterns using the network of 2000 neurons (zoomed version of Fig. 9). need to be specifically designed and built into them, and so the architectural complexity which often arises due to various fault tolerance techniques being used is absent in neural network systems. Finally, although any faults which do occur cannot be located, they can be removed from the system since neural networks can learn. Although the experiments were performed on comparatively small networks (about 2000 neurons) with a small training set, the results are considered indicative for large networks with large training sets due to the scalable nature of calculations. We conclude that fault tolerance arises because the computation is distributed in the neural network rather than localized. Moreover, the system is self-organizing rather than being centrally configured. [1] J. Dongarra, H. Meuer, E. Strohmaier, and H. Simon, “Top 500 supercomputer sites.” May 2012, [Online]. Available: http://www.top500.org/. [2] S. S. Mukherjee, C. Weaver, J. Emer, S. K. Reinhardt, and T. Austin, “A systematic methodology to compute the architectural vulnerability factors for a high-performance microprocessor,” in Proc. MICRO 36, 2003, pp. 29–40. [3] S. Furber and S. Temple, “Spinnaker a universal spiking neural network architecture,” University of Manchester, Manchester, UK, Tech. Rep., Oct. 2010. [4] S. Furber and D. Lester, “SpiNNaker project.” May 2012, [Online]. Available: http://apt.cs.man.ac.uk/projects/SpiNNaker/. [5] H. Markram, R. Bishop, and R. Cicurel, “Blue Brain project.” May 2012, [Online]. Available: http://bluebrain.epfl.ch/. [6] J. Navaridas, M. Luján, J. Miguel-Alonso, L. A. Plana, and S. Furber, “Understanding the interconnection network of SpiNNaker,” in Proc. ICS, 2009, pp. 286–295. [7] W. R. Moore, “Neural computers,” R. Eckmiller and C. v. d. Malsburg, Eds. New York, NY, USA: Springer-Verlag New York, Inc., 1989, ch. Conventional fault-tolerance and neural computers, pp. 29–37. [8] M. Mozer and P. Smolensky, “Skeletonization: A technique for trimming the fat from a network via relevance assessment,” in Proc. NIPS, D. S. Touretzky, Ed. San Mateo: Morgan Kaufmann, 1988, pp. 107–115. [9] H.-M. Tai, “Fault tolerance in neural networks,” Proc. WNN-AIND, p. 59, Feb. 1990. [10] L. Belfore and B. Johnson, “The fault-tolerance of neural networks,” International Journal of Neural Networks Research and Applications, pp. 24–41, Jan. 1989. 9 [11] C. Chiu, K. Mehrotra, C. Mohan, and S. Ranka, “Robustness of feedforward neural networks,” Proc. ICNN, vol. 2, pp. 783–788, March 1993. [12] M. J. Carter and B. Segee, “Fault tolerance of pruned multilayer networks,” Proc. IJCNN, vol. 2, pp. 447–452, July 1991. [13] M. J. Carter, F. J. Rudolph, and A. J. Nucci, “Advances in neural information processing systems 2,” D. S. Touretzky, Ed. San Francisco, CA, USA: Morgan Kaufmann Publishers Inc., 1990, ch. Operational fault tolerance of CMAC networks, pp. 340–347. [14] B. E. Segee and M. J. Carter, “Comparative fault tolerance of parallel distributed processing networks,” IEEE Trans. Comput., vol. 43, no. 11, pp. 1323–1329, Nov. 1994. [15] J. Nijhuis, B. Hofflinger, A. van Schaik, and L. Spaanenburg, “Limits to the fault-tolerance of a feedforward neural network with learning.” IEEE Comput. Soc. Press, 1990, pp. 228–235. [16] M. Emmerson and R. Damper, “Determining and improving the fault tolerance of multilayer perceptrons in a pattern-recognition application.” IEEE Trans. Neural Netw., vol. 4, no. 5, pp. 788–93, Sept. 1993. [17] D. S. Phatak and I. Koren, “Complete and partial fault tolerance of feedforward neural nets,” IEEE Trans. Neural Networks, vol. 6, pp. 446– 456, 1995. [18] W. V. Seelen and H. A. Mallot, “Neural computers,” R. Eckmiller and C. v. d. Malsburg, Eds. New York, NY, USA: Springer-Verlag New York, Inc., 1989, ch. Parallelism and redundancy in neural networks, pp. 51–60. [19] G. Bolt, “Technical Report YCS 154: Investigating Fault Tolerance in Artificial Neural Networks,” Dept. Computer Architecture Group, Universite of York, Tech. Rep., March 1991. [20] G. Panchal, A. Ganatra, Y. P. Kosta, and D. Panchal, “Behaviour analysis of multilayer perceptrons with multiple hidden neurons and hidden layers,” in International Journal of Computer Theory and Engineering, vol. 3(2), April 2011, pp. 332–337. [21] G.-B. Huang, “Learning capability and storage capacity of two-hiddenlayer feedforward networks.” IEEE Trans. on Neural Netw., vol. 14, no. 2, pp. 274–281, March 2003. [22] D. J. Burr, “Experiments on neural net recognition of spoken and written text,” IEEE Trans. Acoustics, Speech and Signal Processing, vol. 36, no. 7, pp. 1162–1168, July 1988. [23] Y. Bengio, “Learning deep architectures for AI,” Dept. IRO, Universite de Montreal, Quebec, Canada, Tech. Rep., 2007. [24] R. J. C. Bosman, W. A. van Leeuwen, and B. Wemmenhove, “Combining Hebbian and reinforcement learning in a minibrain model,” Neural Netw., vol. 17, no. 1, pp. 29–36, 2004. [25] C. Chiu, K. Mehrotra, C. K. Mohan, and S. Ranka, “Training techniques to obtain fault tolerant neural networks,” in Proc. FTCS-24, June 1994, pp. 360–369. [26] A. Kulakov and M. Zwoliński, “Reducing the active paths interference in the Chialvo-Bak minibrain model,” in Proc. ICCMS, vol. 2, Jan. 2011, pp. 677–681.
9cs.NE
1 On the Outage Analysis and Finite SNR Diversity-Multiplexing Tradeoff of arXiv:1712.07781v1 [cs.IT] 21 Dec 2017 Hybrid-Duplex Systems for Aeronautical Communications Tan Zheng Hui Ernest, A S Madhukumar, Rajendra Prasad Sirigina, and Anoop Kumar Krishna Abstract A hybrid-duplex aeronautical communication system (HBD-ACS) consisting of a full-duplex (FD) enabled ground station (GS), and two half-duplex (HD) air-stations (ASs) is proposed as a direct solution to the spectrum crunch faced by the aviation industry. Closed-form outage probability and finite signalto-noise ratio (SNR) diversity gain expressions in aeronautical communications over Rician fading channels are derived for a successive interference cancellation (SIC) detector. Similar expressions are also presented for an interference ignorant (II) detector and HD-equivalent modes at GS and ASs. Through outage and finite SNR diversity gain analysis conducted at the nodes, and system level, residual SI and inter-AS interference are found to be the primary limiting factors in the proposed HBD-ACS. Additional analysis also revealed that the II and SIC detectors in the proposed HBD-ACS are suitable for weak and strong interference scenarios, respectively. When compared to HD-ACS, the proposed HBD-ACS achieves lower outage probability and higher diversity gains at higher multiplexing gains when operating at low SNRs. Finite SNR analysis also showed the possibility of the proposed HBD-ACS being able to attain interference-free diversity gains through proper management of residual SI. Hence, the proposed Tan Zheng Hui Ernest is with the School of Computer Science and Engineering, Nanyang Technological University, Singapore e-mail: ([email protected]). A S Madhukumar is with the School of Computer Science and Engineering, Nanyang Technological University, Singapore e-mail: ([email protected]). Rajendra Prasad Sirigina is with the School of Computer Science and Engineering, Nanyang Technological University, Singapore e-mail: ([email protected]). Anoop Kumar Krishna is with Airbus Singapore Pte Ltd, Singapore e-mail: ([email protected]). 2 HBD-ACS is more reliable and can provide better throughput compared to existing HD-ACS at lowto-moderate SNRs. Index Terms Aeronautical Communications, Spectral Efficiency, Full-Duplex, Hybrid-Duplex, Half-Duplex, Outage Probability, Rician, Finite signal-to-noise ratio (SNR), Diversity. I. I NTRODUCTION Between 2012 and 2032, air travel within the Pacific South East Asia region is projected to record a compounded annual growth rate of 5.3% [1]. This air travel growth trend exposes existing aeronautical communication systems (ACSs) to considerable strain due to demand for data communications from legacy, current and future generation avionics systems. Consequently, this places an additional strain on existing Air-to-Ground (A/G) and Air-to-Air (A/A) aeronautical communication links on the congested aeronautical spectrum. With existing ACSs being unable to deliver the needed data capacity [2], various communication technologies have been proposed to improve the capabilities of existing A/G and A/A links [2], [3]. However, these solutions do not directly address the issue of spectrum utilization. A hybrid-duplex (HBD) ACS consisting of half-duplex (HD) air-stations (ASs) operating existing avionics systems with full-duplex (FD) ground stations (GSs) can be an alternative solution to the shortage of available aeronautical spectrum currently faced by the aviation community. Changes to existing/legacy HD avionics systems currently on board aircrafts can be kept to a minimum in HBD-ACS, thus enabling HBD-ACS to be less disruptive to adopt. Wireless communication systems that have adopted the HBD paradigm include cognitive radio systems [4] and cellular systems [5], [6], [7]. In HBD systems, both FD and HD nodes communicate on the same spectrum since an FD node can simultaneously transmit and receive signals on the same frequency and thereby improve the spectral efficiency [8], [9], [10]. However, self-interference (SI) remains the primary challenge faced by FD nodes due to simultaneous signal transmission and reception, with extensive studies done on SI mitigation architectures. SI mitigation architectures can be categorized into either passive suppression or active cancellation [11]. The former mitigates SI through induced path loss (e.g. antenna separation) while the latter cancels SI in the analog or digital domain. The respective SI cancellation architectures each have unique limitations. For instance, passive suppression may 3 not always be possible due to transceiver design while active cancellation architectures are limited by the analog-to-digital converter’s dynamic range [9] and sophisticated hardware. Also, residual SI is present due to inherent carrier phase noise and imperfect SI channel estimation at the FD transceiver [11], which is also another limiting factor that practical aeronautical HBD systems must overcome. Nonetheless, practical FD systems is a possibility if SI is sufficiently mitigated [11], [12]. In this aspect, implementing suitable SI mitigation architectures for HBD-ACS opens up the possibility of directly addressing the spectrum crunch faced by the aviation industry. In particular, multiple aircrafts and ground stations can communicate on the same aeronautical spectrum, providing motivation for this paper. A. Related Literature Apart from SI at FD nodes, HD nodes in HBD systems also experience interference due to transmissions from other HD and FD nodes. In the literature, multiple interference management approaches have been presented. However, this paper focuses on two widely known approaches where interference is either ignored, i.e., interference ignorant (II) detector, or successfully canceled, i.e., successive interference cancellation (SIC) detector. To quantify the effectiveness of the II and SIC detectors, many related works in literature have attempted to determine the closed-form outage probabilities of these detectors under various fading models. For the II detector, closed-form outage expressions for Nakagami-m fading [13] and composite fading consisting of exponentially distributed signal-of-interest (SOI) and squared K-distributed interfering signals [14] have been noted. It should be pointed out that [13] and [14] are only applicable to specific fading environments and may not be applicable for all aeronautical scenarios where Rician fading is experienced. To this end, a recent paper by Rached et al. [15] presented generalized outage probability expressions that apply to a wide variety of fading scenarios, including Rician fading. Multiple works on outage expressions for SIC detectors have been noted. For instance, SIC outage expressions were investigated by Hasna et al. [16] and Romero-Jerez and Goldsmith [17], but these studies only considered partial SIC where at least one interfering signal remains after interference cancellation. A closed-form outage expression for SIC was studied by Weber et al. [18] for nodes distributed via a Poisson point process. The work in [18] did not consider fading and receiver noise in the signal model, and thus, the closed-form expressions are not directly 4 applicable for aeronautical communications. A recent paper by Zhang et al. [19] presented outage probability expressions for a two-stage SIC detector. However, the outage expressions are specific for Rayleigh fading scenarios and are not applicable to Rician fading scenarios that are common in aeronautical communications. From the mentioned studies, hitherto closed-form outage probability expressions for SIC detectors in Rician fading aeronautical scenarios remain an open problem. Apart from outage probability, both finite signal-to-noise ratio (SNR) diversity gain and finite SNR diversity-multiplexing trade-off (DMT) are metrics that can be used to measure the effectiveness of II or SIC detectors in fixed and variable transmission rate systems, respectively. In particular, both finite SNR diversity gain and finite SNR DMT quantifies the slope of outage probability curves at a particular SNR [20], with the latter considering multiplexing gain [21]. Finite SNR analysis can reveal outage deviation behaviors, which are not present at asymptotically high SNRs due to fading statistics [20]. From a practical perspective, analyzing outage probability decay rates, i.e., finite SNR diversity gain, provides an accurate picture of a system’s outage performance since wireless communication systems are typically designed to operate at low-to-moderate SNR ranges. It has also been pointed out by Narasimhan [21] that finite SNR diversity gain analysis can be used to estimate the SNR needed to achieve a particular rate of error decay, which can be done through turbo codes or low-density parity-check codes. More crucially, outage probability and diversity gain can be used to gauge the upper and lower limits of a system’s bit error rate performance [22], [23]. Finite SNR analysis for Nakagami-m [24] and Rayleigh fading [25], [26] scenarios have also been studied. However, the conclusions drawn in these studies are specific to Nakagamim and Rayleigh fading and are not fully applicable for ACS since Rician fading scenarios, typically encountered by ACS, are not considered. Studies on finite SNR analysis for Rician fading channels have been seen. The impact of Rician K factors on outage behavior and finite SNR DMT for multiple-input multiple-output (MIMO) systems was investigated by Narasimhan [21] and Shin et al. [20]. A recent paper by Heidarpour et al. [27] saw finite SNR DMT analysis being applied to analyze the performance of a network coded cooperative communication system. Despite the noted studies, there is still room for further work on finite SNR DMT analysis for HBD-ACS. 5 B. Main Contributions The main contributions of this paper are summarized as follows: • The present paper proposes an innovative approach for deriving closed-form expressions for outage probability for a II detector and a two-stage SIC detector in a Rician faded environment. • It is shown that the proposed HBD-ACS attains superior outage performance over existing HD-ACS at low SNRs. At high SNRs, however, the outage performance of the proposed HBD-ACS is eclipsed by HD-ACS as the former becomes interference-limited at asymptotic SNRs. Nonetheless, we show through numerical simulations that the HBD-ACS can meet typical Quality-of-Service (QoS) requirements, e.g., frame error rate ≤ 10−3 , at high SNRs for a range of interference levels through II and SIC detectors. • Closed-form finite SNR diversity gain expressions are derived for the II and SIC detectors under Rician fading. The asymptotic behavior of the derived finite SNR diversity gains for HBD-ACS and HD-ACS are proven and shown to be consistent with interference-limited outage behaviors at asymptotic SNRs. • The proposed HBD-ACS is shown to achieve better diversity gains than HD-ACS at high multiplexing gains. Finite SNR DMT analysis reveals that operating at higher multiplexing gain causes the Rician K factor, corresponding to the SOI, to have more impact on HBDACS outage performance. Additionally, reducing residual SI and interference from AS-1 leads to steeper decay of outage probability, improving the finite SNR DMT curve of the proposed HBD-ACS as a consequence. C. Relevance to Related Literature In this work, full interference cancellation is assumed for the two-stage SIC detector. This is unlike in [16] and [17] where only partial SIC is assumed. In addition, the impact of interference on the proposed HBD-ACS is analyzed from the outage probability and finite SNR DMT perspective, which was not covered in [4] - [7], [13] - [15], [18] and [19]. In contrast to [20], [21] and [27], this work extends upon the outage and finite SNR DMT analysis framework to jointly identify interference scenarios for the proposed single-input-single-output equivalent HBD-ACS. The remainder of this paper is organized as follows. The system model is introduced in Section II, with closed-form outage probability expressions at GS and AS-2 presented in Section III. In Section IV, finite SNR diversity gain expressions for both HBD-ACS and HD-ACS are derived 6 Fig. 1. Air-Station 1 (AS-1) and Air-Station 2 (AS-2) operating in HD mode while communicating with the FD ground station (GS). and analyzed. Numerical results are then presented in Section V before the conclusion of the paper in Section VI. II. S YSTEM M ODEL In this paper, A/G communications involving an FD-enabled GS node with two HD ASs in an A/G link is studied. Specifically, a scenario with Air-Station 1 (AS-1) transmitting signals to the GS while Air-Station 2 (AS-2) is receiving signals from the GS is assumed. Due to the fact that the GS node is FD-capable, the HD AS-1 and HD AS-2 simultaneously transmits and receives, respectively, signals on the same aeronautical spectrum (e.g. VHF, L-band) as the GS. Therefore, AS-1 interferes with communications at AS-2 when the latter receives signals from GS. At the FD-enabled GS, a combined pre-mixer and post-mixer SI cancellation architecture is adopted to mitigate inherent SI, as shown in Fig. 1. An analog domain pre-mixer canceler first mitigates the SI signal before down-conversion occurs. After analog SI mitigation, a digital domain post-mixer canceler further suppresses SI in the digital domain. Combining the premixer and post-mixer cancellation architectures in succession results in less residual SI [11, Table II]. The main drawback, however, is the need for separate radio chains, which introduces unnecessary carrier phase noise. To mitigate the phase noise effect, the proposed SI cancellation architecture shares a common local oscillator (LO), as seen in Fig. 1. Assuming SI mitigation at GS, residual SI will be considered due to imperfect SI channel estimation [11]. Thus, an II detector is assumed at GS since signal detection is performed in the presence of residual SI. Rician fading aeronautical communications channels in an en route scenario is assumed to provide a realistic evaluation of the HBD-ACS [28]. Accordingly, we assume that the ASs are 7 communicating with the GS at cruising altitude, with the signal model of this work based on [11]. A. Ground Station Let x1 [t] and xgs [t] be the signals transmitted by AS-1 and GS, respectively, and h1,g [t] be the channel from AS-1 to GS. Additionally, let xsi [t] be the SI signal at GS and let hsi be the SI channel gain. From the perspective of GS, xsi [t] = xgs [t]. The received signal at GS can be written as ygs [t] = p p p Ω X h1,g [t]x1 [t] + Ω X αg,g · |e hsi |xsi [t] + Ω X αg,g |hsi |γφ wφ [t] + wg [t], (1) where e hsi is the error of the imperfect SI channel gain estimate, defined as e hsi = hsi − b hsi , and b hsi is the imperfect estimation of the SI channel gain. In addition, let e hsi be modeled as a zero mean, circularly symmetric complex Gaussian random variable (RV) with variance ǫ to quantify the SI channel estimation error [29]. Modeling e hsi as a zero mean Gaussian RV with variance ǫ enables the system to model the worst case residual SI [29]. Also, let wg [t] be the GS additive white Gaussian noise (AWGN) with zero mean and variance σg2 , and let the phase noise term wφ [t] follow a Gaussian distribution with zero mean and unit variance, scaled by the strength of the phase noise γφ [11]. Let Ω X be the average received signal power of the signal-of-interest (SOI). The average received signal power is defined based on the free space path loss model and it is defined as ΩX =  Pt ,  2 4·π·109 2 n 2 · fc ·d1,g ·σg 3·108 (2) where Pt , d, fc and n are the transmit power (Watts), distance (Km), carrier frequency (MHz) and pathloss exponent, respectively. The received signal power levels are normalized with the receiver noise variance (σg2 ). The channel between AS-1 and GS is selected as the reference link and the average received signal power in the other links are expressed relative to the reference link via the multiplicative factor αi, j , defined as   d1,g n , i ∈ {g, 1} , j ∈ {g, 2} . αi, j = di, j From (2) and (3), the average received SI power at GS can be expressed as Ω X αg,g . (3) 8 B. Air-Station 2 Let hg,2 [t] be the channel between GS and AS-2, h1,2[t] be the channel between AS-1 and AS-2, and w2 [t] be the AWGN at AS-2 with zero mean and variance σ22 . From the perspective of AS-2, xgs [t] and x1 [t] are the SOI and interfering signal, respectively. The received signal at AS-2 can be expressed as y2 [t] = p p Ω X αg,2 hg,2 [t]xgs [t] + Ω X α1,2 h1,2[t]x1 [t] + w2 [t], (4) where Ω X αg,2 and Ω X α1,2 indicate the average received signal powers of the SOI and interfering signal, respectively. To handle the interference at AS-2, two approaches are studied. The first approach assumes an II detector at AS-2. The II detector treats x1 [t] as noise. Therefore, interference is effectively ignored. The second approach assumes a SIC detector at AS-2. The two-stage SIC detector first tries to detect and cancel x1 [t] before proceeding to detect xgs [t] [30]. III. C ALCULATION OF O UTAGE P ROBABILITIES To begin the outage analysis at GS and AS-2, we first define the HBD transmission rates HBD , respectively, and the sum rate of the HBD system as of AS-1 and GS as R1HBD and Rgs HBD HBD = R1HBD + Rgs . Similarly, the HD transmission rates of AS-1 and GS are defined as Rsum HD , respectively, and the sum rate of the HD system is defined as R HD = R HD + R HD . R1HD and Rgs sum gs 1 For fair comparison between HBD and HD systems, RiHBD = 21 RiHD for i ∈ {1, gs} [31], [32], [33]. The respective HBD and HD outage probabilities at GS and AS-2 are defined in the following subsections. A. Hybrid-Duplex Outage Probability The FD-enabled GS receives x1 [t] while simultaneously transmitting xgs [t] in the same time slot. The simultaneous transmission and reception of signals result in strong SI at GS. Let X1 = Ω X |h1,g | 2 be the instantaneous received signal power of the SOI at GS, modeled as a noncentered Chi-squared distributed RV with Rician K factor K X1 . Let Ysi,1 = Ω X αg,g γφ2 |hsi | 2 and Ysi,2 = Ω X αg,g |e hsi | 2 be the instantaneous received signal power corresponding to SI components. In particular, Ysi,1 is modeled as a non-centered Chi-squared distributed RV with Rician K factor KYsi,1 and Ysi,2 is modeled as a exponentially distributed RV. 9 Concurrently, AS-2 also experiences interference from AS-1. Let Xgs = Ω X αg,2 |hg,2 | 2 and Y1 = Ω X α1,2 |h1,2 | 2 be the instantaneous received signal power of the SOI and interference at AS-2, respectively, where Xgs and Y1 are independent non-centered Chi-squared distributed RV  with respective Rician K factors K Xgs and KY1 , respectively. Additionally, let α q, Ω, K, γ be defined as  Lq (0) (K) (1 + K) γ α q, Ω, K, γ = (−1)q exp(−K) (1 + q)! Ω ! q+1 (5) , where q, Ω, K and γ represent an arbitrary non-negative integer, average received power of the signal, Rician K factor, and threshold, respectively. The function Lq (0) (•) represents the q-th  degree, zero-order Laguerre polynomials [34] while α q, Ω, K, γ in (5) represents the Rician power cumulative distribution function (CDF) expansion due to Rician faded signal parameters. H BD HBD = 2 R1 1) Ground Station: At GS, let the HBD threshold be γth,gs − 1, with HBD outage o n  X1 HBD = h , h : R HBD ≥ log 1 + event Ogs 1,g si 2 Ysi,1 +Ysi,2 +1 . By substituting X1, Ysi,1 and Ysi,2 into 1 [15, eq. (12)], the closed-form outage probability at GS can be expressed as Õ Õ l1 l2 HBD  HBD  (q + 1)! Pr Ogs = E {Ysi,1 }E {Ysi,2 }, (6) α q, Ω X , K X1, γth,gs l1 ! · l2 ! · l3 ! q≥0 l1 +l2 +l3 =q+1  HBD is the Rician SOI power CDF expansion at GS, as defined in (5). where α q, Ω X , K X1, γth,gs l1 l2 In addition, E {Ysi,1 } and E {Ysi,2 } are the l1th and l2th moments of Ysi,1 and Ysi,2 , respectively.  α γ 2  l1 g,g l2 l1 } = Γ(1 + From [15, Table II], E {Ysi,1 } = Γ(1 + l1 ) 1+KY φ 1 F1 (−l1, 1; −KYsi,1 )(Ω X )l1 and E {Ysi,2 si,1  l2 l2 )(αg,g ǫ (Ω X )l2 . The function 1 F1 (•) represents the confluent Hypergeometric function [35] and HBD ≤ summation on the right hand side (RHS) of (6) is convergent if γth,gs eq. (14)]. In (6), l1 E {Ysi,1 } and l2 E {Ysi,2 } ΩX 3(1+K X1 )(ΩX αg,g ǫ) [15, quantifies the strength of residual SI, with phase noise l1 l2 and SI channel estimation errors quantified by E {Ysi,1 } and E {Ysi,2 }, respectively. To show the l1 impact of residual SI on the FD-enabled GS, we evaluate the limit of the αg,g term in E {Ysi,1 } from (6) as follows.    if L = ∞, l1 > 0  ∞   Ω γ 2  l1   l1 lim E {Ysi,1 } = Γ(1 + l1 ) 1+KX φ 1 F1 (−l1, 1; −KYsi,1 ) if L ∈ {0, ∞}, l1 = 0 Ysi,1  αg,g →L     0 if L = 0, l1 > 0  (7) l2 Similar results are also yielded when the limit of αg,g in E {Ysi,2 } is evaluated. We do not expect αg,g to approach infinity as the distance on the SI link (dg,g ) cannot be zero. However, it is possible for the average received SI power to be strong if dg,g is short. From (7), the impact 10 of residual SI is diminished as αg,g → 0 and hence, proper SI mitigation strategies is crucial at the FD-enabled GS. HBD = 2) Air-Station 2 (Interference Ignorant Detector): At AS-2, let the HBD threshold be γth,2 o n  H BD HBD(I I) HBD ≥ log 1 + Xgs 2 Rgs − 1 and the HBD outage event be O2 = hg,2, h1,2 : Rgs 2 Y1 +1 . By substituting Xgs and Y1 into [15, eq. (12)], the closed-form outage probability at AS-2 can be expressed as Pr HBD(I I)  O2 = q+1 ÕÕ α HBD  q, Ω X αg,2, K Xgs , γth,2   q+1 E {Y1l }, l (8)  HBD is the Rician SOI power CDF expansion at AS-2, as defined where α q, Ω X αg,2, K Xgs , γth,2 q≥0 l=0 in (5), and E {Y1l } is the l th moment of the interfering signal from AS-1. From [15, Table II], il h α HBD ≤ E {Y1l } = Γ(1 + l) 1+K1,2Y 1 F1 (−l, 1; −KY1 )(Ω X )l and the RHS of (8) is convergent if γth,2 ΩX αg,2 (1+KY1 ) 2(1+K Xgs )ΩX α1,2 1 [15, eq. (14)]. In (8), E {Y1l } quantifies the strength of the interference from AS-1 through moment parameters of Y1 . To investigate the impact of inter-AS interference, we evaluate limα1,2 →L E {Y1l } for L ∈ {0, ∞} using the same approach in (7). Although α1,2 does not reach infinity in practice, large values of α1,2 are possible when d1,2 is small and vice-versa. Evaluating limα1,2 →L E {Y1l } for L ∈ {0, ∞} shows that the impact of inter-AS interference reduces as α1,2 → 0 and thus, the II detector operates effectively in low interference scenarios such as over remote airspace where inter-AS distance is long. 3) Air-Station 2 (Successive Interference Cancellation Detector): In the case of SIC, if the first stage is unable to detect the interfering signal or if the SOI cannot be detected at the second stage, then outage occurs. Therefore, the HBD outage event at AS-2 is defined as    Y1 HBD(SIC) HBD = hg,2, h1,2 : R1 > log2 1 + O2 1 + Xgs      Y1 HBD HBD ∪ hg,2, h1,2 : R1 ≤ log2 1 + , Rgs > log2 1 + Xgs . (9) 1 + Xgs Theorem 1: The closed-form expression for outage probability with SIC detector at AS-2 is !   q+1 ÕÕ   q + 1 HBD l Pr O2HBD(SIC) = α q, Ω X α1,2, KY1, γth,gs E {Xgs } (10) l q≥0 l=0 s ! HBD q 2(K Xgs + 1)γth,2 + 1 − Q 1 2K Xgs , Ω X αg,2  (γ HBD ) j+n−i+1 !  n Õ i+1 ÕÕ   i + 1 th,2 HBD − , α i, Ω X α1,2, KY1, γth,gs α n − i, Ω X αg,2, K Xgs , 1 j + n − i + 1 j n≥0 i=0 j=0 11 l } = Γ(1 + l) where Q 1 (·, ·) is the Marcum Q function [34] and E {Xgs [15, Table II].   ΩX αg,2 l 1 F1 (−l, 1; −K Xgs ) 1+K Xgs Proof: The proof can be found in Appendix A. The first term in (10) is the outage probability due to detecting interference from AS-1. The second term in (10) is the outage probability due to SOI detection after interference cancellation.  HBD from (10) yields Similar to (7), evaluating the limit of α1,2 in α q, Ω X α1,2, KY1, γth,2 HBD      ∞ if L = 0  (11)    0 if L = ∞  From (11), it is evident that the SIC detector works effectively in high interference scenarios, lim α q, Ω X α1,2, KY1, γth,2 α1,2 →L = such as in congested airspace where inter-AS distance is short, since the effect of interference at the SOI detection stage is diminished when α1,2 is large. The closed-form expressions in (6), (8) and (10) can shed insights into the impact of residual SI at GS and interference from AS-1 at AS-2. Further discussions on outage performance with respect to the level of interference are presented in Section V. B. Half-Duplex Outage Probability When the GS is operating in HD mode, AS-2 does not experience interference from AS-1. H BD HD = 22R1 Let the HD threshold at GS and AS-2 be defined as γth,gs H BD HD = 22Rgs − 1 and γth,2 − 1, respectively. Then, the HD outage probabilities at GS and AS-2 are given in (12) and (13), respectively [15, Table I]. HD Pr Ogs Pr   O2HD = Õ Õ m≥0 = m≥0 HD α m, Ω X , K X1, γth,gs  HD  α m, Ω X αg,2, K Xgs , γth,2 . (12) (13) The outage probability expressions in (12) and (13) can be used as a benchmark comparison against HBD mode at GS and AS-2, respectively, which is presented in Section V. C. System Level Outage Probability For the proposed multi-user system, the overall system level outage probability is used as a performance metric to compare HBD and HD protocols. For β ∈ {HBD(I I), HBD(SIC)}, the 12 system level outage probability is defined as β Pout,system  HBD  Ogs , Pr β O2  , = max Pr    HD HD  Pout,system = max Pr Ogs , Pr O2HD . (14) (15) In particular, (14) provides the worst case system level outage behavior for the II and SIC detectors and allows the identification of performance bottlenecks in HBD-ACS. IV. F INITE SNR A NALYSIS In the following subsections, the mathematical preliminaries related to finite SNR diversity gain are presented for both fixed and variable transmission rates, with detailed derivation omitted for brevity. A. Mathematical Preliminaries  1) Finite SNR Diversity Gain: For a system with outage event O, outage probability Pr O , transmission rate R, threshold γ, and average received power Ω with unit noise variance, the diversity gain d at high SNR is given by Zheng and Tse [22] as  log2 (Pr O ) . d = lim Ω→∞ log2 (Ω) (16) The diversity gain definition in (16) is for systems that operate at high SNR ranges. The finite SNR diversity gain d f , which quantifies the decay rate of the outage probability at lowto-moderate SNRs, is given as [21, eq. (5)] df =  −Ω ∂  Pr O . Pr O ∂Ω (17) It has since been shown by Shin et al. [20] and Heidarpour et al. [27] that limΩ→∞ d f = d. Therefore, (17) is consistent with the asymptotic diversity definitions in [22] at high SNR. Practical wireless systems typically operate at the low-to-moderate SNR range [21]. The outage behavior of these systems may also be different at high and moderate SNRs. Therefore, there is motivation to quantify diversity gains at finite SNRs since (16) does not accurately reflect outage behaviors at low-to-moderate SNRs [20]. 13 2) Finite SNR DMT Parameters: For a system which varies its transmission rate with respect to Ω, i.e., variable transmission rate, the high SNR multiplexing gain r is given by Zheng and Tse [22] as R(Ω) Ω→∞ log2 (Ω) (18) r = lim and the finite SNR multiplexing gain r f for such systems is [21, eq. (4)] rf = R(Ω) . log2 (1 + Ω) (19) It has similarly been shown by Shin et al. [20] and Heidarpour et al. [27] that limΩ→∞ r f = r,  with Pr O computed with respect to the threshold γ = (1 + Ω)r f − 1. The finite SNR diversity gain for such a variable transmission rate system (denoted as d ∗f ) can be obtained from (17) as [20, eq. (36)] d ∗f h Pr O b − Pr O  i −Ω  lim , = ∆(Ω) Pr O ∆(Ω)→0 (20) b is the outage event with respect to R Ω+∆(Ω) . Furthermore, b b > Ω and O where ∆(Ω) = Ω−Ω, Ω b is the outage probability with average received power Ω b = Ω + ∆(Ω), threshold b Pr O γ =   b = Pr O when ∆(Ω) = 0. Applying L’Hospital’s rule in (20) by [1 + Ω + ∆(Ω)]r f − 1 and Pr O differentiating with respect to ∆(Ω) and setting ∆(Ω) = 0 yields d ∗f = −Ω ∂ b  Pr O Pr O ∂∆(Ω) . (21) ∆(Ω)=0 Let Z be a RV with normalized nth moment defined as M {Z n } = E {Z n } (Ω)n and let function g(i, j, Ω, r f ) be defined as    j   rf   rf i j r f −1 g(i, j, Ω, r f ) = 1 + Ω − 1 (Ω) 1+Ω −1 , + (i + 1)(r f )(1 + Ω) Ω (22) (23) where i and j are integers. The function M {Z n } represents the normalized nth moment of an interfering signal while the function g(i, j, Ω, r f ) reflects the outage probability decay rate of a variable transmission rate scheme due to average received power (Ω) and finite SNR multiplexing gain (r f ). Although [20, eq. (36)] and [21, eq. (5)] evaluate finite SNR diversity gains using different approaches, the principles underlying them are the same since the latter is an extension of the 14 former. To this end, (21) can be used to evaluate d ∗f for adaptive systems, with r f indicating the sensitivity of the rate adaptation scheme [21]. It is also of interest to analyze d ∗f as it can lead to better code designs that improve transmission rates at the expense of reliability for adaptive systems and vice-versa. B. Finite SNR Diversity Gain for HBD Systems HBD,i Let the finite SNR HBD diversity gain at GS and AS-2 be defined as d HBD f ,gs and d f ,2 , i ∈ {I I, SIC}, respectively. Additionally, let R1 and Rgs be fixed constants with average received power Ω = Ω X . Then, the finite SNR diversity gain at GS and AS-2 are presented in the following theorems. Theorem 2: The finite SNR diversity gain at the FD-enabled GS in the proposed HBD-ACS is d HBD = f ,gs Õ −Ω X  HBD Pr Ogs q≥0 l Õ HBD α q, 1, K X1, γth,gs 1 +l2 +l3 =q+1 × (l1 + l2 − q − 1) (Ω X )l1 +l2 −q−2 ,  (q + 1)! l1 l2 M {Ysi,1 }M {Ysi,2 } l1 ! · l2 ! · l3 ! (24) Proof: The finite SNR diversity gain at GS can be obtained by substituting (6) into (17). At low-to-moderate Ω X , the outage behavior at GS can be analyzed from (24). In particular, (24) allows observation of subtle changes in outage behavior due to the scaling factor associated with the SI strength (αg,g ) and SI channel estimation error (ǫ) that is not present at high Ω X . In addition, the asymptotic behavior of d HBD f ,gs can be obtained from (24) as shown in the following corollary. Corollary 1: The asymptotic behavior of d HBD f ,gs is given by ∂ −Ω X HBD  Pr Ogs = 0.  HBD ΩX →∞ Pr Ogs ∂Ω X lim (25) Proof: From (6) and (24), (Ω X )l1 +l2 −q−1 < 1 when l1 +l2 +l3 ≤ q. Thus, limΩX →∞ (Ω X )l1 +l2 −q−1 = 0, l1 +l2 +l3 ≤ q. Therefore, only l1 +l2 +l3 = q +1 needs to be considered, which consequently leads to the numerator in (24) to be zero, i.e., l1 + l2 − q − 1 = 0. From (25), d HBD f ,gs → 0 as Ω X → ∞ because increasing Ω X also causes residual SI to be stronger, hence there is no improvement in the overall SINR. Also, (25) suggests that the tolerance for residual SI in HBD-ACS is progressively diminished as Ω X is increased since d HBD f ,gs → 0 corresponds to negligible improvements in outage probability at GS. 15 HBD(I I) Theorem 3: The finite SNR diversity gain at AS-2 with the II (d f ,2 HBD(SIC) ) (d f ,2 HBD(I I) d f ,2 HBD(SIC) d f ,2 are ) and SIC detectors  q+1 M {Y1l }(l − q − 1)(Ω X )l−q−2 (26) α = HBD(I I)  l Pr O2 q≥0 l=0 " !   q+1 ÕÕ  −Ω X q + 1 l HBD = M {Xgs }(l − q − 1)(Ω X )l−q−2 α q, α1,2, KY1, γth,gs HBD(SIC)  l Pr O q≥0 l=0 −Ω X + Õ 2 α q+1 ÕÕ HBD  q, αg,2, K Xgs , γth,2 HBD  m, αg,2, K Xgs , γth,2 (−m  −m−2 − 1)(Ω X ) − n Õ i+1 ÕÕ HBD α i, α1,2, KY1, γth,gs !#  i + 1 γth,2 (−n − 2)(Ω X )−n−3 , × α n − i, αg,2, K Xgs , 1 j +n−i +1 j m≥0   n≥0 i=0 j=0  HBD j+n−i+1  (27) , i ∈ {I I, SIC} can be obtained for the II and SIC by respectively Proof: At AS-2, d HBD(i) f ,2 substituting (8) and (10) into (17). The outage behavior at AS-2 can be analyzed from (26) and (27) at low-to-moderate Ω X . In particular, (26) and (27) enables the observation of subtle changes in outage behavior for both II and SIC detectors, which are not present at high Ω X , as inter-aircraft interference varies. HBD(i) Extending upon (26) and (27), the asymptotic behavior of d f ,2 , i ∈ {I I, SIC} can be obtained as follows. HBD(i) Corollary 2: The asymptotic behavior of d f ,2 lim ΩX →∞ −Ω X Pr  O2HBD,i , i ∈ {I I, SIC} is given by  ∂ Pr O2HBD,i = 0. ∂Ω X (28) I) , the approach seen in (25) can be used. Starting Proof: To evaluate limΩX →∞ d HBD(I f ,2 HBD(I I) with the denominator of d f ,2 , (Ω X )l−q−1 < 1 when l ≤ q. Thus, limΩX →∞ (Ω X )l−q−1 = 0 when l ≤ q. In the numerator, (l − q − 1) (Ω X )l−q−2 = 0 when l = q + 1. Similarly, to . Specifically, , we first begin with the denominator of d HBD(SIC) evaluate limΩX →∞ d HBD(SIC) f ,2 f ,2 limΩX →∞ (Ω X )l−q−1 = 0 when l ≤ q and (Ω X )l−q−1 = 1 when l = q + 1. For (Ω X )−m−1 , limΩX →∞ (Ω X )−m−1 = 0 for m ≥ 0 and for (Ω X )−n−2 , limΩX →∞ (Ω X )−n−2 = 0 for n ≥ 0. In the numerator, (l − q − 1) (Ω X )l−q−2 = 0 when l = q + 1. Additionally, limΩX →∞ (Ω X )−m−2 = 0 when m ≥ 0 and limΩX →∞ (Ω X )−n−3 = 0 when n ≥ 0. In the presence of interference at AS-2, (28) shows that improvements to outage probability → 0 as Ω X → ∞ for i ∈ {I I, SIC}. For the II at AS-2 progressively diminishes since d HBD(i) f ,2 detector, increasing Ω X results in strong interference. As a consequence, there is no improvement 16 to the overall SINR. Hence, the II detector is unsuitable in strong interference environments. Similarly, for the SIC detector, increasing Ω X causes xgs [t] to be stronger, making the detection and subtraction of x1 [t] increasingly challenging at stage 1 of the SIC detector. Hence, α1,2 must either increase (for the II detector) or decrease (for the SIC detector) at high Ω X for HBD-ACS to see meaningful improvements in outage probability. C. Finite SNR Diversity Gain for HD Systems Let the finite SNR diversity gain at GS and AS-2 be defined as d HD f ,i , i ∈ {gs, 2}, respectively, with R1 and Rgs assumed to be constants with average received power Ω = Ω X . Then, the finite SNR diversity gain at GS and AS-2 are presented in the following theorem. Theorem 4: The finite SNR diversity gain at GS and AS-2 operating in HD mode are given in (29) and (30), respectively. −Ω X Õ HD  α m, 1, K , γ (−m − 1)(Ω X )−m−2 d HD =  X 1 th,gs f ,gs HD Pr Ogs m≥0 −Ω X Õ HD  −m−2 α m, α , K , γ . d HD =  g,2 X gs th,2 (−m − 1)(Ω X ) f ,2 HD Pr O2 m≥0 (29) (30) Proof: The expressions in (29) and (30) can be obtained by respectively substituting (12) and (13) into (17). The HD outage behavior at GS and AS-2 can be analyzed from (29) and (30), respectively, and it enables the observation of changes in outage probability decay rate that is not visible at high Ω X . As Ω X → ∞, (29) and (30) can be evaluated to determine the asymptotic diversity gain as follows. Corollary 3: The asymptotic behavior of d HD f ,i , i ∈ {gs, 2} is lim d HD f ,i = 1. ΩX →∞ (31) Proof: At GS, the asymptotic behavior of d HD f ,gs can be easily evaluated after some simplifications as shown below: lim d HD f ,gs = lim ΩX →∞ ΩX →∞ − Í  HD m, 1, K X1, γth,gs (−m − 1)(Ω X )−m .  Í HD −m m≥0 α m, 1, K X1, γth,gs (Ω X ) m≥0 α (32) From (32), It can be seen that limΩX →∞ (Ω X )−m = 1 when m = 0, and limΩX →∞ (Ω X )−m = 0 when m > 0. Thus, when evaluating (32), only m = 0 needs to be considered. The asymptotic behavior of d HD f ,2 can also be proven using the same approach. From (32), d HD f ,i → 1 as Ω X → ∞ for i ∈ {gs, 2} and it indicates that the HD system achieves full diversity in the absence of interference at high Ω X , which is consistent with [20, Fig. 3]. 17 D. Finite SNR DMT Analysis for HBD Systems Let the finite SNR diversity gain at GS for a HBD system be defined as d HBD∗ f ,gs , with variable HBD = [1 + Ω ]r f − 1. Similarly, transmission rate R1HBD (Ω X ) = r f log2 (1 + Ω X ) and threshold γth,gs X , i ∈ {I I, SIC}, let the finite SNR diversity gain at AS-2 for a HBD system be denoted as d HBD(i)∗ f ,2 HBD (Ω ) = r log (1+Ω ) and threshold γ HBD = [1+Ω ]r f −1. with variable transmission rate Rgs X f X X 2 th,2 The finite SNR diversity gains at GS and AS-2 are presented in the following theorems. Theorem 5: At GS, the finite SNR diversity gain is given as Õ Õ  (q + 1)! −Ω X l1 l2 M {Ysi,1 }M {Ysi,2 } α q, 1, K , 1 d HBD∗ =  X 1 f ,gs HBD l1 ! · l2 ! · l3 ! Pr Ogs q≥0 l +l +l =q+1 1 2 3 × g(q, l1 + l2 − q − 1, Ω X , r f ), (33) HBD b=Ω b X and γ = γ HBD = [1 + Ω X ]r f − 1 and O = Ogs Proof: Let Ω = Ω X , Ω . Then, d HBD∗ th,gs f ,gs can be obtained through algebraic manipulations by substituting (6) into (21). Theorem 6: At AS-2, the finite SNR diversity gain with II and SIC detectors are:   q+1 ÕÕ  q+1 −Ω X HBD(I I)∗ = d f ,2 M {Y1l }g(q, l − q − 1, Ω X , r f ) (34) α q, αg,2, K Xgs , 1 HBD(I I)  l Pr O2 q≥0 l=0 " !   q+1 Õ Õ  q + 1 −Ω X HBD(SIC)∗ l M {Xgs }g(q, l − q − 1, Ω X , r f ) α q, α1,2, KY1, 1 = d f ,2 HBD(SIC)  l Pr O2 q≥0 l=0 + Õ m≥0 n Õ i+1 ÕÕ   α m, αg,2, K Xgs , 1 g(m, −m − 1, Ω X , r f ) − α i, α1,2, KY1, 1 × α n − i, αg,2, K Xgs , 1  i+1  j n≥0 i=0 j=0 j +n−i+1 !# g( j + n + 1, −n − 2, Ω X , r f ) . (35) b=Ω b X and γ = γ HBD = [1 + Ω X ]r f − 1 and O = O HBD,i, i ∈ {I I, SIC}. Proof: Let Ω = Ω X , Ω th,2 2 HBD(I I)∗ Then, similar to (33), d f ,2 HBD(SIC)∗ and d f ,2 can be obtained through algebraic manipulations by respectively substituting (8) and (10) into (21). In the presence of interference at GS and AS-2, DMT at low-to-moderate Ω X can be analyzed from (33), (34) and (35). It reveals the interference scenarios in which the II or SIC detectors achieves better diversity gain than HD systems. E. Finite SNR DMT Analysis for HD Systems Let the finite SNR HD diversity gain at GS be defined as d HD∗ f ,gs . To ensure fair comparison, we let the variable HD date rate be twice the variable HBD data rate. Let R1HD (Ω X ) = 2r f log2 (1+Ω X ) 18 HD be the variable transmission rate at AS-1 with threshold γth,gs = [1+Ω X ]2r f −1. Similarly at AS-2, let the finite SNR HD diversity gain at AS-2 be defined as d HD∗ f ,2 with variable transmission rate HD (Ω ) = 2r log (1 + Ω ) and threshold γ HD = [1 + Ω ]2r f − 1. The closed-form expressions Rgs X f X X 2 th,2 for the finite SNR diversity gains at GS and AS-2 are presented in the following theorem. Theorem 7: For a variable transmission rate scheme, the finite SNR diversity gain at GS and AS-2 are given in (36) and (37), respectively.  −Ω X Õ α m, 1, K X1, 1 g(m, −m − 1, Ω X , 2r f ) d HD∗ =  f ,gs HD Pr Ogs m≥0  −Ω X Õ d HD∗ = α m, αg,2, K Xgs , 1 g(m, −m − 1, Ω X , 2r f ).  f ,2 HD Pr O2 m≥0 (36) (37) Proof: The expressions in (36) and (37) can be obtained through algebraic manipulations by respectively substituting (12) and (13) into (21). In the absence of interference, (36) and (37) can be used to evaluate the DMT at GS and AS-2, providing a benchmark that can be used in evaluating the performance of the II and SIC detectors in HBD systems. F. System Level Finite SNR Diversity Gain and DMT The system level finite SNR diversity gain and DMT for the multi-user system in Fig. 1 will be used as a metric to compare HBD and HD systems. For fixed and variable transmission rate schemes, the system level finite SNR diversity gain and DMT are given in (38) to (41), respectively. β d f ,system = min   β d HBD f ,gs , d f ,2   HD HD d HD f ,system = min d f ,gs, d f ,2   β∗ β∗ , d d f ,system = min d HBD∗ f ,gs f ,2   HD HD∗ HD∗ d f ,system = min d f ,gs , d f ,2 (38) (39) (40) (41) where β ∈ {HBD(I I), HBD(SIC)}. Quantifying the finite SNR diversity gain and DMT in (38) to (41) provides insights into the degree of improvements in outage performance at the system level, which will be further discussed in Section V. 19 10 Outage Probability at GS (II) 0 HBD(II) - ǫ=0.01, α g,g HBD(II) - ǫ=0.01, α =1 4 HBD(II) - ǫ=0.001, αg,g=1 10 Finite SNR Diversity Gain at GS (II) 4.5 HBD(II) - ǫ=0.01, α HBD(II) - ǫ=0.01, αg,g=1.5 -2 Ideal HBD - α =1 =1.5 g,g =0 HD 3 10 -4 g,g 2.5 df Outage Probability Ideal HBD - αg,g=0 HD Simulation =1 g,g HBD(II) - ǫ=0.001, αg,g=1.5 3.5 HBD(II) - ǫ=0.001, αg,g=1.5 g,g HBD(II) - ǫ=0.001, α 2 10 -6 1.5 1 10 -8 0.5 10 -10 0 0 5 10 15 20 25 30 0 5 10 15 20 25 30 ΩX (dB) ΩX (dB) (a) Outage probability comparison at GS (b) Finite SNR diversity gain comparison at GS Fig. 2. Outage probability and finite SNR diversity gain at GS (II detector) for phase noise strength γφ2 = −130dBm. V. N UMERICAL R ESULTS In this section, numerical results pertaining to the outage probabilities and finite SNR diversity gains at GS, AS-2 and system level are discussed. Monte Carlo simulations are conducted with 109 samples to verify the accuracy of the outage probability computations. In addition, all Rician K factors are fixed at 15, i.e., K X1 = KYsi,1 = K Xgs = KY1 = 15, with σg2 = σ22 = −115dBm, HD = R HBD = 1 for fair comparison between the HBD and HD systems. Rsum sum A. Finite SNR Diversity Gain and Outage Analysis 1) Impact of Residual SI at GS: The HBD outage probability at GS, given in (6), is shown in Fig. 2a. The ideal HBD and the HD outage probability are also plotted in Fig. 2a as a benchmark comparison. The ideal HBD outage probability can be obtained from (6) with αg,g = 0 while the HD outage probability at GS is obtained using (12). From Fig. 2a, (7) is validated since it can  HBD is close to the ideal HBD case, i.e., no interference, at low-to-moderate be seen that Pr Ogs  HBD is higher as SI channel average received power (Ω X ) and vice-versa. As expected, Pr Ogs estimation error (ǫ) is increased. In addition, increasing the strength of the residual SI (αg,g ) degrades the outage performance more than the increase in ǫ since a larger αg,g corresponds to  HBD a higher average residual SI power, with phase noise (γφ2 ) scaled accordingly. In fact, Pr Ogs approaches the ideal HBD case when αg,g = 1, ǫ = 0.001 at low Ω X in Fig. 2a. Hence, sufficient SI mitigation is needed in order for the FD-enabled GS to outperform the HD-enabled GS. 20 Outage Probability at AS-2 10 0 Finite SNR Diversity Gain at AS-2 4.5 HBD(II) - α 4 HBD(II) - α 1,2 1,2 =0.5 =0.1 HBD(SIC) - α 3.5 10 -2 1,2 =5 =10 1,2 =0 HD 3 10 1,2 Ideal HBD - α 2.5 -4 df Outage Probability HBD(SIC) - α 2 HBD(II) - α 10 -6 HBD(II) - α 1,2 1,2 =0.5 1.5 =0.1 HBD(SIC) - α 1,2 =5 1 HBD(SIC) - α1,2=10 Ideal HBD - α 10 1,2 =0 0.5 HD Simulation -8 0 0 5 10 15 20 25 ΩX (dB) (a) Outage probability comparison at AS-2 30 0 5 10 15 20 25 30 ΩX (dB) (b) Finite SNR diversity gain comparison at AS-2 Fig. 3. Outage probability and finite SNR diversity gain at AS-2 (II and SIC detectors) for αg,2 = 1, i.e., link between GS and AS-2 has same distance as the reference link (d1,g ). The finite SNR diversity gain at GS, given in (24), is shown in Fig. 2b. The ideal HBD and HD finite SNR diversity gain at GS are also similarly obtained from (24), with αg,g = 0, HD and (29), respectively. From Fig. 2b, it can be seen that d HBD f ,gs peaks at Ω X = 2dB while d f ,gs peaks at Ω X = 6dB. Additionally, (25) and (31) are also confirmed in Fig. 2b as Ω X → ∞ and is also corroborated in Fig. 2a, where the slope of the outage probability curves become constant as Ω X → ∞. In other words, the FD-enabled GS becomes interference-limited at high Ω X . Interestingly, in the absence of interference at the FD-enabled GS, d HBD f ,gs → 1 as Ω X → ∞ since only SNR needs to be considered at GS. From the finite SNR diversity gain and outage analysis at GS, Fig. 2a and Fig. 2b shows that residual SI is the performance limiting factor for the FD-enabled GS. Therefore, it is important to sufficiently mitigate SI at each of the cascaded stages in Fig. 1 in order to keep the strength of the residual SI low for effective operation of the FD-enabled GS. 2) Impact of Interference at AS-2: The HBD outage probabilities at AS-2 for both II and SIC detectors are shown in Fig. 3a. The II and SIC detector outage probabilities are computed from (8) and (10), respectively, while the ideal HBD and HD outage probabilities are computed from (8) with α1,2 = 0, and (13), respectively. From Fig. 3a, the II detector at AS-2 outperforms the HD mode at low-to-moderate Ω X when inter-AS interference (α1,2 ) is weak and it validates the observations made when evaluating limα1,2 →L E {Y1l } for L ∈ {0, ∞} in Section III-A2. The trend in Fig. 3a also suggests that the further reduction in α1,2 will enable the II detector at AS-2 to attain the ideal HBD outage performance for moderate Ω X , which is expected since α1,2 → 0 21 corresponds to diminishing levels of interference at AS-2. The SIC detector performs better than the HD mode at the low-to-moderate Ω X when interference is strong, e.g., α1,2 = 10, since stage 1 of the SIC detector is more likely to detect and subtract x1 [t]. The resultant signal at stage 2 of the SIC detector is thus almost interference-free. As α1,2 increases, the SIC detector performance approaches that of the ideal HBD case due to the near perfect cancellation of interference in the first stage. When Ω X > 10dB for α1,2 ∈ {5, 10}, an error floor is present which verifies (28). Similar error floor observations are also made for the II detector and it indicates that the II and SIC detectors become interference-limited at high Ω X . From a practical perspective, the trend in Fig. 3a shows that the II detector is well suited for en route scenarios with less congested flight routes such as those over sparsely populated or oceanic regions since the II detector experiences weak interference due to path loss as a result of large inter-aircraft or aircraft to GS distance. On the other hand, the SIC detector is suitable for use in congested airspace scenarios such as the landing or even continental en route scenarios as interference from nearby aircrafts can be effectively removed. Although HD-ACS has superior outage performance compared to the II and SIC detectors at high Ω X , the interference-limited HBD detectors can meet typical QoS requirements, e.g., frame error rate ≤ 10−3 . I) , at AS-2 are shown in Fig. 3b. Both the and d HBD(SIC) The finite SNR diversity gains, d HBD(I f ,2 f ,2 finite SNR HBD and HD diversity gains are obtained from (26) and (30), respectively. Similarly, the ideal finite SNR HBD diversity gain is obtained from (26) with α1,2 = 0. A trend similar I) peaking and d HBD(SIC) to what was seen in Fig. 2b can be found in Fig. 3b, with d HBD(I f ,2 f ,2 HBD(I I) at Ω X = 2dB, and d HD f ,2 peaking at Ω X = 6dB. As expected, reducing α1,2 causes d f ,2 to perform close to the ideal HBD case at low Ω X . Fig. 3b also confirms (28) for both the II and SIC detectors. It is clear that the SIC detector can attain an outage probability decay rate that is HBD(SIC) similar to the ideal HBD case when Ω X ≤ 5dB. Further increasing α1,2 will enable d f ,2 to be almost identical to the ideal HBD case at Ω X ≤ 5dB since the system becomes noise-limited rather than interference-limited. The trends in Fig. 3b are also reflected in Fig. 3a since the slope of the outage probability curves behave as indicated in (28) and (31) as Ω X → ∞. 3) Impact of Interference at System Level: Fig. 4a and Fig. 4b respectively shows the outage probability and finite SNR diversity gain at the system level. The system level outage probability is computed from (14) and (15) while system level finite SNR diversity gain is computed from HBD(I I) is dominated by the II (38) and (39). Through numerical analysis, we observed that Pout,system   HBD < Pr O HBD(I I) detector at AS-2 for α1,2 ∈ {0.1, 0.5} and 0dB ≤ Ω X ≤ 30dB, i.e., Pr Ogs 2 22 10 System Level Outage Probability 0 System Level Finite SNR Diversity Gain 4.5 HBD(II) - ǫ ∈ {0.01,0.001}, α 4 HBD(II) - ǫ ∈ {0.01,0.001}, α 1,2 1,2 =0.5 =0.1 HBD(SIC) - ǫ ∈ {0.01,0.001}, α 10 -2 HBD(SIC) - ǫ ∈ {0.01,0.001}, α 3.5 = 0, α g,g =5 =10 =0 HD 3 10 1,2 1,2 -4 2.5 df Outage Probability Ideal HBD - α 1,2 2 10 -6 HBD(II) - ǫ ∈ {0.01,0.001}, α1,2=0.5 1.5 HBD(II) - ǫ ∈ {0.01,0.001}, α1,2=0.1 HBD(SIC) - ǫ ∈ {0.01,0.001}, α1,2=5 10 -8 HBD(SIC) - ǫ ∈ {0.01,0.001}, α 1,2 1 =10 Ideal HBD - α1,2=0, αg,g=0 0.5 HD Simulation 10 -10 0 0 5 10 15 20 25 30 0 5 10 15 20 25 30 Ω (dB) Ω (dB) X X (a) System level outage probability (b) System level finite SNR diversity gain Fig. 4. System level outage probability and finite SNR diversity gain (II and SIC detectors) for αg,2 = 1,αg,g = 1,γφ2 = −130dBm, ǫ ∈ {0.01, 0.001}. because inter-AS interference at AS-2 is stronger than the residual SI experienced at GS. Thus, HBD(I I) unless interalthough not shown in the figure, increasing αg,g or ǫ does not affect Pout,system HBD(I I) HD AS interference is decreased. It can also be observed from Fig. 4a that Pout,system ≤ Pout,system HBD(I I) HD ≤ Pout,system when Ω X ≤ 4dB, α1,2 = 0.5. When α1,2 = 0.1, Pout,system for Ω X ≤ 11dB. In fact, HBD(I I) Pout,system approaches that of the ideal HBD case when α1,2 is decreased due to the near absence of inter-AS interference at the II detector and it also explains the trend seen in Fig. 4b where it I) approaches that of the ideal HBD case when α1,2 is decreased. In other can be seen that d HBD(I f ,system HBD(I I) words, the decay of Pout,system approaches that of the ideal HBD case when inter-AS interference weakens, as reflected in Fig. 4b, for Ω X ≤ 5dB. Therefore, when an II detector is used at AS-2, I) HBD(I I) . and d HBD(I the inter-AS interference is the limiting factor for both Pout,system f ,system HBD(SIC) When AS-2 adopts an SIC detector, Pout,system is dominated by GS when Ω X ≤ 4dB and α1,2 = 5. Similar trends for the SIC detector are also seen in Fig. 4b for Ω X ≤ 5dB. When HBD(SIC) is dominated by AS-2 and it can be explained from the perspective of Ω X > 4dB, Pout,system the two-stage SIC detector at AS-2. When α1,2 = 5, x1 [t] is five times stronger than the SOI from GS (xgs [t]). In addition, at stage 1 of the SIC detector, noise power (σ22 ) is stronger than xgs [t] when Ω X ≤ 4dB. Thus, the SIC detector is more likely to detect and cancel x1 [t] which   HBD > Pr O HBD(SIC) due to residual SI at GS. When Ω > 4dB, σ 2 will be results in Pr Ogs X 2 2 weaker than xgs [t] at stage 1 of the SIC detector. Consequently, the SIC detector is less likely to   HBD(SIC) HBD < Pr O HBD(SIC) . When α detect and cancel x1 [t], leading to Pr Ogs 1,2 = 10, Pout,system is 2 23 Finite SNR DMT at GS (II) 2 HBD(II) - ǫ=0.01, α 1.8 g,g HBD(II) - ǫ=0.001, α HBD(II) - ǫ=0.01, α 1.6 =1 g,g g,g =1 =1.5 HBD(II) - ǫ=0.001, αg,g=1.5 Ideal HBD - αg,g=0 1.4 HD d * f 1.2 1 0.8 0.6 0.4 0.2 0 0 0.2 0.4 0.6 r Fig. 5. Finite SNR DMT at GS (II detector) for γφ2 0.8 1 f = −130dBm, Ω X = 10dB. HBD(SIC) dominated by GS for Ω X ≤ 10dB due to stronger interference at AS-2, with Pout,system close to HBD(SIC) that of the ideal HBD case. Further increasing α1,2 enables Pout,system to reach near-ideal HBD performance for a wider Ω X range due to the increased likelihood of successfully detecting and canceling x1 [t], thus explaining the trend in Fig. 4b. Hence, the strength of the interference from HBD(SIC) when a SIC detector and d HBD(SIC) AS-1 (α1,2) is the main limiting factor for both Pout,system f ,system is used at AS-2. From Fig. 4a and Fig. 4b, the outage and finite SNR diversity gain analysis has highlighted the feasibility of HBD-ACS over legacy HD-ACS in weak and strong interference scenarios through the II and SIC detectors, respectively. For instance, weak and strong interference scenarios could involve en route flights over sparely and densely populated airspace, respectively. From the aeronautical perspective, the proposed HBD-ACS has better reliability over HD-ACS while providing more throughput than legacy HD systems. B. Finite SNR DMT Analysis 1) Impact of Residual SI at GS: Fig. 5 shows the finite SNR diversity gain at GS. The finite SNR diversity gain (d HBD∗ f ,gs ) is computed from (33). The ideal HBD finite SNR diversity gain is also computed from (33) with αg,g = 0 while the HD finite SNR diversity gain (d HD∗ f ,gs ) is computed from (36). From Fig. 5, it is evident that the stronger residual SI due to SI channel estimation error (ǫ) or phase noise (γφ2 ) reduces d HBD∗ f ,gs . Increasing the strength of the residual 24 Finite SNR DMT at AS-2 2 HBD(II) - α1,2=0.1 HBD(II) - α1,2=0.01 1.8 HBD(SIC) - α1,2=14.3 HBD(SIC) - α1,2=15 HBD(SIC) - α1,2=100 1.6 Ideal HBD - α1,2=0 HD 1.4 d *f 1.2 1 0.8 0.6 0.4 0.2 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 rf Fig. 6. Finite SNR DMT at AS-2 (II and SIC detector) for αg,2 = 1, Ω X = 10dB. SI (αg,g ) affects d HBD∗ more than increasing the SI channel estimation error (ǫ) since the effect f ,gs of phase noise (γφ2 ) on the residual SI is amplified. From the outage probability perspective, increasing residual SI results in a slower decay rate of the outage probability, which lowers d HBD∗ f ,gs . However, it does not imply that outage probability is better when a higher maximum is attained. Nonetheless, the range of r f for which d HBD∗ ≥ d HD∗ value for d HBD∗ f ,gs f ,gs f ,gs increases when the strength of the residual SI (αg,g ) decreases and vice versa. Therefore, FD-enabled GS can experience improved DMT as residual SI decreases, which is evident in Fig. 5 for αg,g = 1. Although d HBD∗ is limited by residual SI, the importance of proper SI mitigation is f ,gs again emphasized since it is still feasible for GS to be FD-enabled if operating at a higher r f is the objective of an ACS. 2) Impact of Interference at AS-2: Fig. 6 shows the finite SNR diversity gain at AS-2. The I)∗ ) is computed from (34) while the finite finite SNR diversity gain for the II detector (d HBD(I f ,2 ) is computed from (35). The ideal HBD SNR diversity gain for the SIC detector (d HBD(SIC)∗ f ,2 finite SNR diversity gain is computed from (34) with α1,2 = 0 while the HD finite SNR diversity gain (d HD∗ f ,2 ) is computed from (37). The trends seen in Fig. 6 are similar to what was seen in , i ∈ {I I, SIC} and d HD∗ [21, Fig. 4], with lower d HBD(i)∗ f ,2 observed as r f → 0. It has been pointed f ,2 out by Narasimhan [21] and Shin et al. [20] that Rician fading outage probability curves are influenced by Rician K factors. In particular, increasing the Rician K factor causes the slope of 25 System Level Finite SNR DMT 2 HBD(II) - ǫ ∈ {0.01,0.001}, α1,2=0.1 HBD(II) (α1,2=0.01), SIC (α1,2=100), ǫ=0.01 1.8 HBD(II) (α1,2=0.01), SIC (α1,2=100), ǫ=0.001 HBD(SIC) - ǫ ∈ {0.01,0.001}, α1,2=14.3 HBD(SIC) - ǫ=0.01, α1,2 = 15 1.6 HBD(SIC) - ǫ=0.001, α1,2 = 15 Ideal HBD - α1,2=0, αg,g=0 HD 1.4 d *f 1.2 1 0.8 0.6 0.4 0.2 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 rf Fig. 7. System level finite SNR DMT (II and SIC detectors) for αg,2 = 1, αg,g = 1, γφ2 = −130dBm, Ω X = 10dB. outage probability curves to become steeper [20, Fig. 2]. From a finite SNR DMT perspective, r f → 0 causes K Xgs to have less impact on the outage performance at AS-2. On the other hand, Fig. 6 also suggests that the II and SIC detectors are able to provide better reliability at higher multiplexing gains compare to HD systems. I)∗ ≥ d HD∗ At high multiplexing gains, if the inter-AS interference reduces, then d HBD(I f ,2 . On f ,2 HBD(I I)∗ the other hand, at low multiplexing gains, d f ,2 < d HD∗ f ,2 even at low inter-AS interference. I)∗ approaches that of the ideal HBD case as α1,2 → 0 since the signal at the In fact, d HBD(I f ,2 II detector is almost interference-free. As a consequence, the resultant outage probability decay rate becomes similar to that of the ideal HBD case. When a SIC detector is adopted at ASHBD(SIC)∗ at ≥ d HD∗ 2, d HBD(SIC)∗ f ,2 as inter-AS interference increases (for example, refer to d f ,2 f ,2 α1,2 = 14.3 in Fig. 6). As α1,2 → ∞, it becomes easier to detect and remove x1 [t] at the twostage SIC detector. When coupled with the lower threshold requirement of the SIC detector, as compared to HD systems, the SIC detector can potentially achieve superior diversity gains over HD systems in strong interference scenarios. Moreover, at large values of α1,2 , if the multiplexing HBD(SIC)∗ gain is high, the achievable d f ,2 matches the ideal HBD case. As shown in Fig. 6,at low is close to that of the ideal HBD case. Therefore, multiplexing gain, the achievable d HBD(SIC)∗ f ,2 the II and SIC detectors provides better reliability at higher multiplexing gains compared to HDACS in the presence of weak and strong interference, respectively. However, at low multiplexing gains, HD-ACS exhibited better reliability than the II and SIC detectors. 26 3) Impact of Interference at System Level: Fig. 7 shows the system level finite SNR diversity β∗ gain for HBD-ACS (d f ,system ) and HD-ACS (d HD∗ f ,system ) computed from (40) and (41), respectively, I)∗ > d HD∗ for β ∈ {HBD(I I), HBD(SIC)}. From Fig. 7, it is evident that d HBD(I f ,system and f ,system HBD(SIC)∗ d f ,system > d HD∗ f ,system as r f increases, and it enables an HBD-ACS to provide better reliability at higher multiplexing gain than HD-ACS since HBD-ACS requires a lower operating threshold than existing HD-ACS at both GS and AS-2. However, the degree of improvement that HBDACS has over HD-ACS is constrained by the strength of interference experienced at GS and AS-2 in the HBD-ACS. HBD(I I)∗ for When the II detector is adopted at AS-2 for weak interference scenarios, d HBD∗ f ,gs > d f ,2 HBD(I I)∗ α1,2 = 0.1. Reducing the strength of the inter-AS interference (α1,2 = 0.01) causes d f ,2 > HBD(I I)∗ d HBD∗ f ,gs , with lower SI channel estimation error (ǫ) corresponding to higher d f ,system . In the presence of strong interference at AS-2 (α1,2 = 100), adopting the SIC detector at AS-2 results HBD(SIC)∗ in d f ,2 > d HBD∗ f ,gs . However, when interference from AS-1 is not as strong, e.g., α1,2 ∈ . For α1,2 = 15 and ǫ = 0.01, residual SI has more impact > d HBD(SIC)∗ {14.3, 15}, then d HBD∗ f ,gs f ,2 HBD(SIC)∗ HBD(SIC)∗ when r f = 0.33. as r f increases because d HBD∗ on d HBD∗ f ,gs < d f ,2 f ,gs than K Xgs on d f ,2 From Fig. 7, the reliability of the HBD-ACS depends on the inter-AS interference at AS-2 for both II and SIC detectors and residual SI at GS. Furthermore, it is possible for the proposed HBD-ACS to attain finite SNR DMT curves that are identical to the ideal HBD case at sufficiently low residual SI. From Fig. 7, the trends show that the proposed HBD-ACS is a viable alternative to legacy HD-ACS in weak and strong interference scenarios. In particular, the proposed HBD-ACS can operate at a higher multiplexing gain than legacy HD-ACS, thus offering better throughput and reliability compared to the latter. VI. C ONCLUSION With the impending spectrum crunch faced by the aviation industry being an issue that must be tackled in the near future, an HBD-ACS consisting of an FD-enabled GS and two HD ASs simultaneously communicating on the same spectrum is proposed. Outage analysis was conducted to investigate the impact of interference on the proposed HBD-ACS. A closed-form outage probability expression for a SIC detector at AS-2 over Rician fading aeronautical channels was also derived. Closed-form outage expressions for the II detectors at AS-2 and GS and HDequivalent mode of operations are also presented as benchmark comparisons. Finite SNR diversity 27 gain expressions are also derived and presented for both HBD-ACS and HD-ACS, with high SNR behaviors proven. Through outage and finite SNR diversity gain analysis, it is established that residual SI is the main limiting factor at the FD-enabled GS. Therefore, the need for sufficient SI mitigation through the design of SI mitigation architectures is crucial, which must be properly addressed in a HBD-ACS. At AS-2, it is observed that interference from AS-1 is the main limiting factor for both II and SIC detectors. When performance is evaluated at the system level, the proposed HBD-ACS is found to be very suitable for weak and strong interference scenarios for the II and SIC detectors, respectively. The proposed HBD-ACS is also able to achieve superior outage performance and better diversity gains at low-to-moderate SNRs compared to existing HD-ACS for both weak and strong interference scenarios. Finite SNR DMT analysis has also revealed that HBD-ACS can achieve DMT curves that are equivalent to interference-free scenarios if residual SI is sufficiently suppressed, enabling HBD-ACS to be more reliable than HD-ACS at higher multiplexing gains while operating at low SNR ranges. Nonetheless, it should be pointed out that both the II and SIC detectors are not suitable for moderate interference scenarios. As a consequence, advance decoder schemes, e.g., jointdecoders, will be needed in such scenarios. To this end, work is on progress on evaluating the outage and finite SNR diversity gain for joint-decoders in moderate interference scenarios. In addition, the impact of Rican K factors on outage behavior in the aeronautical context as well as extending the outage probability derivations for combinations of Rician and Rayleigh fading aeronautical channels are also being investigated as part of future works. ACKNOWLEDGMENT This research is jointly funded by Airbus Singapore Pte Ltd and the Singapore Economic Development Board (EDB). A PPENDIX A P ROOF OF (10) Let Xgs be the average received power of the SOI with non-centered Chi-squared probabil! r   K Xgs +1 K Xgs (K Xgs +1) K Xgs +1 x , where ity density function (PDF) fXgs (x) = ΩX αg,2 exp −K Xgs − ΩX αg,2 x I0 2 ΩX αg,2 I0 (·) is the modified Bessel function of the first kind with zero order [35]. Similarly, let Y1 be the average received power of the interfering signal with non-centered Chi-squared PDF 28 fY1 (y) = KY1 +1 ΩX α1,2  exp −KY1 − KY1 +1 ΩX α1,2 y  I0 2 r KY1 (KY1 +1) ΩX α1,2 y ! . The closed-form SIC outage probabil- ity at AS-2 is equivalent to computing the sum of the areas of outage regions P1 and P2 , n o HBD(SIC) HBD ) = P1 +P2 . Let the outage regions be defined as P1 = Pr Y1 < γth,gs 1 + Xgs i.e.,Pr(O2 n o HBD HBD and P2 = Pr Y1 ≥ γth,2 (1 + Xgs ), Xgs < γth,2 . The expression for P1 can be rewritten as [15] P1 = ∫ 0 q+1 ÕÕ 0 = H BD (1+X ) ∞ ∫ γth,gs gs fY1 (y) fXgs (x)dydx HBD α(q, Ω X α1,2, KY1, γth,gs ) q≥0 l=0   q+1 l E {Xgs }, l (42) where E {·} represents the expectation function. The expression for P2 can be expressed as ∫ γ H BD ∫ ∞ th,2 fY1 (y) fXgs (x)dydx P2 = H BD (1+X ) γth,gs gs 0 = ∫ H BD γth,2 0 Í ©p Q 1 ­ 2KY1, « s HBD (1 + x) 2(KY1 + 1)γth,gs ª ® · fXgs (x)dx. Ω X α1,2 ¬ (43) α( j, Ω X αg,2, K Xgs , 1)x j . Thus, (43) can be rewritten as s ∫ γ H BD Õ HBD q 2(K Xgs + 1)γth,2 th,2 © © ª ª α( j, Ω X αg,2, K Xgs , 1)x j ® P2 = 1 − Q 1 ­ 2K Xgs , ­ ®− Ω X αg,2 0 « j≥0 « ¬ ¬ !   n+1 Õ Õ n+1 i HBD × (44) x dx. α(n, Ω X α1,2, KY1, γth,gs ) i n≥0 i=0  Í HBD ) n+1 n+1 x i and d( j) = α( j, Ω α , K , 1)x j , then the Let c(n) = α(n, Ω X α1,2, KY1, γth,gs X g,2 Xgs i=0 i From [34], fXgs (x) = j≥0 integral in (44) can be written as [34], [36] ! ∫ γ H BD Õ th,2 ©Õ ª c(n) ­ d( j)® dx 0 n≥0 « j≥0 ¬ ∫ γ H BD Õ Õ n th,2 = c(i)d(n − i)dx 0 = n ÕÕ n≥0 i=0 HBD α(i, Ω X α1,2, KY1, γth,gs )α(n − i, Ω X αg,2, K Xgs , 1) n≥0 i=0 = n Õ i+1 ÕÕ n≥0 i=0 j=0 ∫ i+1  Õ i+1 j=0 HBD α(i, Ω X α1,2, KY1, γth,gs )α(n j H BD γth,2 x j+n−i dx 0  HBD j+n−i+1  i + 1 (γth,2 ) . − i, Ω X αg,2, K Xgs , 1) j +n−i+1 j Combining (42) and (45), the expression in (10) can be obtained. (45) 29 In (43), Q 1 KY1 +1 HBD ΩX α1,2 (γth,gs )(1 power series if p 2KY1, r H BD (1+x) 2(KY1 +1)γth,gs ΩX α1,2 ! =1− Í HBD n≥0 α(n, Ω X α1,2, KY1 , γth,gs )(1 + x)n+1 if + x) ≥ 0 [34]. In addition, the PDF fXgs (x) can be expressed as a convergent K Xgs +1 ΩX αg,2 x ≥ 0 [34]. Assuming the power series in (44) is convergent, the resultant product of the power series in (45) will also be convergent [36]. Similarly in (42), the power HBD ≤ series is convergent if γth,gs (ΩX α1,2 )/(1+KY1 ) 2(ΩX αg,2 )/(1+K Xgs ) [37]. Therefore, the closed-form expression in (10) holds if the power series in (42) and (45) are convergent. R EFERENCES [1] ICAO, “Icao long-term traffic forecasts,” 2016. [2] N. Neji, R. De Lacerda, A. Azoulay, T. Letertre, and O. Outtier, “Survey on the future aeronautical communication system and its development for continental communications,” IEEE Trans. Veh. Technol., vol. 62, no. 1, pp. 182–191, 2013. [3] T. Z. H. Ernest, A. K. Krishna, A. Madhukumar, and R. P. Sirigina, “On the efficiency improvements to aeronautical waveforms and integrated modular avionics systems,” in IEEE/AIAA 35th Digit. Avionics Syst. Conf. (DASC), 2016. IEEE, 2016, pp. 1–8. [4] S. Li, R. D. Murch, and V. K. Lau, “Linear transceiver design for full-duplex multi-user mimo system,” in Proc. IEEE Int. Conf. Commun. (ICC), 2014, pp. 4921–4926. [5] M. Mohammadi, H. A. Suraweera, Y. Cao, I. Krikidis, and C. Tellambura, “Full-duplex radio for uplink/downlink wireless access with spatially random nodes,” IEEE Trans. Commun, vol. 63, no. 12, pp. 5250–5266, 2015. [6] Y. Jang, K. Min, S. Park, and S. Choi, “Spatial resource utilization to maximize uplink spectral efficiency in full-duplex massive mimo,” in Proc. IEEE Int. Conf. Commun. (ICC), 2015, pp. 1583–1588. [7] A. C. Cirik, S. Biswas, O. Taghizadeh, A. Liu, and T. Ratnarajah, “Robust transceiver design in full-duplex mimo cognitive radios,” in Proc. IEEE Int. Conf. Commun. (ICC). IEEE, 2016, pp. 1–7. [8] D. Kim, H. Lee, and D. Hong, “A survey of in-band full-duplex transmission: From the perspective of phy and mac layers,” IEEE Commun. Surveys Tut., vol. 17, no. 4, pp. 2017–2046, 2015. [9] A. Sabharwal, P. Schniter, D. Guo, D. W. Bliss, S. Rangarajan, and R. Wichman, “In-band full-duplex wireless: Challenges and opportunities,” IEEE J. Sel. Areas Commun., vol. 32, no. 9, pp. 1637–1652, 2014. [10] V. Tapio, “System scenarios and technical requirements for full-duplex concept,” DUPLO Deliverable D, vol. 1, 2013. [11] A. Sahai, G. Patel, C. Dick, and A. Sabharwal, “On the impact of phase noise on active cancelation in wireless full-duplex,” IEEE Trans. Veh. Technol, vol. 62, no. 9, pp. 4494–4510, 2013. [12] D. Bharadia, E. McMilin, and S. Katti, “Full duplex radios,” ACM SIGCOMM Computer Communication Review, vol. 43, no. 4, pp. 375–386, 2013. [13] Y.-D. Yao and A. U. Sheikh, “Investigations into cochannel interference in microcellular mobile radio systems,” IEEE Trans. Veh. Technol, vol. 41, no. 2, pp. 114–123, 1992. [14] P. S. Bithas and A. A. Rontogiannis, “Mobile communication systems in the presence of fading/shadowing, noise and interference,” IEEE Trans. Commun., vol. 63, no. 3, pp. 724–737, 2015. [15] N. B. Rached, A. Kammoun, M.-S. Alouini, and R. Tempone, “A unified moment-based approach for the evaluation of the outage probability with noise and interference,” IEEE Trans. Wireless Commun., vol. 16, no. 2, pp. 1012–1023, 2017. [16] M. O. Hasna, M.-S. Alouini, A. Bastami, and E. S. Ebbini, “Performance analysis of cellular mobile systems with successive co-channel interference cancellation,” IEEE Trans. Wireless Commun., vol. 2, no. 1, pp. 29–40, 2003. 30 [17] J. M. Romero-Jerez and A. J. Goldsmith, “Receive antenna array strategies in fading and interference: an outage probability comparison,” IEEE Trans. Wireless Commun., vol. 7, no. 3, pp. 920–932, 2008. [18] S. P. Weber, J. G. Andrews, X. Yang, and G. De Veciana, “Transmission capacity of wireless ad hoc networks with successive interference cancellation,” IEEE Trans. Inf. Theory, vol. 53, no. 8, pp. 2799–2814, 2007. [19] Z. Zhang, Z. Ma, M. Xiao, Z. Ding, and P. Fan, “Full-duplex device-to-device-aided cooperative nonorthogonal multiple access,” IEEE Trans. Veh. Technol, vol. 66, no. 5, pp. 4467–4471, 2017. [20] W.-Y. Shin, S.-Y. Chung, and Y. H. Lee, “Diversity–multiplexing tradeoff and outage performance for rician mimo channels,” IEEE Trans. Inf. Theory, vol. 54, no. 3, pp. 1186–1196, 2008. [21] R. Narasimhan, “Finite-snr diversity–multiplexing tradeoff for correlated rayleigh and rician mimo channels,” IEEE Trans. Inf. Theory, vol. 52, no. 9, pp. 3965–3979, 2006. [22] L. Zheng and D. N. C. Tse, “Diversity and multiplexing: A fundamental tradeoff in multiple-antenna channels,” IEEE Trans. Inf. Theory, vol. 49, no. 5, pp. 1073–1096, 2003. [23] R. U. Nabar, H. Bolcskei, and A. J. Paulraj, “Diversity and outage performance in space-time block coded ricean mimo channels,” IEEE Trans. Wireless Commun., vol. 4, no. 5, pp. 2519–2532, 2005. [24] L. Wang, Y. Cai, and W. Yang, “On the finite-snr dmt of two-way af relaying with imperfect csi,” IEEE Wireless Commun. Lett., vol. 1, no. 3, pp. 161–164, 2012. [25] X. Lin, M. Tao, Y. Xu, and R. Wang, “Outage probability and finite-snr diversity–multiplexing tradeoff for two-way relay fading channels,” IEEE Trans. Veh. Technol, vol. 62, no. 7, pp. 3123–3136, 2013. [26] K. Yang, H. Cui, L. Song, and Y. Li, “Efficient full-duplex relaying with joint antenna-relay selection and self-interference suppression,” IEEE Trans. Wireless Commun., vol. 14, no. 7, pp. 3991–4005, 2015. [27] A. R. Heidarpour, G. K. Kurt, and M. Uysal, “Finite-snr diversity-multiplexing tradeoff for network coded cooperative ofdma systems,” IEEE Trans. Wireless Commun., vol. 16, no. 3, pp. 1385–1396, 2017. [28] E. Haas, “Aeronautical channel modeling,” IEEE Trans. Veh. Technol, vol. 51, no. 2, pp. 254–264, 2002. [29] N. Zlatanov, E. Sippel, V. Jamali, and R. Schober, “Capacity of the gaussian two-hop full-duplex relay channel with residual self-interference,” IEEE Trans. Commun., vol. 65, no. 3, pp. 1005–1021, 2017. [30] R. Narasimhan, “Individual outage rate regions for fading multiple access channels,” in Proc. 2007 ISIT. IEEE, 2007, pp. 1571–1575. [31] T. Kwon, S. Lim, S. Choi, and D. Hong, “Optimal duplex mode for df relay in terms of the outage probability,” IEEE Trans. Veh. Technol, vol. 59, no. 7, pp. 3628–3634, 2010. [32] T. K. Baranwal, D. S. Michalopoulos, and R. Schober, “Outage analysis of multihop full duplex relaying,” IEEE Commun. Lett, vol. 17, no. 1, pp. 63–66, 2013. [33] P. C. Sofotasios, M. K. Fikadu, S. Muhaidat, Q. Cui, G. K. Karagiannidis, and M. Valkama, “Full-duplex regenerative relaying and energy-efficiency optimization over generalized asymmetric fading channels,” IEEE Trans. Wireless Commun., 2017. [34] S. András, A. Baricz, and Y. Sun, “The generalized marcum q-function: an orthogonal polynomial approach,” Acta Universitatis Sapientiae Mathematica, vol. 3, no. 1, pp. 60–76, 2011. [35] I. S. Gradshteyn and I. M. Ryzhik, Table of integrals, series, and products. Academic press, 2014. [36] A. Bartoszewicz and S. GłaÌğb, “Algebrability of conditionally convergent series with cauchy product,” Journal of Mathematical Analysis and Applications, vol. 385, no. 2, pp. 693–697, 2012. [37] N. B. Rached, A. Kammoun, M.-S. Alouini, and R. Tempone, “An exact power series formula of the outage probability with noise and interference over generalized fading channels,” in Proc. IEEE PIMRC, 2016, pp. 1–5.
7cs.IT
Heuristic algorithms for the Maximum Colorful Subtree problem Kai Dührkop1 , Marie A. Lataretu1 , W. Timothy J. White1,2 , and Sebastian Böcker1,3 arXiv:1801.07456v3 [cs.DS] 13 Feb 2018 1 Chair for Bioinformatics, Friedrich-Schiller-University, Jena, Germany 2 Berlin Institute of Health, Berlin, Germany 3 Contact: [email protected] Abstract. In metabolomics, small molecules are structurally elucidated using tandem mass spectrometry (MS/MS); this resulted in the computational Maximum Colorful Subtree problem, which is NP-hard. Unfortunately, data from a single metabolite requires us to solve hundreds or thousands of instances of this problem; and in a single Liquid Chromatography MS/MS run, hundreds or thousands of metabolites are measured. Here, we comprehensively evaluate the performance of several heuristic algorithms for the problem against an exact algorithm. We put particular emphasis on whether a heuristic is able to rank candidates such that the correct solution is ranked highly. We propose this “intermediate” evaluation because evaluating the approximating quality of heuristics is misleading: Even a slightly suboptimal solution can be structurally very different from the true solution. On the other hand, we cannot structurally evaluate against the ground truth, as this is unknown. We find that one particular heuristic consistently ranks the correct solution in a top position, allowing us to speed up computations about 100-fold. We also find that scores of the best heuristic solutions are very close to the optimal score; in contrast, the structure of the solutions can deviate significantly from the optimal structures. 1 Introduction Metabolomics characterizes the collection of all metabolites in a biological cell, tissue, organ or organism using high-throughput techniques. Liquid Chromatography Mass Spectrometry (LC-MS) is one of the predominant experimental platforms for this task. Today, a major challenge is to determine the identities of the thousands of metabolites detected in one LC-MS run. This is also true for related fields such as natural products research [23], biomarker discovery, environmental science, or food science. Tandem mass spectrometry (MS/MS) is used to derive information about the metabolites’ structures. Interpretation of the hundreds to thousands of MS/MS spectra generated in a single LC-MS run remains a bottleneck in the analytical pipeline [23]. MS/MS data is usually searched against spectral libraries [19], but only a small number of metabolites (around 2 %) can be identified in this manner [7]. Recently, computational methods have been developed that do not search in spectral libraries but rather in molecular structure databases [1, 2, 5, 6, 9, 15, 16, 18, 21, 22]. CSI:FingerID [9] has won several competitions on the identification of small molecules from MS/MS data4 [17]; the web service for CSI:FingerID currently analyzes more than 2000 queries a day. At the heart of CSI:FingerID and its variants [5,6] lies the computation of fragmentation trees, as these can be readily analyzed by kernel-based methods using multiple kernel learning [18]. Fragmentation trees were introduced in 2008 [4] and were initially targeted at the identification of the molecular formulas of small molecules; later, it was shown that the structure of fragmentation trees contains valuable information for structural elucidation of the underlying molecule [12, 13]. Computing an optimum fragmentation tree leads to the Maximum Colorful Subtree problem [4]. Unfortunately, this problem is NP-hard and also hard to approximate [10, 14]. Algorithms exist to solve the problem either heuristically [14] or exactly [4, 14, 24]. The problem is a variant of the well-studied Graph Motif problem [8, 11]. 4 http://casmi-contest.org/2017/results.shtml 2 Kai Dührkop, Marie A. Lataretu, W. Timothy J. White, and Sebastian Böcker Approximation algorithms are algorithms for (usually) NP-hard problems with provable guarantees on the distance of the returned solution to the optimal one. But in bioinformatics research, the objective function is usually only a “crutch” used to find the optimum structure, whereas the value of the objective function has little or no meaning. To this end, heuristics in bioinformatics are designed to find solutions structurally similar to the optimum solution or, even better, the biological ground truth. This makes it intrinsically difficult to evaluate the performance of these heuristics, as we have to define a measure on the structural similarity between the heuristic solution and the biological ground truth; furthermore, the biological ground truth has to be known. We will use an alternative way to evaluate the performance of a heuristic: For many applications, one biological instance results in a multitude of computational instances, corresponding to candidates or hypotheses; the score of the computational problem is used to rank these hypotheses. Although the ground truth may not be known for the structure of the best solution, we may have information regarding the correct candidate or hypothesis. To this end, we can evaluate a heuristic based on its ability to top-rank the correct candidate. We propose several heuristics for the Maximum Colorful Subtree problem, and evaluate these heuristics with regards to their ranking quality. We find that one particular heuristic allows us to quickly confine the set of candidates (molecular formulas of the precursor molecule). This constitutes a filter, such that optimum solutions have to be sought only for a (preferably small) subset of candidates. We also evaluate whether the structure of the constructed solutions is similar to the optimum solution. 2 The Maximum Colorful Subtree problem Let G = (V, E) be a node-colored, rooted, directed acyclic graph (DAG) with root r ∈ V and edge weights w : E → R. Let C(G) be the set of colors used in G, and let c(v) ∈ C(G) be the color assigned to node v ∈ V . We will consider subtrees T = (VT , ET ) of G rooted at r. Let C(T ) be the set of colors used in T . We say that T is colorful if all of its nodes have different colors. The Maximum Colorful Subtree problem asks to find a colorful r-rooted subtree T of G of maximum weight, where G is a DAG with node colors, edge weights and root r ∈ V . We may assume that G is (weakly) connected and that r is the unique source of G, as we can remove all nodes from the graph which cannot be reached by a path from the root r, without changing the optimal solution. We note that previous work on the problem also makes the assumption of a single source, albeit usually implicitly [4, 13, 14, 24]. From an algorithmic standpoint, problem variants with or without a given root are “basically equivalent”: Given an algorithm that does not assume a fixed root r, we can solve an instance of the problem variant with root r by introducing a superroot r∗ connected solely to r, sufficiently large edge weight w(r∗ , r) and a new color for r∗ . For the reverse direction, we solve the problem for every r ∈ V , then choose the best solution. But there are two peculiarities when computing fragmentation trees that are different from the general problem, and that we will make use of here: First, any DAG used for fragmentation tree computation is transitive: That is, uv ∈ E and vw ∈ E implies uw ∈ E. Second, a coloring c : V → C(G) of DAG G = (V, E) is order-preserving if there is an ordering ‘≺’ on the colors C(G) such that c(u) ≺ c(v) holds for every edge uv of G [10]. Computing fragmentation trees naturally results in order-preserving colors, as nodes can be colored by the fragment mass that is responsible for this node, and edges exist only between nodes from larger to smaller masses. The Maximum Colorful Arborescence problem [10] asks to find a colorful induced subtree T of G of maximum weight, where G is a DAG with order-preserving colors and edge weights. See [10] for Heuristic algorithms for the Maximum Colorful Subtree problem 3 24 -1 7 5 -6 0 5 6 7 2 3 2 0 -1 6 7 -6 3 0 -3 0 2 3 -3 5 -2 -3 0 0 1 4 5 -4 0 0 1 4 0 Fig. 1. Illustration of the Remove Dangling Subtrees (RDS) postprocessing. Left: Input tree, where each node v is labeled by its score D[v]. Right: Output tree of weight 24. numerous complexity results. Here, we will stick with the name “Maximum Colorful Subtree problem”, but nevertheless assume that the coloring is order-preserving, unless indicated otherwise. 3 Heuristics for the Maximum Colorful Subtree problem The following postprocessing methods can be applied to a tree T = (VT , ET ) after any heuristic: The Remove Dangling Edges (RDE) postprocessing iteratively removes edges uv from T , where v is a leaf and w(uv) < 0; this is repeated until no more such edges are found. In contrast, the Remove Dangling Subtrees (RDS) postprocessing does not consider a single edge at a time, but rather induced subtrees: Each node u ∈ VT is scored by the maximum weight of any induced subtree rooted in u. Score D[u] can be computed using dynamic programming: X D[u] = max{0, w(u, v) + D[v]} uv∈ET Clearly, D[u] ≥ 0. For each edge uv with w(u, v) + D[v] < 0 we remove uv and the subtree below it. Both postprocessings can be computed in O(|VT |) time using a tree traversal, as every edge is considered once and |ET | = |VT | − 1. Figure 1 shows an example of the RDS postprocessing. We now present heuristics for finding a colorful subtree with root r in a transitive DAG with order-preserving coloring and unique source r. – Kruskal-style. This heuristic sorts all edges of the graph by decreasing edge weight, then iteratively adds edges from the sorted list, ensuring that the growing subgraph is colorful and that each node has at most one incoming edges. Since r is the unique source of G, and since G is transitive, this will ultimately result in a colorful subtree of G. This heuristic is similar to Kruskal’s algorithm for computing an optimum spanning tree; it was called “greedy heuristic” in [4]. – Prim-style. This heuristic progresses similar to Prim’s algorithm for calculating an optimal spanning tree: The tree T = (VT , ET ) initially contains only the root r of G. In every step, we consider all edges uv with u ∈ VT and v ∈ / VT such that c(v) ∈ / C(VT ); among these, we choose the edge with maximum weight and add it to the tree. We repeat until all colors in the graph are used in the tree. This will usually result in a different tree than the Kruskal-style heuristic, due to the colorfulness constraint. – Insertion. This heuristic is a modification of the “insertion heuristic” from [14]. We again start with a tree T = (VT , ET ) containing only the root r of G. The heuristic greedily attaches nodes labeled with unused colors. For every node v with c(v) = c0 unused, and every node u already part of the solution, we calculate how much we gain by attaching v to u. To calculate this gain, 4 Kai Dührkop, Marie A. Lataretu, W. Timothy J. White, and Sebastian Böcker we take into account the score of the edge uv as well as the possibility of rerouting other outgoing edges of u through v: X  I(u, v) := w(uv) + w(vx) − w(ux) x∈VT ,w(vx)>w(ux) where we assume w(uv) = −∞ if uv ∈ / E. The node with maximum gain is then attached to the partial solution, and edges are rerouted as required. See [14] for details; different from there, we do not iterate over colors in some fixed order but instead, consider all unused colors in every step. – Top-down. The top-down heuristic [4] is also greedy, but adds paths beginning in the root to the partial solution. The partial solution initially contains only the root r of G. The heuristic greedily constructs a path starting at the root which is added to the partial solution; the next node of the path is chosen so that it maximizes the weight of the added edge, simultaneously ensuring that the partial solution remains colorful and does not violate the tree property. If no such edge exists, the algorithm restarts at the root, and searches for another path. It terminates if no edge at the root can be selected. In the resulting tree, all internal nodes but the root have exactly one child. This heuristic extends even simpler heuristics that attach all nodes to the root, which have been in frequent use for molecular formula determination from MS/MS data. – Critical Path1 . Again, we iteratively build the subtree; initially, the partial solution T contains only the root r of G. The score S[u] of a node u ∈ V is the maximum weight of a path p from u to any node v, such that C(p) ∩ C(VT ) ⊆ {c(u)}; that is, the path does not use nodes with colors already present in the tree, except for the color of the starting node. We can compute S[u] using the recurrence S[u] = maxuv∈E,c(v)∈C(V {0, S[v] + w(uv)} / T) (1) where we use that the coloring of G is order-preserving, since in that case no two nodes of the path have the same color. We further assume max ∅ = 0 when computing (1). We iterate over the ordered colors in reverse order, computing S[u] for all nodes u of the active color. The critical path p of maximum score can be found by backtracing from the maximum entry S[u] with u ∈ VT . We add p to T , then iterate, recomputing S for the new set of used colors C(Vt ). See Figure 2 for an example. – Critical Path2 . This heuristic also relies on critical paths, but adds, in each iteration, only the first edge of the critical path to the partial solution. We note that this heuristic does not dominate the Critical Path heuristic, meaning that in certain cases, the subtree computed by this heuristic has smaller weight than that computed by the Critical Path heuristic; see Figure 2 (right) for an example. – Critical Path3 . This heuristic combines the Insertion heuristic with the Critical Path heuristic: In each step the heuristic chooses the edge uv with u ∈ VT that maximizes the sum of critical path score and insertion score S[u] + I(v). – Maximum. All heuristics compute lower bounds of the maximum score; therefore the maximum score over all heuristic solutions is also a lower bound. Time complexity of the heuristics. Let n := |V |, m := |E|, and k := |C(G)|. Clearly, k ≤ n and in applications, we usually have k  n. Furthermore, |VT | ≤ k holds for the returned subtree T = (VT , ET ). – It is easy to check that the Kruskal-style heuristic has time complexity O(m log n) for sorting all edges according to weight. Connectivity testing can then be performed in sub-logarithmic time Heuristic algorithms for the Maximum Colorful Subtree problem 5 r 2 5 u 1 v z 2 3 y x Fig. 2. Left: Example for the Critical Path Heuristic. Nodes are labeled by score, solid lines show the tree, dashed lines the rest of the graph. Grayed-out nodes have colors already used in the subtree. Right: An example input graph for which Critical Path1 produces a better tree than Critical Path2 . Nodes v and z are the same color; all other nodes have distinct colors. The two solid edges are the suboptimal tree output by Critical Path2 . Critical Path1 initially chooses the path ruvx for a score of 6, then adds vy for a total of 8. Critical Path2 begins in the same way by choosing the first edge ru of the heaviest path for a score of 2, but in its second step it chooses the weight-5 edge rz, as the heaviest path starting with uv has weight 4. No further edges can be added, so the total weight is 7. per considered edge using a union-find data structure [20]; checking for colorfulness is easily accommodated by initially placing all nodes of the same color in the same component. The overall time complexity thus remains O(m log n). Similarly, the Prim-style heuristic requires O(m log n) time. – For the Insertion heuristic, computing gain I(u, v) for all u requires O(k 2 ), since u, x ∈ VT . Hence, attaching one v to the growing tree requires O(k 2 n) time, resulting in O(k 3 n) total running time. But there exists a more complicated yet faster implementation for this heuristic: For each v ∈ V , we maintain two scores, in(v) and out(v), which correspond to the two terms P on the RHS of the definition of I(u, v). Specifically, in(v) = maxu∈VT w(uv), and out(v) = x∈VT max{0, w(vx) − w(pT (x), x)}, where pT (x) is the parent of x in T for all x ∈ T . To choose the next node to insert, we look for the node v ∈ V maximizing in(v) + out(v), ignoring nodes of already-used colors, which takes O(n) time (and could in practice often finish early if we search in decreasing order of one of these terms, and know an upper bound on the other). We then perform a single O(k)-time scan to find its optimal parent in the tree, and then perform two further updates: First, for all u ∈ V , set in(u) ← max{in(u), w(vu)} and out(u) ← out(u) + w(uv) − w(pT (v), v). Second, for all x ∈ VT , check whether the incoming edge yx (i.e., y = pT (x)) can be improved by rerouting via v; if so, delete yx, insert vx and for all u ∈ V such that w(yx) ≤ w(ux), set out(u) ← max{0, out(u) − (w(vx) − w(yx))}. The second update needs O(kn) time per inserted node, for O(k 2 n) overall. – The Top-down heuristic searches at most k times for the maximum weight edge leaving a node; since there are O(n) such edges, the running time is O(kn). – For the Critical Path1 heuristic, we need O(m) time to compute values S[u] and to identify the path of maximum weight. This is repeated at most k − 1 times, resulting in a total running time of O(km). The same holds true for the Critical Path2 . For Critical Path3 we can again maintain an out(v) table that contains the score bonus we get for attaching a node in the intermediate tree as child of v and deleting its previous incoming edge. After each insertion of an edge into the intermediate tree we have to perform the two update operations on out which takes O(kn) per insertion. In total we need O(k 2 n + km) time to compute Critical Path3 . In applications, k 6 Kai Dührkop, Marie A. Lataretu, W. Timothy J. White, and Sebastian Böcker is very small and n  m, so the O(km) part for calculating the critical paths requires most of the computation time. Computing the k-best fragmentation trees exactly. Even if we do not trust the structural quality of the heuristic solution, the above heuristics allow us to speed up fragmentation tree computation: We first select a single candidate (molecular formula of the precursor) using one of the heuristics, then compute the optimal solution for this instance using an exact method [4, 14, 24]. In practice, this approach has two shortcomings: Even though certain heuristics show a very good performance in selecting the correct molecular formula (see below), this correct answer is not known to us in application; but we will observe that the computed fragmentation tree will often not be the optimum fragmentation tree, if we also consider other molecular formula candidates and corresponding instances. Even worse, it is usually not sufficient in application to select a single best candidate using the heuristic, then re-compute the fragmentation tree for the corresponding instance. Instead, we usually want to know optimal fragmentation trees for the k best-scoring candidate. This is independent of whether results are reported to the user, who wants to use fragmentation tree structure to survey if computations and, hence, the assigned precursor molecular formula are trustworthy; or, if we perform some downstream computational analysis based on fragmentation tree structure, such as CSI:FingerID [9]. In particular for “large” metabolites with mass beyond 600 Dalton, this is necessary because neither the heuristics nor the exact method will always allow us to find the correct candidate; only by considering several candidates, we can be sufficiently sure that the correct answer is present. We propose the following heuristic to compute optimum fragmentation trees for the kbest molecular formula candidates: First, we compute heuristic solutions for all candidates, and order molecular formula candidates according to the heuristic score. Next, we compute optimum fragmentation trees for the k best candidates; for small k, we can instead choose some fixed parameter, such as 10 candidates. We estimate the maximum ∆ ≥ 0 of differences between the score of the optimum solution and the corresponding heuristic solution, using those candidates where we know the exact solution. We now assume that the score difference is upper-bounded by ∆ for all candidates. We continue to process candidates and compute optimum fragmentation trees from the sorted list, updating the k-best candidates and the corresponding score threshold; we stop computations when the heuristic score of a candidate plus ∆ is smaller than the current score threshold. Clearly, our assumption made above may be violated for certain input, making this method a heuristic. 4 Data and Instances Details of how to transform the MS/MS spectrum of an (unknown) compound into one or more instances of the Maximum Colorful Subtree problem have been published elsewhere [3, 4]; we shortly recapitulate the process. We consider all molecular formulas from some ground set, such as, all molecular formulas from elements CHNOPS. We decompose the precursor mass into all possible candidate molecular formulas from this ground set; each candidate molecular formula corresponds to one instance. For each instance, we decompose the fragment peaks in the MS/MS spectrum, ensuring that each fragment molecular formula is a subformula of the candidate molecular formula for the precursor mass. These molecular formulas constitute the nodes of a graph; each node is colored by the peak it stems from. An edge is present between molecular formulas u, v if and only if v is a proper subformula of u. Now, both nodes and edges receive a certain weight [3], based both on prior knowledge (e.g., distribution of loss masses) and the data (e.g., mass difference between a peak and its hypothetical molecular formula); but as pointed in [4], we may assume that only Heuristic algorithms for the Maximum Colorful Subtree problem 7 80 difference in identification rate (percentage points) identified molecular formulas (%) 1 75 70 65 60 0 1 2 3 5 Critical Path 3 Critical Path 2 Critical Path 1 Kruskal­style Prim­style Insertion Top­down exact Maximum Critical Path 3 Critical Path 2 Critical Path 1 Kruskal­style Prim­style 4 1 2 3 4 5 ranking 6 7 Insertion Top­down exact Maximum 8 9 10 Fig. 3. Performance evaluation, finding the correct molecular formula. Left: Percentage of compounds where the correct molecular formula received the highest score. Note the zoom of the y axis. Right: Percentage point difference against exact computations; how often is the correct answer part of the top k output of each method? edges are weighted. Candidate molecular formulas of the precursor peak are ranked according to the weight of the maximum colorful subtree in this graph. SIRIUS 3.6 default weights are used, see [3]. To evaluate whether a heuristic is capable of ranking the correct molecular formula on the top position, we have to use reference data where the true compound structure is known for each MS/MS measurement. We use reference compounds from GNPS [23]; each reference compound is one instance, corresponding to several graphs (for the different molecular formula candidates of the precursor mass) we have to search in. We then filter instances: For example, we assume a mass accuracy of 10 ppm (parts per million), and discard compounds where the precursor mass is missing or outside outside this mass window. All details can be found in [3]. This leaves us with 4 050 compounds, each of which is then transferred to usually many instances of the Maximum Colorful Subtree problem. One reference compound resulted in between 1 and 21 748 candidate molecular formulas, with median 53 and average 263.8 candidates. To avoid proliferating running times, we consider only the 60 most intense peaks in a MS/MS spectrum that can be decomposed, which is again SIRIUS 3.6 default behavior. We fix the SIRIUS tree size parameter, which is usually adapted at runtime, at −0.5. In addition, we switch off SIRIUS’ spectral recalibration. 5 Results We applied all but the Critical Path heuristics using the RDS postprocessing. We do not evaluate the RDE postprocessing, as it is dominated by RDS (that is, the score is at least as good, in all cases) which, in turn, dominates solutions without postprocessing. Furthermore, both postprocessings are very fast in practice. For the Critical Path heuristics, RDS cannot improve a solution for variants 1 and 2; for variant 3 this is possible in principle, but very unlikely. To keep results of the Critical Path heuristics consistent, we disabled the RDS postprocessing for variant 3, too. All heuristics were implemented in Java 8. For the exact method, we use the Integer Linear Program (ILP) from [14] with the CPLEX solver 12.7.1 (IBM, https://www.ibm.com/products/ ilog-cplex-optimization-studio). First, we evaluated the power of the different heuristics to rank the correct answer (molecular formula) at the top position; see Fig. 3 (left). We also compared against the exact solution. We observe similar identification rates for the critical path heuristics, the maximum heuristic and the exact method. To test whether this trend is true not only for the top rank, but also for the top k 8 Kai Dührkop, Marie A. Lataretu, W. Timothy J. White, and Sebastian Böcker 107 1 month 106 105 1 day 104 1 hour running time (s) 103 102 1 minute 101 100 10­1 10­2 10­3 Critical Path 3 Critical Path 2 Critical Path 1 Kruskal­style Prim­style 10­4 10­5 10­6 0 20 40 60 computed instances (%) Insertion Top­down exact graph building Maximum 80 100 Fig. 4. Running times of the different methods. One instances consists of all graphs generated for one compound in the dataset, considering all decompositions of the precursor mass. For each method, instances are sorted with respect to running time, and we report amortized running times. We also report running times for constructing the instance DAGs and for the exact method. ranks, we also evaluated how often any method is capable to rank the correct answer in its top k, for varying k; see Fig. 3 (right). Identification rates differ much stronger when varying k for one method than for different methods and one k; to this end, we normalize identification rates by subtracting the identification rate of the exact method. We see that all heuristics but critical path result in inferior rankings, loosing one or more percentage points for most ranks. In contrast, the critical path heuristics rank solutions with comparable power as the exact method, and the later two variants often outperform the exact method. Somewhat surprisingly, the maximum over all heuristics performs even better than the best heuristic. Second, we compared running times of the different methods. Running times were measured using a single thread on an Intel E5-2630v3 at 2.40 GHz with 64 GB RAM. The total running time for the exact methods over all instances is almost one month, underlining the importance of speeding up computations. But also note that solving all instances exactly requires only about 100-fold the time required for constructing the instance graphs. For each method, we sorted all instances by running time; we then reported how much time is required to solve, say, the 90 % “easiest” instances for that method. Generally, this ordering is different for each method. For all methods, we observe that the “hardest” 5 % of the instances are responsible for most of the total running time; this has been observed before [3, 14]. In comparison to the exact method, all heuristics are very fast, and at least two orders of magnitude faster. In particular, each heuristic is faster than the method for constructing the instance graphs; running all heuristics, as required for the maximum heuristic, requires about the same time as the graph construction. Comparing heuristics’ running times, we see that the Kruskal-style heuristic is slowest; and that the first variant of the Critical Path heuristic is faster in practice than variants 2 and 3, but not significantly. Heuristic algorithms for the Maximum Colorful Subtree problem 9 1.0 0.8 200 150 0.6 0.4 Critical Path 3 Critical Path 2 Critical Path 1 Kruskal­style Prim­style Insertion Top­down Maximum 0.2 0.0 Critical Path 3 heuristic score relative to exact score 250 0 20 40 60 instances (%) sorted by score 80 100 50 0 50 100 50 0 50 100 exact method 150 200 250 Fig. 5. Left: Relative scores of the heuristics. For each Maximum Colorful Subtree instance, we consider the relative score in comparison the exact method at 100 %. For each method, instances are sorted with respect to relative score. Right: Comparison of the score of the Critical Path3 heuristic in comparison to the optimal score of the instance. For each compound, we consider only the true molecular formula candidate. Third, we compared the scores reached by the different heuristics to the scores of the exact solutions, see Fig. 5 (left). For each compound, we only considered the instance of the Maximum Colorful Subtree that corresponds to the true candidate molecular formula. We report scores relative to the exact solution (at 100 %), and sorted instances with respect to this relative score. In the resulting plot, it is not obvious which of the heuristics “Insertion”, “Kruskal-style” and “Critical Path1 ” should be preferred. We see that Critical Path3 heuristic and, hence, the maximum of all methods are able to compute (almost) optimal solutions for about 80 % of the instances. In turn, this means that even for these methods which perform excellent in ranking the correct answer, we miss the optimal solution in about 20 % of the instances. In addition, we compared scores of the Critical Path3 heuristic against the exact method in more detail, see Fig. 5 (right): We see that for instances where the heuristic does not find the optimal solution, the computed solution is only “slightly suboptimal” with respect to its score. In fact, Pearson correlation between the two measures is +1.00. Fourth, we evaluate the solution structure quality of the Critical Path3 heuristic. Unfortunately, the “true fragmentation tree” cannot be determined experimentally [13]. To this end, we compare heuristic tree structure vs. tree structures computed using the exact method. For each compound, we restrict the comparison to the true candidate molecular formula; for other candidate molecular formulas, the optimal tree cannot possibly be the “ ‘true fragmentation tree”. See Fig. 6. For tree sizes, we observe rather large deviations between heuristic and optimal trees; in contrast, the overall distribution of tree sizes is highly similar. But if we compare tree structures, we observe much larger differences between the Critical Path3 heuristic and the exact method: We measure structural similarity comparing either the set of node labels (fragments) or the set of edge labels (losses) of the two trees. We estimate the similarity of two (finite) sets A, B using the Jaccard similarity coefficient J(A, B) = |A ∩ B| / |A ∪ B| ∈ [0, 1]. We observe that more than 20 % of the heuristic trees differ from the corresponding optimal tree; for at least 10 %, this difference is significant. 10 Kai Dührkop, Marie A. Lataretu, W. Timothy J. White, and Sebastian Böcker Number of vertices for tree size parameter = 2.5 600 60 500 1.0 400 0.8 Jaccard similarity coefficient 40 count number of vertices 50 30 300 200 20 0.6 0.4 10 100 0.2 0 0 0.0 0 20 40 60 instances (%) 80 100 0 10 20 30 40 number of vertices 50 60 fragments losses 50 60 70 instances (%) 80 90 100 Fig. 6. Left: Size of the fragmentation tree. Instances are sorted with respect to the size of the optimal fragmentation tree (black); green bars indicate the corresponding tree sizes for the Critical Path3 heuristic. Middle: Distribution of tree sizes for the exact method (black) and the Critical Path3 heuristic (green). Right: Comparison of the fragmentation tree structure, optimal tree vs. the tree computed by the Critical Path3 heuristic. Note the zoom of the x axis. In all three cases, we consider only the true molecular formula candidate for each compound. 6 Conclusion We have presented heuristics for the Maximum Colorful Subtree problem. Our evaluation shows that the Critical Path3 heuristic is well-suited for choosing the correct candidate molecular formula, when applied to tandem mass spectrometry data of small molecules. Our evaluation sidesteps the catch-22 that we want to evaluate solutions based on structure and not score when, at the same time, the correct solution structure is not known. We have shown that the tree computed by the Critical Path3 heuristic is often identical to the optimal tree. Even when the heuristic returns a suboptimal solution, the score is usually very close to the optimal score. In contrast, the structure of the heuristic tree deviates significantly from the optimal tree for more than 20 % of the instances. To this end, we argue not to use this tree for downstream analysis, such as estimating chemical similarity based on fragmentation tree similarity [12] or machine learning [5, 6, 9, 18]: Preliminary evaluations clearly indicate that using trees computed by any heuristic, leads to significantly worse results for the downstream analysis. A back-of-the-envelope calculation indicates the problem: If we assume that 20 % of the heuristic trees are “structurally faulty”, then a pairwise comparison of trees will result in 36 % tree pairs where at least one of the trees is “structurally faulty”. Building an instance DAG requires more time than running any of the presented heuristics. We conjecture that there is only limited potential for speeding up the graph building phase. To this end, whereas searching for better (and not significantly slower) heuristics is still a valid undertaking, faster heuristics are of little practical use. It is worth mentioning that computing exact solutions for the NP-hard Maximum Colorful Subtree problem takes only about 100-fold the time needed for constructing the graph instances; further speed-up is possible using data reductions and a stronger ILP formulation of the problem from [24]. Even elaborate heuristics for a bioinformatics problem, which are capable of finding solutions with objective function value very close to the optimum, can result in solutions which are structurally very dissimilar from the optimum structure. We showed that this is not only a theoretical possibility, but happens regularly for real-world instances. This underlines the importance of finding exact solutions for bioinformatics problems; the structure of solutions found by heuristic, including local search heuristics such as Markov chain Monte Carlo, may deviate significantly from the optimal solution. Heuristic algorithms for the Maximum Colorful Subtree problem 11 Acknowledgments. WTJW funded by Deutsche Forschungsgemeinschaft (grant BO 1910/9). Availability. The Critical Path3 heuristic and the exact method are available trough the SIRIUS software (https://bio.informatik.uni-jena.de/software/sirius/) and also from GitHub (https://github.com/boecker-lab/sirius). Source code for all other heuristics will be made available upon request. Instances will be made available from our website. References 1. Allen, F., Greiner, R., Wishart, D.: Competitive fragmentation modeling of ESI-MS/MS spectra for putative metabolite identification. Metabolomics 11(1), 98–110 (2015) 2. Allen, F., Pon, A., Greiner, R., Wishart, D.: Computational prediction of electron ionization mass spectra to assist in GC/MS compound identification. Anal Chem 88(15), 7689–7697 (2016) 3. Böcker, S., Dührkop, K.: Fragmentation trees reloaded. J Cheminform 8, 5 (2016) 4. Böcker, S., Rasche, F.: Towards de novo identification of metabolites by analyzing tandem mass spectra. Bioinformatics 24, I49–I55 (2008), proc. of European Conference on Computational Biology (ECCB 2008) 5. Brouard, C., Bach, E., Böcker, S., Rousu, J.: Magnitude-preserving ranking for structured outputs. In: Zhang, M.L., Noh, Y.K. (eds.) Proc. of Asian Conference on Machine Learning. Proceedings of Machine Learning Research, vol. 77, pp. 407–422. PMLR (2017) 6. Brouard, C., Shen, H., Dührkop, K., d’Alché-Buc, F., Böcker, S., Rousu, J.: Fast metabolite identification with input output kernel regression. Bioinformatics 32(12), i28–i36 (2016), proc. of Intelligent Systems for Molecular Biology (ISMB 2016) 7. da Silva, R.R., Dorrestein, P.C., Quinn, R.A.: Illuminating the dark matter in metabolomics. Proc Natl Acad Sci U S A 112(41), 12549–12550 (2015) 8. Dondi, R., Fertin, G., Vialette, S.: Complexity issues in vertex-colored graph pattern matching. J Discrete Algorithms 9(1), 82–99 (2011) 9. Dührkop, K., Shen, H., Meusel, M., Rousu, J., Böcker, S.: Searching molecular structure databases with tandem mass spectra using CSI:FingerID. Proc Natl Acad Sci U S A 112(41), 12580–12585 (2015) 10. Fertin, G., Fradin, J., Jean, G.: Algorithmic aspects of the maximum colorful arborescence problem. In: Proc. of Theory and Applications of Models of Computation (TAMC 2017). Lect Notes Comput Sci, vol. 10185, pp. 216–230 (2017) 11. Lacroix, V., Fernandes, C.G., Sagot, M.F.: Motif search in graphs: Application to metabolic networks. IEEE/ACM Trans Comput Biology Bioinform 3(4), 360–368 (2006) 12. Rasche, F., Scheubert, K., Hufsky, F., Zichner, T., Kai, M., Svatoš, A., Böcker, S.: Identifying the unknowns by aligning fragmentation trees. Anal Chem 84(7), 3417–3426 (2012) 13. Rasche, F., Svatoš, A., Maddula, R.K., Böttcher, C., Böcker, S.: Computing fragmentation trees from tandem mass spectrometry data. Anal Chem 83(4), 1243–1251 (2011) 14. Rauf, I., Rasche, F., Nicolas, F., Böcker, S.: Finding maximum colorful subtrees in practice. J Comput Biol 20(4), 1–11 (2013) 15. Ridder, L., van der Hooft, J.J.J., Verhoeven, S., de Vos, R.C.H., Bino, R.J., Vervoort, J.: Automatic chemical structure annotation of an LC-MS(n) based metabolic profile from green tea. Anal Chem 85(12), 6033–6040 (2013) 16. Ruttkies, C., Schymanski, E.L., Wolf, S., Hollender, J., Neumann, S.: MetFrag relaunched: incorporating strategies beyond in silico fragmentation. J Cheminform 8, 3 (2016) 17. Schymanski, E.L., Ruttkies, C., Krauss, M., Brouard, C., Kind, T., Dührkop, K., Allen, F.R., Vaniya, A., Verdegem, D., Böcker, S., Rousu, J., Shen, H., Tsugawa, H., Sajed, T., Fiehn, O., Ghesquière, B., Neumann, S.: Critical Assessment of Small Molecule Identification 2016: Automated methods. J Cheminf 9, 22 (2017) 18. Shen, H., Dührkop, K., Böcker, S., Rousu, J.: Metabolite identification through multiple kernel learning on fragmentation trees. Bioinformatics 30(12), i157–i164 (2014), proc. of Intelligent Systems for Molecular Biology (ISMB 2014) 19. Stein, S.E.: Mass spectral reference libraries: An ever-expanding resource for chemical identification. Anal Chem 84(17), 7274–7282 (2012) 20. Tarjan, R.E.: A class of algorithms which require nonlinear time to maintain disjoint sets. J Comput System Sci 18(2), 110–127 (1979) 21. Tsugawa, H., Kind, T., Nakabayashi, R., Yukihira, D., Tanaka, W., Cajka, T., Saito, K., Fiehn, O., Arita, M.: Hydrogen rearrangement rules: Computational ms/ms fragmentation and structure elucidation using MSFINDER software. Analytical chemistry 88, 7946–7958 (2016) 12 Kai Dührkop, Marie A. Lataretu, W. Timothy J. White, and Sebastian Böcker 22. Verdegem, D., Lambrechts, D., Carmeliet, P., Ghesquière, B.: Improved metabolite identification with MIDAS and MAGMa through MS/MS spectral dataset-driven parameter optimization. Metabolomics 12(6), 1–16 (2016) 23. Wang, M., Carver, J.J., Phelan, V.V., Sanchez, L.M., Garg, N., Peng, Y., Nguyen, D.D., Watrous, J., Kapono, C.A., Luzzatto-Knaan, T., Porto, C., Bouslimani, A., Melnik, A.V., Meehan, M.J., Liu, W.T., Crüsemann, M., Boudreau, P.D., Esquenazi, E., Sandoval-Calderón, M., Kersten, R.D., Pace, L.A., Quinn, R.A., Duncan, K.R., Hsu, C.C., Floros, D.J., Gavilan, R.G., Kleigrewe, K., Northen, T., Dutton, R.J., Parrot, D., Carlson, E.E., Aigle, B., Michelsen, C.F., Jelsbak, L., Sohlenkamp, C., Pevzner, P., Edlund, A., McLean, J., Piel, J., Murphy, B.T., Gerwick, L., Liaw, C.C., Yang, Y.L., Humpf, H.U., Maansson, M., Keyzers, R.A., Sims, A.C., Johnson, A.R., Sidebottom, A.M., Sedio, B.E., Klitgaard, A., Larson, C.B., Boya P, C.A., Torres-Mendoza, D., Gonzalez, D.J., Silva, D.B., Marques, L.M., Demarque, D.P., Pociute, E., O’Neill, E.C., Briand, E., Helfrich, E.J.N., Granatosky, E.A., Glukhov, E., Ryffel, F., Houson, H., Mohimani, H., Kharbush, J.J., Zeng, Y., Vorholt, J.A., Kurita, K.L., Charusanti, P., McPhail, K.L., Nielsen, K.F., Vuong, L., Elfeki, M., Traxler, M.F., Engene, N., Koyama, N., Vining, O.B., Baric, R., Silva, R.R., Mascuch, S.J., Tomasi, S., Jenkins, S., Macherla, V., Hoffman, T., Agarwal, V., Williams, P.G., Dai, J., Neupane, R., Gurr, J., Rodríguez, A.M.C., Lamsa, A., Zhang, C., Dorrestein, K., Duggan, B.M., Almaliti, J., Allard, P.M., Phapale, P., Nothias, L.F., Alexandrov, T., Litaudon, M., Wolfender, J.L., Kyle, J.E., Metz, T.O., Peryea, T., Nguyen, D.T., VanLeer, D., Shinn, P., Jadhav, A., Müller, R., Waters, K.M., Shi, W., Liu, X., Zhang, L., Knight, R., Jensen, P.R., Palsson, B.Ø., Pogliano, K., Linington, R.G., Gutiérrez, M., Lopes, N.P., Gerwick, W.H., Moore, B.S., Dorrestein, P.C., Bandeira, N.: Sharing and community curation of mass spectrometry data with Global Natural Products Social molecular networking. Nat Biotechnol 34(8), 828–837 (2016) 24. White, W.T.J., Beyer, S., Dührkop, K., Chimani, M., Böcker, S.: Speedy colorful subtrees. In: Proc. of Computing and Combinatorics Conference (COCOON 2015). Lect Notes Comput Sci, vol. 9198, pp. 310–322. Springer, Berlin (2015)
8cs.DS
Formally Specifying and Proving Operational Aspects of Forensic Lucid in Isabelle Serguei A. Mokhov and Joey Paquet arXiv:0904.3789v1 [cs.LO] 24 Apr 2009 Department of Computer Science and Software Engineering Faculty of Engineering and Computer Science Concordia University, Montréal, Québec, Canada, {mokhov,paquet}@cse.concordia.ca Abstract. A Forensic Lucid intensional programming language has been proposed for intensional cyberforensic analysis. In large part, the language is based on various predecessor and codecessor Lucid dialects bound by the higher-order intensional logic (HOIL) that is behind them. This work formally specifies the operational aspects of the Forensic Lucid language and compiles a theory of its constructs using Isabelle, a proof assistant system. 1 Introduction As a part of the Intensional Cyberforensics project, we define a functional-intensional programming/specification language, called Forensic Lucid. The language is under active design and development including its syntax, semantics, the corresponding compiler, run-time, and interactive “development” environments [1,2] that we refer to as General Intensional Programming System (GIPSY) [3]. We approach the problem using Isabelle [4] as a proof assistant. Problem Statement. A lot of intensional dialects have been spawned from the functional intensional programming language called Lucid [5,6,7,8,9,10,11,12]. Lucid (see Section 1.2) itself was invented with a goal for program correctness verification [7,8]. While there were a number of operational semantics rules for compiler and run-time environments developed for all those dialects throughout the years, there was no a complete formal proof set of the rules of the languages. Yet another dialect of Lucid has been created to foster the research on intensional cyberforensics (see Section 1.3), called Forensic Lucid, which, in a large part is a union of the syntax and operational semantics rules from the comprising languages with the forensic extensions. In order to be a credible tool to use, for example, in court, to implement relevant tools for the argumentation, the language ought to have a solid scientific base, a part of which is formalizing the semantics the language and proving correctness of the programs written in it. Proposed Solution. In this work, we propose to begin validation of the Forensic Lucid constructs with the Isabelle prover assistant [4] and extend it to the comprising Lucid dialects as a whole. We proceed bottom-up from “core” Lucid dialects such as GIPL, Lucx, and Indexical Lucid and even their smaller decompositions as well as top-down from Forensic Lucid to arrive to a comprehensive set of proofs covering the dialects. 1.1 Intensional Logics and Programming Definitions. Intensional programming (IP) is based on intensional (or multidimensional) logics, which, in turn, are based on natural language understanding aspects (such as time, belief, situation, and direction). IP brings in dimensions and context to programs (e.g. space and time in physics or chemistry). Intensional logic adds dimensions to logical expressions; thus, a non-intensional logic can be seen as a constant or a snapshot in all possible dimensions. Intensions are dimensions at which a certain statement is true or false (or has some other than a Boolean value). Intensional operators are operators that allow us to navigate within these dimensions. Higher-order intensional logic (HOIL) is the one that couples functional programming as that of Lucid with multidimensional dataflows that the intensional programs can query an alter through an explicitly notion of contexts as first-class values [13,14]. An Example of Using Temporal Intensional Logic. Temporal intensional logic is an extension of temporal logic that allows to specify the time in the future or in the past. (1) E1 := it is raining here today Context: {place:here, time:today} (2) E2 := it was raining here before(today) = yesterday (3) E3 := it is going to rain at (altitude here + 500 m) after(today) = tomorrow Let’s take E1 from (1) above. Then let us fix here to Montreal and assume it is a constant. In the month of February, 2008, with granularity of day, for every day, we can evaluate E1 to either true or false: Tags: 1 2 3 4 5 6 7 8 9 ... Values: F F T T T F F F T ... If one starts varying the here dimension (which could even be broken down to X, Y , Z), one gets a two-dimensional evaluation of E1 : City: / 1 2 3 4 5 6 7 8 9 ... Montreal F F T T T F F F T ... Quebec F F F F T T T F F ... Ottawa F T T T T T F F F ... 1.2 Lucid Lucid [5,6,9,7,8] is a dataflow intensional and functional programming language. In fact, it is a family of languages that are built upon intensional logic (which in turn can be understood as a multidimensional generalization of temporal logic) involving context and demand-driven parallel computation model. A program written in some Lucid dialect is an expression that may have subexpressions that need to be evaluated at certain context. Given the set of dimension D = {dimi } in which an expression varies, and a corresponding set of indexes or tags defined as placeholders over each dimension, the context is represented as a set of <dimi : tagi > mappings and each variable in Lucid, called often a stream, is evaluated in that defined context that may also evolve using context operators [14,15,16,13]. The generic version of Lucid, GIPL [11], defines two basic operators @ and # to navigate in the contexts (switch and query). The GIPL was the first generic programming language of all intensional languages, defined by the means of only two intensional operators @ and #. It has been proven that other intensional programming languages of the Lucid family can be translated into the GIPL [11]. Please refer to Appendix A for the greater details about Lucid origins, variables as streams, random access to streams, and the basic operators. Since the Lucid family of language thrived around intensional logic that makes the notion of context explicit and central, and recently, a first class value [16,13,14,15] that can be passed around as function parameters or as return values and have a set of operators defined upon. We greatly draw on this notion by formalizing our evidence and the stories as a contextual specification of the incident to be tested for consistency against the incident model specification. In our specification model we require more than just atomic context values – we need a higher-order context hierarchy to specify different level of detail of the incident and being able to navigate into the “depth” of such a context. A similar provision by has already been made by the author [17] and earlier works of Swoboda et al. in [18,19,20,21] that needs some modifications to the expressions of the cyberforensic context. Some other languages can be referred to as intensional even though they may not refer to themselves as such, and were born after Lucid (Lucid began in 1974). Examples include hardware-description languages (HDLs, appeared in 1977) where the notion of time (often the only “dimension”, and usually progresses only forward), e.g. Verilog and VHDL. Another branch of newer languages for the becoming popular is aspect-oriented programming (AOP) languages, that can have a notion of context explicitly, but primarily focused on software engineering aspect of software evolution and maintainability. 1.3 Cyberforensic Analysis Cyberforensic analysis has to do with automated or semi-automated processing of and reasoning about electronic evidence, witnesses, and other details from cybercrime incidents (involving computers, but not limited to them). Analysis is one of the phases in cybercrime investigation, where the others focus on evidence collection, preservation, chain of custody, information extraction that precede the analysis. The phases the follow the analysis are formulation of a report and potential prosecution, typically involving expert witnesses. There are quite a few techniques, tools (hardware and software), and methodologies have been developed for all the briefly mentioned phases of the cybercrime investigation. A lot of attention has been paid to the tool development for evidence collection and preservation; a few tools have been developed to aid “browsing” data in the confiscated storage media, log files, memory, and so on. A lot less number of tools have been developed for case analysis of the data, and the existing commercial packages (e.g. Encase or FTK) are very expensive. Even less so there are case management, event modeling, and event reconstruction, especially with solid formal theoretical base. The first formal approach to the cybercrime investigation was the finitestate automata (FSA) approach by Gladyshev et. al [22,23]. The approach is complex to use and understand for non computer science or equivalent investigators. The aim of Forensic Lucid is to alleviate those difficulties, be sound and complete, expressive and usable, and provide even further usability improvement with the graphic interface that allow data-flow graph-based (DFG) programming that allows translation between DFGs and Lucid code for compilation and is implemented for Indexical Lucid in GIPSY already [24], and requires forensic extensions. While Forensic Lucid is in the design and implementation, its solid base is being established in part with this work. The goal of Forensic Lucid in the cyberforensic analysis is to be able to express in a program form the encoding of the evidence, witness stories, and evidential statements, that can be tested against claims to see if there is a possible sequence or multiple sequences of events that explain a given story. This is designed to aid investigator to avoid ad-hoc conclusions and have them look at the possible explanations the Forensic Lucid program execution would yield and refine the investigation, as was shown in the works [22,23] investigators failed to analyze all the stories and their plausibility before drawing conclusions in the case. We do not recite the cases here due to the length limitations. 2 Forensic Lucid The end goal is to define our Forensic Lucid language where its constructs concisely express cyberforensic evidence, which can be initial state of a case towards what we have actually observed as a final state. The implementing system (i.e. GIPSY) has to backtrace intermediate results in order to provide the corresponding event reconstruction path, if it exists. The result of the expression in its basic form is either true or false, i.e. “guilty” or “not guilty” given the context per explanation with the backtrace. There can be multiple backtraces, that correspond to the explanation of the evidence (or lack thereof). 2.1 Properties We define Forensic Lucid to model the evidential statements and other expressions representing the evidence and observations as a higher-order context hierarchy. An execution trace of a Forensic Lucid program would expose the possibility of the proposed claim with the events in the middle. Addition of the context calculus from Lucx for operators on Lucx’s context sets (union, intersection, etc.) are used to address to provide a collection of traces. Forensic Lucid inherits the properties of Lucx, MARFL, Objective Lucid, JOOIP (and their comprising dialects), where the former is for the context calculus, and the latter for the arrays and structural representation of data for modeling the case data structures such as events, observations, and groupings of the related data. One of the basic requirements is that the complete definition of the operational semantics of Forensic Lucid should be compatible with the basic Lucx and GIPL, i.e. the translation rules or equivalent are to be provided when implementing the language compiler within GIPSY, and such that the GEE can execute it with minimal changes. foo @ { [ f i n a l observed event , p o s s i b l e [ ], [ ] } i n i t i a l observed event ] , Listing 1.1. Intensional Storyboard Expression While the [...] notation here may be confusing with respect to the notation of [dimension:tag] in Lucid and more specifically in Lucx [13,25], it is in fact a simple syntactical extension to allow higher-level groups of contexts where this syntactical sugar is later translated to the baseline context constructs. The tentative notation of {[...],...,[...]} implies a notion similar to the notion of the “context set” in [13,25] except with the syntactical sugar mentioned earlier where we allow syntactical grouping of properties, observations, observation sequences, and evidential statements as our context sets. 2.2 Transition Function A transition function determines how the context of evaluation changes during computation. A general issue exists that we have to address is that the transition function ψ is problem-specific. In the FSA approach, the transition function is the labeled graph itself. In the first prototype, we follow the graph to model our Forensic Lucid equivalent. In general, Lucid has already basic operators to navigate and switch from one context to another, which represent the basic transition functions in themselves (the intensional operators such as @, #, iseod, first, next, fby, wvr, upon, and asa as well as their inverse operators1). However, a specific problem being modeled requires more specific transition function than just plain intensional operators. In this case the transition function is a Forensic Lucid function where the matching state transition modeled through a sequence of intensional operators. In fact, the forensic operators are just pre-defined functions that rely on traditional and inverse Lucid operators as well as context switching operators that achieve something similar to the transitions in [22,23]. In fact, the intensional operators of Lucid represent the basic building blocks for ψ and Ψ −1 . 2.3 Primitive Operators The basic set of the classic intensional operators is extended with the similar operators, but inverted in one of their aspects: either negation of trueness or reverse of direction of navigation. Here we provide an informal definition followed by their formal counterpart of these operators alongside with the classical ones (to remind the reader what they do and enlighten the unaware reader). The reverse operators have a restriction that they must work on the bounded streams at the positive infinity. This is not a stringent limitation as the our contexts of observations and evidence in this work are always finite, so they all have the beginning and the end. What we need is an ability to go back in the stream and, perhaps, negate in it with classical-like operators, but reversed. The operators are defined below to give a complete picture. The classical operators first, next, fby, wvr, upon, and asa were previously defined in [11] and earlier. The other complimentary, inverse, and negation operators were defined and revised from [26]. In this list of operators, especially the reverse ones, we make an important assumption that the streams we are working with are finite, which is sufficient for our tasks. Thus, our streams of context values can be bound between bod and eod and contain a finite tag set of elements is used as a context type. For summary of the application of the just defined operators’ examples, please refer to Appendix B. Following the steps in [11], we further represent the definition of the operators via @ and #. Again, there is a mix of classical operators that were previously defined in [11], such as first, next, fby, wvr, upon, and asa as well as the new operators from this work. The collection of the translated operators denoted in monospaced font, while we provide their equivalence to the original Lucid operators, denoted as small caps. The primitive operators are founding blocks to construct more complex case-specific functions that represent a particular investigation case as well as more complex so-called forensic operators. – A stream of first elements of stream X: first X = (x0 , x0 , ..., x0 , ...) first X = X@0 – A stream of second elements of stream X: second X = (x1 , x1 , ..., x1 , ...) = first next X 1 Defined further. (1) – A stream of last elements of stream X: last X = (xn , xn , ..., xn , ...) This definition of the last operator relies on the earlier stated assumption that our streams can be explicitly finite for the language we are developing. This affects the follow up operators that rely in that fact just as well. It is also important to note that the last operator in our design does not return eod all the time on the finite stream due to lack of usefulness for such a value; instead it returns the element of the stream just before the eod. last X = X@(#@(#iseod(#) − 1)) (2) – A stream of elements one before the last one of stream X: prelast X = (xn−1 , xn−1 , ..., xn−1 , ...) = last prev X – A stream of elements of stream X other than the first: next X = (x1 , x2 , ..., xi+1 , ...) next X = X@(# + 1) (3) – A stream of elements of stream X other than the last: prev X = (xn−1 , ..., xi+1 , xi , xi−1 , ...) prev X = X@(# − 1) (4) X fby Y = if # = 0 then X else Y @(# − 1) = if isbod X then X else prev Y (5) – First element of X followed by all of Y : X fby Y = (x0 , y0 , y1 , ..., yi−1 , ...) – First element of X preceded by all of Y : X pby Y = (y0 , y1 , ..., yi−1 , ..., yn , x0 ) X pby Y = if iseod # then X else Y @(# + 1) (6) = if iseod Y then X else next Y – Stream of negated arithmetic values of X: neg X = (−x0 , −x1 , −x2 , ..., −xi+1 , ...) neg X = −X (7) not X = if X then !X else X (8) – Stream of inverted truth values of X: not X = (!x0 , !x1 , !x2 , ..., !xi+1 , ...) – A logical AND stream of truth values of X and Y : X and Y = (x0 &&y0 , x1 &&y1 , x2 &&y2, ..., xi+1 &&yi+1 , ...) X and Y = X&&Y (9) – A logical OR stream of truth values of X and Y : X or Y = (x0 ||y0 , x1 ||y1 , x2 ||y2 , ..., xi+1 ||yi+1 , ...) X or Y = X||Y (10) – A logical XOR stream of truth values of X and Y : X xor Y = (x0 ⊕ y0 , x1 ⊕ y1, x2 ⊕ y2 , ..., xi+1 ⊕ yi+1 , ...) X xor Y = not((X and Y ) or not (X or Y )) (11) – wvr stands for whenever. wvr chooses from its left-hand-side operand only values in the current dimension where the right-hand-side evaluates to true. X wvr Y = if first Y 6= 0 then X fby (next X wvr next Y ) else (next X wvr next Y ) X wvr Y = X@T where (12) T = U fby U@(T + 1) U = if Y then # else next U end – rwvr stands for retreat whenever. rwvr chooses from its left-hand-side operand backwards only values in the current dimension where the right-hand-side evaluates to true. X rwvr Y = if last Y 6= 0 then X pby (prev X rwvr prev Y ) else (prev X rwvr prev Y ) X rwvr Y = X@T where T = U pby U@(T − 1) (13) U = if Y then # else prev U end – nwvr stands for not whenever. nwvr chooses from its left-hand-side operand only values in the current dimension where the right-hand-side evaluates to false. X nwvr Y = X wvr not Y = if first Y == 0 then X fby (next X nwvr next Y ) else (next X nwvr next Y ) X nwvr Y = X@T where (14) T = U fby U@(T + 1) U = if Y == 0 then # else next U end – nrwvr stands for do not retreat whenever. nrwvr chooses from its left-hand-side operand backwards only values in the current dimension where the right-hand-side evaluates to false. X nrwvr Y = X rwvr not Y = if last Y == 0 then X pby (prev X nrwvr prev Y ) else (prev X nrwvr prev Y ) X rnwvr Y = X@T where T = U pby U@(T − 1) (15) U = if Y == 0 then # else prev U end – asa stands for as soon as. asa returns the value of its left-hand-side as a first point in that stream as soon as the right-hand-side evaluates to true. X asa Y = first (X wvr Y ) X asa Y = first (X wvr Y ) (16) – ala (other suggested name is rasa) stands for as late as (or reverse of a soon as). ala returns the value of its left-hand-side as the last point in that stream when the right-hand-side evaluates to true for the last time. X ala Y = last (X wvr Y ) X ala Y = last (X rwvr Y ) (17) – nasa stands for not as soon as. nasa returns the value of its left-hand-side as a first point in that stream as soon as the right-hand-side evaluates to false. X nasa Y = first (X nwvr Y ) X nasa Y = first (X nwvr Y ) (18) – nala (other suggested name is nrasa) stands for not as late as (or reverse of not a soon as). nala returns the value of its left-hand-side as the last point in that stream when the right-hand-side evaluates to false for the last time. X nala Y = last (X nwvr Y ) X nala Y = last (X nrwvr Y ) (19) – upon stands for advances upon. Unlike asa, upon switches context of its left-hand-side operand if the right-hand side is true. X upon Y = X fby ( if first Y 6= 0 then (next X upon next Y ) else (X upon next Y )) X upon Y = X@W where (20) W = 0 fby (if Y then (W + 1) else W ) end – rupon stands for retreats upon. rupon switches context backwards of its left-hand-side operand if the right-hand side is true. X rupon Y = X pby ( if last Y 6= 0 then (prev X rupon prev Y ) else (X rupon prev Y )) X rupon Y = X@W where W = 0 pby (if Y then (W − 1) else W ) end (21) – nupon stands for not advances upon or rather advances otherwise. nupon switches context of its left-hand-side operand if the right-hand side is false. X nupon Y = X upon not Y = X fby ( if first Y == 0 then (next X nupon next Y ) else (X nupon next Y )) X nupon Y = X@W where (22) W = 0 fby (if Y == 0 then (W + 1) else W ) end – nrupon stands for not retreats upon. nrupon switches context backwards of its left-hand-side operand if the right-hand side is false. X nrupon Y = X rupon not Y = X pby ( if last Y == 0 then (prev X nrupon prev Y ) else (X nrupon prev Y )) X nrupon Y = X@W where (23) W = 0 pby (if Y == 0 then (W − 1) else W ) end 2.4 Forensic Operators The operators presented here are based on the discussion of the combination function and others that form morethan-primitive operations to support the required implementation. The discussed earlier comb() operator needs to be realized in the general manner for combining analogies of MPRs, which in our case are higher-level contexts, in the new language’s dimension types. – combine corresponds to the comb function as originally described by Gladyshev in [22]. It is defined in Listing 1.2. It is a preliminary context-enhanced version. /∗ ∗ ∗ Append g i v e n e t o e a c h e l e m e n t ∗ o f a gi ven stream e under t h e ∗ context of d . ∗ ∗ @return t h e r e s u l t i n g c o m b i n e d s t r e a m ∗/ combine ( s , e , d ) = i f i s e o d s t h e n eod ; e l s e ( f i r s t s f b y . d e ) f b y . d combine ( n e x t s , e , d ) ; fi Listing 1.2. The combine Operator – product tentatively corresponds to the cross-product [22] of contexts. It is defined in Listing 1.3. The translated examples show recursion that we are not prepared to deal with in the current Lucid semantics, and will address that in the future work. The two illustrated operators are the first of the a few more to follow in the final language prototype. /∗ ∗ ∗ Append e l e m e n t s ∗ in all possible ∗/ p r o d u c t ( s1 , s2 , d ) i f i s e o d s2 then e l s e combine ( s1 , fi o f s2 t o element o f s1 combinations . = eod ; f i r s t s 2 ) f b y . d p r o d u c t ( s1 , n e x t s 2 ) ; Listing 1.3. The product Operator 2.5 Operational Semantics As previously mentioned, the operational semantics of Forensic Lucid for the large part is viewed as a composition of the semantic rules of Indexical Lucid, Objective Lucid, and Lucx along with the new operators and definitions. Here we list the existing combined semantic definitions to be used the new language, specifically extracts of operational semantics from GIPL [11], and Lucx [13] are in Figure 1, and Figure 3 respectively. The explanation of the rules and the notation are given in great detail in the cited works and are trimmed in this article. For convenience of the reader they are recited here to a degree. The new rules of the operational semantics of Forensic Lucid cover the newly defined operators primarily, including the reverse and logical stream operators as well as forensic-specific operators. We use the same notation as the referenced languages to maintain consistency in defining our rules. In the implementing system, GIPSY, the GIPL is the generic counterpart of all the Lucid programming languages. Like Indexical Lucid, which it is derived from, it has only the two standard intensional operators: E @ C for evaluating an expression E in context C, and #d for determining the position in dimension d of the current context of evaluation in the context space [11]. SIPLs are Lucid dialects (Specific Intensional Programming Languages) with their own attributes and objectives. Theoretically, all SIPLs can be translated into the GIPL [11]. All the SIPLs conservatively extend the GIPL syntactically and semantically. The remainder of this section presents a relevant piece of Lucx as a conservative extension to GIPL. The semantics of GIPL is presented in Figure 1. The excerpt of semantic rules of Lucx are then presented as a conservative extension to GIPL in Figure 3. Following is the description of the GIPL semantic rules as presented in [11]: D ⊢E :v tells that under the definition environment D, expression E would evaluate to value v. D, P ⊢ E : v specifies that in the definition environment D, and in the evaluation context P (sometimes also referred to as a point in the context space), expression E evaluates to v. The definition environment D retains the definitions of all of the identifiers that appear in a Lucid program, as created with the semantic rules 13-16 in Figure 1. It is therefore a partial function D : Id → IdEntry where Id is the set of all possible identifiers and IdEntry, has five possible kinds of value, one for each of the kinds of identifier: 1. Dimensions define the coordinate pairs, in which one can navigate with the # and @ operators. Their IdEntry is simply (dim). 2. Constants are external entities that provide a single value, regardless of the context of evaluation. Examples are integers and Boolean values. Their IdEntry is (const, c), where c is the value of the constant. 3. Data operators are external entities that provide memoryless functions. Examples are the arithmetic and Boolean functions. The constants and data operators are said to define the basic algebra of the language. Their IdEntry is (op, f ), where f is the function itself. 4. Variables carry the multidimensional streams. Their IdEntry is (var, E), where E is the Lucid expression defining the variable. It should be noted that this semantics makes the assumption that all variable names are unique. This constraint is easy to overcome by performing compile-time renaming or using a nesting level environment scope when needed. 5. Functions are non-recursive GIPL user-defined functions. Their IdEntry is (func, idi , E), where the idi are the formal parameters to the function and E is the body of the function. In this paper we do not discuss the semantics of recursive functions. D(id) = (const, c) D, P ⊢ id : c (24) Eopid : D(id) = (op, f ) D, P ⊢ id : id (25) Edid : D(id) = (dim) D, P ⊢ id : id (26) Efid : D(id) = (func, idi , E) D, P ⊢ id : id (27) Evid : D(id) = (var, E) D, P ⊢ E : v D, P ⊢ id : v (28) Eop : D, P ⊢ E : id D(id) = (op, f ) D, P ⊢ Ei : vi D, P ⊢ E(E1 , . . . , En ) : f (v1 , . . . , vn ) (29) Ecid : Efct : D, P ⊢ E : id D(id) = (func, idi , E ′ ) D, P ⊢ E ′ [idi ← Ei ] : v D, P ⊢ E(E1 , . . . , En ) : v (30) EcT : D, P ⊢ E : true D, P ⊢ E ′ : v′ D, P ⊢ if E then E ′ else E ′′ : v′ (31) EcF : D, P ⊢ E : false D, P ⊢ E ′′ : v′′ D, P ⊢ if E then E ′ else E ′′ : v′′ (32) Etag : D, P ⊢ E : id D(id) = (dim) D, P ⊢ #E : P(id) (33) Eat : Ew : Qdim : Qid : Qfid : QQ : D, P ⊢ E ′ : id D(id) = (dim) D, P ⊢ E ′′ : v′′ D, P ⊢ E @E ′ E ′′ : v D, P ⊢ Q : D ′ , P ′ D ′, P ′ ⊢ E : v D, P ⊢ E where Q : v D, P ⊢ dimension id : D †[id 7→ (dim)], P †[id 7→ 0] D, P ⊢ id = E : D †[id 7→ (var, E)], P D, P ⊢ id(id1 , . . . , idn ) = E : D †[id 7→ (func, idi , E)], P D, P ⊢ Q : D ′ , P ′ D ′ , P ′ ⊢ Q′ : D ′′ , P ′′ D, P ⊢ Q Q′ : D ′′ , P ′′ D, P †[id 7→ v′′ ] ⊢ E : v (34) (35) (36) (37) (38) (39) Fig. 1. GIPL Semantics EE.did : D(E.id) = (dim) D, P ⊢ E.id : id.id (40) Fig. 2. Higher-Order Context Dot Operator The evaluation context P, which is changed when the @ operator is evaluated, or a dimension is declared in a where clause, associates a tag (i.e. an index) to each relevant dimension. It is, therefore, a partial function P : Id → N Each type of identifiers can only be used in the appropriate situations. Identifiers of type op, func, and dim evaluate to themselves (Figure 1, rules 25,26,27). Constant identifiers (const) evaluate to the corresponding constant (Figure 1, rule 24). Function calls, resolved by the Efct rule (Figure 1, rule 30), require the renaming of the formal parameters into the actual parameters (as represented by E ′ [idi ← Ei ]). The function P ′ = P †[id 7→ v′′ ] specifies that P ′ (x) is v′′ if x = id, and P(x) otherwise. The rule for the where clause, Ew (Figure 1, rule 35), which corresponds to the syntactic expression E where Q, evaluates E using the definitions Q therein. The additions to the definition environment D and context of evaluation P made by the Q rules (Figure 1, rules 36,37,38) are local to the current where clause. This is represented by the fact that the Ew rule returns neither D nor P. The Qdim rule adds a dimension to the definition environment and, as a convention, adds this dimension to the context of evaluation with tag 0 (Figure 1, rule 36). The Qid and Qfid simply add variable and function identifiers along with their definition to the definition environment (Figure 1, rules 37,38). As a conservative extension to GIPL, Lucx’s semantics introduces the notion of context as a building block into the semantic rules, i.e. context as a first-class value, as described by the rules in Figure 3. In Lucx, semantic rule 42 (Figure 3) creates a context as a semantic item and returns it as a context P that can then be used by rule 43 to navigate to this context by making it override the current context. GIPL’s semantic rule 29 is still valid for the definition of the context operators, where the actual parameters evaluate to values vi that are contexts Pi . The semantic rule 41 expresses that the # symbol evaluates to the current context. When used as a parameter to the context calculus operators, this allows for the generation of contexts relative to the current context of evaluation. E#(cxt) : Econstruction(cxt) D, P ⊢ # : P D, P ⊢ Ed j : id j D(id j ) = (dim) D, P ⊢ Ei j : v j P ′ = P0 †[id1 7→ v1 ]†. . .†[idn 7→ vn ] : D, P ⊢ [Ed1 : Ei1 , Ed2 : Ei2 , . . . , Edn : Ein ] : P ′ Eat(cxt) : D, P ⊢ E ′ : P ′ D, P †P ′ ⊢ E : v D, P ⊢ E @ E ′ : v (41) (42) (43) Fig. 3. Conservative Semantic Rules Introduced by Lucx 3 Conclusion While the list of Isabelle’s proofs is incomplete at the time of the writing of this manuscript some formalization in Isabelle took place, and the work on them is currently on-going. 3.1 Results Due to a non-standard nature of the Lucid language (as opposed to standard imperative languages), it takes some time to understand the full scope of some of its details and model them. This complicates a way to model its operators, expressions, overall meaning in Isabelle. This fact resulted in several trials and attempts to approach the language, from fairly complex to fairly basic – plain integers and pipelined processing and basic index support. They are not fully complete, but some of the basic properties are modeled and proven; please refer to the Isabelle sources for details (once completed it is planned to be released as a part of the Archive of Formal Proofs at [27]). – The IntegerLucid Isabelle file is the most developed out of all as far as definition and exploitation of intensional operators of classical Lucid concerned. It is called “integer” because all the streams and dimensions and all operators around them play with integers, natural numbers, and in rarer cases Booleans. There are no identifiers in there. The Isabelle file contains three theories: OriginalLucidOperators, LucidOperators, and IntegerLucid. The first models classical Lucid operators as pipelined dataflows. The second adds up some index support and proves equivalence to the first definitions. The latter provides new definitions of the intensional operators through @ and #, defines meaning functions, propositions, and lemmas from [11]. Integer Lucid proves the example for N @.d 2 = 44 for the at(). – The BasicLucid theory is currently the second one derived to support Lucid definitions. It is an extension of IntegerLucid by adding identifiers. asa and upon are in this theory. – The LucidSemanticRules theory is meant to have the meaning of complete semantic rules and proven, but it only has a definition of a Hoare tuple [28] and a meaning function for it. – The CommonLucidTypes theory is used by all (most) theories and defines some common types used by most [29]. – ForensicLucid.thy, GIPL.thy, IndexicalLucid.thy, JLucid.thy, JOOIP.thy, Lucx.thy, ObjectiveLucid.thy are the theories under current development with some results from the above. The completed work will have a complete list of the files publicly available and submitted to the AfP [27]. 3.2 Future Work The near-future work will consist primarily of the following items: – Complete semantics of all the mentioned Lucid dialects and their formalization with Isabelle. – Augment the language specification to include the Depmster-Shafer theory [30,31] of evidence to allow weights for claims, credibility, belief, and plausibility parameters. – Prove semantic rules involving intensional data warehouse. – Implementation of the Forensic Lucid compiler, run-time and interactive development environments. 4 Acknowledgments This research and development work was funded in part by NSERC and the Faculty of Engineering and Computer Science of Concordia University, Montreal, Canada. Thanks to Drs. Mourad Debbabi, Patrice Chalin, Peter Grogono on valuable suggestions used in this work. References 1. Mokhov, S.: Intensional Forensics – the Use of Intensional Logic in Cyberforensics. Technical report, Concordia Institute for Information Systems Engineering, Concordia University, Montreal, Canada (January 2007) ENGR6991 Technical Report. 2. Mokhov, S.: Intensional Cyberforensics – a PhD Proposal. Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada (December 2007) 3. The GIPSY Research and Development Group: The General Intensional Programming System (GIPSY) project. Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada (2002-2008) http://newton.cs.concordia.ca/~ gipsy/, last viewed April 2008. 4. Paulson, L.C., Nipkow, T.: Isabelle: A generic proof assistant. University of Cambridge and Technical University of Munich (2007) http://isabelle.in.tum.de/, last viewed: December 2007. 5. Wadge, W., Ashcroft, E.: Lucid, the Dataflow Programming Language. Academic Press, London (1985) 6. Edward Ashcroft and Anthony Faustini and Raganswamy Jagannathan and William Wadge: Multidimensional, Declarative Programming. Oxford University Press, London (1995) 7. Ashcroft, E.A., Wadge, W.W.: Lucid - A Formal System for Writing and Proving Programs. Volume 5., SIAM J. Comput. no. 3 (1976) 8. Ashcroft, E.A., Wadge, W.W.: Erratum: Lucid - A Formal System for Writing and Proving Programs. Volume 6(1):200., SIAM J. Comput. (1977) 9. Ashcroft, E.A., Wadge, W.W.: Lucid, a nonprocedural language with iteration. Communication of the ACM 20(7) (July 1977) 519–526 10. Gagné, J.R., Plaice, J.: Demand-Driven Real-Time Computing, World Scientific (September 1999) 11. Paquet, J.: Scientific Intensional Programming. PhD thesis, Department of Computer Science, Laval University, Sainte-Foy, Canada (1999) 12. Wan, K., Alagar, V., Paquet, J.: A Context theory for Intensional Programming. In: Workshop on Context Representation and Reasoning (CRR05), Paris, France. (July 2005) 13. Wan, K.: Lucx: Lucid Enriched with Context. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada (2006) 14. Paquet, J., Mokhov, S.A., Tong, X.: Design and implementation of context calculus in the GIPSY environment. In: Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), Turku, Finland, IEEE Computer Society (July 2008) 1278–1283 15. Tong, X.: Design and implementation of context calculus in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada (April 2008) 16. Wan, K., Alagar, V., Paquet, J.: Lucx: Lucid Enriched with Context. In: Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), Las Vegas, USA, CSREA Press (June 2005) 48–14 17. Mokhov, S.A.: Towards syntax and semantics of hierarchical contexts in multimedia processing applications using MARFL. In: Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), Turku, Finland, IEEE Computer Society (July 2008) 1288–1294 18. Swoboda, P.: A Formalisation and Implementation of Distributed Intensional Programming. PhD thesis, The University of New South Wales, Sydney, Australia (2004) 19. Swoboda, P., Wadge, W.W.: Vmake, ISE, and IRCS: General tools for the intensionalization of software systems. In Gergatsoulis, M., Rondogiannis, P., eds.: Intensional Programming II, World-Scientific (2000) 20. Swoboda, P., Plaice, J.: A new approach to distributed context-aware computing. In Ferscha, A., Hoertner, H., Kotsis, G., eds.: Advances in Pervasive Computing, Austrian Computer Society (2004) ISBN 3-85403-176-9. 21. Swoboda, P., Plaice, J.: An active functional intensional database. In Galindo, F., ed.: Advances in Pervasive Computing, Springer (2004) 56–65 LNCS 3180. 22. Gladyshev, P., Patel, A.: Finite state machine approach to digital event reconstruction. In: Digital Investigation Journal. Volume 2. (2004) 23. Gladyshev, P.: Finite state machine analysis of a blackmail investigation. In: International Journal of Digital Evidence, Technical and Security Risk Services, Sprint 2005, Volume 4, Issue 1 (2005) 24. Ding, Y.M.: Bi-directional translation between data-flow graphs and Lucid programs in the GIPSY environment. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada (2004) 25. Tong, X., Paquet, J., Mokhov, S.A.: Context Calculus in the GIPSY. Unpublished (2007) 26. Mokhov, S.A., Paquet, J., Debbabi, M.: Designing a language for intensional cyberforensic analysis. Unpublished (2007) 27. Klein, G., Nipkow, T., Paulson, L.C.: The archive of formal proofs. SourceForge.net (2008) http://afp.sourceforge.net/, last viewed: April 2008. 28. Moeller, A.: Program Verification with Hoare Logic. Technical report, University of Aarhus (2004) http://www.brics.dk/~ amoeller/talks/hoare.pdf. 29. Mokhov, S.A., Paquet, J., Tong, X.: Hybrid intensional-imperative type system for intensional logic support in GIPSY. Submitted for publication at LPAR’08 (2008) 30. Shafer, G.: The Mathematical Theory of Evidence. Princeton University Press (1976) 31. Haenni, R., Kohlas, J., Lehmann, N.: Probabilistic argumentation systems. Technical report, Institute of Informatics, University of Fribourg, Fribourg, Switzerland (October 1999) 32. Kahn, G.: The semantics of a simple language for parallel processing. In: Proceedings of the IFIP Congress ’74, Amsterdam, Elsevier North-Holland (1974) 471–475 33. Kahn, G., MacQueen, D.B.: Coroutines and networks of parallel processes. In: Proceedings of the IFIP Congress ’77, Amsterdam, Elsevier North-Holland (1977) 993–998 34. Landin, P.J.: The next 700 programming languages. Communications of the ACM 9(3) (1966) 157–166 Appendix A Lucid Axioms, Theorems, and Proofs Here we present and extend the notion of the formalisms from Paquet [11] and extend them on to the present work. A.1 Streaming and Basic Operators The origins of Lucid date back to 1974. At that time, Ashcroft and Wadge were working on a purely declarative language, in which iterative algorithms could be expressed naturally, which eventually resulted in [9]. Their work fits into the broad area of research into program semantics and verification. It would later turn out that their work is also relevant to the dataflow networks and coroutines of Kahn and MacQueen [32,33]. In the original Lucid (whose operators are in this font), streams were defined in a pipelined manner, with two separate definitions: one for the initial element, and another one for the subsequent elements. For example, the equations first X = 0 next X = X + 1 define variable X to be a stream, such that x0 = 0 xi+1 = xi + 1 In other words, 0 = (0, 0, 0, ..., 0, ...) X = (x0 , x1 , . . . , xi , . . .) = (0, 1, . . . , i, . . .) Similarly, the equations first X = X next Y = Y + next X define variable Y to be the running sum of X, i.e. y0 = x0 yi+1 = yi + xi+1 In other words,   i(i + 1) Y = (y0 , y1 , . . . , yi , . . .) = 0, 1, . . . , ,... 2 It soon became clear that a “new” operator at the time, fby (followed by) can be used to define such typical situations. Hence, the above two variables could be defined as follows: X = 0 fby X + 1 Y = X fby Y + next X As a result, we can summarize the three basic operators of the original Lucid. Definition 1 If X = (x0 , x1 , . . . , xi , . . .) and Y = (y0 , y1 , . . . , yi , . . .), then def (1) first X = (x0 , x0 , . . . , x0 , . . .) def (2) next X = (x1 , x2 , . . . , xi+1 , . . .) def (3) X fby Y = (x0 , y0 , y1 , . . . , yi−1 , . . .) Here parallels can be drawn to the list operations, where first corresponds to head, next corresponds to tail, and fby corresponds to cons. When these operators are combined with Landin’s ISWIM [34] (If You See What I Mean), essentially typed λ -calculus with syntactic sugar, it becomes possible to define complete Lucid programs. The following three derived operators have turned out to be very useful (we will use them later in the text): Definition 2 (1) X wvr Y def (2) X asa Y def = if first Y then X fby ( next X wvr next Y ) else ( next X wvr next Y ) = first (X wvr Y ) def (3) X upon Y = X fby (if first Y then ( next X upon next Y ) else ( X upon next Y )) Where wvr stands for whenever, asa stands for as soon as and upon stands for advances upon. A.2 Random Access to Streams With the original Lucid operators, one could only define programs with pipelined dataflows, i.e. in which the (i + 1)-th element in a stream is only computed once the i-th element has been computed. This situation is potentially wasteful of resources, since the i-th element might not necessarily be required. More importantly, it only allows sequential access into streams. By taking a different approach, it is possible to have random access into streams, using an index # corresponding to the current position, the current context of evaluation. No longer are we manipulating infinite extensions (streams), rather we are defining computation according to a context (here a single integer). We have set out on the road to intensional programming. We redefine all original Lucid operators in terms of the operators # and @: Definition 3 (1) # def = 0 fby (# + 1) def (2) X @ Y = if Y = 0 then first X else ( next X) @ (Y − 1) Further, we give definitions for the original operators using these two baseline operators. In so doing, we will use the following axioms. Axiom 1 Let i ≥ 0. (1) [c]i = c (2) [X + c]i = [X]i + c (3) [ first X]i = [X]0 (4) [ next X]i = [X]i+1 (5) [X fby Y ]0 = [X]0 (6) [X fby Y ]i+1 = [Y ]i (7) if true then [X]i else [Y ]i = [X]i (8) if false then [X]i else [Y ]i = [Y ]i (9) [if C then X else Y ]i = if [C]i then [X]i else [Y ]i Prior giving the re-definitions of the standard Lucid operators, we show some basic properties of @ and #. We will use throughout the discussion here [X]i instead of xi , as it allows for greater readability. Furthermore, we will, as is standard, write X = Y whenever we have (∀i : i ≥ 0 : [X]i = [Y ]i ) Proposition 1. Let i ≥ 0. (1) [#]i = i (2) [X @ Y ]i = [X][Y ]i Proof (1) Proof by induction over i. Base step (i = 0). [#]0 = [0 fby (# + 1)]0 = [0]0 =0 Defn. 3.1 Axiom 1.5 Axiom 1.1 Induction step (i = k + 1). Suppose (∀i : i ≤ k : [#]i = i). [#]k+1 = [0 fby (# + 1)]k+1 = [# + 1]k = [#]k + 1 = k+1 Defn. 3.1 Axiom 1.6 Axiom 1.2 Ind. Hyp. Hence (∀i : i ≥ 0 : [#]i = i). (2) Let i ≥ 0. We will prove by induction over yi that yi ≥ 0 ⇒ [X @ Y ]i = [X][Y ]i . Base step (yi = 0). [X @ Y ]i = [if Y = 0 then first X else ( next X) @ (Y − 1)]i = if [Y = 0]i then [ first X]i else [( next X) @ (Y − 1)]i = if [Y ]i = 0 then [ first X]i else [( next X) @ (Y − 1)]i = [ first X]i = [X]0 = [X][Y ]i Defn. 3.2 Axiom 1.9 Axiom 1.2 Axiom 1.7 Axiom 1.3 Hypothesis Induction step (yi = k + 1). Suppose (∀i : i ≤ k : [#]i = i). [X @ Y ]i = [if Y = 0 then first X else ( next X) @ (Y − 1)]i = if [Y = 0]i then [ first X]i else [( next X) @ (Y − 1)]i = if [Y ]i = 0 then [ first X]i else [( next X) @ (Y − 1)]i = [( next X) @ (Y − 1)]i = [ next X][Y −1]i = [ next X][Y ]i −1 = [X][Y ]i −1+1 = [X][Y ]i Defn. 3.2 Axiom 1.9 Axiom 1.2 Axiom 1.8 Ind. Hyp. Axiom 1.2 Axiom 1.4 Arith. Hence (∀i : i ≥ 0 : [Y ]i ≥ 0 ⇒ ([X @ Y ]i = [X][Y ]i )).  Definition 4 def (1) first X = X @ 0 (2) next X (3) X fby Y (4) X wvr Y (4.1) (4.2) (5) X asa Y (6) def = X @ (# + 1) def = if # = 0 then X else Y @ (# − 1) def = X @T where T = U fby U @ (T + 1) U = if Y then # else next U end def = first (X wvr Y ) def X upon Y = X @ W where (6.1) W = 0 fby if Y then (W + 1) else W end The advantage of these new definitions is that they do not use any form of recursive function definitions. Rather, all of the definitions are iterative, and in practice, more easily implemented in an efficient manner. We prove below that the new definitions are equivalent to the old ones. Proposition 2. first X = first X. Proof Let i ≥ 0. Then [first X]i = [X @ 0]i = [X][0]i = [X]0 = [ first X]i Hence first X = first X. Defn. 4.1 Prop. 1.2 Axiom 1.1 Axiom 1.3  Proposition 3. next X = next X. Proof Let i ≥ 0. Then   [next X]i = X @ (# + 1) i = [X][#+1]i = [X][#]i +1 = [X]i+1 = [ next X]i Defn. 4.2 Prop. 1.2 Axiom 1.2 Prop. 1.1 Axiom 1.4 Hence next X = next X.  Proposition 4. X fby Y = X fby Y . Proof Proof by induction over i. Base step (i = 0). [X fby Y ]0 = [if # = 0 then X else Y @ (# − 1)]0 = if [# = 0]0 then [X]0 else [Y @ (# − 1)]0 = if [#]0 = 0 then [X]0 else [Y @ (# − 1)]0 = if 0 = 0 then [X]0 else [Y @ (# − 1)]0 = [X]0 = [X fby Y ]0 Defn. 4.3 Axiom 1.9 Defn. 1.2 Prop. 1.1 Axiom 1.7 Axiom 1.5 Induction step (i = k + 1).   [X fby Y ]k+1 = if # = 0 then X else Y @ (# − 1) k+1 = if [# = 0]k+1 then [X]k+1 else [Y @ (# − 1)]k+1 = if [#]k+1 = 0 then [X]k+1 else [Y @ (# − 1)]k+1 = if k + 1 = 0then [X]k+1 else [Y @ (# − 1)]k+1 = Y @ (# − 1) k+1 = Y [#−1] k+1   = Y [#] −1   k+1 = Y k = [X fby Y ]k+1 Defn. 4.3 Axiom 1.9 Axiom 1.1 Prop. 1.1 Axiom 1.8 Prop. 1.2 Axiom 1.2 Prop. 1.1 Axiom 1.6 Hence (∀i : i ≥ 0 : [X fby Y ]i = [X fby Y ]i ). Hence fby = fby .  The proof for wvr is more complicated, as it requires relating an iterative definition to a recursive definition. We will therefore need four lemmas that refer to variables T and U in the text in Definitions 4.4.1 and 4.4.2. In addition, we must define the rank of a Boolean stream. Finally, we will have to introduce another set of axioms, that allow us to compare two entire streams, as opposed to particular elements in the two streams. Axiom 2 Let i ≥ 0. (1) X 0 = X (2) [X i ]0 = [X]i (3) first X i = [X]i (4) next X i = X i+1 (5) next (X fby Y ) = Y (6) ( first X) fby Y = X fby Y (7) if true then X else Y = X (8) if false then X else Y = Y Definition 5 Let Y be a Boolean stream. def (1) rank(−1,Y ) = −1 def (2) rank(i + 1,Y ) = min{k : k > rank(i,Y ) : [Y ]k = true} Further, we write ri for rank(i,Y ). Lemma 1. (∀i : i ≥ −1 : (∀ j : ri < j ≤ ri+1 : X j wvr Y j = X ri+1 wvr Y ri+1 )). Proof Let i ≥ −1. Proof by downwards induction over j. Note that ri < ri+1 . Base step ( j = ri+1 ). X ri+1 wvr Y ri+1 = X ri+1 wvr Y ri+1 Identity Induction step ( j = k − 1, j > ri ). X k−1 wvr Y k−1 = if first Y k−1 then X k−1 fby X k wvr Y k else X k wvr Y k = if [Y ]k−1 then X k−1 fby X k wvr Y k else X k wvr Y k = X k wvr Y k = X ri+1 wvr Y ri+1 Defn. 2.1 Axiom 2.3 Axiom 2.8 Ind. Hyp. Hence, (∀i : i ≥ −1 : (∀ j : ri < j ≤ ri+1 : X j wvr Y j = X ri+1 wvr Y ri+1 )).  Lemma 2. (∀i : i ≥ 0 : (X wvr Y )i = X ri wvr Y ri ). Proof Proof by induction over i. Base step (i = 0). (X wvr Y )0 = X wvr Y = X 0 wvr Y 0 = X r0 wvr Y r0 Axiom 2.1 Axiom 2.1 Lemma 1 Induction step (i = k + 1). (X wvr Y )k+1 = next ((X wvr Y )k ) = next (X rk wvr Y rk ) = next (if first Y rk then X rk fby X rk +1 wvr Y rk +1 else X rk +1 wvr Y rk +1 ) = next (if [Y ]rk then X rk fby X rk +1 wvr Y rk +1 else X rk +1 wvr Y rk +1 ) r k = next (X fby X rk +1 wvr Y rk +1 ) = X rk +1 wvr Y rk +1 = X rk+1 wvr Y rk+1 Axiom 2.4 Ind. Hyp. Defn. 2.1 Axiom 2.3 Axiom 2.7 Axiom 2.5 Lemma 1 Hence, (∀i : i ≥ 0 : (X wvr Y )i = X ri wvr Y ri ).  Lemma 3. (∀i : i ≥ −1 : (∀ j : ri < j ≤ ri+1 : [U] j = ri+1 )). Proof Let i ≥ −1. Proof by downwards induction over j. Note that ri < ri+1 . Base step ( j = ri+1 ). [U]ri+1 = [if Y then # else next U]ri+1 = if [Y ]ri+1 then [#]ri+1 else [next U]ri+1 = [#]ri+1 = ri+1 Defn. 4.4.2 Axiom 1.9 Axiom 1.7 Prop. 1.1 Induction step ( j = k − 1, j > ri ). [U]k−1 = [if Y then # else next U]k−1 = if [Y ]k−1 then [#]k−1 else [next U]k−1 = [next U]k−1 = [U]k = ri+1 Hence, (∀i : i ≥ −1 : (∀ j : ri−1 < j < ri : [U] j = ri+1 )). Defn. 4.4.2 Axiom 1.9 Axiom 1.8 Axiom 1.4 Ind. Hyp.  Lemma 4. (∀i : i ≥ 0 : [T ]i = ri ). Proof Proof by induction over i. Base step (i = 0). [T ]0 = [U fby U @ (T + 1)]0 = [U]0 = r0 Defn. 4.4.1 Axiom 1.5 Lemma 3 Induction step (i = k + 1). [T ]k+1 = [U fby U @ (T + 1)]k+1 = [U @ (T + 1)]k = [U][T +1]k = [U][T ]k +1 = [U]rk +1 = rk+1 Defn. 4.4.1 Axiom 1.6 Prop. 1.2 Axiom 1.2 Ind. Hyp. Lemma 3 Hence, (∀i : i ≥ 0 : [T ]i = ri ).  Proposition 5. X wvr Y = X wvr Y . Proof [X wvr Y ]i = [X @ T ]i = [X][T ]i = [X]ri = [X ri ]0 = [X ri fby X ri +1 wvr Y ri +1 ]0 = [if [Y ]ri then X ri fby X ri +1 wvr Y ri +1 else X ri +1 wvr Y ri +1 ]0 = [if first Y ri then X ri fby X ri +1 wvr Y ri +1 else X ri +1 wvr Y ri +1 ]0 r r = [X i wvr Y i ]0 = [(X wvr Y )i ]0 = [X wvr Y ]i Defn. 4.4 Prop. 1.2 Lemma 4 Axiom 1.2 Axiom 1.6 Axiom 2.7 Axiom 2.3 Defn. 2.1 Lemma 2 Axiom 2.2 Hence X wvr Y = X wvr Y .  Proposition 6. X asa Y = X asa Y . Proof X asa Y = first (X wvr Y ) = first (X wvr Y ) = first (X wvr Y ) = X asa Y Hence X asa Y = X asa Y . Defn. 4.5 Prop. 5 Prop. 2 Defn. 2.2  Lemma 5. (∀i : i ≥ 0 : (X upon Y )i = X [W ]i upon Y i ) Proof Proof by induction over i. Base step (i = 0). (X upon Y )0 = X upon Y = X 0 upon Y 0 = X [0 fby ...]0 upon Y 0 = X [W ]0 upon Y 0 Axiom 2.1 Axiom 2.1 Defn. 2.3 Defn. 4.6.1 Induction step (i = k + 1).  (X upon Y )k+1 = next (X upon Y )k  = next X [W ]k upon Y k = if ( first Y k ) then (X [W ]k +1 upon Y k+1 ) else (X [W ]k upon Y k+1 ) = if [Y ]k then (X [W ]k+1 upon Y k+1 ) else (X [W ]k upon Y k+1 )  = X (if [Y ]k then [W ]k+1 else [W ]k ) upon Y k+1 = X [W ]k+1 upon Y k+1 Axiom 2.4 Ind. Hyp. Defn. 2.3 and Axiom 2.5 Axiom 2.4 Defn. 4.6.1 Substit. Defn. 4.6.1 Hence, (∀i : i ≥ 0 : (X upon Y )i = X [W ]i upon Y i )  Proposition 7. X upon Y = X upon Y . Proof Let i ≥ 0. Then [X upon Y ]i = [X @ W ]i = [X][W ]i = [X [W ]i ]0 = [X [W ]i fby . . .]0 = [X [W ]i upon Y i ]0 = [X upon Y ]i Defn. 4.6 Prop. 1.2 Axiom 2.2 Axiom 1.5 Defn. 2.3 Lemma 5 Hence X upon Y = X upon Y .  Now that the corresponding definitions are shown to be equivalent, we can generalize and head off in the negative direction as well: Definition 6 def (1) prev X = X @ (# − 1) def (2) X fby Y = if # ≤ 0 then X else Y @ (# − 1) B Summary of the Operators’ Examples Here we illustrate a few basic examples of application of the Forensic Lucid operators (both, classical Lucid and the newly introduced operators). Assume we have two bounded (between bod and eod) streams X and Y of ten elements. The X stream is just an ordered sequence of natural numbers between 1 and 10. If queried for values below 1 an beginning-of-data (bod) marker would be returned; similarly if queried beyond 10, the end-of-data marker (eod) is returned. The Y stream is a sequence of ten truth values (can be replaced with 0 for “false” and 1 for “true”). The operators applied to these streams may return bounded or unbounded streams of the same or different length than the original depending on the definition of a particular operator. Also assume the current dimension index is 0. The resulting table showing the application of the classical and the new operators is in Table 1. stream/index -1 0 1 2 3 4 5 6 7 8 9 10 11 X bod 1 2 3 4 5 6 7 8 9 10 eod eod Y bod T F F T F F T T F T eod eod X first Y 1 1 1 1 1 1 1 1 1 1 X last Y 10 10 10 10 10 10 10 10 10 10 X next Y 2 3 4 5 6 7 8 9 10 eod eod X prev Y bod X fby Y 1 T F F T F F T T F T eod X pby Y T F F T F F T T F T 1 eod X wvr Y 1 4 7 8 10 X rwvr Y 10 8 7 4 1 X nwvr Y 2 3 5 6 9 X nrwvr Y 9 6 5 3 2 X asa Y 1 1 1 1 1 1 1 1 1 1 X nasa Y 2 2 2 2 2 2 2 2 2 2 X ala Y 10 10 10 10 10 10 10 10 10 10 X nala Y 9 9 9 9 9 9 9 9 9 9 X upon Y 1 2 2 2 3 3 3 4 5 5 eod X rupon Y 10 9 9 8 7 7 7 6 6 6 bod X nupon Y 1 1 2 3 3 4 5 5 5 6 6 eod X nrupon Y 10 10 9 9 9 8 7 7 6 5 5 bod neg X -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 eod eod not Y F T T F T T F F T F eod eod X and Y 1 0 0 1 0 0 1 1 0 1 eod eod X or Y 1 2 3 5 5 6 7 9 9 11 eod eod X xor Y 0 2 3 5 5 6 6 9 9 11 eod eod Table 1. Example of Application of Forensic Lucid Operators to Bounded Streams
6cs.PL
Isotonic regression in general dimensions Qiyang Han∗, Tengyao Wang†, Sabyasachi Chatterjee‡and Richard J. Samworth§ arXiv:1708.09468v1 [math.ST] 30 Aug 2017 September 1, 2017 Abstract We study the least squares regression function estimator over the class of real-valued functions on [0, 1]d that are increasing in each coordinate. For uniformly bounded signals and with a fixed, cubic lattice design, we establish that the estimator achieves the minimax rate of order n− min{2/(d+2),1/d} in the empirical L2 loss, up to poly-logarithmic factors. Further, we prove a sharp oracle inequality, which reveals in particular that when the true regression function is piecewise constant on k hyperrectangles, the least squares estimator enjoys a faster, adaptive rate of convergence of (k/n)min(1,2/d) , again up to poly-logarithmic factors. Previous results are confined to the case d ≤ 2. Finally, we establish corresponding bounds (which are new even in the case d = 2) in the more challenging random design setting. There are two surprising features of these results: first, they demonstrate that it is possible for a global empirical risk minimisation procedure to be rate optimal up to poly-logarithmic factors even when the corresponding entropy integral for the function class diverges rapidly; second, they indicate that the adaptation rate for shape-constrained estimators can be strictly worse than the parametric rate. 1 Introduction Isotonic regression is perhaps the simplest form of shape-constrained estimation problem, and has wide applications in a number of fields. For instance, in medicine, the expression of a leukaemia antigen has been modelled as a monotone function of white blood cell count and DNA index (Schell and Singh, 1997), while in education, isotonic regression has been used to investigate the dependence of college grade point average on high school ranking and standardised test results (Dykstra and Robertson, 1982). It is often generally accepted that genetic effects on phenotypes such as height, fitness or disease are monotone (Mani et al., 2007; Roth, Lipshitz and Andrews, 2009; Luss, Rosset and Shahar, 2012), but additive ∗ University University ‡ University § University † of of of of Washington. Email: [email protected] Cambridge. Email: [email protected] Chicago and University of Illinois at Urbana-Champaign. Email: [email protected] Cambridge. Email: [email protected] 1 structures have been found to be inadequate in several instances (Shao et al., 2008; Goldstein, 2009; Eichler et al., 2010). Alternative simplifying interaction structures have also been considered, including those based on products (Elena and Lenski, 1997), logarithms (Sanjuan and Elena, 2006) and minima (Tong et al., 2001), but the form of genetic interaction between factors is not always clear and may vary between phenotypes (Luss, Rosset and Shahar, 2012). A simple class of isotonic functions, which includes all of the above structures as special cases, is the class of block increasing functions  Fd := f : [0, 1]d → R, f (x1 , . . . , xd ) ≤ f (x′1 , . . . , x′d ) when xj ≤ x′j for j = 1, . . . , d . In this paper, we suppose that we observe data (X1 , Y1 ), . . . , (Xn , Yn ), with n ≥ 2, satisfying Yi = f0 (Xi ) + ǫi , i = 1, . . . , n, (1) where f0 : [0, 1]d → R is Borel measurable, ǫ1 , . . . , ǫn are independent N(0, 1) noise, and the covariates X1 , . . . , Xn , which take values in the set [0, 1]d , can either be fixed or random. Our goal is P to study the performance of the least squares isotonic regression estimator fˆn ∈ argminf ∈Fd ni=1 {Yi − f (Xi )}2 in terms of its empirical risk   X n 1 2 {fˆn (Xi ) − f0 (Xi )} . R(fˆn , f0 ) := E n i=1 (2) Note that this loss function only considers the errors made at the design points X1 , . . . , Xn , and these design points naturally induce a directed acyclic graph GX = (V (GX ), E(GX )) with V (GX ) = {1, . . . , n} and E(GX ) = {(i, i′ ) : (Xi )j ≤ (Xi′ )j ∀ j = 1, . . . , d}. It is therefore natural to restate the problem in terms of isotonic vector estimation on directed acyclic graphs. Recall that given a directed acyclic graph G = (V (G), E(G)), we may define a partially ordered set (V (G), ≤), where u ≤ v if and only if there exists a directed path from u to v. We define the class of isotonic vectors on G by M(G) := {θ ∈ RV (G) : θu ≤ θv for all u ≤ v}. Hence, for a signal vector θ0 = ((θ0 )i )ni=1 := (f0 (Xi ))ni=1 ∈ M(GX ), the least squares estimator θ̂n = ((θ̂n )i )ni=1 := (fˆn (Xi ))ni=1 can be seen as the projection of (Yi )ni=1 onto the polyhedral convex cone M(GX ). Such a geometric interpretation means that least squares estimators for isotonic regression, in general dimensions or on generic directed acyclic graphs, can be efficiently computed using convex optimisation algorithms (see, e.g., Dykstra (1983); Kyng, Rao and Sachdeva (2015); Stout (2015)). In the special case where d = 1, model (1) reduces to the univariate isotonic regression problem that has a long history (e.g. Brunk, 1955; van Eeden, 1958; Barlow et al., 1972; van de Geer, 1990, 1993; Donoho, 1991; Birgé and Massart, 1993; Meyer and Woodroofe, 2000; Durot, 2007, 2008; Yang and Barber, 2017). See Groeneboom and Jongbloed (2014) for a general introduction. Since the risk only depends on the ordering of the design points in the univariate case, fixed and random designs are equivalent for d = 1 under the empirical risk 2 function (2). It is customary to write R(θ̂n , θ0 ) in place of R(fˆn , f0 ) for model (1) with fixed design points. When (θ0 )1 ≤ · · · ≤ (θ0 )n (i.e. X1 ≤ · · · ≤ Xn ), Zhang (2002) proved that there exists a universal constant C > 0 such that 2/3   log n (θ0 )n − (θ0 )1 , (3) + R(θ̂n , θ0 ) ≤ C n n which shows in particular that the risk of the least squares estimator is no worse than O(n−2/3 ) for signals θ0 of bounded uniform norm. In recent years, there has been considerable interest and progress in studying the automatic rate-adaptation phenomenon of shape-constrained estimators. This line of study was pioneered by Zhang (2002) in the context of univariate isotonic regression, followed by Chatterjee, Guntuboyina and Sen (2015) and most recently Bellec (2017), who proved that    kθ − θ0 k22 k(θ) en R(θ̂n , θ0 ) ≤ inf , (4) + log θ∈M(GX ) n n k(θ) where k(θ) is the number of constant pieces in the isotonic vector θ. The inequality (4) is often called a sharp oracle inequality, with the sharpness referring to the fact that the approximation error term n−1 kθ0 − θk22 has leading constant 1. The bound (4) shows nearly parametric adaptation of the least squares estimator in univariate isotonic regression when the underlying signal has a bounded number of constant pieces. Other examples of adaptation in univariate shape-constrained problems include the maximum likelihood estimator of a log-concave density (Kim, Guntuboyina and Samworth, 2017), and the least squares estimator in unimodal regression (Chatterjee and Lafferty, 2017). Much less is known about the rate of convergence of the least squares estimator in the model (1), or indeed the adaptation phenomenon in shape-restricted problems more generally, in multivariate settings. The only work of which we are aware in the isotonic regression case is Chatterjee, Guntuboyina and Sen (2017), which deals with the fixed, lattice design case when d =Q 2. For a general dimension d, and for n1 , . . . , nd ∈ N, we define this lattice by Ld,n1 ,...,nd := dj=1 {1, . . . , nj }; when n1 = . . . = nd = n1/d for some n ∈ N, we also write Ld,n := Ld,n1 ,...,nd as shorthand. When {X1 , . . . , Xn } = L2,n1 ,n2 , Chatterjee, Guntuboyina and Sen (2017) showed that there exists a universal constant C > 0 such that   ((θ0 )n1 ,n2 − (θ0 )1,1 ) log4 n log8 n ; (5) + R(θ̂n , θ0 ) ≤ C n1/2 n with a corresponding minimax lower bound of order n−1/2 . They also provided a sharp oracle inequality of the form   kθ − θ0 k22 Ck(θ) log8 n , (6) + R(θ̂n , θ0 ) ≤ inf θ∈M(L2,n1 ,n2 ) n n where k(θ) is the minimal number of rectangular blocks into which L2,n1 ,n2 may be partitioned such that θ0 is constant on each rectangular block. 3 A separate line of work has generalised the univariate isotonic regression problem to multivariate settings by assuming an additive structure (see e.g. Bacchetti (1989); MortonJones et al. (2000); Mammen and Yu (2007); Chen and Samworth (2016)). In the simplest setting, these works investigate the regression problem (1), where the signal f0 belongs to Fdadd :=  f ∈ Fd : f (x1 , . . . , xd ) = d X j=1 fj (xj ), fj ∈ F1 , kfj k∞  ≤1 . The additive structure greatly reduces the complexity of the class; indeed, it can be shown that the least squares estimator over Fdadd attains the univariate risk n−2/3 , up to multiplicative constants depending on d (e.g. van de Geer, 2000, Theorem 9.1). The main contribution of this paper is to provide risk bounds for the isotonic least squares estimator when d ≥ 3, both from a worst-case perspective and an adaptation point of view. Specifically, we show that in the fixed lattice design case, the least squares estimator satisfies sup θ0 ∈M(Ld,n ),kθ0 k∞ ≤1 R(θ̂n , θ0 ) ≤ Cn−1/d log4 n, (7) for some universal constant C > 0. This rate turns out to be the minimax risk up to polylogarithmic factors in this problem. Furthermore, we establish a sharp oracle inequality: there exists a universal constant C > 0 such that for every θ0 ∈ RLd,n , R(θ̂n , θ0 ) ≤ inf  θ∈M(Ld,n )  2/d   en kθ − θ0 k22 k(θ) 8 , +C log n n k(θ) (8) where k(θ) is the number of constant hyperrectangular pieces in θ. This reveals an adaptation rate of nearly (k/n)2/d for signals that are close to an element of M(Ld,n ) that has at most k hyperrectangular blocks. A corresponding lower bound is also provided, showing that the least squares estimator cannot adapt faster than the n−2/d rate implied by (8) even for constant signal vectors. We further demonstrate that the worst-case bounds and oracle inequalities (7) and (8), with slightly different poly-logarithmic exponents, remain valid for random design points X1 , . . . , Xn sampled independently from a distribution on [0, 1]d with a Lebesgue density bounded away from 0 and ∞. The results in the case of random design are novel even for dimension d = 2. These results are surprising in particular with regard to the following two aspects: 1. The negative results of Birgé and Massart (1993) have spawned a heuristic belief that one should not use global empirical risk minimisation procedures1 when the entropy integral for the corresponding function class diverges (e.g. van de Geer (2000, p. 121– 122), Rakhlin, Sridharan and Tsybakov (2017)). It is therefore of particular interest to see that in our isotonic regression function setting, the global least squares estimator is still rate optimal (up to poly-logarithmic factors). See also the discussion after Corollary 1. 1 The term ‘global’ refers here to procedures that involve minimisation over the entire function class, as opposed to only over a sieve; cf. van de Geer (2000). 4 2. Sharp adaptive behaviour for shape-constrained estimators has previously only been shown when the adaptive rate is nearly parametric (see, e.g., Guntuboyina and Sen (2015); Chatterjee, Guntuboyina and Sen (2015); Bellec (2017); Kim, Guntuboyina and Samworth (2017)). On the other hand, our results here show that the least squares estimator in the d-dimensional isotonic regression problem necessarily adapts at a strictly nonparametric rate. Clearly, the minimax optimal rate for constant functions is parametric. Hence, the least squares estimator in this problem adapts at a strictly suboptimal rate while at the same time being nearly rate optimal from a worst-case perspective. In both the fixed lattice design and the more challenging random design cases, our analyses are based on a novel combination of techniques from empirical process theory, convex geometry and combinatorics. We hope these methods can serve as a useful starting point towards understanding the behaviour of estimators in other multivariate shape-restricted models. The rest of the paper is organised as follows. In Section 2, we state the main results for the fixed lattice design model. Section 3 describes corresponding results in the random design case. Proofs of all main theoretical results are contained in Sections 4 and 5, whereas proofs of ancillary results are deferred until Section 6. 1.1 Notation For a real-valued measurable function f defined on a probability space (X , A, P ) and for p ∈ [1, ∞), we let kf kLp (P ) := P |f |p)1/p denote the usual Lp (P )-norm, and write kf k∞ := supx∈X |f (x)|. For r ≥ 0, we write Bp (r, P ) := {f : X → R, kf kLp (P ) ≤ r} and B∞ (r) := {f : X → R, kf k∞ ≤ r}. We will abuse notation slightly and also write Bp (r) := {v ∈ Rn : kvkp ≤ r} for p ∈ [1, ∞]. The Euclidean inner product on Rd is denoted by h·, ·i. For x, y ∈ Rd , we write x  y if xj ≤ yj for all j = 1, . . . , d.  For ε > 0, the ε-covering number of a (semi-)normed space (F , k·k), denoted N ε, F , k·k , is the smallest number of closed ε-balls whose union covers F . The ε-bracketing number, denoted N[ ] (ε, F , k · k), is the smallest number of ε-brackets, of the form [l, u] := {f ∈ F : l ≤ f ≤ u} such that ku − lk ≤ ε, and whose union covers F . The metric/bracketing entropy is the logarithm of the covering/bracketing number. Throughout the article ǫ1 , . . . , ǫn and {ǫw : w ∈ Ld,n1 ,...,nd } denote independent standard normal random variables and ξ1 , . . . , ξn denote independent Rademacher random variables, both independent of all other random variables. For two probability measures P and Q defined on the same measurable space (X , A), we write (P, Q) := supA∈A |P (A) − Q(A)| R dTVdP for their total variation distance, and d2KL (P, Q) := X log dQ dP for their Kullback–Leibler divergence. We use c, C to denote generic universal positive constants and use cx , Cx to denote generic positive constants that depend only on x. Exact numeric values of these constants may change from line to line unless otherwise specified. Also, a .x b and a &x b mean a ≤ Cx b and a ≥ cx b respectively, and a ≍x b means a .x b and a &x b (a . b means a ≤ Cb for some absolute constant C). We also define log+ (x) := log(x ∨ e). 5 2 Fixed lattice design In this section, we focus on the model (1) in the case where the set of design points forms a finite cubic lattice Ld,n , defined in the introduction. In particular, we will assume in this section that n = nd1 for some n1 ∈ N. We use the same notation Ld,n both for the set of points and the directed acyclic graph on these points with edge structure arising from the natural partial ordering induced by . Thus, in the case d = 1, the graph L1,n is simply a directed path, and this is the classical univariate isotonic regression setting. The case d = 2 is studied in detail in Chatterjee, Guntuboyina and Sen (2017). Our main interest lies in the cases d ≥ 3. 2.1 Minimax rate-optimality of least squares estimator Our first result provides an upper bound on the risk of the least squares estimator θ̂n = θ̂n (Y1 , . . . , Yn ) of θ0 ∈ M(Ld,n ). Theorem 1. Let d ≥ 2. There exists a universal constant C > 0 such that sup θ0 ∈M(Ld,n )∩B∞ (1) R(θ̂n , θ0 ) ≤ Cn−1/d log4 n. Theorem 1 reveals that, up to a poly-logarithmic factor, the empirical risk of the least squares estimator converges to zero at rate n−1/d . The upper bound in Theorem 1 is matched, up to poly-logarithmic factors, by the following minimax lower bound. Proposition 1. There exists a constant cd > 0, depending only on d, such that for d ≥ 2, inf sup θ̃n θ0 ∈M(Ld,n )∩B∞ (1) R(θ̃n , θ0 ) ≥ cd n−1/d , where the infimum is taken over all estimators θ̃n = θ̃n (Y1 , . . . , Yn ) of θ0 . From Theorem 1 and Proposition 1, together with existing results mentioned in the introduction for the case d = 1, we see that the worst-case risk n− min{2/(d+2),1/d} (up to polylogarithmic factors) of the least squares estimator exhibits different rates of convergence in dimension d = 1 and dimensions d ≥ 3, with d = 2 being a transitional case. From the proof of Proposition 1, we see that it is the competition between the cardinality of the maximum chain (totally ordered subset) and the maximum antichain (subset of mutually incomparable design points) that explains the different rates. Similar transitional behaviour was recently observed by Kim and Samworth (2016) in the context of log-concave density estimation, though there it is the tension between estimating the density in the interior of its support and estimating the support itself that drives the transition. The two results above can readily be translated into bounds for the rate of convergence for estimation of a block monotonic function with a fixed lattice design. Recall that Fd is the class of block increasing functions. Suppose that for some f0 ∈ Fd , and at each 1/d x = (x1 , . . . , xd ) ∈ P n−1 , we observe Y (x) ∼ N(f0 (x), 1) independently. 1 Ld,n , where n1 = n −1 Define Pn := n x∈n−1 Ld,n δx and let A denote the set of hypercubes of the form A = 1 6 i −1 Qd i where either Aj = [0, n11 ] or Aj = ( jn1 , nj1 ] for some ij ∈ {2, . . . , n1 }. Now let H denote the set of functions f ∈ Fd that are piecewise constant on each A ∈ A, and set j=1 Aj , n 1X {Y (xi ) − f (xi )}2 . fˆn := argmin n i=1 f ∈H The following is a fairly straightforward corollary of Theorem 1 and Proposition 1. Corollary 1. There exist constants cd , Cd > 0, depending only on d, such that for Q = Pn or Lebesgue measure on [0, 1]d , we have cd n−1/d ≤ inf sup f˜n f0 ∈Fd ∩B∞ (1) Ekf˜n − f0 k2L2 (Q) ≤ sup f0 ∈Fd ∩B∞ (1) Ekfˆn − f0 k2L2 (Q) ≤ Cd n−1/d log4 n, where the infimum is taken over all measurable functions of {Y (x) : x ∈ n−1 1 Ld,n }. This corollary is surprising in the following sense. Gao and Wellner (2007, Theorem 1.1) proved that for d ≥ 3,  log N ε, Fd ∩ B∞ (1), k · k2 ≍d ε−2(d−1) . (9) In particular, for d ≥ 3, the classes Fd ∩ B∞ (1) are massive in the sense that the entropy R 1 1/2 integral δ log N(ε, Fd ∩ B∞ (1), k · k2) dε diverges at a polynomial rate in δ −1 as δ ց 0. To the best of our knowledge, this is the first example of a setting where a global empirical risk minimisation procedure has been proved to attain (nearly) the minimax rate of convergence over such massive parameter spaces. 2.2 Sharp oracle inequality In this subsection, we consider the adaptation behaviour of the least squares estimator in dimensions d ≥ 2 (again, the d = 2 case is covered in Chatterjee, Guntuboyina and Sen (2017)). Our main result is the sharp oracle Q inequality in Theorem 2 below. We call a set in Rd a hyperrectangle if it is of the form dj=1 Ij where Ij ⊆ R is an interval for each j = 1, . . . , d. By a slight abuse of terminology, we also call a subset of Ld,n a hyperrectangle if it is the intersection of a hyperrectangle in [0, 1]d and Ld,n . We say a subset A of Ld,n is a Q two-dimensional sheet if A = dj=1 [aj , bj ] where |{j : bj = aj }| ≥ d − 2. A two-dimensional sheet is therefore a special type of hyperrectangle whose intrinsic dimension is at most two. For θ ∈ M(Ld,n ), let K(θ) denote the cardinality of the minimal partition Ld,n = ⊔K ℓ=1 Aℓ of Ld,n into a disjoint union of two-dimensional sheets A1 , . . . , AK , where the restricted vector θAℓ = (θ(u))u∈Aℓ is constant for each ℓ = 1, . . . , K. Theorem 2. Let d ≥ 2. There exists a universal constant C > 0 such that for every θ0 ∈ RLd,n ,    n kθ − θ0 k22 CK(θ) 8 R(θ̂n , θ0 ) ≤ inf . + log+ θ∈M(Ld,n ) n n K(θ) 7 We remark that Theorem 2 does not imply (nearly) parametric adaptation when d ≥ 3. This is because even when θ0 is constant on Ld,n for every n, we have K(θ0 ) = n(d−2)/d → ∞ as n → ∞. The following corollary of Theorem 2 gives an alternative (weaker) form of oracle inequality that offers easier comparison to lower dimensional results given in (4) and (6). Let M(k) (Ld,n ) be the collection of all θ ∈ M(Ld,n ) such that there exists a partition Ld,n = ⊔kℓ=1 Rℓ where R1 , . . . , Rk are hyperrectangles with the property that for each ℓ, the restricted vector θRℓ is constant. Theorem 3. Let d ≥ 2. There exists a universal constant C > 0 such that for every θ0 ∈ RLd,n ,   2/d   kθ − θ0 k22 k n 8 inf . R(θ̂n , θ0 ) ≤ inf +C log+ k∈N θ∈M(k) (Ld,n ) n n k It is important to note that both Theorems 2 and 3 allow for model misspecification, as it is not assumed that θ0 ∈ M(Ld,n ). For signal vectors θ0 that are piecewise constant on k hyperrectangles, Theorem 3 provides an upper bound of the risk of order (k/n)2/d up to poly-logarithmic factors. The following proposition shows that even for a constant signal vector, the adaptation rate of n−2/d given in Theorem 3 cannot be improved. Proposition 2. Let d ≥ 2. There exists a constant cd > 0, depending only on d, such that for any θ0 ∈ M(1) (Ld,n ), ( n−1 log2 n if d = 2 R(θ̂n , θ0 ) ≥ cd n−2/d if d ≥ 3. The case d = 2 of this result is new, and reveals both a difference with the univariate situation, where the adaptation rate is of order n−1 log n (Bellec, 2017), and that a poly-logarithmic penalty relative to the parametric rate is unavoidable for the least squares estimator. Moreover, we see from Proposition 2 that for d ≥ 3, although the least squares estimator achieves a faster rate of convergence than the worst-case bound in Theorem 1 on constant signal vectors, the rate is not parametric, as would have been the case for a minimax optimal estimator over the set of constant vectors. This is in stark contrast to the nearly parametric adaptation results established in (4) and (6) for dimensions d ≤ 2. Another interesting aspect of these results relates to the notion of statistical dimension, R 2 defined for an arbitrary cone C in Rn by2 δ(C) := Rn kΠC (x)k22 (2π)−n/2 e−kxk2 /2 dx, where ΠC is the projection onto the set C (Amelunxen et al., 2014). Theorem 3 and Proposition 2 reveal a type of phase transition phenomenon for the statistical dimension δ(M(Ld,n )) = R(θ̂n , 0) of the monotone cone (cf. Table 1). The following corollary of Theorem 2 gives another example where different adaptation behaviour is observed in dimensions d ≥ 3, in the sense that the n−2/d log8 n adaptive rate achieved for constant signal vectors is actually available for a much wider class of isotonic signals that depend only on d − 2 of all d coordinates of Ld,n . For r = 0, 1, . . . , d, we say 2 Our reason for defining the statistical dimension via an integral rather than as EkΠC (ǫ)k22 is because, in the random design setting, the cone C is itself random, and in that case δ(C) is a random quantity. 8 d 1  Table 1: Bounds∗ for δ M(Ld,n ) . 2 ≥3 ∗ † ‡ upper bound Pn −1 † i=1 i lower bound Pn −1 † i=1 i . n1−2/d log8 n &d n1−2/d . log8 n ‡ & log2 n Entries without a reference are proved in this paper. Amelunxen et al. (2014) Chatterjee, Guntuboyina and Sen (2017) a vector θ0 ∈ M(Ld,n ) is a function of r variables, written θ0 ∈ Mr (Ld,n ), if there exists J ⊆ {1, . . . , d}, of cardinality r, such that (θ0 )(x1 ,...,xd ) = (θ0 )(x′1 ,...,x′d ) whenever xj = x′j for all j ∈ J . Corollary 2. For d ≥ 2, there exists constant Cd > 0, depending  −2/d  log8 n n sup R(θ̂n , θ0 ) ≤ Cd n−4/(3d) log16/3 n  θ0 ∈Mr (Ld,n )∩B∞ (1)  −1/d 4 n log n only on d, such that if r ≤ d − 2 if r = d − 1 if r = d. If the signal vector θ0 belongs to Mr (Ld,n ), then it is intrinsically an r-dimensional isotonic signal. Corollary 2 demonstrates that the least squares estimator exhibits three different levels of adaptation when the signal is a function of d, d − 1, d − 2 variables respectively. However, viewed together with Proposition 1, Corollary 2 shows that no further adaptation is available when the intrinsic dimension of the signal vector decreases further. Moreover, if we let ñ = n2/d denote the size of a maximal two-dimensional sheet in Ld,n , then the three levels of adaptive rates in Corollary 2 are ñ−1 , ñ−2/3 and ñ−1/2 respectively, up to poly-logarithmic factors, matching the two-dimensional ‘automatic variable adaptation’ result described in Chatterjee, Guntuboyina and Sen (2017, Theorem 2.4). In this sense, the adaptation of the isotonic least squares estimator in general dimensions is essentially a two-dimensional phenomenon. 3 Random design In this section, we consider the setting where the design points X1 , . . . , Xn are independent and identically distributed from some distribution P supported on the unit cube [0, 1]d . We will assume throughout that P has Lebesgue density p0 such that 0 < m0 ≤ inf x∈[0,1]d p0 (x) ≤ supx∈[0,1]d p0 (x) ≤ M0 < ∞. Since the least squares estimator fˆn is only well-defined on X1 , . . . , Xn , for definiteness, we extend fˆn to [0, 1]d by defining fˆn (x) := min {fˆn (Xi ) : 1 ≤  P i ≤ n, Xi  x} ∪ {maxi fˆn (Xi )} . If we let Pn := n−1 ni=1 δXi , then the risk function (2) is R(fˆn , f0 ) = Ekfˆn − f0 k2L2 (Pn ) in the context of random design. 9 The main results of this section are the following two theorems, establishing respectively the worst-case performance and the sharp oracle inequality for the least squares estimator in (k) the random design setting. We write Fd for the class of functions in Fd that are piecewise (k) constant on k hyperrectangular pieces. In other words, if f ∈ Fd , then there exists a partition [0, 1]d = ⊔kℓ=1 Rℓ , such that the closure of each Rℓ is a hyperrectangle and f is a constant function when restricted to each Rℓ . Let γ2 := 9/2 and γd := (d2 + d + 1)/2 for d ≥ 3. Theorem 4. Let d ≥ 2. There exists a constant Cd,m0 ,M0 > 0, depending only on d, m0 and M0 , such that sup R(fˆn , f0 ) ≤ Cd,m0 ,M0 n−1/d logγd n. f0 ∈Fd ∩B∞ (1) Theorem 5. Let d ≥ 2. There exists a constant Cd,m0 ,M0 > 0, depending only on d, m0 and M0 , such that for any measurable function f0 : [0, 1]d → R, we have  2/d    k 2γd n 2 ˆ R(fn , f0 ) ≤ inf inf kf − f0 kL2 (P ) + Cd,m0 ,M0 . log+ k∈N f ∈F (k) n k d To the best of our knowledge, Theorem 5 is the first sharp oracle inequality in the shapeconstrained regression literature with random design. The different norms on the left- and right-hand sides arise from the simple observation that Ekf − f0 k2L2 (Pn ) = kf − f0 k2L2 (P ) for (k) f ∈ Fd . The proofs of Theorems 4 and 5 are considerably more involved than those of the corresponding Theorems 1 and 2 in Section 2. We briefly mention two major technical difficulties: 1. The size of Fd , as measured by its entropy, is large when d ≥ 3, even after L∞ truncation (cf. (9)). As rates obtained from the entropy integral (e.g. van de Geer, 2000, Theorem 9.1) do not match those from Sudakov lower bounds for such classes, standard entropy methods result in a non-trivial gap between the minimax rates of convergence, which typically match the Sudakov lower bounds (e.g. Yang and Barron, 1999, Proposition 1), and provable risk upper bounds for least squares estimators when d ≥ 3. 2. In the fixed lattice design case, our analysis circumvents the difficulties of standard entropy methods by using the fact that a d-dimensional cubic lattice can be decomposed into a union of lower-dimensional pieces. This crucial property is no longer valid when the design is random. We do not claim any optimality of the power in the poly-logarithmic factor in the oracle inequality in Theorems 4 and 5. On the other hand, similar to the fixed, lattice design case, the worst-case rate n−1/d and adaptation rate n−2/d cannot be improved, as can be seen from the following two propositions. Proposition 3. Let d ≥ 2. There exists a constant cd,m0 ,M0 > 0, depending only on d, m0 and M0 , such that, inf sup R(f˜n , f0 ) ≥ cd,m0 ,M0 n−1/d , f˜n f0 ∈Fd ∩B∞ (1) 10 where the infimum is taken over all measurable functions f˜n of the data (X1 , Y1), . . . , (Xn , Yn ). Proposition 4. Let d ≥ 2. There exists a constant cd,M0 > 0, depending only on d and M0 , (1) such that for any f0 ∈ Fd , R(fˆn , f0 ) ≥ cd,M0 n−2/d . A key step in proving Proposition 4 is to establish that with high probability, the cardinality of the maximum antichain in GX is at least of order n1−1/d . When d = 2, the distribution of this maximum cardinality is the same as the distribution of the length of the longest decreasing subsequence of a uniform permutation of {1, . . . , n}, a famous object of study in probability and combinatorics. See Romik (2014) and references therein. 4 Proofs of results in Section 2 Throughout this section, ǫ = (ǫw )w∈Ld,n1 ,...,nd denotes a vector of independent standard normal random variables. It is now well understood that the risk of the least squares estimator in the Gaussian sequence model is completely characterised by the size of a localised Gaussian process; cf. Chatterjee (2014). The additional cone property of M(Ld,n ) makes the reduction even simpler: we only need to evaluate the Gaussian complexity of M(Ld,n ) ∩ B2 (1), where the Gaussian complexity of T ⊆ RLd,n1 ,...,nd is defined as wT := E supθ∈T hǫ, θi. Thus the result in the following proposition constitutes a key ingredient in analysing the risk of the least squares estimator. Proposition 5. There Q exists a universal constant C > 0 such that for d ≥ 2 and every 1 ≤ n1 ≤ · · · ≤ nd with dj=1 nj = n, we have p 2/π hǫ, θi ≤ C nd−1 n−1/2 ≤ E sup (d − 1)d−1 1 θ∈M(Ld,n1 ,...,nd )∩B2 (1) r −1/2 Remark. In the case n1 = · · · = nd = n1/d , we have nd−1 = 1 n n nd−1 nd q n nd−1 nd log4 n. = n1/2−1/d . Remark. From the symmetry of the problem, we see that the restriction that n1 ≤ · · · ≤ nd is not essential. In the general case, for the lower bound, n1 should be replaced with minj nj , while in the upper bound, nd−1 nd should be replaced with the product of the two largest elements of {n1 , . . . , nd } (considered here as a multiset). P Proof. We first prove the lower bound. Consider the set W := {w ∈ Ld,n1 ,...,nd : dj=1 wj = Pd − := {w ∈ Ld,n1 ,...,nd : n1 }, and define W + := {w ∈ Ld,n1 ,...,nd : j=1 wj > n1 } and W Pd j=1 wj < n1 }. For each realisation of the Gaussian random vector ǫ = (ǫw )w∈Ld,n1 ,...,nd , we define θ(ǫ) = (θw (ǫ))w∈Ld,n1 ,...,nd ∈ M(Ld,n1 ,...,nd ) by   if w ∈ W + 1 θw := sgn(ǫw ) if w ∈ W   −1 if w ∈ W − . 11 Since kθ(ǫ)k22 = n, it follows that     X X X θ(ǫ) 1 ǫw + |ǫw | hǫ, θi ≥ E ǫ, E sup ǫw − = 1/2 E kθ(ǫ)k2 n θ∈M(Ld,n1 ,...,nd )∩B2 (1) w∈W w∈W − w∈W + p 2/π = 1/2 |W |. n The proof of the lower bound is now completed by noting that    d−1 n1 d + n1 − 1 ≥ |W | = . (10) d−1 d−1 We next prove the upper bound. For j = 1, . . . , d − 2 and xj ∈ {1, . . . , nj }, we define Ax1 ,...,xd−2 := {w = (w1 , . . . , wd )⊤ ∈ Ld,n1 ,...,nd : (w1 , . . . , wd−2 ) = (x1 , . . . , xd−2 )}. Each Ax1 ,...,xd−2 can be viewed as a directed acyclic graph with graph structure inherited from Ld,n1 ,...,nd . Since L monotonicity is preserved under the subgraph restriction, we have that M(Ld,n1 ,...,nd ) ⊆ x1 ,...,xd−2 M(Ax1 ,...,xd−2 ). Therefore, by the Cauchy–Schwarz inequality, Amelunxen et al. (2014, Proposition 3.1(5, 9, 10)) and Chatterjee, Guntuboyina and Sen (2017, Theorem 2.1), we obtain that 2  2   hǫ, θi ≤ E E sup hǫ, θi sup θ∈M(Ld,n1 ,...,nd )∩B2 (1) θ∈M(Ld,n1 ,...,nd )∩B2 (1)  = δ M(Ld,n1 ,...,nd ) ≤ = δ M(L2,nd−1 ,nd ) as desired.  X x1 ,...,xd−2 d−2 Y nj . j=1 δ M(Ax1 ,...,xd−2 ) n nd−1 nd  log8 (end−1 nd ), Proof of Theorem 1. Fix θ0 ∈ M(Ld,n ) ∩ B∞ (1). By Chatterjee (2014, Theorem 1.1), the function t 7→ E sup hǫ, θ − θ0 i − t2 /2 θ∈M(Ld,n ),kθ−θ0 k≤t is strictly concave on [0, ∞) with a unique maximum at, say, t0 ≥ 0. We note that t0 ≤ t∗ for any t∗ satisfying t2 hǫ, θ − θ0 i ≤ ∗ . E sup (11) 2 θ∈M(Ld,n ),kθ−θ0 k≤t∗ P For a vector θ = (θx )x∈Ld,n , we define θ̄ := n−1 x∈Ld,n θx and write 1n ∈ RLd,n for the all-one vector. Then n o hǫ, θ − θ̄0 1n i + hǫ, θ̄0 1n − θ0 i hǫ, θ − θ0 i = E sup E sup θ∈M(Ld,n ),kθ−θ0 k2 ≤t∗ θ∈M(Ld,n ),kθ−θ0 k2 ≤t∗ ≤E =E sup θ∈M(Ld,n ),kθ−θ̄0 1n k2 ≤t∗ +n1/2 sup θ∈M(Ld,n )∩B2 (t∗ +n1/2 ) 12 hǫ, θ − θ̄0 1n i  hǫ, θi = t∗ + n1/2 wM(Ld,n )∩B2 (1) , where we recall that wM(Ld,n )∩B2 (1) = E supθ∈M(Ld,n )∩B2 (1) hǫ, θi. Therefore, to satisfy (11), it suffices to choose  2 1/2 t∗ = wM(Ld,n )∩B2 (1) + wM(L + 2n1/2 wM(Ld,n )∩B2 (1) d,n )∩B2 (1)  1/2 . max wM(Ld,n )∩B2 (1) , n1/4 wM(Ld,n )∩B2 (1) . (12) Consequently, by Chatterjee (2014, Corollary 1.2) and Proposition 5, we have that R(θ̂n , θ0 ) . n−1 max(1, t20 ) . n−1 t2∗ . n−1/d log4 n, which completes the proof. The following proposition is the main ingredient of the proof of the minimax lower bound in Proposition 1. It exhibits a combinatorial obstacle, namely the existence of a large antichain, that prevents any estimator from achieving a faster rate of convergence. We state the result in the more general and natural setting of least squares isotonic regression on directed acyclic graphs. Recall that the isotonic regression problem on a directed acyclic graph G = (V (G), E(G)) is of the form Yv = θv + ǫv , where θ = (θv )v∈V (G) ∈ M(G) and ǫ = (ǫv )v∈V (G) is a vector of independent N(0, 1) random variables. Proposition 6. If G = (V (G), E(G)) is a directed acyclic graph and W ⊆ V (G) is a maximum antichain of G, then inf sup θ̃n θ0 ∈M(G)∩B∞ (1) R(θ̃n , θ0 ) ≥ 8|W | , 27n where the infimum is taken over all measurable functions θ̃n of {Yv : v ∈ V (G)}. Proof. If v ∈ / W , then by the maximality of W , there exists u0 ∈ W such that either u0 ≤ v or u0 ≥ v. Suppose without loss of generality it is the former. Then v 6≤ u for any u ∈ W , because otherwise we would have u0 ≤ u, contradicting the fact that W is an antichain. It follows that we can write V (G) = W + ⊔ W ⊔ W − , where for all v ∈ W + , u ∈ W , we have u 6≥ v, and similarly for all v ∈ W − , u ∈ W , we have v 6≥ u. For τ = (τw ) ∈ {0, 1}W =: T , we define θτ = (θvτ ) ∈ M(G) ∩ B∞ (1) by   if v ∈ W − −1 θvτ = ρ(2τv − 1) if v ∈ W   1 if v ∈ W + , where ρ ∈ (0, 1) is a constant to be chosen later. Let Pτ denote the distribution of {Yv : v ∈ V (G)} when the isotonic signal is θτ . Then, for τ, τ ′ ∈ T , by Pinsker’s inequality (e.g. Pollard, 2002, p. 62), we have 1 n ′ d2TV (Pτ , Pτ ′ ) ≤ d2KL (Pτ , Pτ ′ ) = kθτ − θτ k22 = nρ2 kτ − τ ′ k0 . 2 4 13 Consequently, setting ρ = 2/(3n1/2 ), by Assouad’s Lemma (cf. Yu, 1997, Lemma 2), we have that inf θ̃n 8|W | 1 , R(θ̃n , θ0 ) ≥ inf sup Ekθ̃n − θτ k22 ≥ 2ρ2 |W |(1 − n1/2 ρ) = 27n θ̃n τ ∈T n θ0 ∈M(G)∩B∞ (1) sup as desired. Proof of Proposition 1. Recall that n1 = n1/d . We note that the set W :=  ⊤ v = (v1 , . . . , vd ) ∈ Ld,n : d X vj = n1 j=1   n1−1/d 1 −1 is an antichain in Ld,n of cardinality d+n ≥ (d−1) d−1 . Hence any maximum antichain of d−1 Ld,n is at least of this cardinality. The desired result therefore follows from Proposition 6. Proof of Corollary 1. For Q = Pn , the result is an immediate consequence of Theorem 1 and Proposition 1, together with the facts that inf sup θ̃n θ0 ∈M(Ld,n )∩B∞ (1) R(θ̃n , θ0 ) = inf sup f˜n f0 ∈Fd ∩B∞ (1) and sup R(θ̂n , θ0 ) = θ0 ∈M(Ld,n )∩B∞ (1) sup f0 ∈Fd ∩B∞ (1) Ekf˜n − f0 k2L2 (Pn ) Ekfˆn − f0 k2L2 (Pn ) . Now suppose that Q is Lebesgue measure on [0, 1]d . For any f : [0, 1]d → R, we may define θ(f ) : Ld,n → R by θ(f )(x) := f (n−1 1 x). On the other hand, for any θ : Ld,n → R, we can d also define f (θ) : [0, 1] → R by f (θ)(x1 , . . . , xd ) := θ(⌊n1 x1 ⌋, . . . , ⌊n1 xd ⌋). We first prove the upper bound by observing from Lemma 1 and Theorem 1 that  −1 sup Ekfˆn − f0 k2L2 (Q) ≤ 2 sup n Ekθ(fˆn ) − θ(f0 )k22 + kf0 − f (θ(f0 ))k2L2 (Q) f0 ∈Fd ∩B∞ (1) f0 ∈Fd ∩B∞ (1) ≤2 1 Ekθ̂n − θ0 k22 + 8dn−1/d ≤ Cd n−1/d log4 n, n θ0 ∈M(Ld,n )∩B∞ (1) sup as desired. Then by convexity of H and Proposition 1, we have inf sup f˜n f0 ∈Fd ∩B∞ (1) Ekf˜n − f0 k2L2 (Q) ≥ inf sup Ekf˜n − f (θ0 )k2L2 (Q) = inf sup Ekf (θ(f˜n )) − f (θ0 )k2L2 (Q) f˜n θ0 ∈M(Ld,n )∩B∞ (1) f˜n θ0 ∈M(Ld,n )∩B∞ (1) = inf θ̃n 1 Ekθ̃n − θ0 k22 ≥ cd n−1/d , θ0 ∈M(Ld,n )∩B∞ (1) n sup which completes the proof. 14 Proof of Theorem 2. Recall that the tangent cone at a point x in a closed, convex set K is defined as T (x, K) := {t(y − x) : y ∈ K, t ≥ 0}. By Bellec (2017, Proposition 2.1) (see also Chatterjee, Guntuboyina and Sen (2017, Lemma 4.1)), we have n o 1 inf (13) kθ − θ0 k22 + δ T (θ, M(Ld,n )) . R(θ̂n , θ0 ) ≤ n θ∈M(Ld,n ) For a fixed θ ∈ M(Ld,n ) such that K(θ) = K, let Ld,n = ⊔K ℓ=1 Aℓ be the partition of Ld,n into two-dimensional sheets Aℓ such that θ is constant on each Aℓ . Define mℓ := |Aℓ |. Then any u ∈ T (θ, M(Ld,n )) must be isotonic when restricted to each of the two-dimensional sheets; in other words K M T (θ, M(Ld,n )) ⊆ T (0, M(Aℓ)). ℓ=1 By Amelunxen et al. (2014, Proposition 3.1(9, 10)), we have  X M K K K   X  δ M(Aℓ ) . δ T (0, M(Aℓ)) = T (0, M(Aℓ )) = δ T (θ, M(Ld,n )) ≤ δ ℓ=1 ℓ=1 ℓ=1 (14) By a consequence of the Gaussian Poincaré inequality (cf. Boucheron, Lugosi and Massart, 2013, p. 73) and Proposition 5, we have  2  δ M(Aℓ ) ≤ E sup hǫAℓ , θi + 1 . log8+ mℓ . (15) θ∈M(Aℓ )∩B2 (1) Thus, by (14), (15) and Lemma 2 applied to x 7→ log8+ x, we have  δ T (θ, M(Ld,n )) . K X log8+ mℓ . K ℓ=1 log8+   n , K which together with (13) proves the desired result. Proof of Theorem 3. For a fixed θ ∈ M(k) (Ld,n ), let Ld,n = ⊔kℓ=1 Rℓ be the partition of Ld,n into hyperrectangles such that θQis constant on each hyperrectangle Rℓ . Suppose Rℓ has side ℓ| lengths m1 , . . . , md (so |Rℓ | = dj=1 mj ), so it can be partitioned into m|R parallel twoj mj ′ dimensional sheets. By choosing mj and mj ′ to be the largest two elements of the multiset {m1 , . . . , md } and using Jensen’s inequality (noting that x 7→ x1−2/d is concave when d ≥ 2), we obtain  1−2/d k X n 1−2/d . (16) K(θ) ≤ |Rℓ | ≤k k ℓ=1 This, combined with the oracle inequality in Theorem 2, gives the desired result. Proof of Proposition 2. Since the convex cone M(Ld,n ) is invariant under translation by any θ0 ∈ M(1) (Ld,n ), we may assume without loss of generality that θ0 = 0. By Chatterjee (2014, Corollary 1.2), we have 1 3/2 (17) R(θ̂n , 0) ≥ (t20 − Ct0 ), n 15 where  t0 : = argmax E t≥0 sup θ∈M(Ld,n )∩B2 (t)  = argmax t · E t≥0 2 hǫ, θi − t /2 sup θ∈M(Ld,n )∩B2 (1)  2 hǫ, θi − t /2  =E sup θ∈M(Ld,n )∩B2 (1) hǫ, θi. By Proposition 5, we have t0 = E sup θ∈M(Ld,n )∩B2 (1) hǫ, θi ≥ cd n1/2−1/d , which together with (17) proves the desired lower bound for cases d ≥ 3. For the d = 2 case, by Sudakov minorisation for Gaussian processes (e.g. Pisier, 1999, Theorem 5.6 and the remark following it) and Lemma 3, there exists a universal constant ε0 > 0 such that  E sup hǫ, θi & ε0 log1/2 N ε0 , M(L2,n ) ∩ B2 (1), k · k2 & log n. θ∈M(L2,n )∩B2 (1) This, together with (17), establishes the desired conclusion when d = 2. Proof of Corollary 2. Without loss of generality, we may assume that θ0 ∈ Mr (Ld,n ) is a function of the final  r variables. For x3 , . . . , xd ∈ {1, . . . , n1 }, we define the two-dimensional sheet Ax3 ,...,xd := (x1 , . . . , xd ) : x1 , x2 ∈ {1, . . . , n1 } . When r ≤ d − 2, we have that θ0 is constant on each Ax3 ,...,xd . Hence, by Theorem 2,  K(θ0 ) log8+ n/K(θ0 ) . n−2/d log8 n. R(θ̂n , θ0 ) . n Now suppose that θ0 ∈ Md−1 (Ld,n ). Let m be a positive integer to be chosen later. Then (ℓ) Ax3 ,...,xd = ⊔m ℓ=−m Ax3 ,...,xd , where   ℓ−1 ℓ (ℓ) Ax3 ,...,xd := Ax3 ,...,xd ∩ v ∈ Ld,n : . < (θ0 )v ≤ m m (ℓ) Let θ(m) ∈ M(Ld,n ) be the vector that takes the constant value ℓ/m on Ax3 ,...,xd for each ℓ = −m, . . . , m. Then setting m ≍ n2/(3d) log−8/3 n, we have by Theorem 2 that  8 kθ(m) − θ0 k22 K(θ(m) ) log+ n/K(θ(m) ) 1 m R(θ̂n , θ0 ) . + ≤ 2 + 2/d log8 n . n−4/(3d) log16/3 n. n n m n as desired. Finally, the r = d case is covered in Theorem 1. 16 5 Proof of results in Section 3 Henceforth we write EX for the expectation conditional on X1 , . . . , Xn , and also write Gn := n1/2 (Pn − P ). The key ingredient in the proofs of both Theorems 4 and 5 is the following proposition, which controls the risk of the least squares estimator when f0 = 0. Recall that γ2 = 9/2 and γd = (d2 + d + 1)/2 for d ≥ 3. Proposition 7. Let d ≥ 2. There exists a constant Cd,m0 ,M0 > 0, depending only on d, m0 and M0 , such that R(fˆn , 0) ≤ Cd,m0 ,M0 n−2/d log2γd n. The proof of Proposition 7 requires several reduction techniques, which we detail in Section 5.1 below. We first derive Theorems 4 and 5 from Proposition 7. Proof of Theorem 4. Since the argument used in the proof of Theorem 1, up to (12), does not depend on the design, we deduce from Chatterjee (2014, Corollary 1.2), Amelunxen et al. (2014, Proposition 3.1(5)) and the Cauchy–Schwarz inequality that R(fˆn , f0 ) .  1 E max 1, δ(M(GX )), n1/2 δ(M(GX ))1/2 . n On the other hand, by Proposition 7, we have  E δ M(GX ) .d,m0 ,M0 n1−2/d log2γd n. (18) (19) We obtain the desired result by combining (18) and (19). Proof of Theorem 5. For any f ∈ Fd , write θf,X := (f (X1 ), . . . , f (Xn ))⊤ ∈ Rn . By Bellec (2017, Proposition 2.1), we have   n o 1 2 ˆ R(fn , f0 ) ≤ E inf kθf,X − θf0 ,X k2 + δ T (θf,X , M(GX )) n f ∈Fd n o 1 (20) ≤ inf inf Ekθf,X − θf0 ,X k22 + E δ T (θf,X , M(GX )) . n k∈N f ∈Fd(k) (k) Now, for a fixed f ∈ Fd , let R1 , . . . , Rk be the corresponding hyperrectangles for which f is constant when restricted to each Rℓ . Define Xℓ := RL := |Xℓ |. Then ℓ ∩ {X1 , . . . , Xn } and  NℓL k k for fixed X1 , . . . , Xn , we have T (θf,X , M(GX )) ⊆ ℓ=1 M(GXℓ ). ℓ=1 T 0, M(GXℓ ) = Hence by Amelunxen et al. (2014, Proposition 3.1(9, 10)) and (19), we have that h n oi   E δ T (θf,X , M(GX )) = E E δ T (θf,X , M(GX )) N1 , . . . , Nk X k n o  ≤E E δ M(GXℓ ) Nℓ ℓ=1 .d,m0 ,M0  X k 1−2/d 2γd d Nℓ log+ Nℓ .d n(k/n)2/d log2γ E + (n/k), ℓ=1 17 (21) d where the final bound follows from applying Lemma 2 to the function x 7→ x1−2/d log2γ + (x). We complete the proof by substituting (21) into (20) and observing that 1 inf Ekθf,X − θf0 ,X k22 = inf Ekf − f0 k2L2 (Pn ) = inf kf − f0 k2L2 (P ) , (k) (k) n f ∈Fd(k) f ∈Fd f ∈Fd as required. Proof of Proposition 3. Without = nd1 for some Pdloss of generality, we may assume that nQ w −1 w  n1 ∈ N. Let W := {w ∈ Ld,n : j=1 wj = n1 }. For any w ∈ W , define Cw := dj=1 nj 1 , n1j . Note that x = (x1 , . . . , xd )⊤ ∈ ∪w∈W Cw if and only if ⌈n1 x1 ⌉ + · · · + ⌈n1 xd ⌉ = n1 . For any τ = (τw ) ∈ {0, 1}|W | =: T , we define fτ ∈ Fd by   if ⌈n1 x1 ⌉ + · · · + ⌈n1 xd ⌉ ≤ n1 − 1 0 fτ (x) := 1 if ⌈n1 x1 ⌉ + · · · + ⌈n1 xd ⌉ ≥ n1 + 1   ρτ(⌈n1 x1 ⌉,...,⌈n1 xd ⌉) if x ∈ ∪w∈W Cw , where ρ ∈ [0, 1] is to be specified later. Moreover, let τ w be the binary vector differing from τ in only the w coordinate. We write Eτ for the expectation over (X1 , Y1 ), . . . , (Xn , Yn ), where Yi = fτ (Xi ) + ǫi for i = 1, . . . , n. We let EX be the expectation over (Xi )ni=1 alone and EY |X,τ be the conditional expectation of (Yi )ni=1 given (Xi )ni=1 . Given any estimator f˜n , we have XX Z 1 2 max Eτ f˜n − fτ L2 (Pn ) ≥ |W | (f˜n − fτ )2 dPn Eτ τ ∈T 2 w∈W τ ∈T Cw   Z Z 1 XX 2 2 (f˜n − fτ w ) dPn (f˜n − fτ ) dPn + Eτ w Eτ = |W |+1 2 C C w w w∈W τ ∈T   Z Z X X 1 2 2 ˜ ˜ (fn − fτ w ) dPn (fn − fτ ) dPn + EY |X,τ w EX EY |X,τ = |W |+1 2 Cw Cw w∈W τ ∈T  Z h  i 1 XX 1 2 ≥ |W |+1 (fτ − fτ w ) dPn 1 − dTV PY |X,τ , PY |X,τ w , (22) EX 2 4 C w w∈W τ ∈T where PY |X,τ (respectively PY |X,τ w ) is the conditional distribution of (Yi )ni=1 given (Xi )ni=1 when the true signal is fτ (respectively fτ w ). The final inequality in the above display follows 1/2 R R because for ∆ := Cw (fτ − fτ w )2 dPn and A := Cw (f˜n − fτ )2 dPn ≥ ∆2 /4 , we have Z Z o ∆2  c 2 2 ˜ ˜ w w w PY |X,τ (A) + PY |X,τ (A ) (fn − fτ ) dPn ≥ (fn − fτ ) dPn + EY |X,τ EY |X,τ 4 Cw Cw  ∆2  ≥ 1 − dTV PY |X,τ , PY |X,τ w . 4 By Pinsker’s inequality (cf. Pollard, 2002, p. 62), we obtain that   1 n 2 w dTV PY |X,τ , PY |X,τ ≤ d2KL(PY |X,τ , PY |X,τ w ) = kfτ − fτ w k2L2 (Pn ) . 2 4 18 (23) P 3/2 Writing Nw := ni=1 1{Xi ∈Cw } , we have Nw ∼ Bin(n, P (Cw )), so EX Nw ≥ m0 and EX Nw ≤ 3/2 (EX Nw2 EX Nw )1/2 ≤ 21/2 M0 . Thus, together with (23), we have Z h  i 2 (fτ − fτ w ) dPn 1−dTV PY |X,τ , PY |X,τ w EX Cw    n1/2 2 ≥ EX kfτ − fτ w kL2 (Pn ) 1 − kfτ − fτ w kL2 (Pn ) 2   ρ ρ3 ρ2 ρ2 3/2 3/2 m0 − 1/2 M0 EX Nw ≥ . = EX Nw − n 2n n 2 3/2 Substituting the above inequality into (22), we obtain that for ρ = 23/2 m0 /(3M0 ), max Eτ f˜n − fτ τ ∈T 2 L2 (Pn ) ≥ |W | m30 ≥ cd,m0 ,M0 n−1/d , 3 27n M0 where the final inequality follows from a counting argument as in (10). This completes the proof. Proof of Proposition 4. Clearly we only need to establish the claim for f0 = 0. By Lemma 4, −1 1/d there is an event E with probability at least 1−e−ed (M0 n) log(M0 n) on which the data points 1/d X1 , . . . , Xn contain a maximal antichain WX with cardinality at least n1−1/d /(2eM0 ). Write WX+ := {Xi : ∃w ∈ WX , Xi ≻ w} and WX− := {Xi : ∃w ∈ WX , Xi ≺ w}. For each realisation of the n-dimensional Gaussian random vector ǫ, we define θX = θX (ǫ) = ((θX )w ) by   if w ∈ WX+ 1 (θX )w := sgn(ǫw ) if w ∈ WX   −1 if w ∈ WX− . We see that θX ∈ M(GX ). By Chatterjee (2014, Theorem 1.1), for f0 = 0, we have that   2 1/2 ˆ fn L2 (Pn ) = argmax sup hǫ, θi − t /2 = sup hǫ, θi. n t≥0 θ∈M(GX )∩B2 (t) θ∈M(GX )∩B2 (1) Hence E fˆn    θX (ǫ) 1E sup hǫ, θi ≥ 1/2 E ǫ, = 1/2 E n n kθX (ǫ)k2 θ∈M(GX )∩B2 (1)   X X X 1 |ǫi |1E . ≥ E ǫi 1E + ǫi 1E − n − + i:X ∈W 1 1 L2 (Pn ) i:Xi ∈WX i:Xi ∈WX i (24) X The first two terms in the bracket are seen to be zero by computing the expectation conditionally on X1 , . . . , Xn . For the third term, we have that  X   X      2 1/2 X |ǫi |1E = E E E |WX |1E &d,M0 n1−1/d , E |ǫi |1E ≥ (25) π i:X ∈W i:X ∈W i X i X 19 where the final inequality follows from Lemma 4. By (24), (25) and the Cauchy–Schwarz inequality, we have that  2 2 E fˆn L2 (Pn ) ≥ E fˆn L2 (Pn ) &d,M0 n−2/d , as desired. 5.1 Proof of Proposition 7 The proof of Proposition 7 is rather technical, so we sketch a brief outline of the main steps below: Step 1. Instead of bounding R(fˆn , 0) directly, we first consider bounding  E kfˆn k2L2 (P ) 1{kfˆn k∞ ≤4 log1/2 n} . (26) By Proposition 8, this task essentially reduces to understanding two empirical processes (28) and (29). By means of Lemmas 5 and 6, this in turn reduces to the study of the symmetrised local empirical process sup E f ∈Fd ∩B∞ (1)∩B2 (r,P ) n 1 X n1/2 ξi f (Xi ) , (27) i=1 for a suitable L2 (P ) radius r. Step 2. To obtain a sharp bound on the empirical process in (27), which constitutes the main technical challenge of the proof, we sliceP[0, 1]d into strips of the form [0, 1]d−1 × , ℓ ], for ℓ = 1, . . . , n1 , and decompose ni=1 ξi f (Xi ) into sums of smaller em[ ℓ−1 n1 n1 pirical processes over these strips. Each of these smaller empirical processes is then controlled via a bracketing entropy chaining argument (Lemma 7). The advantage of this decomposition is that the block monotonicity permits good control of the L2 (P ) norm of the envelope function in each strip (Lemma 9). Step 3. Having bounded (27), and hence also (26), we finally translate the bound of (26) back to a bound for R(fˆn , 0), our original quantity of interest. The cost of L∞ truncation is handled in Lemma 10, whereas our understanding of the symmetrised empirical process in (27) helps to control the discrepancy between the L2 (P ) norm and L2 (Pn ) norm risks (cf. Proposition 10). In our empirical process theory arguments, since our least squares estimator fˆn is defined to be lower semi-continuous, we can avoid measurability and countability digressions by defining G the class of real-valued lower semi-continuous functions on [0, 1]d and Fd′ := {f ∈ Fd ∩ G : f |(Q∩[0,1])d ⊆ Q}. This is a countable, uniformly dense3 subset of Fd ∩ G so that, for example, supf ∈Fd ∩G Gn f = supf ∈Fd′ Gn f . The main content of Step 1 is the following proposition. Here ‘uniformly dense’ means that for any f ∈ Fd ∩ G, we can find a sequence (fm ) in Fd′ such that kfm − f k∞ → 0. This can be done by defining, e.g., fm (x) := m−1 ⌈mf (x)⌉. 3 20 Proposition 8. Suppose that for each n ∈ N there exist a function φn : [0, ∞) → [0, ∞) and rn ≥ n−1/2 log1/2 n such that φn (rn ) ≤ n1/2 rn2 . Moreover, assume that for all r ≥ rn the map r 7→ φn (r)/r is non-increasing and sup E f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (r,P ) n 1 X n1/2 and sup E f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (r,P ) n 1 X n1/2 ǫi f (Xi ) ≤ C1 φn (r), (28) ξi f 2 (Xi ) ≤ C2 φn (r), (29) i=1 i=1 for some constants C1 , C2 > 0 that do not depend on r and n. Then for f0 = 0, we have that  E kfˆn k2L2 (P ) 1{kfˆn k∞ ≤4 log1/2 n} .C1 ,C2 rn2 . Proof. Let Mn f := −P f 2 . Then 2 n Pn i=1 ǫi f (Xi ) − 1 n Pn i=1 f 2 (Xi ) and Mf := E(Mn f ) = −kf k2L2 (P ) =: n 2X ǫi f (Xi ) + (Pn − P )f 2 . |Mn f − Mf | ≤ n i=1 P P Moreover, by definition of fˆn , we have ni=1 {ǫi − fˆn (Xi )}2 ≤ ni=1 ǫ2i , so Mn fˆn ≥ 0. Fix s ≥ 1 and for ℓ ∈ N, let Fd,ℓ := Fd ∩ B∞ (4 log1/2 n) ∩ B2 (2ℓ srn ). Then by a union bound, we have   ∞   X  1/2 ˆ ˆ Mn f ≥ 0 P kfn kL2 (P ) ≥ srn ∩ kfn k∞ ≤ 4 log n ≤ P sup ℓ=1 ≤ ≤ ∞ X ℓ=1 ∞ X ℓ=1 P  P   sup Mn f − Mf ≥ 22ℓ−2 s2 rn2 f ∈Fd,ℓ sup f ∈Fd,ℓ n 1 X n1/2 i=1 ǫi f (Xi ) ≥  22ℓ−4 s2 n1/2 rn2  f ∈Fd,ℓ \Fd,ℓ−1   ∞ X 2 2ℓ−3 2 1/2 2 s n rn . + P sup Gn f ≥ 2 ℓ=1 f ∈Fd,ℓ (30) By a moment inequality for empirical processes (Giné, Latala and Zinn, 2000, Proposition 3.1) and (28), we have  4  n 1 X log4 n 4 ℓ ℓ 4 E sup 1/2 .C1 φn (2 srn ) + (2 srn ) + ǫi f (Xi ) . (31) n2 f ∈Fd,ℓ n i=1 Similarly, by symmetrisation (cf. van der Vaart and Wellner (1996, Lemma 2.3.1)), the moment inequality for empirical processes mentioned above and condition (29), we have 4    4  n 1 X 2 log2 n 2 .E sup 1/2 E sup Gn f .C2 φ4n (2ℓ srn ) + (2ℓ srn )4 + ξi f (Xi ) . n2 f ∈Fd,ℓ n f ∈Fd,ℓ i=1 (32) 21 By (30), (31), (32) and Markov’s inequality, we obtain that 4 ∞    ℓ X  1 1 φ (2 sr ) n n 1/2 + . , (33) P kfˆn kL2 (P ) ≥ srn ∩ kfˆn k∞ ≤ 4 log n .C1 ,C2 22ℓ s2 n1/2 rn2 s4 s4 ℓ=1 where we have used the assumption rn ≥ n−1/2 log1/2 n and the fact that φn (2ℓ srn ) ≤ 2ℓ sφn (rn ) ≤ 2ℓ sn1/2 rn2 for the non-increasing function r 7→ φn (r)/r. The bound in (33) is valid for all s ≥ 1. Hence Z ∞   2 2 ˆ P fˆn L2 (P ) 1{kfˆn k∞ ≤4 log1/2 n} ≥ t dt E kfn kL2 (P ) 1{kfˆn k∞ ≤4 log1/2 n} = 0 Z ∞  2 2 2 ≤ rn + 2rn s P fˆn L2 (P ) 1{kfˆn k∞ ≤4 log1/2 n} ≥ s2 rn2 ds 1 .C1 ,C2 rn2 , as desired. The proposition below on the size of the symmetrised empirical process solves Step 2 in the outline of the proof of Proposition 7. 2 −d)/2 Proposition 9. Fix d ≥ 2 and suppose that r ≥ n− max{1/d,(1−2/d)} log(d a constant Cd,m0 ,M0 > 0, depending only on d, m0 and M0 , such that sup E f ∈Fd ∩B∞ (1)∩B2 (r,P ) n 1 X n1/2 i=1 n. There exists ξi f (Xi ) ≤ Cd,m0 ,M0 rn1/2−1/d logγd −1/2 n. Proof. It is convenient here to work with the class of block decreasing functions Fd,↓ := {f : + [0, 1]d → R : −f ∈ Fd } instead. We write Fd+ := {f ∈ Fd : f ≥ 0} and Fd,↓ := {f ∈ Fd,↓ : f ≥ 0}. By replacing f with −f and decomposing any function f into its positive and + negative parts, it suffices to prove the result with Fd,↓ in place of Fd . We handle the cases d = 2 and d ≥ 3 separately. Case d = 2. We apply Lemma 7 with η = r/(2n) and Lemma 8 to obtain sup E + f ∈F2,↓ ∩B∞ (1)∩B2 (r,P ) n 1 X n1/2 1/2 ξi f (Xi ) .d,m0 ,M0 n i=1 3 η + log n Z r η log4 n(log log n)2 r dε + ε n1/2 . r log4 n, as desired. Case d ≥ 3. We assume without loss of generality that n = nd1 for some n1 ∈ N. We 1 define strips Iℓ := [0, 1]d−1 × [ ℓ−1 , ℓ ] for ℓ = 1, . . . , n1 , so that [0, 1]d = ∪nℓ=1 Iℓ . Our n1 n1 strategy is to analyse the expected supremum of the symmetrised empirical process when restricted to each strip. To this end, define Sℓ := {X1 , . . . , Xn } ∩ Iℓ and Nℓ := |Sℓ |, and let Ω0 := {m0 n1−1/d /2 ≤ minℓ Nℓ ≤ maxℓ Nℓ ≤ 2M0 n1−1/d }. Then by Hoeffding’s inequality, 22 P(Ωc0 ) Hence we have   n1 X  m0 n ≤ 2n1 exp −m20 n1−2/d /8 . P Nℓ − ENℓ > ≤ 2n1 ℓ=1 sup E + f ∈Fd,↓ ∩B∞ (1)∩B2 (r,P ) where  Eℓ := E n 1 X n1/2 i=1  1/2  n1 X  Nℓ 2 1−2/d ξi f (Xi ) ≤ E E + C exp −m n /16 , 1 ℓ Ω 0 0 n1/2 ℓ=1 (34) 1 sup + f ∈Fd,↓ ∩B∞ (1)∩B2 (r,P ) 1/2 Nℓ X ξi f (Xi )  N1 , . . . , Nn1 . i:Xi ∈Sℓ R + By Lemma 9, for any f ∈ Fd,↓ ∩ B∞ (1) ∩ B2 (r, P ) and ℓ ∈ {1, . . . , n1 }, we have Iℓ f 2 dP ≤ 2 7(M0 /m0 )ℓ−1 r 2 logd n =: rn,ℓ . Consequently, we have by Lemma 7 that for any η ∈ [0, rn,ℓ /3), Z rn,ℓ H[ ] (rn,ℓ ) 1/2 1/2 H[ ] (ε) dε + Eℓ . Nℓ η + , (35) 1/2 η Nℓ  + where H[ ] (ε) := log N[ ] ε, Fd,↓ (Iℓ )∩B∞ (1; Iℓ )∩B2 (rn,ℓ , P ; Iℓ ), k·kL2(P ;Iℓ ) . Here, kf k2L2 (P ;Iℓ ) := R 2 + f dP , the set Fd,↓ (Iℓ ) is the class of non-negative functions on Iℓ that are block decreasing, Iℓ B∞ (1; Iℓ ) is the class of functions on Iℓ that are bounded by 1 and B2 (rn,ℓ , P ; Iℓ ) is the class + of measurable functions f on Iℓ with kf kL2 (P ;Iℓ ) ≤ rn,ℓ . Any g ∈ Fd,↓ (Iℓ ) ∩ B∞ (1; Iℓ ) ∩  1/2 + B2 (rn,ℓ , P ; Iℓ ) can be rescaled into a function fg ∈ Fd,↓ ∩ B∞ (1) ∩ B2 n1 (M0 /m0 )1/2 rn,ℓ , P map fg (x1 , . . . ,Rxd−1 , xd ) := g(x1 , . . . , xd−1 , (xd + ℓ − 1)/n1 ). Moreover, Rvia the invertible 2 ′ (f − fg ) dP ≥ n1 (m0 /M0 ) Iℓ (g − g ′ )2 dP . Thus, by Lemma 8, for ǫ ∈ [η, rn,ℓ], [0,1]d g   + H[ ] (ε) ≤ log N[ ] n1/(2d) (m0 /M0 )1/2 ε, Fd,↓ ∩ B∞ (1) ∩ B2 n1/(2d) (M0 /m0 )1/2 rn,ℓ , k · kL2 (P )  2(d−1) rn,ℓ 2 .d,m0 ,M0 logd+ (1/ǫ). ε Substituting the above entropy bound into (35), and choosing η = n−1/(2d) rn,ℓ , we obtain 2 d−1 Z rn,ℓ  2 2 d−1 rn,ℓ logd /2 n logd n rn,ℓ logd n 1/2 1/2 d2 /2 . Nℓ η + . Eℓ .d,m0 ,M0 Nℓ η + log n + dε + 1/2 1/2 ε η d−2 Nℓ Nℓ η Hence Eℓ 1Ω0 .d,m0 ,M0 rn,ℓ n1/2−1/d logd 2 /2 2 /2 2 n + n−1/2+1/(2d) logd n .m0 ,M0 rn,ℓ n1/2−1/d logd n, (36) 2 where in the final inequality we used the conditions that d ≥ 3 and r ≥ n−(1−2/d) log(d −d)/2 n. Combining (34) and (36), we have that   n1 n 1 X 1 X (d2 +d)/2 −1/2 1/2−1/d ℓ E sup log n ξi f (Xi ) .d,m0 ,M0 rn 1/2 1/2 + n1 ℓ=1 f ∈Fd,↓ ∩B∞ (1)∩B2 (r,P ) n i=1 2 +d)/2 . rn1/2−1/d log(d which completes the proof. 23 n, Finally, we need the following proposition to switch between L2 (P ) and L2 (Pn ) norms as described in Step 3. Proposition 10. Fix d ≥ 2 and suppose that f0 = 0. There exists a constant Cd,m0 ,M0 > 0, depending only on d, m0 and M0 , such that h i   2 2 E fˆn L2 (Pn ) 1{kfˆn k∞ ≤4 log1/2 n} ≤ Cd,m0 ,M0 n−2/d log2γd n + E fˆn L2 (P ) 1{kfˆn k∞ ≤4 log1/2 n} . Proof. To simplify notation, we define f˜n := fˆn 1{kfˆn k∞ ≤4 log1/2 n} and rn := n−1/d logγd n. We write  2 2 E fˆn L2 (Pn ) 1{kfˆn k∞ ≤4 log1/2 n} = E f˜n L2 (Pn )   2 2 = E f˜n L2 (Pn ) 1{kfˆn kL (P ) ≤rn } + E f˜n L2 (Pn ) 1{kfˆn kL (P ) >rn } , (37) 2 2 and control the two terms on the right hand side of (37) separately. For the first term, we have  E f˜n 1 2 L2 (Pn ) {kfˆn kL2 (P ) ≤rn } n 1X 2 f (Xi ) ≤E sup f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P ) n i=1 . rn2 + . rn2 n X 1 E sup ξi f 2 (Xi ) n f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P ) i=1 n X log1/2 n + ξi f (Xi ) E sup n f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P ) i=1 .d,m0 ,M0 rn2 + rn n−1/d logγd n . rn2 , (38) where the second line uses the symmetrisation inequality (cf. van der Vaart and Wellner, 1996, Lemma 2.3.1), the third inequality follows from Lemma 6 and the penultimate inequality follows from applying Proposition 9 to f /(4 log1/2 n). For the second term on the ′ right-hand side of (37), we first claim that there exists some constant Cd,m > 0, depend0 ,M0 ing only on d, m0 and M0 , such that   2 Pn f 2 ′ − 1 > Cd,m0 ,M0 ≤ 2 . (39) P sup 2 n f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P )c P f To see this, we adopt a peeling argument as follows. Let Fd,ℓ := {f ∈ Fd ∩ B∞ (4 log1/2 n) : 2ℓ−1 rn2 < P f 2 ≤ 2ℓ rn2 } and m be the largest integer such that 2m rn2 < 32 log n (so that m ≍ log n). We have that sup f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P )c Pn f 2 1 − 1 = 1/2 2 Pf n |Gn f 2 | 2 f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P )c P f n o 1 ℓ 2 −1 2 . 1/2 max (2 rn ) sup |Gn f | . n ℓ=1,...,m f ∈Fd,ℓ 24 sup By Talagrand’s concentration inequality (cf. Talagrand (1996)) for empirical processes, in the form given by Massart (2000, Theorem 3), applied to the class {f 2 : f ∈ Fd,ℓ }, we have that for any sℓ > 0,   552sℓ log n 1/2 1/2 2 (ℓ+7)/2 2 rn sℓ log n + P sup |Gn f | > 2E sup |Gn f | + 2 ≤ e−sℓ . 1/2 n f ∈Fd,ℓ f ∈Fd,ℓ Here we have used the fact that supf ∈Fd,ℓ VarP f 2 ≤ supf ∈Fd,ℓ P f 2kf k2∞ ≤ 2ℓ+4 rn2 log n. Further, we note by the symmetrisation inequality again, Lemma 6 and Proposition 9 that 1 2 E sup |Gn f | . n1/2 n X E sup n X log1/2 n ξi f (Xi ) . ξi f (Xi ) E sup n1/2 f ∈Fd,ℓ i=1 2 f ∈Fd,ℓ i=1 .d,m0 ,M0 2ℓ/2 rn n1/2−1/d f ∈Fd,ℓ logγd n. By a union bound, we have that with probability at least 1 − sup f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P )c Pn f 2 −1 Pf2 Pm ℓ=1 e−sℓ ,  1/2 n1/2−1/d logγd n + sℓ log1/2 n sℓ log n + ℓ 2 . .d,m0 ,M0 max ℓ=1,...,m 2ℓ/2 n1/2 rn 2 nrn P P −sℓ −ℓ−1 By choosing sℓ := 2ℓ log n, we see that m ≤ ∞ ≤ 2n−2 and ℓ=1 e ℓ=1 n  sup f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P )c Pn f 2 − 1 .d,m0 ,M0 1, Pf2  which verifies (39). Now let E := supf ∈Fd ∩B∞ (4 log1/2 n)∩B2 (rn ,P )c  E f˜n 1 2 L2 (Pn ) {kfˆn kL2 (P ) >rn } Pn f 2 P f2 ′ − 1 ≤ Cd,m . Then 0 ,M0 32 log n n2 32 log n 2 ′ . ≤ (Cd,m + 1)E f˜n L2 (P ) + 0 ,M0 n2  ≤ E f˜n 1 1 2 L2 (Pn ) {kfˆn kL2 (P ) >rn } E + (40) Combining (37), (38) and (40), we obtain E f˜n 2 L2 (Pn ) .d,m0 ,M0 rn2 + E f˜n 2 , L2 (P ) as desired. Proof of Proposition 7. For f0 = 0, we decompose   2 R(fˆn , 0) = E fˆn L2 (Pn ) 1{kfˆn k∞ ≤4 log1/2 n} + E fˆn 1 2 1/2 n} L2 (Pn ) {kfˆn k∞ >4 log (41) and handle the two terms on the right-hand side separately. For the first term, let rn := n−1/d logγd n and observe that by Lemma 5 and Proposition 9, we have that for r ≥ rn , E sup f ∈Fd ∩B∞ (4 log 1/2 n)∩B2 (r,P ) n 1 X n1/2 ǫi f (Xi ) .d,m0 ,M0 rn1/2−1/d logγd n. i=1 25 On the other hand, by Lemma 6 and Proposition 9, for r ≥ rn , n 1 X 2 E sup ξi f (Xi ) .d,m0 ,M0 rn1/2−1/d logγd n. 1/2 f ∈Fd ∩B∞ (4 log1/2 n)∩B2 (r,P ) n i=1 It follows that the conditions of Proposition 8 are satisfied for this choice of rn with φn (r) := rn1/2−1/d logγd n. By Propositions 10 and 8, we deduce that   2 2 E fˆn .d,m ,M n−2/d log2γd n + E fˆn 1 ˆ 1 ˆ 1/2 1/2 L2 (Pn ) {kfn k∞ ≤4 log n} 0 L2 (P ) {kfn k∞ ≤4 log 0 −2/d .d,m0 ,M0 n log 2γd n. n} (42) For the second term on P the right-hand side ofP (41), we note that by the definition of the n 2 ˆ least squares estimator, i=1 {fn (Xi ) − ǫi } ≤ ni=1 ǫ2i , so n n n 2X ˆ 2X 2 4X 2 2 2 ˆ fn L2 (Pn ) ≤ {fn (Xi ) − ǫi } + ǫ ≤ ǫ. n i=1 n i=1 i n i=1 i Thus,  E fˆn 1 2 1/2 n} L2 (Pn ) {kfˆn k∞ >4 log  ≤ 4E ǫ21 1{kfˆn k∞ >4 log1/2 n} . P(kfˆn k∞ > 4 log1/2 n)1/2 . n−3 , (43) where the final inequality follows from Lemma 10. The proof is completed by substituting (42) and (43) into (41). 6 Appendix: proofs of ancillary results The proof of Corollary 1 requires the following lemma on Riemann approximation of block increasing functions. Lemma 1. Suppose n1 = n1/d f ∈ Fd , define fL (x1, . . . , xd ) :=  is a positive integer. For any −1 −1 −1 f n1 ⌊n1 x1 ⌋, . . . , n1 ⌊n1 xd ⌋ and fU (x1 , . . . , xd ) := f n1 ⌈n1 x1 ⌉, . . . , n−1 1 ⌈n1 xd ⌉ . Then Z (fU − fL )2 ≤ 4dn−1/d kf k2∞ . [0,1]d Proof. For x = (x1 , . . . , xd )⊤ and x′ = (x′1 , . . . , x′d )⊤ in Ld,n , we say x and x′ are equivalent F if and only if xj − x1 = x′j − x′1 for j = 1, . . . , d. Let Ld,n = N r=1 Pr be the partition of Ld,n into equivalence classes. Since each Pr has non-empty intersection with a different element of the set {(x1 , . . . , xd ) ∈ Ld,n : minj xj = 1}, we must have N ≤ dn1−1/d . Therefore, we have Z N Z X 2 (fU − fL ) = (fU − fL )2 [0,1]d r=1 d n−1 1 (Pr +(−1,0] ) N X 2 ≤ kf k∞ n r=1 ≤ X x=(x1 ,...,xd )⊤ ∈Pr      x1 x1 − 1 xd xd − 1 f −f ,..., ,..., n n n n  2N kf k∞ f (1, . . . , 1) − f (0, . . . , 0) ≤ 4dn−1/d kf k2∞ , n 26 as desired. The following is a simple generalisation of Jensen’s inequality. Lemma 2. Suppose h : [0, ∞) → (0, ∞) is a non-decreasing function satisfying the following: (i) There exists x0 ≥ 0 such that h is concave on [x0 , ∞). (ii) There exists some x1 > x0 such that h(x1 ) − xh′+ (x1 ) ≥ h(x0 ), where h′+ is the right derivative of h. Then there exists a constant Ch > 0 depending only on h such that for any nonnegative random variable X with EX < ∞, we have Eh(X) ≤ Ch h(EX). Proof. Define H : [0, ∞) → [h(0), ∞) by ( h(x1 ) − x1 h′+ (x1 ) + xh′+ (x1 ) if x ∈ [0, x1 ) H(x) := h(x) if x ∈ [x1 , ∞). Then H is a concave majorant of h. Moreover, we have H ≤ (h(x1 )/h(0))h. Hence, by Jensen’s inequality, we have Eh(X) ≤ EH(X) ≤ H(EX) ≤ h(x1 ) h(EX), h(0) as desired. We need the following lower bound on the metric entropy of M(L2,n ) ∩ B2 (1) for the proof of Proposition 2. Lemma 3. There exist universal constants c > 0 and ε0 > 0 such that  log N ε0 , M(L2,n ) ∩ B2 (1), k · k2 ≥ c log2 n. Proof. It suffices to prove the equivalent result that there exist  universal constants c, ε0 > 0 such that the packing number D ε0 , M(L2,n ) ∩ B2 (1), k · k2 (i.e. the maximum number of disjoint open Euclidean balls of radius ε0 that can be fitted into M(L2,n ) ∩ B2 (1)) is at least exp(c log2 n). Without loss of generality, we may also assume that n1 := n1/2 = 2ℓ − 1 for some ℓ ∈ N, so that ℓ ≍ log n. Now, for r = 1, . . . , ℓ, let Ir := {2r−1, . . . , 2r − 1} and consider the set   n −1 −1Ir ×Is o Ir ×Is L2,n ⊆ M(L2,n ) ∩ B2 (1), ,√ M̄ := θ ∈ R : θIr ×Is ∈ √ 2r+s+1 log n 2r+s log n 2 where 1Ir ×Is denotes the all-one vector on Ir × Is . Define a bijection ψ : M̄ → {0, 1}ℓ by  ψ(θ) := 1 √ θIr ×Is =−1Ir ×Is / 2r+s+1 log n 27 ℓ r,s=1 . Then, for θ, θ′ ∈ M̄, kθ − θ′ k22  2 dH (ψ(θ), ψ(θ′ )) 1 1 = 1 − 1/2 , 4 2 log2 n where dH (·, ·) denotes the Hamming distance. On the other hand, the Gilbert–Varshamov 2 bound (e.g. Massart, 2007, Lemma 4.7) entails that there exists a subset I ⊆ {0, 1}ℓ such that |I| ≥ exp(ℓ2 /8) and dH (v, v ′ ) ≥ ℓ2 /4 for any distinct v, v ′ ∈ I. Then the set ψ −1 (I) ⊆ M̄ has cardinality at least exp(ℓ2 /8) ≥ exp(log2 n/32), and each pair of distinct elements ℓ2 /4 1 1 2 have squared ℓ2 distance at least ε0 := log ) & 1, as desired. (1 − 21/2 2 n4 Lemma 4 below gives a lower bound on the size of the maximal antichain (with respect to the natural partial ordering on Rd ) among independent and identically distributed X1 , . . . , Xn . iid Lemma 4. Let d ≥ 2. Let X1 , . . . , Xn ∼ P , where P is a distribution on [0, 1]d with Lebesgue −1 1/d density bounded above by M0 ∈ [1, ∞). Then with probability at least 1−e−ed (M0 n) log(M0 n) , 1/d there is an antichain in GX with cardinality at least n1−1/d /(2eM0 ). Proof. By Dilworth’s Theorem (Dilworth, 1950), for each realisation of the directed acyclic graph GX , there exists a covering of V (GX ) by chains C1 , . . . , CM , where M denotes the cardinality of a maximum antichain of GX . Thus, it suffices to show that with the given probability, the maximum chain length of GX is at most k := ⌈e(M0 n)1/d ⌉ ≤ 2e(M0 n)1/d . By a union bound, we have that     n n (k!)−d M0k P(X1  · · ·  Xk ) = P(∃ a chain of length k in GX ) ≤ k k  k  −kd en k −1 1/d ≤ M0k ≤ (M0 n)−k/d ≤ e−ed (M0 n) log(M0 n) , k e as desired. The following two lemmas control the empirical processes in (28) and (29) by the symmetrised empirical process in (27). Lemma 5. Let n ≥ 2, and suppose X1 , . . . , Xn are independent and identically distributed on X . Then for any countable class F of measurable, real-valued functions defined on X , we have n n X X 1/2 E sup ǫi f (Xi ) ≤ 2 log n E sup ξi f (Xi ) . f ∈F i=1 f ∈F i=1 Proof. Let α0 := 0, and for k = 1, . . . , n, let αk := E|ǫ(k) |, where |ǫ(1) | ≤ · · · ≤ |ǫ(n) | are the 28 order statistics of {|ǫ1 |, . . . , |ǫn |}, so that αn ≤ (2 log n)1/2 . Observe that for any k = 1, . . . , n, E sup k X k X ξi f (Xi ) = E sup f ∈F i=1 ξi f (Xi ) + E f ∈F i=1 ξi f (Xi ) i=k+1 X n ≤ E sup E ξi f (Xi ) f ∈F n X X1 , . . . , Xk , ξ 1 , . . . , ξ k i=1  ≤ E sup n X ξi f (Xi ) . f ∈F i=1 (44) We deduce from Han and Wellner (2017, Proposition 1) and (44) that E sup n X f ∈F i=1 ǫi f (Xi ) ≤ 21/2 n X k=1 (αk − αk−1)E sup k X f ∈F i=1 ξi f (Xi ) ≤ 21/2 αn E sup n X ξi f (Xi ) , f ∈F i=1 as required. Lemma 6. Let X1 , . . . , Xn be random variables taking values in X and F be a countable class of measurable functions f : X → [−1, 1]. Then E sup f ∈F n X i=1 2 ξi f (Xi ) ≤ 4E sup f ∈F n X ξi f (Xi ) . i=1 Proof. By Ledoux and Talagrand (2011, Theorem 4.12), applied to φi (y) = y 2/2 for i = 1, . . . , n (note that y 7→ y 2 /2 is a contraction on [0, 1]), we have E sup n X f ∈F i=1  n X ξi f 2 (Xi ) ξi f (Xi ) = E E sup X1 , . . . , Xn ξi f (Xi ) X1 , . . . , Xn 2 f ∈F i=1 n X  ≤ 4E E sup f ∈F i=1   = 4E sup n X ξi f (Xi ) , f ∈F i=1 as required. The following is a local maximal inequality for empirical processes under bracketing entropy conditions. This result is well known for η = 0 in the literature, but we provide a proof for the general case η ≥ 0 for the convenience of the reader. iid Lemma 7. Let X1 , . . . , Xn ∼ P on X with empirical distribution Pn , and, for some r > 0, let G ⊆ B∞ (1)∩B2 (r, P ) be a countable class of measurable functions. Then for any η ∈ [0, r/3), we have Z r 1/2 1/2 E sup |Gn f | . n η + log+ N[ ] (ε, G, k · kL2 (P ) ) dε + n−1/2 log+ N[ ] (r, G, k · kL2 (P ) ). f ∈G η The above P inequality also holds if we replace Gn f with the symmetrised empirical process n−1/2 ni=1 ξi f (Xi ). 29 Proof. Writing Nr := N[ ] (r, G, k · kL2 (P ) ), there exists {(fℓL , fℓU ) : ℓ = 1, . . . , Nr } that form an r-bracketing set for G in the L2 (P ) norm. Letting G1 := {f ∈ G : f1L ≤ f ≤ f1U } and ℓ−1 r Gℓ := {f ∈ G : fℓL ≤ f ≤ fℓU } \ ∪j=1 Gj for ℓ = 2, . . . , Nr , we see that {Gℓ }N ℓ=1 is a partition of G such that the L2 (P )-diameter of each Gℓ is at most r. It follows by van der Vaart and Wellner (1996, Lemma 2.14.3) that for any choice of fℓ ∈ Gℓ , we have that Z r 1/2 1/2 E sup |Gn f | . n η + log+ N[ ] (ε, G, k · kL2 (P ) ) dε f ∈G η   (45) + E max |Gn fℓ | + E max Gn sup |f − fℓ | , ℓ=1,...,Nr ℓ=1,...,Nr f ∈Gℓ The third and fourth terms of (45) can be controlled by Bernstein’s inequality (in the form of (2.5.5) in van der Vaart and Wellner (1996)):   log+ Nr 1/2 + r log+ Nr . E max |Gn fℓ | ∨ E max Gn sup |f − fℓ | . 1/2 ℓ=1,...,Nr ℓ=1,...,Nr n f ∈Gℓ 1/2 Since η < r/3, the last term r log+ Nr in the above display can be assimilated into the entropy integral in (45), which establishes the claim for E supf ∈G |Gn f |. We now study the symmetrised empirical process. For f ∈ G, we define e ⊗ f : {−1, 1} × X → R by (e ⊗ f )(t, x) := tf (x), and apply the previous result to the function class e ⊗ G := {e ⊗ f : f ∈ G}. Here the randomness is induced by the independently and identically distributed pairs (ξi , Xi )1≤i≤n . For any f ∈ G and any ε-bracket [f , f¯] containing f , we have that [e+ ⊗ f − e− ⊗ f¯, e+ ⊗ f¯ − e− ⊗ f ] is an ε-bracket for e ⊗ f in the L2 (Pξ ⊗ P ) metric, where e+ (t) := max{e(t), 0} = max(t, 0) and e− (t) = max(−t, 0). Writing Pξ denote the Rademacher distribution on {−1, 1}, it follows that for every ǫ > 0, N[ ] (ε, e ⊗ G, L2 (Pξ ⊗ P )) ≤ N[ ] (ε, G, L2 (P )), which proves the claim for the symmetrised empirical process. In the next two lemmas, we assume, as in the main text, that P is a distribution on [0, 1]d with Lebesgue density bounded above and below by M0 ∈ [1, ∞) and m0 ∈ (0, 1] + respectively. Recall that Fd,↓ = {f : −f ∈ Fd , f ≥ 0}. The following result is used to control the bracketing entropy terms that appear in Lemma 7 when we apply it in the proof of Proposition 9. Lemma 8. There exists a constant Cd > 0, depending only on d, such that for any r, ǫ > 0,  + log N[ ] ε, Fd,↓ ∩ B2 (r, P )∩B∞ (1), k · kL2 (P ) (  2 M0 4 2 r log+ (1/ε) 0 (r/ε)2 M log ( ) log (1/ε) log if d = 2, + + m0 m0 ε ≤ Cd d2 2(d−1) M0 d−1 if d ≥ 3. (r/ε) ( m0 ) log+ (1/ε) R Proof. For any Borel measurable S ⊆ [0, 1]d , we define kf k2L2 (P ;S) := S f 2 dP . We first claim that for any η ∈ (0, 1/4], (  2 M0 4 2 r log(1/η) r 2 M0  ( ) log ( ) log (1/η) log if d = 2, + + ε m0 m0 ε log N[ ] ε, Fd,↓ ∩B2 (r), k·kL2(P ;[η,1]d ) .d d2 r 2(d−1) M0 d−1 ( m0 ) log (1/η) if d ≥ 3. (ε) 30 + By the cone property of Fd,↓ , it suffices to establish the above claim when r = 1. We denote by vol(S) the Lebesgue measure of a measurable set S ⊆ [0, 1]d . By Gao and Wellner (2007, Theorem 1.1) and a scaling argument, we have for any δ, M > 0 and any hyperrectangle A ⊆ [0, 1]d that (  (γ/δ)2 log2+ (γ/δ) if d = 2, + log N[ ] δ, Fd,↓ ∩ B∞ (M), k · kL2 (P ;A) .d (46) (γ/δ)2(d−1) if d ≥ 3, 1/2 where γ := M0 Mvol1/2 (A). Let m := ⌊log2 (1/η)⌋ and define Iℓ := [2ℓ η, 2ℓ+1η] ∩ [0, 1] for + each ℓ = 0, . . . , m. Then for ℓ1 , . . . , ℓd ∈ {0, . . . , m}, any f ∈ Fd,↓ ∩ B2 (1, P ) is uniformly −1/2 Qd Qd ℓj bounded by m0 j=1 2 η on the hyperrectangle j=1 Iℓj . Then by (46) we see that for any δ > 0, ( 0  ) log2+ (1/δ) if d = 2, δ −2 (M0 /m0 ) log2 ( M + m0 log N[ ] δ, Fd,↓ ∩ B2 (1), k · kL2 (P ;Qd Iℓ ) .d j=1 j δ −2(d−1) (M0 /m0 )d−1 if d ≥ 3, where we have used the fact that log+ (ax) ≤ 2 log+ (a) log+ (x) for any a, x > 0. Global + brackets for Fd,↓ ∩B2 (1) on [η, 1]d can then be constructed by taking all possible combinations of local brackets on Iℓ1 × · · · × Iℓd for ℓ1 , . . . , ℓd ∈ {0, . . . , m}. Overall, for any ε > 0, setting δ = (m + 1)−d/2 ε establishes the claim. We conclude that if we fix any ε > 0, take η = ε2 /(4d) ∧ 1/4 and take a single bracket consisting of the constant functions 0 and 1 on [0, 1]d \ [η, 1]d , we have   + + log N[ ] ε, Fd,↓ ∩ B2 (r) ∩ B∞ (1),k · kL2 (P ) ≤ log N[ ] ε/2, Fd,↓ ∩ B2 (r), k · kL2 (P ;[η,1]d ) (  2 M0 4 2 r log+ (1/ε) 0 log ( ) log (1/ε) log if d = 2, (r/ε)2 M + + m m ε 0 0 .d 2 d M (r/ε)2(d−1) ( m00 )d−1 log+ (1/ε) if d ≥ 3, completing the proof. + For 0 < r < 1, let Fr be the envelope function of Fd,↓ ∩B2 (r, P )∩B∞ (1). The lemma below , ℓ] controls the L2 (P ) norm of Fr when restricted to strips of the form Iℓ := [0, 1]d−1 × [ ℓ−1 n1 n1 for ℓ = 1, . . . , n1 . Lemma 9. For any r ∈ (0, 1] and ℓ = 1, . . . , n1 , we have Z Iℓ Fr2 dP 7M0 r 2 logd+ (1/r 2 ) . ≤ m0 ℓ Proof. By monotonicity and the L2 (P ) and L∞ constraints, we have Fr2 (x1 , . . . , xd ) ≤ r2 ∧ 1. We first claim that for any d ∈ N, m0 x1 ···xd Z [0,1]d   t ∧ 1 dx1 · · · dxd ≤ 5t logd+ (1/t). x1 · · · xd 31  R Q t dx1 · · · dxd To see this, we define Sd := (x1 , . . . , xd ) : dj=1 xj ≥ t and set ad := Sd x1 ···x d R and bd := Sd dx1 · · · dxd . By integrating out the last coordinate, we obtain the following relation   Z t 1− bd = dx1 · · · dxd−1 = bd−1 − ad−1 . (47) x1 · · · xd−1 Sd−1 On the other hand, we have by direct computation that Z 1 Z 1 t dxd · · · dx1 ad = ··· t x · · · x 1 d t x ···x 1 d−1 ≤ ad−1 log(1/t) ≤ · · · ≤ a1 logd−1 (1/t) = t logd (1/t). (48) Combining (47) and (48), we have   Z t ∧ 1 dx1 · · · dxd = ad + 1 − bd ≤ min{ad + 1, ad + ad−1 + · · · + a1 + 1 − b1 } [0,1]d x1 · · · xd   t logd+1 (1/t) d ≤ min t log (1/t) + 1, ≤ 5t logd+ (1/t), log(1/t) − 1 as claimed, where the final inequality follows by considering the cases t ∈ [1/e, 1], t ∈ [1/4, 1/e) and t ∈ [0, 1/4) separately. Consequently, for ℓ = 2, . . . , n1 , we have that Z Iℓ Fr2 M0 dP ≤ m0 ≤ M0 m0 Z ℓ/n1 (ℓ−1)/n1 ℓ/n1 Z (ℓ−1)/n1 Z [0,1]d−1   r 2 /xd ∧ 1 dx1 · · · dxd−1 dxd x1 · · · xd−1 2 5(r 2 /xd ) logd−1 + (xd /r ) dxd 2  7M0 r 2 logd−1 M0 2 d−1 + (1/r ) 2 5r log+ (1/r ) log ℓ/(ℓ − 1) ≤ , ≤ m0 m0 ℓ as desired. For the remaining case ℓ = 1, we have Z Z 5M0 2 d 2 Fr dP ≤ M0 Fr2 dx1 · · · dxd ≤ r log+ (1/r 2 ), m0 [0,1]d I1 which is also of the correct form. The following is a simple tail bound for kfˆn k∞ . Lemma 10. For f0 = 0, we have  P kfˆn k∞ ≥ 4 log1/2 n ≤ 2n−7 . Proof. Recall that we say U ⊆ Rd is an upper set if whenever x ∈ U and x  y, we have y ∈ U; we say, L ⊆ Rd is a lower set if −L is an upper set. We write U and L respectively for the collections of upper and lower sets in Rd . The least squares estimator 32 fˆn over Fd then has a well-known min-max representation (Robertson, Wright and Dykstra, 1988, Theorem 1.4.4): fˆn (Xi ) = min max YL∩U , L∈L,L∋Xi U ∈U ,U ∋Xi where YL∩U denotes the average value of the elements of {Y1 , . . . , Yn } ∩ L ∩ U, with the convention that YL∩U = 0 if {Y1, . . . , Yn } ∩ L ∩ U = ∅. Then sup fˆn (x) = max fˆn (Xi ) ≤ max Yi . x∈[0,1]d 1≤i≤n 1≤i≤n Since f0 = 0, we have Yi = ǫi , which means that     1/2 1/2 ˆ P sup fn (x) ≥ 4 log n ≤ P max ǫi ≥ 4 log n ≤ ne−8 log n = n−7 . x∈[0,1]d 1≤i≤n The desired result follows by observing that a similar inequality holds for inf x∈[0,1]d fˆn (x). Acknowledgements: The research of the first author is supported by in part by NSF Grant DMS-1566514. The research of the second and fourth authors is supported by EPSRC fellowship EP/J017213/1 and a grant from the Leverhulme Trust RG81761. References Amelunxen, D., Lotz, M., McCoy, M. B. and Tropp, J. A. (2014) Living on the edge: phase transition in convex programs with random data. Inf. Inference, 3, 224–294. Bacchetti, P. (1989) Additive isotonic models. J. Amer. Statist. Assoc., 84, 289–294. Barlow, R. E., Bartholomew, D. J., Bremner, J. M. and Brunk, H. D. (1972) Statistical Inference under Order Restrictions. Wiley, New York. Bellec, P. C. (2017) Sharp oracle inequalities for least squares estimators in shape restricted regression. Ann. Statist., to appear. Birgé, L. and Massart, P. (1993) Rates of convergence for minimum contrast estimators. Probab. Theory Related Fields, 97, 113–150. Boucheron, S., Lugosi, G. and Massart, P. (2013) Concentration Inequalities. Oxford University Press, Oxford. Brunk, H. D. (1955) Maximum likelihood estimates of monotone parameters. Ann. Math. Statist., 26, 607–616. Chatterjee, S. (2014) A new perspective on least squares under convex constraint. Ann. Statist., 42, 2340–2381. Chatterjee, S., Guntuboyina, A. and Sen, B. (2015) On risk bounds in isotonic and other shape restricted regression problems. Ann. Statist., 43, 1774–1800. 33 Chatterjee, S., Guntuboyina, A. and Sen, B. (2017) On matrix estimation under monotonicity constraints. Bernoulli, to appear. Chatterjee, S. and Lafferty, J. (2017) Adaptive risk bounds in unimodal regression. arXiv preprint, arxiv:1512.02956v5. Chen, Y. and Samworth, R. J. (2016) Generalized additive and index models with shape constraints. J. Roy. Statist. Soc., Ser. B, 78, 729–754. Dilworth, R. P. (1950) A decomposition theorem for partially ordered sets. Ann. Math., 51, 161–166. Donoho, D. (1991) Gelfand n-widths and the method of least squares. Technical Report, University of California. Durot, C. (2007) On the Lp -error of monotonicity constrained estimators. Ann. Statist., 35, 1080–1104. Durot, C. (2008) Monotone nonparametric regression with random design. Math. Methods Statist., 17, 327–341. Dykstra, R. L. and Robertson, T. (1982) An algorithm for isotonic regression for two or more independent variables. Ann. Statist., 10, 708–716. Dykstra, R. L. (1983) An algorithm for restricted least squares regression. J. Amer. Statist. Assoc., 78, 837–842. Eichler, E. E., Flint, J., Gibson, G., Kong, A., Leal, S. M., Moore, J. H. and Nadeau, J. H. (2010) Missing heritability and strategies for finding the underlying causes of complex disease. Nat. Rev. Genet., 11, 446–450. Elena, S. F. and Lenski R. E. (1997) Test of synergistic interactions among deleterious mutations in bacteria. Nature, 390, 395–398. Gao, F. and Wellner, J. A. (2007) Entropy estimate for high-dimensional monotonic functions. J. Mult. Anal., 98, 1751–1764. Giné, E., Latala, R and Zinn, J. (2000) Exponential and moment inequalities for U-statistics. In High dimensional probability, II (Seattle, WA, 1999), volume 47 of Progr. Probab., pp. 13–38. Birkhäuser Boston, Boston, MA, 2000. Goldstein, D. B. (2009) Common genetic variation and human traits. N. Engl. J. Med., 360, 1696–1698. Groeneboom, P. and Jongbloed, G. (2014) Nonparametric Estimation under Shape Constraints. Cambridge University Press, Cambridge. Guntuboyina, A. and Sen, B. (2015) Global risk bounds and adaptation in univariate convex regression. Probab. Theory Related Fields, 163, 379–411. 34 Han, Q. and Wellner, J. A. (2017) A sharp multiplier inequality with applications ot heavytailed regression problems. arXiv preprint, arxiv:1706.02410. Kim, A. K. H., Guntuboyina, A. and Samworth, R. J. (2017) Adaptation in log-concave density estimation. Ann. Statist., to appear. Kim, A. K. H. and Samworth, R. J. (2017) Global rates of convergence in log-concave density estimation. Ann. Statist., 44, 2756–2779. Kyng, R., Rao, A. and Sachdeva, S. (2015) Fast, provable algorithms for isotonic regression in all ℓp -norms. In Advances in Neural Information Processing Systems, pp. 2719–2727. Ledoux, M. and Talagrand, M. (2011) Probability in Banach Spaces: Isoperimetry and Processes. Springer-Verlag, Berlin. Luss, R., Rosset, S. and Shahar, M. (2012) Efficient regularized isotonic regression with application to gene-gene interaction search. Ann. Appl. Statist., 6, 253–283. Mammen, E. and Yu, K. (2007) Additive isotonic regression. In Cator, E. A. et al. (Eds.), Asymptotics: Particles, Processes and Inverse Problems, 179–195. Institute of Mathematical Statistics, Beachwood. Mani, R., Onge, R. P. S., Hartman, J. L., Giaever, G. and Roth, F. P. (2007) Defining genetic interaction. Proc. Nat. Acad. Sci. USA, 105, 3461–3466. Massart, P. (2000) About the constant in Talagrand’s concentration inequalities for empirical processes. Ann. Probab., 28, 863–884. Massart, P. (2007) Concentration Inequalities and Model Selection, Springer, Berlin. Meyer, M. and Woodroofe, M. (2000) On the degrees of freedom in shape-restricted regression. Ann. Statist., 28, 1083–1104. Morton-Jones, T., Diggle, P., Parker, L., Dickinson, H. O. and Binks, K. (2000) Additive isotonic regression models in epidemiology. Statist. Med., 19, 849–859. Pisier, G. (1999) The Volume of Convex Bodies and Banach Space Geometry, Cambridge University Press, Cambridge. Pollard, D. (2002) A User’s Guide to Measure Theoretic Probability. Cambridge University Press, Cambridge. Rakhlin, A., Sridharan, K. and Tsybakov, A. B. (2017) Empirical entropy, minimax regret and minimax risk. Bernoulli, 23, 789–824. Robertson, T., Wright, F. T. and Dykstra, R. L. (1988) Order Restricted Statistical Inference. John Wiley & Sons, Ltd., Chichester. Romik, D. (2014) The Surprising Mathematics of Longest Increasing Subsequences. Cambridge University Press, Cambridge. 35 Roth, F. P., Lipshitz, H. D. and Andrews, B. J. (2009) Q&A: epistasis. J. Biol., 8, 35. Sanjuan, R. and Elena, S. F. (2006) Epistasis correlates to genomic complexity. Proc. Natl. Acad. Sci. USA, 103, 14402–14405. Shao, H., Burrage, L. C., Sinasac, D. S., Hill, A. E., Ernest, S. R., O’Brien, W., Courtland, H.-W., Jepsen, K. J., Kirby, A., Kulbokas, E. J., Daly, M. J., Broman, K. W., Lander, E. S. and Nadeau, J. H. (2008) Genetic architecture of complex traits: Large phenotypic effects and pervasive epistasis. Proc. Natl. Acad. Sci. USA, 105, 19910–19914. Schell, M. J. and Singh, B. (1997) The reduced monotonic regression method. J. Amer. Statist. Assoc., 92, 128–135. Stout, Q. F. (2015) Isotonic Regression for Multiple Independent Variables. Algorithmica, 71, 450–470. Talagrand, M. (1996) New concentration inequalities in product spaces. Invent. Math., 126, 505–563. Tong, A. H., Evangelista, M., Parsons, A. B., Xu, H., Bader, G. D., Pagé, N., Robinson, M., Raghibizadeh, S., Hogue, C. W. V., Bussey, H., Andrews, B., Tyers, M. and Boone, C. (2001) Systematic genetic analysis with ordered arrays of yeast deletion mutants. Science, 294, 2364–2368. van de Geer, S. A. (1990) Estimating a regression function. Ann. Statist. 18, 907–924. van de Geer, S. A. (1993) Hellinger-consistency of certain nonparametric maximum likelihood estimators. Ann. Statist. 21, 14–44. van de Geer, S. A. (2000) Applications of Empirical Process Theory. Cambridge University Press, Cambridge. van der Vaart, A. W. and Wellner, J. A. (1996) Weak Convergence and Empirical Processes. Springer, New York. van Eeden, C. (1958) Testing and estimating ordered parameters of probability distributions. Mathematical Centre, Amsterdam. Yang, F. and Barber, R. F. (2017) Uniform convergence of isotonic regression. arXiv preprint, arxiv:1706.01852. Yang, Y. and Barron, A. (1999). Information-theoretic determination of minimax rates of convergence. Ann. Statist., 27, 1564–1599. Yu, B. (1997) Assouad, Fano and Le Cam. In Pollard, D., Torgersen, E. and Yang G. L. (Eds.) Festschrift for Lucien Le Cam: Research Papers in Probability and Statistics, 423– 435. Springer, New York. Zhang, C.-H. (2002) Risk bounds in isotonic regression. Ann. Statist., 30, 528–555. 36
10math.ST
Path Consistency Learning in Tsallis Entropy Regularized MDPs Ofir Nachum * 1 Yinlam Chow * 2 Mohamamd Ghavamzadeh * 2 arXiv:1802.03501v1 [cs.AI] 10 Feb 2018 Abstract We study the sparse entropy-regularized reinforcement learning (ERL) problem in which the entropy term is a special form of the Tsallis entropy. The optimal policy of this formulation is sparse, i.e., at each state, it has non-zero probability for only a small number of actions. This addresses the main drawback of the standard Shannon entropy-regularized RL (soft ERL) formulation, in which the optimal policy is softmax, and thus, may assign a non-negligible probability mass to non-optimal actions. This problem is aggravated as the number of actions is increased. In this paper, we follow the work of Nachum et al. (2017) in the soft ERL setting, and propose a class of novel path consistency learning (PCL) algorithms, called sparse PCL, for the sparse ERL problem that can work with both on-policy and off-policy data. We first derive a sparse consistency equation that specifies a relationship between the optimal value function and policy of the sparse ERL along any system trajectory. Crucially, a weak form of the converse is also true, and we quantify the sub-optimality of a policy which satisfies sparse consistency, and show that as we increase the number of actions, this suboptimality is better than that of the soft ERL optimal policy. We then use this result to derive the sparse PCL algorithms. We empirically compare sparse PCL with its soft counterpart, and show its advantage, especially in problems with a large number of actions. 1. Introduction In reinforcement learning (RL), the goal is to find a policy with maximum long-term performance, defined as the sum of discounted rewards generated by following the policy (Bertsekas & Tsitsiklis, 1996; Sutton & Barto, 1998). In case the number of states and actions are small, and the * Equal contribution 1 Google Brain 2 Google DeepMind. Correspondence to: Yinlam Chow <[email protected]>. Proceedings of the 35 th International Conference on Machine Learning, Stockholm, Sweden, PMLR 80, 2018. Copyright 2018 by the author(s). model is known, the optimal policy is the solution of the non-linear Bellman optimality equations (Bellman, 1957). When the system is large or the model is unknown, greedily solving the Bellman equations often results in policies that are far from optimal. A principled way of dealing with this issue is regularization. Among different forms of regularization, such as `2 (e.g., Farahmand et al. 2008; 2009) and `1 (e.g., Kolter & Ng 2009; Johns et al. 2010; Ghavamzadeh et al. 2011), entropy regularization is among the most studied in both value-based (e.g., Kappen 2005; Todorov 2006; Ziebart 2010; Azar et al. 2012; Fox et al. 2016; O’Donoghue et al. 2017; Asadi & Littman 2017) and policy-based (e.g., Peters et al. 2010; Todorov 2010) RL formulations. In particular, two of the most popular deep RL algorithms, TRPO (Schulman et al., 2015) and A3C (Mnih et al., 2016), are based on entropy-regularized policy search. We refer the interested readers to Neu et al. (2017), for an insightful discussion on entropy-regularized RL algorithms and their connection to online learning. In entropy-regularized RL (ERL), an entropy term is added to the Bellman equation. This formulation has four main advantages: 1) it softens the non-linearity of the Bellman equations and makes it possible to solve them more easily, 2) the solution of the softened problem is quantifiably not much worse than the optimal solution in terms of accumulated return, 3) the addition of the entropy term brings nice properties, such as encouraging exploration (Shannon entropy) (e.g., Fox et al. 2016; Nachum et al. 2017) and maintaining a close distance to a baseline policy (relative entropy) (e.g., Schulman et al. 2015; Nachum et al. 2018), and 4) unlike the original problem that has a deterministic solution, the solution to the softened problem is stochastic, which is preferable in problems in which exploration or dealing with unexpected situations is important. However, in the most common form of ERL, in which a Shannon (or relative) entropy term is added to the Bellman equations, the optimal policy is of the form of softmax. Despite the advantages of a softmax policy in terms of exploration, its main drawback is that at each step, it assigns a non-negligible probability mass to non-optimal actions, a problem that is aggravated as the number of actions is increased. This may result in policies that may not be safe to execute. To address this issue, Lee et al. (2018) proposed to add a special form of a general notion of entropy, Path Consistency Learning in Tsallis Entropy Regularized MDPs called Tsallis entropy (Tsallis, 1988), to the Bellman equations. This formulation has the property that its solution has sparse distributions, i.e., at each state, only a small number of actions have non-zero probability. Lee et al. (2018) studied the properties of this ERL formulation, proposed value-based algorithms (fitted Q-iteration and Q-learning) to solve it, and showed that although it is harder to solve than its soft counterpart, it potentially has a solution closer to that of the original problem. In this paper, we propose novel path consistency learning (PCL) algorithms for the Tsallis ERL problem, called sparse PCL. PCL is a class of actor-critic type algorithms developed by Nachum et al. (2017) for the soft (Shannon entropy) ERL problem. It uses a nice property of soft ERL, namely the equivalence of consistency and optimality, and learns parameterized policy and value functions by minimizing a loss that is based on the consistency equation of soft ERL. The most notable feature of soft PCL is that it can work with both on-policy (sub-trajectories generated by the current policy) and off-policy (sub-trajectories generated by a policy different than the current one, including any sub-trajectory from the replay buffer) data. We first derive a multi-step consistency equation for the Tsallis ERL problem, called sparse consistency. We then prove that in this setting, while optimality implies consistency (similar to the soft case), unlike the soft case, consistency only implies sub-optimality. We then use the sparse consistency equation and derive PCL algorithms that use both on-policy and off-policy data to solve the Tsallis ERL problem. We empirically compare sparse PCL with its soft counterpart. As expected, we gain from using the sparse formulation when the number of actions is large, both in algorithmic tasks and in discretized continuous control problems. 2. Markov Decision Processes (MDPs) We consider the reinforcement learning (RL) problem in which the agent’s interaction with the system is modeled as a MDP. A MDP is a tuple M = (X , A, r, P, P0 , γ), where X and A are state and action spaces; r : X × A → R and P : X × A → ∆X are the reward function and transition probability distribution, with r(x, a) ∈ [0, Rmax ] and P (·|x, a) being the reward and the next state probability of taking action a in state x; P0 : X → ∆X is the initial state distribution; and γ ∈ [0, 1) is a discounting factor. In this paper, we assume that the action space is finite, but can be large. The goal in RL is to find a stationary Markovian policy, i.e., a mapping from state and action spaces to a simplex over the actions µ : X × A → ∆A , that maximizes the expected discounted sum of rewards, i.e., max E ∞ X µ s.t. t  γ r(xt , at ) (1) t=0 ∀x X a∈A µ(a|x) = 1, ∀x, a µ(a|x) ≥ 0, where x0 ∼ P0 , at ∼ µ(·|xt ), and xt+1 ∼ P (·|xt , at ). For a given policy µ, we define its value and action-value functions as ∞ X  V µ (x) = E γ t r(xt , at )|x0 = x, µ, P , t=0 ∞ X  Qµ (x, a) = E γ t r(xt , at )|x0 = x, a0 = a, µ, P . t=0 Any solution of the optimization problem (1) is called an optimal policy and is denoted by µ∗ . Note that while a MDP may have several optimal policies, it only has a sin∗ gle optimal value function V ∗ = V µ . It has been proven that (1) has a solution in the space of deterministic policies, i.e., Πd = {µ : µ : X → A}, which can be obtained as the greedy action w.r.t. the optimal action-value function, i.e., µ∗ (x) ∈ arg maxa Q∗ (x, a) (Puterman, 1994; Bertsekas & Tsitsiklis, 1996). The optimal action-value function Q∗ is the unique solution of the non-linear Bellman optimality equations, i.e., for all x ∈ X and a ∈ A, X Q(x, a) = r(x, a)+γ P (x0 |x, a) max Q(x0 , a0 ). (2) 0 a ∈A x0 ∈X Any optimal policy µ∗ and the optimal state and stateaction value functions, V ∗ and Q∗ , satisfy the following equations for all states and action, X Q∗ (x, a) = r(x, a) + γ P (x0 |x, a)V ∗ (x0 ), x0 ∈X V ∗ (x) = max Q∗ (x, a), a∈A µ∗ (x) ∈ arg max Q∗ (x, a). a∈A 3. Entropy Regularized MDPs As discussed in Section 2, finding an optimal policy for a MDP involves solving a non-linear system of equations (see Eq. 2), which is often complicated. Moreover, the optimal policy may be deterministic, always selecting the same optimal action at a state even when there are several optimal actions in that state. This is undesirable when it is important to explore and to deal with unexpected situations. In such cases, one might be interested in multimodal policies that still have good performance. This is why many researchers have proposed to add a regularizer in the form of an entropy term to the objective function (1) and solve the following entropy-regularized optimization problem ∞ hX i max E γ t r(xt , at ) + αH µ (xt , at ) µ s.t. (3) t=0 ∀x X µ(a|x) = 1, ∀x, a µ(a|x) ≥ 0, a∈A where H µ (x, a) is an entropy-related term and α is the regularization parameter. The entropy term smoothens the objective function (1) such that the resulting problem (3) is often easier to solve than the original one (1). This is another reason for the popularity of entropy-regularized MDPs. Path Consistency Learning in Tsallis Entropy Regularized MDPs 3.1. Entropy Regularized MDP with Shannon Entropy 4 It is common to use Hsfµ (xt , at ) = − log µ(at |xt ) in entropy-regularized MDPs (e.g., Fox  et al. 2016;  Nachum et al. 2017). Note that Hsf (µ) = Eµ Hsfµ (x, a) is the Shannon entropy. Problem (3) with Hsfµ (x, a) can be seen as a RL problem in which the reward function is the sum of the original reward function r(x, a) and a term that encourages exploration.1 Unlike (1), the optimization problem (3) with Hsfµ has a unique optimal policy µ∗sf and a unique optimal value Vsf∗ (action-value Q∗sf ) function that satisfy the following equations: Q∗sf (x, a) = r(x, a) + γ X P (x0 |x, a)Vsf∗ (x0 ), 3.2. Entropy Regularized MDP with Tsallis Entropy To address the issues with the softmax policy, Lee et al.  4 µ (2018) proposed to use Hsp (xt , at ) = 21 1 − µ(at |xt ) in entropy-regularized MDPs. Note that Hsp (µ) =  µ Eµ Hsp (x, a) is a special case of a general notion of entropy, called entropy (Tsallis, 1988), i.e., Sq,k (p) = P Tsallis q k (1 − p ), for the parameters q = 2 and k = 12 .2 i i q−1 Similar to the soft MDP problem, the optimization probµ lem (3) with Hsp has a unique optimal policy µ∗sp and a unique optimal value Vsp∗ (action-value Q∗sp ) function that satisfy the following equations (Lee et al., 2018): Q∗sp (x, a) = r(x, a) + γ x0 ∈X X P (x0 |x, a)Vsp∗ (x0 ), x0 ∈X  Vsf∗ (x) = α · sfmax Q∗sf (x, ·)/α ,  exp Q∗sf (x, a)/α , µ∗sf (a|x) = P ∗ 0 a0 ∈A exp Qsf (x, a )/α (4) where for any function f : X × A → R,P the sfmax operator  is defined as sfmax f (x, ·) = log a exp f (x, a) . Note that the equations in (4) are derived from the KKT conditions of (3) with Hsfµ . In this case, the optimal policy is soft-max, with the regularization parameter α playing the role of its temperature (see Eq. 4). This is why (3) with Hsfµ is called the soft MDP problem. In soft MDPs, the optimal value function Vsf∗ is the unique solution of the soft Bellman optimality equations, i.e., ∀x ∈ X , ∀a ∈ A,  Vsp∗ (x) = α · spmax Q∗sp (x, ·)/α ,  + , µ∗sp (a|x) = Q∗sf (x, a)/α − G Q∗sf (x, ·)/α where (·)+ = max(·, 0), and for any function f : X ×A → R, the spmax operator is defined as  f (x, ·) 2 i X  f (x, a) 2  1h 1+ −G , spmax f (x, ·) = 2 α α a∈S(x) in which P  G f (x, ·) = a∈S(x) f (x, a) − 1 |S(x)| f (x,a V (x) = α · sfmax  r(x, ·) + γ X   P (x |x, ·)V (x ) /α . (5) 0 0 x0 Note that the sfmax operator is a smoother function of its inputs than the max operator associated with the Bellman optimality equation (2). This means that solving the soft MDP problem is easier than the original one, with the cost that its optimal policy µ∗sf performs worse than the optimal policy of the original MDP µ∗ . This difference can be quantified as ∀x ∈ X V ∗ (x) − ∗ α log(|A|) ≤ V µsf (x) ≤ V ∗ (x), (6) 1−γ where we discriminate between the value function of a policy µ in the soft Vsfµ and original V µ MDPs. Note that the sub-optimality of µ∗sf is unbounded as |A| → ∞. This is the main drawback of using softmax policies; in large action space problems, at each step, the policy assigns a nonnegligible probability mass to non-optimal actions, which in aggregate can be detrimental to its reward performance. 1 Another entropy term that has been studied in the literature (7) ) and S(x) is the set of actions satisfying 1 + i α (i) > Pi f (x,a(j) ) , where a(i) indicates the action with the ith j=0 α largest value of f (x, a). Note that the equations in (7) are µ derived from the KKT conditions of (3) with Hsp . In this case, the optimal policy may have zero probability for sevµ eral actions (see Eq. 7). This is why (3) with Hsp is called the sparse MDP problem. The regularization parameter α controls the sparsity of the resulted policy. The policy would be more sparse for smaller values of α. In sparse MDPs, the optimal value function Vsp∗ is the unique fixedpoint of the sparse Bellman optimality operator Tsp (Lee et al., 2018) that for any function f : X → R is defined as  X   P (x0 |x, ·)f (x0 ) /α . (Tsp f )(x) = α · spmax r(x, ·) + γ x0 (8) Similar to (5), the spmax operator is a smoother function of its inputs than the max, and thus, solving the sparse MDP problem is easier than the original one, with the cost that its optimal policy µ∗sp performs worse than the optimal policy of the original MDP µ∗ . This difference can be quantified as (Lee et al., 2018), 4 µ t |xt ) is Hrel (xt , at ) = − log µµ(a , where πb is a baseline policy. t |xt )   b (a µ Note that Hrel (µ) = Eµ Hrel (x, a) is the relative entropy. Probµ lem (3) with Hrel (x, a) can be seen as a RL problem in which the reward function is the sum of the original reward function r(x, a) and a term that penalizes deviation from the baseline policy πb . ∀x ∈ X V ∗ (x) − ∗ |A| − 1 α · ≤ V µsp (x) ≤ V ∗ (x). (9) 1−γ 2|A| 2 Note that the Shannon entropy is a special case of the Tsallis entropy for the parameters q = k = 1 (Tsallis, 1988). Path Consistency Learning in Tsallis Entropy Regularized MDPs On the other hand, the spmax operator is more complex than sfmax, and thus, it is slightly more complicated to solve the sparse MDP problem than its soft counterpart. However, as can be seen from Eqs. 6 and 9, the optimal policy of the sparse MDP, µ∗sp , can have a better performance than its soft counterpart, µ∗sf , and this difference becomes more apparent as the number of actions |A| grows. For large action size, the term (|A| − 1)/(2|A|) in (9) turns to a constant, while log |A| in (6) grows unbounded. 4. Path Consistency Learning in Soft MDPs A nice property of soft MDPs that was elegantly used by Nachum et al. (2017) is that any policy µ and function V : X → R that satisfy the (one-step) consistency equation, i.e., for all x ∈ X and for all a ∈ A, V (x) = r(x, a)−α log µ(a|x)+γ X P (x0 |x, a)V (x0 ), (10) x0 ∈X µ∗sf are optimal, i.e., µ = and V = Vsf∗ (consistency implies optimality). Due to the uniqueness of the optimal policy in soft MDPs, the reverse is also true, i.e., the optimal policy µ∗sp and the value function Vsp∗ satisfy the consistency equation (optimality implies consistency). As shown in Nachum et al. (2017), the (one-step) consistency equation (10) can be easily extended to multi-step, i.e., any policy µ and function V : X → R that for any state x0 and sequence of actions a0 , . . . , ad−1 , satisfy the multi-step consistency equation h V (x0 ) = Ex1:d |x0 ,a0:d−1 γ d V (xd ) + d−1 X γ t r(xt , at ) − α log µ(at |xt ) (11) i t=0 are optimal, i.e., µ = µ∗sf and V = Vsf∗ . The property that both single and multiple step consistency equations imply optimality (Eqs. 10 and 11) was the motivation of a RL algorithm by Nachum et al. (2017), path consistency learning (PCL). The main idea of (soft) PCL is to learn a parameterized policy and value function by minimizing the following objective function: J (θ, φ) = 1X J(ξi , θ, φ)2 , 2 ξi where ξ = (x0 , a0 , r0 , . . . , xd−1 , ad−1 , rd−1 , xd ) is any dlength sub-trajectory, θ and φ are the policy and value function parameters, respectively, and J(ξ, θ, φ) = −Vφ (x0 ) + γ d Vφ (xd ) + d−1 X (12)  γ t r(xt , at ) − α log µθ (at |xt ) . t=0 An important property of the soft PCL algorithm is that since the multi-step consistency (11) holds for any d-length sub-trajectory, it can use both on-policy (ξ’s generated by the current policy µθ ) and off-policy data, i.e., ξ’s generated by a policy different than the current one, including any dlength sub-trajectory from the replay buffer. Note that since both optimal policy µ∗sf and value function Vsf∗ can be written based on the optimal action-value function Q∗sf (see Eq. 4), we may write the objective function (12) based on Qψ , and optimize only one set of parameters ψ, instead of separate θ and φ. 5. Consistency between Optimal Value & Policy in Sparse MDPs This section begins the main contributions of our work. We first identify a (one-step) consistency equation for the sparse MDPs defined by (3). We then prove the relationship between the sparse consistency equation and the optimal policy and value function of the sparse MDP, and highlight its similarities and differences with that in soft MDPs, discussed in Section 4. We then extend the sparse consistency equation to multiple steps and prove results that allow us to use the multi-step sparse consistency equation to derive on-policy and off-policy algorithms to solve sparse MDPs, which we fully describe in Section 6. The significance of the sparse consistency equation is in providing an efficient tool for computing a near-optimal policy for sparse MDPs, which only involves solving a set of linear equations and linear complementary constraints, as opposed to (iteratively) solving the fixed-point of the non-linear sparse Bellman operator (8). We report the proofs of all the theorems of this section in Appendix A. For any policy µ and value function V : X → R, we define the (one-step) consistency equation of the sparse MDPs as, for all state x ∈ X and for all actions a ∈ A, α V (x) = r(x, a) + − αµ(a|x) + λ(a|x) − Λ(x) 2 X +γ P (x0 |x, a)V (x0 ), (13) x0 where λ : X × A → R+ and Λ : X → R− are Lagrange multipliers, such that λ(a|x) · µ(a|x) = 0 and − α2 ≤ Λ(x) ≤ 0. We call this the one-step sparse consistency equation and it is the equivalent of Eq. 10 in soft MDPs. We now present a theorem which states that, similar to soft MDPs, optimality in sparse MDPs is a necessary condition for consistency, i.e., optimality implies consistency. Theorem 1. The optimal policy µ∗sp and value function Vsp∗ of the sparse MDP (3) satisfy the consistency equation (13). Theorem 2 shows that in the sparse MDPs, consistency only implies near-optimality, as opposed to optimality in the case of soft MDPs. Path Consistency Learning in Tsallis Entropy Regularized MDPs Theorem 2. Any policy µ that satisfies the consistency equation (13) is α/(1 − γ)-optimal in the sparse MDP (3), i.e., for each state x ∈ X , we have α Vspµ (x) ≥ Vsp∗ (x) − . (14) 1−γ This result indicates that for a fixed γ, as α decreases, a policy µ satisfying the one-step consistency equations approaches the true optimal µ∗sp . To connect the performance of µ to the original goal of maximizing expected return, we present the following corollary, which is a direct consequence of Theorem 2 and the results reported in Section 3.2 on the performance of µ∗sp in the original MDP. Corollary 1. Any policy µ that satisfies the consistency 1 α ) · 1−γ -optimal in the original equation (13) is ( 32 − |A| MDP (1), i.e., for each state x ∈ X , we have   3 1 α ∗ V (x) − − · ≤ V µ (x) ≤ V ∗ (x). 2 |A| 1−γ We now extend the (one-step) sparse consistency equation (13) to multiple steps. For any state x0 ∈ X and sequence of actions a0 , . . . , ad−1 , define the multi-step consistency equation for sparse MDPs as h V (x0 ) = Ex1:d |x0 ,a0:d−1 γ d V (xd ) + d−1 X t=0 γ t r(xt , at ) + (15) i α − αµ(at |xt ) + λ(at |xt ) − Λ(xt ) , 2 where λ : X × A → R+ and Λ : X → R− are Lagrange multipliers, such that λ(a|x) · µ(a|x) = 0 and − α2 ≤ Λ(x) ≤ 0. We call this multi-step sparse consistency equation, the equivalent of Eq. 11 in soft MDPs. From Theorem 1, we can immediately show that multi-step sparse consistency is a necessary condition of optimality. Corollary 2. The optimal policy µ∗sp and value function Vsp∗ of the sparse MDP (3) satisfy the multi-step consistency equation (15). Proof. The proof follows directly from Theorem 1, by repeatedly applying the expression in (13) over the trajectory ξ, taking the expectation over the trajectory, and using telescopic cancellation of the value function of intermediate states. Conversely, followed from Theorem 2, we prove the following result on the performance of any policy satisfying the mutli-step consistency equation. This is a novel result showing that solving the multi-step consistency equation is indeed sufficient to guarantee near-optimality. Corollary 3. Any policy µ that satisfies the multi-step consistency equation (15) is α/(1 − γ)-optimal in the sparse MDP (3). Proof. Consider the multi-step consistency equation (15). Since it is true for any initial state x0 and sequence of actions a0:d−1 , unrolling it for another d steps starting at state xd and using the action sequence ad:2d−1 yields h V (x0 ) = Ex1:2d |x0 ,a0:2d−1 γ 2d V (x2d ) + 2d−1 X γ t r(xt , at ) + t=0 i α − αµ(at |xt ) + λ(at |xt ) − Λ(xt ) . 2 Note that this process can be repeated for an arbitrary number of times (say k times), and also note that as V is a bounded function, one has limk→∞ γ kd V (xkd ) = 0. Therefore, by further unrolling, we obtain V (x0 ) = Ex1:∞ |x0 ,a0:∞ ∞ hX γ t r(xt , at ) + t=0 α − αµ(at |xt ) 2 i + λ(at |xt ) − Λ(xt ) . Followed from the Banach fixed-point theorem (Bertsekas & Tsitsiklis, 1996), one can show that the solution pair (V, µ) is also a solution to the one-step consistency condition in (13), i.e.,PV (x) = r(x, a) + α2 − αµ(a|x) + λ(a|x)−Λ(x)+γ x0 ∈X P (x0 |x, a)V (x0 ), for any x ∈ X and a ∈ A. Thus the α/(1 − γ)-optimality performance guarantee of µ is implied by Theorem 2. Equipped with the above results on the relationship between (near)-optimality and multi-step consistency in sparse MDPs, we are now ready to present our off-policy RL algorithms to solve the sparse MDP (3). 6. Path Consistency Learning in Sparse MDPs Similar to the PCL algorithm for soft MDPs, in sparse MDPs the multi-step consistency equation (15) naturally leads to a path-wise algorithm for training a policy µθ and value function Vφ parameterized by θ and φ, as well as Lagrange multipliers Λρ and λθ,ρ parameterized by the auxiliary parameter ρ. To characterize the objective function of this algorithm, we first define the soft consistency error for the d-step sub-trajectory ξ as a function of θ, ρ, and φ, J(ξ; θ,ρ, φ) = −Vφ (x) + γ d Vφ (xd ) + d−1 X t=0 γ j r(xt , at ) +  α − αµθ (at |xt ) + λθ,ρ (at |xt ) − Λρ (xt ) . 2 The goal of our algorithm is to learn Vφ , µθ , λθ,ρ , and Λρ , such that the expectation of J(ξ; θ, ρ, φ) for any initial state x0 and action sequence a0:d−1 is as close to 0 as possibles. Our sparse PCL algorithm minimizes objective function Jn (θ, ρ, φ) = P the empirical 1 2 J(ξ ; θ, ρ, φ) , which converges to J (θ, ρ, φ) = i ξi 2 Path Consistency Learning in Tsallis Entropy Regularized MDPs   Ex0 ,a0:d−1 E[J(ξ; θ, ρ, φ)2 | x0 , a0:d−1 ] as i → ∞. By the Cauchy-Schwarz inequality, J (θ, ρ, φ) is a conserva 2 tive surrogate of E J(ξ; θ, ρ, φ) , which represents the error of the multi-step consistency equation. This relationship justifies that the solution policy of the sparse PCL algorithm is near-optimal (see Corollary 3). Moreover, the gradient of J(ξ) w.r.t. the parameters is as follows: d−1 X  ∂J(ξ) = J(ξ; θ, ρ, φ) γ t ∇θ λθ,ρ (at |xt ) − αµθ (at |xt ) , ∂θ t=0 d−1 X  ∂J(ξ) = J(ξ; θ, ρ, φ) γ t ∇ρ λθ,ρ (at |xt ) − Λρ (xt ) , ∂ρ t=0  ∂J(ξ) = J(ξ; θ, ρ, φ)∇φ Vφ (x0 ) − γ d Vφ (xd ) . ∂φ We may relate the sparse PCL algorithm to the standard actor-critic (AC) algorithm (Konda & Tsitsiklis, 2000; Sutton et al., 2000), where ∂J(ξ)/∂θ and ∂J(ξ)/∂φ correspond to the actor and critic updates, respectively. An advantage of sparse PCL over the standard AC is that it does not need the multi-time-scale update required by AC for convergence. While optimizing J(θ, ρ, φ) minimizes the mean square of the soft consistency error, in order to satisfy the multistep consistency in (15), one still needs to impose the following constraints on Lagrange multipliers into the optimization problem: (i) − α2 ≤ Λρ (x) ≤ 0, and (ii) λθ,ρ (a|x) · µθ (a|x) = 0, ∀x ∈ X , ∀a ∈ A. One standard approach is to replace the above constraints with adding penalty functions (Bertsekas, 1999) to the original objective function Jn . Note that each penalty function is associated with a penalty parameter and there are |X | · |A| + 2|X | constraints. When |X | and |A| are large, tuning all the parameters becomes computationally expensive. Another approach is to update the penalty parameters using gradient ascent methods (Bertsekas, 2014). This is equivalent to finding the saddle point of the Lagrangian function in the constrained optimization problem. However, the challenge is to balance the primal and dual updates in practice. We hereby describe an alternative and a much simpler methodology to parameterize the Lagrange multipliers λθ,ρ (a|x) and Λρ (x), such that the aforementioned constraints are immediately satisfied. Although this method may impose extra restrictions to the representations of their function approximations, it avoids the difficulties of directly solving a constrained optimization problem. Specifically, to satisfy the constraint (i), one can parameterize Λρ with a multilayer perceptron network that has either an activation function of −α/2 · σ(·) or −α/2 · (1 + tanh(·))/2 at its last layer. To satisfy constraint (ii), we consider the case when µθ is written in form of (fθ (x, a))+ for some function approximator fθ . This parameterization of µθ is justified by the closed-form solution policy of the Tsallis entropy-regularized MDP problem in (7). Specifically, (7) ∗ uses fsp (x, a) = Q∗sp (x, a)/α − G(Q∗sp (x, ·)/α). Now suppose that λθ,ρ is parameterized as follows: λθ,ρ (a|x) = + −fθ (x, a) · Fρ (x, a), where Fρ : X × A → R+ is an auxiliary function approximator. Then by the property (x)+ · (−x)+ = 0, constraint (ii) is immediately satisfied. A pseudo-code of our sparse PCL algorithm can be found in Algorithm 1 in the Appendix A. Unified Sparse PCL Note that the closed-form optimal policy µ∗sp and value function Vsp∗ are both functions of the optimal state-action value function Q∗sp . As in soft PCL, based on this observation one can also parameterize both policy and value function in sparse PCL (see Eq. 7) with a single function approximator Qψ (x, a). Although consistency does not imply optimality in sparse MDPs (as opposed to the case of soft MDPs), the justification of this parameterization comes from Corollary 2, where the unique optimal value function and optimal policy satisfy the consistency equation (15). From an actor-critic perspective, the significance of this is that both policy (actor) and value function (critic) can be updated simultaneously without affecting the convergence. Accordingly, the update rule for the model parameter ψ takes the form d−1 X  ∂J(ξ) = J(ξ; ψ, ρ) γ t ∇ψ λψ,ρ (at |xt ) −αµψ (at |xt ) ∂ψ t=0  + ∇ψ Vψ (x0 ) − γ d ∇ψ Vψ (xd ) . 7. Experimental Results We demonstrate the effectiveness of the sparse PCL algorithm by comparing its performance with that of the soft PCL algorithm on a number of RL environments available in the OpenAI Gym (Brockman et al., 2016) environment. 7.1. Discrete Control Here we compare the performance of these two algorithms on the following standard algorithmic tasks: 1) Copy, 2) DuplicatedInput, 3) RepeatCopy, 4) Reverse, and 5) ReversedAddition (see appendix for more details). Each task can be viewed as a grid environment, where each cell stores a single character from a finite vocabulary V. An agent moves on the grid of the environment and writes to output. At each time step the agent observes the character of the single cell in which it is located. After observing the character, the agent must take an action of the form (m, w, c), where m determines the agent’s move to an adjacent cell, (in 1D environments, m ∈ {left, right}; in 2D environments, m ∈ {left, right, up, down}), w ∈ {0, 1} determines whether the agent writes to output or not, and c ∈ V determines the character that the agent writes if w = 1 (otherwise c = ∅). Based on this problem setting, the action Path Consistency Learning in Tsallis Entropy Regularized MDPs Copy |A| = 20 |A| = 40 30 30 25 25 25 25 20 20 20 20 15 15 15 15 10 10 10 10 5 5 5 0 0 500 1000 1500 2000 DuplicatedInput 5 0 0 1000 |A| = 20 2000 3000 4000 0 0 |A| = 80 2000 4000 6000 8000 10000 0 |A| = 160 15 15 15 10 10 10 10 5 5 5 5 0 0 500 1000 1500 2000 2500 0 0 1000 |A| = 20 2000 3000 4000 5000 5000 10000 15000 0 |A| = 80 80 80 80 60 60 60 40 40 40 40 20 20 20 20 0 0 0 10000 15000 0 |A| = 16 2000 4000 6000 8000 10000 5000 10000 15000 20000 0 |A| = 64 30 30 30 25 25 25 25 20 20 20 20 15 15 15 15 10 10 10 10 5 5 5 0 5000 10000 15000 20000 5000 10000 15000 20000 Soft PCL 5000 10000 15000 20000 5 0 0 10000 20000 30000 40000 50000 |A| = 128 30 0 20000 0 0 |A| = 32 0 15000 |A| = 160 60 5000 10000 0 0 |A| = 40 80 0 5000 |A| = 320 15 0 RepeatCopy |A| = 160 30 0 Reverse |A| = 80 30 0 0 10000 20000 30000 40000 50000 0 10000 20000 30000 40000 50000 Sparse PCL Figure 1. Results of the average reward from sparse PCL and standard soft PCL during training. Here each row corresponds to a specific algorithmic task. For each particular task, the action space is increased from left to right across the rows, corresponding to an increase in difficulty. We observe that soft PCL returns a better solution when the action space is small, but its performance degrades quickly as the size of action space grows. On the other hand, sparse PCL is not only able to learn good policies in tasks with small action spaces, but, unlike soft PCL, also successfully learns high-reward policies in the higher-dimension variants. See the appendix for additional results. space A has size |A| = Θ(|V|). Accordingly, the difficulty of these tasks grows with the size of the vocabulary. To illustrate the effectiveness of Tsallis entropy-regularized MDPs in problems with large action space, we evaluate these two PCL algorithms on 4 different choices of |V|. In each task, the agent has a different goal. In Copy, the environment is a 1D sequence of characters and the agent aims to copy the sequence to output. In DuplicatedInput, the environment is a 1D sequence of duplicated characters and the agent needs to write the de-duplicated sequence to output. In RepeatCopy, the environment is a 1D sequence of characters in which the agent must copy in forward order, reverse order, and finally forward order again. In Reverse, the environment is a 1D sequence of characters in which the agent must copy to output in reverse order. Finally, in ReversedAddition, the environment is a 2 × n grid of digits representing two numbers in base-|V| that the agent needs to sum. In each task the agent receives a reward of 1 for each correctly output character. The episode is terminated either when the task is completed, or when the agent outputs an incorrect character. We follow a similar experimental procedure as in Nachum et al. (2017), where the functions V , µ, λ, Λ in the consistency equations are parameterized with a recurrent neural network with multiple heads. For each task and each PCL algorithm, we perform a hyper-parameter search to find the optimal regularization weight α, and the corresponding training curves for average reward are shown in Figure 1. To increase the statistical significance of these experiments, we also train these policies on 5 different Monte Carlo trials (Notice that these environments are inherently deterministic, therefore no additional Monte Carlo evaluation is needed.). Details of the experimental setup and extra numerical results are included in the Appendix. For each task we evaluated sparse PCL compared to the original soft PCL on a suite of variants which successively increase the vocabulary size. For low vocabulary sizes soft PCL achieves better results. This suggests that Shannon entropy encourages better exploration in small action spaces. Indeed, in such regimes, a greater proportion of the total actions are useful to explore, and exploration is not as costly. Therefore, the decreased exploration of the Tsallis entropy Path Consistency Learning in Tsallis Entropy Regularized MDPs 7.2. Continuous Control We further evaluate the two PCL algorithms on HalfCheetah, a continuous control problem in the OpenAI gym. The environment consists of a 6−dimensional action space, where each dimension corresponds to a torque of [−1, 1]. Here we discretize each continuous action with either one of the following grids: {−1, 0, 1} and {−1, −0.5, 0, 0.5, 1}. Even though the resolution of these discretization grids is coarse, the corresponding action spaces are quite large, with sizes of 36 = 729 and 56 = 15625, respectively. We present the results of sparse PCL and soft PCL on these discretized problems in Figure 2. Similar to the observations in the algorithmic tasks, here the policy learned by sparse PCL performs much better than that of soft PCL. Specifically sparse PCL achieves higher average reward and is able to learn much faster. To better visualize the learning progress of these two PCL algorithms in these problems, at each training step we also compare the average probability of the most-likely actions across all time-steps from the on-policy trajectory.3 Clearly, sparse PCL quickly converges to a near-deterministic policy, while the policy generated by soft PCL still allocates significant probability masses to non-optimal actions (as the average probability of most-likely actions barely ever exceeds 0.75). In environments like HalfCheetah, where the trajectory has a long horizon (1000 steps), the soft-max policy will in general suffer because it chooses a large number of sub-optimal actions in each episode for exploration. Comparing with the performance of other continuous RL algorithms such as deterministic policy gradient (DPG) (Silver et al., 2014), we found that the policy generated by 3 Specifically in each iteration we collect a single on-policy trajectory of 1000 steps. Therefore this metric is an average over 1000 samples of (greedy) action probabilities. |A| = 56 2500 2500 2000 2000 1500 1500 1000 1000 500 500 0 0 0 Most Likely Probability As we increase the vocabulary size (and thus the action space), the picture changes. We see that the advantage of soft PCL over sparse PCL decreases until eventually the order is reversed and sparse PCL begins to show a significant improvement over the standard soft PCL. This supports our original hypothesis. In large action spaces, the tendency of soft PCL to assign a non-zero probability to many sub-optimal actions over-emphasizes exploration and is detrimental to the final reward performance. On the other hand, sparse PCL is able to handle exploration in large action spaces properly. These empirical results provide evidence for this unique advantage of sparse PCL. Reward |A| = 36 may outweigh its asymptotic benefits. The sub-optimality bounds presented in this paper support this behavior: when |A| is small, αsoft PCL log(|A|) ≤ 3αsparse PCL /2. 20000 40000 60000 1.0 1.0 0.8 0.8 0.6 0.6 0.4 0.4 0 20000 40000 60000 Soft PCL 0 20000 40000 60000 0 20000 40000 60000 Sparse PCL Figure 2. Results of sparse PCL and soft PCL in HalfCheetah with discretized actions. The top figure shows the average reward over 5 random runs during training, with best hyper-parameters. On the bottom we plot the average probability of the most-likely actions during training. The bottom figure illustrates the fast convergence of sparse PCL to a near-deterministic policy. sparse PCL is sub-optimal. This is mainly due to the coarse discretization of the action space. Our main purpose here is to demonstrate the fast and improved convergence to deterministic policies in sparse PCL, compared to soft PCL. Further evaluation of sparse PCL will be left to future work. 8. Conclusions In this work we studied the sparse entropy-regularized problem in RL, whose optimal policy has non-zero probability for only a small number of actions. Similar to the work by Nachum et al. (2017), we derived a relationship between (near-)optimality and consistency for this problem. Furthermore, by leveraging the properties of the consistency equation, we proposed a class of sparse path consistency learning (sparse PCL) algorithms that are applicable to both on-policy and off-policy data and can learn from multi-step trajectories. We found that the theoretical advantages of sparse PCL correspond to empirical advantages as well. For tasks with a large number of actions, we find significant improvement in final performance and amount of time needed to reach that performance by using sparse PCL compared to the original soft PCL. Future work includes 1) extending the sparse PCL algorithm to the more general class of Tsallis entropy, 2) investigating the possibility of combining sparse PCL and path following algorithms such as TRPO (Schulman et al., 2015), and 3) comparing the performance of sparse PCL with other deterministic policy gradient algorithms, such as DPG (Silver et al., 2014) in the continuous domain. Path Consistency Learning in Tsallis Entropy Regularized MDPs References Asadi, K. and Littman, M. An alternative softmax operator for reinforcement learning. In Proceedings of the 34th International Conference on Machine Learning, pp. 243–252, 2017. Azar, M., Gómez, V., and Kappen, H. Dynamic policy programming. Journal of Machine Learning Research, 13:3207–3245, 2012. Bellman, R. Dynamic Programming. Princeton University Press, 1957. Bertsekas, D. Nonlinear programming. Athena scientific Belmont, 1999. Bertsekas, D. Constrained optimization and Lagrange multiplier methods. Academic press, 2014. Bertsekas, D. and Tsitsiklis, J. Neuro-Dynamic Programming. Athena Scientific, 1996. Brockman, G., Cheung, V., Pettersson, L., Schneider, J., Schulman, J., Tang, J., and Zaremba, W. OpenAI Gym. arXiv:1606.01540, 2016. Farahmand, A. M., Ghavamzadeh, M., Szepesvári, Cs., and Mannor, S. Regularized policy iteration. In Proceedings of Advances in Neural Information Processing Systems 21, pp. 441–448. MIT Press, 2008. Farahmand, A. M., Ghavamzadeh, M., Szepesvári, Cs., and Mannor, S. Regularized fitted Q-iteration for planning in continuous-space Markovian decision problems. In Proceedings of the American Control Conference, pp. 725– 730, 2009. Fox, R., Pakman, A., and Tishby, N. G-learning: Taming the noise in reinforcement learning via soft update. In Proceedings of the 32nd International Conference on Uncertainty in Artificial Intelligence, pp. 202–211, 2016. Ghavamzadeh, M., Lazaric, A., Munos, R., and Hoffman, M. Finite-sample analysis of lasso-td. In Proceedings of the Twenty-Eighth International Conference on Machine Learning, pp. 1177–1184, 2011. Johns, J., Painter-Wakefield, C., and Parr, R. Linear complementarity for regularized policy evaluation and improvement. In Proceedings of Advances in Neural Information Processing Systems 23, pp. 1009–1017. MIT Press, 2010. Kappen, H. Path integrals and symmetry breaking for optimal control theory. Journal of Statistical Mechanics, 11, 2005. Kolter, Z. and Ng, A. Regularization and feature selection in least-squares temporal difference learning. In Proceedings of the Twenty-Sixth International Conference on Machine Learning, pp. 521–528, 2009. Konda, V. and Tsitsiklis, J. Actor-critic algorithms. In Advances in neural information processing systems, pp. 1008–1014, 2000. Lee, K., Choi, S., and Oh, S. Sparse Markov decision processes with causal sparse Tsallis entropy regularization for reinforcement learning. IEEE Robotics and Automation Letters, 2018. Mnih, V., Badia, A., Mirza, M., Graves, A., Lillicrap, T., Harley, T., Silver, D., and Kavukcuoglu, K. Asynchronous methods for deep reinforcement learning. In Proceedings of the 33rd International Conference on Machine Learning, pp. 1928–1937, 2016. Nachum, O., Norouzi, M., Xu, K., and Schuurmans, D. Bridging the gap between value and policy based reinforcement learning. In NIPS, pp. 2772–2782, 2017. Nachum, Ofir, Norouzi, Mohammad, Xu, Kelvin, and Schuurmans, Dale. Trust-pcl: An off-policy trust region method for continuous control. In Proceedings of the 5th International Conference on Learning Representations, 2018. Neu, G., Jonsson, A., and Gómez, V. A unified view of entropy-regularized Markov decision processes. arXiv:1705.07798, 2017. O’Donoghue, B., Munos, R., Kavukcuoglu, K., and Mnih, V. PGQ: Combining policy gradient and Q-learning. In Proceedings of the 5th International Conference on Learning Representations, 2017. Peters, J., Müling, K., and Altun, Y. Relative entropy policy search. In Proceedings of the 24th Conference on Artificial Intelligence, pp. 1607–1612, 2010. Puterman, M. Markov Decision Processes. Wiley Interscience, 1994. Schulman, J., Levine, S., Moritz, P., Jordan, M., and Abbeel, P. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning, pp. 1889–1897, 2015. Silver, David, Lever, Guy, Heess, Nicolas, Degris, Thomas, Wierstra, Daan, and Riedmiller, Martin. Deterministic policy gradient algorithms. In ICML, 2014. Sutton, R. and Barto, A. An Introduction to Reinforcement Learning. MIT Press, 1998. Path Consistency Learning in Tsallis Entropy Regularized MDPs Sutton, R., McAllester, D., Singh, S., and Mansour, Y. Policy gradient methods for reinforcement learning with function approximation. In Proceedings of Advances in Neural Information Processing Systems 12, pp. 1057– 1063, 2000. Todorov, E. Linearly-solvable Markov decision problems. In Proceedings of the 19th Advances in Neural Information Processing, pp. 1369–1376, 2006. Todorov, E. Policy gradients in linearly-solvable MDPs. In Proceedings of the 23rd Advances in Neural Information Processing, pp. 2298–2306, 2010. Tsallis, C. Possible generalization of Boltzmann-Gibbs statistics. Journal of Statistical Physics, 52(1):479–487, 1988. Ziebart, B. Modeling Purposeful Adaptive Behavior with the Principle of Maximum Causal Entropy. PhD thesis, Carnegie Mellon University, 2010. Path Consistency Learning in Tsallis Entropy Regularized MDPs A. Proofs of Section 5 Consider the Bellman operator for the entropy-regularized MDP with Tsallis entropy:  X   (Tsp f )(x) = α · spmax r(x, ·) + γ P (x0 |x, ·)f (x0 ) /α . x0 We first have the following technical result about its properties. Proposition 1. The sparse-max Bellman operator Tsp has the following properties: (i) Translation: (Tsp (V + β))(x) = (Tsp V )(x) + γβ; (ii) γ-contraction: k(Tsp V1 ) − (Tsp V2 )k∞ ≤ γkV1 − V2 k∞ ; (iii) Monotonicity: (Tsp V1 )(x) ≤ (Tsp V2 )(x) for any value functions V1 , V2 : X → R such that V1 (x) ≤ V2 (x), ∀x ∈ X . The detailed proof of this proposition can be found in Lee et al. (2018). Using these results, the Banach fixed point theorem shows that there exists a unique solution for the following fixed point equation: V (x) = (Tsp V )(x), ∀x ∈ X , and this solution is equal to the optimal value function Vsp∗ (x). Analogous to the arguments in standard MDPs, in this case the optimal value function can also be computed using dynamic programming methods such as value iteration. Before proving the main results, notice that by using analogous arguments of the complementary-slackness property in KKT conditions, the second and the third consistency equation in (13) is equivalent to the following condition: X α r(x, a) + γ P (x0 |x, a)V (x0 ) + − αµ(a|x) − V (x) = Λ(x), ∀x ∈ X , ∀a ∈ Aµ (x), 2 x0 ∈X (16) X α r(x, a) + γ P (x0 |x, a)V (x0 ) + − αµ(a|x) − V (x) ≤ Λ(x), ∀x ∈ X , ∀a 6∈ Aµ (x), 2 0 x ∈X where Aµ (x) = {a ∈ A : µ(a|x) > 0} represents the set of actions that have non-zero probabilities w.r.t policy µ. Theorem 3. The pair of optimal value function and optimal policy (Vsp∗ , µ∗sp ) of the MDP problem in (3) satisfies the consistency equation in (13). Proof. Recall that the optimal state-action value function is given by X Q∗sp (x, a) = r(x, a) + γ P (x0 |x, a)Vsp∗ (x0 ). x0 ∈X According to Bellman’s optimality, the optimal value function satisfies the following equality:   X α Vsp∗ (x) = max µ(a|x) Q∗sp (x, a) + (1 − µ(a|x)) , µ∈∆x 2 (17) a∈A at any state x ∈ X , where µ∗sp is the corresponding maximizer. By the KKT condition, we have that Q∗sp (x, a) + α α (1 − µ∗sp (a|x)) + λ∗sp (a|x) = Λ∗sp (x) + µ∗sp (a|x), 2 2 for any x ∈ X and any a ∈ A, where Λ∗sp is the Lagrange multiplier that corresponds to equality constraint 1, and λ∗sp ≥ 0 is the Lagrange multiplier that corresponds to inequality constraint µ(a|x) ≥ 0 such that P a∈A µ(a|x) = λ∗sp (a|x) · µ∗sp (a|x) = 0, ∀x ∈ X , ∀a ∈ A. Recall from the definition of optimal state-action value function Q∗sp and the definition of the optimal policy µ∗sp , one has that Aµ∗sp (x) = S(Q∗sp (x, ·)). This condition further implies α (1 − 2µ∗sp (a|x)), ∀x ∈ X , a ∈ S(Q∗sp (x, ·)). 2 P Substituting the equality in (17) to this KKT condition, and noticing that 0 ≤ a∈A µ∗sp (a|x))2 ≤ 1, the KKT condition implies that α αX ∗ Λ∗sp (x) + ≥ Vsp∗ (x) = Λ∗sp (x) + µsp (a|x)µ∗sp (a|x) ≥ Λ∗sp (x), 2 2 Λ∗sp (x) = Q∗sp (x, a) + a∈A Path Consistency Learning in Tsallis Entropy Regularized MDPs which further implies that α ≤ Λ∗sp (x) − Vsp∗ (x) ≤ 0, ∀x ∈ X . 2 Therefore, by defining Λ(x) = Λ∗sp (x) − Vsp∗ (x), and λ(a|x) = λ∗sp (a|x), one immediately has that − α2 ≤ Λ(x) ≤ 0, ∀x ∈ X . Using this construction, one further has the following expression for any x ∈ X and any a ∈ S(Q∗sp (x, ·)): − Λ(x) = Q∗sp (x, a) + α − αµ∗sp (a|x) − Vsp∗ (x), 2 which proves consistency, based on the equivalence condition in (16). Theorem 4. The solution policy µ of the consistency equation in (13) is α/(1 − γ)-optimal w.r.t. the sparse MDP problem in (3). That is,   E ∞ X    α α γ t Rt + . 1 − µ(at |xt ) | x0 = x, µ, P  ≥ Vsp∗ (x) − 2 (1 − γ) t=0 (18) Proof. To proof the sub-optimality performance bound given in this theorem, we first study the expression of (Tsp V ), where Tsp is the Bellman operator of the Tsallis entropy-regularized MDP problem in (3). Let X Q̄(x, a) = r(x, a) + γ P (x0 |x, a)V (x0 ) x0 ∈X be the corresponding state-action value function. Using the definition from (3), one has the following expression:       X 1  (Tsp V )(x) = α · spmax  · r(x, a) + γ P (x0 |x, a)V (x0 )   α  0 x ∈X = α · spmax Q̄(x, ·) α a∈A ! . Furthermore, by exploiting the structure of the sparse-max formulation of an arbitrary value function, one also has the following chain of equalities/inequalities: !   X α Q̄(x, ·) α · spmax = max µ(a|x) · Q̄(x, a) + (1 − µ(a|x)) µ∈∆x α 2 a∈A   X α = µ(a|x) · Q̄(x, a) + (1 − µ(a|x)) 2 a∈A   X α αX = µ(a|x) Q̄(x) + − αµ(a|x) + µ(a|x)2 2 2 a∈A a∈A α ≤V (x) + . 2 The first equality follows from the fact that α · spmax(Q̄(x, ·)/α) is a closed form solution of the optimization problem X  max µ(a|x) Q̄(x, a) − αHµ (x, a) , µ∈∆x a∈A when Hµ is the Tsallis entropy. The second equality follows from the fact that if (V, µ) satisfies the consistency equation, then there exists a Lagrange multiplier Λ∗ (x) = Λ(x) + V (x), ∀x ∈ X such that the following KKT conditions hold: α − αµ(a|x) = Λ∗ (x), ∀x ∈ X , ∀a ∈ Aµ (x), 2 α Q̄(x, a) + − αµ(a|x) ≤ Λ∗ (x), ∀x ∈ X , ∀a 6∈ Aµ (x), 2 X µ(a|x) = 1, µ(a|x) ≥ 0, ∀x ∈ X , ∀a ∈ A, Q̄(x, a) + a Path Consistency Learning in Tsallis Entropy Regularized MDPs which further implies that µ is the maximizer of the inner optimization problem. The third equality follows from arithmetic manipulations, and the first inequality follows from the consistency equation in (16), i.e., for any x ∈ X and any a ∈ Aµ (x), there exists Λ(x) ∈ [− α2 , 0] such that: α α 0 ≥ Λ(x) = Q̄(x, a) + − αµ(a|x) − V (x) ⇐⇒ Q̄(x, a) + − αµ(a|x) ≤ V (x). 2 2 Therefore combining all these arguments, one concludes that the following Bellman inequality holds: α (Tsp V )(x) ≤ V (x) + , ∀x ∈ X . (19) 2 Now recall that the γ−contraction property (w.r.t. the ∞−norm) of the Bellman operator Tsp . By the Banach fixedpoint theorem, this property implies that there exists a unique fixed point solution Vsp∗ to equation V (x) = (Tsp V )(x), for all x ∈ X , and it is the limit point (over all x ∈ X ) of the converging iterative sequence limn→∞ (Tspn V0 )(x) for any initial value function V0 . Also recall that the translation property of this Bellman operator, i.e., for any constant K, (Tsp (V + K)) = (Tsp V ) + γK. Therefore, by repeatedly applying the Bellman operator to both sides of the inequality in (19), and by using the above properties of a Bellman operator, one can show that Vsp∗ (x) = lim (Tspn V )(x) ≤ n→∞ ∞ X −γ t · n=0 α 1 α + V (x) = − · + V (x), ∀x ∈ X . 2 2 1−γ (20) Furthermore, consider the consistency equation in (13), i.e., there exists a function Λ(x) ∈ [0, α2 ] such that for any x ∈ X and any a ∈ Aµ (x), α α − ≤ Λ(x) = Q̄(x, a) + − αµ(a|x) − V (x) ⇐⇒ V (x) ≤ Q̄(x, a) + α − αµ(a|x). 2 2 By multiplying µ(a|x) on both sides of this inequality and summing over a ∈ A, the above expression implies X  V (x) ≤ µ(a|x) Q̄(x, a) + α − αµ(a|x) a∈A    αX α 1 − µ(a|x) + ≤ µ(a|x) Q̄(x, a) + µ(a|x) 1 − µ(a|x) 2 2 a∈A a∈A   X X  α α 1 − µ(a|x)  + . = µ(a|x) r(x, a) + γ P (x0 |x, a)V (x0 ) + 2 2 0  X (21) x ∈X a∈A Therefore, equipped with the γ−contraction property of the following Bellmen operator:   X X  α (Tµ V )(x) = µ(a|x) r(x, a) + 1 − µ(a|x) + γ P (x0 |x, a)V (x0 ) 2 0 x ∈X a∈A and the Banach fixed-point theorem, for any initial value function V0 , one can deduce the following expression:     ∞ X  α 1 − µ(at |xt ) | µ, x0 = x . lim Tµ [V0 ]n (x) = E  γ t r(xt , at ) + n→∞ 2 t=0 Using the translation property of the Bellman operator (Tµ V ) and repeatedly applying this Bellman operator to both sides of (21), one obtains the following inequality for any x ∈ X : V (x) ≤ lim (Tµ V )n (x) + n→∞ ∞ X α t γ 2 n=0     ∞ X  α α 1 =E  γ t r(xt , at ) + 1 − µ(at |xt ) | µ, x0 = x + · . 2 2 1 − γ t=0 Therefore, by combining the results in (20) and in (22), one completes the proof of this theorem. (22) Path Consistency Learning in Tsallis Entropy Regularized MDPs Algorithm 1 Sparse Path Consistency Learning Input: Environment EN V , learning rate η, discount factor γ, regularization α, rollout d, number of steps N , replay buffer capacity B, prioritized replay hyper-parameter α. Parameterizations of Λ and λ follow from the descriptions in Section 6. function Gradients(x0:T , R0:T −1 , a0:T −1 ) Pd−1 Compute C(t) = −V̄φ (xt ) + γ d V̄φ (xt+d ) + j=0 γ j (Rj + α/2 − αµ̄θ (aj |xj ) + λθ (aj |xj ) − Λρ (xj )) for t < T , padding with zeros PTas−1necessary. Compute ∆θ = t=0 C(t)∇θ C(t). PT −1 Compute ∆φ = t=0 C(t)∇φ C(t). PT −1 Compute ∆ρ = t=0 C(t)∇ρ C(t). Return ∆θ, ∆φ, ∆ρ end function Initialize θ, φ, ρ. Initialize empty replay buffer RB(α). for i = 0 to N − 1 do Sample x0:T , a0:T −1 ∼ µ̄θ on EN V , yielding reward R0:T −1 . ∆θ, ∆φ, ∆ρ = Gradients(x0:T , a0:T −1 , R0:T −1 ). Update θ ← θ − η∆θ. Update φ ← φ − η∆φ. Update ρ ← ρ − η∆ρ. PT −d Input x0:T , a0:T −1 into RB with priority j=0 Rj . If |RB| > B, remove episodes uniformly at random. Sample s0:T from RB. ∆θ, ∆φ, ∆ρ = Gradients(x0:T , a0:T −1 , R0:T −1 ). Update θ ← θ − η∆θ. Update φ ← φ − η∆φ. Update ρ ← ρ − η∆ρ. end for B. Experimental Details For the algorithmic tasks, we follow a similar experimental setup as described in Nachum et al. (2017). We parameterize all values by a single LSTM recurrent neural network with internal dimension 128 and multiple heads (one for each desired quantity). At each training step, we sample a batch of 400 episodes using the current policy acting on the environment. We perform a gradient step based on this batch. We then add the experience to the replay buffer and perform a gradient step based on an off-policy batch sampled from the replay buffer. We fix the rollout to d = 10. As in Nachum et al. (2017), our replay buffer is prioritized by episode rewards: the probability of sampling an episode from the replay buffer is 0.1 + 0.9 · exp{αR}/Z where R is the total reward of the episode, Z is a normalizing factor, and we use α = 0.5. We use a replay buffer of capacity B = 10, 000 episodes. In our experiments we use a learning rate of η = 0.005 and discount γ = 0.9. For HalfCheetah we parameterized the policy and value networks as feed forward networks with two hidden layers of dimension 64 and tanh non-linearities. At each training step we sampled 100 steps from the environment and input these into a replay buffer. We then sample a batch of 25 sub-episodes of 100 steps from the replay buffer, prioritized by exponentiated recency (with weight 0.01) and perform a single training step. We use rollout d = 10, discount γ = 0.99, and performed a hyperparameter search over learning rate η ∈ {0.0005, 0.0001}. In standard Soft PCL, the policy µ̄θ is determined by logits output by the neural network. That is,   µ̄θ (−|x) = softmax NN(x, θ)0:|A|−1 , (23) where NN(x, θ)0:|A|−1 are |A| output values of the neural network. For Sparse PCL, to induce sparsity, we parameterize the policy using the G function:   µ̄θ (−|x) = relu NN(x, θ)0:|A|−1 − G(NN(x, θ)0:|A|−1 ) . (24) Path Consistency Learning in Tsallis Entropy Regularized MDPs Accordingly, λθ is parameterized as   λθ (−|x) = relu G(NN(x, θ)0:|A|−1 − NN(x, θ)0:|A|−1 ) exp{NN(x, θ)|A| }. (25) B.1. Experimental Results for ReversedAddition ReversedAddition |A| = 40 |A| = 64 30 30 25 25 20 20 15 15 10 10 5 5 0 0 0 20000 40000 60000 80000 100000 |A| = 96 15 10 5 0 0 20000 40000 60000 80000 100000 Soft PCL 0 20000 40000 60000 80000 100000 Sparse PCL Figure 3. The average reward over training for sparse PCL compared to the standard soft PCL on ReversedAddition. In this task, the environment is a 2 × n grid of digits representing two numbers in base-|V| that the agent needs to sum. As in the other tasks in the main paper, we see that sparse PCL becomes more advantageous compared to soft PCL as the action space increases in size.
2cs.AI
The Right Mutation Strength for Multi-Valued Decision Variables Benjamin Doerr1 , Carola Doerr2 , Timo Kötzing3 1 Laboratoire d’Informatique (LIX), École Polytechnique, Paris-Saclay, France CNRS and LIP6, Sorbonne Universités, UPMC Univ Paris 06, Paris, France 3 Hasso-Plattner-Institut, Potsdam, Germany arXiv:1604.03277v1 [cs.NE] 12 Apr 2016 2 Abstract The most common representation in evolutionary computation are bit strings. This is ideal to model binary decision variables, but less useful for variables taking more values. With very little theoretical work existing on how to use evolutionary algorithms for such optimization problems, we study the run time of simple evolutionary algorithms on some OneMax-like functions defined over Ω = {0, 1, . . . , r − 1}n . More precisely, we regard a variety of problem classes requesting the component-wise minimization of the distance to an unknown target vector z ∈ Ω. For such problems we see a crucial difference in how we extend the standard-bit mutation operator to these multi-valued domains. While it is natural to select each position of the solution vector to be changed independently with probability 1/n, there are various ways to then change such a position. If we change each selected position to a random value different from the original one, we obtain an expected run time of Θ(nr log n). If we change each selected position by either +1 or −1 (random choice), the optimization time reduces to Θ(nr + n log n). If we use a random mutation strength i ∈ {0, 1, . . . , r − 1}n with probability inversely proportional to i and change the selected position by either +i or −i (random choice), then the optimization time becomes Θ(n log(r)(log(n) + log(r))), bringing down the dependence on r from linear to polylogarithmic. One of our results depends on a new variant of the lower bounding multiplicative drift theorem. 1 Introduction In evolutionary computation, taking ideas both from computer science and biology, often search and optimization problems are modeled in a way that the solution candidates are fixed-length strings over the alphabet consisting of 0 and 1. In other words, the search space Ω is chosen to be {0, 1}n for some positive integer n. Such a representation of solution candidates is very suitable to model binary decision variables. For example, when searching for graph substructures like large cliques, (degree-constrained) spanning trees, or certain matchings, we can use binary decision variables describing whether a vertex or an edge is part of the solution or not. For these reasons, the bit string representation is the most prominent one in evolutionary computation. When a problem intrinsically consists of other types of decision variables, the algorithm designer has the choice to either work with a different representation (e.g., permutations in the traveling salesman problem) or to re-model the problem using a bit string representation. For an example for the latter, see, e.g., [DJ07], where the Eulerian cycle problem (asking for a permutation of the edges) was re-modeled as a matching problem. In general, such a remodeling may not lead to an efficient or a natural approach, and it may be better to work with 1 a representation different from bit strings. The traveling salesman problem is an example for such a situation. While in this work we shall not deal with the difficulties of treating permutation search spaces in evolutionary computation, we shall try to extend our good understanding of the bit string representation to representations in which the decision variables can take more values than just zero and one. Consequently, we shall work with search spaces Ω = {0, . . . , r − 1}n . Such search spaces are a natural representation when each decision variable can take one out of r values. Examples from the evolutionary computation literature include scheduling n jobs on r machines, which naturally leads to the search space {0, . . . , r − 1}n , see Gunia [Gun05]. However, also rooted trees lead to this type of representation: Since each vertex different from the root has a unique predecessor in the tree, a rooted tree on n vertices can be represented via an element of {0, . . . , n − 1}n−1 . This was exploited in [STW04] to design evolutionary algorithms for shortest-path problems. An alternative representation would be to code each value in log r bits, leading to a search space of {0, 1}n log r . However, this representation has the weakness that search points with similar fitness can be vastly different (the bit representations 10 . . . 0 and 01 . . . 1 code almost the same value, but are complementary); this trap-like behavior can lead to a very poor performance on some OneMax functions (see Section 1.2 for a formal defintion). 1.1 Mutation Operators for Multi-Valued Search Spaces A first question, and our main focus in this work, is what mutation operators to use in such multi-valued search spaces. When there is no particular topology in the components i ∈ [1..n] := {1, . . . , n}, that is, in the factors [0..r − 1], then the natural analogue of the standard-bit mutation operator is to select each component i ∈ [1..n] independently and mutate the selected components by changing the current value to a random other value in [0..r − 1]. This operator was used in [STW04, Gun05] as well as in the theoretical works [DJS11, DP12]. When the decision values 0, 1, . . . , r − 1 carry more meaning than just denoting alternatives without particular topology, then one may want to respect this in the mutation operator. We shall not discuss the most general set-up of a general distance matrix defined on the values 0, 1, . . . , r − 1, but assume that they represent linearly ordered alternatives. Given such a linear topology, several other mutation operators suggest itself. We shall always imitate the principle of standard-bit mutation that each component i ∈ [1..n] is changed independently with probability 1/n, so the only point of discussion is how such an elementary change looks like. The principle that mutation is a minimalistic change of the individual suggests to alter a selected component randomly by +1 or −1 (for a precise definition, including also a description of how to treat the boundary cases, see again Section 2). We say that this mutation operator has a mutation strength equal to one. Naturally, a mutation strength of one carries the risk of being slow—it takes r − 1 such elementary mutations to move one component from one boundary value, say 0, to the other, say r − 1. In this language, the previously discussed mutation operator changing a selected component to a new value chosen uniformly at random can (roughly) be described as having a mutation strength chosen uniformly at random from [1..r − 1]. While this operator does not have the disadvantage of moving slowly through the search space, it does have the weakness that reaching a particular target is slow, even when already close to it. Based on these (intuitive, but we shall make them precise later) observations, we propose an elementary mutation that takes a biased random choice of the mutation strength. We give more weight to small steps than the uniform operator, but do allow larger jumps with certain probability. More precisely, in each elementary mutation independently we choose the mutation 2 strength randomly such that a jump of +j or −j occurs with probability inversely proportional to j (and hence with probability Θ((j log r)−1 )). This distribution was used in [DRWW10] and is called harmonic distribution, aiming at overcoming the two individual weaknesses of the two operators discussed before and, as we shall see, this does indeed work. 1.2 Run time Analysis of Multi-Valued OneMax Functions To gain a more rigorous understanding of the working principles of the different mutations strengths, we conduct a mathematical run time analysis for simple evolutionary algorithms on multi-valued analogues of the OneMax test function. Comparable approaches have been very successful in the past in studying in isolation particular aspects of evolutionary computation, see, e.g., [Jan13]. Also, many observations first made in such simplistic settings have later been confirmed for more complicated algorithms (see, e.g., [AD11]) or combinatorial optimization problems (see, e.g., [NW10]). n On bit strings, Pnthe classic OneMax test function is defined by Om : {0, 1} → R; (x1 , . . . , xn ) 7→ i=1 xi . Due to the obvious symmetry, for most evolutionary algorithms it makes no difference whether the target is to maximize or to minimize this function. For several reasons, among them the use of drift analysis, in this work it will be more convenient to always assume that our target is the minimization of the given objective function. The P obvious multi-valued analogue of this OneMax function is Om : {0, 1, . . . , r − 1}n → R; x 7→ ni=1 xi , however, a number of other functions can also be seen as multi-valued analogues. For example, we note that in the bit string setting we have Om(x) = H(x, (0, . . . , 0)), where H(x, y) := |{i ∈ [1..n] | xi 6= yi }| denotes the Hamming distance between two bit strings x and y. Defining fz : {0, 1}n → R; x 7→ H(x, z) for all z ∈ {0, 1}n , we obtain a set of 2n objective functions that all have an isomorphic fitness landscape. Taking this route to define multi-valued analogue of OneMax functions, we obtain the class of functions P fz : {0, 1, . . . , r − 1}n 7→ R; x 7→ ni=1 |xi − zi | for all z ∈ {0, 1, . . . , r − 1}n , again with f(0,...,0) being the OneMax function defined earlier. Note that these objective functions do not all have an isomorphic fitness landscape. The asymmetry with respect to the optimum z can be overcome by replacing the classic distance |xi − zi | in the reals by the distance modulo r (ring distance), that is, min{xi − (zi − r), |xi − zi |, (zi + r) − xi }, creating yet another non-isomorphic fitness landscape. All results we show in the following hold for all these objective functions. As evolutionary algorithm to optimize these test functions, we study the (1+1) evolutionary algorithm (EA). This is arguably the most simple evolutionary algorithm, however, many results that could first only be shown for the (1 + 1) EA could later be extended to more complicated algorithms, making it an ideal instrument for a first study of a new subject. Naturally, to study mutation operators we prefer mutation-based EAs. For the different ways of setting the mutation strength, we conduct a mathematical run time analysis, that is, we prove bounds on the expected number of iterations the evolutionary algorithm needs to find the optimal solution. This optimization time today is one of the most accepted performance measures for evolutionary algorithms. 1.3 Previous Works and Our Results In particular for the situation that r is large, one might be tempted to think that results from continuous optimization can be helpful. So far, we were not successful in this direction. A main difficulty is that in continuous optimization, usually the asymptotic rate of convergence is regarded. Hence, when operating with a fixed r in our setting and re-scaling things into, say, {0, 1r , 2r , . . . , 1}n , then these results, due to their asymptotic nature, could become less meaningful. For this reason, the only work in the continuous domain that we found slightly resembling 3 ours is by Jägersküpper (see [Jäg08] and the references therein), which regards continuous optimization with an a-priori fixed target precision. However, the fact that Jägersküpper regards approximations with respect to the Euclidean norm (in other words, minimization of the sphere function) makes his results hard to compare to ours, which can be seen as minimization of the 1-norm. Coming back to the discrete domain, as said above, the vast majority of theoretical works on evolutionary computation work with a bit string representation. A notable exception is the work on finding shortest path trees (e.g., [STW04]); however, in this setting we have that the dimension and the number r of values are not independent: one naturally has r equal to the dimension, because each of the n − 1 non-root vertices has to choose one of the n − 1 other vertices as predecessor. Therefore, we see only three previous works that are comparable to ours. The first two regard the optimization of linear functions via the (1 + 1) EA using mutation with uniform strength, that is, resetting a component to a random other value. The main result of [DJS11] is that the known run time bound of O(n log n) on linear functions defined on bit strings remains valid for the search space {0, 1, 2}n . This was extended and made more precise in [DP12], where for r-valued linear functions an upper bound of (1 + o(1))e(r − 1)n ln(n) + O(r 3 n log log n) was shown together with a (1 + o(1))n(r − 1) ln(n) lower bound. A third paper considers dynamically changing fitness functions [KLW15]. They also consider OneMax functions with distance modulo r, using ±1 mutation strength. In this setting the fitness function changed over time and the task was to track it as closely as possible, which the ±1 mutation strength can successfully do. Note that a seemingly similar work on the optimization of a dynamic variant of the maze function over larger alphabets [LW14] is less comparable to our work since there all non-optimal values of a decision variable contribute the same to the fitness function. Compared to these works, we only regard the easier static OneMax problem (note though that there are several ways to define multi-valued OneMax functions), but obtain tighter results also for larger values of r and for three different mutation strengths. For the uniform mutation strength, we show a tight and precise (1 + o(1))e(r − 1)n ln(n) run time estimate for all values of r (Section 4). For the cautious ±1 mutation strength, the run time becomes Θ(n(r + log n)), that is, still (mostly) linear in r (Section 5). The harmonic mutation strength overcomes this slowness and gives a run time of Θ(n log(r)(log(r) + log(n))), which for most values of r is significantly better than the previous bound (Section 6). All analyses rely on drift methods, for the lower bound for the case of uniform mutation strength we prove a variant of the multiplicative drift lower bound theorem [Wit13] that does not need the restriction that the process cannot go back to inferior search points (see Section 4.2.2). 2 Algorithms and Problems In this section we define the algorithms and problems considered in this paper. We let [r] := {0, 1, . . . , r − 1} and [1..r] := {1, 2, . . . , r}. For a given search space Ω, a fitness function is a function f : Ω → R. While a frequently analyzed search space is Ω = {0, 1}n , we will consider in this paper Ω = [r]n . We define the following two metrics on [r], called interval-metric and ring-metric, respectively. The intuition is that the interval metric is the usual metric induced by the metric on the natural numbers, while the ring metric connects the two endpoints of the interval (and, thus, 4 forms a ring). Formally we have, for all a, b ∈ [r], dint (a, b) = |b − a|; dring (a, b) = min{|b − a|, |b − a + r|, |b − a − r|}. We consider different step operators v : [r] → [r] (possibly randomized). These step operators will later decide the update of a mutation in a given component. Thus we call, for any given x ∈ [r], d(x, v(x)) the mutation strength. We consider the following step operators. • The uniform step operator chooses a different element from [r] uniformly at random; thus we speak of a uniform mutation strength. • The ±1 operator chooses to either add or subtract 1, each with probability 1/2; this operator has a mutation strength of 1. • The Harmonic operator makes a jump of size j ∈ [r] with probability proportional to 1/j, choosing the direction uniformly at random; we call its mutation strength harmonic mutation strength. Note that, in the case of the ring-metric, all steps are implicitly considered with wrap-around. For the interval-metric, we consider all steps that overstep a boundary of the interval as invalid and discard this mutation as infeasible. Note that this somewhat arbitrary choice does not impact the results in this paper. We consider the algorithms RLS and (1 + 1) EA as given by Algorithms 1 and 2. Both algorithms sample an initial search point from [r]n uniformly at random. They then proceed in rounds, each of which consists of a mutation and a selection step. Throughout the whole optimization process the algorithms maintain a population size of one, and the individual in this population is always the most recently sampled best-so-far solution. The two algorithms differ only in the mutation operation. While the RLS makes a step in exactly one position (chosen uniformly at random), the (1 + 1) EA makes, in each position, a step with probability 1/n. The fitness of the resulting search point y is evaluated and in the selection step the parent x is replaced by its offspring y if and only if the fitness of y is at least as good as the one of x. Since we consider minimization problems here, this is the case if f (y) ≤ f (x). Since we are interested in expected run times, i.e., the expected number of rounds it takes until the algorithm evaluates for the first time a solution of minimal fitness, we do not specify a termination criterion. For the case of r = 2, the two algorithms are exactly the classic Algorithms RLS and (1 + 1) EA, for all three given step operators (which then degenerate to the flip operator, which flips the given bit). Note that the algorithms with the considered topologies are unbiased in the general sense of [RV11] (introduced for {0, 1}n by Lehre and Witt [LW12] and made specific for several combinatorial search spaces in [DKLW13]). Let d be either the interval- or the ring-metric and let z ∈ [r]n . We can define a straightforward generalization of the OneMax fitness function as n X d(xi , zi ). i=1 Whenever we refer to an r-valued OneMax function, we mean any such function. We refer to d as the metric of the OneMax function and to z as the target of the OneMax function. 5 Algorithm 1: RLS minimizing a function f : [r]n → R with a given step operator v. 1 2 3 4 5 6 7 Initialization: Sample x ∈ [r]n uniformly at random and query f (x); Optimization: for t = 1, 2, 3, . . . do Choose i ≤ n uniformly at random; for j = 1, . . . , n do if j = i then yj ← v(xj ) else yj ← xj Evaluate f (y); if f (y) ≤ f (x) then x ← y Algorithm 2: The (1 + 1) EA minimizing a function f : [r]n → R with a given step operator v. 1 Initialization: Sample x ∈ [r]n uniformly at random and query f (x); 2 Optimization: for t = 1, 2, 3, . . . do 3 for i = 1, . . . , n do 4 With probability 1/n set yi ← v(xi ) and set yi ← xi otherwise; 5 6 3 Evaluate f (y); if f (y) ≤ f (x) then x ← y Drift Analysis A central tool in many of our proofs is drift analysis, which comprises a number of tools to derive bounds on hitting times from bounds on the expected progress a process makes towards the target. Drift analysis was first used in evolutionary computation by He and Yao [HY01] and is now, after a large number of subsequent works, probably the most powerful tool in run time analysis. We briefly collect here the tools that we use. We phrase the following results in the language that we have some random process, either in the real numbers or in some other set Ω, but then equipped with a potential function g : Ω → R. We are mostly interested in the time the process (or its potential) needs to reach 0. Multiplicative drift is the situation that the progress is proportional to the distance from the target. This quite common situation in run time analysis was first framed into a drift theorem, namely the following one, in [DJW12]. A more direct proof of this results, that also gives large deviation bounds, was later given in [DG13]. Theorem 1 (from [DJW12]). Let X (0) , X (1) , . . . be a random process taking values in S := {0} ∪ [smin , ∞) ⊆ R. Assume that X (0) = s0 with probability one. Assume that there is a δ > 0 such that for all t ≥ 0 and all s ∈ S with Pr[X (t) = s] > 0 we have E[X (t+1) |X (t) = s] ≤ (1 − δ)s. Then T := min{t ≥ 0 | X (t) = 0} satisfies E[T ] ≤ ln(s0 /smin ) + 1 . δ It is easy to see that the upper bound above cannot immediately be matched with a lower bound of similar order of magnitude. Hence it is no surprise that the only lower bound result for multiplicative drift, the following theorem by Witt [Wit13], needs two additional assumptions, namely that the process does not move away from the target and that it does not too often 6 make large jumps towards the target. We shall see later (Theorem 7) that the first restriction can be removed under not too strong additional assumptions. Theorem 2 (from [Wit13]). Let X (t) , t = 0, 1, . . . be random variables taking values in some finite set S of positive numbers with min(S) = 1. Let X (0) = s0 with probability one. Assume that for all t ≥ 0, Pr[X (t+1) ≤ X (t) ] = 1. Let saim ≥ 1. Let 0 < β, δ ≤ 1 be such that for all s > saim and all t ≥ 0 with Pr[X (t) = s] > 0, we have E[X (t) − X (t+1) | X (t) = s] ≤ δs, Pr[X (t) − X (t+1) ≥ βs | X (t) = s] ≤ βδ . ln(s) Then T := min{t ≥ 0 | X (t) ≤ saim } satisfies E[T ] ≥ ln(s0 ) − ln(saim ) 1 − β . δ 1+β In situations in which the progress is not proportional to the distance, but only monotonically increasing with it, the following variable drift theorem of Johannsen [Joh10] can lead to very good results. Another version of a variable drift theorem can be found in [MRC09, Lemma 8.2]. Theorem 3 (from [Joh10]). Let X (t) , t = 0, 1, . . . be random variables taking values in some finite set S of non-negative numbers. Assume 0 ∈ S and let xmin := min(S \ {0}). Let X (0) = s0 with probability one. Let T := min{t ≥ 0 | X (t) = 0}. Suppose that there exists a continuous and monotonically increasing function h : [xmin , s0 ] → R>0 such that E[X (t) −X (t+1) |X (t) ] ≥ h(X (t) ) holds for all t < T . Then Z s0 1 xmin + dx. E[T ] ≤ h(xmin ) xmin h(x) 4 Mutation Strength Chosen Uniformly at Random In this section, we analyze the mutation operator with uniform mutation strength, that is, if the mutation operator chooses to change a position, it resets the current value to a different value chosen independently (for each position) and uniformly at random. We shall prove the same results, tight apart from lower order terms, for all r-valued OneMax functions defined in Section 2. Let f be one such objective function and let z be its target. When regarding a single component xi of the solution vector, it seems that replacing a nonoptimal xi by some yi that is closer to the target, but still different from it, gains us some fitness, but does not lead to a structural advantage (because we still need an elementary mutation that resets this value exactly to the target value zi ). This intuitive feeling is correct for RLS and not correct for the (1 + 1) EA. 4.1 RLS with Uniform Mutation Strength For RLS, we turn the above intuition into the potential function g : [r]n → R; x 7→ H(x, z) = |{i ∈ [1..n] | xi 6= zi }|, the Hamming distance, which counts the number of non-optimal positions in the current solution x. We get both an upper and a lower bound on the drift in this potential which allow us to apply multiplicative drift theorems. From that we get the following result. 7 Theorem 4. Let f be any r-valued OneMax function with target z ∈ [r]n . Then randomized local search (RLS) with uniform mutation strength has an optimization time T satisfying E[T ] = n(r − 1)(ln(n) + Θ(1)). If x0 denotes the random initial individual, then for all x ∈ [r]n we have E[T |x0 = x] = n(r − 1)HH(x,z) , where, for any positive integer k, we let Hk := Pk j=1 1/j denote the k-th Harmonic number. Proof. Consider one iteration of RLS started with a current solution x 6= z. Let y be the current solution after one iteration, that is, the value of x after mutation and selection. We observe that g(y) = g(x) − 1 if and only if the mutation operator selects a non-optimal position i of x (this happens with probability g(x)/n) and then replaces xi by zi (this happens with probability 1/(r − 1)). In all other cases, we have g(y) = g(x), though not necessarily y = x. Consequently, the expected progress with respect to g in this iteration is g(x) − E[g(y)] = g(x) . n(r − 1) (1) Let us denote by Tx0 the run time of RLS conditional on the initial search point being x0 . Then the multiplicative drift theorem (Theorem 1) gives an upper bound of E[Tx0 ] ≤ n(r − 1)(ln(g(x0 )) + 1). Similarly, the assumptions of the multiplicative drift theorem for lower bounds (Theorem 2) are satisfied with saim = ln n and β = 1/ ln n. Consequently, assuming g(x0 ) = exp(ω(ln ln n)) in the second estimate, we obtain E[Tx0 ] ≥ n(r − 1)(ln(g(x0 )) − ln ln n)(1 − 2/ ln(n)) = n(r − 1) ln(g(x0 ))(1 − o(1)). In the above analysis we used multiplicative drift with the Hamming distance because this in a generic manner gave a very strong result. We also used a drift approach to ease the comparison with the other results we will obtain, also via drift analysis. For this particular problem, also a very problem-specific approach can be used, which gives an even sharper result. Consider a run of RLS starting with a search point x0 . For i ∈ [0..g(x0 )], let Ti denote the first iteration for after which g(x) ≤ i, where Tg(x0 ) = 0. Then equation (1) shows that E[Ti−1 − Ti ] = n(r−1) i all i ∈ [1..g(x0 )]. Consequently,   g(x X0 ) (Ti−1 − Ti ) E[Tx0 ] = E i=1 g(x0 ) = X i=1 E[Ti−1 − Ti ] g(x0 ) = n(r − 1) X 1 i i=1 = n(r − 1)Hg(x0 ) , 8 P where for all k ∈ N, Hk := ki=1 (1/i) is the kth Harmonic number. The harmonic number is well understood, e.g., we have Hk = ln(k) + γ + O(1/k) with γ = 0.5772... being the EulerMascheroni constant and we have the non-asymptotic bounds ln(k) ≤ Hk ≤ ln(k) + 1, which gives n(r − 1) ln(g(x0 )) ≤ E[Tx0 ] ≤ n(r − 1)(ln(g(x0 )) + 1). By the law of total probability, the expected run time of RLS (with the usual random initialization) is E[T ] = n(r − 1)E[Hg(x0 ) ]. The expected potential of the random initial search we see point is E[g(x0 )] = n(1 − 1/r). p √ By a Chernoff bound (e.g., Theorem 1.11 in [Doe11]), that Pr[|g(x0 ) − E[g(x0 )]| ≥ n ln n] ≤ 2n−2 . Hence E[Hg(x0 ) ] = HE[g(x0 )] ± Θ( ln(n)/n) ± Θ(ln(n)/n2 ). The first error term could be further reduced by arguments as used in [DD14], where for the case r = 2 a run time bound of E[T ] = nHn/2 − 1/2 ± o(1) was shown. We do not detail this idea any further and are content with summarizing the above in the following result, which in particular shows that the Hamming distance very precisely describes the quality of a search point. 4.2 The (1+1) EA with Uniform Mutation Strength We now consider the same run time analysis problem for the (1 + 1) EA, that is, instead of selecting a single random entry of the solution vector and applying an elementary mutation to it, we select each entry independently with probability 1/n and mutate all selected entries. Our main result is the following. Theorem 5. For any r-valued OneMax function, the (1 + 1) EA with uniform mutation strength has an expected optimization time of E[T ] = e(r − 1)n ln(n) + o(nr log n). As we will see, since several entries can be changed in one mutation step, the optimization process now significantly differs from the RLS process. This has two important consequences. First, while for the RLS process the Hamming distance of the current search point precisely determined the expected remaining optimization time, this is not true anymore for the (1 + 1) EA. This can be seen (with some mild calculations which we omit here) from the search points P x = (r, 0, . . . , 0) and y = (1, 0, . . . , 0) and the fitness function f defined by f (x) = ni=1 x0 . The second, worse, consequence is that the Hamming distance does not lead to a positive drift from each search point. Consider again x = (r, 0, . . . , 0) and f as above. Denote by x′ the search point after one mutation-selection cycle started with x. Let g be the Hamming distance to the optimum x∗ = (0, . . . , 0) of f . Then for r ≥ 5, the drift from the search point r−4 < 0. Indeed, we have g(x′ ) = 0, that is, x satisfies E[g(x) − g(x′ )] ≤ −(1 ± o(1)) 2e(r−1)n 1 g(x) − g(x′ ) = 1, with probability (1 − 1/n)n−1 (1/n)(1/(r − 1)) = (1 ± o(1)) e(r−1)n . This is the only event that gives a positive drift. On the other hand, with probability at least r−2 (1 − 1/n)n−2 (n − 1)(1/n2 )(1 + 2 + · · · + (r − 2))/(r − 1)2 = (1 ± o(1)) 2e(r−1)n , the mutation operator touches exactly the first and one other entry of x and does so in a way that the first entry does not become zero and the second entry remains small enough for x′ to be accepted. This event leads to a drift of −1, showing the claim. For these reasons, we resort to the actual fitness as potential function in our upper bound proof. It is clear that the fitness also is not a perfect measure for the remaining optimization time (compare, e.g., the search points (2, 0, . . . , 0) and (1, 1, 0, . . . , 0)), but naturally we have a positive drift from each non-optimal search point, which we shall exploit via the variable drift theorem. For the lower bound, a worsening of the Hamming distance in the optimization process is less of a problem, since we only need an upper bound for the drift. Hence for the 9 lower bound, we can use multiplicative drift with g again. However, since the process may move backwards occasionally, we cannot apply Witt’s lower bound drift theorem (Theorem 2), but have to prove a variant of it that does not require that the process only moves forward. This lower bound theorem for multiplicative drift might be of interest beyond this work. 4.2.1 An Upper Bound for the Run Time Theorem 6. For any r-valued OneMax function f , the (1 + 1) EA with uniform mutation strength has an expected optimization time of E[T ] ≤ e(r − 1)n ln(n) + (2 + ln(2))e(r − 1)n = e(r − 1)n ln(n) + O(rn). Pn Proof. Let z be the optimum of f . Then f can be written as f (x) = i=1 d(xi , zi ), where d is one of the distance measures on [r] that were described in Section 2. Let x be a fixed search point and y be the result of applying one mutation and selection step to x. We use the short-hand di := d(xi , zi ). We first show that n X 1 di (di + 1). ∆ := f (x) − E[f (y)] ≥ 2e(r − 1)n (2) i=1 Indeed, f (x)−f (y) is always non-negative. Consequently, it suffices to point out events that lead to the claimed drift. With probability (1 − (1/n))n−1 ≥ (1/e), the mutation operator changes exactly one position of x. This position then is uniformly distributed in [1..n]. Conditional Pi i (di +1) , where the first inequality δ/(r − 1) = d2(r−1) on this position being i, we have ∆ ≥ dδ=1 uses the fact that all our fitness functions are of the type that if there is a value xi ∈ [r] with d(xi , zi ) = k, then for each j ∈ [0..k −1] there is at least one value yi ∈ [r] such that d(yi , zi ) = j. This shows (2). For any d ≥ 1, we have d(d + 1) ≥ 2d and d(d + 1) ≥ d2 . Also, the mapping 1 1 2 and ∆ ≥ d 7→ d2 is convex. Consequently, we have ∆ ≥ 2e(r−1)n 2 f (x) e(r−1)n f (x), that is, 1 1 2 ∆ ≥ max{ 2e(r−1)n 2 f (x) , e(r−1)n f (x)}. To this drift expression, we apply Johannsen’s [Joh10] variable drift theorem (Theorem 3). Let S = [0..(r − 1)n]. Let h : R>0 → R>0 be defined by 1 1 2 h(s) = 2e(r−1)n 2 s for s ≥ 2n and h(s) = e(r−1)n s for s < 2n. Then h is a continuous increasing function satisfying ∆ ≥ h(f (x)). Consider the process X0 , X1 , . . . with Xt describing the fitness after the tth iteration. Given that we start with a fitness of X0 , Johannsen’s drift theorem gives Z X0 1 1 E[T ] ≤ + ds h(1) h(s) 1 Z X0 Z 2n n2 n 2e(r − 1) 2 ds + = e(r − 1)n + e(r − 1) ds s s 2n  1  1 1 − + e(r−1)n ln(2n) ≤ e(r−1)n + 2e(r−1)n2 2n X0 ≤ e(r − 1)n ln(n) + (1 + 1 + ln(2))e(r − 1)n. We may remark that the drift estimate above is pessimistic in that it applies to all r-valued OneMax functions. For an r-valued OneMax function using the ring metric or one having the optimum close to (r/2, . . . , r/2), we typically have two different bit values in each positive distance from zi . In this case, the drift stemming from exactly position i being selected for P i −1 d2i , that is, nearly twice the value we 2δ/(r − 1) = r−1 mutation is ∆ ≥ di /(r − 1) + dδ=1 10 computed above. The fact that in the following subsection we prove a lower bound matching the above upper bound for all r-valued OneMax functions shows that this, almost twice as high, drift has an insignificant influence on the run time. 4.2.2 A Lower Bound for the Run Time In this section, we write (q)+ := max{q, 0} for any q ∈ R. We aim at proving a lower bound, again via drift analysis, that is, via transforming an upper bound on the expected progress (with respect to a suitable potential function) into a lower bound on the expected run time. Since we only need an upper bound on the progress, we can again (as in the RLS analysis) work with the Hamming distance g(x) = H(x, z) to the optimum z as potential and, in the upper estimate of the drift, ignore the fact that this potential may increase. The advantage of working with the Hamming distance is that the drift computation is easy and we observe multiplicative drift, which is usually convenient to work with. We have to overcome one difficulty, though, and this is that the only known lower bound theorem for multiplicative drift (Theorem 2) requires that the process does not move away from the target, in other words, that the g-value is non-increasing with probability one. As discussed above, we do not have this property when using the Hamming distance as potential in a run of the (1 + 1) EA. We solve this problem by deriving from Theorem 2 a drift theorem (Theorem 7 below) that gives lower bounds also for processes that may move away from the optimum. Compared to Theorem 2, we need the stronger assumptions (i) that we have a Markov process and (ii) that we have bounds not only for the drift g(X (t) ) − g(X (t+1) ) or the positive part (g(X (t) ) − g(X (t+1) ))+ of it, but also for the positive progress (s − g (t+1) )+ with respect to any reference point s ≤ g(X (t) ). This latter condition is very natural. In simple words, it just means that we cannot profit from going back to a worse (in terms of the potential) state of the Markov chain. A second advantage of these stronger conditions (besides allowing the analysis of nondecreasing processes) is that we can easily ignore an initial segment of the process (see Corollary 8). This is helpful when we encounter a larger drift in the early stages of the process. This phenomenon is often observed, e.g., in Lemma 6.7 of [Wit13]. Previous works, e.g., [Wit13], solved the problem of a larger drift in the early stage of the process by manually cutting off this phase. This requires again a decreasing process (or conditioning on not returning to the region that has been cut off) and an extra argument of the type that the process with high probability reaches a search point with potential in [s̃0 , 2s̃0 ] for a suitable s̃0 . So it is safe to say that Corollary 8 is a convenient way to overcome these difficulties. We start by proving our new drift results, then compute that the Hamming distance to the optimum satisfies the assumptions of our drift results, and finally state and prove the precise lower bound. Theorem 7. (multiplicative drift, lower bound, non-decreasing process) Let X (t) , t = 0, 1, . . . be a Markov process taking values in some set Ω. Let S ⊂ R be a finite set of positive numbers with min(S) = 1. Let g : Ω → S. Let g(X (0) ) = s0 with probability one. Let saim ≥ 1. Let T := min{t ≥ 0 | g(X (t) ) ≤ saim } be the random variable describing the first point in time for which g(X (t) ) ≤ saim . Let 0 < β, δ ≤ 1 be such that for all ω ∈ Ω, all saim < s ≤ g(ω), and all t ≥ 0 with 11 Pr[X (t) = ω] > 0, we have E[(s − g(X (t+1) ))+ | X (t) = ω] ≤ δs, Pr[s − g(X (t+1) ) ≥ βs | X (t) = ω] ≤ Then E[T ] ≥ βδ . ln(s) ln(s0 ) − ln(saim ) ln(s0 ) − ln(saim ) 1 − β ≥ (1 − 2β). δ 1+β δ The proof follows from an application of Witt’s drift theorem (Theorem 2) to the random process Y (t) := min{g(X (τ ) ) | τ ∈ [0..t]}. Proof. We define a second random process by Y (t) := min{g(X (τ ) ) | τ ∈ [0..t]}. By definition, Y takes values in S and Y is decreasing, that is, we have Y (t+1) ≤ Y (t) with probability one for all t ≤ 0. Trivially, we have Y (0) = g(X (0) ) = s0 . Let TY := min{t ≥ 0 | Y (t) ≤ saim } be the first time this new process reaches or goes below saim . Clearly, TY = T . Let β, δ as in the theorem. Let saim < s and t ≥ 0 such that Pr[Y (t) = s] > 0. Observe that when Y (t) = s, then Y (t) − Y (t+1) = s − min{s, g(X (t+1) )} = (s − g(X (t+1) ))+ . Let AYs be the event that Y (t) = s and let BωX be the event that X (t) = ω. Using the fact that X is a Markov process, we compute E[Y (t) − Y (t+1) | AYs ] X = Pr[AYs | B]E[(s − g(X (t+1) ))+ | AYs , BωX ] ω:g(ω)≥s = X Pr[BωX | AYs ]E[(s − g(X (t+1) ))+ | BωX ] X Pr[BωX | AYs ]δs = δs ω:g(ω)≥s ≤ ω:g(ω)≥s and Pr[Y (t) − Y (t+1) ≥ βs | AYs ] X = Pr[BωX | AYs ] Pr[s − X (t+1) ≥ βs | AYs , BωX ] ω:g(ω)≥s = X Pr[BωX | AYs ] Pr[s − X (t+1) ≥ βs | BωX ] X Pr[BωX | AYs ] ω:g(ω)≥s ≤ ω:g(ω)≥s βδ βδ = . ln(s) ln(s) Consequently, Y satisfies the assumptions of the multiplicative lower bound theorem (Theaim ) 1−β orem 2). Hence E[T ] = E[TY ] ≥ ln(s0 )−ln(s δ 1+β . Elementary algebra shows (1 − β) ≥ (1 − 2β)(1 + β), which gives the second, more convenient lower bound. Corollary 8. Assume that the assumptions of Theorem 7 are satisfied, however with δ replaced by δ(s) for some function δ : S → (0, 1]. Then for any saim < s̃0 ≤ s0 , we have E[T ] ≥ ln(s̃0 ) − ln(saim ) (1 − 2β), δmax (s̃0 ) where δmax (s̃0 ) := max{δ(s) | saim < s ≤ s̃0 }. 12 Proof. Let S̃ := S ∩ [0, s̃0 ]. Let g̃ : Ω → S̃; ω 7→ min{s̃0 , g(ω)}. Let ω ∈ Ω, saim < s ≤ g̃(ω), and t be such that Pr[X (t) = ω] > 0. Then E[(s − g̃(X (t+1) ))+ | X (t) = ω] = E[(s − g(X (t+1) ))+ | X (t) = ω] ≤ δ(s)s ≤ δmax (s̃0 )s by the assumptions of Theorem 7 and s ≤ s̃0 . Similarly, Pr[s − g̃(X (t+1) ) ≥ βs | X (t) = ω] = Pr[s − g(X (t+1) ) ≥ βs | X (t) = ω] βδmax (s̃0 ) βδ(s) ≤ . ≤ ln(s) ln(s) Hence we may apply Theorem 7 to (S̃, s̃0 , g̃, δmax (s̃0 )) instead of (S, s0 , g, δ) and obtain the claimed bound. Lemma 9. Let f be an r-valued OneMax function with optimum z. Let x ∈ [r]n and y be the outcome of applying mutation and selection to x. Let s+ := H(x, z) and s ≤ s+ . Then   s+1 1 s + 3e E[(s − H(y, z))+ ] ≤ . e(r − 1)n 1 − 1/n (r − 1)n Proof. Let u be the outcome of mutating x with uniform mutation strength and y be the result of applying selection (with respect to f ) to x and u. We consider first the case that s = s+ . With probability (1 − (1/n))n−1 , u and x differ in exactly one position. Conditional on this, E[(s − H(y, z))+ ] = s/(r − 1)n. The only other event in which possibly s > H(y, z) is that u and x differ in at least two positions i and j such that ui = zi and uj = zj . The probability for this to happen is 1− (1− 1/(r − 1)n)s − (s/(r − 1)n)(1− 1/(r−1)n)s−1 ≤ 1−(1−s/(r−1)n)−(s/(r−1)n)(1−(s−1)/(r−1)n) = s(s−1)/(r−1)2 n2 . In this case, we can estimate (s − H(y, z))+ from above by the number of non-correct positions that are touched by the mutation operator, which in this case is Bin(s, 1/n) conditional on being at least two, which again is at most 3. Consequently, in the case that s = s+ , we have E[(s−H(y, z)+ ] ≤ (1 − (1/n))n−1 s/(r − 1)n + 3s(s − 1)/(r − 1)2 n2 ≤ (s/(r − 1)n)(1/e(1 − 1/n) + 3(s − 1)/(r − 1)n). Let now s ≤ s+ −1. Let Z := |{i ∈ [1..n] | xi 6= zi 6= ui }| ∈ [0..s+ ] be the number of positions that are incorrect in both x and u. Clearly, H(y, z) stochastically dominates Z, which we write as H(x, z)  Z. Let Z ′ be defined analogous to Z but for an original search point x′ with H(x′ , z) = s + 1 ≤ H(x, z). Then, clearly, Z  Z ′ . Consequently, s − H(y, z)  s − Z  s − Z ′ , and consequently, (s−H(y, z))+  (s−Z ′ )+ and E[(s−H(y, z)+ ] ≤ E[(s−Z ′ )+ ]. The only way to get a positive value for s − Z ′ is that at least two incorrect positions of x′ are changed to their correct value in the mutation offspring. Analogous to the previous paragraph, the probability for this to happen is 1−(1−1/(r −1)n)s+1 −((s+1)/(r −1)n)(1−1/(r −1)n)s ≤ (s+1)s/(r −1)2 n2 . In this case, we can estimate (s − Z ′ )+ from above by the number of incorrect positions that are touched by the mutation operator (conditional on being at least two) minus one, which is at most 2. We conclude E[(s − H(y, z))+ ] ≤ E[(s − Z ′ )+ ] ≤ 2(s + 1)s/(r − 1)2 n2 . Putting the two cases together, we see that we always have E[(s − H(y, z))+ ] ≤ (s/(r − 1)n)(1/e(1 − 1/n) + 3(s + 1)/(r − 1)n). Lemma 10. Let f be an r-valued OneMax function with optimum z. Let saim = ln(n)3 and β = 1/ ln(n). Let x ∈ [r]n with H(x, z) > saim . Let saim < s ≤ H(x, z). Let y be the outcome 2 1 2− ln(n) if n ≥ 11. of applying mutation and selection to x. Then Pr[s − H(y, z) ≥ βs] ≤ r−1 13 Proof. We have that Pr[s − H(y, z) ≥ βs] ≤ Pr[H(x, z) − H(y, z) ≥ βsaim ]. The latter is at most the probability that at least βsaim = ln(n)2 positions of x flip to a particular value (namely the one given by z) in one mutation step. Since the expected number of positions flipping to the correct value is at most 1/(r − 1), a strong multiplicative Chernoff bound (e.g., than ln(n)2 with probability at most Cor. 1.10(b) in [Doe11]) shows that this number is greater √ 2 1 − ln(n)2 2 ln(n) ≤ r−1 2 (e/ ln(n) (r − 1)) for n ≥ 10.29 ≈ exp( 2e). We are now ready to give the main result of this section. Theorem 11. For any r-valued OneMax function, the (1 + 1) EA with uniform mutation strength has an expected optimization time of E[T ] ≥ e(r − 1)n (ln(n) − 6 ln ln(n)) (1 − O(1/ ln(n))) ≥ e(r − 1)n ln(n) − O((r − 1)n ln ln(n)). Proof. Let n be sufficiently large. Let Ω = [r]n and f : Ω → R an r-valued OneMax function with optimum z. Let saim = ln(n)3 and β = 1/ ln(n). For all saim < s ≤ n, let δ(s) := (1/e(r − 1)n)(1/(1 − 1/n) + 3e(s + 1)/(r − 1)n). Consider a run of the (1 + 1) EA optimizing f initialized with a random search point X (0) . We have E[H(X (0) , z)] = n(1−1/r). Consequently, we have H(X (0) , z) ≥ n/3 with probability 1 − exp(−Ω(n)). In the following, we thus assume that X (0) is a fixed initial search point with some H(·, z) value of at least n/3. Denote by X (t) the search point building the one-element population of this EA after the t-th iteration. Let g : Ω → N; x 7→ H(x, z). By Lemma 9 and 10, the following conditions are satisfied for all ω ∈ Ω, all saim < s ≤ g(ω), and all t ≥ 0 with Pr[X (t) = ω] > 0. E[(s − g(X (t+1) ))+ | X (t) = ω] ≤ δ(s)s. βδ(s) . Pr[s − g(X (t+1) ) ≥ βs | X (t) = ω] ≤ ln(s) We apply Corollary 8 with s̃0 = n/ ln(n)3 ≤ n/3 and δmax (s̃0 ) ≤ O(1/ ln(n)3 (r − 1))) and obtain 1 e(r−1)n (1 + O(1/n) + ln(s̃0 ) − ln(saim ) (1 − 2β) δmax (s̃0 ) ≥ e(r − 1)n ln(n) − O((r − 1)n ln ln(n)). E[T ] ≥ We remark that the lower order term O((r − 1)n log log n) in this lower bound could be removed with stronger methods. We preferred to use the simple and natural proof approach via multiplicative drift, because it is easy to handle and still relatively precisely describes the true behavior of the process. As is visible from Lemma 9, in the early stages the progress is slightly faster than the multiplicative (main) term s/e(r − 1)n. This is why we cut out the regime from the initial H-value of approximately n(1 − 1/r) up to an H-value of s̃0 = n/ ln(n)3 , resulting in a −Θ((r − 1)n log log n) term in our lower bound. Another −Θ((r − 1)n log log n) term stems from the second condition of Witt’s lower bound drift theorem (which is similar to the second condition of our theorem). To prove a bound sharp up to terms of order (r − 1)n log log n, we need β ≤ log log n/ log n. However, this forbids using an saim smaller than 1/β = log n/ log log n, since otherwise any improvement would count into the bad event of the second condition. An saim of at least polylogarithmic size immediately implies an Ω((r−1)n log log n) additive distance to the upper bound proven in Theorem 6. We are very optimistic that via variable drift, in particular, the lower bound theorem of [DFW11], both difficulties could be overcome. We do not think that this small improvement justifies the effort, though. 14 5 Unit Mutation Strength In this section we regard the mutation operator that applies only ±1 changes to each component. It is not very surprising that RLS with the ±1 variation operator needs Θ(n(r + log n)) fitness evaluations in expectation to optimize any r-valued OneMax function. We give the full proof below since it is similar to the analysis of the (1 + 1) EA equipped with the ±1 variation operator. The proof makes use of the following observation. There are two extreme kinds of individuals with fitness n. The first kind is only incorrect in one position (by an amount of n); the second kind is incorrect in every position (by an amount of 1). The first kind of individual is hard to improve (the deficient position has to be chosen for variation), while the second kind is very easy to improve (every position allows for improvement). We reflect this in our choice of potential function by giving each position a weight exponential in the amount that it is incorrect, and then sum over all weights. Theorem 12. The expected optimization time of RLS with the ±1 variation operator is Θ(n(r+ log n)) for any r-valued OneMax function. Proof. The lower bound Ω(nr) is quite immediate: with probability 1/2 we start in a search point of fitness at most nr/2 and in each step the algorithm increases the fitness by at most one. On the other hand, there is a coupon collector effect which yields the Ω(n log n) lower bound. Indeed, it is well-known that this is the expected number of RLS iterations that we need in case of r = 2, and larger values of r will only delay optimization. We now turn to the more interesting upper bound. Let any r-valued OneMax function be given with metric d and target z. We want to employ a multiplicative drift theorem (see Theorem 1). We measure the potential of a search point by the following drift function. For all x ∈ Ω = [r]n , let n X (wd(zi ,xi ) − 1), (3) g(x) := i=1 where w := 1 + ε is an arbitrary constant between 1 and 2. In fact, for the analysis of RLS we can simply set w := 2 but since we want to re-use this part in the analysis of the (1 + 1) EA, we prefer the more general definition here. We regard how the potential changes on average in one iteration. Let x denote the current search point and let y denote the search point that we obtain from x after one iteration of RLS (after selection). Clearly, we have that each position is equally likely to be selected for variation. When a non-optimal component i is selected, then the probability that yi is closer to zi than xi is at least 1/2, while for every already optimized component we will not accept any move of RLS (thus implying yi = xi ). This shows that, abbreviating di := d(zi , xi ) for all i ∈ [1..n], and denoting by O := {i ∈ [1..n] | xi = zi } the set of already optimized bits,  X  1 (wdi − 1) − (wdi −1 − 1) E[g(x) − g(y) | x] = 2n i∈[1..n]\O = 1 2n X i∈[1..n]\O ≥ 1 2n (1 = 1 2n (1 (1 − di 1 w )w X (wdi − 1) − 1 w) − 1 w )g(x). i∈[1..n] Furthermore, the maximal potential that a search point can obtain is at most nwr . Plugging 1), we see that the expected optimization time all this into the multiplicative drift (see Theorem  1 1 r is of order at most ln(nw )/ 2n (1 − w ) = O(n(log(n) + r)), as desired. 15 For the analysis of the (1 + 1) EA we will proceed similarly as for RLS. To help with the added complexity, we use the following lemma. Lemma 13. Let n be fixed, let q be a cost function on elements of [1..n] and let c be a cost function on subsets of [1..n]. Furthermore, let a random variable S ranging over subsets of [1..n] be given. Then we have ∀T ⊆ [1..n] : c(T ) ≤ X ∀T ⊆ [1..n] : c(T ) ≥ X i∈T q(i) ⇒ E[c(S)] ≤ n X q(i) Pr[i ∈ S]; (4) q(i) ⇒ E[c(S)] ≥ n X q(i) Pr[i ∈ S]. (5) and i∈T i=1 i=1 P P Pn Proof. We have E[c(S)] = T ⊆[n] Pr[S = T ]c(S) ≤ T ⊆[n] Pr[S = T ] i∈T q(i) = Pn q(i) Pr[i ∈ S]. The other direction follows analogously. i=1 The proof for the case of the (1 + 1) EA follows along similar lines, but is (significantly) more involved. Theorem 14. The expected optimization time of the (1 + 1) EA with the ±1 variation operator is Θ(n(r + log n)) for any r-valued OneMax function. Proof. The lower bound Ω(nr) follows almost as for RLS: With constant probability the initial search point is Θ(nr) away from the optimum, and the expected progress towards the optimum is bounded form above by 1. Thus, with a simple lower-bound additive drift theorem [HY01], the lower bound of Ω(nr) follows. Regarding the upper bound, let any r-valued OneMax function be given with metric d and target z. We want to employ multiplicative drift again. We fix some w > 1 to be specified later. With any search point x ∈ Ω we associate a vector d ∈ Rn such that, for all i ≤ n, di = d(xi , zi ). We use the same potential g on Ω as for the analysis of RLS, that is, for all x ∈ Ω, g(x) = n X i=1 (wdi − 1). Let any current search point x ∈ Ω be given and let Y be the random variable describing the search point after one cycle of mutation and selection. Let E1 be the event that Y is obtained from x by flipping exactly one bit and the result is accepted (that is, f (Y ) ≤ f (x)). Let E2 be the event that at least 2 bits flip and the result is accepted. The total drift in the potential g is now E[g(x) − g(Y )] = E[g(x) − g(Y ) | E1 ] Pr[E1 ] + E[g(x) − g(Y ) | E2 ] Pr[E2 ]. We are now going to estimate E[g(x) − g(Y ) | E2 ]. The random variable Y is completely determined by choosing a set S ⊆ [1..n] of bit positions to change in x and then, for each such position i ∈ S, choosing how to change it (away or towards the target zi ). For each choice S ⊆ [1..n], let A(S) be the set of all possible values for Y which have the set S as positions of change. For each possible S ⊆ [1..n], let Y (S) be the random variable Y conditional on making changes exactly at the bit positions of S. Thus, we can now write the random variable Y as X Y = Y (S) Pr[S]. S We are now going to estimate, for any possible S, E[g(Y (S)) − g(x)]. 16 For all possible S, let c(S) = E[g(Y (S)) − g(x)]. Let a possible S be given. Note that Y (S) is the uniform distribution on A(S). For each y ∈ A(S) and each i ∈ S, we have d(yi , zi ) − di ∈ {−1, 0, 1} (note that the case of being 0 can only occur when r is odd and we have a circle, or in other such border cases); in the case that this value is 1 we call (y, i) an up-pair, and in case that this value is −1 we call this pair a down-pair. We let U be thePset of all up-pairs. As we only consider accepted mutations, we have that, for all y ∈ A(S), i∈S d(yi , zi ) − di ≤ 0. This implies that there are at least as many down-pairs as there are up-pairs in A(S) × S. Furthermore, for any up-pair (y, i) with di 6= 0 there is y ′ ∈ A(S) such that (y ′ , i) is a down-pair and, for all j ∈ S \ {i}, yj′ = yj . Thus, for all up-pairs (y, i) ∈ U there is a down-pair (y, i), such that the mapping (y, i) 7→ (y, i) is injective and, for all (y, i) ∈ U with di 6= 0, (y, i) = (y ′ , i). Note that, for all up-pairs (y, i), we have di ≤ di . We now get, for any (y, i) ∈ U , wd(yi ,zi ) − wdi + wd(y i ,zi ) − wdi ≤ wdi (w − 1 + = wdi 1 − 1) w (w − 1)2 . w Overall we have c(S) = E[g(Y (S)) − g(x)] X 1 g(y) − g(x) = |A(S)| y∈A(S) = ≤ n   X X 1 wd(yi ,zi ) − wdi |A(S)| y∈A(S) i=1  X  1 wd(yi ,zi ) − wdi + wd(y i ,zi ) − wdi |A(S)| (y,i)∈U ≤ X (w − 1)2 1 wdi |A(S)| w ≤ 1X (y,i)∈U 2 i∈S wdi (w − 1)2 . w Using Lemma 13, we see that E[g(Y ) − g(x) | E2 ] ≤ n X 1 di (w − 1)2 w n 2w = n (w − 1)2 X di w . 2wn i=1 i=1 We use the following estimation of progress we can make with changing exactly one position. E[g(x) − g(Y ) | E1 ] Pr[E1 ] ≥ = 17 1 X (1 − 2ne i∈[n] n X w−1 2wne i=1 di 1 w )w wdi . Let w be any constant > 1 such that w − 1 − e(w − 1)2 > 0, and let c = (w − 1 − e(w − 1)2 )/e. Then we have E[g(x) − g(Y )] ≥ = n n w − 1 X di (w − 1)2 X di w − w 2wne 2wn i=1 w − 1 − e(w − 2wne i=1 1)2 n X wdi i=1 n = ≥ c X di w 2wn i=1 c g(x). 2wn Again, the maximal potential that a search point can obtain is at most nwr . Plugging all this into the multiplicative drift (see  Theorem 1), we see that the expected optimization time c = O(n(log(n) + r)), as desired. is of order at most ln(nwr )/ 2wn 6 Harmonic Mutation Strength In this section we will consider a mutation operator with variable step size. The idea is that different distances to the target value require different step sizes for rapid progress. We consider a mutation operator which, in each iteration, chooses its step size from a fixed distribution. As distribution we use what we call the harmonic distribution, which chooses step size j ∈ [1..r − 1] with probability proportional to 1/j. Using the bound on the harmonic number Hr−1 < 1+ln r, we see that the probability of choosing such a j is at least 1/(j(1 + ln r)). Theorem 15. The RLS as well as the (1 + 1) EA with the harmonically distributed step size (described above) has an expected optimization time of Θ(n log r(log n + log r)) on any r-valued OneMax function. Proof. We first show the upper bound by considering drift on the fitness. Let any x ∈ Ω be given, let Y be the random variable describing the best individual of the next iteration and let Ai,j be the event that Y differs from x in exactly bit position i and this bit position is now j 1 closer to the optimum. Note that, for both RLS and the (1+1) EA, we get Pr[Ai,j ] ≥ 2enj(1+ln r) . We have E[f (x) − f (Y )] ≥ = = di n X X i=1 j=1 n X i=1 di n X X i=1 j=1 E[f (x) − f (Y ) | Ai,j ] Pr[Ai,j ] j Pr[Ai,j ] ≥ di n X X i=1 j=1 j 2enj(1 + ln r) 1 di = f (x). 2en(1 + ln r) 2en(1 + ln r) As the initial fitness is less than rn, the multiplicative drift theorem (see Theorem 1) gives us the desired total optimization time. Now we turn to the lower bound. A straightforward coupon collector argument gives us the lower bound of Ω(n log r log n), since each position has to change from incorrect to correct at some point, and that mutation has a probability of O(1/(n log r)). It remains to show a 18 lower bound of Ω(n(log r)2 ). To this end, let f be any r-values OneMax function and x∗ its optimum. Let g(x) = d(x1 , x∗1 ) be the distance of the first position to the optimal value in the first position. Let h(x) = ln(g(x) + 1). Let x′ be the outcome of one mutation step and x′′ be the outcome of selection from {x, x′ }. We easily compute E[max{0, h(x) − h(x′ )}] ≤ n K ln r as well. For the random for some absolute constant K. Consequently, E[h(x) − h(x′′ )] ≤ n K ln r initial search point, we have g(x) ≥ r/2 with constant probability, that is, h(x) = Ω(log r) with constant probability. Consequently, the additive drift theorem gives that the first time T at 2 which h(x) = 0, satisfies E[T ] ≥ Ω(log r)/ n K ln r = Ω(n log r). In the same way as we showed the additive drift statement E[h(x) − h(x′′ )] = O(1/n log r), we could have shown a multiplicative drift statement for g, namely E[g(x) − g(x′′ )] = O(g(x)/n log r); in fact, the latter is implied by the former. Unfortunately, due to the presence of large jumps – we have Pr[g(x′′ ) ≤ g(x)/2] = Θ(1/n log r) –, we cannot exploit this via the lower bound multiplicative drift theorem. Naturally, the question arises whether the O((log r)2 ) dependence on r can be improved. In particular, one wonders whether drawing the step size from the Harmonic distribution is optimal, or whether another distribution gives a better optimization time. This is exactly the problem considered in [DRWW10], where the following result is presented, which could also be used to derive the run time bound of Theorem 15. Theorem 16 ([DRWW10]). Let a random process on A = {0, . . . , r} be given, representing the movement of a token. Fix a probability distribution of step sizes D over {1, . . . , r}. Initially, the token is placed on a random position in A. In round t, a random step size d is chosen according to D. If the token is in position x ≥ d, then it is moved to position x − d, otherwise it stays put. Let TD be the number of rounds until the token reaches position 0. Then minD (E[TD ]) = Θ((log r)2 ). While our processes have a slightly different behavior (including the possibility to overshoot the goal), we believe that these differences only lead to to differences in the constants of the optimization time. Thus, the above theorem indicates that the Harmonic distribution is an optimal choice and cannot be improved. 7 Conclusion While many analyses of randomized search heuristics focus on the behavior of the algorithm in dependence of a large and growing dimension, we additionally considered a growing size of the search space in each dimension. We considered the (1 + 1) EA with three different mutation strengths and proved asymptotically tight optimization times for a variety of OneMax-type test functions over an alphabet of size r. We proved that both using large changes (change to uniformly chosen different value) or very local changes (change value by ±1) leads to relatively slow (essentially linear in r) optimization times of Θ(rn log n) and Θ(n(r + log n)), respectively. We then considered a variable step size operator which allows for both large and small steps with reasonable probability; this leads to an optimization time of Θ(n log r(log n + log r)). Note that this bound, while polylogarithmic in r, is worse than the bound of Θ(n(r + log n)) for the ±1 operator when r is asymptotically smaller than log n log log n. This shows that there is no uniform superior mutation operator among the three proposed operators. Acknowledgments This research benefited from the support of the “FMJH Program Gaspard Monge in optimization and operation research”, and from the support to this program from EDF (Électricité de 19 France). References [AD11] Anne Auger and Benjamin Doerr. Theory of Randomized Search Heuristics. World Scientific, 2011. [DD14] Benjamin Doerr and Carola Doerr. The impact of random initialization on the runtime of randomized search heuristics. In Proc. of Genetic and Evolutionary Computation Conference (GECCO), pages 1375–1382. ACM, 2014. [DFW11] Benjamin Doerr, Mahmoud Fouz, and Carsten Witt. Sharp bounds by probabilitygenerating functions and variable drift. In Proc. of Genetic and Evolutionary Computation Conference (GECCO), pages 2083–2090. ACM, 2011. [DG13] Benjamin Doerr and Leslie A. Goldberg. Adaptive drift analysis. Algorithmica, 65:224–250, 2013. [DJ07] Benjamin Doerr and Daniel Johannsen. Adjacency list matchings: an ideal genotype for cycle covers. In Proc. of Genetic and Evolutionary Computation Conference (GECCO), pages 1203–1210. ACM, 2007. [DJS11] Benjamin Doerr, Daniel Johannsen, and Martin Schmidt. Runtime analysis of the (1+1) evolutionary algorithm on strings over finite alphabets. In Proc. of Foundations of Genetic Algorithms (FOGA), pages 119–126. ACM, 2011. [DJW12] Benjamin Doerr, Daniel Johannsen, and Carola Winzen. Multiplicative drift analysis. Algorithmica, 64:673–697, 2012. [DKLW13] Benjamin Doerr, Timo Kötzing, Johannes Lengler, and Carola Winzen. Black-box complexities of combinatorial problems. Theoretical Computer Science, 471:84–106, 2013. [Doe11] Benjamin Doerr. Analyzing randomized search heuristics: Tools from probability theory. In Anne Auger and Benjamin Doerr, editors, Theory of Randomized Search Heuristics, pages 1–20. World Scientific Publishing, 2011. [DP12] Benjamin Doerr and Sebastian Pohl. Run-time analysis of the (1+1) evolutionary algorithm optimizing linear functions over a finite alphabet. In Proc. of Genetic and Evolutionary Computation Conference (GECCO), pages 1317–1324. ACM, 2012. [DRWW10] Martin Dietzfelbinger, Jonathan E. Rowe, Ingo Wegener, and Philipp Woelfel. Tight bounds for blind search on the integers and the reals. Combinatorics, Probability & Computing, 19:711–728, 2010. [Gun05] Christian Gunia. On the analysis of the approximation capability of simple evolutionary algorithms for scheduling problems. In Proc. of Genetic and Evolutionary Computation Conference (GECCO), pages 571–578. Jahn, 2005. [HY01] Jun He and Xin Yao. Drift analysis and average time complexity of evolutionary algorithms. Artificial Intelligence, 127:57–85, 2001. 20 [Jäg08] Jens Jägersküpper. Oblivious randomized direct search for real-parameter optimization. In Proc. of European Symposium on Algorithms (ESA), pages 553–564. Springer, 2008. [Jan13] Thomas Jansen. Analyzing Evolutionary Algorithms—The Computer Science Perspective. Springer, 2013. [Joh10] Daniel Johannsen. Random combinatorial structures and randomized search heuristics. PhD thesis, Saarland University, 2010. [KLW15] Timo Kötzing, Andrei Lissovoi, and Carsten Witt. (1+1) EA on generalized dynamic onemax. In Proc. of Foundations of Genetic Algorithms (FOGA), pages 40–51. ACM, 2015. [LW12] Per Kristian Lehre and Carsten Witt. Black-box search by unbiased variation. Algorithmica, 64:623–642, 2012. [LW14] Andrei Lissovoi and Carsten Witt. MMAS vs. population-based EA on a family of dynamic fitness functions. In Proc. of Genetic and Evolutionary Computation Conference (GECCO), pages 1399–1406. ACM, 2014. [MRC09] Boris Mitavskiy, Jonathan Rowe, and Chris Cannings. Theoretical analysis of local search strategies to optimize network communication subject to preserving the total number of links. International Journal of Intelligent Computing and Cybernetics, 2:243–284, 2009. [NW10] Frank Neumann and Carsten Witt. Bioinspired Computation in Combinatorial Optimization – Algorithms and Their Computational Complexity. Springer, 2010. [RV11] Jonathan Rowe and Michael Vose. Unbiased black box search algorithms. In Proc. of Genetic and Evolutionary Computation Conference (GECCO), pages 2035–2042. ACM, 2011. [STW04] Jens Scharnow, Karsten Tinnefeld, and Ingo Wegener. The analysis of evolutionary algorithms on sorting and shortest paths problems. J. Math. Model. Algorithms, 3:349–366, 2004. [Wit13] Carsten Witt. Tight bounds on the optimization time of a randomized search heuristic on linear functions. Combinatorics, Probability & Computing, 22:294– 318, 2013. 21
9cs.NE
Closing the AI Knowledge Gap arXiv:1803.07233v1 [cs.CY] 20 Mar 2018 Ziv Epstein∗ , Blakeley H. Payne∗ , Judy Hanwen Shen, Abhimanyu Dubey, Bjarke Felbo, Matthew Groh, Nick Obradovich, Manuel Cebrian, Iyad Rahwan Media Lab, Massachusetts Institute of Technology, Cambridge, MA, USA Correspondence: {cebrian, irahwan}@mit.edu Abstract AI researchers employ not only the scientific method, but also methodology from mathematics and engineering. However, the use of the scientific method – specifically hypothesis testing – in AI is typically conducted in service of engineering objectives. Growing interest in topics such as fairness and algorithmic bias show that engineering-focused questions only comprise a subset of the important questions about AI systems. This results in the AI Knowledge Gap: the number of unique AI systems grows faster than the number of studies that characterize these systems’ behavior. To close this gap, we argue that the study of AI could benefit from the greater inclusion of researchers who are well positioned to formulate and test hypotheses about the behavior of AI systems. We examine the barriers preventing social and behavioral scientists from conducting such studies. Our diagnosis suggests that accelerating the scientific study of AI systems requires new incentives for academia and industry, mediated by new tools and institutions. To address these needs, we propose a two-sided marketplace called TuringBox. On one side, AI contributors upload existing and novel algorithms to be studied scientifically by others. On the other side, AI examiners develop and post machine intelligence tasks designed to evaluate and characterize algorithmic behavior. We discuss this market’s potential to democratize the scientific study of AI behavior, and thus narrow the AI Knowledge Gap. 1 The Many Facets of AI Research Although AI is a sub-discipline of computer science, AI researchers do not exclusively use the scientific method in their work. For example, the methods used by early AI researchers often drew from logic, a subfield of mathematics, and are distinct from the scientific method we think of today. Indeed AI has adopted many techniques and approaches over time. In this section, we distinguish and explore the history of these ∗ Equal contribution. methodologies with a particular emphasis on characterizing the evolving science of AI. 1.1 AI as Math As early as the seventeenth century, the notion that intelligence could be equated to symbolic information processing was formalized. In his 1677 Preface to the General Science Leibniz wrote: “It is obvious that if we could find characters or signs suited for expressing all our thoughts as clearly and as exactly as arithmetic expresses numbers or geometry expresses lines, we could do in all matters insofar as they are subject to reasoning all that we can do in arithmetic and geometry. For all investigations which depend on reasoning would be carried out by transposing these characters and by a species of calculus.” [Leibniz, 1685] In the early 20th century, Leibniz’s ideas influenced a number of mathematicians. Logician and mathematician David Hilbert posed the famous question: Can all of mathematical reasoning be formalized [Hilbert, 1928]? This question spurred many others to explore the limits of computation and logic, an enterprise that culminated in Gödel’s incompleteness theorems, which revealed fundamental limits of formal reasoning. But these discoveries of formal limitations around computability and formal reasoning did not stop scholars from pursuing the foundations of mechanized intelligence. AI, as its known today, began with Alan Turing’s seminal work “Computing Machinery and Intelligence” in which Turing discussed the idea of creating machines that can think [Turing, 1950]. Turing acknowledged the vagueness of the terms ‘machine’ and ‘thought,’ and operationalized the question with the Universal Turing Machine, which could perform arbitrary symbolic computation. The idea, again, was that once mathematics is mechanized, all manner of reasoning subsequently follows. Thus, the early builders of AI systems were mainly mathematicians, devising mechanistic procedures–often called proof theories–for all manner of reasoning. In 1955, Herbert Simon and Allen Newell’s Logic Theorist proved 38 theorems in the Principia Mathematica [Newell et al., 1959]. This led Simon to claim that they had “solved the mind-body problem.” He argued that with a sufficiently powerful version of the Logic Theorist, we could automate mathematical reasoning, which in turn would enable the automation of all reasoning. In subsequent decades, theoretical developments in symbolic reasoning continued. This manifested in numerous mathematical investigations, from analyzing the computational complexity of various symbolic reasoning problems, to providing precise mathematical semantics of logic programming languages [Van Emden and Kowalski, 1976], to new forms of computationally efficient symbolic reasoning on constrained languages [McCarthy, 1981; Jaffar and Maher, 1994; Kakas et al., 1992]. In tandem, significant theoretical developments took place in machine learning, grounded in statistical learning theory. These efforts resulted in rigorous foundations for reasoning about facts [Pearl, 1986], learning patterns [Vapnik, 1999] and taking actions and planning in the presence of uncertainty [Sutton and Barto, 1998] . 1.2 AI as Engineering Since the 1970s, in parallel to these developments in AI theory, a growing cadre of AI engineers started taking shape. On one hand, some mathematically-minded computer scientists produced demonstrations of the capabilities of particular symbolic reasoning techniques. For example, one can show how an AI agent performs planning by solving logical satisfiability problems [Kautz et al., 1992] or performs various commonsense reasoning tasks using circumscriptionbased logical reasoning [McCarthy, 1986]. On the other hand, AI engineers embarked on formalizing all manner of domain-specific facts in symbols and rules that can be used in operational expert systems [Jackson, 1998]. There were ambitious – but ultimately unsuccessful – attempts to build expert systems manually with encyclopedic knowledge, capable of answering any question [Lenat et al., 1985]. The difficulty of curating such knowledge bases made salient that building general AI systems was not only a challenge from a computational perspective, but also required an infeasible knowledge engineering effort. Despite two ‘AI Winters,’ the engineering methodologies employed by builders of AI systems became increasingly sophisticated, leveraging contemporaneous increases in computation capacities and data streams. This sophistication took the form of i) better developed methodologies, and ii) more standardized and precise benchmarks. First, AI engineers developed standardized knowledge engineering methodologies for AI systems, such as KADS [Wielinga et al., 1992]. This development also benefited from the overall maturity in the broader field of software engineering, enabling standardized Application Programming Interfaces, team management, code documentation and sharing, and so on. Second, AI engineers have developed increasingly sophisticated benchmark problems to compare their systems. These benchmarks have taken three forms: as standardized tasks, datasets, or metrics. In the early days of symbolic AI, these benchmarks were qualitative, such as the ‘Blocks World’ [Sussman and Winograd, 1970; Bylander, 1994]. But modern AI grounded in statistical theory has invited more sophisticated benchmark tasks, from board games like Chess [Campbell et al., 2002] and Checkers [Schaeffer et al., 2007], to card games like Poker [Bowling et al., 2015], to computer games like Atari [Mnih et al., 2015], to artificial markets for testing trading algorithms [Wellman et al., 2001], to Robocup Soccer [Kitano et al., 1997]. In problems spanning across application domains such as computer vision and natural language processing (two of the most prominent application areas of modern AI techniques), the benchmark for performance on tasks has been set by widely used, standardized, large-scale evaluation datasets. For instance, in the task of object recognition, the ImageNet [Russakovsky et al., 2015] dataset has become a ubiquitous standard for performance. Similarly, for the tasks of image captioning and scene understanding, the Microsoft Common Objects in Context (MS-COCO) [Lin et al., 2014] dataset has been instrumental in providing a reliable benchmark for performance. The development of such large-scale benchmark problems has led to the construction and widespread adoption of metrics to assess the performance of new algorithms at scale. Enhancements of traditional signal processing metrics such as the receiver operating characteristic (ROC) [Davis and Goadrich, 2006] including precision, recall, and F1 measures have been established as standard metrics for performance assessment. In more involved tasks, metrics such as mean Average Precision [Van De Sande et al., 2010](for object detection), BLEU [Papineni et al., 2002] (for machine translation), and Inception Score [Zhou et al., 2017] (for generative modeling assessment) are some examples that have been established by the research community to evaluate complex intelligence tasks. 1.3 AI as Science In addition to these mathematical and engineering-based methodologies, AI researchers also frequently employ the scientific method – specifically the hypothesis testing paradigm. For instance, to evaluate the performance of reinforcement learning algorithms in a multi-agent setting [Littman, 1994], it is common to resort to Monte Carlo simulation to estimate average properties such as convergence rate and long-run performance. Likewise, in many complex AI systems, the performance of the system under different choices of parameters is often compared using the null hypothesis testing paradigm[Cohen, 1995]. However, while some AI researchers have indeed employed a hypothesis driven approach in studying AI systems, the predominant objective has been engineering-oriented: focused on designing and building intelligent systems. These pertain, for example, to the performance of a heuristic planning system against some theoretical optimum, the speed of convergence of a real-time optimization algorithm, or the classification accuracy of a given image classification system. Indeed, it is common for articles submitted to AI conferences to be rejected if they do not present a specific technical advance beyond existing AI algorithms and models. This observation has an important implication. Even when AI researchers use the scientific method to examine the systems they build, the engineering-oriented incentives of the larger community lead them to selectively target engineeringoriented research questions. While these are important scientific questions about AI Study Sweeney et al., 2013 Stimulus Treatment Groups AI System Scope Behavior Names as Search Terms Racial Association Google Search Engine Via API Disparate Treatment Parliamentarian Headshots Gender, Fitzpatrick Skin Type Class Facial Recognition Algorithms Via API Disparate Mistreatment Consumer Profiles Web Broswer, Operating System, User History Online Pricing Algorithms Field Disparate Treatment Buolamwini et al., 2018 Hannak et al., 2014 Table 1: Sample of existing behavioral studies of AI in terms of their stimulus, AI system, and measured behavior. We describe the treatment types for each stimuli and the level at which the study occurs (either locally, via an API, or “in the field”). systems, they are not the only important questions. As we will discuss in the next section, there is a growing set of research questions of interest to a broad range of scientists outside of the scope of the AI canon that involve concepts and methods beyond the training of a typical AI researcher. 2 A New Science of AI Recent advances in hardware and deep learning have led to the proliferation of deployed AI systems. AI is no longer confined to the laboratory but instead has become a ubiquitous part of the social world. We rely on AI systems to help us make decisions as simple as what movie to watch next or where to go to dinner as well as more complex, highstakes decisions, such as who is able to get a loan or when an inmate’s sentence should be reduced [Bennett and Lanning, 2007; Kaggle, 2013; Tay and Ho, 1992; Berk, 2012]. We now share the roads with autonomous vehicles, we routinely interact with social media bots, and financial markets are now dominated by algorithmic trading [Bonnefon et al., 2016; Ferrara et al., 2016]. Due to their ubiquity and potential harm, the increasingly emergent and often unintended properties of these AI systems have garnered widespread attention in both the public and academic spheres [O’Neil, 2017; Friedman and Nissenbaum, 1996]. However, practices such as training on proprietary data and using complex models often make it challenging to use the underlying structure of the system to predict or study its emergent behaviors [Voosen, 2017]. Instead many studies, especially in the area of algorithmic bias, have employed techniques which do not require details about the system’s architecture. In 2013, Sweeney’s study on discrimination showed that search results were disproportionately more likely to return results related to arrest when a racially associated name was used as a keyword in online advertisements [Sweeney, 2013]. This study and others like it began a new wave of hypothesisdriven science related to AI systems. Since then, an increasing number of studies has attempted to characterize the emergent behaviors of high-stakes algorithms. A recent study showed that dark, female faces are misgendered at higher rates than lighter, male faces by commercial facial recognition algorithms [Buolamwini and Gebru, 2018]. ProPublica showed evidence of racial dis- Figure 1: Conceptual illustration of applying the scientific method of experimentation and causal inference to a black box AI system (center) by providing a stimulus (left) and measuring behavioral output (right). crimination in new recidivism risk score algorithms as well as price discrimination based on zip code for auto insurance premiums [Larson et al., 2016; Larson et al., 2017]. Studies have even explored algorithmic bias on deployed platforms. For example, recent studies have investigated price discrimination on e-commerce sites [Chen et al., 2016; Hannak et al., 2014]. Engineering tools such as multi-agent simulation and ROC curves are not capable of fully explaining these systems and their behavior. Instead, we turn to the domain specific knowledge, tools, and methodologies of the social and behavioral sciences. 2.1 Towards a social science methodology We propose framing the output of AI systems as behavior, with its own patterns and ecologies, and propose using scientific techniques like experimentation and causal inference to understand these behaviors, agnostic to the underlying system architecture. Figure 1 illustrates this framing. Each of the aforementioned studies in Section 2 contain three core components: an AI system contained in a controlled environment, systematic stimuli, and a measure of behavior, as shown in Table 1. At the core of the social sciences is the attempt to under- stand and predict the behavior and emergent properties of complex systems comprised of intelligent agents. Social scientists could contribute several essential pieces of expertise to questions that lie at the interface of AI and the social sciences. First, social scientists possess knowledge on experimental design and causal inference. Designing stimuli for AI systems is analogous to designing and administering more traditional ‘treatments’ in the social and behavioral sciences. Further, in many cases such as investigating pricing discrimination on e-commerce sites, the space of potential variables is infinite. Social scientists conduct randomized controlled trials and derive theoretically informed hypotheses to narrow the space of their possible behavioral investigations. Second, social scientists bring domain specific knowledge that a typical AI researcher may not have, such as knowledge of specific types of discrimination, human learning procedures, social dynamics, among other relevant topics. With the potential upsides to added collaboration with social and behavioral scientists in mind, we propose a new science of AI which composites previous scientific AI methodologies, the domain expertise of the social sciences, and social science methodologies such as causal inference and hypothesis-driven research design. 2.2 The AI Knowledge Gap But there are significant challenges facing this new science of AI. These challenges primarily derive from incentives which encourage the engineering of new systems over the study of existing systems. The first challenge relates to the reproducibility crisis, a popular topic of discussion within the AI community. The conversation about reproducibility centers around the following problem: as researchers often desire to publish regularly and rapidly, time constraints diminish their incentives to reproduce results or replicate existing systems. The focus on contributing novel systems can lead researchers to fail to replicate their comparative benchmarks, to choose strategic but non-comprehensive benchmarks, or to never publish the code for their novel systems. Indeed it was recently found that only 6% of 400 authors at two top AI conferences shared their new algorithm’s code [Hutson, 2018]. The second challenge is the expertise required to study AI systems in their social contexts. Many of the aforementioned examples require knowledge in computer science as well as knowledge (and data) related to the social domain of AI systems, such as the criminal justice system. However, for the same reasons as with the challenge of reproducibility, there are few incentives for the AI community to gain expertise denovo in every domain of interest, especially for increasingly complex socio-technical systems. However, as mentioned previously, social and behavioral scientists – due to their scientific focus on the socio-technical systems themselves – are uniquely positioned to help fill this gap. The third challenge is accessibility. The pervasive use of proprietary data and differences in computational power can make it difficult for computer scientists to access relevant models. Additionally, while social scientists have unique training in measuring behavior and social outcomes, they do not necessarily have the training required to install an exper- Figure 2: Proxy evidence for an AI Knowledge Gap: the number of AI agents built grows faster than the studies that characterize those agents’ behavior. imental AI system from Github or to invoke a corporate API directly. These dynamics have caused the study of existing AI systems to severely lag behind the production of new systems, as shown in Figure 2. To estimate the pace of algorithm development in machine learning and artificial intelligence, we study the full set of 7,241 conference papers from the Neural Information Processing Systems (NIPS) Conference from 1987 to 2017. To count the number of papers introducing new computational models, we search through abstracts and count the number of papers that contain any of the words ‘new’, ‘novel’, ‘we propose’, and ‘we introduce’ in their abstract. To count the papers aimed solely at studying previous models, we count the number of papers that include any of the terms ‘we study’, ‘we examine’, ‘we compare’ and ‘we analyze’ in their abstract, but none of the keywords used to count new models. As discussed above, the key bottleneck in the study of the behavior of AI systems is a misalignment of incentives. To address these concerns, we propose TuringBox, a market platform that provides access to and incentive for the study of AI behavior. 3 TuringBox: A Market for the Behavioral Research of AI Systems In order to address the above challenges of accessibility, replication, and incentive incompatibility, a general tool for the rigorous study of AI systems must satisfy many properties. Drawing from the literature of existing platforms for AI research, we enumerate these desirable properties below: 1. Customizable Metrics: The platform should allow for the creation of custom evaluation metrics to evaluate AI systems, and the customizable selection of subsets of stimuli (data samples or environments). For instance, users might wish to evaluate custom metrics of fairness, precision, and accuracy on a variety of algorithms for a particular task, or to evaluate algorithms on a variety of subsets of stimuli. 2. Centralized Implementation: Scientists on the platform should be able to evaluate the exact implementation on any arbitrary input sample, along with explicitly outlined hyperparameter settings that produced the model. This property has been adopted by platforms such as ParlAI [Miller et al., 2017] and Algorithmia. 3. Centralized Evaluation: The platform should unify several different benchmarks that exist across communities in a centralized computing environment, without replicating the benchmarks locally. Such an evaluation system has already been adopted by platforms such as ParlAI [Miller et al., 2017], Algorithmia and OpenML [Vanschoren et al., 2014]. 4. General Compatibility: The platform should have a consistent, generalizable method to include newer AI problems and have support for all existing AI problems of interest. This property is essential to understand the behavior of classes of algorithms across different tasks and environments, and provides a cohesive framework for the study of AI behavior across different classes of algorithms. 5. Full Scope: AI systems of interest can be accessed at three different scopes. The first scope consists of algorithms whose code is readily available and can be accessed directly from a scientist’s local machine or from a centralized platform’s servers. The second scope includes algorithms that are accessible only from remote servers via API calls. The third scope contains remotely served algorithms that do not have an explicit API protocol, and thus must be observed “in the field,” via custom scripts, as exemplified in Hannak et al. A sufficient platform for the behavioral study of AI should provide functionality for each scope. With these properties in mind, we envision a two-sided digital marketplace, called TuringBox, that couples two previously orthogonal threads of AI research by convening two communities (see Fig 3). On one side of the market, AI contributors upload existing and novel algorithms to both benchmark their algorithms with respect to performance, fairness, or other qualities and to gain reputation in their community. These contributors will be incentivized to upload not only algorithms they wrote themselves, but also protocols that access APIs and algorithms “in the field.” On the other side of the market, AI examiners develop and post tasks designed to examine and characterize algorithmic behavior. We anticipate that this methodological tool will attract not just computer scientists but will also be of interest to experts in experimentation across the social and behavioral sciences, thus mitigating the AI Knowledge Gap. Notable examples of AI platforms include the DeepMind PyschLab [Leibo et al., 2018], a fully 3D game-like platform for agent-based AI research, ParlAI [Miller et al., 2017], a unified framework for the evaluation of dialog models with Figure 3: A schematic of the marketplace for AI. additional support for images, CloudCV [Agrawal et al., 2015], an open-source platform for machine learning and computer vision, and OpenML [Vanschoren et al., 2014], an online machine learning platform for sharing and organizing data and machine learning algorithms. Each platform satisfies some of the properties listed above, and we map these platforms to properties in Table 2. 3.1 Incentive Scheme In our proposed market, both sides are driven by exogenous and endogenous incentives rather than money. The implementation is engineered to best serve the unique interests of both types of users. Below we discuss how each side of the market incentivizes use by the other. Incentives of examiners As AI systems further permeate society, we envision increasing demand for the examination of the behaviors of these systems. The recent increase in studies on algorithmic bias [Hajian et al., 2016] as well as the success of interdisciplinary conferences such as Fairness, Accountability, and Transparency or the International Conference on Computational Social Science already suggest an interest from the social science community. In addition to understanding bias, examiners may also be able to learn about the origins and structure of complex human behavior, such as strategy formation, as was the case with AlphaGo Zero [Silver et al., 2016]. However, accessibility is a key concern preventing examiners from studying existing systems. Many social scientists have limited programming or computer science backgrounds and cannot implement state of the art AI systems to study. To address this concern, we employ the second side of the market (the contributors) who upload their AI systems to the platform. Examiners can then access these systems from a central source without added expertise. Incentives of the contributors TuringBox motivates a large group of people – the contributors – to populate the platform with algorithms to study. These contributors are AI researchers in academia and industry as well as other individuals that possess the skills to design and implement AI systems. TuringBox will motivate contributors to upload their own systems by addressing several concerns in the AI community. Customizable Metrics Platform Centralized Implementation Centralized Evaluation General Compatibility Full Scope Algorithmia CloudCV DeepMind PsychLab FairML OpenML ParlAI Themis-ML TuringBox Table 2: Platforms for the study of AI and their corresponding properties. Importantly, the platform will assist with the problem of reproducibility. When contributors upload their new systems, all other contributors will then be able to access and test these new systems. Having the designers of the algorithms themselves upload their algorithm is important for two reasons. First, it prevents issues from arising due to differences in implementations. Secondly, it ensures that the algorithm designers have responsibility for the performance of the algorithm and any subsequent aberrant behavior it may exhibit. Further, TuringBox will ease access to benchmarking tools. With so many AI systems on the platform, contributors will be able to easily compare their system’s performance to the performance of other state of the art systems. Moreover, by incorporating social scientists on the examiner side of the market, TuringBox will allow researchers to measure their systems using new social metrics, such as fairness. As examiners study an increasing number of AI systems, we anticipate they will produce new ways to measure the biases or behaviors of AI systems, which contributors can then use to ensure their systems operate as expected. In addition to individual contributors, companies may also be interested in filling the contributor side of the market via APIs to demonstrate the performance of their proprietary algorithms and that their algorithms are, for example, bias-free. 4 Discussion Because of AI systems’ emergent complexity, their ubiquity in society, and their inherent opacity, there is a need to map the boundaries of AI research, and to extend them when possible. Our examination suggests there is untapped potential for the hypothesis driven scientific investigation of AI systems. It is useful to think of AI systems not solely as engineering artifacts, but rather as a new class of protocols with heterogeneous behavior. In order to keep up with the proliferation of these systems and to close the AI Knowledge Gap, AI scientists must start to emphasize the generation of knowledge about how these systems behave both in the lab and in the field. This can be achieved by broadening the scope of AI research and opening access to the study of AI behavior to scientists from other disciplines. We believe a market for the study of machine behavior is crucial to reach these goals for several reasons. The first is that it offers a general yet unified framework for understanding when bias occurs in complex architectures. Many studies across computer science, behavioral economics, and legal studies have already investigated the behavior of AI systems but each uses an ad hoc approach to collecting data and measuring behavior. Our market provides a toolkit for examining behavior across a population of AI systems, which enables a scalable and flexible alternative to costly algorithmic audits. As an increasing number of AI systems are deployed every day, and their real world stakes increase, a consistent methodology to perform these algorithmic audits at scale becomes imperative. The second rationale for the TuringBox platform is that it helps bridge the gap between computer scientists and social scientists. Historically, computer scientists and roboticists were the only ones concerned with the behavior of machines, because they were the only ones interacting with the systems. However, social sciences offer many key skills, methods, and perspectives about AI systems that are not being fully leveraged in the AI research community. Finally, this framing can potentially curb adversarial effects of emergent superintelligences by providing a controlled environment to examine their behaviors [Bostrom, 1998]. Indeed this market anticipates a future where the AI systems that inhabit it exhibit the complex, cross-domain behaviors of artificial general intelligence. Amazon’s Mechanical Turk created a revolution for the social sciences by scaling the way social scientists perform experiments [Buhrmester et al., 2011; Horton et al., 2011]. For the first time, scientists could cheaply run massive online experiments and learn about individual and collective behavior without recruiting subjects to a physical location. By lowering the barrier to entry for experimentation, the market was successful in both opening up new methodologies and democratizing research to a broad class of scientists. As a behavioral science of AI systems becomes conceivable, we believe the next revolution in AI experimentation will come from standardizing experimental protocols while keeping the hetero- geneity of these systems wide open. References [Agrawal et al., 2015] Harsh Agrawal, Clint Solomon Mathialagan, Yash Goyal, Neelima Chavali, Prakriti Banik, Akrit Mohapatra, Ahmed Osman, and Dhruv Batra. Cloudcv: Large-scale distributed computer vision as a cloud service. In Mobile cloud visual media computing, pages 265–290. Springer, 2015. [Bennett and Lanning, 2007] James Bennett and Stan Lanning. The netflix prize. Proceedings of KDD Cup and Workshop, 2007. [Berk, 2012] Richard Berk. Criminal justice forecasts of risk a machine learning approach. 2012. [Bonnefon et al., 2016] Jean-François Bonnefon, Azim Shariff, and Iyad Rahwan. The social dilemma of autonomous vehicles. Science, 352(6293):1573–1576, 2016. [Bostrom, 1998] Nick Bostrom. How long before superintelligence? 1998. [Bowling et al., 2015] Michael Bowling, Neil Burch, Michael Johanson, and Oskari Tammelin. Heads-up limit hold’em poker is solved. Science, 347(6218):145–149, 2015. [Buhrmester et al., 2011] Michael Buhrmester, Tracy Kwang, and Samuel D Gosling. Amazon’s mechanical turk: A new source of inexpensive, yet high-quality, data? Perspectives on psychological science, 6(1):3–5, 2011. [Buolamwini and Gebru, 2018] Joy Buolamwini and Timnit Gebru. Gender shades: Intersectional accuracy disparities in commercial gender classification. In Conference on Fairness, Accountability and Transparency, pages 77–91, 2018. [Bylander, 1994] Tom Bylander. The computational complexity of propositional strips planning. Artificial Intelligence, 69(1-2):165–204, 1994. [Campbell et al., 2002] Murray Campbell, A Joseph Hoane Jr, and Feng-hsiung Hsu. Deep blue. Artificial intelligence, 134(1-2):57–83, 2002. [Chen et al., 2016] Le Chen, Alan Mislove, and Christo Wilson. An Empirical Analysis of Algorithmic Pricing on Amazon Marketplace. In Proceedings of the International World Wide Web Conference (WWW’16), Montréal, Canada, Apr 2016. [Cohen, 1995] Paul R Cohen. Empirical methods for artificial intelligence, volume 139. MIT press Cambridge, MA, 1995. [Davis and Goadrich, 2006] Jesse Davis and Mark Goadrich. The relationship between precision-recall and roc curves. In Proceedings of the 23rd international conference on Machine learning, pages 233–240. ACM, 2006. [Ferrara et al., 2016] Emilio Ferrara, Onur Varol, Clayton Davis, Filippo Menczer, and Alessandro Flammini. The rise of social bots. Commun. ACM, 59(7):96–104, June 2016. [Friedman and Nissenbaum, 1996] Batya Friedman and Helen Nissenbaum. Bias in computer systems. ACM Trans. Inf. Syst., 14(3):330–347, July 1996. [Hajian et al., 2016] Sara Hajian, Francesco Bonchi, and Carlos Castillo. Algorithmic bias: From discrimination discovery to fairness-aware data mining. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pages 2125–2126. ACM, 2016. [Hannak et al., 2014] Aniko Hannak, Gary Soeller, David Lazer, Alan Mislove, and Christo Wilson. Measuring Price Discrimination and Steering on E-commerce Web Sites. In Proceedings of the ACM Internet Measurement Conference (IMC’14), Vancouver, Canada, Nov 2014. [Hilbert, 1928] David Hilbert. Die grundlagen der mathematik. In Die Grundlagen der Mathematik, pages 1–21. Springer, 1928. [Horton et al., 2011] John J Horton, David G Rand, and Richard J Zeckhauser. The online laboratory: Conducting experiments in a real labor market. Experimental economics, 14(3):399–425, 2011. [Hutson, 2018] Matthew Hutson. Artificial intelligence faces reproducibility crisis, 2018. [Jackson, 1998] Peter Jackson. Introduction to expert systems. Addison-Wesley Longman Publishing Co., Inc., 1998. [Jaffar and Maher, 1994] Joxan Jaffar and Michael J Maher. Constraint logic programming: A survey. The journal of logic programming, 19:503–581, 1994. [Kaggle, 2013] Kaggle. 2013. [Kakas et al., 1992] Antonis C. Kakas, Robert A. Kowalski, and Francesca Toni. Abductive logic programming. Journal of logic and computation, 2(6):719–770, 1992. [Kautz et al., 1992] Henry A Kautz, Bart Selman, et al. Planning as satisfiability. In ECAI, volume 92, pages 359–363. Citeseer, 1992. [Kitano et al., 1997] Hiroaki Kitano, Minoru Asada, Yasuo Kuniyoshi, Itsuki Noda, and Eiichi Osawa. Robocup: The robot world cup initiative. In Proceedings of the first international conference on Autonomous agents, pages 340– 347. ACM, 1997. [Larson et al., 2016] J Larson, S Mattu, L Kirchner, and J Angwin. How we analyzed the compas recidivism algorithm. propublica, 2016. [Larson et al., 2017] J Larson, J Angwin, L Kirchner, and S Mattu. How we examined racial discrimination in auto insurance prices. propublica, 2017. [Leibniz, 1685] Gottfried Leibniz. The art of discovery. In Leibniz: Selections. Scribner, 1951, 1685. [Leibo et al., 2018] Joel Z Leibo, Cyprien de Masson d’Autume, Daniel Zoran, David Amos, Charles Beattie, Keith Anderson, Antonio Garcı́a Castañeda, Manuel Sanchez, Simon Green, Audrunas Gruslys, et al. Psychlab: A psychology laboratory for deep reinforcement learning agents. arXiv preprint arXiv:1801.08116, 2018. [Lenat et al., 1985] Douglas B Lenat, Mayank Prakash, and Mary Shepherd. Cyc: Using common sense knowledge to overcome brittleness and knowledge acquisition bottlenecks. AI magazine, 6(4):65, 1985. [Lin et al., 2014] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014. [Littman, 1994] Michael L Littman. Markov games as a framework for multi-agent reinforcement learning. In Machine Learning Proceedings 1994, pages 157–163. Elsevier, 1994. [McCarthy, 1981] John McCarthy. Circumscription—a form of non-monotonic reasoning. In Readings in Artificial Intelligence, pages 466–472. Elsevier, 1981. [McCarthy, 1986] John McCarthy. Applications of circumscription to formalizing common-sense knowledge. Artificial Intelligence, 28(1):89–116, 1986. [Miller et al., 2017] Alexander H Miller, Will Feng, Adam Fisch, Jiasen Lu, Dhruv Batra, Antoine Bordes, Devi Parikh, and Jason Weston. Parlai: A dialog research software platform. arXiv preprint arXiv:1705.06476, 2017. [Mnih et al., 2015] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015. [Newell et al., 1959] Allen Newell, John C Shaw, and Herbert A Simon. Report on a general problem solving program. In IFIP congress, volume 256, page 64, 1959. [O’Neil, 2017] Cathy O’Neil. Weapons of math destruction: How big data increases inequality and threatens democracy. Broadway Books, 2017. [Papineni et al., 2002] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pages 311–318. Association for Computational Linguistics, 2002. [Pearl, 1986] Judea Pearl. Fusion, propagation, and structuring in belief networks. Artificial intelligence, 29(3):241– 288, 1986. [Russakovsky et al., 2015] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015. [Schaeffer et al., 2007] Jonathan Schaeffer, Neil Burch, Yngvi Björnsson, Akihiro Kishimoto, Martin Müller, Robert Lake, Paul Lu, and Steve Sutphen. Checkers is solved. science, 317(5844):1518–1522, 2007. [Silver et al., 2016] David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016. [Sussman and Winograd, 1970] Gerald Sussman and Terry Winograd. Micro-planner reference manual. 1970. [Sutton and Barto, 1998] Richard S Sutton and Andrew G Barto. Introduction to reinforcement learning, volume 135. MIT press Cambridge, 1998. [Sweeney, 2013] Latanya Sweeney. Discrimination in online ad delivery. Queue, 11(3):10, 2013. [Tay and Ho, 1992] Danny P.H. Tay and David K.H. Ho. Artificial intelligence and the mass appraisal of residential apartments. Journal of Property Valuation and Investment, 10(2):525–540, 1992. [Turing, 1950] Alan M Turing. Computing machinery and intelligence. Mind, pages 433–460, 1950. [Van De Sande et al., 2010] Koen Van De Sande, Theo Gevers, and Cees Snoek. Evaluating color descriptors for object and scene recognition. IEEE transactions on pattern analysis and machine intelligence, 32(9):1582–1596, 2010. [Van Emden and Kowalski, 1976] Maarten H Van Emden and Robert A Kowalski. The semantics of predicate logic as a programming language. Journal of the ACM (JACM), 23(4):733–742, 1976. [Vanschoren et al., 2014] Joaquin Vanschoren, Jan N Van Rijn, Bernd Bischl, and Luis Torgo. Openml: networked science in machine learning. ACM SIGKDD Explorations Newsletter, 15(2):49–60, 2014. [Vapnik, 1999] Vladimir Naumovich Vapnik. An overview of statistical learning theory. IEEE transactions on neural networks, 10(5):988–999, 1999. [Voosen, 2017] Paul Voosen. The ai detectives. Science, 357(6346):22–27, 2017. [Wellman et al., 2001] Michael P. Wellman, Peter R. Wurman, Kevin O’Malley, Roshan Bangera, Daniel Reeves, William E Walsh, et al. Designing the market game for a trading agent competition. IEEE Internet Computing, 5(2):43–51, 2001. [Wielinga et al., 1992] Bob J Wielinga, A Th Schreiber, and Jost A Breuker. KADS: A modelling approach to knowledge engineering. Knowledge acquisition, 4(1):5–53, 1992. [Zhou et al., 2017] Zhiming Zhou, Weinan Zhang, and Jun Wang. Inception score, label smoothing, gradient vanishing and-log (d (x)) alternative. arXiv preprint arXiv:1708.01729, 2017.
2cs.AI
Single Shot Temporal Action Detection 1 Department Tianwei Lin1 , Xu Zhao1,3, *, Zheng Shou2 of Automation, Shanghai Jiao Tong University, China. 2 Columbia University, USA Medianet Innovation Center (CMIC), Shanghai Jiao Tong University, China {wzmsltw,zhaoxu}@sjtu.edu.cn,[email protected] 3 Cooperative arXiv:1710.06236v1 [cs.CV] 17 Oct 2017 ABSTRACT Temporal action detection is a very important yet challenging problem, since videos in real applications are usually long, untrimmed and contain multiple action instances. This problem requires not only recognizing action categories but also detecting start time and end time of each action instance. Many state-of-the-art methods adopt the "detection by classification" framework: first do proposal, and then classify proposals. The main drawback of this framework is that the boundaries of action instance proposals have been fixed during the classification step. To address this issue, we propose a novel Single Shot Action Detector (SSAD) network based on 1D temporal convolutional layers to skip the proposal generation step via directly detecting action instances in untrimmed video. On pursuit of designing a particular SSAD network that can work effectively for temporal action detection, we empirically search for the best network architecture of SSAD due to lacking existing models that can be directly adopted. Moreover, we investigate into input feature types and fusion strategies to further improve detection accuracy. We conduct extensive experiments on two challenging datasets: THUMOS 2014 and MEXaction2. When setting Intersection-over-Union threshold to 0.5 during evaluation, SSAD significantly outperforms other state-of-the-art systems by increasing mAP from 19.0% to 24.6% on THUMOS 2014 and from 7.4% to 11.0% on MEXaction2. CCS CONCEPTS • Computing methodologies → Activity recognition and understanding; KEYWORDS Temporal Action Detection, Untrimmed Video, SSAD network 1 INTRODUCTION Due to the continuously booming of videos on the internet, video content analysis has attracted wide attention from both industry and academic field in recently years. An important branch of video content analysis is action recognition, which usually aims at classifying the categories of manually trimmed video clips. Substantial This research has been supported by the funding from NSFC (61673269, 61273285) and the Cooperative Medianet Innovation Center (CMIC). * Corresponding author. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. MM ’17, Mountain View, CA, USA © 2017 ACM. 978-1-4503-4906-2/17/10. . . $15.00 DOI: 10.1145/3123266.3123343 Figure 1: Overview of our system. Given an untrimmed long video, (1) we extract Snippet-level Action Score features sequence with multiple action classifiers; (2) SSAD network takes feature sequence as input and directly predicts multiple scales action instances without proposal generation step. progress has been reported for this task in [6, 24, 36, 38, 40]. However, most videos in real world are untrimmed and may contain multiple action instances with irrelevant background scenes or activities. This problem motivates the academic community to put attention to another challenging task - temporal action detection. This task aims to detect action instances in untrimmed video, including temporal boundaries and categories of instances. Methods proposed for this task can be used in many areas such as surveillance video analysis and intelligent home care. Temporal action detection can be regarded as a temporal version of object detection in image, since both of the tasks aim to determine the boundaries and categories of multiple instances (actions in time/ objects in space). A popular series of models in object detection are R-CNN and its variants [8, 9, 27], which adopt the "detect by classifying region proposals" framework. Inspired by R-CNN, recently many temporal action detection approaches adopt similar framework and classify temporal action instances generated by proposal method [3, 5, 29, 43] or simple sliding windows method [15, 23, 39]. This framework may has some major drawbacks: (1) proposal generation and classification procedures are separate and have to be trained separately, but ideally we want to train them in a joint manner to obtain an optimal model; (2) the proposal generation method or sliding windows method requires additional time consumption; (3) the temporal boundaries of action instances generated by the sliding windows method are usually approximative rather than precise and left to be fixed during classification. Also, since the scales of sliding windows are pre-determined, it is not flexible to predict instances with various scales. To address these issues, we propose the Single Shot Action Detector (SSAD) network, which is a temporal convolutional network conducted on feature sequence with multiple granularities. Inspired by another set of object detection methods - single shot detection models such as SSD [20] and YOLO [25, 26], our SSAD network skips the proposal generation step and directly predicts temporal boundaries and confidence scores for multiple action categories, as shown in Figure 1. SSAD network contains three sub-modules: (1) base layers read in feature sequence and shorten its temporal length; (2) anchor layers output temporal feature maps, which are associated with anchor action instances; (3) prediction layers generate categories probabilities, location offsets and overlap scores of these anchor action instances. For better encoding of both spatial and temporal information in video, we adopt multiple action recognition models (action classifiers) to extract multiple granularities features. We concatenate the output categories probabilities from all action classifiers in snippetlevel and form the Snippet-level Action Score (SAS) feature. The sequences of SAS features are used as input of SSAD network. Note that it is non-trivial to adapt the single shot detection model from object detection to temporal action detection. Firstly, unlike VGGNet [31] being used in 2D ConvNet models, there is no existing widely used pre-trained temporal convolutional network. Thus in this work, we search multiple network architectures to find the best one. Secondly, we integrate key advantages in different single shot detection models to make our SSAD network work the best. On one hand, similar to YOLO9000 [26], we simultaneously predict location offsets, categories probabilities and overlap score of each anchor action instance. On the other hand, like SSD [20], we use anchor instances of multiple scale ratios from multiple scales feature maps, which allow network flexible to handle action instance with various scales. Finally, to further improve performance, we fuse the prediction categories probability with temporal pooled snippetlevel action scores during prediction. The main contributions of our work are summarized as follows: (1) To the best of our knowledge, our work is the first Single Shot Action Detector (SSAD) for video, which can effectively predict both the boundaries and confidence score of multiple action categories in untrimmed video without the proposal generation step. (2) In this work, we explore many configurations of SSAD network such as input features type, network architectures and postprocessing strategy. Proper configurations are adopted to achieve better performance for temporal action detection task. (3) We conduct extensive experiments on two challenging benchmark datasets: THUMOS’14 [14] and MEXaction2 [1]. When setting Intersection-over-Union threshold to 0.5 during evaluation, SSAD significantly outperforms other state-of-the-art systems by increasing mAP from 19.0% to 24.6% on THUMOS’14 and from 7.4% to 11.0% on MEXaction2. 2 RELATED WORK Action recognition. Action recognition is an important research topic for video content analysis. Just as image classification network can be used in image object detection, action recognition models can be used in temporal action detection for feature extraction. We mainly review the following methods which can be used in temporal action detection. Improved Dense Trajectory (iDT) [37, 38] feature is consisted of MBH, HOF and HOG features extracted along dense trajectories. iDT method uses SIFT and optical flow to eliminate the influence of camera motion. Two-stream network [6, 30, 40] learns both spatial and temporal features by operating network on single frame and stacked optical flow field respectively using 2D Convolutional Neural Network (CNN) such as GoogleNet [35], VGGNet [31] and ResNet [12]. C3D network [36] uses 3D convolution to capture both spatial and temporal information directly from raw video frames volume, and is very efficient. Feature encoding methods such as Fisher Vector [38] and VAE [24] are widely used in action recognition task to improve performance. And there are many widely used action recognition benchmark such as UCF101 [34], HMDB51 [18] and Sports-1M [16]. Temporal action detection. This task focuses on learning how to detect action instances in untrimmed videos where the boundaries and categories of action instances have been annotated. Typical datasets such as THUMOS 2014 [14] and MEXaction2 [1] include large amount of untrimmed videos with multiple action categories and complex background information. Recently, many approaches adopt "detection by classification" framework. For examples, many approaches [15, 23, 33, 39, 41] use extracted feature such as iDT feature to train SVM classifiers, and then classify the categories of segment proposals or sliding windows using SVM classifiers. And there are some approaches specially proposed for temporal action proposal [3, 5, 7, 22, 43]. Our SSAD network differs from these methods mainly in containing no proposal generation step. Recurrent Neural Network (RNN) is widely used in many action detection approaches [21, 32, 42, 44] to encode feature sequence and make per-frame prediction of action categories. However, it is difficult for RNNs to keep a long time period memory in practice [32]. An alternative choice is temporal convolution. For example, Lea et al. [19] proposes Temporal Convolutional Networks (TCN) for temporal action segmentation. We also adopt temporal convolutional layers, which makes our SSAD network can handle action instances with a much longer time period. Object detection. Deep learning approaches have shown salient performance in object detection. We will review two main set of object detection methods proposed in recent years. The representative methods in first set are R-CNN [9] and its variations [8, 27]. R-CNN uses selective search to generate multiple region proposals then apply CNN in these proposals separately to classify their categories; Fast R-CNN [8] uses a 2D RoI pooling layer which makes feature map be shared among proposals and reduces the time consumption. Faster RCNN [27] adopts a RPN network to generate region proposal instead of selective search. Another set of object detection methods are single shot detection methods, which means detecting objects directly without generating proposals. There are two well known models. YOLO [25, 26] uses the whole topmost feature map to predict probabilities of multiple categories and corresponding confidence scores and location offsets. SSD [20] makes prediction from multiple feature map with multiple scales default boxes. In our work, we combine the characteristics of these single shot detection methods and embed them into the proposed SSAD network. Figure 2: The framework of our approach. (a) Multiple action classifiers are used to extract Snippet-level Action Scores (SAS) feature. (b) The architecture of SSAD network: base layers are used to reduce the temporal dimension of input data; anchor layers output multiple scale feature map associated with anchor instances and prediction layers are used for predicting categories, location and confidence of anchor instances. (c) The training and prediction procedures: during training, we match anchor instances with ground truth instances and calculate loss function for optimization. During prediction, post-processing and NMS procedure are conducted on anchor instances to make final prediction. 3 OUR APPROACH In this section, we will introduce our approach in details. The framework of our approach is shown in Figure 2. 3.1 Problem Definition v We denote a video as Xv = {x t }Tt =1 where Tv is the number of frames in Xv and x t is the t-th frame in Xv . Each untrimmed video Xv is annotated with a set of temporal action instances   Nv Φv = ϕ n = φ n , φ n0 , kn n=1 , where Nv is the number of temporal action instances in Xv , and φ n , φ n0 , kn are starting time, ending time and category of action instance ϕ n respectively. kn ∈ {1, ..., K } where K is the number of action categories. Φv is given during training procedure and need to be predicted during prediction procedure. 3.2 Extracting of Snippet-level Action Scores To apply SSAD model, first we need to make snippet-level action classification and get Snippet-level Action Score (SAS) features. Given a video Xv , a snippet st = (x t , Ft , X t ) is composed by three parts: x t is the t-th frame in Xv , Ft = { ft 0 }tt 0+5 =t −4 is stacked optical flow field derived around x t and X t = {x t 0 }tt 0+8 =t −7 is video frames volume. So given a video Xv , we can get a sequence of snippets v Sv = {st }Tt =1 . We pad the video Xv in head and tail with first and last frame separately to make Sv have the same length as Xv . Action classifier. To evaluate categories probability of each snippet, we use multiple action classifiers with commendable performance in action recognition task: two-stream network [30] and C3D network [36]. Two-stream network includes spatial and temporal networks which operate on single video frame x t and stacked optical flow field Ft respectively. We use the same two-stream network architecture as described in [40], which adopts VGGNet-16 network architecture. C3D network is proposed in [36], including multiple 3D convolution layers and 3D pooling layers. C3D network operates on short video frames volume X t with length l, where l is the length of video clip and is set to 16 in C3D. So there are totally three individual action classifiers, in which spatial network measures the spatial information, temporal network measures temporal consistency and C3D network measures both. In section 4.3, we evaluate the effect of each action classifier and their combinations. SAS feature. As shown in Figure 2(a), given a snippet st , each action classifier can generate a score vector p t with length K 0 = K + 1, where K 0 includes K action categories and one background category. Then we concatenate output scores of each classifiers to Action Score (SAS) feature psas,t =  form the Snippet-level  p S,t , pT ,t , pC ,t , where p S,t , pT ,t , pC ,t are output score of spatial, temporal and C3D network separately. So given a snippets sequence Sv with length Tv , we can extract a SAS feature sequence  Tv Pv = psas,t t =1 . Since the number of frames in video is uncertain and may be very large, we use a large observation window with length We denote a window as  Tw to0 truncate the feature sequence. 0 are starting and ending ω = φω , φω , Pω , Φω , where φ ω and φ ω time of ω, Pω and Φω are SAS feature sequence and corresponding ground truth action instances separately. 3.3 SSAD Network Temporal action detection is quite different from object detection in 2D image. In SSAD we adopt two main characteristics from single shot object detection models such as SSD [20] and YOLO [25, 26]: 1) unlike "detection by classification" approaches, SSAD directly predicts categories and location offsets of action instances in untrimmed video using convolutional prediction layers; 2) SSAD combine temporal feature maps from different convolution layers for prediction, making it possible to handle action instances with various length. We first introduce the network architecture. Network architecture. The architecture of SSAD network is presented in Figure 2(b), which mainly contains three sub-modules: base layers, anchor layers and prediction layers. Base layers handle the input SAS feature sequence, and use both convolution and pooling layer to shorten the temporal length of feature map and increase the size of receptive fields. Then anchor layers use temporal convolution to continually shorten the feature map and output anchor feature map for action instances prediction. Each cell of anchor layers is associated with anchor instances of multiple scales. Finally, we use prediction layers to get classification score, overlap score and location offsets of each anchor instance. In SSAD network, we adopt 1D temporal convolution and pooling to capture temporal information. We conduct Rectified Linear Units (ReLu) activation function [11] to output temporal feature map except for the convolutional prediction layers. And we adopt temporal max pooling since max pooling can enhance the invariance of small input change. Base layers. Since there are no widely used pre-trained 1D ConvNet models such as the VGGNet [31] used in 2D ConvNet models, we search many different network architectures for SSAD network. These architectures only differ in base layers while we keep same architecture of anchor layers and prediction layers. As shown in Figure 3, we totally design 5 architectures of base layers. In these architectures, we mainly explore three aspects: 1) whether use convolution or pooling layer to shorten the temporal dimension and increase the size of receptive fields; 2) number of layers of network and 3) size of convolution layer’s kernel. Notice that we set the number of convolutional filter in all base layers to 256. Evaluation results of these architectures are shown in section 4.3, and finally we adopt architecture B which achieves the best performance. Multi-scale anchor layers. After processing SAS feature sequence using base layers, we stack three anchor convolutional layers (Conv-A1, Conv-A2 and Conv-A3) on them. These layers have same configuration: kernel size 3, stride size 2 and 512 convolutional filters. The output anchor feature maps of anchor layers are f A1 , f A2 and f A3 with size (Tw /32 × 512), (Tw /64 × 512) and (Tw /128 × 512) separately. Multiple anchor layers decrease temporal dimension of feature map progressively and allow SSAD get predictions from multiple resolution feature map. Figure 3: Multiple architectures of base layers. Input and output sizes are same for each architecture. Parameter of layer is shown with the format of kernel/stride. All convolutional layers have 512 convolutional filters. Evaluation results of these architectures are shown in section 4.3, and we adopt architecture B which achieves the best performance. For each temporal feature map of anchor layers, we associate a set of multiple scale anchor action instances with each feature map cell as shown in Figure 4. For each anchor instance, we use convolutional prediction layers to predict overlap score, classification score and location offsets, which will be introduced later. In term of the details of multi-scale anchor instances, the lower anchor feature map has higher resolution and smaller receptive field than the top anchor feature map. So we let the lower anchor layers detect short action instances and the top anchor layers detect long action instances. For a temporal feature map f of anchor layer with length M, we define base scale s f = M1 and a set of scale D f ratios R f = {rd }d =1 , where D f is the number of scale ratios. We use {1, 1.5, 2} for f A1 and {0.5, 0.75, 1, 1.5, 2} for f A2 and f A3 . For each ratio rd , we calculate µw = s f · rd as anchor instance’s default width. And all anchor instances associated with the m-th feature map cell share the same default center location µc = m+0.5 M . So for an anchor feature map f with length M f and D f scale ratios, the number of associated anchor instances is M f · D f . Prediction layers. We use a set of convolutional filters to predict classification scores, overlap scores and location offsets of anchor instances associated with each feature map cell. As shown in Figure 4, for an anchor feature map f with length M f and D f scale ratios, we use D f · (K 0 + 3) temporal convolutional filters with kernel size 3, stride  size 1 for prediction.  The output of pre- diction layer has size M f × D f · (K 0 + 3) and can be reshaped    into M f · D f × (K 0 + 3) . Each anchor instance gets a prediction  score vector ppr ed = pc l ass , pover , ∆c, ∆w with length (K 0 + 3), where pc l ass is classification score vector with length K 0 , pover is overlap score and ∆c, ∆w are location offsets. Classification score pcl ass is used to predict anchor instance’s category. Overlap score pover is used to estimate the overlap between anchor instance and ground truth instances and should have value between [0, 1], so it is normalized by using sigmoid function: 0 pover = siдmoid(pover ). (1) Figure 4: Anchor instances and prediction layer in temporal feature map. In feature map of a anchor layer, we associate a set of multiple scale anchor instances with each feature map cell. We use convolutional prediction layer to predict location offset, confidence and classification scores simultaneously for each anchor instance. And location offsets ∆c, ∆w are used for adjusting the default location of anchor instance. The adjusted location is defined as: φc = µc + α 1 · µw · ∆c φw = µw · exp(α 2 · ∆w), (2) where φc and φw are center location and width of anchor instance respectively. α 1 and α 2 are used for controlling the effect of location offsets to make prediction stable. We set both α 1 and α 2 to 0.1. The starting and ending time of action instance are φ = φc − 12 · φw and φ 0 = φc + 12 ·φw respectively. So for a anchor feature map f , we can   Nf 0 get a anchor instances set Φf = ϕ n = φc , φw , pcl ass , pover n=1 , where N f = M f · D f is the number of anchor instances. And the  total prediction instances set is Φp = Φf A1 , Φf A2 , Φf A3 . 3.4 regard it as positive, otherwise negative. We expand ϕ n with match 0 ing information as ϕ n0 = φc , φw , pc l ass , pover , kд , дiou , дc , дw , where kд is the category of ϕд and is set to 0 for negative instance, дiou is the IoU overlap between ϕ n and ϕд , дc and дw are center location and width of ϕд respectively. So a ground truth instance can match multiple anchor instances while a anchor instance can only match one ground truth instance at most. Hard negative mining. During label assignment, only a small part of anchor instances match the ground truth instances, causing an imbalanced data ratio between the positive and negative instances. Thus we adopt the hard negative mining strategy to reduce the number of negative instances. Here, the hard negative instances are defined as negative instances with larger overlap score than 0.5. We take all hard negative instances and randomly sampled negative instances in remaining part to make the ratio between positive and negative instances be nearly 1:1. This ratio is chosen by empirical validation. So after label assignment and hard negative  N t r ain mining, we get Φp0 = ϕ n0 n=1 as the input set during training, where Nt r ain is the number of total training instances and is the sum of the number of positives Npos and negatives Nneд . Objective for training. The training objective of the SSAD network is to solve a multi-task optimization problem. The overall loss function is a weighted sum of the classification loss (class), the overlap loss (conf), the detection loss (loc) and L2 loss for regularization: Training of SSAD network Training data construction. As described in Section 3.2, for an untrimmed video Xv with length Tv , we get SAS features sequence Pv with same length. Then we slide window of length Tw in feature sequence with 75% overlap. The overlap of sliding window is aim to handle the situation where action instances locate in boundary of window and also used to increase the amount of training data. During training, we only keep windows containing at least one ground-truth instance. So given a set of untrimmed training videos, Nω we get a training set Ω = {ωn }n=1 , where N ω is the number of windows. We randomly shuffle the data order in training set to make the network converge faster, where same random seed is used during evaluation. Label assignment. During training, given a window ω, we can get prediction instances set Φp via SSAD network. We need to match them with ground truth set Φω for label assignment. For an anchor instance ϕ n in Φp , we calculate it’s IoU overlap with all ground truth instances in Φω . If the highest IoU overlap is higher than 0.5, we match ϕ n with corresponding ground truth instance ϕд and L = Lcl ass + α · Lover + β · Lloc + λ · L 2 (Θ), (3) where α, β and λ are the weight terms used for balancing each part of loss function. Both α and β are set to 10 and λ is set to 0.0001 by empirical validation. For the classification loss, we use conventional softmax loss over multiple categories, which is effective for training classification model and can be defined as: Lcl ass = Lsof tmax = (kд ) where Pi 1 NÕ t r ain Nt r ain i=1 (kд ) (−loд(Pi )), (4) (kд ) exp(pcl as s,i ) = Í (k j ) j exp(pcl as s,i ) and kд is the label of this instance. Lover is used to make a precise prediction of anchor instances’ overlap IoU score, which helps the procedure of NMS. The overlap loss adopts the mean square error (MSE) loss and be defined as: Lover = 1 NÕ t r ain Nt r ain i=1 0 (pover,i − дiou,i ). (5) Lloc is the Smooth L1 loss [8] for location offsets. We regress the center (ϕc ) and width (ϕw ) of predicted instance: Lloc = 1 NÕ pos Npos i=1 (SL 1 (ϕc,i − дc,i ) + SL 1 (ϕw,i − дw,i )), (6) where дc,i and дw,i is the center location and width of ground truth instance. L 2 (Θ) is the L2 regularization loss where Θ stands for the parameter of the whole SSAD network. 3.5 Prediction and post-processing During prediction, we follow the aforementioned data preparation method during the training procedure to prepare test data, with the following two changes: (1) the overlap ratio of window is reduced to 25% to increase the prediction speed and reduce the redundant predictions; (2) instead of removing windows without annotation, we keep all windows during prediction because the removing operation is actually a leak of annotation information. If the length of input video is shorter than Tw , we will pad SAS feature sequence to Tw so that there is at least one window for prediction. Given a Nω video Xv , we can get a set of Ω = {ωn }n=1 . Then we use SSAD network to get prediction anchors of each window and merge these Np prediction as Φp = {ϕ n }n=1 , where Np is the number of prediction instances. For a prediction anchor instance ϕ n in Φp , we calculate the mean Snippet-level Action Score p̄sas among the temporal range of instance and multiple action classifiers. 0 p̄sas = φ Õ  1 p S,t + pT ,t + pC,t , 3 · (φ 0 − φ) t =φ (7) where φ and φ 0 are starting and ending time of prediction anchor instance respectively. Then we fuse categories scores p̄sas and pcl ass with multiplication factor pconf and get the p f inal : 0 p f inal = pover · (pcl ass + p̄sas ) . (8) We choose the maximum dimension kp in p f inal as the category of ϕ n and corresponding score pconf as the confidence score. We  expand ϕ n as ϕ n0 = φc , φw , pconf , kp and get prediction set Φp0 =  0 Np ϕ n n=1 . Then we conduct non-maximum suppress (NMS) in these prediction results to remove redundant predictions with confidence  Np 0 score pconf and get the final prediction instances set Φp00 = ϕ n0 n=1 , where Np 0 is the number of the final prediction anchors. Since there are little overlap between action instances of same category in temporal action detection task, we take a strict threshold in NMS, which is set to 0.1 by empirical validation. 4 EXPERIMENTS 4.1 Dataset and setup THUMOS 2014 [14]. The temporal action detection task of THUMOS 2014 dataset is challenging and widely used. The training set is the UCF-101 [34] dataset including 13320 trimmed videos of 101 categories. The validation and test set contain 1010 and 1574 untrimmed videos separately. In temporal action detection task, only 20 action categories are involved and annotated temporally. We only use 200 validation set videos (including 3007 action instances) and 213 test set videos (including 3358 action instances) with temporal annotation to train and evaluate SSAD network. MEXaction2 [1]. There are two action categories in MEXaction2 dataset: "HorseRiding" and "BullChargeCape". This dataset is consisted of three subsets: YouTube clips, UCF101 Horse Riding clips and INA videos. YouTube and UCF101 Horse Riding clips are trimmed and used for training set, whereas INA videos are untrimmed with approximately 77 hours in total and are divided into training, validation and testing set. Regarding to temporal annotated action instances, there are 1336 instances in training set, 310 instances in validation set and 329 instances in testing set. Evaluation metrics. For both datasets, we follow the conventional metrics used in THUMOS’14, which evaluate Average Precision (AP) for each action categories and calculate mean Average Precision (mAP) for evaluation. A prediction instance is correct if it gets same category as ground truth instance and its temporal IoU with this ground truth instance is larger than IoU threshold θ . Various IoU thresholds are used during evaluation. Furthermore, redundant detections for the same ground truth are forbidden. 4.2 Implementation Details Action classifiers. To extract SAS features, action classifiers should be trained first, including two-stream networks [40] and C3D network [36]. We implement both networks based on Caffe [13]. For both MEXaction and THUMOS’14 datasets, we use trimmed videos in training set to train action classifier. For spatial and temporal network, we follow the same training strategy described in [40] which uses the VGGNet-16 pre-trained on ImageNet [4] to intialize the network and fine-tunes it on training set. And we follow [36] to train the C3D network, which is pretrained on Sports-1M [16] and then is fine-turned on training set. SSAD optimization. For training of the SSAD network, we use the adaptive moment estimation (Adam) algorithm [17] with the aforementioned multi-task loss function. Our implementation is based on Tensorflow [2]. We adopt the Xavier method [10] to randomly initialize parameters of whole SSAD network because there are no suitable pre-trained temporal convolutional network. Even so, the SSAD network can be easily trained with quick convergence since it has a small amount of parameters (20 MB totally) and the input of SSAD network - SAS features are concise high-level feature. The training procedure takes nearly 1 hour on THUMOS’14 dataset. Table 1: mAP results on THUMOS’14 with various IoU threshold θ used in evaluation. θ 0.5 0.4 0.3 0.2 0.1 Karaman et al. [15] Wang et al. [39] Oneata et al. [23] Richard et al. [28] Yeung et al. [42] Yuan et al. [44] Shou et al. [29] Zhu et al. [45] 0.2 8.5 15.0 15.2 17.1 18.8 19.0 19.0 0.3 12.1 21.8 23.2 26.4 26.1 28.7 28.9 0.5 14.6 28.8 30.0 36.0 33.6 36.3 36.2 0.9 17.8 36.2 35.7 44.0 42.6 43.5 43.6 1.5 19.2 39.8 39.7 48.9 51.4 47.7 47.7 SSAD 24.6 35.0 43.0 47.8 50.1 4.3 Comparison with state-of-the-art systems Results on THUMOS 2014. To train action classifiers, we use full UCF-101 dataset. Instead of using one background category, here we form background categories using 81 action categories which are un-annotated in detection task. Using two-stream and C3D networks as action classifiers, the dimension of SAS features is 303. Figure 5: Detection AP over different action categories with overlap threshold 0.5 in THUMOS’14. Table 2: Results on MEXaction2 dataset with overlap threshold 0.5. Results for [1] are taken from [29]. AP(%) BullCHargeCape HorseRiding mAP(%) DTF [1] SCNN [29] 0.3 11.6 3.1 3.1 1.7 7.4 SSAD 16.5 5.5 11.0 For training of SSAD model, we use 200 annotated untrimmed video in THUMOS’14 validation set as training set. The window length Lw is set to 512, which means approximately 20 seconds of video with 25 fps. This choice is based on the fact that 99.3% action instances in the training set have smaller length than 20 seconds. We train SSAD network for 30 epochs with learning rate of 0.0001. The comparison results between our SSAD and other state-ofthe-art systems are shown in Table 1 with multiple overlap IoU thresholds varied from 0.1 to 0.5. These results show that SSAD significantly outperforms the compared state-of-the-art methods. While the IoU threshold used in evaluation is set to 0.5, our SSAD network improves the state-of-the-art mAP result from 19.0% to 24.6%. The Average Precision (AP) results of all categories with overlap threshold 0.5 are shown in Figure 5, the SSAD network outperforms other state-of-the-art methods for 7 out of 20 action categories. Qualitative results are shown in Figure 6. Results on MEXaction2. For training of action classifiers, we use all 1336 trimmed video clips in training set. And we randomly sample 1300 background video clips in untrimmed training videos. The prediction categories of action classifiers are "HorseRiding", "BullChargeCape" and "Background". So the dimension of SAS features equals to 9 in MEXaction2. For SSAD model, we use all 38 untrimmed video in MEXaction2 training set training set. Since the distribution of action instances’ length in MEXaction2 is similar with THUMOS’14, we also set the interval of snippets to zero and the window length Tw to 512. We train all layers of SSAD for 10 epochs with learning rate of 0.0001. We compare SSAD with SCNN [29] and typical dense trajectory features (DTF) based method [1]. Both results are provided by [29]. Comparison results are shown in Table 2, our SSAD network achieve significant performance gain in all action categories Table 3: Comparisons between different action classifiers used in SSAD on THUMOS’14, where two-stream network includes both spatial and temporal networks. Action Classifier used for SAS Feature mAP (θ = 0.5) C3D Network Two-Stream Network Two-Stream Network+C3D Network 20.9 21.9 24.6 Table 4: Comparisons among multiple base layers configurations on THUMOS’14. A, B, C, D, E are base layers configurations which presented in Figure 3. Network Configuration A mAP(θ = 0.5) 23.7 B C 24.6 24.1 D E 23.9 23.4 of MEXaction2 and the mAP is increased from 7.4% to 11.0% with overlap threshold 0.5. Figure 6 shows the visualization of prediction results for two action categories respectively. 4.4 Model Analysis We evaluate SSAD network with different variants in THUMOS’14 to study their effects, including action classifiers, architectures of SSAD network and post-processing strategy. Action classifiers. Action classifiers are used to extract SAS feature. To study the contribution of different action classifiers, we evaluate them individually and coherently with IoU threshold 0.5. As shown in Table 3, two-stream networks show better performance than C3D network and the combination of two-stream and C3D network lead to the best performance. In action recognition task such as UCF101, two-stream network [40] achieve 91.4%, which is better than 85.2% of C3D [36] network (without combining with other method such as iDT [38]). So two-stream network can predict action categories more precisely than C3D in snippet-level, which leads to a better performance of the SSAD network. Furthermore, the SAS feature extracted by two-stream network and C3D network are complementary and can achieve better result if used together. Figure 6: Visualization of prediction action instances by SSAD network. Figure (a) shows prediction results for two action categories in THUMOS’14 dataset. Figure (b) shows prediction results for two action categories in MEXaction2 dataset. Table 5: Evaluation on different post-processing strategy on THUMOS’14. pc l ass psas pover mAP (θ = 0.5) ! 22.8 ! ! ! 13.4 24.3 ! ! ! ! ! ! ! 19.8 23.3 24.6 Architectures of SSAD network. In section 3.3, we discuss several architectures used for base network of SSAD. These architectures have same input and output size. So we can evaluate them fairly without other changes of SSAD. The comparison results are shown in Table 4. Architecture B achieves best performance among these configurations and is adopted for SSAD network. We can draw two conclusions from these results: (1) it is better to use max pooling layer instead of temporal convolutional layer to shorten the length of feature map; (2) convolutional layers with kernel size 9 have better performance than other sizes. Post-processing strategy. We evaluate multiple post-processing strategies. These strategies differ in the way of late fusion to generate p f inal and are shown in Table 5. For example, pc l ass is used for generate p f inal if it is ticked in table. Evaluation results are shown in Table 5. For the categories score, we can find that pc l ass has better performance than p̄sas . And using the multiplication factor pover can further improve the performance. SSAD network achieves the best performance with the complete post-processing strategy. 5 CONCLUSION In this paper, we propose the Single Shot Action Detector (SSAD) network for temporal action detection task. Our SSAD network drops the proposal generation step and can directly predict action instances in untrimmed video. Also, we have explored many configurations of SSAD network to make SSAD network work better for temporal action detection. When setting Intersection-over-Union threshold to 0.5 during evaluation, SSAD significantly outperforms other state-of-the-art systems by increasing mAP from 19.0% to 24.6% on THUMOS’14 and from 7.4% to 11.0% on MEXaction2. In our approach, we conduct feature extraction and action detection separately, which makes SSAD network can handle concise high-level features and be easily trained. A promising future direction is to combine feature extraction procedure and SSAD network together to form an end-to-end framework, so that the whole framework can be trained from raw video directly. REFERENCES [1] 2015. MEXaction2. http://mexculture.cnam.fr/xwiki/bin/view/Datasets/Mex+ action+dataset. (2015). [2] M. Abadi, A. Agarwal, P. Barham, and others. 2016. Tensorflow: Largescale machine learning on heterogeneous distributed systems. arXiv preprint arXiv:1603.04467 (2016). [3] F. Caba Heilbron, J. Carlos Niebles, and B. Ghanem. 2016. Fast temporal activity proposals for efficient detection of human actions in untrimmed videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 1914–1923. [4] J. Deng, W. Dong, R. Socher, L. Li, K. Li, and L. Feifei. 2009. ImageNet: A largescale hierarchical image database. (2009), 248–255. [5] V. Escorcia, F. C. Heilbron, J. C. Niebles, and B. Ghanem. 2016. Daps: Deep action proposals for action understanding. In European Conference on Computer Vision. Springer, 768–784. [6] C. Feichtenhofer, A. Pinz, and A. Zisserman. 2016. Convolutional two-stream network fusion for video action recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 1933–1941. [7] J. Gemert, M. Jain, E. Gati, C. G. Snoek, and others. 2015. Apt: Action localization proposals from dense trajectories. BMVA Press. [8] R. Girshick. 2015. Fast r-cnn. In Proceedings of the IEEE International Conference on Computer Vision. 1440–1448. [9] R. Girshick, J. Donahue, T. Darrell, and J. Malik. 2014. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition. 580–587. [10] X. Glorot and Y. Bengio. 2010. Understanding the difficulty of training deep feedforward neural networks.. In Aistats, Vol. 9. 249–256. [11] X. Glorot, A. Bordes, and Y. Bengio. 2011. Deep Sparse Rectifier Neural Networks.. In Aistats, Vol. 15. 275. [12] K. He, X. Zhang, S. Ren, and J. Sun. 2016. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 770–778. [13] Y. Jia, E. Shelhamer, J. Donahue, S. Karayev, J. Long, R. Girshick, S. Guadarrama, and T. Darrell. 2014. Caffe: Convolutional architecture for fast feature embedding. In Proceedings of the 22nd ACM international conference on Multimedia. ACM, 675–678. [14] Y. G. Jiang, J. Liu, A. R. Zamir, G. Toderici, I. Laptev, M. Shah, and R. Sukthankar. 2014. THUMOS challenge: Action recognition with a large number of classes. In ECCV Workshop. [15] S. Karaman, L. Seidenari, and A. Del Bimbo. 2014. Fast saliency based pooling of fisher encoded dense trajectories. In ECCV THUMOS Workshop, Vol. 1. [16] A. Karpathy, G. Toderici, S. Shetty, T. Leung, R. Sukthankar, and L. Fei-Fei. 2014. Large-scale video classification with convolutional neural networks. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition. 1725–1732. [17] D. Kingma and J. Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980 (2014). [18] H. Kuehne, H. Jhuang, R. Stiefelhagen, and T. Serre. 2013. HMDB51: A large video database for human motion recognition. In High Performance Computing in Science and Engineering ’12. Springer, 571–582. [19] C. Lea, R. Vidal, A. Reiter, and G. D. Hager. 2016. Temporal Convolutional Networks: A Unified Approach to Action Segmentation. In Computer Vision– ECCV 2016 Workshops. Springer, 47–54. [20] W. Liu, D. Anguelov, D. Erhan, C. Szegedy, S. Reed, C. Fu, and A. C. Berg. 2016. SSD: Single shot multibox detector. In European Conference on Computer Vision. Springer, 21–37. [21] S. Ma, L. Sigal, and S. Sclaroff. 2016. Learning activity progression in LSTMs for activity detection and early detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 1942–1950. [22] P. Mettes, J. C. van Gemert, and C. G. Snoek. 2016. Spot on: Action localization from pointly-supervised proposals. In European Conference on Computer Vision. Springer, 437–453. [23] D. Oneata, J. Verbeek, and C. Schmid. 2014. The LEAR submission at Thumos 2014. ECCV THUMOS Workshop (2014). [24] Z. Qiu, T. Yao, and T. Mei. 2016. Deep Quantization: Encoding Convolutional Activations with Deep Generative Model. arXiv preprint arXiv:1611.09502 (2016). [25] J. Redmon, S. Divvala, R. Girshick, and A. Farhadi. 2016. You only look once: Unified, real-time object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 779–788. [26] J. Redmon and A. Farhadi. 2016. YOLO9000: Better, Faster, Stronger. arXiv preprint arXiv:1612.08242 (2016). [27] S. Ren, K. He, R. Girshick, and J. Sun. 2015. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in neural information processing systems. 91–99. [28] A. Richard and J. Gall. 2016. Temporal action detection using a statistical language model. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 3131–3140. [29] Z. Shou, D. Wang, and S.-F. Chang. 2016. Temporal action localization in untrimmed videos via multi-stage cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 1049–1058. [30] K. Simonyan and A. Zisserman. 2014. Two-stream convolutional networks for action recognition in videos. In Advances in Neural Information Processing Systems. 568–576. [31] K. Simonyan and A. Zisserman. 2015. Very Deep Convolutional Networks for Large-Scale Image Recognition. In International Conference on Learning Representations. [32] B. Singh, T. K. Marks, M. Jones, O. Tuzel, and M. Shao. 2016. A multi-stream bi-directional recurrent neural network for fine-grained action detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 1961–1970. [33] G. Singh and F. Cuzzolin. 2016. Untrimmed Video Classification for Activity Detection: submission to ActivityNet Challenge. arXiv preprint arXiv:1607.01979 (2016). [34] K. Soomro, A. R. Zamir, and M. Shah. 2012. UCF101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402 (2012). [35] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. 2015. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 1–9. [36] D. Tran, L. Bourdev, R. Fergus, L. Torresani, and M. Paluri. 2015. Learning spatiotemporal features with 3d convolutional networks. In Proceedings of the IEEE International Conference on Computer Vision. 4489–4497. [37] H. Wang, A. Kläser, C. Schmid, and C.-L. Liu. 2011. Action recognition by dense trajectories. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on. IEEE, 3169–3176. [38] H. Wang and C. Schmid. 2013. Action recognition with improved trajectories. In Proceedings of the IEEE International Conference on Computer Vision. 3551–3558. [39] L. Wang, Y. Qiao, and X. Tang. 2014. Action recognition and detection by combining motion and appearance features. THUMOS14 Action Recognition Challenge 1 (2014), 2. [40] L. Wang, Y. Xiong, Z. Wang, and Y. Qiao. 2015. Towards good practices for very deep two-stream convnets. arXiv preprint arXiv:1507.02159 (2015). [41] R. Wang and D. Tao. 2016. UTS at activitynet 2016. AcitivityNet Large Scale Activity Recognition Challenge 2016 (2016), 8. [42] S. Yeung, O. Russakovsky, G. Mori, and L. Fei-Fei. 2016. End-to-end learning of action detection from frame glimpses in videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2678–2687. [43] G. Yu and J. Yuan. 2015. Fast action proposals for human action detection and search. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 1302–1311. [44] J. Yuan, B. Ni, X. Yang, and A. A. Kassim. 2016. Temporal Action Localization with Pyramid of Score Distribution Features. In IEEE Conference on Computer Vision and Pattern Recognition. 3093–3102. [45] Y. Zhu and S. Newsam. 2016. Efficient Action Detection in Untrimmed Videos via Multi-Task Learning. arXiv preprint arXiv:1612.07403 (2016).
1cs.CV
arXiv:1712.06454v1 [math.ST] 15 Dec 2017 Oracle inequalities for the stochastic differential equations ∗ Pchelintsev E.A., † Pergamenshchikov S.M.‡ Abstract This paper is a survey of recent results on the adaptive robust non parametric methods for the continuous time regression model with the semi - martingale noises with jumps. The noises are modeled by the Lévy processes, the Ornstein – Uhlenbeck processes and semi-Markov processes. We represent the general model selection method and the sharp oracle inequalities methods which provide the robust efficient estimation in the adaptive setting. Moreover, we present the recent results on the improved model selection methods for the nonparametric estimation problems. Key words: Non-parametric regression, Weighted least squares estimates, Improved non-asymptotic estimation, Robust quadratic risk, Lévy process, Ornstein – Uhlenbeck process, semi-Markov process, Model selection, Sharp oracle inequality, Adaptive estimation, Asymptotic efficiency AMS (2010) Subject Classification : primary 62G08; secondary 62G05 ∗ This work was done under the Ministry of Education and Science of the Russian Federation in the framework of the research project no. 2.3208.2017/4.6, by RFBR Grant 16-01-00121 A and by the partial financial support of the RSF grant number 14-49-00079 (National Research University ”MPEI” 14 Krasnokazarmennaya, 111250 Moscow, Russia). † Department of Information Technologies and Business Analytics, Tomsk State University, Lenin str. 36, 634050 Tomsk, Russia, e-mail: [email protected] ‡ Laboratory of Mathematics LMRS, University of Rouen, France, International Laboratory SSP & QF, National Research Tomsk State University and National Research University ”MPEI” 14 Krasnokazarmennaya, 111250 Moscow, Russia, e-mail: [email protected] 1 1 Introduction This paper is a survey on the adaptive non parametric estimation methods for the general semi-martingale regression model in continuous time defined as d yt = S(t)d t + dξt , 0 ≤ t ≤ n , (1.1) where S(·) is an unknown 1 - periodic function, (ξt )0≤t≤n is an unobservable noise defined by semimartingale with the values in the Skorokhod space D[0, n] such that, for any function f from L2 [0, n], the stochastic integral Z n In (f ) = f (s)dξs 0 is well defined and has the following properties EQ In (f ) = 0 and EQ In2 (f ) ≤ κQ Z n f 2 (s)ds . (1.2) 0 We use EQ for the expectation with respect to the distribution Q in D[0, n] of the process (ξt )0≤t≤n , which is assumed to belong to some probability family Qn and κQ is some positive constant depending on the distribution Q. The problem consists to estimate the function S on the observations (yt )0≤t≤n . Note that if (ξt )0≤t≤n is a brownian motion, then we obtain the well known ”signal+white noise” model which is very popular in statistical radio-physics (see, for example, [17, 31, 32, 40]). In this paper we assume that in addition to the intrinsic noise in the radio-electronic system, approximated usually by the Gaussian white or color noise, the useful signal S is distorted by the impulse flow described by the processes with jumps. The cause of the appearance of a pulse stream in the radio-electronic systems can be, for example, either external unintended (atmospheric) or intentional impulse noise and the errors in the demodulation and the channel decoding for the binary information symbols. Note that, for the first time the impulse noises for the detection signal problems have been introduced on the basis of the compound Poisson processes was introduced by Kassam in [23]. Later, such processes was used in [28, 29, 30, 38] for the parametric and nonparametric signal estimation problems. However, the compound Poisson process can describe only the large impulses influence of fixed single frequency. Taking into account that in the telecommunication systems, the impulses are without limitations on frequencies one needs to extend the framework of the observation model by making use the Lévy processes (2.1) which is a particular case of the general semimartinagale regression model introduced in [25]. Generally, we consider nonparametric estimation problems for the function S from L2 under the 2 condition that the distribution of the noise (ξt )0≤t≤n is unknown. We know only that this distribution belongs to some distribution family Qn . In this case we use the robust estimation approach proposed in [13, 28, 29] for the nonparametric estimation. According to this approach we have to construct an estimator Sbn (any function of (yt )0≤t≤n ) for S to minimize the robust risk defined as (1.3) R∗n (Sbn , S) = sup RQ (Sbn , S) , Q∈Qn where RQ (·, ·) is the usual quadratic risk of the form RQ (Sbn , S) := EQ kSbn − Sk2 2 and kSk = Z 1 S 2 (t)dt . (1.4) 0 It is clear that if we don’t know the distribution of the observation one needs to find an estimator which will be optimal for all possible observation distributions. Moreover in this paper we consider the estimation problem in the adaptive setting, i.e. when the regularity of S is unknown. To this end we use the adaptive method based on the model selection approach. The interest to such statistical procedures is explained by the fact that they provide adaptive solutions for the nonparametric estimation through oracle inequalities which give the non-asymptotic upper bound for the quadratic risk including the minimal risk over chosen family of estimators. It should be noted that for the first time the model selection methods were proposed by Akaike [1] and Mallows [34] for parametric models. Then, these methods had been developed for the nonparametric estimation and the oracle inequalities for the quadratic risks was obtained by Barron, Birgé and Massart [3], Massart [35], by Fourdrinier and Pergamenshchikov [12] for the regression models in discrete time and [27] in continuous time. Unfortunately, the oracle inequalities obtained in these papers can not provide the efficient estimation in the adaptive setting, since the upper bounds in these inequalities have some fixed coefficients in the main terms which are more than one. To obtain the efficiency property for estimation procedures one has to obtain the sharp oracle inequalities, i.e. in which the factor at the principal term on the right-hand side of the inequality is close to unity. The first result on sharp inequalities is most likely due to Kneip [22] who studied a Gaussian regression model in the discrete time. It will be observed that the derivation of oracle inequalities usually rests upon the fact that the initial model, by applying the Fourier transformation, can be reduced to the Gaussian independent observations. However, such transformation is possible only for Gaussian models with independent homogeneous observations or for inhomogeneous ones with known correlation characteristics. For the general non Gaussian observations one needs to 3 use the approach proposed by Galtchouk and Pergamenshchikov [14, 15] for the heteroscedastic regression models in discrete time and developed then by Konev and Pergamenshchikov in [25, 26, 28, 29] for semimartingale models in continuous time. In general the model selection is an adaptive rule α b which choses an estimator S ∗ = Sbαb from an estimate family (Sbα )α∈A . The goal of this selection is to prove the following nonasymptotic oracle inequality: for any sufficient small δ > 0 and any observation duration n ≥ 1 R(S ∗ , S) ≤ (1 + δ) min R(Sbα , S) + δ −1 Bn , (1.5) α∈A where the rest term Bn is sufficiently small with respect to the minimax convergence rate. Such oracle inequalities are called sharp, since the coefficient in the main term 1 + δ is close to one for sufficiently small δ > 0. Moreover, in this paper we represent the new results on the improved estimation methods for the nonparametric models (1.1). Usually, the model selection procedures are based on the least squares estimators. But in [39] it is propose to use the improved least square estimators which enable to improve considerably the non asymptotic estimation accuracy. At the first time such idea was proposed in [12] for the regression in discrete time and in [27] for the Gaussian regression model in continuous time. In [39] these methods are developed for the non - Gaussion regression models in continuous time. It should be noted that generally for the conditionally Gaussian regression models one can not use the well known improved estimators proposed in [19, 11] for Gaussian or spherically symmetric observations. To apply the improved estimation methods to the non Gaussian regression models in continuous time one needs to modify the well known James–Stein procedure in the way proposed in [38, 30]. For the improved model selection procedures the oracle inequality (1.5) is shown also. We note that this inequality allows us to provide the asymptotic efficiency without knowing the regularity of the function being estimated. The efficacy property for a nonparametric estimate S ∗ means b S) = l (r) , lim υn sup R(S ∗ , S) = lim υn inf sup R(S, ∗ n→∞ S∈Wrk where l∗ (r) = ((1 + 2k)r) Sb S∈W k r n→∞ 1/(2k+1)  k π(k + 1) 2k/(2k+1) , (1.6) υn is a normalizing coefficient (convergence rate), Wrk is the Sobolev ball of a radius r > 0 and the regularity k ≥ 1. The limit (1.6) is called the Pinsker constant which is calculated by Pinsker in [40]. 4 The rest of the paper is organized as follows. In the next section 2, we describe the Lévy, Ornstein–Uhlenbeck and semi-Markov processes as the examples of a semimartingale impusle noise in the model (1.1). In Section 3 we construct the model selection procedure based on the least square estimators and show the sharp oracle inequalities. In Section 4 we give the improved least squares estimators and we study the improvement effect for the semimartingale model (1.1). In Section 5 we construct the improved model selection procedure and show the sharp oracle inequalities. The asymptotic efficiency is studed in Section 6. 2 2.1 Examples Lévy model First we consider the model (1.1) with the Lévy noise process, i.e. we assume that the noise process (ξt )0≤t≤n is defined as ξt = ̺1 wt + ̺2 zt and zt = x ∗ (µ − µ e)t , (2.1) where ̺1 and ̺2 are some unknown constants, (wt )t≥ 0 is a standard brownian motion, µ(ds dx) is a jump measure with deterministic compensator µ e(ds dx) = dsΠ(dx), Π(·) is a Lévy measure, i.e. some positive measure on R∗ = R \ {0}, (see, for example, [18, 9] for details) such that Π(x2 ) = 1 and Π(x6 ) < ∞ . R Here we use the notation Π(|x|m ) = R |z|m Π(dz). Note that the Lévy ∗ measure Π(R∗ ) could be equal to +∞. One can check directly that for the process (2.1) the condition (1.2) holds with κQ = σQ = ̺21 + ̺22 . We assume that the nuisance parameters ̺1 and ̺2 of the process (ξt )0≤t≤n satisfy the conditions (2.2) 0 < ̺ ≤ ̺21 and σQ ≤ ς ∗ , where the bounds ̺ and ς ∗ are functions of n, i.e. ̺ = ̺ and ς ∗ = ςn∗ such n that for any δ̌ > 0 lim inf nδ̌ ̺ > 0 and n→∞ n lim n−δ̌ ςn∗ = 0 . n→∞ (2.3) For this example Qn is the family of all distributions of process (1.1) – (2.1) on the Skorokhod space D[0, n] satisfying the conditions (2.2) – (2.3). The models (1.1) with the Lévy’s type noise are used in different applied problems (see [7], for details). Such models naturally arise in the nonparametric functional statistics problems (see, for example, [8]). 5 2.2 Ornstein – Uhlenbeck model Now we consider the noise process (ξt )t≥0 in (1.1) difened by a non-Gaussian Ornstein-Uhlenbeck process with the Lévy subordinator. Let the noise process in (1.1) obey the equation dξt = aξt dt + dut , ξ0 = 0 , (2.4) where ut = ̺1 wt + ̺2 zt and the process zt is defied in (2.1). Here a ≤ 0, ̺1 and ̺2 are unknown parameters. We assume that the parameters ̺1 and ̺2 satisfy the conditions (2.2) and the parameter − amax ≤ a ≤ 0 , (2.5) where the bound amax > 0 is the function of n, i.e. amax = amax (n), such that for any δ̌ > 0 a = 0. (2.6) lim max n→∞ nδ̌ In this case Qn is the family of all distributions of process (2.4) on the Skorokhod space D[0, n] satisfying the conditions (2.2), (2.5) and (2.6). Note also that the processes (2.1) and (2.4) are G - conditionally Gaussian square integrated semimartingales, where G = σ{zt , t ≥ 0}. Such processes are used in the financial Black-Scholes type markets with jumps (see, for example, [2, 10] and the references therein). Note also that in the case when ̺2 = 0 for the parametric estimation problem such models are considered in [20, 21, 24]. 2.3 Semi – Markov model In [4, 5] it is introduced the regression model (1.1) in which the noise process describes by the equation ξt = ̺1 Lt + ̺2 Xt , (2.7) and the Lévy process Lt is defined as Lt = ̺ˇ wt + p 1 − ̺ˇ2 zt , where 0 ≤ ̺ˇ ≤ 1 is an unknown constant. Moreover, we assume that the pure jump process (Xt )t≥ 0 in (2.7) is a semi-Markov process with the following form Nt X Xt = Yi , (2.8) i=1 6 where (Yi )i≥ 1 is an i.i.d. sequence of random variables with E Yi = 0 , E Yi2 = 1 and E Yi4 < ∞ . Here Nt is a general counting process (see, for example, [36]) defined as Nt = ∞ X k=1 1{Tk ≤t} and Tk = k X τl , l=1 where (τl )l≥ 1 is an i.i.d. sequence of positive integrated random variables with distribution η and mean τ̌ = E τ1 > 0. We assume that the processes (Nt )t≥0 and (Yi )i≥ 1 are independent between them and are also independent of (Lt )t≥0 . Here, the family Qn is defined by of all distributions of process (2.7) on the Skorokhod space D[0, n] with the parameters ̺1 and ̺2 satisfying the conditions (2.2) and 0 ≤ ̺ˇ ≤ 1. Note that the process (Xt )t≥ 0 is a special case of a semi-Markov process (see, e.g., [6] and [33]). It should be noted that if τj are exponential random variables, then (Nt )t≥0 is a Poisson process and, in this case, (ξt )t≥0 is a Lévy process. But, in the general case when the process (2.8) is not a Lévy process, this process has a memory and cannot be treated in the framework of semi-martingales with independent increments. In this case, we need to develop new tools based on renewal theory arguments from [16]. It should be noted that for ̺ˇ > 0 the process (2.7) is G - conditionally Gaussian also. In this case G = σ{zt , Xt , t ≥ 0}. 3 Model selection Let (φj )j≥ 1 be an orthonormal uniformly bounded basis in L2 [0, 1], i.e. for some constant φ∗ ≥ 1, which may be depend on n, sup sup |φj (t)| ≤ φ∗ < ∞ . 0≤j≤n 0≤t≤1 For example, we can take the trigonometric basis defined as Tr1 ≡ 1 and, for j ≥ 2,  √  cos(2π[j/2]x) for even j; Trj (x) = 2 (3.1)  sin(2π[j/2]x) for odd j, where [x] denotes the integer part of x. 7 To estimate the function S we use here the model selection procedure for continuous time regression models from [28] based on the Fourrier expansion. We recall that for any function S from L2 [0, 1] we can write Z 1 ∞ X S(t) = θj φj (t) and θj = (S, φj ) = S(t)φj (t)dt . 0 j=1 So, to estimate the function S it suffices to estimate the coefficients θj and to replace them in this representation by their estimators. Using the fact that the function S and φj are 1 - periodic we can write that Z 1 n θj = φ (t) S(t)dt . n 0 j If we replace here the differential S(t)dt by the stochastic observed differential dyt then we obtain the natural estimate for θj on the time interval [0, n] Z n 1 θbj,n = φ (t)d yt , n 0 j which can be represented, in view of the model (1.1), as 1 θbj,n = θj + √ ξj,n n 1 and ξj,n = √ In (φj ) . n We need to impose some stability conditions for the noise Fourier transform sequence (ξj,n )1≤j≤n . To this end we set for some stability noise intensity parameter σQ > 0 the following function L1,n (Q) = sup x∈[−1,1]n n X j=1   2 xj EQ ξj,n − σQ . In [28] the parameter σQ is called proxy variance . C1 ) There exists a variance proxy σQ > 0 such that for any ǫ > 0 L1,n (Q) = 0. nǫ n→∞ lim Moreover, we set  2 n X 2 2  L2,n (Q) = sup EQ  xj (ξj,n − EQ ξj,n ) . |x|≤1 j=1 8 (3.2) C2 ) Assume that for any ǫ > 0 L2,n (Q) = 0. nǫ n→∞ lim Now (see, for example, [17]) we can estimate the function S by the projection estimators, i.e. Sbm (t) = m X j=1 θbj,n φj (t) , 0 ≤ t ≤ 1, (3.3) for some number m → ∞ as n → ∞. It should be noted that Pinsker in [40] shows that the projection estimators of the form (3.3) are not efficient. For obtaining efficient estimation one needs to use weighted least square estimators defined as n X b Sλ (t) = λ(j)θbj,n φj (t) , (3.4) j=1 where the coefficients λ = (λ(j))1≤j≤n belong to some finite set Λ from [0, 1]n . As it is shown in [40], in order to obtain efficient estimators, the coefficients λ(j) in (3.4) need to be chosen depending on the regularity of the unknown function S. Since we consider the adaptive case, i.e. we assume that the regularity of the function S is unknown, then we chose the weight coefficients on the basis of the model selection procedure proposed in [28] for the general semi-martingale regression model in continuous time. To the end, first we set n X ν = #(Λ) and |Λ|∗ = 1 + max λ(j) , λ∈Λ j=1 where #(Λ) is the cardinal number of Λ. Now, to choose a weight sequence λ in the set Λ we use the empirical quadratic risk, defined as Errn (λ) =k Sbλ − S k2 , which in our case is equal to Errn (λ) = n X j=1 2 λ (j)θbj,n −2 2 n X j=1 λ(j)θbj,n θj + ∞ X θj2 . j=1 Since the Fourier coefficients (θj )j≥ 1 are unknown, we replace the terms θbj,n θj,n by σ b 2 θej,n = θbj,n − n, n 9 where σ bn is an estimate for the variance proxy σQ defined in (3.2). If it is known, we take σ bn = σQ , otherwise, we can choose it, for example, as in [28], i.e. n X b σ bn = t2j,n , (3.5) √ j=[ n]+1 where b tj,n are the estimators for the Fourier coefficients with respect to the trigonometric basis (3.1), i.e. Z 1 n b T rj (t)dyt . tj,n = n 0 Finally, in order to choose the weights, we will minimize the following cost function n n X X 2 2 b Jn (λ) = λ (j)θj,n − 2 λ(j)θej,n + δ Pn (λ), j=1 j=1 where δ > 0 is some threshold which will be specified later and the penalty term is σ b |λ|2 Pn (λ) = n . (3.6) n We define the model selection procedure as Sb∗ = Sbλ̂ b = argmin Jn (λ) . with λ λ∈Λ (3.7) We recall that the set Λ is finite so λ̂ exists. In the case when λ̂ is not unique, we take one of them. As is shown in [4, 28, 39] both Conditions C1 ) and C2 ) hold for the processes (2.1), (2.4) and (2.7). Proposition 3.1. If the conditions C1 ) and C2 ) hold for the distribution Q of the process ξ in (1.1), then, for any n ≥ 1 and 0 < δ < 1/3, the risk (1.4) of estimate (3.7) for S satisfies the oracle inequality B (Q) 1 + 3δ min RQ (Sbλ , S) + n , (3.8) RQ (Sb∗ , S) ≤ 1 − 3δ λ∈Λ δn  where Bn (Q) = Un (Q) 1 + |Λ|∗ EQ |b σn − σQ | and the coefficient Un (Q) is such that for any ǫ > 0 U (Q) lim n ǫ = 0 . (3.9) n n→∞ 10 In the case, when the value of σQ is known, one can take σ bn = σQ and σQ |λ|2n Pn (λ) = , n then we can rewrite the oracle inequality (3.8) with Bn (Q) = Un (Q). Also we study the accuracy properties for the estimator (3.5). Proposition 3.2. Let in the model (1.1) the function S(·) is continuously differentiable. Then, for any n ≥ 2, EQ |b σn − σQ | ≤ κn (Q)(1 + kṠk2 ) √ , n where the term κn (Q) possesses the property (3.9). To obtain the oracle inequality for the robust risk (1.3) we need some additional condition on the distribution family Qn . We set ς ∗ = ςn∗ = sup σQ Q∈Qn and L∗n = sup (L1,n (Q) + L2,n (Q)) . (3.10) Q∈Qn C∗1 ) Assume that the conditions C1 )–C2 ) hold and for any ǫ > 0 L∗n + ςn∗ = 0. nǫ n→∞ lim Now we impose the conditions on the set of the weight coefficients Λ. C∗2 ) Assume that the set Λ is such that for any ǫ > 0 ν = 0 and n→∞ nǫ lim lim n→∞ |Λ|∗ = 0. n1/2+ǫ Theorem 3.3. Assume that the conditions C∗1 )–C∗2 ) hold. Then the robust risk (1.3) of the estimate (3.7) for continuously differentiable function S(t) satisfies for any n ≥ 2 and 0 < δ < 1/3 the oracle inequality 1 ∗ 1 + 3δ min R∗n (Sbλ , S) + B (1 + kṠk2 ) , R∗n (Sb∗ , S) ≤ 1 − 3δ λ∈Λ δn n where the term B∗n satisfies the property (3.9). 11 Now we specify the weight coefficients (λ(j))j≥1 in the way proposed in [14] for a heteroscedastic regression model in discrete time. First we define the normalizing coefficient which defined the minimax convergence rate vn = n , ς∗ (3.11) where the upper proxy variance is ς ∗ is defined in (3.10). Consider a numerical grid of the form An = {1, . . . , k ∗ } × {r1 , . . . , rm } , where ri = iε and m = [1/ε2 ]. Both parameters k ∗ ≥ 1 and 0 < ε ≤ 1 are assumed to be functions of n, i.e. k ∗ = k ∗ (n) and ε = ε(n), such that for any δ>0  k ∗ (n)   limn→∞ k ∗ (n) = +∞ , limn→∞ = 0, ln n   limn→∞ ε(n) = 0 and limn→∞ nδ ε(n) = +∞ . One can take, for example, ε(n) = 1 ln(n + 1) and k ∗ (n) = p ln(n + 1) . For each α = (β, r) ∈ An we introduce the weight sequence λα = (λα (j))j≥1 as  λα (j) = 1{1≤j≤d} + 1 − (j/ωα )β 1{d<j≤ωα } (3.12) 1/(2β+1) where d = d(α) = [ωα / ln(n + 1)], ωα = τβ r vn and τβ = (β + 1)(2β + 1) . π 2β β We set Λ = {λα , α ∈ An } . (3.13) It will be noted that in this case the cardinal of the set Λ is ν = k ∗ m. Moreover, taking into account that τβ < 1 for β ≥ 1 we obtain for the set (3.13) |Λ|∗ ≤ 1 + sup ωα ≤ 1 + (υn /ε)1/3 . α∈A Note that the form (3.12) for the weight coefficients was proposed by Pinsker in [40] for the efficient estimation in the nonadaptive case, i.e. when the regularity parameters of the function S are known. In the adaptive case these weight coefficients are used in [28, 29] to show the asymptotic efficiency for model selection procedures. 12 4 Improved estimation In this Section we consider the improved estimation method for the model (1.1). We impose the following additional condition on the noise distribution. D1 ) There exists n0 ≥ 1 such that for any n ≥ n0 there exists a σ field Gn for which the random vector ξed,n = (ξj,n )1≤j≤d is the Gn conditionally Gaussian in Rd with the covariance matrix  Gn = E ξi,n ξj,n |Gn ) 1≤i,j≤d and for some nonrandom constant ln∗ > 0 inf Q∈Qn (tr Gn − λmax (Gn )) ≥ ln∗ , where λmax (A) is the maximal eigenvalue of the matrix A. Proposition 4.1. Let in the model (1.1) the noise process describes by the Lévy process (2.1). Then the condition D1 ) holds with ln∗ = (d − 1)̺ for any n ≥ 1. Proposition 4.2. Let in the model (1.1) the noise process describes by the Ornstein–Uhlenbeck process (2.4). Then the condition D1 ) holds with ln∗ = (d − 6)̺/2 for any n ≥ n0 and d ≥ d0 = inf{d ≥ 7 : 5 + ln d ≤ ǎd}, ǎ = (1 − e−amax )/(4amax ). Now, for the first d Fourier coefficients we use the improved estimation method proposed for parametric models in [38]. To this end we set θen = P (θbj,n )1≤j≤d . In the sequel we will use the norm |x|2d = dj=1 x2j for any vector x = (xj )1≤j≤d from Rd . Now we define the shrinkage estimators as ∗ θj,n = (1 − g(j)) θbj,n , where g(j) = (cn /|θen |d )1{1≤j≤d} and cn =  ln∗  . p rn∗ + d/vn n (4.1) The positive parameter rn∗ is such that limn→∞ rn∗ = ∞ and for any ǫ > 0 lim n→∞ rn∗ = 0 nǫ 13 (4.2) and vn defined in (3.11). Now we introduce a class of shrinkage weighted least squares estimates for S as Sλ∗ = n X ∗ λ(j)θj,n φj . (4.3) j=1 We denote the difference of quadratic risks of the estimates (3.4) and (4.3) as ∆Q (S) := RQ (Sλ∗ , S) − RQ (Sbλ , S) . We obtain the following result. Theorem 4.3. Let the observed process (yt )0≤t≤n describes by the equation (1.1) and the condition D1 ) holds. Then for any n ≥ 1 sup sup ∆Q (S) ≤ −c2n . (4.4) Q∈Qn kSk≤r ∗ n Remark 4.1. The inequality (4.4) means that non asymptotically, i.e. for any n ≥ 1, the estimate (4.3) outperforms in mean square accuracy the estimate (3.4). Moreover in the efficient weight coefficients d ≈ nδ̌ as n → ∞ for some δ̌ > 0. Therefore, in view of the definition (4.1) and the conditions (2.3) and (4.2) ncn → ∞ as n → ∞. This means that improvement is considerably may better than for the parametric regression when the parameter dimension d is fixed [38]. 5 Improved model selection This Section gives the construction of a model selection procedure for estimating a function S in (1.1) on the basis of improved weighted least square estimates (Sλ∗ )λ∈Λ and states the sharp oracle inequality for the robust risk of proposed procedure. As in Section 3, the performance of any estimate Sλ∗ will be measured by the empirical squared error Errn (λ) = kSλ∗ − Sk2 . In order to obtain a good estimate, we have to write a rule to choose a weight vector λ ∈ Λ in (4.3). It is obvious, that the best way is to minimise the 14 empirical squared error with respect to λ. Making use the estimate definition (4.3) and the Fourier transformation of S implies Errn (λ) = n X λ 2 ∗ 2 (j)(θj,n ) j=1 Here one needs to replace the terms −2 n X ∗ λ(j)θj,n θj j=1 ∗ θj,n θj + n X θj2 . j=1 by their estimators θ̄j,n . We set σ bn , n where σ bn is defined in (3.5). For this change in the empirical squared error, one has to pay some penalty. Thus, one comes to the cost function of the form n n X X ∗ 2 Jn∗ (λ) = λ2 (j)(θj,n ) −2 λ(j) θ̄j,n + δ Pn (λ) , ∗ b θ̄j,n = θj,n θj,n − j=1 j=1 where δ is some positive constant and the penalty term Pn (λ) is defined in (3.6). Substituting the weight coefficients, minimizing the cost function λ∗ = argminλ∈Λ Jn∗ (λ) , (5.1) in (4.3) leads to the improved model selection procedure S ∗ = Sλ∗∗ . (5.2) It will be noted that λ∗ exists because Λ is a finite set and also if the minimizing sequence in (5.1) λ∗ is not unique, one can take any minimizer. Theorem 5.1. If the conditions C1 ) and C2 ) hold for the distribution Q of the process ξ in (1.1), then, for any n ≥ 1 and 0 < δ < 1/3, the risk (1.4) of estimate (5.2) for S satisfies the oracle inequality B̌ (Q) 1 + 3δ min RQ (Sλ∗ , S) + n , 1 − 3δ λ∈Λ nδ  where B̌n (Q) = Ǔn (Q) 1 + |Λ|∗ EQ |b σn − σQ | and the coefficient Ǔn (Q) satisfies the property (3.9). RQ (Sλ∗∗ , S) ≤ Now Theorem 5.1 and Proposition 3.2 directly imply the following inequality for the robust risk (1.3) of the procedure (5.2). Theorem 5.2. Assume that the conditions C∗1 ) and C∗2 ) hold and the function S is continuously differentiable. Then for any n ≥ 2 and 0 < δ < 1/3 R∗n (Sλ∗∗ , S) ≤ Ǔ∗ (1 + kṠk2 ) 1 + 3δ min R∗n (Sλ∗ , S) + n , 1 − 3δ λ∈Λ nδ where the coefficient Ǔ∗n satisfies the property (3.9). 15 6 Asymptotic efficiency In order to study the asymptotic efficiency we define the following functional Sobolev ball k X k Wk,r = {f ∈ Cp [0, 1] : kf (j) k2 ≤ r} , j=0 where r > 0 and k ≥ 1 are some unknown parameters, Ckp [0, 1] is the space of k times differentiable 1 - periodic R → R functions such that f (i) (0) = f (i) (1) for any 0 ≤ i ≤ k −1. It is well known that for any S ∈ Wk,r the optimal rate of convergence is n−2k/(2k+1) (see, for example, [40, 37]). On the basis of the model selection procedure we construct the adaptive procedure S∗ for which we obtain the following asymptotic upper bound for the quadratic risk, i.e. we show that the parameter (1.6) gives a lower bound for the asymptotic normalized risks. To this end we denote by Σn of all estimators Sbn of S measurable with respect to the process (1.1), i.e. σ{yt , 0 ≤ t ≤ n}. Theorem 6.1. The robust risk (1.3) admits the following asymptotic lower bound lim inf inf vn2k/(2k+1) sup R∗n (Sbn , S) ≥ l∗ (r) . n→∞ b ∈Σ S n n S∈Wk,r We show that this lower bound is sharp in the following sense. Theorem 6.2. The quadratic risk (1.3) for the estimating procedure S ∗ has the following asymptotic upper bound lim sup vn2k/(2k+1) sup R∗n (S ∗ , S) ≤ l∗ (r) . n→∞ S∈Wk,r It is clear that Theorem 6.2 and Theorem 6.1 imply Corollary 6.3. The model selection procedure S ∗ is efficient, i.e. 2k lim (vn ) 2k+1 sup R∗n (S ∗ , S) = l∗ (r) . n→∞ (6.1) S∈Wk,r Note that the equality (6.1) implies that the parameter (1.6) is the Pinsker constant in this case (cf. [40]). Moreover, it means that the robust efficiency 2k holds with the convergence rate (vn ) 2k+1 . It is well known that for the simple risks the optimal (minimax) estimation convergence rate for the functions from the set Wk,r is n2k/(2k+1) (see, for example, [17, 37, 40]). So, if the distribution upper bound ς ∗ → 0 as n → ∞ we obtain the more rapid rate, 16 and if ς ∗ → ∞ as n → ∞ we obtain the more slow rate. In the case when ς ∗ is constant the robust rate is the same as the classical non robust convergence rate. Acknowledgements. The first author is partially supported by the the RSF grant 17-11-01049. The last author is partially supported by the Russian Federal Professor program (project no. 1.472.2016/1.4, Ministry of Education and Science) and by the project XterM - Feder, University of Rouen, France. References [1] Akaike H (1974) A new look at the statistical model identification. IEEE Trans. on Automatic Control 19:716–723 [2] Barndorff-Nielsen OE, Shephard N (2001) Non-Gaussian OrnsteinUhlenbeck-based models and some of their uses in financial mathematics. J Royal Stat Soc B63:167–241 [3] Barron A, Birgé L, Massart P (1999) Risk bounds for model selection via penalization. Probab. Theory Relat. Fields 113:301–415 [4] Barbu V, Beltaif S, Pergamenshchikov SM (2017) Robust adaptive efficient estimation for semi - Markov nonparametric regression models. Preprint 2017 https://arxiv.org/pdf/1604.04516.pdf submitted in Statistical inference for stochastic processes [5] Barbu V, Beltaif S, Pergamenshchikov SM (2017) Robust adaptive efficient estimation for a semi-Markov continuous time regression from discrete data. Preprint 2017 http://arxiv.org/abs/1710.10653 submitted in Annales de l’Institut Henri Poincaré [6] Barbu VS, Limnios N (2008) Semi-Markov Chains and Hidden SemiMarkov Models toward Applications - Their use in Reliability and DNA Analysis. Lecture Notes in Statistics 191 [7] Bertoin J (1996) Lévy Processes. Cambridge University Press, Cambridge [8] Ferraty F, Vieu P (2006) Nonparametric Functional Data Analysis : Theory and Practice. Springer Series in Statistics, Springer-Verlag, New York 17 [9] Cont R, Tankov P (2004) Financial Modelling with Jump Processes. Chapman & Hall [10] Delong L, Klüppelberg C (2008) Optimal investment and consumption in a Black-Scholes market with Lévy driven stochastic coefficients. Annals of Applied Probability 18(3):879–908 [11] Fourdrinier D, Strawderman W E (1996) A paradox concerning shrinkage estimators: should a known scale parameter be replaced by an estimated value in the shrinkage factor? Journal of Multivariate Analysis 59(2):109 –140 [12] Fourdrinier D, Pergamenshchikov S (2007) Improved selection model method for the regression with dependent noise. Annals of the Institute of Statistical Mathematics 59(3):435–464 [13] Galtchouk LI, Pergamenshchikov SM (2006) Asymptotically efficient estimates for non parametric regression models.Statistics and Probability Letters 76(8):852–860 [14] Galtchouk LI, Pergamenshchikov SM (2009) Sharp non-asymptotic oracle inequalities for nonparametric heteroscedastic regression models. Journal of Nonparametric Statistics 21(1):1 – 16 [15] Galtchouk LI, Pergamenshchikov SM (2009) Adaptive asymptotically efficient estimation in heteroscedastic nonparametric regression. Journal of Korean Statistical Society 38(4):305–322 [16] Goldie CM (1991) Implicit renewal theory and tails of solutions of random equations. The Annals of Applied Probability 1(1):126 – 166 [17] Ibragimov IA, Khasminskii RZ (1981) Statistical Estimation: Asymptotic Theory. Springer, New York [18] Jacod J, Shiryaev AN (2002) Limit theorems for stochastic processes, 2nd edition. Springer, Berlin [19] James W, Stein C (1961) Estimation with quadratic loss. In Proceedings of the Fourth Berkeley Symposium Mathematics, Statistics and Probability, University of California Press, Berkeley 1:361–380 [20] Höpfner R, Kutoyants YuA (2009) On LAN for parametrized continuous periodic signals in a time inhomogeneous diffusion. Statist. Decisions 27(4):309 – 326 18 [21] Höpfner R, Kutoyants YuA (2010) Estimating discontinuous periodic signals in a time inhomogeneous diffusion. Statistical Inference for Stochastic Processes 13(3):193 – 230 [22] Kneip A (1994) Ordered linear smoothers. Annals of Statistcs 22:835– 866 [23] Kassam SA (1988) Signal detection in non-Gaussian noise. SpringerVerlag Inc., New York [24] Konev VV, Pergamenshchikov SM (2003) Sequential estimation of the parameters in a trigonometric regression model with the Gaussian coloured noise. Statistical Inference for Stochastic Processes 6:215–235 [25] Konev VV, Pergamenshchikov SM (2009) Nonparametric estimation in a semimartingale regression model. Part 1. Oracle Inequalities. Journal of Mathematics and Mechanics of Tomsk State University 3:23–41 [26] Konev VV, Pergamenshchikov SM (2009) Nonparametric estimation in a semimartingale regression model. Part 2. Robust asymptotic efficiency. Journal of Mathematics and Mechanics of Tomsk State University 4:31–45 [27] Konev VV, Pergamenshchikov SM (2010) General model selection estimation of a periodic regression with a Gaussian noise. Annals of the Institute of Statistical Mathematics 62:1083–1111 [28] Konev VV, Pergamenshchikov SM (2012) Efficient robust nonparametric estimation in a semimartingale regression model. Ann Inst Henri Poincaré Probab Stat 48(4):1217–1244 [29] Konev VV, Pergamenshchikov SM (2015) Robust model selection for a semimartingale continuous time regression from discrete data. Stochastic processes and their applications 125:294 – 326 [30] Konev VV, Pergamenshchikov SM, Pchelintsev E (2014) Estimation of a regression with the pulse type noise from discrete data. Theory Probab Appl 58(3):442–457 [31] Kutoyants YuA (1977) Estimation of the signal parameter in a Gaussian Noise. Problems of Information Transmission 13(4):29–36 [32] Kutoyants YuA (1984) Parameter Estimation for Stochastic Processes. Heldeman-Verlag, Berlin 19 [33] Limnios N, Oprisan G (2001) Semi-Markov Processes and Reliability. Birkhäuser, Boston [34] Mallows C (1973) Some comments on Cp . Technometrics 15:661–675 [35] Massart P (2005) A non-asymptotic theory for model selection. European Congress of Mathematics, Eur. Math. Soc., Zürich [36] Mikosch T (2004) Non-Life Insurance Mathematics. An Introduction with Stochastic Processes. Springer [37] Nussbaum M (1985) Spline smoothing in regression models and asymptotic efficiency in L2 . Ann Stat 13:984–997 [38] Pchelintsev E (2013) Improved estimation in a non-Gaussian parametric regression. Stat Inference Stoch Process 16(1):15 – 28 [39] Pchelintsev EA, Pchelintsev VA, Pergamenshchikov SM (2017) Improved robust model selection methods for the Levy nonparametric regression in continuous time. Preprint 2017 http://arxiv.org/abs/1710.03111 submitted in Stochastic Processes and their Applications [40] Pinsker MS (1981) Optimal filtration of square integrable signals in Gaussian white noise. Problems of Transimission information 17:120– 133 20
10math.ST
Estimated Depth Map Helps Image Classification Yihui He∗ Xi’an Jiaotong University Xi’an, China arXiv:1709.07077v1 [cs.CV] 20 Sep 2017 [email protected] Abstract We consider image classification with estimated depth. This problem falls into the domain of transfer learning, since we are using a model trained on a set of depth images to generate depth maps (additional features) for use in another classification problem using another disjoint set of images. It’s challenging as no direct depth information is provided. Though depth estimation has been well studied [16], none have attempted to aid image classification with estimated depth. Therefore, we present a way of transferring domain knowledge on depth estimation to a separate image classification task over a disjoint set of train, and test data. We build a RGBD dataset based on RGB dataset and do image classification on it. Then evaluation the performance of neural networks on the RGBD dataset compared to the RGB dataset. From our experiments, the benefit is significant with shallow and deep networks. It improves ResNet-20 by 0.55% and ResNet-56 by 0.53%.Our code and dataset are available publicly.1 Figure 1. Learning on RGBD dataset: First we generate the depth map of an image with a depth estimation network (On the Left). Second, we perform image classification on the depth map and the image. ing data. Different from previous efforts, we propose to utilize estimated depth maps in a image classification task. While extensively studied in semantic labeling and accuracy improvement, depth map regression has been less explored in its application to classification problems. Intuitively, one can imagine that a neural-network that is deep enough would generate it’s own depth-map (or at least simulate depth-map-like features). Recently, the efficacy and power of the deep convolutional neural network (CNN) has been made accessible [10, 12]. With a CNN, we are able to perform depth estimation on a single image [16]. However, most classification tasks still perform on RGB images. With only RGB images, CNN features have been setting new records for a wide variety of vision applications [10, 17, 7, 18, 3]. Despite all the successes in depth estimation and image classification, the deep CNN has been not yet been used for learning on RGBD images, since RGBD datasets are not as widely-used as RGB datasets. We propose to build a RGBD dataset based on RGB dataset and do image classification on it, illustrated in Figure 1. Then evaluation the performance of neural networks on the RGBD dataset compared to the RGB dataset. To our knowledge, we are the first to bridge gap between estimated depth and image classification. From our experiments, the 1. Introduction Estimating depths from a single monocular image depicting general scenes is a fundamental problem in computer vision, which has widespread applications in sceneunderstanding, 3D modeling, robotics, and other challenging problems. It is a notorious example of an ill-posed problem, as one captured image may correspond to numerous real world scenes [6]. It remains a challenging task for computer vision algorithms as no reliable cues can be exploited, such as temporal information, stereo correspondences. Previous research involving depth maps usually involve geometric [11, 9, 8], convolutional [16] and semantic [14] techniques. Nevertheless, none of these works tried to perform image classification using depth maps as train∗ This work was done as course project of Advanced Data Mining in UCSB 1 github.com/yihui-he/Estimated-Depth-Map-Helps-ImageClassification 1 benefit is significant on both shallow and deep networks. It improves ResNet-20 0.55%. To sum up, we highlight the main contributions of this work as follows: • We created a RGBD image dataset for CIFAR-10. • We illustrate that depth channel has a better feature representation than R,G,B channels, and show that training on RGBD images could improve performance. Figure 2. Transer Learning: Build RGBD CIFAR-10 dataset • We define a new metric for ill-posed depth prediction problem. 2. Related Work CNN have been applied with great success for object classification [13, 19, 20, 10, 2] and detection [7, 18, 3]. CNN have recently been applied to a variety of other tasks, like depth estimation. Depth estimation from single image is well addressed by Liu et al. [16] and Eigen et al. [5]. They both agree that depth estimation is an ill-posed problem, since there’s no real ground truth depth map. We define transfer learning accuracy metric for depth estimation model (Section 3.1). It becomes easier to compare performance of different depth estimation model. Estimated depth map [16] has been successfully applied to some other problems. Based on depth information, performance improved on semantic labeling [5]. However, depth maps have not been combined with an image classification task. To our knowledge, we are the first to bridge gap between depth estimation and image classification. There are already many successful transfer learning results in Computer Vision. A popular one is transfer ImageNet [4] Classification Network like VGG-16 [19] to object detection [18]. Another example also in object detection is contextualized networks [15], usually through multi scale context. 3. Approach Recent depth image research works mainly focus on depth-estimation [16] and segmentation with depth image [5]. And we’ve witnessed significant improvement on depth estimation quality in these years. However, most image classification tasks nowadays are still performed on RGB images. So we want to transfer depth knowledge learned by depth estimation model into our image-classification model. In this section, we first built a RGBD dataset for CIFAR10 [13], based on a trained deep convolutional neural field model [16]. To investigate the effect of the depth channel on image classification task, we design two experiments (one with a simple feedforward NN and one with a CNN) Finally, we propose a new metric for depth estimation performance measurement. Figure 3. Depth map estimated by deep convolutional neural field 3.1. Build RGBD Dataset Since the Deep Convolutional Neural Field model accepts images [4] that are much larger that CIFAR-10 tiny images (32 × 32), we build RGBD dataset as follow: 1. resize CIFAR-10 tiny image (32 × 32 × 3) to normal size (400 × 400 × 3) in order to feed in CNF. 2. perform depth estimation on the normal size image. 3. downscale the output image (depth image, 400×400× 1) back to tiny image (32 × 32 × 1). 4. combine RGB and D channels together as our RGBD image (32 × 32 × 4). Figure 2 shows the transfer learning procedure. Figure 3 shows some depth maps. Since there is no ground-truth depth image for CIFAR-10 dataset, we can’t directly measure the quality of our depth estimation attempts for these tiny images. However, we can infer this indirectly.We can use the accuracy results of our two experiments as a new metric to quantify depth map quality. 3.2. Classification Task on RGBD Dataset In order to make it easier to show effect of depth channel, we employ a simple two layer neural network for classification task. The architecture for learning on the RGBD dataset is shown in Figure 1. 0.50 0.6 0.5 0.40 val accuracy validation accuracy 0.45 0.35 0.30 0.3 0.25 0.20 0.4 0.2 0 20 40 60 80 100 Epoch 120 140 160 180 Figure 4. R vs G vs B vs D, testing time The number of neurons in the input layer depends on input. If input is a single channel (R, G, B, D), we have 32×32 neurons. The amount of hidden neurons is not determined. We perform fine tuning for each situation. The number of output neurons is always number of classes (10 classes for CIFAR-10). 4. Experiment We measure depth map quality in two ways. First, we evaluate neural network performance on R, G, B, D channel as input respectively. Second, we train neural network on RGB, RGBD respectively and compare the performance. Our depth estimation is based on Tensorflow [1]. And our neural network training is based on Caffe [12]. 4.1. R vs G vs B vs D We perform fine tuning on each channel. So that their performances are approximately optimal. Figure 4 shows validation accuracy comparison through time. You can see that, at testing time, the depth channel outperforms R, G, B channels under the same architecture. This implies that, depth channel has a better feature representation than R, G, B channels. Training on RGBD dataset would result in better performance for shallow networks. 4.2. RGB vs RGBD Figure 5 Compares validation accuracy comparison through time. We get 56% and 52% validation accuracy with RGBD and RGB dataset respectively. This can be seen as a sign that depth map brings extra knowledge learned by deep convolutional neural field to our classification task. Also notice that, although RGBD dataset have more inputs and neurons, it has a much higher converge rate than RGB dataset. It can be interpreted as a better feature representation brought by depth map. Estimated depth map works on shallow networks, however it remains a question whether it works on deep networks like ResNet [10]. 0 50 100 Epoch 150 200 250 Figure 5. RGB vs RGBD, testing time (RGBD:blue, RGB:red) Network two-layers ResNet-20 ResNet-56 RGB 48 8.75 6.97 RGBD 44 8.20 6.44 Table 1. Performance comparisons of ResNet with or without depth estimation aided on CIFAR-10 (Smaller is better). 4.3. ResNet Experimentation Our previous experiments using a 2-layer feed-forward neural network yielded a performance increase of 4%, when comparing a NN trained on the RGB dataset to the NN trained on the RGBD dataset. These results did’t satisfy us, as a simple feed-forward neural network may show how good the features are presented to it, but not the optimal tool used for image classification. We want to see whether the estimated depth map truely bring in some new knowledges of depth, which can’t be obtained just using RGB images. So we decided to test the performance of ResNet [10] over the CIFAR-10 RGB dataset and compare it to the performance achieved over our CIFAR-10 RGBD dataset. Similar with 2-layer networks, only number of channels of input layer is changed from 3 to 4. The increased computational complexity could be ignored, since later layers have much more channels. Shown in Table 1, ResNet-20 improves 0.45% with estimated depth map. ResNet-56 achieved error of 6.45% using the RGBD dataset, which is competitive with ResNet110 using RGB dataset. This performance gain of 0.53% in accuracy between RGBD and RGB using the CNN could not be ignored on CIFAR-10. We conclude that training on RGBD dataset would also result in better performance for deep networks like ResNet. Depth estimation feature may be hard to be generated by deep network itself. 5. Conclusion We created a RGBD image dataset for CIFAR-10. We define a transfer learning accuracy metric for depth predic- tion problem. On RGBD CIFAR-10, we show that depth channel has a better feature representation. Training on RGBD images could improve image classification on both shallow and deep networks. [13] References [14] [1] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mané, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viégas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. Software available from tensorflow.org. 3 [2] J. Carreira, H. Madeira, and J. G. Silva. Xception: A technique for the experimental evaluation of dependability in modern computers. IEEE Transactions on Software Engineering, 24(2):125–136, 1998. 2 [3] J. Dai, K. He, and J. Sun. Instance-aware semantic segmentation via multi-task network cascades. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3150–3158, 2016. 1, 2 [4] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. FeiFei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pages 248–255. IEEE, 2009. 2 [5] D. Eigen and R. Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In Proceedings of the IEEE International Conference on Computer Vision, pages 2650–2658, 2015. 2 [6] D. Eigen, C. Puhrsch, and R. Fergus. Depth map prediction from a single image using a multi-scale deep network. In Advances in neural information processing systems, pages 2366–2374, 2014. 1 [7] R. Girshick. Fast r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, pages 1440–1448, 2015. 1, 2 [8] A. Gupta, A. A. Efros, and M. Hebert. Blocks world revisited: Image understanding using qualitative geometry and mechanics. In Computer Vision–ECCV 2010, pages 482– 496. Springer, 2010. 1 [9] A. Gupta, M. Hebert, T. Kanade, and D. M. Blei. Estimating spatial layout of rooms using volumetric reasoning about objects and surfaces. In Advances in neural information processing systems, pages 1288–1296, 2010. 1 [10] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015. 1, 2, 3 [11] V. Hedau, D. Hoiem, and D. Forsyth. Thinking inside the box: Using appearance models and context based on room geometry. In Computer Vision–ECCV 2010, pages 224–237. Springer, 2010. 1 [12] Y. Jia, E. Shelhamer, J. Donahue, S. Karayev, J. Long, R. Girshick, S. Guadarrama, and T. Darrell. Caffe: Convolu- [15] [16] [17] [18] [19] [20] tional architecture for fast feature embedding. In Proceedings of the 22nd ACM international conference on Multimedia, pages 675–678. ACM, 2014. 1, 3 A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images, 2009. 2 L. Ladicky, J. Shi, and M. Pollefeys. Pulling things out of perspective. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 89–96, 2014. 1 J. Li, Y. Wei, X. Liang, J. Dong, T. Xu, J. Feng, and S. Yan. Attentive contexts for object detection. IEEE Transactions on Multimedia, 19(5):944–954, 2017. 2 F. Liu, C. Shen, and G. Lin. Deep convolutional neural fields for depth estimation from a single image. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5162–5170, 2015. 1, 2 A. Razavian, H. Azizpour, J. Sullivan, and S. Carlsson. Cnn features off-the-shelf: an astounding baseline for recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pages 806–813, 2014. 1 S. Ren, K. He, R. B. Girshick, and J. Sun. Faster R-CNN: towards real-time object detection with region proposal networks. CoRR, abs/1506.01497, 2015. 1, 2 K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. 2 C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1–9, 2015. 2
1cs.CV
COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS arXiv:1206.2512v2 [math.AC] 21 Dec 2012 ELIZABETH GROSS AND SONJA PETROVIĆ Abstract. Associated to any hypergraph is a toric ideal encoding the algebraic relations among its edges. We study these ideals and the combinatorics of their minimal generators, and derive general degree bounds for both uniform and non-uniform hypergraphs in terms of balanced hypergraph bicolorings, separators, and splitting sets. In turn, this provides complexity bounds for algebraic statistical models associated to hypergraphs. As two main applications, we recover a well-known complexity result for Markov bases of arbitrary 3way tables, and we show that the defining ideal of the tangential variety is generated by quadratics and cubics in cumulant coordinates. 1. Introduction The edge subring of a hypergraph H is the monomial subalgebra parametrized by the edges of H. We derive a general degree bound for the minimal generators of its defining ideal, IH , in terms of the structure of the underlying hypergraph. Let H be a hypergraph on V =Q{1, . . . , n} with edge set E. Each edge ei ∈ E of size d encodes a squarefree monomial xei := j∈ei xj of degree d in the polynomial ring k[x1 , . . . , xn ]. The edge subring of the hypergraph H, denoted by k[H], is the following monomial subring: k[H] := k[xei : ei ∈ E(H)]. The toric ideal of k[H], denoted IH , is the kernel of the monomial map φH : k[tei ] → k[H] defined by φH (tei ) = xei . The ideal IH encodes the algebraic relations among the edges of the hypergraph. For the special case where H is a graph, generating sets of the toric ideal of k[H] have been studied combinatorially in [12, 13], [15], [19], and [20, 21]. The motivation for studying toric ideals IH is threefold. First, explicit results that relate IH to combinatorial properties of H have existed only for graphs. Second, IH is related to the Rees algebra R(I(H)) of the edge ideal of H: in case when H is a graph, the presentation ideal of R(I(H)) is completely determined by generators of IH and the syzygies of the edge ideal I(H). Third, these toric ideals correspond to Markov bases for algebraic statistical models; this connection is outlined at the end of the Introduction. A starting point of our work is the fact that combinatorial signatures of generators of IH are balanced edge sets of H. Balanced edge sets on uniform hypergraphs were introduced in [14], and are referred to as monomial walks. This paper is based on the fact that the ideal IH is generated by binomials fE arising from primitive balanced edge sets E of H (See Proposition 3.1, a generalization of [14, Theorem 2.8]). A balanced edge set of H is a multiset of bicolored edges E = Eblue t Ered satisfying the following balancing condition: for each vertex v covered by E, the number of red edges 1 2 GROSS AND PETROVIĆ containing v equals the number of blue edges containing v, that is, (*) degblue (v) = degred (v). A binomial fE arises from E if it can be written as Y Y fE = te − te0 . e∈Eblue e0 ∈Ered Note that while H is a simple hypergraph (it contains no multiple edges), E allows repetition of edges. In addition, the balanced edge set E is primitive if there exists no other balanced 0 0 0 0 ( Ered ; this is the usual definition ( Eblue and Ered such that Eblue t Ered edge set E 0 = Eblue of an element in the Graver basis of IH . If H is a uniform hypergraph, a balanced edge set is called a monomial walk to conform with the terminology in [20, 21] and [14]. In what follows, we give two general degree bounds for generators of IH (Section 5), study the combinatorics of splitting sets and reducibility (defined in Section 3), and explore implications to algebraic statistics throughout. Section 4 focuses on indispensable binomials, i.e. binomials that are members of every minimal generating set of IH . Proposition 4.1 gives a combinatorial sufficient condition for determining whether a binomial f ∈ IH is indispensable. Consequently, the Graver basis is the unique minimal generating set of IH for any 2-regular hypergraph (Proposition 4.2). In particular, this means that the Graver basis is equal to the universal Gröbner basis, although the defining matrix need not be unimodular. Theorem 5.1 is a combinatorial criterion for the ideal of a uniform hypergraph to be generated in degree at most d ≥ 2. The criterion is based on decomposable balanced edge sets, separators, and splitting sets; see Definitions 3.2 and 3.3. Our result generalizes the well-known criterion for the toric ideal of a graph to be generated in degree 2 from [12] and [20, 21]. Splitting sets translate and extend the constructions used in [12] and [20, 21] to hypergraphs and arbitrary degrees. Theorem 5.3 provides a more general result for non-uniform hypergraphs. In algebraic statistics, any log-linear statistical model corresponds to a toric variety whose defining ideal gives a Markov basis for the model (cf. Fundamental Theorem of Markov bases [6], [8]). Since these varieties, by definition, have a monomial parametrization, we can also associate to any log-linear model M with a square-free parameterization a (non-uniform) hypergraph HM . By Proposition 3.1, Markov moves for the model M are described by balanced edge sets of HM : if E is a balanced edge set of HM , then a Markov move on a fiber of the model corresponds to replacing the set of red edges in E by the set of blue edges in E. Our degree bounds give a bound for the Markov complexity (Markov width) of the model M. For general references on Markov complexity of classes for some log-linear models, the reader should refer to [4], [5], [8, Chapter 1, §2] and [10]. We apply our combinatorial criteria to recover a well-known result in algebraic statistics from [4] in Corollary 4.8. Finally, we study the Markov complexity of a set of models from [18] called hidden subset models. Namely, Theorem 5.6 says that the ideal associated to the image of Tan((P1 )n ) in higher cumulants is generated by quadratics and cubics. 2. Preliminaries and notation We remind the reader that all hypergraphs in this paper are simple, that is, they contain no multiple edges. In contrast, balanced edge sets of hypergraphs are not, since the binomials COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS 3 arising from the sets need not be squarefree. Therefore, for the purpose of this manuscript, we will refer to a balanced edge set as a multiset of edges, with implied vertex set; and, as usual, V (E) denotes the vertex set contained in the edges in E. For the remainder of this short section, we will clear the technical details and notation we need for the proofs that follow. A multiset, M , is an ordered pair (A, f ) such that A is a set and f is a function from A to N>0 that records the multiplicity of each of the elements of A. For example, the multiset M = ({1, 2}, f ) with f (1) = 1 and f (2) = 3 represents M = {1, 2, 2, 2} where ordering doesn’t matter. We will commonly use the latter notation. Given a multiset M = (A, f ), the support of M is supp(M ) := A, and its size is |M | := P a∈A f (a). For two multisets M1 = (A, f1 ) and M2 = (B, f2 ), we say M2 ⊆ M1 if B ⊆ A and for all b ∈ B, f2 (b) ≤ f1 (b). M2 is a proper submultiset of M1 if B ( A, or there exists a b ∈ B such that f2 (b) < f1 (b). Unions, intersections, and relative complements of multisets are defined in the canonical way:   f1 (a) M1 ∪ M2 := (A ∪ B, g) where g(a) = f2 (a)  max(f (a), f (a)) 1 2 if a ∈ A \ B, if a ∈ B \ A, if a ∈ A ∪ B; M1 ∩ M2 := (A ∩ B, g) where g(a) = min(f1 (a), f2 (a)); ( f1 (a) if a ∈ A \ B, M1 − M2 := (C, g), where g(a) = f1 (a) − f2 (a) otherwise. and C = A \ B ∪ {a ∈ A ∩ B | f1 (a) − f2 (a) > 0} Note that the support of the union (intersection) of two multisets is the union (intersection) of their supports. Finally, we define a sum of M1 and M2 :   f1 (a) M1 t M2 := (A ∪ B, g) where g(a) = f2 (a)  f (a) + f (a) if a ∈ A ∩ B 1 2 if a ∈ A \ B, if a ∈ B \ A . If M1 t M2 is a balanced edge set, then the notation M1 tb M2 will be used to record the bicoloring of M1 t M2 : edges in M1 are blue, and edges in M2 are red. Finally, the number of edges in a hypergraph H containing a vertex v will be denoted by deg(v; H). For a bicolored multiset M := Mblue tm Mred , the blue degree degblue (v; M ) of a vertex v is defined to be deg(v; Mblue ). The red degree degred (v; M ) is defined similarly. 4 GROSS AND PETROVIĆ 3. Splitting sets and reducible edge sets The aim of this section is to lay the combinatorial groundwork for studying toric ideals of hypergraphs. In particular, we explicitly state what it combinatorially means for a binomial arising from a monomial walk to be generated by binomials of a smaller degree. We begin by describing the binomial generators of IH . Unless otherwise stated, H need not be uniform. Proposition 3.1. Every binomial in the toric ideal of a hypergraph corresponds to a balanced edge set. In particular, the toric ideal IH is generated by primitive balanced edge sets. Proof. Suppose E is a balanced multiset of edges over H. Define a binomial fE ∈ k[te : e ∈ E(H)] as follows: Y Y fE = te − te0 . e∈Eblue e0 ∈Ered The balancing condition (*) ensures that fE is in the kernel of the map φH . The second claim is immediate.  Motivated by the application of reducible simplicial complexes to understand the Markov bases of hierarchical log-linear models [7], we now introduce notions of reducibility and separators for balanced edge sets. For simplicity, we will often abuse notation and use H to denote the edge set of H. Definition 3.2. A balanced edge set E is said to be reducible with separator S, supp(S) ⊆ supp(E), and decomposition (Γ1 , S, Γ2 ), if there exist balanced edge sets Γ1 6= E and Γ2 6= E with S 6= ∅ such that S = Γ1red ∩ Γ2blue , E = Γ1 t Γ2 , and the following coloring conditions hold: Γ1red , Γ2red ⊆ Ered and Γ1blue , Γ2blue ⊆ Eblue . We say that S is proper with respect to (Γ1 , S, Γ2 ) if S is a proper submultiset of both Γ1red and Γ2blue . If S is not proper, then S is said to be blue with respect to (Γ1 , S, Γ2 ) if Γ1red = S, and red with respect to (Γ1 , S, Γ2 ) if Γ2blue = S. Figure 1 shows an example of a reducible balanced edge set E. The separator is proper and consists of the single green edge es ; it appears twice in the balanced edge set E, once as a blue edge and once as a red edge. Figure 2 shows a reducible balanced edge set where the separator, consisting of the two green edges e1 and e2 , is not proper. As before, the separator edges appear twice in the balanced edge set. If H is a hypergraph and E is a balanced edge set with supp(E) ⊆ H, given a multiset S with supp(S) ⊆ H, we can construct a new balanced edge set in the following manner: E + S := (Eblue t S) tm (Ered t S). Definition 3.3. Let H be a hypergraph. Let E be a balanced edge set with size 2n such that supp(E) ⊆ H. A non-empty multiset S with supp(S) ⊆ H is a splitting set of E with decomposition (Γ1 , S, Γ2 ) if E +S is reducible with separator S and decomposition (Γ1 , S, Γ2 ). S is said to be a blue (red, resp.) splitting set with respect to (Γ1 , S, Γ2 ), if S is a blue (red, resp.) separator of E + S with respect to (Γ1 , S, Γ2 ). S is a proper splitting set of E if there exists a decomposition (Γ1 , S, Γ2 ) of E + S such that S is a proper separator with respect to (Γ1 , S, Γ2 ). COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS !"# !"# Figure 1. Reducible balanced edge set. The green edge es is the separator. 5 !$# Figure 2. Reducible balanced edge set with an improper separator. The separator consists of green edges e1 and e2 . Example 3.4 (Group-based Markov model). Let V1 = {x1 , x2 , x3 , x4 }, V2 = {y1 , y2 , y3 , y4 }, and V3 = {z1 , z2 , z3 , z4 }. Let V be the disjoint union of V1 , V2 , and V3 . Let H be the 3-uniform hypergraph with vertex set V and edge set: e111 e221 e331 e441 = {x1 , y1 , z1 } = {x2 , y2 , z1 } = {x3 , y3 , z1 } = {x4 , y4 , z1 } e122 e212 e342 e432 = {x1 , y2 , z2 } = {x2 , y1 , z2 } = {x3 , y4 , z2 } = {x4 , y3 , z2 } e133 e243 e313 e423 = {x1 , y3 , z3 } = {x2 , y4 , z3 } = {x3 , y1 , z3 } = {x4 , y2 , z3 } e144 e234 e324 e414 = {x1 , y4 , z4 } = {x2 , y3 , z4 } = {x3 , y2 , z4 } = {x4 , y1 , z4 } The hypergraph H has applications in algebraic phylogenetics: it represents the parametrization of a particular group-based model from [17, Example 25]. Consider the monomial walk W = {e324 , e111 , e243 , e432 } tm {e122 , e313 , e234 , e441 }. Let S = {e133 , e212 }. Then S is a splitting set of W with decomposition (Γ1 , S, Γ2 ) where Γ1 = {e111 , e243 , e432 } tm {e133 , e212 , e441 } Γ2 = {e133 , e212 , e324 } tm {e122 , e313 , e234 }. The decomposition (Γ1 , S, Γ2 ) encodes binomials in IH that generate fW : fW = te324 (te111 te243 te432 − te133 te212 te441 ) + te441 (te133 te212 te324 − te122 te313 te234 ). The previous example illustrates the algebraic interpretation of a splitting set. Notice there is a correspondence between monomials in k[tei ] and multisets of edges of H. We will write E(taei11 taei22 · · · taeil ) for the multiset ({ei1 , . . . , eil }, f ) where l f : {ei1 , . . . , eil } → N eij 7→ aj . Thus the support of E(taei11 taei22 · · · taeil ) corresponds to the support of the monomial taei11 taei22 · · · taeil . l l If fE = u − v ∈ IH is the binomial arising from the balanced edge set E, then a monomial s corresponds to a splitting set S if and only if there exist two binomials u1 − v1 , u2 − v2 ∈ IH such that us = u1 u2 , vs = v1 v2 and s = gcd(v2 , u1 ). In this case, the decomposition of E + S is (Γ1 , S, Γ2 ) where Γ1 = E(u1 ) tm E(v1 ) and Γ2 = E(u2 ) tm E(v2 ). 6 GROSS AND PETROVIĆ For a balanced edge set, E, the existence of a spitting set determines whether the binomial fE ∈ IH can be written as the linear combination of two binomials fΓ1 ,fΓ2 ∈ IH . While, in general, the existence of a splitting set does not imply deg(fΓ1 ), deg(fΓ2 ) < deg(fE ), if H is uniform and the splitting set is proper, then the following lemma holds. Lemma 3.5. Let H be a uniform hypergraph and let W be a monomial walk with supp(W) ⊆ H and |W| = 2n. If S is a proper splitting set of W, then there exists a decomposition (Γ1 , S, Γ2 ) of W + S such that |Γ1 | < |W| and |Γ2 | < |W|. Proof. Let S be a proper splitting set of W. By definition, there exists a decomposition (Γ1 , S, Γ2 ) of W + S, such that S is a proper submultiset of Γ1red and Γ2blue . Let |Γ1 | = 2n1 and |Γ2 | = 2n2 . Since W + S = Γ1 t Γ2 , it follows that |W + S| = |Γ1 | + |Γ2 |. Then, 2n + 2|S| = 2n1 + 2n2 , which implies 2n − 2n1 = 2n2 − 2|S|. But S being a proper submultiset of Γ2blue gives that n2 > |S|, which, in turn, implies that n > n1 . By a similar argument, n > n2 . Thus |Γ1 | < |W| and |Γ2 | < |W|.  4. Indispensable Binomials A binomial f in a toric ideal I is indispensable if f or −f belongs to every binomial generating set of I. Indispensable binomials of toric ideals were introduced by Takemura et al, and are studied in [1], [2], [3], [13], [15]. Proposition 4.1. Let H be a hypergraph. Let E be a balanced edge set with supp(E) ⊆ H. Let fE be the binomial arising from E. If there does not exist a splitting set of E, then fE is an indispensable binomial of IH . Proof. Suppose E is not indispensable. Then there is a binomial generating set of IH , G = {f1 , . . . , fn }, such that fE ∈ / G and −fE ∈ / G. Since fE = fE+ −fE− ∈ IH , there is a fi = fi+ −fi− ∈ G such that fi+ or fi− divides fE+ . Without loss of generality, assume fi+ |fE+ . Since fi is a binomial in IH , fi arises from a monomial walk Ei on H. Let S = Eired . Let Γ1 = Ei and Γ2 = Γ2blue tm Γ2red where Γ2blue = ((Eblue − Eiblue ) t Eired ) Γ2red = Ered . Since fi+ |fE+ , the multiset Eiblue ⊆ Eblue , and thus Γ1 t Γ2 = E + S. By construction, Γ1red ∩ Γ2blue = S. Therefore S is a splitting set of E.  If every Graver basis element of a binomial ideal IH is indispensable, then the Graver basis of IH is the unique minimal generating set of IH . Propositions 4.2 and 4.6 describe two classes of hypergraphs where this is the case. In particular, for these hypergraphs, the universal Gröbner basis of IH is a minimal generating set. Proposition 4.2. If H is a 2-regular uniform hypergraph, then the Graver basis of IH is the unique minimal generating set of IH . For the proof of Proposition 4.2, we make use of Proposition 3.2 in [14] which concerns balanced edge sets that are pairs of perfect matchings. COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS 7 Definition 4.3. A matching on a hypergraph H = (V, E) is a subset M ⊆ E such that the elements of M are pairwise disjoint. A matching is called perfect if V (M ) = V . Proof of Proposition 4.2. Let G be the Graver basis of IH and let f ∈ G. Since every element of G is binomial, f arises from a primitive monomial walk W with supp(W) ⊆ H. Let Mb = supp(Wred ) and Mr = supp(Wblue ). By primitivity of W, the intersection Mr ∩Mb = ∅. Since W satisfies condition (*) and H is 2-regular, if e1 , e2 ∈ Mb and e1 ∩ e2 6= ∅, then e1 ∈ Mr or e2 ∈ Mr , which would contradict the primitivity of W. So Mb and Mr are two edge-disjoint perfect matchings on V (W). By Proposition 3.2 in [14], W contains no multiple edges, i.e. W = Mb tm Mr . Furthermore, since H is 2-regular, the edge set of the subhypergraph induced by V (W) is Mb ∪ Mr Suppose S is a splitting set of W with decomposition (Γ1 , S, Γ2 ). By the correspondence between primitive monomial walks and primitive binomials, there exists a primitive monomial walk Γ such that Γblue ⊆ Γ1blue and Γred ⊆ Γ1red (if Γ1 is primitive, then Γ = Γ1 ). By Proposition 3.2 in[14], Γ must be a pair of perfect matchings on V (Γ ). This means Γ is a proper balanced edge set of W, a contradiction. Therefore, by Proposition 4.1, fW is indispensable. Since every element in the Graver basis of IH is indispensable, there is no generating set of IH strictly contained in the Graver basis, and the claim follows.  Definition 4.4. A k-uniform hypergraph H = (V, E) is k-partite if there exists a partition of V into k disjoint subsets, V1 , . . . , Vk , such that each edge in E contains exactly one vertex from each Vi . Lemma 4.5. Let H = (V, E) be a k-uniform k-partite hypergraph with E = Eb t Er and Eb ∩ Er = ∅. If there exists a Vi , 1 ≤ i ≤ k, such that deg(v; Er ) = deg(v; Eb ) = 1 for all v ∈ Vi , then a monomial walk W with support E is primitive only if W contains no multiple edges. Proof. Follows from the proof of necessity of Proposition 3.2 in [14].  Proposition 4.6. Let H = (V, E) be a k-uniform k-partite hypergraph. If there exists a Vi such that deg(v; E) = 2 where for all v ∈ Vi , then the Graver basis of IH is the unique minimal generating set of IH . Proof. The proof is similar to the proof of Proposition 4.2. Note that while H may not be 2regular, one of its parts, Vi , is ‘locally’ 2-regular, and thus restricts the structure of monomial walks on H. In particular, Lemma 4.5 ensures that Mr and Mb , are edge-disjoint perfect matchings on V (W)|Vi , and the rest of the proof follows immediately.  Example 4.7 (No 3-way interaction). The toric ideal of the hypergraph H in Figure 3 corresponds to the hierarchical log-linear model for no 3-way interaction on 2 × 2 × 2 contingency tables. This statistical model is a common example in algebraic statistics [8, Example 1.2.7]. Since there is exactly one primitive monomial walk W on H that travels through 8 edges, IH = (fW ). For 2 × 3 × 3 contingency tables with no 3-way interaction, the hypergraph corresponding to this log-linear model has 18 edges. The hypergraph in this case is H = (V, E) where V = {x00 , x01 , x02 , x10 , x11 , x12 , y00 , y01 , y02 , y10 , y11 , y12 , z00 , z01 , z02 , z10 , z11 , z12 , z20 , z21 , z22 } and the 8 GROSS AND PETROVIĆ Figure 3. edge set is: e000 e010 e020 e100 e110 e120 = {x00 , y00 , z00 } = {x01 , y00 , z10 } = {x02 , y00 , z20 } = {x10 , y10 , z00 } = {x11 , y10 , z10 } = {x12 , y10 , z20 } e001 e011 e021 e101 e111 e121 = {x00 , y01 , z01 } = {x01 , y01 , z11 } = {x02 , y01 , z21 } = {x10 , y11 , z01 } = {x11 , y11 , z11 } = {x12 , y11 , z21 } e002 e012 e022 e102 e112 e122 = {x00 , y02 , z02 } = {x01 , y02 , z12 } = {x02 , y02 , z22 } = {x10 , y12 , z02 } = {x11 , y12 , z12 } = {x12 , y12 , z22 } Let W be the primitive monomial walk W = {e000 , e101 , e011 , e112 , e022 , e120 } tm {e100 , e001 , e111 , e012 , e122 , e220 .} Every remaining edge H that does not appear in W is not contained in V (W), thus it can be easily verified that there does not exist a splitting set of W, so by Proposition 4.1, fW is indispensable. In fact, H satisfies the condition of Proposition 4.6 and thus every binomial in IH corresponding to a primitive monomial walk is indispensable. From the above discussion, we can see that if a uniform hypergraph H contains an induced subhypergraph Hs that is 2-regular and there exists a bicoloring such that with this bicoloring Hs is also a balanced edge set, then the maximum degree of any minimal generating set of IH is at least |E(Hs )|/2. A similar statement holds for k-uniform, k-partite hypergraphs with vertex partition V = ∪ki=1 Vi . Namely, if H contains an induced subhypergraph Hs that is 2-regular on Vi (i.e., H satisfies the conditions of Proposition 4.6) and there exists a bicoloring such that with this bicoloring Hs is a balanced edge set (e.g., Hs is a pair of disjoint perfect matchings), then the maximum degree of any minimal generating set of IH is at least |E(Hs )|/2. Recall that degree bounds on minimal generators give a Markov complexity bound for the corresponding log-linear model in algebraic statistics. This allows us to recover a well-known result: Corollary 4.8 (Consequence of Theorem 1.2 in [4]; see also Theorem 1.2.17 in [8]). The Markov complexity for the no 3-way interaction model on 3 × r × c contingency tables grows arbitrarily large as r and c increase . Proof. For the no 3-way interaction model on 2 × r × c contingency tables, we can construct a primitive binomial fHs of degree 2 · min(r, c) in its defining toric ideal by taking a cycle COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS 9 of length min(r, c) on the bipartite graph Kr,c . (We remind the reader that this is precisely how fW is constructed in Example 4.7). By noting that the hypergraph associated to this binomial Hs is an induced subhypergraph of the hypergraph associated to the 3 × r × c case and that Hs is 2-regular in one of the partitions, the claim follows by Proposition 4.6.  5. General degree bounds and an application For uniform hypergraphs, balanced edge sets are referred to as monomial walks. In the previous sections, we saw that splitting sets of W translate to algebraic operations on the binomials fW , providing a general construction for rewriting a high-degree binomial in terms of binomials corresponding to shorter walks. This, along with Lemma 3.5, is the key to the general degree bound result. Theorem 5.1. Given a k-uniform hypergraph H, the toric ideal IH is generated in degree at most d if and only if for every primitive monomial walk W of length 2n > 2d, with supp(W) ⊆ H, one of the following two conditions hold: i) there exists a proper splitting set S of W, or ii) there is a finite sequence of pairs, (S1 , R1 ), . . . , (SN , RN ), such that • S1 and R1 are blue and red splitting sets of W of size less than n with decompositions (Γ11 , S1 , Γ21 ) and (Υ11 , R1 , Υ21 ), • Si+1 and Ri+1 are blue and red splitting sets of Wi = Γ2iblue tm Υ1ired of size less than n with decompositions (Γ1i+1 , Si+1 , Γ2i+1 ) and (Υ1i+1 , Ri+1, Υ2i+1 ), and, • SN ∩ RN 6= ∅ or there exists a proper splitting set of WN . Proof of necessity (⇒). Let H be a k-uniform hypergraph whose toric ideal IH is generated in degree at most d. Let W be a primitive monomial walk of length 2n > 2d. Let pW = u − v be the binomial that arises from W. Since IH is generated in degree at most d, there exist primitive binomials of degree at most d, (u1 − v1 ), . . . , (us − vs ) ∈ k[tei ], and m1 , . . . , ms ∈ k[tei ], such that pW = m1 (u1 − v1 ) + m2 (u2 − v2 ) + . . . + ms (us − vs ). By expanding and reordering so that m1 u1 = uw , ms vs = vw , and mi vi = mi+1 ui+1 for all i = 1, . . . , s − 1, we may and will assume that m1 , . . . , ms are monomials. If gcd(mi , mi+1 ) 6= 1 for some i, we can add the terms mi (ui − vi ) and mi+1 (ui+1 − vi+1 ) to get a new term, m0i (u0i − vi0 ), where m0i = gcd(mi , mi+1 ) and (u0i − vi0 ) is an binomial of IH of degree less than n. Continuing recursively in the manner, we have pW = m01 (u01 − v10 ) + m02 (u02 − v20 ) + . . . + m0r (u0r − vr0 ) where m01 u01 = u0w , m0r vr0 = vw0 , m0i vi0 = m0i+1 u0i+1 , gcd(m0i , m0i+1 ) = 1 for all i = 1, . . . , r − 1, and deg(u0i − vi0 ) < n for all i = 1, . . . r. For convenience, we will drop the superscripts and write pw = m1 (u1 − v1 ) + m2 (u2 − v2 ) + . . . + mr (ur − vr ). 10 GROSS AND PETROVIĆ Case 1: r = 2. In this case, pW = m1 (u1 − v1 ) + m2 (u2 − v2 ). Let Γ1 := E(u1 ) tm E(v1 ) Γ2 := E(u2 ) tm E(v2 ) S := E(v1 ) ∩ E(u2 ) = E(gcd(v1 , u2 )). We want to show (Γ1 , S, Γ2 ) is a decomposition of W + S. Since S = Γ1red ∩ Γ2blue , Γ1blue ⊆ Wblue , and Γ2red ⊆ Wred , we only need to show W + S = Γ1 t Γ2 , Γ2red ⊆ (W + S)red , and Γ2blue ⊆ (W + S)blue . First, notice the following equalities hold: W + S = (Wblue t S) t (Wred t S) = E(u) t S t E(v) t S = E(m1 u1 ) t S t E(m2 v2 ) t S = E(m1 ) t E(u1 ) t S t E(m2 ) t E(v2 ) t S. Let s ∈ k[tei ] be the monomial such that E(s) = S, so s = gcd(v1 , u2 ). The equality m1 v1 = m2 u2 implies m1 ( vs1 ) = m2 ( us2 ). Now, vs1 and us2 are clearly relatively prime, and by the assumptions on pW , m1 and m2 are relatively prime. This means the equality m1 ( vs1 ) = m2 ( us2 ) implies m1 = us2 and m2 = vs1 . Thus, Γ1 t Γ2 = E(u1 ) t E(v1 ) t E(u2 ) t E(v2 ) v1 u2 = E(u1 ) t E( ) t S t E(v2 ) t E( ) t S s s = E(u1 ) t E(m2 ) t S t E(v2 ) t E(m1 ) t S. Consequently, W + S = Γ1 t Γ2 . Notice the equality m2 = vs1 also implies Γ1red = E(v1 ) = E(m2 ) t S. This means Γ1red ⊆ (E(m2 u2 ) t S) = (Wred t S) = (W + S)red . By a similar observation, Γ2blue ⊆ (W + S)blue . Case 2: r = 2N + 1. For 1 < i < N , let Γ1i = E(ui ) tm E(vi ) Γ2i = E(mi+1 ui+1 ) tm E(m2N −i+2 v2N −i+2 ) Si = E(vi ) ∩ E(mi+1 ui+1 ) = E(gcd(vi , mi+1 ui+1 )) = E(vi ). For 1 < i < N , let Υ1i = E(mi ui ) tm E(m2N −i+1 v2N −i+1 ) Υ2i = E(u2N −i+2 ) tm E(v2N −i+2 ) Ri = E(m2N −i+1 v2N −i+1 ) ∩ E(u2N −i+2 ) = E(gcd(m2N −i+1 v2N −i+1 , u2N −i+2 )) = E(u2N −i+2 ). One can follow the proof of Case 1) to see that S1 and R1 are splitting sets of W, and Si+1 and Ri+1 are splitting sets of Wi = E(mi+1 ui+1 ) tm E(m2N −i+1 v2N −i+1 ) for i = 1, . . . , N − 1. Furthermore, by definition, they are blue and red splitting sets (resp.) of size less than 2n. Since WN −1blue = Γ2N −1blue and WN −1red = Υ1N −1red , the binomial arising from the walk on WN −1 is mN uN − mN +2 vN +2 = mN (uN − vN ) + mN +1 (uN +1 − vN +1 ) + mN +2 (uN +2 − vN +2 ). Choose e ∈ H such that te | mN +1 , then te | vN and te | uN +2 . But since SN = E(vN ) and RN = E(uN +2 ), e ∈ SN and e ∈ RN , so SN ∩ RN 6= ∅. COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS 11 Case 3: r = 2N + 2. For 1 < i < N , let Γ1i = E(ui ) tm E(vi ) Γ2i = E(mi+1 ui+1 ) tm E(m2N −i+3 v2N −i+3 ) Si = E(vi ) ∩ E(mi+1 ui+1 ) = E(gcd(vi , mi+1 ui+1 )) = E(vi ). For 1 < i < N , let Υ1i = E(mi ui ) tm E(m2N −i+2 v2N −i+2 ) Υ2i = E(u2N −i+3 ) tm E(v2N −i+3 ) Ri = E(m2N −i+2 v2N −i+2 ) ∩ E(u2N −i+3 ) = E(gcd(m2N −i+2 v2N −i+2 , u2N −i+3 )) = E(u2N −i+3 ). We can follow the proof of Case 1) to see that S1 and R1 are splitting sets of W, and Si+1 and Ri+1 are splitting sets of Wi = E(mi+1 ui+1 ) tm E(m2N −i+2 v2N −i+2 ) for i = 1, . . . , N − 1. Furthermore, by definition, they are blue and red (resp.) splitting sets of size less than n. Since WNblue = Γ2Nblue and WNred = Υ1Nred , the binomial arising from WN is mN +1 uN +1 − mN +2 vN +2 = mN +1 (uN +1 − vN +1 ) + mN +2 (uN +2 − vN +2 ) which is exactly case 1), which means there exists a proper splitting set of WN .  Proof of sufficiency (⇐). Assume every primitive monomial walk W of length 2n > 2d with supp(W) ⊂ H satisfies i) or ii). Let pW = u − v be a generator of IH which arises from the monomial walk W on H. To show that IH = [IH ]≤d , we proceed by induction on the degree of pW . If deg pW = 2, then pW ∈ [IH ]≤d . So assume deg pW = n > d and every generator of IH of degree less than n is in [IH ]≤d . Since the size of W is greater than 2d, either condition i) holds or condition ii) holds. Suppose i) holds. By Lemma 3.5, there exists a decomposition of W, (Γ1 , S, Γ2 ), such that |Γ1 | < |W| and |Γ2 | < |W|. Let pΓ1 = u1 − v1 (pΓ2 = u2 − v2 , respectively) be the binomial that arises from Γ1 (Γ2 , respectively). Let m1 = u/u1 and m2 = v/v2 . What remains to be shown is that pW = m1 pΓ1 + m2 pΓ2 , that is, u − v = m1 (u1 − v1 ) + m2 (u2 − v2 ). However, it is clear that u = m1 u1 and v = m2 v2 , so it suffices to show is that m1 v1 = m2 u2 , or equivalently, E(m1 v1 ) = E(m2 u2 ). Let s ∈ k[tei ] be the monomial such that E(s) = S. Then v1 u2 Γ1 t Γ2 = (E(u1 ) t E( ) t S) t (E( ) t S t E(v2 )) s s and W + S = (E(m1 ) t E(u1 ) t S) t (E(m2 ) t E(v2 ) t S). Thus, since W + S = Γ1 t Γ2 , v1 u2 E(m1 ) t E(m2 ) = E( ) t E( ), s s which in turn implies v1 u2 m1 m2 = ( )( ). s s 12 GROSS AND PETROVIĆ Since W is primitive and the coloring conditions on (Γ1 , S, Γ2 ) imply E( vs1 ) ⊆ Wred and E(m1 ) ⊆ Wblue , the monomials m1 and vs1 are relatively prime. A similar argument shows m2 and us2 are relatively prime. Thus, m1 = us2 and m2 = vs1 , and consequently, E(m1 v1 ) = E(m2 u2 ) and pw = m1 pΓ1 + m2 pΓ2 . Since deg pΓ1 , deg pΓ2 < n, the induction hypothesis applied to pΓ1 and pΓ2 shows that pW ∈ [IH ]≤d . Now suppose ii) holds. For i from 1 to N , let pΓ1i = ui − vi and pΥ2i = yi − zi be the binomials arising from Γ1i and Υ2i . Let wib − wir be the binomial arising from the walk Wi and let pW = w0b − w0r . For 1 ≤ i ≤ N , let mi = w(i−1)b /ui , and qi = w(i−1)r /zi . Then pW = N X i=1 mi (ui − vi ) + wNb − wNr + N X qN +1−i (yN +1−i − zN +1−i ). i=1 The preceding claim follows from three observations: (1) by construction, w0b = m1 u1 and w0r = q1 z1 ; (2) by the definition of WN , wNb = mN vN and wNr = qN yN ; and (3) by the definitions of mi , qi , and the walk Wi , mi vi = mi+1 ui+1 and qi+1 zi+1 = qi yi for 1 ≤ i ≤ N − 1. As on the splitting sets of Wi , the linear combination PN PNa consequence of the size conditions q m (u − v ) ∈ [I ] and i i i H ≤d i=1 N +1−i (yN +1−i − zN +1−i ) ∈ [IH ]≤d . So if WN satisfies i=1 condition i), the binomial wNb − wNr ∈ [IH ]≤d , and thus, pW ∈ [IH ]≤d . To finish the proof, assume that SN and RN share an edge, e. Then the claim above becomes: pW = N X i=1 N X mN vN qN y N mi (ui − vi ) + te ( − )+ qN +1−i (yN +1−i − zN +1−i ) te te i=1 and we just need to show that, in fact, te divides mN vN and qN yN . But this is clear to see since e ∈ SN which implies te |vN and e ∈ RN which implies te |yN .  Example 5.2 (Independence models). Let H be the complete k-partite hypergraph with d vertices in each partition V1 , . . . , Vk . These hypergraphs correspond to the independence model in statistics. Equivalently, the edge subring of the complete k-partite hypergraph with d vertices in each partition parametrizes the Segre embedding of Pd × · · · × Pd with k copies. The ideal IH is generated by quadrics. To see this, let W, supp(W) ⊆ H, be a primitive monomial walk of length 2n, n > 2. Choose a multiset E 0 ⊂ W consisting of n − 1 blue and n − 1 red edges. Since each edge must contain a vertex from each Vi , for each i, there is at most one vertex in V (E 0 ) ∩ Vi that is not covered by a red edge and a blue edge from E 0 . Consequently, V (E 0 ) contains a vertex from each Vi that belong to at least one red edge and at least one blue edge of E 0 . For a multiset of edges, M , with supp(M ) ⊆ H, we define the max degree of a vertex: maxdeg(v; M ) := max(degred (v; M ), degblue (v; M )). The partitioning of the vertices ensures that V (E 0 ) cannot contain more then k vertices whose maxdeg with respect to E 0 is n − 1. Indeed, if there are more that k vertices with maxdeg equal to n − 1, then two of those vertices must belong to the same partition, Vj . This would imply that W contains at least 4(n − 1) edges, which is impossible when n > 2. Next, choose n − 1 new blue edges and n − 1 red edges in the following manner: COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS 13 Figure 4. Let db (v) := degblue (v; E 0 ) and dr (v) := degred (v; E 0 ). For i = 1, . . . , k choose a vertex from 0 0 V (Eblue ) ∩ V (Ered ) ∩ Vi that has the largest maxdeg with respect to E 0 ; let bn−1 and rn−1 be this set of vertices. For all v ∈ bn−1 , reduce db (v) and dr (v) by 1. Now choose b1 , . . . , bn−2 by the following algorithm: for i from 1 to k do: let Vi :=sort V (E 0 ) ∩ Vi by db (v) in decreasing order; for j from n − 2 down to 1 do: ( bj := list {vi : vi is first element in Vi }; for all v ∈ bj do db (v) = db (v) − 1; for i from 1 to k do Vi =sort Vi by db (v) in decreasing order; ). Let R1 = {b1 , . . . , bn−1 } and S1 = {r1 , . . . , rn−1 }. Then R1 and S1 are red and blue splitting sets of W that share an edge. Thus, condition ii) of Theorem 5.1 is met, and consequently IH is generated in degree 2. When H is a non-uniform hypergraph, the toric ideal IH is not necessarily homogeneous. For example, Figure 4 supports a binomial in IH where H consists of edges of size two and four; note that the edges still satisfy the balancing condition (*). However, we can still modify the conditions of Theorem 5.1 to find degree bounds for the toric ideals of non-uniform hypergraphs. Proposition 5.3 gives a prescription for determining a degree bound on the generators of IH in terms of local structures of H. Proposition 5.3. Given a hypergraph H and a binomial fE ∈ IH arising from the balanced edge set E with n = |Eblue | ≥ |Ered |, fE is a linear combination of binomials in IH of degree less than n if one of the following two conditions hold: i) there exists a proper splitting set S of E with decomposition (Γ1 , S, Γ2 ) where |Γiblue |, |Γired | < n for i = 1, 2, or ii) there is a pair of blue and red splitting sets of E, S and R, of size less than n with decompositions (Γ1 , S, Γ2 ), (Υ1 , R, Υ2 ) such that |Γ1blue |, |Υ2red | < n, |Γ2blue |, |Υ1red | ≤ n, and S ∩ R 6= ∅. Proof. This proof follows the proof of sufficiency for Theorem 5.1. Note that in the proof, the uniform condition doesn’t play an essential role; it is only invoked to bound the size of the red and blue parts of each monomial hypergraph appearing in the decompositions 14 GROSS AND PETROVIĆ involved. Thus, the hypothesis of Proposition 5.3 acts in place of the uniform condition in Theorem 5.1.  We close with an application. For the remainder of this section, we will concern ourselves with the first tangential variety, Tan((P1 )n ). In [18], Sturmfels and Zwiernik use cumulants to give a monomial parameterization of Tan((P1 )n ). The variety Tan((P1 )n ) is associated to a class of hidden subset models [18, Example 5.2], and context-specific independence models [11]. We now derive a bound for the toric ideal of the image of Tan((P1 )n ) in higher cumulants and, equivalently, for the Markov complexity of these models. Example 5.4. Let H = (V, E) where V = {1, . . . , n} and E = {e : e ⊆ V and |e| ≥ 2}. Then the set of polynomials vanishing on the image of Tan((P1 )n ) in higher cumulants is the toric ideal IH (see [18, Theorem 4.1]). The hypergraph in Example 5.4 is the complete hypergraph on n vertices after removing all singleton edges. The degree bound on the generators of this hypergraph can be found by looking at a smaller hypergraph. Lemma 5.5. Let H1 = (V, E1 ) where V = {1, . . . , n} and E1 = {e : e ⊆ V and |e| ≥ 2}, and let H2 = (V, E2 ) where E2 = {e ⊆ V : 2 ≤ |e| ≤ 3}. If the ideal IH2 is generated in degree at most d, then the ideal IH1 is generated in degree at most d. Proof. Consider IH2 as an ideal in the bigger polynomial ring S := k[tei : ei ∈ H1 ], denoted as I˜H2 := IH2 S. Assume that IH2 , and consequently, I˜H2 , is generated in degree at most d. Pick an arbitrary binomial u − v = tei1 tei2 · · · tein − tej1 tej2 · · · tejm ∈ IH1 . Since every edge e ∈ H1 is the disjoint union of a collection of edges ek1 , . . . , ekl ∈ H2 , we Q may write te − li=1 teki ∈ IH1 . Noting that " j ! # l l−2 Y Y X te − teki = (te − tek1 t∪li=2 ek ) − teki (t∪li=j+1 ek − tej+1 t∪li=j+2 ek ) , i i=1 i j=1 i i=1 Q one easily sees that the binomial te − li=1 teki is generated by quadratics. In turn, this essentially shows that relations in IH2 allow us to rewrite u−v in terms of edges ei1 , . . . , ein , ej1 , . . . , ejm ∈ E2 of size 2 and 3 only. The claim follows since u−v can be expressed as a binomial in I˜H2 .  Theorem 5.6. Let H = (V, E) where V = {1, . . . , n} and E = {e ⊆ V : 2 ≤ |e| ≤ 3}. The toric ideal of H is generated by quadrics and cubics. In particular the image of Tan((P1 )n ) in higher cumulants is generated in degrees 2 and 3. In the following proof, we examine the local combinatorics of H to illustrate how the structure of a hypergraph reveals insights into the generating set of IH . Proof. Let fE be a primitive binomial in IH with E a balanced edge set. Without loss of generality, we will assume throughout the proof |Eblue | ≥ |Ered |. If E contains only 2-edges or only 3-edges, then by [16, Theorem 14.1] fE is a linear combination of quadratics. So we will assume E contains a 2-edge and a 3-edge. COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS 15 Since |Eblue | ≥ |Ered |, Eblue must contain at least as many 2-edges as Ered , and in order to satisfy (*), the difference between the number of 3-edges in Ered and the number of 3-edges in Eblue must be a multiple of 2. Notice that for every pair e1 , e2 of 3-edges (where e1 and e2 do not need to be unique), there are three 2-edges in H, e3 , e4 , e5 , such that {e1 , e2 } tm {e3 , e4 , e5 } is a balanced edge set. Let B2,3 ⊂ IH be the set of all binomials arising from balanced edge 0 sets of this form. Then fE is a linear combination of binomials in B2,3 and fE 0 , where Eblue 0 and Ered contains the same number of 2-edges and exactly one 3-edge. Since it suffices to consider primitive binomials, we will proceed inductively by showing that every primitive degree n binomial in Bh := {fE ∈ IH : |Eblue | = |Ered | and Eblue , Ered contain exactly one 3-edge each} is a linear combination of binomials in Bh with degree less than n. Let fE ∈ Bh such that degree fE = n > 3 and fE is primitive. Let e1 be the 3-edge in Ered . Since fE is primitive, e1 must intersect a 2-edge e2 in Eblue . Let e2 = {v1 , v2 } where v1 ∈ e1 . The edge e2 intersects at most one other edge of Ered besides e1 . We will examine the possible intersections of e2 and Ered in order to find splitting sets of E that satisfy one of the conditions listed in Proposition 5.3. For illustrations of Case 1 and Case 3 see Figures 5 and 6. In all three cases, we will construct S, Γ1 and Γ2 such that S is a splitting set of E with an associated decomposition (Γ1 , S, Γ2 ) which satisfies the properties of condition i) in Theorem 5.3. In fact, fE will be a linear combination of fΓ1 and fΓ2 , both of which have strictly lower degree than fE . Furthermore, since the blue and red parts of Γ1 and Γ2 will contain the same number of 2 and 3-edges, it follows that fΓ1 , fΓ2 ∈ Bh . Case 1: The edge e1 = e2 ∪ {v3 } = {v1 , v2 , v3 } for some v3 ∈ V (E). Since v3 ∈ / e2 and |Eblue | = |Ered |, there must be a 2-edge e3 ∈ Ered such that v3 ∈ / e3 in order for (*) to hold. Let e3 = {v4 , v5 } and e4 = {v3 , v4 , v5 }. The sets S, Γ1 and Γ2 in this case are: S = {e4 } Γ1 = (Eblue − {e2 }) tm ((Ered − {e1 , e3 }) t {e4 }) Γ2 = {e2 , e4 } tm {e1 , e3 }. !$# !%# !"# !"# !$## !%# !&# !&# Figure 5. Case 1 Figure 6. Case 3 Case 2: The edge e1 = {v1 , v3 , v4 } for some v3 , v4 ∈ V (E) and there is a 2-edge e3 ∈ Ered such that e3 = {v2 , v3 }. 16 GROSS AND PETROVIĆ Since v3 ∈ / e2 , degblue (v3 ; E) = degred (v3 ; E) ≤ n − 1 and, thus, there exists a 2-edge e4 ∈ Ered such that v3 ∈ / e4 . Let e4 = {v5 , v6 }. Now let e5 = {v3 , v4 , v5 } and e6 = {v3 , v6 }. The sets S, Γ1 and Γ2 in this case are: S = {e5 , e6 } Γ1 = (Eblue − {e2 }) tm ((Ered − {e1 , e3 , e4 }) t {e5 , e6 }) Γ2 = {e2 , e5 , e6 } tm {e1 , e3 , e4 }. Case 3: There is a 2-edge e3 ∈ Ered such that v2 ∈ e3 and e2 ∩ e3 = ∅. In this case, let e4 = (e1 − {v1 }) ∪ (e3 − {v2 }). The sets S, Γ1 and Γ2 in this case are: S = {e4 } Γ1 = (Eblue − {e2 }) tm ((Ered − {e1 , e3 }) t {e4 }) Γ2 = {e2 , e4 } tm {e1 , e3 }.  Acknowledgements The authors would like to thank the anonymous referee for carefully reading the previous version of this manuscript and thus allowing us to greatly improve Section 5. We are also grateful to Despina Stasi and Seth Sullivant for helpful discussions. References [1] A. Takemura and S. Aoki. Some characterizations of minimal Markov basis for sampling from discrete conditional distributions, Ann. Inst. Statist. Math. 56 1 (2004), 117. [2] S. Aoki, A. Takemura, R. Yoshida. Indispensable monomials of toric ideals and Markov bases, Journal of Symbolic Computation 43 67 (2008) 490-507. [3] H. Charalambous, A. Katsabekis, and A. Thoma. Minimal systems of binomial generators and the indispensable complex of a toric ideal, Proceedings of the American Mathematical Society 135 (2007) 3443-3451. [4] J. De Loera and S. Onn, Markov bases of three-way tables are arbitrarily complicated, J. Symb. Comput. 41 2 (February 2006) 173-18. [5] M. Develin and S. Sullivant. Markov bases of binary graph models, Annals of Combinatorics 7 (2003) 441-466. [6] P. Diaconis and B. Sturmfels. Algebraic algorithms for sampling from conditional distributions, Ann. Statist. 26, no. 1, 363–397 (1998) [7] A. Dobra and S. Sullivant. A divide-and-conquer algorithm for generating Markov bases of multi-way tables. Computational Statistics 19 (2004), 347-366 [8] M. Drton, B. Sturmfels and S. Sullivant. Lectures on algebraic statistics, Oberwolfach Seminars 39, Birkhäuser (2009) [9] I. Gitler, E. Reyes, R. Villarreal. Ring graphs and toric ideals, Electronic Notes in Discrete Mathematics 28 1 (2007) 393-400. [10] S. Hoşten and S. Sullivant. A finiteness theorem for Markov bases of hierarchical models, J. Comb. Theory Ser. A 114 2 (2007) 311-321. [11] L. Oeding. Set-theoretic defining equations of the tangential variety of the Segre variety, J. Pure and Applied Algebra, 215 (2011) 1516-1527. [12] H. Ohsugi and T. Hibi. Toric ideals generated by quadratic binomials, Journal of Algebra 218 (1999), 509-527. [13] H. Ohsugi and T. Hibi. Indispensable binomials of finite graphs, J. Algebra Appl. 4 (2005), no 4, 421-434. COMBINATORIAL DEGREE BOUND FOR TORIC IDEALS OF HYPERGRAPHS 17 [14] S. Petrović and D. Stasi. Toric algebra of hypergraphs. Preprint: arXiv:1206.1904 [15] E. Reyes, C. Tatakis, A. Thoma. Minimal generators of toric ideals of graphs, Adv. in Appl. Math 48 (2012), no. 1, 64-67 [16] B. Sturmfels. Gröbner bases and convex polytopes, University Lecture Series, 8. American Mathematical Society, 1996. [17] B. Sturmfels and S. Sullivant. Toric ideals of phylogenetic invariants, Journal of Computational Biology 12 (2005) 204-228. [18] B. Stumfels and P. Zwiernik. Binary cumulant varieties, Annals of Combinatorics, to appear. [19] C. Tatakis andA. Thoma. On the universal Gröbner basis of toric ideals of graphs, Journal of Combinatorial Theory, Series A, 118 (2011) 1540-1548 [20] R. Villarreal. Rees algebras of edge ideals, Communications in Algebra, 23 (9), 3513–3524 (1995) [21] R. Villarreal, Monomial Algebras. Monographs and Textbooks in Pure and Applied Mathematics 238, Marcel Dekker, Inc., New York, 2001.
0math.AC
3D Object Discovery and Modeling Using Single RGB-D Images Containing Multiple Object Instances Wim Abbeloos1 , Esra Ataer-Cansizoglu2∗, Sergio Caccamo3 , Yuichi Taguchi2∗ , Yukiyasu Domae4 arXiv:1710.06231v1 [cs.CV] 17 Oct 2017 1 KU Leuven, Belgium Electric Research Labs, Cambridge, MA, USA 3 KTH Royal Institute of Technology, Stockholm, Sweden 4 Mitsubishi Electric Corporation, Japan 2 Mitsubishi Abstract Unsupervised object modeling is important in robotics, especially for handling a large set of objects. We present a method for unsupervised 3D object discovery, reconstruction, and localization that exploits multiple instances of an identical object contained in a single RGB-D image. The proposed method does not rely on segmentation, scene knowledge, or user input, and thus is easily scalable. Our method aims to find recurrent patterns in a single RGB-D image by utilizing appearance and geometry of the salient regions. We extract keypoints and match them in pairs based on their descriptors. We then generate triplets of the keypoints matching with each other using several geometric criteria to minimize false matches. The relative poses of the matched triplets are computed and clustered to discover sets of triplet pairs with similar relative poses. Triplets belonging to the same set are likely to belong to the same object and are used to construct an initial object model. Detection of remaining instances with the initial object model using RANSAC allows to further expand and refine the model. The automatically generated object models are both compact and descriptive. We show quantitative and qualitative results on RGB-D images with various objects including some from the Amazon Picking Challenge. We also demonstrate the use of our method in an object picking scenario with a robotic arm. 1. Introduction Object model generation is crucial for robotic manipulation. Typical object detection and localization methods have a separate supervised stage where they learn and build object models. However, the types of objects a robot needs ∗ Corresponding authors: {cansizoglu,taguchi}@merl.com Figure 1: Given a single RGB-D image containing multiple instances of the same object (top-left), our method automatically discovers the object and localizes the multiple instances by grouping a set of features (top-right). A 3D model of the object is also recovered by registering the features from the multiple instances into a single coordinate system (bottom). The registered features are denoted as red dots, overlaid on the colored 3D point cloud of the scene. Note that some of the features appear on the missing face of this specific object instance, indicating that they are recovered from some other object instances. to interact with can expand and change rapidly, such as new items arriving at a warehouse as seen in the scope of Amazon Picking Challenge [1]. On the other hand, in many situations, objects appear in multiple copies. This paper exploits this fact and presents a method for discovering and modeling an object from a single RGB-D frame in which the object appears in multiple copies. The recurrent patterns found in the single frame can be used to automatically discover the object, and the various viewpoints of different instances can provide valuable information for object model generation. Our only assumption is the existence of at least two instances of an object in the single RGB-D image. We do not use any prior knowledge about the number, shape, and appearance of the object. Thus, the object can appear in a cluttered scene or the image can contain multiple instances of different objects. Our method performs on-the-fly object model generation, while detecting and localizing the instances of the reconstructed object in the given image. Thus, it enables online robot manipulation using only a singleshot image. Our technique employs a sparse feature representation, as shown in Figure 1. Therefore, the problem can be seen as finding groups of features that correspond to different instances of the object. To solve this grouping problem we make use of the following information: 1. Appearance similarity: Pairs of features that come from the same location of two instances should be similar. 2. Geometric similarity: Two groups of features corresponding to each other based on appearance similarity should have the same in-group geometric distribution. In other words, there exists a single transformation that would transfer and align the positions of features in one group to the positions of corresponding features in the other group. We employ the appearance and geometric constraints jointly. Furthermore, we avoid the use of depth segmentation and spatial closeness to decide whether features are coming from the same instance, as the objects might be touching with each other or occluding one another. We look for recurrent patterns in the image using both geometric and appearance similarity following the sparse feature representation. First, we extract keypoints and match them based on the descriptor similarity. We then find triplets of keypoints matching with each other using several geometric criteria, which are defined for pairs and triplets of the matched keypoints and are invariant to the 6-degreeof-freedom (6-DOF) transformations. Each of the matched triplets provides a 6-DOF transformation, which is a candidate of the relative pose between two instances of the object, but might be an outlier. Thus, in the second stage we cluster the relative poses associated with each triplet match and find clusters supported by many triplets. The matches that appear in the same cluster are likely to belong to the same pair of objects. Thus, in the third stage we generate an initial model based on the clustering results. Lastly, the generated model is used in a RANSAC framework in order to detect additional instances among the remaining keypoints, which can yield further expansion and enrichment of the generated model. Once a model has been discovered, it can be used to detect the corresponding object even if only one instance is present. 1.1. Contributions The main contributions of this paper are as follows: • We present a method for unsupervised object discovery and modeling from a single RGB-D image containing multiple instances of the same object. • We propose an efficient grouping algorithm that generates a set of relative pose candidates using triplets of keypoint matches and then clusters them to find each instance of the object and their relative poses. • We show experimental results using several objects and demonstrate an application of our method to object picking. 1.2. Related Work Object discovery has been investigated using a variety of approaches. Some are based on geometric and/or color segmentation [25][16], which typically rely on strong assumptions of the scene or the objects (e.g., the objects are placed on a table) and do not exploit multiple instances. Another segmentation-based approach based on shape analysis using compactness, symmetry, smoothness, and local and global convexity of segments and their recurrence is proposed in [19]. Since these methods suffer from over and under segmentation, especially in scenes with a lot of clutter, they are not suitable solutions to our problem. Other methods gather information over time (thus they are not single-shot approaches) [11][23] and some assume that objects will be displaced or removed [18][24][4]. A closely related field is the detection of repetitive patterns [20][26][29] in images. These methods, however, depend on the organized appearance of the structure elements, while in our case, object instances may appear in random poses. Other related problems are co-segmentation [9] and unsupervised detection of object categories [27]. Unsupervised detection of multiple instances of objects in RGB images has been studied in [15][6][7][21]. These methods also use geometric and appearance information, which is then used for clustering or combinatorial optimization. They operate either on matched points, or matched pairs of points, while our method uses matched triplets. Moreover, they use only RGB information and not depth, and do not reconstruct a 3D model or estimate 6-DOF pose. We compare our method with [6] in experiments. Some object detection methods for robotics applications have been proposed that take into account multiple object instances. A sparse 3D object model created by using structure from motion, which requires multiple frames, is used in [10]. This enables the detection and pose estimation of multiple object instances in an RGB image. Similarly, in [17], a sparse 3D model is first manually created from multiple images, after which they detect the model using a stereo cam- n1 n2 f4 f2 m1 f3 f1 = ||d|| = ||m2 - m1|| m2 Figure 2: Two surface points mi and their normals ni determine a point pair feature. era system. Note that these systems require one to build a model first, while ours does not. 2. Method The goal of this work is to discover, model, and localize an object in a scene without any prior knowledge. The input is a single RGB-D frame, including a color (or grayscale) image and a depth map of the scene. We use sparse 3D feature points throughout our pipeline, and thus ignore pixels that have invalid depth measurements. Our method consists of four main steps. In the first step, we extract keypoints and generate triplet matches based on the descriptor similarity and several geometric criteria that are invariant to the 6-DOF transformations. Second, we cluster triplet matches based on their relative poses as we expect to see geometric similarity among groups of features. Third, we generate an initial model using the clustering results. At the fourth step, the initial model is used to detect additional object instances in the remaining set of features that have been considered outliers in the clustering step, which can further enhance the object model. Each of the four steps is detailed in the following subsections. 2.1. Matching Triplets of Keypoints In the first step, our goal is to generate triplets of keypoint matches, each of which provides a candidate of the relative pose between two instances of the object. We use SIFT [22] to detect and describe keypoints. This results in a set of N keypoints that have valid depth measurements. Every keypoint in this set is compared to all others to find its most similar keypoint. The similarity measure used is the Euclidean distance between the 128 dimensional feature descriptors. We also threshold the Euclidean distance such that we maintain M ≤ N keypoint matches for the following processes. Based on appearance similarity, we expect that two instances of an object have similar keypoints. However, the single keypoint matches are not robust enough, include many outliers, and do not provide the relative pose between the two instances. Thus triplets of keypoint matches are used to be robust to outliers and to obtain the relative pose using three 3D point registration [28]. For each combination of three keypoint matches, we need to consider cases where matches are reversed except for symmetric cases (we thus  keep  4 out of 8 candidates). This results in a total of M 4 possible triplets. We try to select = 2M(M−1)(M−2) 3 3 correct triplets based on the following geometric criteria invariant to the 6-DOF transformations: • Point pair feature similarity: Point pair features [13][8][3] describe the relative position and orientation of points on the surface of an object (Figure 2). For two points m1 and m2 with normals n1 and n2 , with d = m2 − m1 the feature F is F(m1 , m2 ) = (kdk, ∠(n1 , d), ∠(n2 , d), ∠(n1 , n2 )), (1) where ∠(a, b) ∈ [0 π] denotes the angle between two vectors. Let l1 and l2 be keypoints matching with m1 and m2 respectively. We compute the difference of point pair features between the matches as F(m1 , m2 ) − F(l1 , l2 ) and apply distance and angle thresholds to the calculated difference to filter out incorrect correspondences. • Sidedness: We check whether the third point of the triplet falls on the same side of the line defined by the other two points to avoid reflections [15]. For the triplet P, let us denote the cross product of the edges di and d j as vi, j (P) = di × d j . We discard a triplet match if any of the two corresponding v vectors are in opposite directions, i.e., discard the triplet match between P and Q, if ∃i, j such that vi, j (P) kvi, j (P)k + vi, j (Q) kvi, j (Q)k < ε. • Minimum triangle edge length and maximum acuteness: To ensure the found corresponding triangles will yield sufficiently accurate transformation estimations, triangles generated with closely located keypoints are removed. This is done using a minimum triangle edge length and maximum angle acuteness threshold. • Overlapping triangles: We omit the triplet match if the two triangles are overlapping, as they would more likely be coming from the same instance. Since the point pair feature similarity can be computed for pairs of keypoint matches, we first use this criterion for efficient pruning of incorrect pairs and then use the other criteria for selecting correct triplets. Also, in order to get a balanced distribution of keypoints among triplet matches, a keypoint can appear at most L times in the generated triplet matches. The thresholds and parameters used in this study are given in Section 3. 2.2. Clustering 5.1 For each of the triplets obtained in the first step, a 6-DOF pose that transforms the triangle to its corresponding triangle is estimated. Let P = (p1 , p2 , p3 ) and Q = (q1 , q2 , q3 ) denote two matching triangles where pi , qi ∈ R3 are 3D positions of the keypoints. The calculation of the pose results in the transformation Tp,q ∈ SE(3) that consists of a rotation matrix R ∈ SO(3) and a translation vector t ∈ R3 such that qi = Tp,q (pi ) = Rpi + t. These transformations are clustered using the DBScan [14] algorithm to discover sets of triplets with similar transformations. DBScan is a density based clustering method, which only requires a single input parameter for the maximum distance between two instances that are allowed to be clustered together. During clustering, we exploit sum of 3D point-to-point distances as the distance between two triplets. For symmetry, the distance is computed bidirectionally. Thus, the distance between two matching triplets (P, Q) and (A, B) based on the respective transformations Tp,q and Ta,b is D((P, Q), (A, B)) = ∑ kTp,q (ai ) − bi k + ∑ kTa,b (pi ) − qi k. i 0 2 4 7.3 3 8 6 14.4 13.2 5 7 10 1 9 5.9 4.2 11 Figure 3: An overlay shows the graph representing clustered sets of points (vertices) and their relations (edges). Note there are two types of relations between sets of points: sets that are clustered together because they contain similar triplets, and sets that are connected because they have points in common. The edges representing matched triangles have a label showing the distance (the distance error obtained with the transformation between them). i (2) The output of clustering can contain the same pair of instances in two different clusters with associated poses as inverse of each other. Hence, if such clusters are found, one of them is inverted and the clusters are merged. The transformation for each cluster is then recalculated considering all sets of corresponding triplets in the cluster. 2.3. Initial Model Creation The clustering procedure results in sets of points that belong to the same object instance and are matched to another object instance. In other words, each cluster can be seen as two sets of points, where one set can be aligned with the other set using the transformation of the cluster. Some of these sets may have keypoints in common with other sets. Thus, the clustering result can be represented as a graph where nodes correspond to sets of points and edges correspond to the distance between sets based on the transformation of the cluster associating the two sets (Figure 3). If two sets have points in common, then the transformation between them is identity and the connecting edge is set to have a small preset weight δ . The resulting graph can have multiple connected components, since the scene can contain multiple instances of various types of objects. In order to create a model for each connected component, we first decide which node will be the reference frame where all sets will be transformed to. We pick the node representing the set of points with the largest number of matches and common points as the reference. All other sets of points that are connected to it are transformed to the reference frame by applying a series of transformations. The optimal series of transformations for every set is found by searching for the shortest path to the reference frame using Dijkstra’s algorithm [12]. The 3D object model consists of all points transformed to this common reference frame, and associated with their original keypoint descriptors. This process generates an object model for each connected component in the graph, hence it might yield multiple models, each containing points from all sets connected to their reference set. For each generated model, we apply a final bundle adjustment to refine landmark locations and instance poses. 2.4. Additional Instance Detection After creating a set of object models, every model is compared to all others to verify whether they truly are distinct objects, or whether their correspondence was simply missed by the earlier steps (this is possible because we enforce a unique match between keypoints in our first step, instead of considering all possible matches). For each model, we perform detection between the model and the sets of points from the other connected components of the graph. This is performed by a correspondence search via descriptor similarity and a geometric verification by a 3point RANSAC registration. We also try to detect any remaining instances that had not been matched before. We use the remaining keypoints that are not associated with any of the nodes in the graph to avoid matching the model to the previously detected instances. In the RANSAC registration, we sample three scene points so that they are within the diameter of the Sez Sd Mez Md # img (pair) 54 57 49 30 190 # img (> 2) 29 0 3 12 44 # img (total) 83 57 52 42 234 Table 1: The number of images containing only pairs of instances, the number of images containing more than two instances, and the total number of images, per scenario. model. In both cases, the RANSAC estimates an initial transformation using the three points and counts the number of inliers (the percentage of matched points that, when transformed, are within a certain distance of their corresponding points). RANSAC succeeds if the inlier ratio is larger than a certain threshold. The transformation is then re-estimated based on the inliers of the most successful attempt. In the case of a successful RANSAC, the model is merged with the other model or the points selected as inliers from the remaining keypoints. 3. Experiments and Results An ASUS Xtion Pro Live RGB-D camera was used to acquire a dataset of 234 VGA (640 × 480) resolution color and depth images. The depth image was converted to a 3D point cloud and transformed to the RGB camera’s reference frame. This means every valid measurement point has both a 3D coordinate and a color value. We classified the captured scenes into four different scenarios: scenes containing either a single or multiple object types (denoted by S and M), and scenes with or without clutter and occlusion (denoted by easy ez and difficult d ). Each scene contained two to nine instances per object type. We used objects with various shapes and sizes and varying amounts of texture. The number of images per scenario is given in Table 1. Qualitative and quantitative results are given for the different scenarios. The dataset is available at ftp://ftp.merl.com/pub/cansizoglu/ ObjectDiscovery3DV2017.zip, and includes object annotations. Our method is compared to an RGB object discovery algorithm [6] that uses feature matching with a novel pairwise dissimilarity measure and hierarchical agglomerative clustering to find pairwise matches between sets of points. The dissimilarity measure they propose consists of a photometric and a geometric term. The photometric term is simply the Euclidean distance between the points’ SIFT descriptor vectors, which is also used in our method. The geometric term is used to determine a pairwise dissimilarity between two corresponding pairs. It uses the homography of the first Figure 4: Robot arm used for object picking. correspondence to transform the points of another and vice versa. The final geometric term is the average of the transformation errors. The total pairwise dissimilarity is a linear combination of both terms. We used the source code available on the authors’ website with the default parameters, as changing them did not improve the results. The following parameters were used in these experiments to eliminate incorrectly matched triplets: a 5mm and 35 degrees threshold for the point pair feature difference. Each edge of the triangle should be at least 10mm and at most 125mm and each angle should exceed 10 degrees. Maximum value of the distance between two samples in clustering was set to 35mm, while we discarded clusters with less than 14 samples. In detection, we used a RANSAC inlier threshold of 5mm. A RANSAC was recalled as successful when there were at least 5 inliers and the inlier ratio was more than 12.5%. The average running time was 809ms with a C++ implementation on a standard PC. We also demonstrate the use of our algorithm in an object picking scenario with a robotic arm, where multiple instances of the same object are visible (Please see supplementary video). We mounted an ASUS Xtion sensor on the robot arm and picked up objects using a vacuum gripper as seen in Figure 4. 3.1. Qualitative Results Some results on the proposed dataset on the four different scenarios are shown in Figure 5. For our method the image is overlaid with the transformed object model (with one color per object type). For the comparison method, clusters of matching features are shown (each cluster having a with clutter/occlusion multiple objects single object without clutter/occlusion Figure 5: Some of the scenes from the proposed dataset from the four scenarios: single/multiple objects (top/bottom) and with/without clutter and occlusion (left/right). Overlaid is a visualization of the results for our method (first and third columns) and the results for [6] (second and fourth columns). The quantitative results are summarized in Table 2. (a) Because our algorithm searches for the largest recurrent pattern, object instances occurring in an organized way are merged into one object, resulting in object models containing two instances. Each object instance is shown in a random color. (b) While a correct object model was created for the object, and all instances were found correctly, a separate partial model was discovered in two instances (denoted by green arrows pointing to green model points). The second model is considered a false positive, since these points should have been a part of the first model. (c) The object model in green was successfully discovered, and its instances located, despite the high degree of occlusion by other objects. Figure 6: A few remarkable results with additional comments. different color). This figure contains only scenes with two instances per object type to allow direct comparison to the other method. The result of our method on a scene with a larger number instances is shown in Figure 1 and more examples are shown in the supplementary material. Experiments on scenes with objects placed in an organized way gave the results seen in Figure 6a. Here, three ducks were placed side by side and our algorithm ended up with a model of two repetitive patterns representing two neighboring ducks. This was expected as the clustering stage selects the largest cluster to start building the initial model. Note that the filter eliminating overlapping triangles was turned off to create this example. 3.2. Quantitative Results We report object discovery performance on the generated dataset in Table 2. Objects were counted as true positives if the discovered model was correct, and it was localized correctly. We considered a detection correct when at least 90% of the features were inside the annotated bounding box. They were counted as a false negative if the object was not detected. False positives occur when an incorrect model is found, or when a model was found in an incorrect place. Since [6] only discovers pairwise matches, we compared the performance for the subset of scenes containing only pairs of objects (two object instances per object type). Our method has an F1-score of 0.966 on this subset, while the comparison method only reaches 0.471. Our method finds any number of instances and thus can be evaluated on the entire dataset by counting the number of instances (not pairs) found. For this evaluation our F1-score is 0.974. Our method gives very few false positives resulting in a high precision. A false positive example is shown in Fig- ure 6b. There is a few false negatives in our method (e.g., the brushes in the scene in row 5, column 1 of Figure 5). These false negatives are caused by the objects having relatively few keypoints, and many of the keypoints being matched incorrectly. These incorrect matches result from the descriptor not being sufficiently invariant to large viewpoint changes. The recall does not differ much for the scenarios with or without occlusion and clutter, but it is slightly lower for the scenario with multiple object types. An interesting result of the comparison method is that they have the worst performance for the easiest scenario Sez with only one object type without clutter or occlusion (e.g., the scenes in rows 1, 2 and 3, column 2 of Figure 5). In this scenario, they have a large number of false positives. As there are far fewer keypoints, it is more likely that false matches accidentally form a cluster. If there is more clutter, these false matches are more likely to be more random and are less likely to cause false positive clusters. 4. Conclusion and Discussion We presented a novel method for 3D discovery, modeling, and localization of multiple instances of an object using a single RGB-D image. Following a sparse feature representation, we employ appearance similarity and geometric similarity to group features associated to the instances. Our grouping algorithm is efficient as it considers triplet matches and eliminates incorrect correspondences between triplets based on various geometric constraints. The 6-DOF poses calculated for each triplet match are clustered in order to find matching object instances. The initial model generated using the clustering results can then be used to detect remaining object instances in the scene. The proposed Sez Sd Mez Md Total F1 Objects (our) P R 0.992 0.971 1.000 0.965 1.000 0.919 0.989 0.907 0.995 0.938 0.974 Pairs (our) P R 1.000 1.000 1.000 0.965 1.000 0.931 1.000 0.925 1.000 0.949 0.966 Pairs [6] P R 0.338 0.329 0.621 0.506 0.607 0.508 0.629 0.429 0.504 0.441 0.471 Table 2: Precision (P) and recall (R) for our method and [6] on the different datasets. S/M indicates whether the dataset has a Single (S) or Multiple (M) object models. The easy/difficult scenario is indicated with ez or d . We give results for P-R calculated on the found object instances (first column) and for P-R calculated on pairs of objects (second and third columns). method provides descriptive and compact object models using only a single RGB-D image and is suitable for robotic manipulation tasks. Another application of our framework can be seen in [2], where we generate object proposals for a deep-learning-based classification method. Since our technique outputs regions with recurrent patterns, we further improve classification accuracy by considering joint probability of bounding boxes that refer to copies of the same object. The goal of this study is to detect and discover objects from a single image that contains multiple object instances. Therefore it differs from other methods that aim to detect and track objects in a given sequence of frames such as object SLAM techniques [5]. Based on a sparse feature representation, the problem can be formulated as a challenging search problem, where we search for subsets of features that resemble each other in terms of appearance and geometry. More specifically, all pairwise feature matches need to be considered in this problem, as opposed to investigating feature matches only between frames in an object tracking scenario given a sequence of frames. Moreover, the instances can occur in various viewpoints in a single image making the search problem more challenging, while a smooth motion is usually observed in a video-based tracking scenario. Our algorithm finds the largest recurrent pattern in the scene. This can be an important limitation especially in two cases (i) when the objects are placed in an organized way as in Figure 6a, and (ii) when there are pairs of instances that have the same relative pose. The limitation in the first case exists due to the fact that we avoided any assumptions about the placement of the objects as opposed to existing work on finding periodic patterns in a scene. This makes our algorithm applicable to more general scenarios, i.e., occlusion, random pose, etc. Once a cluster is detected it is always possible to search for periodic patterns in order to handle cases with organized objects. We can also solve this problem by recursively calling the algorithm on the set of points from each cluster. On the other hand, if an object has repeated patterns on its surface, then following such a recursive splitting strategy would result in models smaller than the object. Consequently, such scenarios might be solved with more prior knowledge such as the size of the object or the number of object instances in the scene. The limitation in the second case can be solved by some assumptions about the placement of the objects. For example, a smoothness in depth can be expected among the features of an instance. Again, we avoided using any depth-based segmentation as they are shown to perform poorly on various cases. Keypoint detection and descriptor matching lie at the core of the proposed technique as a way of measuring appearance similarity. Missing features in some instances due to nonrobust keypoint detection and poor matching in large viewpoint changes were among the problems we faced because of limitations of conventional feature detectors and descriptors. As a result, the performance degraded especially when there are too many false matches that need to be handled as observed in the case of cluttered scene or multiple object types in a single image. Therefore, improving descriptors and descriptor matching is an important extension of this work. Acknowledgments This work was done at and supported by Mitsubishi Electric Research Laboratories. We thank the anonymous reviewers for their helpful comments. W.A. thanks EAVISE, KU Leuven for the travel support. References [1] Amazon picking challenge. http:// amazonpickingchallenge.org/. 1 [2] W. Abbeloos, S. Caccamo, E. Ataer-Cansizoglu, Y. Taguchi, C. Feng, and T.-Y. Lee. Detecting and grouping identical objects for region proposal and classification. In Workshop Deep Learning for Robotic Vision Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), pages 501– 502, 2017. 8 [3] W. Abbeloos and T. Goedemé. Point pair feature based object detection for random bin picking. In Conference on Computer and Robot Vision (CRV), pages 432–439, June 2016. 3 [4] S. Caccamo, E. Ataer-Cansizoglu, and Y. Taguchi. Joint 3D reconstruction of a static scene and moving objects. In Proc. Int’l Conf. 3D Vision (3DV), 2017. 2 [5] C. Cadena, L. Carlone, H. Carrillo, Y. Latif, D. Scaramuzza, J. Neira, I. Reid, and J. J. Leonard. Past, present, and future of simultaneous localization and mapping: Toward the robust-perception age. IEEE Trans. Robotics, 32(6):1309– 1332, Dec. 2016. 8 [6] M. Cho, J. Lee, and K. M. Lee. Feature correspondence and deformable object matching via agglomerative corre- [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] spondence clustering. In Proc. IEEE Int’l Conf. Computer Vision (ICCV), pages 1280–1287, 2009. 2, 5, 6, 7, 8 M. Cho, Y. M. Shin, and K. M. Lee. Unsupervised detection and segmentation of identical objects. In Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), pages 1617–1624, 2010. 2 C. Choi, Y. Taguchi, O. Tuzel, M.-Y. Liu, and S. Ramalingam. Voting-based pose estimation for robotic assembly using a 3D sensor. In Proc. IEEE Int’l Conf. Robotics and Automation (ICRA), pages 1724–1731, May 2012. 3 W.-S. Chu, C.-P. Chen, and C.-S. Chen. MOMIcosegmentation: Simultaneous segmentation of multiple objects among multiple images. In Proc. Asian Conf. Computer Vision (ACCV), pages 355–368, 2010. 2 A. Collet, D. Berenson, S. S. Srinivasa, and D. Ferguson. Object recognition and full pose registration from a single image for robotic manipulation. In Proc. IEEE Int’l Conf. Robotics and Automation (ICRA), pages 48–55, 2009. 2 T. Dharmasiri, V. Lui, and T. Drummond. MO-SLAM: Multi object slam with run-time object discovery through duplicates. In Proc. IEEE/RSJ Int’l Conf. Intelligent Robots and Systems (IROS), pages 1214–1221, 2016. 2 E. W. Dijkstra. A note on two problems in connexion with graphs. Numerische mathematik, 1(1):269–271, 1959. 4 B. Drost, M. Ulrich, N. Navab, and S. Ilic. Model globally, match locally: Efficient and robust 3D object recognition. In Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), pages 998–1005, June 2010. 3 M. Ester, H.-P. Kriegel, J. Sander, X. Xu, et al. A densitybased algorithm for discovering clusters in large spatial databases with noise. In International Conference on Knowledge Discovery and Data Mining (KDD), volume 96, pages 226–231, 1996. 4 V. Ferrari, T. Tuytelaars, and L. Van Gool. Simultaneous object recognition and segmentation from single or multiple model views. Int’l J. Computer Vision, 67(2):159–188, 2006. 2, 3 M. Firman, D. Thomas, S. Julier, and A. Sugimoto. Learning to discover objects in RGB-D images using correlation clustering. In Proc. IEEE/RSJ Int’l Conf. Intelligent Robots and Systems (IROS), pages 1107–1112, 2013. 2 T. Grundmann, R. Eidenberger, M. Schneider, M. Fiegert, and G. v. Wichert. Robust high precision 6D pose determination in complex environments for robotic manipulation. In [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] Workshop Best Practice in 3D Perception and Modeling for Mobile Manipulation at the Proc. IEEE Int’l Conf. Robotics and Automation (ICRA), pages 1–6, 2010. 2 E. Herbst, X. Ren, and D. Fox. RGB-D object discovery via multi-scene analysis. In Proc. IEEE/RSJ Int’l Conf. Intelligent Robots and Systems (IROS), pages 4850–4856, 2011. 2 A. Karpathy, S. Miller, and L. Fei-Fei. Object discovery in 3D scenes via shape analysis. In Proc. IEEE Int’l Conf. Robotics and Automation (ICRA), pages 2088–2095, 2013. 2 T. Leung and J. Malik. Detecting, localizing and grouping repeated scene elements from an image. In Proc. European Conf. Computer Vision (ECCV), pages 546–555, 1996. 2 J. Liu and Y. Liu. Grasp recurring patterns from a single view. In Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), pages 2003–2010, 2013. 2 D. G. Lowe. Distinctive image features from scale-invariant keypoints. Int’l J. Computer Vision, 60(2):91–110, 2004. 3 L. Ma and G. Sibley. Unsupervised dense object discovery, detection, tracking and reconstruction. In Proc. European Conf. Computer Vision (ECCV), pages 80–95, 2014. 2 J. Mason, B. Marthi, and R. Parr. Object disappearance for object discovery. In Proc. IEEE/RSJ Int’l Conf. Intelligent Robots and Systems (IROS), pages 2836–2843, 2012. 2 J. Papon, A. Abramov, M. Schoeler, and F. Wörgötter. Voxel cloud connectivity segmentation - supervoxels for point clouds. In Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), pages 2027–2034, June 22-27 2013. 2 M. Pauly, N. J. Mitra, J. Wallner, H. Pottmann, and L. J. Guibas. Discovering structural regularity in 3D geometry. In ACM Trans. Graphics, volume 27, page 43, 2008. 2 T. Tuytelaars, C. H. Lampert, M. B. Blaschko, and W. Buntine. Unsupervised object discovery: A comparison. Int’l J. Computer Vision, 88(2):284–302, 2010. 2 S. Umeyama. Least-squares estimation of transformation parameters between two point patterns. IEEE Trans. Pattern Anal. Mach. Intell., 13(4):376–380, Apr. 1991. 3 C. Wu, J.-M. Frahm, and M. Pollefeys. Detecting large repetitive structures with salient boundaries. In Proc. European Conf. Computer Vision (ECCV), pages 142–155, 2010. 2
1cs.CV
Designing a Safe Autonomous Artificial Intelligence Agent based on Human Self-Regulation Mark Muraven University at Albany January 5, 2017 Author contact: [email protected] Human Self-Regulation for AI 2 Abstract There is a growing focus on how to design safe artificial intelligent (AI) agents. As systems become more complex, poorly specified goals or control mechanisms may cause AI agents to engage in unwanted and harmful outcomes. Thus it is necessary to design AI agents that follow initial programming intentions as the program grows in complexity. How to specify these initial intentions has also been an obstacle to designing safe AI agents. Finally, there is a need for the AI agent to have redundant safety mechanisms to ensure that any programming errors do not cascade into major problems. Humans are autonomous intelligent agents that have avoided these problems and the present manuscript argues that by understanding human self-regulation and goal setting, we may be better able to design safe AI agents. Some general principles of human self-regulation are outlined and specific guidance for AI design is given. Muraven 3 Recently there has been some discussion on how to better align autonomous artificial intelligence actions with human interests. The issue, as discussed at length (e.g., Bostrom, 2014), is that an autonomous artificial intelligence agent, in blindly following its programming, may engage in actions that directly or indirectly hurt human welfare. Several potential solutions have been put forth, but to date, none are deemed sufficient or adequate to address the problem. More broadly, there exists the general question of how to make an autonomous artificial intelligence agent work and what might be the key features of it. The goal of this manuscript is to argue that by understanding how humans autonomously reach their own goals, we can better design an autonomous artificial intelligence agent to both be autonomous and to pursue goals that align with human interests. The underlying assumption behind this discussion is that humans have evolved and been socialized in ways that ensure optimal goal pursuit. Obviously, there are instances where humans’ behavior is less than ideal, but as will be argued human goal behavior is a reasonable starting point for designing a self-regulation system for an autonomous agent. Thus, this manuscript provides a brief and introductory framework to research on human self-regulation. There are many details and formalisms omitted for simplicity’s sake. The point is to give a basic understanding of human self-regulation that may help in the design of an autonomous artificial intelligence agent as well. In particular, understanding human self-regulation may guide research on artificial intelligence because humans seem to avoid many of the hypothesized pitfalls that an artificial intelligence may face. For instance, the obsessive pursuit of one final goal, analogous to the paperclip optimization problem, is rare in humans. Humans do not single-mindedly pursue one goal to the exclusion of all others. Foreshadowing some of the dynamics of the model, humans that pursue a goal beyond reasonable balance are considered mentally ill. Addicts, people suffering from obsession and compulsions, and those who engage in self-damage suffer from understandable and avoidable problems with their self- Human Self-Regulation for AI 4 regulation system. Indeed, treatment for those conditions usually addresses how to better self-regulate. Thus, in humans, a correctly functioning self-regulatory system is needed to maintain mental health. Moreover, humans’ ability to self-regulate is very robust as most people can adapt to highly dynamic environments and remain focused on long-term goal pursuit even when unexpected obstacles arise. These are traits that would be highly valued in an autonomous artificial intelligence agent. As described below, there are clear features of humans’ goal system that helps to keep it stable and balanced that may be easily emulated in an artificial intelligence agent. The other benefit from understanding how the human goal system operates is that most people engage in behaviors that they believe will benefit themselves and other people. Obviously, there is some level of self-deception and flexibility in definition (the dictator who puts opponents in jail may convince himself that it is for the good of society), but theories of human self-regulation suggest that there are checks and balances on such self-deception. These checks built into the self-regulation system help to explain why most people follow socially approved goals in socially appropriate ways. Understanding human self-regulation may therefore help in designing autonomous artificial intelligent agents that avoid undesired and unconventional solutions to problems (e.g., making everyone happy by putting wires into the brain’s pleasure centers). Feedback Loops Self-regulation is a broad and encompassing topic within modern cognitive science. At its heart, it describes how individuals select purposive goals, stay on track toward those goals, and correct for changes in the environment as they move toward their goals. The central idea is that there is a feedback control process that helps people reach their goals. The basic framework for understanding human selfregulation follows from cybernetic models of feedback control (Carver & Scheier, 1981) that suggests people compare their current state to some goal, standard or ideal. That is, the feedback system Muraven 5 compares incoming information to a reference value. If a discrepancy is noted between the current state and ideal state, some action takes place to try to minimize (or maximize, if the goal is to be unlike something) that difference. Thus, at its core there are four simple parts to a feedback loop: current state monitoring, ideal state monitoring, a comparator system to evaluate differences between those two states, and an output function to reduce the discrepancies between those two states. The critical feature of cybernetic control requires the agent to have some idea of what actions may reduce (or enlarge) the discrepancy between the current state and goal state. Learning and training helps make this self-regulation process more efficient so the agent can quickly decide what actions are likely to lead to the desired outcome (Taylor, Pham, Rivkin, & Armor, 1998). However, as explained below, the autonomous agent should be open to feedback and is constantly self-monitoring, so when an action does not lead to the desired outcome, adjustments can be made. Complex and autonomous behavior can begin to emerge when multiple conflicting feedback loops are nested within a hierarchical structure. The critical feature is not the cybernetic feedback loop itself, but rather the way multiple conflicting loops interact. It is through these chaotic and dynamic interactions that autonomy emerges. Moreover, these interactions among loops are the critical feature in maintaining goal focus in changing environments and avoiding actions that would damage themselves and others. Basic Features Hierarchical Goals One critical feature of the feedback loop is that goals are arranged in an hierarchical structure (Elliot, 2006). Every goal has an underlying motivation (superordinate goal) and activates sub-goals. For Human Self-Regulation for AI 6 example, a person who wishes to make a friend (goal) may be doing that to fulfill the need to feel connected to others (superordinate goal). They might pursue that goal by texting someone they met (sub-goal). Progress on each of these goals at every level of the hierarchy is monitored and controlled by the cybernetic feedback loops previously described. Lower level goals are more concrete and discrete, whereas higher level goals tend to be more abstract. The top-most goals should be agent-defining and represent the fundamental values of the autonomous agent, although they are not often brought to conscious awareness. These top level goals are fundamental and basic. That is, they exist in everyone, cannot be ignored, and are critical to the successful functioning of the autonomous agent. For humans, these top-level goals are likely the product of evolution and thus innate (Deci & Ryan, 2000). There may be individual differences in how strongly each goal is pursued, but they are valued to some extent in every person. Even in cases of disordered behavior, such as addiction, a mixture of these goals is still active (Graham, Young, Valach, & Alan Wood, 2008). These top level goals are basic to human nature and ultimately drive all behavior. For humans, the exact enumeration of these top-level goals is a matter of some controversy, but most accounts include a need to feel competent, a desire to have a meaningful impact on the world, a dislike of inconsistencies as well as more basic concerns such as a need for survival and social connections. For the purpose of an autonomous artificial intelligence agent, an exact and complete description of these top-level goals may be less important than the fact that there are multiple conflicting goals that are aligned with human desires. Given the hierarchical nature of goals, each of these top level goals can be fulfilled in different and perhaps competing ways. For example, the goal of belongingness or relatedness may lead to the goal of calling friends more often, becoming more active in a social movement, and showing more affection to one’s family. These lower level goals also may conflict so that progress on one goal may Muraven 7 hinder progress on another goal. People’s habitual solutions to these conflicts is an important source of individual differences. Conflicting Goals Given that people have multiple goals active at the same time, these goals may often be in conflict. The pursuit of one goal may block, interfere or even undo the pursuit of another. For example, the desire to feel competent may lead to risk taking, which conflicts with the need for survival. The interfering nature of these goals is a critical feature of a successful autonomous agent and necessary for proper functioning. If an autonomous agent has to balance multiple, conflicting goals, there has to be a prioritization process to resolve these competing desires (Stroebe, Mensink, Aarts, Schut, & Kruglanski, 2008). Given the wide range of potential goals, the autonomous agent needs some way to narrow the choices. Some general principles seem to be at work. People often try to find situations that will maximize their progress to as many goals as possible (multifinality; Förster, Liberman, & Friedman, 2007; Kruglanski et al., 2013). For example, people like to study in groups, so both social and competency goals can be simultaneously filled. They also seek goals that may be met in different ways, thus allowing for multiple paths to the desired endpoint (equifinality; Kruglanski, Pierro, & Sheveland, 2011). In general, if progress toward a goal is blocked, an autonomous agent typically should try to find other ways to fulfill that goal. Just because current progress is frustrated, the goal should not be dropped. Instead, the agent should search through alternative paths to find another way to reach the goal. As a general principle, the higher the goal is in the hierarchy, the less willing the autonomous agent should be to drop it. If a call to a friend goes unanswered, the person will likely try another friend before giving up on fulfilling a desire to fulfill a need for social connection. Even when blocked multiple ways, Human Self-Regulation for AI 8 people will seek other ways to fulfill the same goal. If no friends answer their phone, a person may start posting on Facebook to gain some sense of social connection. More generally, the fields of psychology, economics, decision making, and sociology have put forth several different but ultimately related theories of motivation and goal selection. Recently, Steel and König (2006) integrated these theories into their temporal motivation theory (TMT), which is based on four core features: value, expectancy, time, and loss versus gains. Value is determined by anticipated satisfaction of goal completion, whereas expectancy is the perceived probability that that outcome will occur. Temporal discounting results in events closer in time being more influential. Finally, gains and losses are weighted differently, so that losses hurt more than gains and the same outcome could be perceived as a gain or loss based on the context. This theory can be integrated with theories that limit the search space for potential alternatives, like Decision Field Theory (Busemeyer & Diederich, 2002) to further increase its utility. This model likely provides a strong basis for understanding goal selection by an autonomous agent. Goals Reprioritization Although the TMT model does account for temporal discounting, it is still a relatively static perspective on goal pursuit. It fails to account for changes over time and interactions between multiple, conflicting goals. An autonomous agent should dynamically update its goals as the situation changes and as progress is made. If a person wants to build a shed and unexpectedly runs out of nails, the goal to buy more nails gets elevated in priority. If the store is closed, another goal may become active, such as paint the trim or respond to unanswered e-mails. For instance, research has found that goals for examinations changed as students’ perception of their course grade changed (Lord & Hanges, 1987). Lower-level goals Muraven 9 are subject to revision as circumstances change, based on feedback from more abstract, higher-level goals. Thus, goals must be allowed to change as the situation changes. The dynamics of the self-regulation system must be changeable as well. Some goals should be hewed to closely and resist change. Other times the system should be more open and flexible. For instance, in times of exploration, creativity or difficulty, the system may look to internal and external cues to be very open to new goals. Other times, the autonomous agent should ignore distractions or other goals in order to maximize pursuit of the currently active goal. Goal dynamics should depend on both bottom up processing based on the immediate value of the goal and top down processing, which considers the overall implication of the goal for the autonomous agent. Bottom-up models, like the multiple-goal pursuit model (MGPM; Ballard, Yeo, Loft, Vancouver, & Neal, 2016) dynamically update the discrepancy between current and goal state, as well as the available and required resources needed to reach the goal, which determines the motivation to act on that goal at any moment in time. This means there should be regular evaluations of progress and alternate goals. The amount of processing dedicated to this reevaluation should probably depend on the nature of the goal and its place in the hierarchy of goals. Moreover, a successful autonomous agent should learn from prior experience and anticipate the effects of its behaviors, so that goals are dynamically updated based on past actions. On the other hand, top-down models of goal dynamics also need to be considered (Lynn, Wormwood, Barrett, & Quigley, 2015). Such models assume that decisions are made within the larger context of the decision maker’s life. Thus prior history and future desires are weighed in the decision-making process. Human Self-Regulation for AI 10 Feedback Implicit in all these models is a need for regular assessment of goal progress. A successful autonomous agent must get regular feedback on its progress toward its goals. In humans, there is good evidence to suggest that emotions serve this purpose. Researchers have theorized that people have a meta-monitoring process that focuses on their rate of progress toward goals. Goals associated with positive affect are more likely to be prioritized (Custers & Aarts, 2007). Likewise, the more a behavior matches critical goals, the more positive people feel (Chirkov, Ryan, Kim, & Kaplan, 2003). When progress is perceived to be adequate, people experience positive affect; inadequate progress results in negative affect. This emotional feedback process allows people to track their progress toward multiple goals and hold models of desired progress toward these goals. Based on this feedback, people will prioritize some goals over others and increase or decrease effort on those goals. Other self-conscious emotions, such as shame, guilt, and pride may provide additional goal related feedback (Tangney, 2003). These emotions are powerful guides to behaviors and strongly motivate self-regulation. Additional emotional information includes intensity and arousal level, based on the type of goal being pursued and changes in rate in progress. Each level in the hierarchy in goals is likely separately monitored, although feelings associated with low level goals may be more fleeting than higher level goals. Further complicating matters, the feedback from progress may lag behind actual output. That is, it may take some time for the effects of the behavior to become evident. Thus, an autonomous agent should be able to reward itself from small actions that help move it toward goals. Such intrinsic motivation helps to ensure that goals are not abandoned when feedback is long in coming (Deci & Ryan, 1991). Muraven 11 The criterion for the feedback is likely multi-dimensional, especially for more abstract goals. For example, to determine whether the autonomous agent is making a positive change in the world (competence goal), the agent may look to others’ reaction, changes in the environment, and degree of challenge felt during the activity (Fisher, 1978). There should be some flexibility in the criterion as well— new situations should lead to looser criteria than familiar situations. Experience should add more criteria to evaluate success and repeated success or failures should lead to recalibration of the criteria so the agent’s affective experiences remains relatively stable. In short, any autonomous agent needs a method to monitor progress toward its short and longterm goals. This feedback monitoring process seems to be largely built into human neurological system. Because of its fundamental and critical importance, it seems to be universal in mentally healthy people and resistant to change. Obviously, people may seek ways to modify their emotional state outside of goal pursuit, but society generally frowns upon long-term modulation of the emotional-feedback system (e.g., through drug use). Thus, an autonomous artificial intelligence agent will need a clear and dynamic feedback system that is difficult to ignore, resistant to change and not easily substituted by other experiences. Goal Fatigue Finally, an autonomous agent needs to avoid getting stuck on a goal, even when that goal is seen as important and progress is being made. As explained above, autonomous agents should have multiple goals they wish to fulfill at any time but it is unlikely that they can fulfill more than one or two with any action. Thus, the agent needs some way to balance these conflicting and interfering goals. Because making progress on one goal often means forestalling progress on another, the autonomous agent needs to have ways to select one goal and suppress all others. This ensures that the Human Self-Regulation for AI 12 agent stays on task and does not get distracted by temporary or fleeting desires that might be triggered by the environment. Once a goal is selected, the agent should make certain that adequate resources are devoted to the task to secure its completion. Indeed, humans who are poorer at suppressing competing desires and staying on task suffer numerous problems in school, work and life (Tangney, Baumeister, & Boone, 2004). Research has shown that non-prioritized goals are shielded from interferences, so that these unselected goals are suppressed and less likely to be remembered (Shah, Friedman, & Kruglanski, 2002). Choosing to prioritize one goal (or set of goals) over other goals should only be temporarily acceptable, however. The autonomous agent should have a built in fatigue process, so that the agent can be responsive to environmental change. Given the dynamics of goal pursuit, as the environment changes, new goals should be selected. This ensures that the agent can pursue complex goals in changing situations, and even account and correct for its own actions. More profoundly, the agent should not allow any goal to be suppressed indefinitely even when the environment is static. The longer other goals are suppressed, the weaker that suppression should become. The autonomous agent should be less able to hold back competing goals and more responsive to environmental cues. This will lead to increased chances of goal switching. This is different from simple hyperbolic discounting, because it applies even to pleasurable activities and when progress toward the goal is acceptable. The agent may switch from higher priority to lower priority goals simply because in pursuit of the higher priority goal, the lower priority goals had to be suppressed. There is extensive evidence in humans that self-control comes at a cost and is limited (Muraven, 2012; Muraven & Baumeister, 2000). Suppressing competing urges weakens inhibition, so that the ability to suppress alternative goals becomes weaker. Eventually, current goal pursuit is dropped and an Muraven 13 alternative goal is pursued. Thus, no goal will be pursued indefinitely; people have an inbuilt mechanism that causes their ability to suppress alternatives to fail. Although this failure of self-control is a problem for many people, it clearly has benefits as well. It prevents people from obsessively pursuing any goal, even if that goal is pleasurable and desired. People stop working, creating art, playing video games or even taking heroin, at least for a little while to pursue different goals. Thus, the failure of self-control in humans, although associated with negative consequences, may be critical to maintaining successful autonomous self-regulation. This failure of inhibition prevents autonomous agents from obsessive pursuit of any goal and helps ensure that behavior is balanced between goals. This fatigue process may itself be open to feedback. For example, under certain conditions, the inhibition process may itself be strengthened or weakened to help the agent remain on task or allow itself to be distracted by higher priority tasks. Thus, things like external rewards or importance of the goal may allow the agent to at least temporarily ignore the fatigue feedback and continue working. Conclusion Although competing goals seem like a feature to avoid in an autonomous agent, having conflicting goals is actually critical to the long-term stability of the agent. Such interfering goals prevent autonomous agents from pursuing one goal to the exclusion of all others, thereby helping to avoid situations of unwanted persistence, like the paperclipper maximizer problem. Moreover, by having multiple goals active at once, problems with specifying one general law to guide an autonomous agent are reduced. Instead, the autonomous agent will seek an unstable equilibrium between several goal states, which prevents any one goal becoming predominant. The Human Self-Regulation for AI 14 flexible feedback system further pushes the agent to avoid extremes, while permitting a level of situational adjustment and self-correction. The fact that goals are arranged in hierarchies also helps in the design of an autonomous artificial intelligence. Only the top level goals need to be specified; the lower level goals that fulfill these goals can be discovered through exploration. The flexible feedback system helps to ensure that as the agent develops more complexity it will remain consistent with initial programming goals. That is, the same top-level goals that are active in babies (e.g., make social connections, gain competence) are active in adults, only they are pursued in a more complex way. For the creation of an autonomous agent, specification of general, top-level groups that generally serve the welfare and betterment of humanity should help ensure alignment of the agent with human goals. In humans, these goals have been selected by evolution and society to help guide human behavior and thus have been tested as successful. The rare human that deviates or fails to balance these goals will undergo treatment to try to restore harmony and retraining to select appropriate goals, thus suggesting that human misery is not a product of these goals but rather a failure of self-regulation itself. An autonomous agent with a strong and well-designed self-regulatory system may therefore avoid these problems. That is not to say that human self-regulation is completely understood. For instance, the nature of the topmost goals needs some level of specificity. Research on humans has identified many likely candidates, although there remains some disagreement. There also needs to be some work on how to formally specify these goals in order to assess progress. However, this is not an intractable problem, because as noted above, each level of goal spawns multiple, competing lower level goals. Given that each of these goals likely interfere and that the ability to suppress all other goals weakens over time, a misspecification in a goal will be corrected in the long run. Muraven 15 In summary, a consideration of human self-regulation may help in the design of a more general autonomous agent. Key features of human self-regulation include a hierarchical goal structure, multiple conflicting goals, an emotional feedback system and goal fatigue. This self-regulation system relies on relatively simple rules that generate an unstable equilibrium and thus may be ported to an artificial intelligence system. Moreover, there is reason to believe that an autonomous agent based on these principles will more likely be aligned to human goals and avoid poorly optimized, nonsensical, or monomaniac goal pursuit. Human Self-Regulation for AI 16 References Ballard, T., Yeo, G., Loft, S., Vancouver, J. B., & Neal, A. (2016). An Integrative Formal Model of Motivation and Decision Making: The MGPM*. Bostrom, N. (2014). Superintelligence: Paths, dangers, strategies: OUP Oxford. Busemeyer, J. R., & Diederich, A. (2002). Survey of decision field theory. Mathematical Social Sciences, 43(3), 345-370. Carver, C. S., & Scheier, M. F. (1981). Attention and self-regulation: A control-theory approach to human behavior. New York: Springer-Verlag. Chirkov, V., Ryan, R. M., Kim, Y., & Kaplan, U. (2003). Differentiating autonomy from individualism and independence: a self-determination theory perspective on internalization of cultural orientations and well-being. Journal of Personality and Social Psychology, 84(1), 97. Custers, R., & Aarts, H. (2007). In search of the nonconscious sources of goal pursuit: Accessibility and positive affective valence of the goal state. Journal of Experimental Social Psychology, 43(2), 312-318. Deci, E. L., & Ryan, R. M. (1991). A motivational approach to self: Integration in personality. In R. Dienstbier (Ed.), Nebraska symposium on motivatioU: Vol. 38. Perspective on motivation (pp. 237-288). Lincoln, NB: University of Nebraska Press. Deci, E. L., & Ryan, R. M. (2000). The "what" and "why" of goal pursuits: Human needs and the selfdetermination of behavior. Psychological Inquiry, 11(4), 227-268. Elliot, A. J. (2006). The hierarchical model of approach-avoidance motivation. Motivation and Emotion, 30(2), 111-116. Fisher, C. D. (1978). The effects of personal control, competence, and extrinsic reward systems on intrinsic motivation. Organizational Behavior and Human Performance, 21(3), 273-288. Förster, J., Liberman, N., & Friedman, R. S. (2007). Seven principles of goal activation: A systematic approach to distinguishing goal priming from priming of non-goal constructs. Personality and Social Psychology Review, 11(3), 211-233. Graham, M. D., Young, R. A., Valach, L., & Alan Wood, R. (2008). Addiction as a complex social process: An action theoretical perspective. Addiction Research & Theory, 16(2), 121-133. Kruglanski, A. W., Köpetz, C., Bélanger, J. J., Chun, W. Y., Orehek, E., & Fishbach, A. (2013). Features of multifinality. Personality and Social Psychology Review, 17(1), 22-39. Kruglanski, A. W., Pierro, A., & Sheveland, A. (2011). How many roads lead to Rome? Equifinality set‐size and commitment to goals and means. European Journal of Social Psychology, 41(3), 344-352. Muraven 17 Lord, R. G., & Hanges, P. J. (1987). A control system model of organizational motivation: Theoretical development and applied implications. Behavioral Science, 32(3), 161-178. Lynn, S. K., Wormwood, J. B., Barrett, L. F., & Quigley, K. S. (2015). Decision making from economic and signal detection perspectives: development of an integrated framework. Frontiers in Psychology, 6, 952. doi:10.3389/fpsyg.2015.00952 Muraven, M. (2012). Ego-Depletion: Theory and Research. In R. M. Ryan (Ed.), Oxford Handbook of Motivation (pp. 111-126). New York: Oxford University Press. Muraven, M., & Baumeister, R. F. (2000). Self-regulation and depletion of limited resources: Does selfcontrol resemble a muscle? Psychological Bulletin, 126(2), 247-259. Shah, J. Y., Friedman, R., & Kruglanski, A. W. (2002). Forgetting all else: On the antecedents and consequences of goal shielding. Journal of Personality and Social Psychology, 83(6), 1261-1280. Steel, P., & König, C. J. (2006). Integrating theories of motivation. Academy of Management Review, 31(4), 889-913. Stroebe, W., Mensink, W., Aarts, H., Schut, H., & Kruglanski, A. W. (2008). Why dieters fail: Testing the goal conflict model of eating. Journal of Experimental Social Psychology, 44(1), 26-36. Tangney, J. P. (2003). Self-relevant emotions. In M. R. L. J. P. Tangney (Ed.), Handbook of self and identity (pp. 384-400). New York, NY, US: Guilford Press. Tangney, J. P., Baumeister, R. F., & Boone, A. L. (2004). High Self-Control Predicts Good Adjustment, Less Pathology, Better Grades, and Interpersonal Success. Journal of Personality, 72(2), 271-322. Taylor, S. E., Pham, L. B., Rivkin, I. D., & Armor, D. A. (1998). Harnessing the imagination: Mental simulation, self-regulation, and coping. American Psychologist, 53(4), 429-439.
3cs.SY
arXiv:1709.03565v1 [cs.DS] 11 Sep 2017 Importance Sketching of Influence Dynamics in Billion-scale Networks Hung T. Nguyen, Tri P. Nguyen NhatHai Phan Thang N. Dinh Virginia Commonwealth University Richmond, VA 23284, USA Email: {hungnt,trinpm}@vcu.edu New Jersey Institute of Technology Newark, NJ 07104, USA Email: [email protected] Virginia Commonwealth University Richmond, VA 23284, USA Email: [email protected] Abstract—The blooming availability of traces for social, biological, and communication networks opens up unprecedented opportunities in analyzing diffusion processes in networks. However, the sheer sizes of the nowadays networks raise serious challenges in computational efficiency and scalability. In this paper, we propose a new hyper-graph sketching framework for influence dynamics in networks. The central of our sketching framework, called SKIS, is an efficient importance sampling algorithm that returns only non-singular reverse cascades in the network. Comparing to previously developed sketches like RIS and SKIM, our sketch significantly enhances estimation quality while substantially reducing processing time and memory-footprint. Further, we present general strategies of using SKIS to enhance existing algorithms for influence estimation and influence maximization which are motivated by practical applications like viral marketing. Using SKIS, we design high-quality influence oracle for seed sets with average estimation error up to 10x times smaller than those using RIS and 6x times smaller than SKIMs. In addition, our influence maximization using SKIS substantially improves the quality of solutions for greedy algorithms. It achieves up to 10x times speed-up and 4x memory reduction for the fastest RIS-based DSSA algorithm, while maintaining the same theoretical guarantees. I. I NTRODUCTION Online social networks (OSNs) such as Facebook and Twiter have connected billions of users, providing gigantic communication platforms for exchanging and disseminating information. For example, Facebook now has nearly 2 billions monthly active users and more than 2.5 billion pieces of content exchanged daily. Through OSNs, companies and participants have actively capitalized on the “word-of-mouth” effect to trigger viral spread of various kinds of information, including marketing messages, propaganda, and even fake news. In the past decade, a great amount of research has focused on analyzing how information and users’ influence propagate within the network, e.g., evaluating influence of a group of individuals, aka influence estimation [1], [2], [3], and finding a small group of influential individuals, aka influence maximization [4], [2], [5], [6], [7], [8], or controlling diffusion processes via structure manipulation [9]. Yet, diffusion analysis is challenging due to the sheer size of the networks. For example, state-of-the-art solutions for influence maximization, e.g., DSSA [8], IMM [7], TIM/TIM+[6], cannot complete in the networks with only few million edges [10]. Further, our comprehensive experiments on influence estimation show that the average estimation error can be as high as 40-70% for popular sketches such as RIS and SKIM. This happens even on a small network with only 75K nodes (Epinion). This calls for development of new approaches for analyzing influence dynamics in large-scale networks. In this paper, we propose a new importance sketching technique, termed SKIS, that consists of non-singular reverse influence cascades, or simply non-singular cascades. Each non-singular cascade simulates the reverse diffusion process from a source node. It is important that each non-singular cascade must include at least another node other than the source itself. Thus, our sketch, specifically, suppresses singular cascades that die prematurely at the source. Those singular cascades, consisting of 30%-80% portion in the previous sketches [2], [5], not only waste the memory space and processing time but also reduce estimation efficiency of the sketches. Consequently, SKIS contains samples of smaller variances providing estimations of high concentration with less memory and running time. Our new sketch also powers a new principle and scalable influence maximization class of methods, that inherits the algorithmic designs of existing algorithms on top of SKIS sketch. Particularly, SKIS-based IM methods are the only provably good and efficient enough that can scale to networks of billions of edges across different settings. We summarize of our contributions as follows: • At the central of our sketch is an importance sampling algorithm to sample non-singular cascades (Alg. 1). For simplicity, we first present the sketch and its sampling algorithm using the popular independent cascade model [4], and later extend them to other diffusion models. • We provide general frameworks to apply SKIS for existing algorithms for the influence estimation and influence maximization problems. We provide theoretical analysis to show that using SKIS leads to improved influence estimation oracle due to smaller sample variances and better concentration bounds; and that the state-of-theart methods for influence maximization like D-SSA [8], IMM [7], and, TIM/TIM+[6] can also immediately benefit from our new sketch. • We conduct comprehensive empirical experiments to demonstrate the effectiveness of our sketch in terms of quality, memory and computational time. Using SKIS, we can design high-quality influence oracle for seed set with average estimation error up to 10x times smaller than those using RIS and 6x times those using SKIM. In addition, our influence maximization using SKIS substantially improves the quality of solutions for greedy algorithms. It achieves up to 10x times speed-up and 4x memory reduction for the fastest RIS-based DSSA algorithm, while maintaining the same theoretical guarantees. Related work. Sketching methods have become extremely useful for dealing with problems in massive sizes. Most notable sketches including bottom-k sketches [11] a summary of a set of items with nonnegative weights, count-min sketch [12] that count the frequency of different events in the stream. Recently, Cohen et al. [2] investigate the combined reachability sketch which is a bottom-k min-hash sketch of the set of reachable nodes. They show small estimation errors for estimating influences. However, this method deteriorates for large influences since the size of each sketch is fixed. Similar scheme was applied for continuous-time model [13]. Borgs et al. [5] proposed reverse influence sketch (RIS) which captures the influences in a reverse manner. This approach has advantage in estimating large influences and becomes very successful in finding the seed set with maximum influence, i.e. influence maximization. [3] uses RIS sketches to estimate influences in dynamic graphs. Other related works on influences in multiplex networks and identifying the sources of influence cascades are studied in [14], [15], [16]. Organization. The rest of the paper is organized as follows: In Section II, we introduce the diffusion model and two problems of influence estimation/maximization. We propose our importance sketching scheme in Section III. Applications in influence estimation/maximization is presented in Sections IV and V, respectively. Extensions to other diffusion models are discussed in Section VI which is followed by experiments in Section VII and conclusion in Section VIII. II. P RELIMINARIES Consider a social network abstracted as a graph G = (V, E, w). Each edge (u, v) ∈ E is associated with a real number w(u, v) ∈ [0, 1] specifying the probability that node u will influence v once u is influenced. To model the influence dynamic in the network, we first focus on the popular Independent Cascade (IC) model [4] and then, discuss the extensions of our techniques to other models, e.g. Linear Threshold (LT) or Continuous-time model, later in Section VI. A. Independent Cascade Model For a subset of nodes S ⊆ V , called seed set, the influence propagation from S happens in discrete rounds t = 0, 1, ... At round 0, only nodes in S are active (aka influenced) and the others are inactive. Each newly activated node u at round t will have a single chance to activate each neighbor v of u with probability w(u, v). An activated node remains active till the end of the diffusion propagation. The process stops when no more nodes get activated. Sample Graphs. Once a node u gets activated, it will activate each of its neighbor v with probability w(u, v). This can be thought of as flipping a biased coin that gives head with probability w(u, v) to determine whether the edge (u, v) exists. If the coin lands head for the edge (u, v), the activation occurs and we call (u, v) a live-edge. Since all the influences in the IC model are independent, it does not matter when coins are flipped to determine the states of the edges. Thus, we can flip all the coins at the beginning instead of waiting until u gets activated. We call the deterministic graph g that contains all the live-edges resulted from a series of coin flips over all the edges in G a sample graph of G. Probabilistic Space. The set of all sample graphs generated from G together with their probabilities define a probabilistic space ΩG . Each sample graph g ∈ ΩG can be generated by flipping coins on all the edges to determine whether or not the edge is live or appears in g. That is each edge (u, v) will be present in a sample graph with probability w(u, v). Therefore, a sample graph g = (V, E 0 ⊆ E) is generated from G with a probability Pr[g ∼ G] calculated by, Y Y (1 − w(u, v)). (1) w(u, v) Pr[g ∼ G] = (u,v)∈E / 0 (u,v)∈E 0 Influence Spread. Given a diffusion model, the measure Influence Spread (or simply influence) of a seed set S is defined as the expected number of active nodes in the end of the diffusion propagation, where the expectation is taken over the probabilistic space ΩG . Given a sample graph g ∼ G and a seed set S ⊂ V , we denote ηg (S) the set of nodes reachable from S (including nodes in S themselves). The influence spread of S is defined as follows, X I(S) = |ηg (S)| Pr[g ∼ G]. (2) g∼G The frequently used notations are summarized in Table I. TABLE I: Table of notations Notation n, m I(S), Î(S) N in (S) γv , Γ γ0 Rj , R CR (S) Description #nodes, #edges of graph G = (V, E, w). Expected Influence of S ⊆ V and an estimate. Set of in-neighbor nodes of S. P γv = 1−Πu∈N in (v) (1−w(u, v)); Γ = v∈V γv . P γ0 = v∈V γv /n. A random IIS sample and a SKIS sketch. CR (S) = |Rj ∈ R|Rj ∩ S 6= ∅|. B. Influence Estimation/Maximization Problems We describe the tasks of Influence Estimation and Maximization which are used to evaluate sketches’ efficiency. Definition 1 (Influence Estimation (IE)). Given a probabilistic graph G and a seed set of nodes S ⊆ V , the IE problem asks for an estimation Î(S) of the set influence I(S). Definition 2 (Influence Maximization (IM) [4]). Given a probabilistic graph G, a budget k, the IM problem asks for a set Sk of size at most k having the maximum influence among all other sets of size at most k, Sk = arg max I(S). (3) S⊆V,|S|≤k C. Sketch-based Methods for IE/IM 90 30 g,ηg (src(Rj ))=Rj The key property of RIS samples for influence estimation/maximization is stated in the following lemma. Lemma 1 ([5]). Given a random RIS sample Rj generated from G = (V, E, w), for a set S ⊆ V of nodes, we have, I(S) = n · Pr[Rj ∩ S 6= ∅]. (5) Thus, estimating/maximizing I(S) is equivalent to estimating/maximizing the probability Pr[Rj ∩ S 6= ∅]. Using RIS samples for IE/IM. Thanks to Lemma 1, a general strategy for IE/IM is generating a set of RIS samples, then returning an empirical estimate of Pr[Rj ∩ S 6= ∅] on generated samples for IE or the set Ŝk that intersects with most samples for IM. The strong advantage of RIS is the reuse of samples to estimate influence of any seed set S ⊆ V . Ohsaka et al. [3] build a query system to answer influence queries. [5], [6], [7], [8], [17] recently use RIS samples in solving Influence Maximization problem with great successes, i.e. handling large networks with tens of millions of nodes and billions of edges. 2) Combined Reachability Sketch (SKIM): Cohen et al. [2] proposed the combined reachability sketch which can be used to estimate influences of multiple seed sets. Each node u in the network is assigned a combined reachability sketch which is a bottom-k min-hash sketch of the set of nodes reachable from u in l sample graphs. [2] generates l sample graphs g of G, i.e. l = 64 by default, and build a combined reachability sketch of size k for each node. The influence estimate of a seed set S is computed by taking the bottom-k sketch of the union over all the sketches of nodes in S and applying the cardinality estimator [2]. Using the sketches, the solution for IM is found by following the greedy algorithm which repeatedly adds a node with highest marginal influence into the solution. Here, the marginal influences are similarly estimated from node sketches. Common Shortcomings. According to recent benchmarks [10] and our own empirical evaluations (details in Section VII), both RIS and SKIM yield significant influence estimation errors. For RIS, it is due to the fact that the majority of RIS samples contain only their sources as demonstrated in %Samples 60 %Samples 1) Reverse Influence Sketch (RIS): Essentially, a random RIS sample, denoted by Rj , contains a random set of nodes, following a diffusion model, that can influence a randomly selected source node, denoted by src(Rj ). A RIS sample is generated in three steps: 1) Select a random node v ∈ V which serves as src(Rj ). 2) Generate a sample graph g ∼ G. 3) Return the set Rj of nodes that can reach v in g. Thus, the probability of generating a particular RIS sample Rj can be computed based on the source selection and the sample graphs that has Rj as the set of nodes that reach src(Rj ) in g. Let denote such set of nodes that can reach to a node v in sample graph g by ηg− (v). We have, X 1 Pr[g]. (4) Pr[Rj ] = n − 20 30 10 0 0 1 2 3 4 5 6 Sample Size 7 8 (a) Weighted Cascade (WC) 1 2 3 4 5 6 Sample Size 7 8 (b) Trivalency (TRI) Fig. 1: Distribution of reversed cascade sizes on Epinions network (and on other networks as well) with two different edge weight models: Weighted Cascade (WC) and Trivalency (TRI). The majority of the cascades are singular. Figure 1 with up to 86% of such RIS samples overall. These samples, termed singular, harm the performance in two ways: 1) they do not contribute to the influence computation of other seed sets than the ones that contain the sources, however, the contribution is known in advance, i.e. number of seed nodes; 2) these samples magnify the variance of the RIS-based random variables used in estimation causing high errors. This motivates our Importance Sketching techniques to generate only non-singular samples that are useful for influence estimations of many seed sets (not just ones with the sources). III. I MPORTANCE S KETCHING This section introduces our core construction of Importance Sketching algorithm to generate random non-singular samples with probabilities proportional to those in the original sample space of reverse influence samples and normalized by the probability of generating a non-singular ones. Algorithm 1: Importance Influence Sampling (IIS) Alg. 1 2 3 4 5 6 Input: Graph G = (V, E, w) Output: Rj - A random IIS sample Pick a node v ∈ V as the source with probability in Eq. 8; Select an in-neighbor ui of v, ui ∈ N in (v), with probability of selecting ui given in Eq. 9; Initialize a queue Q = {ui } and a node set Rj = {v, ui }; foreach ut ∈ N in (v), t 6= i do With probability w(ut , v): Q.push(ut ); Rj ← Rj ∪ {ut }; 11 while Q is not empty do v = Q.pop();// get the longest inserted node foreach u ∈ N in (v)\(Rj ∪ Q) do With probability w(u, v): Q.push(u); Rj ← Rj ∪ {u}; // insert u 12 return Rj ; 7 8 9 10 A. Importance Influence Sampling (IIS) Sample Spaces and Desired Property. Let ΩRIS be the sampling space of reverse influence samples (RIS) with probability Pr[Rj ∈ ΩRIS ] of generating sample Rj . Let ΩSKIS be a subspace of ΩRIS and corresponds to the space of only non-singular reverse influence samples in ΩRIS . Since ΩSKIS is a subspace of ΩRIS , the probability Pr[Rj ∈ ΩSKIS ] of generating a non-singular sample from ΩSKIS is larger than that from ΩRIS . Specifically, for a node v ∈ V , let γv be the probability of generating a non-singular sample if v is P selected as the source and Γ = γ . Then, since the v∈V v sample sources are selected randomly, the ratio of generating a non-singular sample to generating any sample in ΩRIS is nΓ and thus, the probability Pr[Rj ∈ ΩSKIS ] is as follows, n Pr[Rj ∈ ΩSKIS ] = Pr[Rj ∈ ΩRIS ]. (6) Γ Our upcoming IIS algorithm aims to achieve this desired property of sampling non-singular samples from ΩSKIS . Sampling Algorithm. Our Importance Influence Sampling (IIS) scheme involves three core components: 1) Probability of having a non-singular sample. For a node v ∈ V , a sample with source v is singular if no inneighbor of v is selected, that happens with probability Πu∈N in (v) (1−w(u, v)). Hence, the probability of having a non-singular sample from a node v is the complement: γv = 1 − Πu∈N in (v) (1 − w(u, v)). (7) 2) Source Sampling Rate. Note that the set of non-singular samples is just a subset of all possible samples and we want to generate uniformly random samples from that subset. Moreover, each node v has a probability γv of generating a non-singular sample from it. Thus, in order to generate a random sample, we select v as the source with probability Pr[src(Rj ) = v] computed as follows, γv γv , (8) = Pr[src(Rj ) = v] = P Γ u∈V γu P where Γ = u∈V γu , and then generate a uniformly random non-singular sample from the specific source v as described in the next component. 3) Sample a non-singular sample from a source. From the src(Rj ) = v, we generate a non-singular sample Rj from v uniformly at random. Let N in (v) = {u1 , u2 , . . . , ul } be a fixed-order set of in-neighbors of v. We divide the all possible non-singular samples from v into l buckets: bucket Bi , 1 ≤ i ≤ l contains those samples that have the first node from N in (v) being ui . That means all the nodes u1 , . . . , ui−1 are not in the sample but ui is in for certain. The other nodes from ui+1 to ul may appear and will be sampled following the normal RIS sampling. Now we select the bucket that Rj belongs to with the probability of selecting Bi being as follows, Qi−1 (1 − w(ut , v))w(ui , v) . (9) Pr[select Bi ] = t=1 γv For i = 1, we have Pr[select B1 ] = w(u1 , v). Note that P l i=1 Pr[select Bi ] = 1. Assume bucket Bi is selected and, thus, node ui is added as the second node besides the source into Rj . For each other node ut , t 6= i, ut is selected into Rj with probability w(ut , v) following the ordinary RIS for the IC model. These three components guarantee a non-singular sample. The detailed description of IIS sampling is in Alg. 1. The first step selects the source of the IIS sample among V . Then, the first incoming node to the source v is picked (Line 2) following the above description of the component 3). Each of the other incoming neighbors also tries to influence the source (Lines 4-6). The rest performs similarly as in RIS [5]. That is for each newly selected node, its incoming neighbors are randomly added into the sample with probabilities equal to their edge weights. It continues until no newly selected node is observed. Note that Line 3 only adds the selected neighbors ui of v into Q but adds both v and ui to Rj . The loop from Lines 7-11 mimics the BFS-like sampling procedure of RIS. Let Pr[Rj ] be the probability of generating a non-singular sample Rj using IIS algorithm. We have X Pr[Rj ] = Pr[src(Rj ) = v] Pr[generate Rj from v] v∈V X γv Pr[Rj ∈ ΩRIS and src(Rj ) = v] Γ γv v∈V X n 1 = Pr[Rj ∈ ΩRIS and src(Rj ) = v] Γ n v∈V n = Pr[Rj ∈ ΩRIS ] = Pr[Rj ∈ ΩSKIS ], Γ Pr[Rj ∈ΩRIS and src(Rj )=v] where Pr[generate Rj from v] = due γv to the selection of the bucket that Rj belongs to in IIS. Thus, the output Rj of IIS is an random sample from non-singular space ΩSKIS and we obtain the following lemma. = Lemma 2. Recall that ΩSKIS is the sample space of nonsingular reverse influence samples. IIS algorithm generates a random non-singular sample from sample space ΩSKIS . Connection between IIS Samples and Influences. We establish the following key lemma that connects our IIS samples with the influence of any seed set S. Lemma 3. Given a random IIS sample Rj generated by Alg. 1 from the graph G = (V, E, w), for any set S ⊆ V , we have, X I(S) = Pr[Rj ∩ S 6= ∅] · Γ + (1 − γv ), (10) v∈S where γv and Γ are defined in Eqs. 7 and 8. The proof is presented in our extended version [18]. The influence I(S) of any set S comprises of two parts: 1) Pr[Rj ∩ S 6= ∅] ·P Γ depends on the randomness of Rj and 2) the fixed amount v∈S (1−γv ) that is inherent to set S and accounts for the contribution of singular samples in ΩRIS to the influence I(S). Lemma 3 states that instead of computing or estimating the influence I(S) directly, we P can equivalently compute or estimate Pr[Rj ∩S 6= ∅]·Γ+ v∈S (1−γv ) using IIS samples. Remark: Notice that we can further generate samples of larger sizes and reduce the variance as shown later, however, the computation would increase significantly. IV. I NFLUENCE O RACLE VIA IIS S KETCH (SKIS) We use IIS sampling to generate a sketch for answering influence estimation queries of different node sets. We show that the random variables associated with our samples have much smaller variances than that of RIS, and hence, lead to better concentration or faster estimation with much fewer samples required to achieve the same or better quality. SKIS-based Influence Oracle. An SKIS sketch R is a collection of IIS samples generated by Alg. 1, i.e. R = {R1 , . . . , RT }. As shown in Lemma 3, the influence I(S) can be estimated through estimating the probability Pr[Rj ∩ S 6= ∅]. Thus, from a SKIS sketch R = {R1 , . . . , RT }, we can obtain an estimate Î(S) of I(S) for any set S by, X CR (S) ÎR (S) = ·Γ+ (1 − γv ), (11) |R| v∈S where CR (S) is coverage of S on R, i.e., CR (S) = |{Rj ∈ R|Rj ∩ S 6= ∅}|. (12) Lemma 4. The random variable Zj (S) (Eq. 14) has I(S) Γ I2 (S) Var[Zj (S)] = − n n n2 P X (1 − γv ) (Γ + (1 − γv ) − 2I(S)). − v∈S 2 n (19) v∈S Since the random variables Yj (S) for RIS samples are Bernoulli and E[Yj (S)] = I(S) n , we have Var[Yj (S)] = I(S) I(S) (1 − ). Compared with Var[Zj (S)], we observe that n n 2 I(S) Γ I2 (S) I(S) Γ = Var[Yj (S)], since n ≤ 1, n n − n2 ≤ n − I n(S) 2 Var[Zj (S)] ≤ Var[Yj (S)] P X (1 − γv ) − v∈S 2 (Γ + (1 − γv ) − 2I(S)). n v∈S Algorithm 2: SKIS-based Influence Oracle 1 2 Input: Graph G = (V, E, w) Preprocessing: Generate a SKIS sketch R = {R1 , . . . , RT } of IIS samples using Alg. 1. For any influence query for any set S: return ÎR (S) (Eq. 11). We build an SKIS-based oracle for influence queries by generating a set R of T IIS samples in a preprocessing step and then answer influence estimation query ÎR (S) for any requested set S (Alg. 2). In the following, we show the better estimation quality of our sketch through analyzing the variances and estimating concentration properties. SKIS Random Variables for Estimations. For a random IIS sample Rj and a set S, we define random variables: ( 1 if Rj ∩ S 6= ∅ Xj (S) = , and (13) 0 otherwise. P Xj (S) · Γ + v∈S (1 − γv ) . (14) Zj (S) = n Then, the means of Xj (S) and Zj (S) are as follows, P I(S) − v∈S (1 − γv ) (15) E[Xj (S)] = Pr[Rj ∩ S 6= ∅] = Γ P (1 − γv ) Γ I(S) E[Zj (S)] = E[Xj (S)] · + v∈S = . (16) n n n Hence, we can construct a corresponding set of random variables Z1 (S), PTZ2 (S), . . . , ZT (S) by Eqs. 13 and 14. Then, ÎR (S) = Tn j=1 Zj (S) is an empirical estimate of I(S) based on the SKIS sketch R. For comparison purposes, let Yj (S) be the random variable associated with RIS sample Qj in a RIS sketch Q, ( 1 if Qj ∩ S 6= ∅ Yj (S) = (17) 0 otherwise. From Lemma 1, the mean value of Yj (S) is then, I(S) E[Yj (S)] = . n (18) Variance Reduction Analysis. We show that the variance of Zj (S) for SKIS is much smaller than that of Yj (S) for RIS. The variance of Zj (S) is stated in the following. In practice, most ofP seed sets have small influences, i.e. I(S)  Γ2 , thus, Γ + v∈S (1 − γv ) − 2I(S)  0. Hence, Var[Zj (S)] < Var[Yj (S)] holds for most seed sets S. Better Concentrations Variables. ObP h P of SKIS Random i v∈S (1−γv ) Γ+ v∈S (1−γv ) , we obtain , serve that Zj (S) ∈ n n another result on the variance of Zj (S) as follows. Lemma 5. The variance of random variable Zj (S) satisfies I(S) Γ Var[Zj (S)] ≤ . (20) n n Using the above result with the general form of Chernoff’s bound in Lemma 2 in [7], we derive the following concentration inequalities for random variables Zj (S) of SKIS. Lemma 6. Given a SKIS sketch R = {R1 , . . . , RT } with random variables Z1 (S), . . . , ZT (S), we have, h PT Zj (S) i  −2 T I(S)  j=1 Pr n − I(S) ≥ I(S) ≤ exp Γ T + 23  n 2n P i  −2 T I(S)  h T Zj (S) j=1 n − I(S) ≤ −I(S) ≤ exp . Pr Γ T n 2n Compared with the bounds for RIS sketch in Corollaries 1 and 2 in [7], the above concentration bounds for SKIS sketch (Lemma 6) are stronger, i.e. tighter. Specifically, we have the factor nΓ in the denominator of the exp(.) function while for RIS random variables, it is simply 1. Sufficient Size of SKIS Sketch for High-quality Estimations. There are multiple strategies to determine the number of IIS samples generated in the preprocessing step. For example, [3] generates samples until total size of all samples reaches O( 13 (n + m) log(n)). Generating IIS samples to reach such a specified threshold is vastly faster than using RIS due to the bigger size of IIS samples. This method provides an additive estimation error guarantee within . Alternatively, by Lemma 6, we derive the sufficient number of IIS samples to provide the more preferable (, δ)-estimation of I(S). Lemma 7. Given a set S, , δ ≥ 0, if the SKIS sketch R n −2 has at least (2 nΓ + 23 ) ln( 2δ ) I(S)  IIS samples, ÎR (S) is an (, δ)-estimate of I(S), i.e., Pr[(1 − )I(S) ≤ ÎR (S) ≤ (1 + )I(S)] ≥ 1 − δ. (21) In practice, I(S) is unknown in advance and a lower-bound of I(S), e.g. |S|, can be used to compute the necessary number of samples to provide the same guarantee. Compared to RIS with weaker concentration bounds, we save a factor of O( Γn ). V. SKIS- BASED IM A LGORITHMS With the help of SKIS sketch that is better in estimating the influences compared to the well-known successful RIS, we can largely improve the efficiency of IM algorithms in the broad class of RIS-based methods, i.e. RIS [5], TIM/TIM+ [6], IMM [7], BCT [19], [20], SSA/DSSA [8]. This improvement is possible since these methods heavily rely on the concentration of influence estimations provided by RIS samples. SKIS-based framework. Let R = {R1 , R2 , . . . } be a SKIS sketch of IIS samples. R gives an influence estimate X CR (S) ·Γ+ (1 − γv ), (22) ÎR (S) = ÊR [Zj (S)] · n = |R| v∈S for any set S. Thus, instead of optimizing over the exact influence, we can intuitively find the set S to maximize the estimate function Î(S). Then, the framework of using SKIS sketch to solve IM problem contains two main steps: 1) Generate a SKIS sketch R of IIS samples, 2) Find the set Sk that maximizes the function ÎR (S) and returning Sk as the solution for the IM instance. There are two essential questions related to the above SKISbased framework : 1) Given a SKIS sketch R of IIS samples, how to find Sk of k nodes that maximizes ÎR (Sk ) (in Step 2)? 2) How many IIS samples in the SKIS sketch R (in Step 1) are sufficient to guarantee a high-quality solution for IM? We give the answers for the above questions in the following sections. Firstly, we adapt the gold-standard greedy algorithm to obtain an (1 − (1 − 1/k)k )-approximate solution over a SKIS sketch. Secondly, we adopt recent techniques on RIS with strong solution guarantees to SKIS sketch. Algorithm 3: Greedy Algorithm on SKIS sketch 4 Input: SKIS sketch R and k Output: An (1 − (1 − 1/k)k )-approximate seed set Ŝk Ŝk = ∅ for i = 1 : k do  (v,Ŝk ) v̂ ← arg maxv∈V \Ŝk ∆R|R| Γ + (1 − γv ) Add v̂ to Ŝk 5 return Ŝk 1 2 3 A. Greedy Algorithm on SKIS Sketches Let consider the optimization problem of finding a set Sk of at most k nodes to maximize the function ÎR (S) on a SKIS sketch R of IIS samples under the cardinality constraint |S| ≤ k. The function ÎR (S) is monotone and submodular since it is the weighted P sum of a set coverage function CR (S) and a linear term v∈S (1 − γv ). Thus, we obtain the following lemma with the detailed proof in our extended version [18]. Lemma 8. Given a set of IIS samples R, the set function ÎR (S) defined in Eq. 22 is monotone and submodular. Thus, a standard greedy scheme [21], which iteratively selects a node with highest marginal gain, gives an (1−(1− k1 )k ), that converges to (1 − 1/e) asymptotically, approximate solution Ŝk . The marginal gain of a node v with respect to a set S on SKIS sketch R is defined as follows, ∆R (v, Ŝk ) gainR (v, S) = Γ + (1 − γv ), (23) |R| where ∆R (v, S) = CR (S ∪ {v}) − CR (S) is called the marginal coverage gain of v w.r.t. S on SKIS sketch R. Given a collection of IIS samples R and a budget k, the Greedy algorithm is presented in Alg. 3 with a main loop (Lines 2-4) of k iterations. Each iteration picks a node v̂ having largest marginal gain (Eq. 23) with respect to the current partial solution Ŝk and adds it to Ŝk . The approximation guarantee of the Greedy algorithm (Alg. 3) is stated below. Lemma 9. The Greedy algorithm (Alg. 3) returns an (1 − (1 − k1 )k )-approximate solution Ŝk , 1 ∗ ), (24) ÎR (Ŝk ) ≥ (1 − (1 − )k )ÎR (SR k ∗ is the optimal cover set of size k on sketch R. where SR The lemma is derived directly from the 1 − (1 − k1 )k approximation factor of the ordinary greedy algorithm [21]. B. Sufficient Size of SKIS Sketch for IM Since the SKIS sketch offers a similar greedy algorithm with approximation ratio (1 − (1 − 1/k)k ) to the traditional RIS, we can combine SKIS sketch with any RIS-based algorithm, e.g. RIS[5], TIM/TIM+[6], IMM[7], BCT[20], SSA/DSSA[8]. We discuss the adoptions of two most recent and scalable algorithms, i.e. IMM[7] and SSA/DSSA[8]. IMM+SKIS. Tang et al. [7] provide a theoretical threshold    n n −2  θRIS = O (log + log δ −1 )  (25) k OPTk on the number of RIS samples to guarantee an (1 − 1/e − )approximate solution for IM problem with probability 1 − δ. Replacing RIS with IIS samples to build a SKIS sketch enables us to use the better bounds in Lemma 6. By the approach of IMM in [7] with Lemma 6, we reduce the threshold of samples to provide the same quality to,  Γ + k θSKIS = O θRIS . (26) n SSA/DSSA+SKIS. More recently, Nguyen et al. [8] propose SSA and DSSA algorithms which implement the Stopand-Stare strategy of alternating between finding candidate solutions and checking the quality of those candidates at exponential points, i.e. 2t , t ≥ 1, to detect a satisfactory solution at the earliest time. Combining SKIS with SSA or DSSA brings about multiple benefits in the checking step of SSA/DSSA. The benefits stem from the better concentration bounds which lead to better error estimations and smaller thresholds to terminate the algorithms. The details are in our extended version [18]. L VI. E XTENSIONS TO OTHER DIFFUSION MODELS The key step in extending our techniques for other diffusion models is devising an importance sketching procedure for each model. Fortunately, following the same designing principle as IIS, we can devise importance sketching procedures for many other diffusion models. We demonstrate this through two other equally important and widely adopted diffusion models, i.e. Linear Threshold [4] and Continuous-time model [13]. Linear Threshold model [4]. This model imposes a constraint that the total weights P of incoming edges into any node v ∈ V is at most 1, i.e. u∈N in (v) w(u, v) ≤ 1. Every node has a random activation threshold λv ∈ [0, 1] and gets activated if the Ptotal edge weights from active in-neighbors exceeds λv , i.e. u∈N in (v),u is active w(u, v) ≥ λv . A RIS sampling for LT model [20] selects a random node as the source and iteratively picks at most one in-neighbor of the last activated node with probability being the edge weights, w(u, v). The importance sketching algorithm for the LT model has the following components: • Probability of having a non-singular sample: X γv = w(u, v) (27) u∈N in (v) • Source Sampling Rate: Pr[src(Rj ) = v] = P γv (28) γv Sample a non-singular sample from a source.: select exactly one in-neighbor u of src(Rj ) = v with probability w(u,v) γv . The rest follows RIS sampling [19]. v∈V • Continuous-time model [13]. Here we have a deadline parameter T of the latest activation time and each edge (u, v) is associated with a length distribution, represented by a density function L(u,v) (t), of how long it takes u to influence v. A node u is influenced if the length of the shortest path from any active node at time 0 is at most T . The RIS sampling for the Continuous-time model [7] picks a random node as the source and invokes the Dijkstra’s algorithm to select nodes into src(Rj ). When the edge (u, v) is first visited, the activation time is sampled following its length distribution L(u,v) (t). From the length distribution, we can compute the probability p(u, v, T ) of an edge (u, v) having activation time at most T Z T p(u, v, T ) = L(u,v) (t)dt (29) t=0 The importance sketching procedure for the Continuoustime model has the following components: • Probability of having a non-singular sample: Y γv = 1 − (1 − p(u, v, T )) (30) u∈N in (v) • Source Sampling Rate: Pr[src(Rj ) = v] = P γv (31) γv Sample a non-singular sample from a source.: Use a bucket system on p(u, v, T ) similarly to IIS to select the first in-neighbor u. The activation time of u follows v∈V • (t) . Subsequently, the normalized density function (u,v) γv it continues by following RIS sampling [7]. VII. E XPERIMENTS We demonstrate the advantages of our SKIS sketch through a comprehensive set of experiments on the key influence estimation and maximization problems. Due to space limit, we report the results under the IC model and partial results for the LT model. However, the implementations for all models will be released on our website to produce complete results. A. Experimental Settings TABLE II: Datasets’ Statistics Dataset #Nodes 3 NetPHY 37 · 10 Epinions 75 · 103 DBLP 655 · 103 Orkut 3 · 106 Twitter [22] 41.7 · 106 Friendster 65.6 · 106 #Edges Avg. Degree 181 · 103 841 · 103 2 · 106 234 · 106 1.5 · 109 3.6 · 109 9.8 22.4 6.1 78.0 70.5 109.6 Datasets. We use 6 real-world datasets from [23], [22] with size ranging from tens of thousands to as large as 65.6 million nodes and 3.6 billion edges. Table II gives a summary. Algorithms compared. On influence estimation, we compare our SKIS sketch with: • RIS [5]: The well-known RIS sketch. • SKIM [2]: Combined reachability sketch. We run SKIM with default parameters in [2] (k = l = 64). SKIM is modified to read graph from files instead of internally computing the edge weights. Following [3], we generate samples into SKIS and RIS until the total size of all the samples reaches h · n log n where h is a constant. Here, h is chosen in the set {5, 10}. On influence maximization, we compare: • PMC [24]: A Monte-Carlo simulation pruned method with no guarantees. It only works on the IC model. • IMM [7]: RIS-based algorithm with quality guarantees. • DSSA [8]: The current fastest RIS-based algorithm with approximation guarantee. • DSSA+SKIS: A modified version of DSSA where SKIS sketch is adopted to replace RIS. We set  = 0.5, δ = 1/n for the last three algorithms. For PMC, we use the default parameter of 200 DAGs. Metrics. We compare the algorithms in terms of the solution quality, running time and memory usage. To compute the solution quality of a seed set, we adopt the relative difference |Î(S)−I(S)| · 100%, where Î(S) is an which is defined as max{I(S), Î(S)} estimate, and I(S) is the “ground-truth” influence of S. Ground-truth Influence. Unlike previous studies [7], [2], [24] using a constant number of cascade simulations, i.e. 10000, to measure the ground-truth influence with unknown accuracy, we adopt the Monte-Carlo Stopping-Rule algorithm [25] that guarantees an estimation error less than  with probability at least 1 − δ where  = 0.005, δ = 1/n. Specifically, let W Wj be the size of a random influence cascade and Zj = nj with E[Zj ] = I(S)/n and 0 ≤ Zj ≤ 1. The Monte-Carlo PT method generates sample Zj until j=1 Zj ≥ 4(e−2) ln( 2δ ) 12 PT Zj and returns Î(S) = j=1 n as the ground-truth influence. T For Twitter and Friendster dataset, we set  = 0.05, and δ = 1/n to compute ground-truth due to the huge computational cost in these networks. For the other networks, we keep the default setting of  and δ as specified above. Weight Settings. We consider two widely-used models: • Weighted Cascade (WC) [6], [2], [7], [8]: The weight of edge (u, v) is inversely proportional to the in-degree of node v, din (v), i.e. w(u, v) = din1(v) . • Trivalency (TRI) [2], [26], [27]: The weight w(u, v) is selected randomly from the set {0.1, 0.01, 0.001}. Environment. We implemented our algorithms in C++ and obtained the implementations of others from the corresponding authors. We conducted all experiments on a CentOS machine with Intel Xeon E5-2650 v3 2.30GHz CPUs and 256GB RAM. We compute the ground-truth for our experiments in a period of 2 months on a cluster of 16 CentOS machines, each with 64 Intel Xeon CPUs X5650 2.67GHz and 256GB RAM. TABLE III: Average relative differences (dnf: “did not finish” within 24h). SKIS almost always returns the lowest errors. WC Model SKIS RIS TRI Model SKIM SKIS RIS SKIM |S| Nets h(5) h(10) h(5) h(10) k(64) h(5) h(10) h(5) h(10) k(64) l PHY 6.2 3.7 14.0 Epin. 4.7 3.0 15.7 DBLP 3.8 4.1 13.7 Orkut 10.3 9.2 13.5 Twit. 10.9 10.5 21.4 Frien. 15.9 10.2 22.2 7.8 7.5 1.7 1.3 11.8 11.8 19.6 16.6 14.2 55.3 11.6 5.0 0.9 0.7 9.4 8.8 77.6 9.3 9.9 14.5 16.0 29.1 81.4 81.9 80.8 13.3 dnf 29.8 21.3 28.5 8.2 4.5 47.4 27.7 6.4 3.5 10.8 dnf 81.5 dnf 23.6 dnf PHY Epin. 2 DBLP 10 Orkut Twit. Frien. 0.9 1.0 0.9 0.9 1.1 0.9 0.6 0.7 0.6 0.6 1.2 0.7 1.0 1.0 1.9 1.1 1.3 0.9 0.7 2.1 0.3 1.0 7.6 0.2 1.4 5.0 0.8 0.7 56.5 0.1 1.1 60.2 4.3 0.7 dnf 1.9 0.2 1.5 0.7 0.2 3.1 1.9 1.1 4.4 5.5 4.2 6.4 0.6 0.9 1.8 5.3 0.9 5.5 2.0 1.8 2.8 5.5 dnf dnf dnf PHY Epin. 3 DBLP 10 Orkut Twit. Frien. 0.6 0.6 0.2 0.3 0.9 0.3 0.8 0.6 0.3 0.3 0.9 0.3 0.9 0.6 0.2 0.3 1.0 0.3 1.0 0.6 0.3 0.7 2.3 2.3 0.2 1.7 0.1 0.3 50.7 2.5 0.9 36.3 0.9 0.2 dnf 1.9 0.4 0.3 0.0 1.1 2.4 1.9 1.2 1.9 0.3 6.8 4.1 0.6 1.3 4.6 0.2 2.1 2.8 2.0 1.1 1.5 0.3 dnf dnf dnf B. Influence Estimation We show that SKIS sketch consumes much less time and memory space while consistently obtaining better solution quality, i.e. very small errors, than both RIS and SKIM. 1) Solution Quality: Table III and Figure 2 present the relative estimation errors of all three sketches. The solution quality of SKIS is consistently better than RIS and SKIM across all the networks and edge models. As shown in Table III, the errors of SKIS are 110% and 400% smaller than those of RIS with k = 1 while being as good as or better TABLE IV: Sketch construction time and index memory of algorithms on different edge models. SKIS and RIS uses roughly the same time and memory and less than that of SKIM. Index Time [second (or h for hour)] SKIS RIS SKIM Index Memory [MB (or G for GB)] SKIS RIS SKIM M Nets h(5)h(10) h(5)h(10) k(64) h(5)h(10) h(5)h(10) k(64) PHY 0 1 1 1 2 41 83 Epin. 1 1 1 1 10 63 126 DBLP 10 18 7 14 37 702 1G WC Orkut 92 157 69 148 0.6h 2G 5G Twit. 0.6h 0.9h 0.4h 1.0h 5.2h 38G 76G Frien. 0.8h 1.8h 0.8h 1.9h dnf 59G 117G 52 105 105 81 162 220 848 2G 2G 3G 5G 9G 42G 84G 44G 61G 117G dnf PHY 0 1 1 2 Epin. 1 1 1 1 DBLP 11 34 18 36 TRI Orkut 88 206 89 197 Twit. 0.6h 1.2h 0.5h 1.3h Frien. 0.9h 2.3h 1.0h 2.4h 97 194 41 84 2G 5G 2G 4G 36G 69G 54G 108G 1 29 22 dnf dnf dnf 46 90 41 82 1G 2G 2G 4G 36G 69G 54G 108G 99 230 2G dnf dnf dnf than RIS for k = 100, 1000. On the other hand, SKIM shows the largest estimation errors in most of the cases. Particularly, SKIM’s error is more than 60 times higher than SKIS and RIS on Twitter when |S| = 100. Similar results are observed under TRI model. Exceptionally, on Twitter and Friendster, the relative difference of RIS is slightly smaller than SKIS with h = 5 but larger on h = 10. In TRI model, estimating a random seed on large network as Twitter produces higher errors since we have insufficient number of samples. Figures 2b, c, and d draw the error distributions of sketches for estimating the influences of random seeds. Here, we generate 1000 uniformly random nodes and consider each node to be a seed set. We observe that SKIS’s errors are highly concentrated around 0% even when the influences are small while errors of RIS and SKIM spread out widely. RIS reveals extremely high errors for small influence estimation, e.g. up to 80%. The error distribution of SKIM is the most widely behaved, i.e. having high errors at every influence level. Under TRI model (Figure 2a), SKIS also consistently provides significantly smaller estimation errors than RIS and SKIM. 2) Performance: We report indexing time and memory of different sketches in Table IV. Indexing Time. SKIS and RIS use roughly the same amount of time for build the sketches while SKIM is much slower than SKIS and RIS and failed to process large networks in both edge models. On larger networks, SKIS is slightly faster than RIS. SKIM markedly spends up to 5 hours to build sketch for Twitter on WC model while SKIS, or RIS spends only 1 hour or less on this network. Index Memory. In terms of memory, the same observations are seen as with indexing time essentially because larger sketches require more time to construct. In all the experiments, SKIS consumes the same or less amount of memory with RIS. SKIM generally uses more memory than SKIS and RIS. In summary, SKIS consistently achieves better solution quality than both RIS and SKIM on all the networks, edge 47.4 60 27.7 40 16.6 20 14.2 4.4 2.8 1.8 1.5 0.2 1.9 1.5 4.6 2.3 0.3 0 SKIM 50 0 -50 100 Relative difference (%) 55.3 100 Relative difference (%) 80 Relative difference (%) Relative difference (%) 100 50 0 -50 SKIS h=5 SKIS h=10 -100 SKRIS SKRIS SKIS SKIS (h=5) (h=10) (h=5) (h=10) (a) TRI model 1 50 0 -50 SKRIS h=5 SKRIS h=10 -100 10 100 Ground-truth influence (b) SKIS-WC model 1 SKIM -100 10 100 Ground-truth influence 1 (c) RIS-WC model 10 100 Ground-truth influence (d) SKIM-WC model 0.1 0 SKIS (1K) SKIS (10K) SKIS (100K) 1 SKRIS (1K) SKRIS (10K) SKRIS (100K) 200 400 600 800 Number of seeds (k) 1000 (a) Epinions 1.5 0.05 0 1 200 5 5 Expected Influence (x10 ) 0.2 0.1 Expected Influence (x10 ) 0.3 Expected Influence (x105) Expected Influence (x105) Fig. 2: a) Relative difference on Epinions under TRI model and b), c), d) error distributions under WC model with |S| = 1. SKIS has the lowest relative errors which highly concentrates around 0 while RIS’s and SKIM’s errors widely spread out. 1 0.5 0 200 400 600 800 1000 Number of seeds (k) 1 (b) NetPHY 200 400 600 800 Number of seeds (k) 100 0 1000 1 (c) DBLP 200 400 600 800 Number of seeds (k) 1000 (d) Twitter Fig. 3: Efficiency of SKIS and RIS sketches in finding the maximum seed sets. SKIS sketch is up to 80% more efficient. IMM PMC DSSA+SKIS DSSA Running time (s) 2 10 101 100 102 101 100 -1 10 -1 10 1 5000 10000 15000 Number of seeds (k) 20000 1 (a) Epinions 5000 10000 15000 Number of seeds (k) 20000 (b) DBLP Fig. 4: Running time of algorithms under the IC model. DSSA+SKIS DSSA IMM DSSA+SKIS 101 Running time (s) This subsection illustrates the advantage of IIS sketch in finding the seed set with maximum influence. The results show that IIS samples drastically speed up the computation time. DSSA+SKIS is the first to handle billion-scale networks on the challenging TRI edge model. We limit the running time for algorithms to 6 hours and put “dnf” if they cannot finish. 1) Identifiability of the Maximum Seed Sets: We compare the ability of the new IIS with the traditional RIS sampling in terms of identifying the seed set with maximum influence. We fix the number of samples generated to be in the set {1000, 10000, 100000} and then apply the Greedy algorithm to find solutions. We recompute the influence of returned seed sets using Monte-Carlo method with precision parameters  = 0.005, δ = 1/n. The results is presented in Figure 3. From Figure 3, we observe a recurrent consistency that IIS samples return a better solution than RIS over all the networks, k values and number of samples. Particularly, the solutions provided by IIS achieve up to 80% better than those returned by RIS. When more samples are used, the gap gets smaller. 2) Efficiency of SKIS on IM problem: Table V presents the results of DSSA-SKIS, DSSA, IMM and PMC in terms of running time, memory consumption and samples generated. Running Time. From Table V, the combination DSSA+SKIS outperforms the rest by significant margins on all datasets and edge models. DSSA-SKIS is up to 10x faster than the original DSSA. DSSA+SKIS is the first and only algorithm that can run on the largest network on TRI model. Running time (s) C. Influence Maximization IMM PMC DSSA+SKIS DSSA Running time (s) models and seed set sizes while consuming the same or less time/memory. The errors of SKIS is highly concentrated around 0. In contrast, RIS is only good for estimating high influence while incurring significant errors for small ranges. 100 -1 10 -2 10 1 5000 10000 15000 Number of seeds (k) (a) Epinions 20000 DSSA IMM 102 101 100 10-1 1 5000 10000 15000 Number of seeds (k) 20000 (b) DBLP Fig. 5: Running time of algorithms under the LT model. Figure 4 compares the running time of all IM algorithms across a wide range of budget k = 1..20000 under IC and TRI edge weight model. DSSA+SKIS always maintains significant performance gaps to the other algorithms, e.g. 10x faster than DSSA or 1000x faster than IMM and PMC. Number of Samples and Memory Usage. On the same line with the running time, the memory usage and number of samples generated by DSSA+SKIS are much less than those required by the other algorithms. The number of samples generated by DSSA+SKIS is up to more 10x smaller than DSSA on TRI model, 100x less than IMM. Since the memory for storing the graph is counted into the total memory, the memory saved by DSSA+SKIS is only several times smaller than those of DSSA and IMM. PMC exceptionally requires TABLE V: Performance of IM algorithms with k = 100 (dnf: “did not finish” within 6h, mem: “out of memory”). Nets Running Time [s (or h)] Total Memory [M (or G)] Expected Influence (%) IMM PMC DSSA DSSA +SKIS IMM PMC DSSA DSSA +SKIS IMM PMC DSSA DSSA +SKIS #Samples [×103 ] IMM DSSA DSSA +SKIS PHY 0.1 3.1 Epin. 0.2 10.5 DBLP 1.1 137.4 WC Orkut 24.1 1.4h Twit. 67.3 mem Frien. dnf mem 0.0 0.0 0.1 2.6 5.5 78.3 0.0 0.0 0.1 0.9 6.3 43.6 31 86 39 130 162 60 4G 6G 30G mem dnf mem 26 34 136 2G 17G 35G 9 17 113 2G 16G 36G 6.64 6.7 19.4 19.8 10.8 11.2 6.7 8.7 25.80 mem dnf mem 5.33 17.9 9.3 5.7 24.1 0.35 5.34 16.6 8.5 5.1 21.0 0.35 103.3 39.8 93.0 174.4 54.0 mem 8.9 4.48 5.4 11.52 18.0 215.0 3.8 0.9 2.6 2.6 0.8 102.4 PHY 0.2 1.5 Epin. 13.9 6.9 DBLP 3.2 20.1 TRI Orkut dnf 0.3h Twit. dnf mem Frien. dnf mem 0.0 2.0 0.3 1.3h 5.2h mem 0.0 0.6 0.2 0.2h 0.6h 3.1h 50 61 483 40 389 54 dnf 16G dnf mem dnf mem 30 72 191 28G 100G mem 9 33 118 11G 28G 99G 1.77 1.73 5.7 5.9 0.32 0.31 dnf 67.3 dnf mem dnf mem 1.4 5.47 0.28 67.9 24.2 mem 1.5 5.46 0.24 67.8 24.4 40.1 370.1 123.0 3171.0 dnf dnf dnf 35.8 8.9 348.2 1.4 3.4 mem 3.8 0.5 20.5 0.3 0.4 0.2 huge memory and is unable to run on two large networks. Experiments on the Linear Threshold (LT) model. We carry another set of experiments on the LT model with multiple budget k. Since in LT, the total weights of incoming edge to every node are bounded by 1, for each node, we first normalized the weights of incoming edges and then multiply them with a random number uniformly generated in [0, 1]. The results are illustrated in Figure 5. Similar observations to the IC are seen in the LT model that DSSA+SKIS runs faster than the others by orders of magnitude. Overall, DSSA+SKIS reveals significant improvements over the state-of-the-art algorithms on influence maximization. As a result, DSSA+SKIS is the only algorithm that can handle the largest networks under different models. VIII. C ONCLUSION We propose SKIS - a novel sketching tools to approximate influence dynamics in the networks. We provide both comprehensive theoretical and empirical analysis to demonstrate the superiority in size-quality trade-off of SKIS in comparisons to the existing sketches. The application of SKIS to existing algorithms on Influence Maximization leads to significant performance boost and easily scale to billion-scale networks. In future, we plan to extend SKIS to other settings including evolving networks and time-based influence dynamics. R EFERENCES [1] B. Lucier, J. Oren, and Y. Singer, “Influence at scale: Distributed computation of complex contagion in networks,” in KDD. ACM, 2015, pp. 735–744. [2] E. Cohen, D. Delling, T. Pajor, and R. F. Werneck, “Sketch-based influence maximization and computation: Scaling up with guarantees,” in CIKM. ACM, 2014, pp. 629–638. [3] N. Ohsaka, T. Akiba, Y. Yoshida, and K.-i. Kawarabayashi, “Dynamic influence analysis in evolving networks,” VLDB, vol. 9, no. 12, pp. 1077– 1088, 2016. [4] D. Kempe, J. Kleinberg, and É. Tardos, “Maximizing the spread of influence through a social network,” in KDD, 2003, pp. 137–146. [5] C. Borgs, M. Brautbar, J. Chayes, and B. Lucier, “Maximizing social influence in nearly optimal time,” in SODA. SIAM, 2014, pp. 946–957. [6] Y. Tang, X. Xiao, and Y. Shi, “Influence maximization: Near-optimal time complexity meets practical efficiency,” in SIGMOD. ACM, 2014, pp. 75–86. [7] Y. Tang, Y. Shi, and X. Xiao, “Influence maximization in near-linear time: A martingale approach,” in SIGMOD, 2015, pp. 1539–1554. [8] H. T. Nguyen, M. T. Thai, and T. N. Dinh, “Stop-and-stare: Optimal sampling algorithms for viral marketing in billion-scale networks,” in SIGMOD. New York, NY, USA: ACM, 2016, pp. 695–710. [9] H. Tong, B. A. Prakash, T. Eliassi-Rad, M. Faloutsos, and C. Faloutsos, “Gelling, and melting, large graphs by edge manipulation,” in CIKM. ACM, 2012, pp. 245–254. [10] S. R. A. Arora, S. Galhotra, “Debunking the myths of influence maximization: Anin-depth benchmarking study,” in SIGMOD. ACM, 2017, pp. 75–86. [11] E. Cohen and H. Kaplan, “Summarizing data using bottom-k sketches,” in PODC. ACM, 2007, pp. 225–234. [12] G. Cormode and S. Muthukrishnan, “An improved data stream summary: the count-min sketch and its applications,” Journal of Algorithms, vol. 55, no. 1, pp. 58–75, 2005. [13] N. Du, L. Song, M. Gomez-Rodriguez, and H. Zha, “Scalable influence estimation in continuous-time diffusion networks,” in NIPS, 2013, pp. 3147–3155. [14] D. T. Nguyen, H. Zhang, S. Das, M. T. Thai, and T. N. Dinh, “Least cost influence in multiplex social networks: Model representation and analysis,” in ICDM. IEEE, 2013, pp. 567–576. [15] T. N. Shen, Y.and Dinh, H. Zhang, and M. T. Thai, “Interest-matching information propagation in multiple online social networks,” in CIKM. ACM, 2012, pp. 1824–1828. [16] H. T. Nguyen, P. Ghosh, M. L. Mayo, and T. N. Dinh, “Multiple infection sources identification with provable guarantees,” in CIKM. ACM, 2016, pp. 1663–1672. [17] H. T. Nguyen, T. P. Nguyen, T. N. Vu, and T. N. Dinh, “Outward influence and cascade size estimation in billion-scale networks,” in SIGMETRICS. ACM, 2017, pp. 63–63. [18] “Importance sketching of influence dynamics in billion-scale networks,” https://www.dropbox.com/s/ssoq6ecngqky1v2/icdm17 sketch.pdf?dl=0 [19] H. T. Nguyen, M. T. Thai, and T. N. Dinh, “Cost-aware targeted viral marketing in billion-scale networks,” in INFOCOM. IEEE, 2016, pp. 1–9. [20] ——, “A billion-scale approximation algorithm for maximizing benefit in viral marketing,” IEEE/ACM Transactions on Networking, vol. 25, no. 4, pp. 2419–2429, 2017. [21] G. Nemhauser and L. Wolsey, “Maximizing submodular set functions: formulations and analysis of algorithms,” North-Holland Mathematics Studies, vol. 59, pp. 279–301, 1981. [22] H. Kwak, C. Lee, H. Park, and S. Moon, “What is twitter, a social network or a news media?” in WWW. ACM, 2010, pp. 591–600. [23] SNAP, http://snap.stanford.edu, 2017, stanford network analysis project. [24] N. Ohsaka, T. Akiba, Y. Yoshida, and K.-i. Kawarabayashi, “Fast and accurate influence maximization on large networks with pruned montecarlo simulations,” in AAAI, 2014. [25] P. Dagum, R. Karp, M. Luby, and S. Ross, “An optimal algorithm for monte carlo estimation,” SICOMP, pp. 1484–1496, 2000. [26] W. Chen, C. Wang, and Y. Wang, “Scalable influence maximization for prevalent viral marketing in large-scale social networks,” in KDD. New York, NY, USA: ACM, 2010, pp. 1029–1038. [27] K. Jung, W. Heo, and W. Chen, “Irie: Scalable and robust influence maximization in social networks,” in ICDM, 2012, pp. 918–923. [28] V. Vazirani, Approximation Algorithms. Springer, 2001. where Rj (v) is a random IIS sketch with src(Rj (v)) = v. Plugging this back into the computation of I(S) gives, X X I(S) = Pr[Rj (v) ∩ S 6= ∅]γv + (1 − γv ) v∈V = v∈V A PPENDIX = v∈V g∈ΩG v∈V ηg (S, v) Pr[g] + g∈Ω∅ G (v) g∈Ω̄∅ G (v) Since our IIS sketching algorithm only generates samples corresponding to sample graphs from the set Ω̄∅G (v), we define Ω̄∅G (v) to be a graph sample space in which the sample graph G] Pr[ḡ ∈ Ω̄∅G (v)] = Pr[ḡ∈Ω ḡ ∈ Ω̄∅G (v) has a probability γv P of being realized (since Pr[ḡ ∈ ΩG ] = γv is the ḡ∈Ω̄∅ G (v) normalizing factor to fulfill a probability distribution of a sample space). Then, Eq. 32 is rewritten as follows, X X X Pr[g ∈ ΩG ] γv + (1 − γv ) I(S) = ηg (S, v) γv v∈S v∈V g∈Ω̄∅ (v) G X X X = ηḡ (S, v) Pr[ḡ ∈ Ω̄∅G (v)]γv + (1 − γv ) v∈S Now, from the node v in a sample graph ḡ ∈ Ω̄∅G (v), we have a IIS sketch Rj (ḡ, v) starting from v and containing all the nodes that can reach v in ḡ. Thus, ηḡ (S, v) = 1Rj (ḡ,v)∩S6=∅ where 1x is an indicator function returning 1 iff x 6= 0. Then, X ηḡ (S, v) Pr[ḡ ∈ Ω̄∅G (v)] ḡ∈Ω̄∅ G (v) = X ḡ∈Ω̄∅ G (v) X (1 − γv ) v∈S X (1 − γv ) (33) v∈S That completes the proof. B. Proof of Lemma 4 Var[Xj (S)] P P I(S) − v∈S (1 − γv ) I(S) − v∈S (1 − γv ) = (1 − ) Γ Γ P 2 X (1 − γv ) I(S) I (S) = − − v∈S 2 (Γ + (1 − γv ) − 2I(S)) 2 Γ Γ Γ v∈S Put this back into the variance of Zj (S) proves the lemma. C. Proof of Lemma 5 P v∈V g∈Ω̄∅ (v) G (32) v∈V ḡ∈Ω̄∅ (v) G Pr[Rj (v) ∩ S 6= ∅] Pr[src(Rj ) = v]Γ + From the basic properties of variance, we have, P Xj (S) · Γ + v∈S (1 − γv ) Var[Zj (S)] = Var[ ] n 2 Γ = 2 Var[Xj (S)] n Since Xj (S) is a Bernoulli random variable with its mean P  value E[Xj (S)] = I(S)− v∈S (1−γv ) , the variance Var[Xj (S)] X ηg (S, v) Pr[g] . is computed as follows, Γ In each g ∈ Ω∅G (v), the node v does not have any incoming nodes, thus, ηg (S, v) = 1 only if v ∈ P S. Thus, P P P we have that ηg (S, v) Pr[g] = Pr[g]. v∈V g∈Ω∅ (v) v∈S g∈Ω∅ G G (v) Furthermore, the probability of a sample graph which has no P incoming live-edge to v is g∈Ω∅ (v) Pr[g] = 1−γv . Combine G with the above equiation of I(S), we obtain, X X X I(S) = (1 − γv ) + ηg (S, v) Pr[g ∈ ΩG ]. v∈S v∈S = Pr[Rj ∩ S 6= ∅] · Γ + Given a stochastic graph G, recall that ΩG is the space of all possible sample graphs g ∼ G and Pr[g] is the probability that g is realized from G. In a sample graph g ∈ ΩG , ηg (S, v) = 1 if v is reachable from S in g. Consider the graph sample space ΩG , based on a node v ∈ V \S, we can divide ΩG into two partitions: 1) Ω∅G (v) contains those samples g in which v has no incoming live-edges; and 2) Ω̄∅G (v) = ΩG \Ω∅G . We start from the definition of influence spread as follows, X X I(S) = ηg (S, v) Pr[g] X X X v∈S X γv Pr[Rj (v) ∩ S 6= ∅] Γ + (1 − γv ) Γ v∈V A. Proof of Lemma 3 = X 1Rj (ḡ,v)∩S6=∅ Pr[ḡ ∈ Ω̄∅G (v)] = Pr[Rj (v) ∩ S 6= ∅] (1−γ ) v v∈S Since Zj (S) takes values of either or P n Γ+ v∈S (1−γv ) I(S) and the mean value E[Z (S)] = , i.e. j P n P n Γ+ v∈S (1−γv ) I(S) v∈S (1−γv ) ≤ ≤ . The variance of Zj (S) n n n is computed as follows, Var[Zj (S)]  I(S) P  Γ + P I(S)  v∈S (1 − γv ) v∈S (1 − γv ) − − = n n n P n P  I(S)  Γ + v∈S (1 − γv ) v∈S (1 − γv ) ≤ − n n n I(S) Γ = (34) n n D. Proof of Lemma 6 Lemma 2 in [7] states that: Lemma 10. Let M1 , M2 , . . . be a martingale, such that |M1 | ≤ a, |Mj − Mj−1 | ≤ a for any j ∈ [2, T ], and T X Var[M1 ] + Var[Mj |M1 , M2 , . . . , Mj−1 ] ≤ b, (35) j=2 where Var[.] denotes the variances of a random variable. Then, for any λ > 0,   λ2 Pr[MT − E[MT ] ≥ λ] ≤ exp − 2 (36) 3 aλ + 2b Note that uniform random variables are also a special type of martingale and the above lemma holds for random variable as well. Let p = I(S) n . For RIS samples, since • |M1 | ≤ 1, • |Mj − Mj−1 | ≤ 1, ∀j ∈ [2, T ], PT • Var[M1 ] + = j=2 Var[Mj |M1 , . . . , Mj−1 ] Pi Var[Y (S)] = T p(1 − p) ≤ T p, j j=1 applying Eq. 36 for λ = T p gives the following Chernoff’s bounds, T  hX i  2 Pr Xj (S) − T p ≥ T p ≤ exp − 2 T p , (37) 2 + 3 j=1 and, T hX i  2  Pr Xj (S) − T p ≤ −T p ≤ exp − T p . 2 j=1 (38) However, for IIS samples in SKIS sketch, the corresponding random variables Zj (S) replace Yj (S) and have the following properties: P • • • Γ+ (1−γ ) v v∈S ≤ 1, |M1 | ≤ n |Mj − Mj−1 | ≤ 1, ∀j ∈ [2, T ], The sum of variances: T X Var[M1 ] + Var[Mj |M1 , . . . , Mj−1 ] j=2 = i X Var[Zj (S)] = T p j=1 Γ n (39) Thus, applying the general bound in Eq. 36 gives, T i  hX  2 Xj (S) − T p ≥ T p ≤ exp − Γ 2 T p , Pr 2n + 3 j=1 (40) and, T  hX i  2 Pr Xj (S) − T p ≤ −T p ≤ exp − Γ T p . 2n j=1 (41) Note the factor Γn is added in the denominator of the terms in the exp(.) function. Since 2 Γn dominates 32 , the concentration bounds for Zj (S) for SKIS are tighter than those of Yj (S) for RIS given in Eqs. 37 and 38. E. Proof of Lemma 8 Since the function ÎR (S) contains two additive terms, it is sufficient to show that each P of them is monotone and submodular. The second term v∈S (1 − γv ) is a linear function and thus, it is monotone and submodular. For the Γ is a constant and only first additive term, we see that |R|·n need to show that CR (S) is monotone and submodular. Given the collection of IIS samples R in which Rj ∈ R is a list of nodes, the function CR (S) is just the count of IIS samples that intersect with the set S. In other words, it is equivalent to a covering function in a set system where IIS samples are elements and nodes are sets. A set covers an element if the corresponding node is contained in the corresponding IIS sample. It is well known that any covering function is monotone and submodular [28] and thus, the CR (S) has the same properties. F. Improvements of SSA/DSSA using SKIS sketch Recall that the original Stop-and-Stare strategy in [8] uses two independent sets of RIS samples, called R and Rc . The greedy algorithm is applied on the first set R to find a candidate set Ŝk along with an estimate ÎR (Ŝk ) and the second set Rc is used to reestimate the influence of Ŝk by ÎRc (Ŝk ). Now, SSA and DSSA have different ways to check the solution quality. SSA. It assumes a set of fixed precision parameters 1 , 2 , 3 +2 +1 2 +3 (1 − 1/e) ≤ . The algorithm stops such that 1(1+ 1 )(1+2 ) when two conditions are met: δ −2 1) CR (Ŝk ) ≥ Λ1 where Λ1 = O(log tmax 3 ) and tmax is a precomputed number depending on the size of the input graph G. 2) ÎR (Ŝk ) ≤ (1 + 1 )ÎRc (Ŝk ). ⇒ Improvements using SKIS: Replacing RIS samples by IIS samples to build R and Rc helps in both stopping conditions: δ Γ −2 ) using the tighter • Reduce Λ1 to Λ1 = O( n log t max 3 form of the Chernoff’s bounds in Lemma 6. • Since IIS samples have better influence estimation accuracy, ÎR (Ŝk ) and ÎRc (Ŝk ) are closer to the true influence I(Ŝk ). Thus, the second condition is met earlier than using RIS samples. DSSA. Instead of assuming precision parameters, DSSA dynamically compute the error bounds 1 , 2 and 3 as follows: • 1 = • 2 = • 3 = ÎR (Ŝk ) − 1. ÎR qc (Ŝk ) n(1+) .  2t−1 ÎRc (Ŝk ) q n(1+)(1−1/e−)  (1+/3)2t−1 Î c (Ŝ ) . k R Here, 1 measures the discrepancy of estimations using two different sketches R and Rc while 2 and 3 are the error bounds of estimating the influences of Ŝk and the optimal solution Sk∗ using the number of samples contained in R and Rc . The algorithm stops when two conditions are met: δ • CR (Ŝk ) ≥ Λ2 where Λ2 = O(log t −2 ). max • (1 + 2 + 1 2 )(1 − 1/e − ) + (1 − 1/e)3 ≤ . ⇒ Improvement using SKIS: Similarly to SSA, applying SKIS helps in both stopping conditions: Γ δ • Reduce Λ2 to Λ2 = O( n log t −2 ). max • Reduce the value of 1 , 2 and 3 due to better influence estimations of ÎR (Ŝk ) and ÎRc (Ŝk ) by SKIS that leads to earlier satisfaction of the second condition.
8cs.DS
REAL CLASS SIZES arXiv:1803.01717v1 [math.GR] 1 Mar 2018 HUNG P. TONG-VIET Abstract. In this paper, we study the structures of finite groups using some arithmetic conditions on the sizes of real conjugacy classes. We prove that a finite group is solvable if the prime graph on the real class sizes of the group is disconnected. Moreover, we show that if the sizes of all non-central real conjugacy classes of a finite group G have the same 2-part and the Sylow 2-subgroup of G satisfies certain condition, then G is solvable. 1. Introduction Let G be a finite group. An element x ∈ G is said to be real if there exists an element g ∈ G such that xg = x−1 . We denote by Re(G) the set of all real elements of G. A conjugacy class xG containing x ∈ G is said to be real if x is a real element of G or equivalently xG = (x−1 )G . The size of a real conjugacy class is called a real class size. Several arithmetic properties of the real class sizes can be conveniently stated using graph theoretic language. The prime graph on the real class sizes of a finite group G, denoted by ∆∗ (G), is a simple graph with vertex set ρ∗ (G) the set of primes dividing the size of some real conjugacy class of G and there is an edge between two vertices p and q if and only if the product pq divides some real class size. Now a prime p is not a vertex of ∆∗ (G), that is, p 6∈ ρ∗ (G) if and only if p divides no real class size of G. In [6], the authors show that 2 is not a vertex of ∆∗ (G) if and only if G has a normal Sylow 2-subgroup S (i.e., G is 2-closed) and Re(S) ⊆ Z(S). For odd primes, a similar result is not that satisfactory. Combining results in [11], [14] and [15], we can show that if an odd prime p is not a vertex of ∆∗ (G) and assume ′ further that when p = 3, SL3 (2) is not a composition factor of G, then O2 (G) has a ′ normal Sylow p-subgroup and Op (G) is solvable, in particular, G is p-solvable (see Lemma 2.7). The proofs of the aforementioned results, especially, for odd primes, are quite involved and depend heavily on the classification of finite simple groups. This is in contrast to the similar result for all conjugacy classes, that is, if a prime p does not divide the size of any conjugacy classes of G then G has a normal central Sylow p-subgroup. The proof of this classical result is just an application of Jordan’s theorem on the existence of derangements in finite permutation groups. It is proved in [6] that ∆∗ (G) has at most two connected components. In our first result, we will show that if ∆∗ (G) is disconnected, then G is solvable. Date: March 6, 2018. 2010 Mathematics Subject Classification. Primary 20E45; Secondary 20D10. Key words and phrases. Real conjugacy classes, real class sizes, prime graphs. 1 2 H. P. TONG-VIET Theorem A. Let G be a finite group. If the prime graph on the real class sizes of G is disconnected, then G is solvable. We next study in more detail the real class sizes of finite groups with disconnected prime graph on real class sizes. Theorem B. Let G be a finite group. Suppose that ∆∗ (G) is disconnected. Then 2 divides some real class size and one of the following holds. (1) G has a normal Sylow 2-subgroup. ′ ′ (2) ∆∗ (O2 (G)) is disconnected and the real class sizes of O2 (G) are either odd or powers of 2. It follows from Theorem B that if the prime graph ∆∗ (G) of a finite group G is disconnected, then 2 must be a vertex of ∆∗ (G). This confirms once again the importance of the prime 2 in the study of real conjugacy classes of finite groups. In ′ the second conclusion of Theorem B, both connected components of ∆∗ (O2 (G)) are complete and one of the components of this graph contains the prime 2 only. (See Theorem 3.5). We should mention that it was proved in [7] that a finite group whose all real class sizes are either odd or powers of 2 is solvable. However, in the proof of (2), we will need the solvability from Theorem A. So, if one can prove part (2) of Theorem B without using the solvability of the group, then we would have another proof of Theorem A. In [7], it is shown that if all non-central real conjugacy classes of a group have prime sizes, then the group has a normal Sylow 2-subgroup or a normal 2-complement. The next example shows that this is not the case if we only assume that all real class sizes are prime powers. ′ Example. Let G = Alt4 : C4 be a solvable group of order 48. We have G = O2 (G), G/Z(G) ∼ = Sym3 and the real class sizes of G are 1, 3 or 8. Clearly, = Sym4 , G/O2 (G) ∼ G has no normal Sylow 2-subgroup nor normal 2-complement. It follows from [1] that if the prime graph defined on all class sizes of a finite group G is disconnected, then G/Z(G) is a Frobenius group with abelian kernel and complement. By our example above, this does not hold for the prime graph on real class sizes. In our last result, we provide further evidence for a conjecture proposed in [16]. We will prove Conjecture C in [16] under some condition on the Sylow 2-subgroups. Theorem C. Let G be a finite group. Suppose that the sizes of all non-central real conjugacy classes of G have the same 2-part. Assume further that G has a Sylow ′ 2-subgroup S with Re(S) ⊆ Z(S). Then G is solvable and O2 (G) has a normal 2-complement. A conjecture due to G. Navarro states that a finite group G is solvable if G has at most two real class sizes. Clearly, our Theorem C implies this conjecture with an additional assumption that Re(S) ⊆ Z(S) for some Sylow 2-subgroup S of G. Finite 3 2-groups S with Re(S) ⊆ Z(S) have been studied by Chillag and Mann [2]. These are exactly the finite 2-groups S for which if x, y ∈ S and x2 = y 2, then xZ(S) = yZ(S). 2. Real conjugacy classes Our notation are more or less standard. If n is a positive integer, then π(n) is the set of prime divisors of n. If π(n) ⊆ σ for some set of primes σ, then n is said to be a σ-number. If n > 1 is an integer and p is a prime, then the p-part of n, denoted by np , is the largest power of p dividing n. Recall that Re(G) is the set of all real elements of G. We collect some properties of real elements and real class sizes in the following lemma. Lemma 2.1. Let G be a finite group and let N ✂ G. If x ∈ Re(G), then every power of x is also real. If x ∈ Re(G), then xt = x−1 for some 2-element t ∈ G. If x ∈ Re(G) and |xG | is odd, then x2 = 1. If x, y ∈ Re(G), xy = yx and (|xG |, |y G |) = 1, then xy ∈ Re(G). Furthermore, if (o(x), o(y)) = 1, then π(|xG |) ∪ π(|y G |) ⊆ π(|(xy)G |). (5) If |G : N| is odd, then Re(G) = Re(N). (6) Suppose that Nx is a real element in G/N. If |N| or the order of Nx in G/N is odd, then Nx = Ny for some real element y ∈ G (of odd order if the order of Nx is odd). (1) (2) (3) (4) Proof. Let x ∈ G be a real element. Then xg = x−1 for some g ∈ G. If k is any integer, then (xk )g = (xg )k = (x−1 )k = (xk )−1 so xk is real which proves (1). Write o(g) = 2a m with (2, m) = 1 and let t = g m. Then t is a 2-element and m xt = xg = xg = x−1 as g 2 ∈ CG (x) and m is odd. This proves (2). Parts (3)–(5) are in Lemma 6.3 of [6]. Finally, (6) is Lemma 2.2 in [11].  Fix 1 6= x ∈ Re(G), set C∗G (x) = {g ∈ G | xg ∈ {x, x−1 }}. Then C∗G (x) is a 2 subgroup of G containing CG (x). If g ∈ G such that xg = x−1 , then xg = x so g 2 ∈ CG (x). Assume that x is not an involution. We see that g ∈ C∗G (x) \ CG (x) and if h ∈ C∗G (x) \ CG (x), then xh = x−1 = xg so that hg −1 ∈ CG (x) or equivalently h ∈ CG (x)g. Thus CG (x) has index 2 in C∗G (x) and hence |xG | is even. In particular, this is the case if x is a nontrivial real element of odd order. The next lemma is well-known. We will use this lemma freely without further reference. Lemma 2.2. Let G be a finite group and let N ✂ G. Then (1) If x ∈ N, then |xN | divides |xG |. (2) If Nx ∈ G/N, then |(Nx)G/N | divides |xG |. The following lemma shows that a finite group G has no nontrivial real element of odd order if and only if G has a normal Sylow 2-subgroup. 4 H. P. TONG-VIET Lemma 2.3. ([6, Proposition 6.4]). The following are equivalent: (1) Every nontrivial element in Re(G) has even order. (2) Every element in Re(G) is a 2-element. (3) G has a normal Sylow 2-subgroup. The next lemma determines the number of connected components of the prime graphs on real class sizes. Lemma 2.4. ([6, Theorem 6.2]). For any finite group G, ∆∗ (G) has at most two connected components. If a finite group G is of even order, then it has a real element of order 2. If an odd prime p dividing |G|, G may not have a real element of order p. However, if G has no proper normal subgroup of odd index and G is p-solvable, Dolfi, Malle and Navarro [5] show that G must contain a real element of order p. ′ Lemma 2.5. ([5, Corollary B]). Let G be a finite group with O2 (G) = G. Suppose that p is an odd prime dividing |G|. If G is p-solvable, then G has a real element of order p. In the next two lemmas, we state the Itô-Michler theorem for real conjugacy classes. Lemma 2.6. ([6, Theorem 6.1]). Let G be a finite group and let P be a Sylow 2subgroup of G. Then all real classes of G have odd size if and only if P ✂ G and Re(P ) ⊆ Z(P ). Lemma 2.7. Let G be a finite group and p be an odd prime. If p = 3, assume in addition that G has no composition factor isomorphic to SL3 (2). If p does not ′ divide |xG | for all real elements of G, then G is p-solvable and Op (G) is solvable. ′ ′ Furthermore, O2 (G) has a normal Sylow p-subgroup P and P ′ ≤ Z(O2 (G)). Proof. The first claim is Theorem A in [11]. Now, Theorem B in that reference implies that p does not divide χ(1) for all real-valued irreducible characters χ ∈ Irr(G). By ′ Theorem A in [15], we know that Op (G) is solvable. Finally, the last statement follows from Theorem A in [14].  3. Proofs of Theorems A and B Let G be a finite group. Suppose that ∆∗ (G) is disconnected. Then ∆∗ (G) has exactly two connected components by Lemma 2.4. The following will be used frequently in our proofs. Lemma 3.1. Let G be a finite group and suppose that ∆∗ (G) has two connected components with vertex sets π1 and π2 , where 2 6∈ π2 . Then there exists an involution i ∈ G such that |iG | > 1 is a π2 -number and CG (i) has a normal Sylow 2-subgroup. Proof. Let p be a prime in π2 . Then p must divide |iG | for some nontrivial real element i ∈ G. Clearly, every prime divisor of |iG | is adjacent to p ∈ π2 , this implies 5 that |iG | is a nontrivial π2 -number. Hence |iG | > 1 is odd and so i2 = 1 by Lemma 2.1(3) and thus i is an involution of G. Assume that CG (i) has a nontrivial real element x of odd order. Then xi = ix and |xG | is even so |xG | is a π1 -number and thus (|xG |, |iG |) = 1. Lemma 2.1(4) implies that xi is a real element. Furthermore, since (o(x), o(i)) = 1, 2p divides |(ix)G | by Lemma 2.1(4) again. This means that 2 ∈ π1 and p ∈ π2 are adjacent in ∆∗ (G), which is impossible. Therefore, CG (i) has no nontrivial real element of odd order and thus it has a normal Sylow 2-subgroup by Lemma 2.3.  Notice that if N ✂ G, then ∆∗ (N) is a subgraph of ∆∗ (G) by Lemma 2.2(1) and the fact that Re(N) ⊆ Re(G). However, in general, it is not true that ∆∗ (G/N) is a subgraph of ∆∗ (G). The involutions in G/N might produce extra vertices as well as edges in ∆∗ (G/N). However, this is the case if |N| is odd. Lemma 3.2. Let G be a finite group and let N ✂ G with |N| odd. Then ∆∗ (G/N) is a subgraph of ∆∗ (G). Proof. We first show that ρ∗ (G/N) ⊆ ρ∗ (G). Indeed, let p ∈ ρ∗ (G/N) and let Nx ∈ G/N be a real element such that p divides |(Nx)G/N |. By Lemma 2.1(6), there exists a real element y ∈ G such that Nx = Ny. Since |(Nx)G/N | = |(Ny)G/N | divides |y G |, p divides |y G |, so p ∈ ρ∗ (G). With a similar argument, we can show that if p 6= q ∈ ρ∗ (G/N) which are adjacent in ∆∗ (G/N), then p, q are adjacent in ∆∗ (G) by using Lemma 2.1(6) again. Thus ∆∗ (G/N) is a subgraph of ∆∗ (G).  Let X be a subgroup or a quotient of a finite group G and suppose that ∆∗ (X) is a subgraph of ∆∗ (G). Assume that ∆∗ (G) is disconnected having two connected components with vertex sets π1 and π2 , respectively. To show that ∆∗ (X) is disconnected, it suffices to show that ρ∗ (X) ∩ πi 6= ∅ for i = 1, 2 or equivalently X has two real elements ui , i = 1, 2 which both lift to real elements of G and π(|uX i |) ∩ πi 6= ∅ for i = 1, 2. For a finite group G and a prime p, G is said to be p-closed if it has a normal Sylow p-subgroup and it is p-nilpotent if it has a normal p-complement. Proposition 3.3. Let G be a finite group. Suppose that ∆∗ (G) has two connected components with vertex sets π1 and π2 where 2 6∈ π2 . Then (1) If G is not 2-closed and M ✂G with |G : M| odd, then ∆∗ (M) is disconnected. ′ (2) If N ✂G with |N| odd and assume further that G = O2 (G) is not 2-nilpotent, then ∆∗ (G/N) is disconnected. Proof. By Lemma 3.1, G has an involution i such that |iG | > 1 is a π2 -number and CG (i) has a normal Sylow 2-subgroup S. For (1), let M ✂ G with |G : M| being odd. Notice that ρ∗ (M) ⊆ ρ∗ (G) = π1 ∪ π2 and that if M is 2-closed, then G is also 2-closed. Thus we assume that M is not 2closed. By Lemma 2.6, 2 divides some real class size of M and hence 2 ∈ ρ∗ (M) ∩ π1 . 6 H. P. TONG-VIET Now M contains every real element of G by Lemma 2.1(5), in particular, i ∈ M. Moreover, ∆∗ (M) is a subgraph of ∆∗ (G). If M ≤ CG (i), then S ✂ M as |G : M| is odd, so M is 2-closed, a contradiction. Thus, |iM | > 1 and hence ρ∗ (M) ∩ π2 6= ∅. Therefore, ∆∗ (M) is disconnected as ρ∗ (M) ∩ πi is non-empty for each i = 1, 2. For (2), suppose that N ✂ G with |N| odd. By Lemma 3.2, ∆∗ (G/N) is a subgraph of ∆∗ (G). In particular, ρ∗ (G/N) ⊆ ρ∗ (G) = π1 ∪π2 . If G/N is 2-closed, then SN ✂G ′ is of odd index and thus G = SN since G = O2 (G). However, this would imply that G is 2-nilpotent with a normal 2-complement N. Therefore, we assume that G/N is not 2-closed. Clearly, Ni ∈ G/N is an involution. If Ni is central in G/N, then G/N = CG/N (Ni) = CG (i)N/N, where the latter equality follows from [12, Lemma 7.7]. Hence G/N has a normal Sylow 2-subgroup SN/N, a contradiction. Thus Ni is not central in G/N and |(Ni)G/N | > 1, so ρ∗ (G/N) ∩ π2 6= ∅. Finally, as G/N is not 2-closed, 2 ∈ ρ∗ (G/N) ∩ π1 by applying Lemma 2.6 again. Therefore, ∆∗ (G/N) is disconnected.  We are now ready to prove Theorem A which we restate here. Theorem 3.4. Let G be a finite group. If ∆∗ (G) is disconnected, then G is solvable. Proof. Let G be a counterexample with minimal order. Then G is non-solvable and ∆∗ (G) is disconnected. By Lemma 2.4, ∆∗ (G) has exactly two connected components with vertex sets π1 and π2 , respectively. If G has a normal Sylow 2-subgroup, then it is clearly solvable by Feit-Thompson theorem. Therefore, we can assume that G has no normal Sylow 2-subgroup. Now it follows from Lemma 2.3 that G has a nontrivial real element x of odd order. Then |xG | is divisible by 2 and hence 2 is always a vertex of ∆∗ (G). We assume that 2 ∈ π1 . Hence all vertices in π2 are odd primes. (1) By Lemma 3.1, G has an involution i such that |iG | > 1 is a π2 -number and CG (i) has a normal Sylow 2-subgroup, say S. Clearly, S is also a Sylow 2-subgroup of G as |iG | is odd. Notice that CG (i) is solvable. Now G has a nontrivial real element x of odd order by Lemma 2.3. Clearly |xG | is even so |xG | must be a π1 -number. Thus (|xG |, |iG |) = 1; therefore, G is not a nonabelian simple group by [8, Theorem 2]. ′ ′ (2) G = O2 (G). Since G is not 2-closed, ∆∗ (O2 (G)) is disconnected by Proposition ′ ′ 3.3(1). If O2 (G) < G, then O2 (G) is solvable by the minimality of |G|, hence G is ′ ′ solvable since G/O2 (G) is solvable. This contradiction shows that G = O2 (G). ′ (3) O2′ (G) = 1. By (2) above, we have G = O2 (G) and since G is not solvable, G is not 2-nilpotent so that by Proposition 3.3(2) ∆∗ (G) is disconnected, where G = G/O2′ (G). If O2′ (G) is nontrivial, then |G| < |G| and thus by the minimality of |G|, G is solvable and so is G. Hence O2′ (G) = 1 as required. (4) If M is a maximal normal subgroup of G, then |G : M| = 2 and G = Mhii. Let M be a maximal normal subgroup of G. Then G/M is a simple group. 7 (a) Assume first that G/M is abelian, then G/M ∼ = Cr for some prime r. Since 2′ O (G) = G by (2), we deduce that r = 2. Clearly, M is not solvable. We next claim that i 6∈ M and hence we have that G = Mhii. Suppose that by contradiction that i ∈ M. Then either |iM | > 1 or M = CG (i). If the latter case holds, then M is solvable by (1) and thus G is solvable, a contradiction. Assume that |iM | > 1. Notice that ∆∗ (M) is a subgraph of ∆∗ (G). We see that ρ∗ (M) ∩ π2 6= ∅ as every prime divisor of |iM | is in π2 and i ∈ Re(M). Observe next that M is not 2-closed so it has a nontrivial real element z of odd order by Lemma 2.3 and thus |z M | is even. In other words, 2 ∈ ρ∗ (M). Therefore ρ∗ (M) ∩ π1 6= ∅. Hence we have shown that ∆∗ (M) is disconnected. Thus by induction, M is solvable, which is a contradiction. (b) Now, assume that G/M is a non-abelian simple group. Set G = G/M. G Assume first that i 6∈ M. Then i is an involution in G and |i | divides |iG |. Let y be a nontrivial real element of G of odd order (such an element exists by Lemma 2.3). By Lemma 2.1(6), y lifts to a real element z ∈ G of odd order. Therefore |y G | G divides |z G |. Since (|z G |, |iG |) = 1, we deduce that (|yG |, |i |) = 1, contradicting [8, Theorem 2]. Assume that i ∈ M. If G = MCG (i), then G/M ∼ = CG (i)/(M ∩ CG (i)) is a non-abelian simple group, which is impossible as CG (i) is solvable by (1). Thus H := MCG (i) < G and |G : H| = |G : H| divides |G : CG (i)| = |iG |. Let y ∈ G be a real element of odd order and z ∈ G be a real element of odd order such that y = z. Then |yG | = |z G | divides |z G | so (|G : CG (z)|, |G : H|) = 1 as (|z G |, |iG |) = 1. Therefore, G = HCG (z), where H has odd index in G and H has a normal Sylow 2-subgroup S. As every nontrivial real element of odd order of G lifts to a nontrivial real element of odd order of G by Lemma 2.1(6), every prime divisor s of |G : H| (which lies in π2 ) divides the size of no nontrivial real element of odd order of G, so G ∼ = PSL2 (q) r ∼ with q = 2 − 1 a Mersenne prime and s | (q − 1)/2 or G = M23 with s = 5 by [11, Theorem 4.1]. If the latter case holds, then |G : H| must be a power of 5. Inspecting [3] shows that this is not the case. Thus G ∼ = PSL2 (q) with q = 2r − 1 a Mersenne prime. It follows that r ≥ 3 and q ≥ 7 as G is non-solvable. Observe that S is a Sylow 2-subgroup of G of order q + 1 = 2r ≥ 8 and so S ∼ = Dq+1 , which is a maximal subgroup of G unless q = 7. Suppose first that q > 7. It implies that H = S so that |G : H| = q(q − 1)/2. In particular, q divides |G : H| and thus q | (q − 1)/2 by the claim above, which is impossible. Now assume that q = 7. Notice that the Sylow 2-subgroup of G ∼ = PSL2 (7) is self-normalizing but not maximal. Since S ✂ H, we must have that H = S and we will get a contradiction as above. (5) G = G′ hii and |G : G′ | = 2. 8 H. P. TONG-VIET Since G is not non-abelian simple, G possesses a maximal normal subgroup W . It follows from (4) that G = W hii and |G : W | = 2. It also follows from (4) that i does not lie in any maximal normal subgroup of G so that G = hiG i. Clearly G′ ≤ W as G/W ∼ = C2 is abelian. Moreover, G = hiG i ≤ G′ hii ≤ W hii = G. It follows that W = G′ and the claim follows. ′ (6) O2 (G′ ) is a π1 -group. Since |G : G′ | = 2 and G is non-solvable, G′ is non-solvable and thus ∆∗ (G′ ) is a connected subgraph of ∆∗ (G) with 2 ∈ ρ∗ (G′ ) ⊆ π1 . Observe that π(G) = π(G′ ). Let σ = π(G′ ) \ π1 . Now, if q ∈ σ, then q is odd and divides the size of no nontrivial ′ real conjugacy classes of G′ . Let K = O2 (G′ ). If q ∈ σ and q > 3 or q = 3 and SL3 (2) is not a composition factor of G′ , then K has a normal Sylow q-subgroup Q by Lemma 2.7. Clearly Q ✂ G and thus Q = 1 by (3). Hence q does not divide |K|. We now suppose that q = 3 and SL3 (2) is isomorphic to a composition factor of G′ . As G′ /K is solvable, SL3 (2) is isomorphic to a composition factor of K. Let L be a subnormal subgroup of K and U ✂ L such that L/U ∼ = SL3 (2). Using [3], we see that L/U has a self-normalizing Sylow 2-subgroup T /U and a real element Uz ∈ L/U of order 3 with |(Uz)L/U | = 7 · 8. There exists a real element y ∈ L of 3-power order with Uz = Uy (see [16, Lemma 2.6]). Since |(Uz)L/U | divides |y L | and |y L | divides |y G |, we see that 7 ∈ π1 . By (1), CG (i) has a normal Sylow 2-subgroup S with S ∈ Syl2 (G). As L is subnormal in G, S ∩ L is a Sylow 2-subgroup of L and thus (S ∩ L)U/U is a Sylow 2-subgroup of L/U. Observe that CG (i) contains a Sylow 7-subgroup, say Q, of G. Hence (Q ∩ L)U/U is a Sylow 7-subgroup of L/U. Since Q normalizes S, we can see that (Q∩L)U/U normalizes (S ∩L)U/U, which is impossible as the Sylow 2-subgroup ′ of L/U is self-normalizing. Thus we have shown that K = O2 (G′ ) is a π1 -group. The final contradiction. By (5), we have G = G′ hii so CG (i) = CG′ (i)hii which implies that |iG | = |G : CG (i)| = |G′ : CG′ (i)|. Since |iG | is a π2 -number and CG (i) is solvable, CG′ (i) is also solvable and possesses a Hall π1 -subgroup T which is also ′ a Hall π1 -subgroup of G′ (as |G′ : CG′ (i)| is a π2 -number). As O2 (G′ ) ✂ G′ is a ′ ′ π1 -subgroup by (6), we deduce that O2 (G′ ) ≤ T and thus O2 (G′ ) is solvable since ′ T ≤ CG′ (i) is solvable. Clearly, G′ /O2 (G′ ) is solvable by Feit-Thompson theorem, which implies that G′ is solvable and hence G is solvable. This contradiction finally proves the theorem.  ′ In the next result, we show that if G = O2 (G) and ∆∗ (G) is disconnected, then each connected component of ∆∗ (G) is complete and one of the components is just {2}. In particular, every real class size of G is either odd or a 2-power. ′ Theorem 3.5. Let G be a finite group. Suppose that G = O2 (G) and ∆∗ (G) is disconnected with vertex sets π1 and π2 where 2 6∈ π2 . Then π1 = {2} and π2 = π(|iG |) for some non-central involution i ∈ G. 9 Proof. By Theorem 3.4, we know that G is solvable. Let i ∈ G be an involution as in Lemma 3.1 and let S be a normal Sylow 2-subgroup of CG (i). Let σ be the set of odd prime divisors p of |CG (i)| such that p does not divide |iG |. Since |iG | is a π2 -number and |G| = |iG | · |CG (i)|, we see that π1 \ {2} ⊆ π(G) \ (π2 ∪ {2}) ⊆ σ = π(G) \ ({2} ∪ π(|iG |)). ′ Assume that σ = ∅. Then π1 ⊆ {2} and π2 ⊆ π(|iG |). As G = O2 (G) and ∗ ∆ (G) is disconnected, 2 divides some real class size of G, hence 2 ∈ π1 . Moreover π(|iG |) ⊆ π2 ; therefore π1 = {2} and π(|iG |) = π2 as wanted. Assume next that σ is not empty and let p ∈ σ. Then p is odd and p divides |CG (i)| but does not divide |iG |. By Lemma 2.5, G has a real element x of order p. Let P be a Sylow p-subgroup of CG (i). Since |G : CG (i)| = |iG | is not divisible by p, P is also a Sylow p-subgroup of G. Replacing x by its G-conjugates, we can assume x ∈ P ≤ CG (i) by Sylow theorem. We have that xi = ix, (o(x), o(i)) = 1 and (|xG |, |iG |) = 1 so that by applying Lemma 2.1(4), xi is real in G and π(|xG |) ∪ π(|iG |) ⊆ π(|(xi)G |). As |iG | > 1, we can find a prime r dividing |iG | and so r ∈ π2 . Now the previous inclusion would imply that 2 ∈ π(|xG |) ⊆ π1 and r ∈ π2 are adjacent in ∆∗ (G), which is impossible.  We now consider the situation when 2 is not a vertex of ∆∗ (G), where G is a finite group. By Lemma 2.6, G has a normal Sylow 2-subgroup S with Re(S) ⊆ Z(S). Lemma 3.6. Let G be a finite group. Suppose that G has a normal Sylow 2-subgroup S with Re(S) ⊆ Z(S). Then ∆∗ (G) is connected. Proof. If ∆∗ (G) has at most one vertex, then we are done. So, assume that ∆∗ (G) has at least two vertices, i.e., |ρ∗ (G)| ≥ 2. We argue by contradiction. Suppose that ∆∗ (G) is not connected. Then ∆∗ (G) has two connected components with vertex sets π1 and π2 . Then we can find two non-central real elements x, y ∈ Re(G) such that π(|xG |) ⊆ π1 and π(|y G|) ⊆ π2 so (|xG |, |y G|) = 1. Since S ✂ G and Re(S) ⊆ Z(S), Re(G) ⊆ Re(S) ⊆ Z(S) by using Lemma 2.1(5). Thus all nontrivial real elements of G are involutions in Z(S). Let E be the set of all involutions of Z(S) together with the identity. Then E is an elementary abelian subgroup of Z(S). Indeed, E = Ω1 (Z(S)) and thus E ✂ G. Clearly x, y ∈ E so that E is not central. In particular, CG (E) ✂ G is a proper subgroup of G. Notice that E ≤ Z(S) and hence S ≤ CG (E). Therefore A := G/CG (E) is a nontrivial group of odd order and we can consider E as an F2 Amodule. By Maschke’s theorem, E is a completely reducible A-module. Observe that |xA | = |A : CA (x)| = |G : CG (x)| = |xG | and |y A | = |y G |. Therefore, the two A-orbits xA and y A have coprime sizes. By Theorem 1.1 in [4], the A-orbit (xy)A has size |xA | · |y A |. Hence |(xy)G | = |xG | · |y G |, where xy ∈ E is an involution. This 10 H. P. TONG-VIET implies that there is an edge between a prime in π1 and a prime in π2 , which is impossible.  We are now ready to prove Theorem B. Theorem 3.7. Let G be a finite group. Suppose that ∆∗ (G) is disconnected. Then 2 divides some real class size and one of the following holds. (1) G has a normal Sylow 2-subgroup. ′ ′ (2) ∆∗ (O2 (G)) is disconnected and the real class sizes of O2 (G) are either odd or powers of 2. Proof. Suppose that ∆∗ (G) is disconnected and let the vertex sets of the connected components are π1 and π2 , respectively. Assume that 2 6∈ π2 . We see that ∆∗ (G) has at least two vertices. We first claim that 2 ∈ π1 . It suffices to show that 2 divides some real class size of G. Suppose by contradiction that 2 divides no real class size. Then G has a normal Sylow 2-subgroup S with Re(S) ⊆ Z(S) by Lemma 2.6. However, Lemma 3.6 implies that ∆∗ (G) is connected, which is a contradiction. Next, suppose that G has no normal Sylow 2-subgroup. We claim that part (2) ′ of the conclusion holds. Let K := O2 (G). By Proposition 3.3(1), ∆∗ (K) is dis′ connected. Since O2 (K) = K and ∆∗ (K) is disconnected, the result follows from Theorem 3.5.  We suspect that if a finite group G has a normal Sylow 2-subgroup S, then ∆∗ (G) is connected, that is, case (1) in Theorem 3.7 cannot occur. However, we are unable to prove or disprove this yet. In view of Lemma 3.6, this is true if Re(S) ⊆ Z(S). There are many examples of finite groups whose prime graphs on real class sizes are disconnected. For the first example, let m > 1 be an odd integer; the dihedral group D2n of order 2n, where n = m or n = 2m, has a disconnected prime graph on real class sizes as its real class sizes are just 1, 2 and m. For another example, let G be a Frobenius group with Frobenius kernel F and complement H, where both F and H are abelian and |H| is even. In this case, all the nontrivial real class sizes of G are |F | and |H| and since (|F |, |H|) = 1, ∆∗ (G) is disconnected. 4. Proof of Theorem C Let G be a finite group. Observe that if x ∈ Z(G) is a real element of G, then x2 = 1. We first begin with the following lemma. Lemma 4.1. Let G be a finite group and let S ∈ Syl2 (G). Suppose that Re(S) ⊆ Z(S) and |xG |2 = 2a ≥ 2 for all non-central real elements x ∈ G. If y is a nontrivial real element of G whose order is a 2-power, then y is a central involution of G. Proof. Let y be a nontrivial real element of G whose order is a 2-power. Then y t = y −1 for some 2-element t ∈ G by Lemma 2.1(2). As t normalizes hyi, U := hy, ti is a 11 2-subgroup of G. By Sylow theorem, U g ≤ S for some g ∈ G. If y g is a central involution of G, then so is y. Thus we can assume that U ≤ S. Since y ∈ Re(U), we have y ∈ Re(S) ⊆ Z(S) and so y 2 = 1. Hence y is an involution. Finally, since y ∈ Z(S), |y G| is odd which forces y ∈ Z(G) as by assumption |xG | is even for all non-central real elements x of G.  The following lemma is obvious. Lemma 4.2. Let G be a finite group and let S ∈ Syl2 (G). Suppose that |xG |2 = 2a ≥ 2 for all non-central real elements x ∈ G. Let K ✂ G be a normal subgroup of odd index. Then |xK |2 = 2a for all non-central real elements x ∈ K. Proof. Let K be a normal subgroup of G of odd index. By Lemma 2.1(5), we have Re(G) ⊆ Re(K). Now let x ∈ K be a non-central real element of K and let C := CG (x). Let P ∈ Syl2 (C) and let S ∈ Syl2 (G) such that P ≤ S. Since |G : K| is odd, we have P ≤ S ≤ K. In particular, S ∈ Syl2 (K). We see that CK (x) = K ∩ C and P ≤ K ∩ C. Thus P ≤ CK (x) ≤ C and so P is also a Sylow 2-subgroup of CK (x). Therefore |C|2 = |CK (x)|2 and hence |xG |2 = |G : C|2 = |S : P | = |K : CK (x)|2 = |xK |2 .  Lemma 4.3. Let G be a finite group and let S ∈ Syl2 (G). Suppose that |xG |2 = 2a ≥ 2 for all non-central real elements x ∈ G. Assume further that G has a Sylow 2-subgroup S with Re(S) ⊆ Z(S). Then every nontrivial real element of G/O2′ (G) of 2-power order lies in the center of G/O2′ (G). Proof. Let N = O2′ (G)✂G and let Nx be a real element of G/N of order k := 2c ≥ 2. Then Nx = Ny for some real element y ∈ G by Lemma 2.1(6). We see that y k ∈ N and so (y k )m = 1 for some odd integer m ≥ 1. As (k, m) = 1, 1 = uk + vm for some integers u, v. We have Nx = Ny = Ny uk+vm = (Ny uk )(Ny vm ) = Ny vm as y k ∈ N. Clearly z := y vm is a nontrivial real element of G whose order divides k = 2c and Nx = Ny = Nz. By Lemma 4.1, z is a central involution of G and thus Nx is also a central involution of G/N.  In the next theorem, we show that if a finite group satisfies the hypothesis of Theorem C, then it is solvable. Theorem 4.4. Let G be a finite group. Suppose that |xG |2 = 2a for all non-central real elements x ∈ G. Assume further that G has a Sylow 2-subgroup S with Re(S) ⊆ Z(S). Then G is solvable. Proof. Let G be a minimal counterexample to the theorem and let S be a Sylow 2subgroup of G with Re(S) ⊆ Z(S). Then G is non-solvable and thus G has no normal Sylow 2-subgroup. By Lemma 2.3, G has a nontrivial real element z of odd order. Clearly, z is not central and thus |z G | is always even. Therefore, |z G |2 = 2a ≥ 2. It follows from Lemma 4.3 that every nontrivial real element of G/O2′ (G) of 2power order lies in the center of G/O2′ (G). In particular, all involutions of G/O2′ (G) are in the center of G/O2′ (G). Now we can apply results in [10]. Since O2′ (G/O2′ (G)) = 12 H. P. TONG-VIET 1, by the main theorem in [10], the last term of the derived series of G/O2′ (G), say H/O2′ (G) is isomorphic to a direct product L1 × L2 × · · · × Ln , where each Li is isomorphic to either SL2 (q) with q ≥ 5 odd or 2 · Alt7 , the perfect double cover of Alt7 . For each i, every real element of Li is also a real element of G/O2′ (G) as Li is a subgroup of G/O2′ (G). Moreover, every nontrivial real element of Li of 2-power order must lie in the center of G/O2′ (G) and hence must be in Z(Li ). Thus to obtain a contradiction, we need to find a real element x ∈ Li of order 2m ≥ 4. Notice that |Z(Li )| = 2 for all i ≥ 1. Assume first that Li ∼ = 2 · Alt7 for some i ≥ 1. Using [3], Li has a real element x of order 4. Assume next that Li ∼ = SL2 (q) for some q ≥ 5 odd. It is well known that the Sylow 2-subgroup T of SL2 (q) is a generalized quaternion group of oder 2k+1 for some k ≥ 2. (See, for example, Theorem 2.8.3 in [9]). Now T is generated by two k−1 elements α and β such that o(β) = 2k , o(α) = 4, α2 = β 2 and β α = β −1 . Thus β is a real element of SL2 (q) of order 2k ≥ 4. We can take x = β. The proof is now complete.  We now prove the 2-nilpotence part of Theorem C. Theorem 4.5. Let G be a finite group. Suppose that |xG |2 = 2a for all non-central real elements x ∈ G. Assume further that G has a Sylow 2-subgroup S with Re(S) ⊆ ′ Z(S). Then O2 (G) is 2-nilpotent. ′ Proof. By Lemma 4.2, we can assume that G = O2 (G). Let G = G/O2′ (G) and use the ‘bar’ notation. Now G is solvable by Theorem 4.4. Let P = O2 (G). Since G is solvable, it possesses a Hall 2′ -subgroup, say H. It follows from Lemma 4.3 that every real element of G whose order is a power of 2 lies in the center of G. This implies that H centralizes all real elements of order at most 4 of P and thus by [13, Theorem B], H centralizes P . By Hall-Higman 1.2.3, H ≤ CG (P ) ≤ P which forces H = 1. This means that G = P is a 2-group and so G is 2-nilpotent as required.  Finally, Theorem C follows by combining Theorems 4.4 and 4.5. References [1] Bertram, Edward A.; Herzog, Marcel; Mann, Avinoam. On a graph related to conjugacy classes of groups. Bull. London Math. Soc. 22 (1990), no. 6, 569–575. [2] Chillag, David; Mann, Avinoam. Nearly odd-order and nearly real finite groups. Comm. Algebra 26 (1998), no. 7, 2041–2064. [3] Conway, J. H.; Curtis, R. T.; Norton, S. P.; Parker, R. A.; Wilson, R. A. Atlas of finite groups. Maximal subgroups and ordinary characters for simple groups. With computational assistance from J. G. Thackray. Oxford University Press, Eynsham, 1985. [4] Dolfi, Silvio; Guralnick, Robert; Praeger, Cheryl E.; Spiga, Pablo. Coprime subdegrees for primitive permutation groups and completely reducible linear groups. Israel J. Math. 195 (2013), no. 2, 745–772. [5] Dolfi, Silvio; Malle, Gunter; Navarro, Gabriel. The finite groups with no real p-elements. Israel J. Math. 192 (2012), no. 2, 831–840. 13 [6] Dolfi, Silvio; Navarro, Gabriel; Tiep, Pham Huu. Primes dividing the degrees of the real characters. Math. Z. 259 (2008), no. 4, 755–774. [7] Dolfi, Silvio; Pacifici, Emanuele; Sanus, Lucia. Finite groups with real conjugacy classes of prime size. Israel J. Math. 175 (2010), 179–189. [8] Fisman, Elsa; Arad, Zvi. A proof of Szep’s conjecture on nonsimplicity of certain finite groups. J. Algebra 108 (1987), no. 2, 340–354. [9] Gorenstein, Daniel. Finite groups. Second edition. Chelsea Publishing Co., New York, 1980. [10] Griess, Robert L., Jr. Finite groups whose involutions lie in the center. Quart. J. Math. Oxford Ser. (2) 29 (1978), no. 115, 241–247. [11] Guralnick, Robert M.; Navarro, Gabriel; Tiep, Pham Huu. Real class sizes and real character degrees. Math. Proc. Cambridge Philos. Soc. 150 (2011), no. 1, 47–71. [12] Isaacs, I. Martin. Finite group theory. Graduate Studies in Mathematics, 92. American Mathematical Society, Providence, RI, 2008. [13] Isaacs, I. M.; Navarro, Gabriel. Normal p-complements and fixed elements. Arch. Math. (Basel) 95 (2010), no. 3, 207–211. [14] Isaacs, I. M.; Navarro, Gabriel. Groups whose real irreducible characters have degrees coprime to p. J. Algebra 356 (2012), 195–206. [15] Tiep, Pham Huu. Real ordinary characters and real Brauer characters. Trans. Amer. Math. Soc. 367 (2015), no. 2, 1273–1312. [16] Tong-Viet, H. P. Groups with some arithmetic conditions on real class sizes. Acta Math. Hungar. 140 (2013), no. 1-2, 105–116. Department of Mathematical Sciences, Binghamton University, Binghamton, NY 13902-6000, USA E-mail address: [email protected]
4math.GR
Which NP-Hard SAT and CSP Problems Admit Exponentially Improved Algorithms? arXiv:1801.09488v1 [cs.DS] 29 Jan 2018 Victor Lagerkvist∗1 and Magnus Wahlström†2 1 2 Institut für Algebra, TU Dresden, Dresden, Germany Department of Computer Science, Royal Holloway, University of London, Great Britain Abstract We study the complexity of SAT(Γ) problems for potentially infinite languages Γ closed under variable negation, which we refer to as sign-symmetric languages Γ. Via an algebraic connection, this reduces to the study of restricted partial polymorphisms we refer to as pSDI-operations (for partial, self-dual and idempotent), under which the language Γ is invariant. First, we focus on the language classes themselves. We classify the structure of the least restrictive pSDI-operations, corresponding to the most powerful languages Γ, and find that these operations can be divided into levels, corresponding to a rough notion of difficulty, where every level k has an easiest language class, containing the language for (k − 1)-SAT, and a hardest language class, containing (among other things) constraints encoded as roots of multivariate polynomials of degree (k − 1). Particular classes in each level correspond to the natural partially defined versions of previously studied total algebraic invariants. In particular, the easiest class on level k ≥ 3 corresponds to the partial k-ary near-unanimity (k-NU) operation, and a larger class corresponds to the partial k-edge operation. The largest class at each level corresponds to a partial operation uk we call k-universal. Furthermore, every sign-symmetric language Γ not preserved by uk implements all k-clauses, hence SAT(Γ) is at least as hard as k-SAT; and if Γ is not preserved by uk for any k, then SAT(Γ) is trivially SETH-hard (i.e., takes time O∗ (2n ) under SETH). Second, we consider implications of this for the complexity of SAT(Γ). We find that particular classes in the hierarchy correspond to previously known algorithmic strategies. In particular, languages preseved by the partial 2-edge operation can be solved via Subset Sum-style meet in the middle, and languages preserved by the partial 3-NU operation can be solved via fast matrix multiplication. These results also hold for the correspondning non-Boolean CSP problems. We also find that symmetric 3-edge languages reduce to finding a monochromatic triangle in an edge-coloured graph, which can be done using algorithms for sparse matrix multiplication; and if the sunflower conjecture holds for sunflowers with k petals, then the partial k-NU language has an improved algorithm via Schöning-style local search. Complementing this, we show a lower bound, showing that for every level k there is a constant ck such that for every partial operation p on level k, the problem SAT(Γ) with Γ = Inv(p) cannot be solved faster than O∗ (cnk ) unless SETH fails. In particular, when Γ = Inv(2-edge), this gives us the first NP-hard SAT problem which simultaneously has non-trivial upper and lower bounds on the running time, assuming SETH. Finally, we note a possible conjecture: It is consistent with our present knowledge that SAT(Γ) admits an improved algorithm if and only if Γ is preserved by uk for some constant k. However, to show this in the positive poses some significant difficulty. ∗ † [email protected] [email protected] 1 Introduction Significant attention has been paid to the exact time complexity of SAT and its various restrictions; in particular CNF-SAT and k-SAT, but also other restrictions such as Not-All-Equal SAT, 1-in-k SAT, and several more cases [15, 23, 25, 42, 49]. The usual focus is on an improved algorithm for some particular variant, i.e., showing that the problem can be solved in time O∗ (cn ) for some c < 2, or, in some cases, that such an improvement is not feasible, up to our current knowledge (i.e., it would require disproving the strong exponential-time hypothesis, SETH; see below). Here, and in the sequel, the parameter n will in this context always denote the number of variables in a given instance. But what is the general rule for when a SAT problem admits such an improved algorithm? And can we say anything at all about lower bounds on such improvements? To refine the question, let us recall some terminology. A constraint language is a (possibly infinite) set Γ of finitary relations R ⊆ D ar(R) over some domain D, where ar(R) denotes the arity of R. We will mainly focus on the Boolean case, i.e., D = {0, 1}. Then SAT(Γ), occasionally called the parameterized satisfiability problem, is the SAT problem where the constraints of the instance are applications of relations from Γ, i.e., the constraints are statements that R(x1 , . . . , xr ) must hold, for some R ∈ Γ and some variables x1 , . . . , xr from the variable set (where we do allow repetitions of a variable). The multi-valued generalization of SAT, the constraint satisfaction problem over Γ (CSP(Γ)) is defined in essentially the same way, except that Γ may be non-Boolean. Full definitions of the problems under consideration follow in Section 2. Thus, for example, 3-SAT corresponds to SAT(Γ3SAT ) where Γ3SAT for each 3-clause in {(x ∨ y ∨ z), . . . , (¬x ∨ ¬y ∨ ¬z)} contains the relation excluding only the tuple forbidden by that particular clause. Similarly, for k ≥ 3 let ΓkSAT denote the constraint language of all k-clauses, i.e., SAT(ΓkSAT ) is equivalent to k-SAT. Let us also tentatively define c(Γ) as the infimum over all constants c > 1 such that SAT(Γ) can be solved in O(cn ) on n variables. Then the exponential time hypothesis (ETH), due to Impagliazzo and Paturi, states that c(ΓkSAT ) > 1 for every k, and was shown to be equivalent to the statement that c(Γ3SAT ) > 1 [25]. It has also been shown to be equivalent to the statement that c(Γ) > 1 for every Γ such that SAT(Γ) is NP-hard [31]. The strong exponential time hypothesis (SETH) is the statement that limk→∞ c(ΓkSAT ) = 2 [10, 25]. Then our main research question can be rephrased as, for which constraint languages Γ is c(Γ) < 2, respectively, when would c(Γ) < 2 contradict SETH? We say that SAT(Γ) allows an improved algorithm in the former case, and that it is SETH-hard in the latter. Hence, our main interest is in exponential improvements rather than subexponential improvements of the form O(2n−o(n) ) which have been proven to exist for CNF-SAT [17]. Before we discuss our approach for the general case, we consider a few examples. First of all, the algorithms for k-SAT imply that c(Γ) < 2 for every finite language Γ. However, such bounds are also known for some infinite languages. One example is Exact SAT, the language of 1-in-k-clauses of all arities, which admits an improved algorithm [53]. As has been shown more recently, so does the problem where constraints are encoded as the roots of bounded-degree multivariate polynomials over a finite field [42]. Thus, we need a way to discuss properties of infinite arbitrary languages, and we need to consider the representation of constraints from such a language. We address these issues in Section 1.2. Lower bounds on c(Γ) for some Γ have been significantly harder to come by. Some SAT problems have been shown to be SETH-hard, in particular Not-All-Equal SAT and problems related to SAT such as Hitting Set [15]. It is also known that assuming ETH, the value of c(ΓkSAT ) increases infinitely often [25]. However, we do not even have conjectural evidence against any particular value of c(Γ) for any language Γ such that SAT(Γ) is not SETH-hard, other than for trivial cases.1 We also are not aware of any previous attempts to engage with the question of what makes a SAT problem SETH-hard or not in general. In this paper, we study these questions using tools from universal algebra. It is known that the value 1By trivial cases, we mean problems where the natural search space is smaller than 2n but otherwise unrestricted. Consider a language where every variable is involved in a disequality, e.g., the language of relations R′ (x1 , . . . , x2k ) ≡ (x1 6= xk+1 ) ∧ . . . ∧ (xk 6= x2k ) ∧ R(x1 , . . . , xk ) for arbitrary relations R. It is easy to see that under SETH, this problem has c(Γ) = 21/2 . 1 of c(Γ) is determined by algebraic invariants of Γ known as partial polymorphisms [31]. It is not difficult to prove that if Γ has no interesting partial polymorphisms, then SAT(Γ) is trivially SETH-hard. We study the converse to this question, to essentially ask, does the existence of even a single relevant partial polymorphism p imply that SAT(Γ) has an improved algorithm? In particular, is it possible to design an algorithm with an exponentially improved running time, whose correctness depends only on p? One of the main strengths of using such an algebraic approach is that it makes the task of identifying languages Γ such that c(Γ) < 2 considerably easier. In fact, as we discuss in Section 1.1, these languages can be succinctly classified according to the expressive power of individual partial operations. Our paper has two main contributions. First, we characterize the structure of the weakest non-trivial invariants p. In this, we restrict ourselves to sign-symmetric languages (see below). This reveals a characterization of problem complexity, with close ties to several previously studied problems and algorithm classes. Second, we use the framework to provide both upper and lower bounds on c(Γ) for the corresponding languages Γ, under SETH. We show that algorithms from the literature can be extended to work for every language having a certain partial polymorphism p. In the negative direction, we are able to prove lower bounds on c(Γ) for every language Γ characterised purely by its invariants. As a result, we produce the first language Γ such that c(Γ) has both non-trivial upper and lower bounds under SETH. Finally, we make connections between these SAT(Γ) problems and some problems in polynomial-time fine-grained complexity. Our approach also implies some results for CSPs on a non-Boolean domain, but our main focus in the present paper lies in studying the Boolean case. 1.1 Universal algebraic aspects of SAT problems To make the discussion of our approach more precise, we need to review some notions from universal algebra. This is simply intended as an introduction and overview to make the extended abstract self-contained; full definitions follow later in the paper in Section 2. The universal algebraic approach to problem complexity originates in research into the constraint satisfaction problem (CSP) [29]. Recall the definitions of a constraint language Γ and the problem CSP(Γ) from the preceding section. Clearly, the complexity of CSP(Γ) varies as a function of Γ: if Γ is simple enough, then CSP(Γ) is in P; and if Γ is rich enough, then CSP(Γ) is NP-complete. The dichotomy conjecture, first posed by Feder and Vardi [19], states that these are the only two cases and that no NP-intermediate CSP problems exist: for every fixed language Γ, CSP(Γ) is either in P or is NP-complete. This conjecture has been the subject of intense research and the piece remaining to complete the puzzle was recently resolved by two independent authors [7, 57]. The algebraic approach turned out to be central in this research programme. In short, this approach boils down to the realization that properties of constraint languages can be expressed by properties of their polymorphisms. Informally, a polymorphism of a constraint language Γ is an operation which yields a method to combine satisfying assignments of instances of CSP(Γ). The algebraic reformulation of the CSP dichotomy theorem then states that CSP(Γ) is tractable if there exists a non-trivial method to combine solutions, and is NP-complete otherwise. More formally, we may define polymorphisms as follows. First, let R ⊆ D n be a relation on D, and let p : Dr → D be an r-ary operation over D. We can then generalise p to an operation (Dn )r → D n on tuples over D by p(x1 , . . . , xr )[i] = p(x1 [i], . . . , xr [i]) for every position i ∈ [n] (where xj [i] denotes the ith element of the tuple xj ). Then p is a polymorphism of R if this generalised operation preserves R, i.e., if p(x1 , . . . , xr ) ∈ R for any x1 , . . . , xr ∈ R. Note that if p is a projection, i.e., p(t1 , . . . , tr ) = ti for some i ∈ [r], then p preserves every possible relation. The notion of a polymorphism easily extends to constraint languages, and we say that p is a polymorphism of the constraint language Γ if p is a polymorphism of R for every relation R ∈ Γ, and let Pol(Γ) denote this set. It is then known that the complexity of CSP(Γ), up to polynomial-time many-one reductions, is determined entirely by Pol(Γ) [28]. Theorem 1. Let Γ and ∆ be finite constraint languages over a finite domain D. If Pol(∆) ⊆ Pol(Γ), then CSP(Γ) is polynomial-time many-one reducible to CSP(∆). 2 At this stage this result may seem slightly puzzling since we do not yet have a clear correspondence between polymorphisms and their implications on constraint languages. However, there exists a dual concept to polymorphisms on the relational side called implementations. Given a set of relations Γ over a domain D, a k-ary relation R is definable by a primitive positive implementation over Γ (pp-definable) if there exists a first-order formula making use of existential quantification and conjunctive constraints over Γ such that the set of models of this formula is precisely R. Given a constraint language Γ we then let hΓi be the smallest set of relations containing Γ and which is closed under taking pp-definitions. The polymorphisms of Γ then characterize the power of pp-definitions over Γ in the following sense. Theorem 2 ([5, 6, 21]). Let Γ and ∆ be two constraint languages. Then Γ ⊆ h∆i if and only if Pol(∆) ⊆ Pol(Γ). This duality has two implications. First, note that an instance of CSP(Γ) can be viewed as a special case of a pp-definition over Γ, hence the polymorphisms of Γ describe closure properties for the whole CSP(Γ) problem, and can be used to design polynomial-time algorithms. This is in line with the intuition that a polymorphism yields a method for combining satisfying assignments. Second, if R has a pp-definition in Γ then there is a polynomial-time many-one reduction from CSP(Γ ∪ {R}) to CSP(Γ); essentially, the ppdefinition describes a classical “gadget reduction” between the problems obtained by replacing constraints over R by the collection of constraints over Γ prescribed by the pp-definition. Therefore, dually to the previous point, the absence of sufficiently interesting polymorphisms for Γ would imply a polynomial-time reduction from an NP-hard problem CSP(Γ′ ), e.g., 3-SAT, to CSP(Γ). In practice, for CSPs beyond the Boolean domain, the complexity landscape gets very complex and one needs to apply a richer algebraic toolbox to make progress. However, it was realized early that not only does the complexity of CSP(Γ) depend on Pol(Γ), but in fact only the identities satisfied by the operations in Pol(Γ) [9]. In technical terms this means that the complexity of CSP(Γ) only depends on the variety generated by Pol(Γ). We will not define these concepts formally since they are not needed to present the main results; it is sufficient to know that the complexity of CSP(Γ) only depends on the identities satisfied by the operations in Pol(Γ). For example, CSP(Γ) is solvable using k-consistency if Pol(Γ) contains a majority operation, i.e., a ternary operation m satisfying the identities m(x, y, y) = y, m(y, x, y) = y, m(y, y, x) = y [29]. Moreover, all operations resulting in tractable CSPs can be characterized using such identities. It is worth remarking that for the Boolean domain the situation is considerably simplified due to Post’s classification of Boolean Pol(Γ) [46], and a large range of such problems have been proven to admit dichotomies [14]. For example, Schaefers dichotomy theorem for SAT(Γ) [48] can be proven in an extremely straightforward manner using this approach. However, for our purposes the above methods are too coarsegrained, since the precise running time O∗ (cn ) for a problem SAT(Γ) is not preserved by the introduction of existentially quantified variables. Hence, we are in need of more fine-grained algebraic tools than usual, which can be applied as follows. A partial operation over D (of some arity r) is an operation p : X → D for some domain X ⊆ D r . Similar to the total case we again extend it to a partial operation on tuples over D: for x1 , . . . , xr ∈ D n , we let p(x1 , . . . , xr )[i] = p(x1 [i], . . . , xr [i]) if this is defined for every position i ∈ [n]; otherwise p(x1 , . . . , xr ) is undefined. Then p is a partial polymorphism of a relation R ⊆ D n if, for any x1 , . . . , xr ∈ R such that p(x1 , . . . , xr ) is defined we have p(x1 , . . . , xr ) ∈ R. We will occasionally also say that R is invariant under the partial operation p. A partial projection is a subfunction of a projection; such an operation preserves every possible relation. A partial polymorphism of a constraint language Γ is a partial polymorphism of every relation R ∈ Γ and we let pPol(Γ) denote the set of all partial polymorphisms of Γ. Similarly, given a set of partial operations P we write Inv(P) to denote the set of relations invariant under P , and if P = {p} is singleton we write Inv(p) instead of Inv({p}). Dually to this relaxed notion of a polymorphism, we have a strengthened notion on the relational side: a quantifier-free primitive positive definition (qfpp-definition) 3 over Γ is a pp-definition without existential quantification. We let hΓi6∃ denote the smallest set of relations containing Γ and which is closed under qfpp-definitions, and then obtain the following correspondence. Theorem 3 ([21, 47]). Γ ⊆ h∆i6∃ if and only if pPol(∆) ⊆ pPol(Γ) for any constraint languages Γ and ∆. With the help of this correspondence Jonsson et al. [31] proved that partial polymorphisms indeed can be used for studying the fine-grained complexity of SAT and CSP. Theorem 4. Let Γ and ∆ be two finite constraint languages. If pPol(Γ) ⊆ pPol(∆) then there is a polynomial-time many-one reduction from CSP(∆) to CSP(Γ) which does not increase the number of variables. Unfortunately, this theorem is difficult to apply in practice since it requires a good understanding of the structure of the closed sets pPol(Γ) for all possible choices of Γ. Despite advances made by several different researchers [12, 13, 35, 51], no such classification is known even for Boolean Γ, and even less is known for Γ such that SAT(Γ) is NP-hard. Hence, we propose a method inspired by the rich algebraic toolbox developed for studying the classical complexity of CSP: does the SETH-hardness of SAT(Γ) and CSP(Γ) only depend on the identities satisfied by the partial polymorphisms of Γ? On the one hand, it is easily verified that if the only partial polymorphisms of Γ are the partial projections, then Γ can qfpp-define all k-clauses for every k ≥ 1, and SAT(Γ) is SETH-hard. On the other hand, we would have to show that every non-trivial partial polymorphism p allows the design of an algorithm that solves SAT(Γ) in O∗ (cn ) time for some c < 2. One issue which speaks against the feasibility of this approach is that individual partial polymorphisms are very weak restrictions. For one thing, it is known that for every finite set P of partial operations (that does not imply any non-trivial total operation), the set Inv(P) of all relations that are invariant under P contains a double-exponential number of relations as a function of the arity n [37, Lemma 35]. Note that for k a finite language such as k-SAT, there are in contrast only 2O(n ) distinct instances on n variables. Hence, languages Inv(p) for a single partial operation p would be much richer than previously studied problems. Very similarly, in a related study [36], it was shown that the existence of so-called polynomial kernels for SAT(Γ) cannot be characterised by such a finite set P , whereas every finite problem, as well as Exact SAT and problems defined via bounded-degree polynomials, have polynomial kernels [27]. Nevertheless, contrary to these earlier results, we will prove that the presence of certain individual partial polymorphisms can be used to design improved algorithms for SAT problems. As a starting point we in the first hand consider the partial analogues of well-studied polymorphisms resulting in tractable CSPs. For example, a Maltsev operation is a ternary operation φ satisfying the two identities φ(x, x, y) = y and φ(y, x, x) = y, and is well-known to result in tractable CSPs due to the algorithm by Bulatov and Dalmau [8]. We may then define the partial Maltsev operation over a domain D as the unique partial operation which for all x, y ∈ D satisfies these two identities, but which is undefined otherwise. Similarly, it is possible to define partial variants of k-ary near unanimity (k-NU) and k-ary edge (k-edge) operations. These classes of operations are formally defined in Section 2.5 and at the moment we will simply regard them as wellbehaved operations resulting in tractable CSPs, but we remark that a 2-edge operation is equivalent to a Maltsev operation and that a ternary NU-operation is nothing else than a majority operation. It may also be interesting to observe that the partial operations defined in this manner are unique for every fixed domain, even though there may exist a large number of total operations satisfying the identities. 1.2 Our results and structure of the paper For a partial polymorphism p, let Inv(p)-SAT refer to the problem SAT(Γ) where Γ = Inv(p). Hence, in this problem every involved relation is invariant under the given partial operation p. We will sometimes also refer to the CSP-variants of these problems and denote these by Inv(p)-CSP (and tacitly assume that the domain of the operation p is clear from the context, or is not relevant). We look at three related aspects of the complexity of these problems. Let us first discuss our model more carefully. 4 Our questions and model. Since Γ is infinite we first need to fix a constraint representation. Let R ⊆ {0, 1}r be a relation. An explicit representation of R is a list of all tuples t ∈ R. For infinite languages the explicit representation is not always the most natural one since a relation may contain exponentially many tuples with respect to the arity. This is particuraly troublesome when proving lower bounds for Inv(p)-SAT since we may not be able to construct relations of arbitrary arity in the required time bound. Hence, we also consider an implicit representation. In this model of representation a contraint R(x1 , . . . , xr ) is represented by an oracle consisting of a computable function which, given an assignment to variables X ⊆ {x1 , . . . , xr }, can determine if this assignment can be extended to an assignment to {x1 , . . . , xr } consistent with R. Example 5. For each r ≥ 3 consider the relation Rr = {(x1 , . . . , xr ) ∈ {0, 1}r | x1 + . . . + xr is even}. Even though |Rr | is exponential with respect to r it is not difficult to see that constraints over Rr can be implicitly represented by computing the parity of the given assignment. Given these definitions, we consider the following three notions of improved algorithms. Definition 6. Let Γ be an infinite constraint language. 1. SAT(Γ) admits a non-uniform improved algorithm with running time O∗ (cn ), c < 2, if for every finite Γ′ ⊂ Γ the problem SAT(Γ′ ) can be solved in O∗ (cn ) time. 2. SAT(Γ) admits an improved algorithm in explicit representation if SAT(Γ) admits an improved algorithm for the problem variant where every relation is provided in explicit representation. 3. SAT(Γ) admits an improved algorithm in the oracle model if SAT(Γ) admits an improved algorithm when constraints are provided only as extension oracles. Note that for a non-uniform improved algorithm, the representation does not matter. Also note that these are gradually stronger requirements, and that in these terms, SETH states that CNF-SAT does not admit even a non-uniform improved algorithm. On the other hand, allowing constraints of unbounded arity via oracle P access can be useful; for example, the n-ary constraint ( ni=1 xi = k) has a simple extension oracle, and if included in the language, can be used to phrase optimisation problems as oracle-access SAT problems. To restrict our scope, we focus on constraint languages that are closed under variable negation. Informally, this means that whenever R ∈ Γ, in addition to constraints R(x1 , . . . , xr ) on only positive variables, we are also allowed to impose constraints such as R(x1 , . . . , ¬xi , . . . , xr ) with some occurrences of variables xi negated in the constraint. More formally, it means that for every R ∈ Γ, and for every subset S ⊆ [ar(R)] of positions of R, the relation produced by negating every tuple t ∈ R in positions S is also contained in Γ. In this case, we say that Γ is sign-symmetric. This is a natural restriction which holds for many well-studied constraint language, e.g., the languges corresponding to k-SAT, 1-in-k-SAT and the roots of bounded-degree polynomials are all sign-symmetric. Furthermore, it is known that the expressive power of a sign-symmetric constraint language is characterised by a restricted kind of partial polymorphism which we refer to as pSDIoperations (for partial, self-dual and idempotent) [34, 38]. Thus, the restriction to sign-symmetric languages corresponds directly to a restriction on the algebraic level. Most importantly, the Boolean partial operations arising from system of identities of the form considered in Section 1.1 are guaranteed to be pSDI. The fine-grained structure of NP-hard SAT problems. The first part of the paper, Section 3, is dedicated to explaining the the structure of pSDI-operations. Due to the algebraic correspondence between partial polymorphisms and qfpp-definability this also serves as a classification of the NP-hard SAT problems we need to consider for constructing improved algorithms. First, we study the structure of single pSDI-operations p that impose some non-trivial restrictions on the expressive power of Γ. We particularly consider the weakest such operations, i.e., such that the language 5 Γ = Inv(p) is as rich as possible. In particular, we consider p such that every subfunction of p which is pSDI is a partial projection. Let us refer to such an operation as being minimal. For example, the partial variants of Maltsev, k-NU, and k-edge operations are all minimal. Equipped with this notion we then show that minimal pSDI-operations are naturally organised into levels, with a structure as follows. • There is a single minimal operation on level 2, which is the partial Maltsev, or, equivalently, the partial 2-edge operation. This is also equivalent to the 2-universal operation defined below. • For every other minimal pSDI-operation p, there is a unique largest constant k such that p is implied by the partial k-NU operation nuk . We refer to this as the level of k. Thus, the partial k-NU operation is the strongest operation on level k ≥ 3. • For every level k ≥ 2, there is also a unique weakest pSDI-operation uk which we refer to as the k-universal operation, such that uk is implied by every operation on level k. • The language ΓkSAT corresponding to k-SAT is preserved by the partial (k + 1)-NU operation, but not by any operation on a previous level; and every sign-symmetric language Γ that is not preserved by the k-universal operation can qfpp-define ΓkSAT . • Finally, as an interesting case, roots of polynomials of degree at most d are preserved by the (d + 1)universal operation, but not by any other operation on a level up to d + 1. Thus, the levels of minimal pSDI-operations correspond to a natural notion of difficulty. It also follows that if a sign-symmetric language Γ is not preserved by the k-universal operation for any constant k, then SAT(Γ) is trivially SETH-hard, whereas every other language Γ has some kind of restriction on its expressive power. We also note that there is no known case of a problem known to be SETH-hard, which fits into a framework of searching through the set {0, 1}n for a solution, and which is k-universal for any k. Hence, it is consistent with our present knowledge that every k-universal problem SAT(Γ) admits an improved algorithm. Last, we remark that although we in this paper are mainly interested in the time complexity of SAT, the classification of minimal pSDI-operations in this section may be of independant interest for any Boolean problem compatible with qfpp-definitions. In this vein, we also give a “vertical” result in the above hiearchy, and show that every sign-symmetric constraint language Γ not preserved by the partial k-NU operation for any k can qfpp-define either 1-in-k-clauses of all arities, or counting constraints modulo p of all arities for some fixed prime p. This result is the main technical challenge in this section, and relies on an application of Szemerédi’s theorem [54] to analyse the structure of symmetric relations R ∈ / Inv(nuk ). Upper and Lower Bounds on the SAT problem. Second, in Section 4 and Section 5, we consider the strength of the problem Inv(p)-SAT for various pSDI-operations p, with an interest in bounding the value c(Γ) for Γ = Inv(p) from above and below. The first question here is the matter of constraint representation. As mentioned previously, the language Inv(p) contains a double-exponential number of relations of arity r as a function of r; hence any fixed representation would in the worst case use 2O(r) bits just to encode the relations. This becomes an issue when we allow constraints of unbounded arity. Recall that we consider three alternatives for representation: explicit representation, extension oracles, and non-uniform algorithms where the particular choice of representation does not matter. We then obtain the following results. • When p is the partial 2-edge operation, we refer to Inv(p)-SAT as 2-edge-SAT. We show that 2-edgen SAT can be solved in O∗ (2 2 ) time in the oracle setting using a meet-in-the-middle strategy combined n with the computation of a kind of canonical labels for partial assignments, similarly to the O∗ (2 2 )time algorithm for Subset Sum with n integers [24]. A similar improved algorithm is possible for the generalisation to 2-edge-CSP, i.e., for fixed non-Boolean domains. Furthermore, if c(Inv(p)) < 21/2 6 1 in the extension oracle setting, then Subset Sum can be solved in O∗ (2( 2 −ε)n ) for some ε > 0, which is a long-standing open problem. • When p is the partial k-NU operation, we refer to Inv(p)-SAT as k-NU-SAT. For k = 3, this problem is equivalent to 2-SAT, and hence in P, but the generalisation 3-NU-CSP to larger fixed domains is NPhard and admits an improved algorithm using fast matrix multiplication, similarly to the well-known algorithm for the CSP problem over binary constraints. • For k > 3, we show two conditional connections. First, if the (k, k − 1)-hyperclique problem for hypergraphs with ground set of size n can be solved in time O(nk−ε ) for any ε > 0, then both k-NU-SAT and k-NU-CSP admit improved algorithms in the oracle setting. Second, if the ErdősRado sunflower conjecture [18] holds for sunflowers with k sets, then k-NU-SAT admits an improved algorithm via a local search strategy in the explicit representation, similar to Schöning’s algorithm for k-SAT [52]. • We also investigate the case that p is the partial 3-edge operation e3 , and give a partial result. Assume that every relation R in the input is either preserved by the partial 2-edge relation, or by nu3 , or R is symmetric and preserved by e3 – i.e., whether t ∈ R depends only on the Hamming weight of t. Then the SAT problem has an improved algorithm via a reduction to the problem of finding monochromatic triangles in an edge-coloured graph, which in turn can be solved using fast algorithms for triangle finding in sparse graphs. We do not know whether this strategy generalises to non-symmetric relations. For further classes, we note that SAT(Γ) contains some highly challenging special cases. In particular an algorithm for the k-universal languages for k > 2 would need to generalise the algorithm of Lokshtanov et al. for bounded-degree polynomials [42], while only using the abstract properties guaranteed by uk . Finally, we show lower bounds in the oracle extension model: for every minimal pSDI-operation p, we get a concrete lower bound c(Inv(p)) ≥ ck > 1 assuming the randomized SETH, where k is the level of p. (1−ε)n ) for any ε > 0 and any That is, unless SETH is false, no algorithm can solve Inv(p)-SAT in time O∗ (ck log k p at level k. The bound ck converges to 2 at a rate of 2 − ck = Θ( k ). A connection to polynomial-time problems. Finally, we make some connections between the Inv(p)SAT and Inv(p)-CSP problems and some problems in polynomial-time algorithms. We show that the minimal pSDI-operations generalise not only to CSP problems on fixed domains, but to abstract conditions on “CSP-like” problems on a domain of size n and with d = Θ(1) variables. We refer to this as the abstract Inv(p)-problem. Any solution to such a problem that runs in time O(nd−ε ) for any ε > 0 implies an improved algorithm for the corresponding Inv(p)-SAT and Inv(p)-CSP problems in the oracle setting for every fixed domain. This lies behind the improved algorithms for 2-edge-CSP and 3-NU-CSP. However, there is some indication that these problems may be tougher than the original problems, since the reduction loses a significant amount of instance structure (e.g., the local search strategy for k-NU-SAT cannot be lifted to the abstract problem). In fact, there are conjectures that would prevent improved algorithms for most cases of the abstract problem considered in this article: • The abstract k-NU problem is equivalent to (k, k − 1)-hyperclique, i.e., the problem of finding a k-hyperclique in a (k − 1)-regular hypergraph. Thus, it has an improved algorithm for k = 3 but the status is unknown for k > 3. Moreover, the general (l, k)-hyperclique problem for l > k has been conjectured to require nl−o(1) time [40]. • The abstract 3-universal problem contains the problem of finding a zero-weight triangle in an edgeweighted graph with arbitrary edge weights. This does not admit an improved algorithm unless the 3-SUM conjecture fails (but SETH-hardness is not known) [56]. 7 Considering the connections, we still consider it useful to ask which minimal pSDI-operations p suffice to guarantee an improved algorithm for the abstract Inv(p)-problem. We leave this question for future work. 1.3 Technical notes and proof methods Let us now give a few more details about the proofs of the above results. The structural characterisation builds on a description of minimal non-trivial pSDI-operations (Lemma 27) — they are precisely the operations produced by padding the partial k-NU operation by additional arguments. The weakest and strongest operations on each level follow from this almost by definition. It also follows that the operations on each level k are characterized by the presence or absence of each of roughly 2k possible types of padding argument. Note that such a padding makes an operation weaker; e.g., in order to apply the partial majority operation to a sequence of tuples t1 , . . . , tk ∈ R for some relation R, in a padded version of arity r we require that R further contains a sequence of tuples tk+1 , . . . , tr determined by the padding arguments from the tuples t1 , . . . , tk . This also provides a way to think about the consequences of not being preserved by such an operation. Assume e.g. that a relation R is not preserved by nuk . Then by definition there are t1 , . . . , tk ∈ R such that nuk (t1 , . . . , tk ) = t is defined, and by sign-symmetry we may assume that t is the constant 0-tuple 0ar(R) . Then the witness produces a partition of the arguments of R, in a way which can be used to implement a relation R′ of arity k which accepts every tuple of weight 1 but none of weight 0. However, we have no information at this point about the remaining tuples in R′ . Continuing this line of reasoning to derive a consequence for an infinite sign-symmetric language Γ with nuk ∈ / pPol(Γ) for every k, we first observe that ′′ we can define a symmetric relation R ∈ / Inv(nuk ) as a conjunction of k! applications of R′ under argument permutation, then (as announced) analyse the possibilities for families of such relations using Szemerédi’s theorem. In particular, a broken arithmetic progression of i accepted weights in such a relation implies that we can qfpp-define an i + 1-clause using R. By contrast, if uk ∈ / pPol(R), then the tuples t1 , . . . , t2k −1 ∈ R required by the arguments of uk imply that such a relation R′ must have |R′ | = 2k − 1, i.e., it must be the relation corresponding to a k-clause. Moving on to the algorithmic applications, most of the positive results are relatively straight-forward applications of known ideas; the interesting aspect is that the applicability of these ideas follows from such simple conditions as the minimal pSDI-operations. Here, we particularly wish to highlight the conjectural connection to local search. Recall that Schöning’s algorithm [52] reduces k-SAT to several applications of local search, i.e., given a starting point x ∈ {0, 1}n and a parameter t, find a satisfying assignment within Hamming distance t of x. By sign-symmetry, for our problem this reduces to the case x = 0n (alternatively, one could use monotone local search; cf. Fomin et al. [20]). Now, consider the set of all minimal tuples in any relation R ∈ Inv(nuk ) with 0ar(R) ∈ / R. It is easy to see that by the nuk -condition, this set does not contain a sunflower of k sets, and by the sunflower conjecture, this implies that for every i there are at most C i such minimal tuples in R of weight i for some C. A simple computation shows that a recursive algorithm that finds an unsatisfied relation R, enumerates minimal tuples in it, and recursively proceeds from every such tuple yields a total searching time of 2O(t) , which would be precisely sufficient to yield an improved algorithm for k-NU-SAT. This algorithm uses the explicit representation in order to be able to enumerate such minimal tuples. It is an interesting open question whether this can be achieved efficiently in the oracle setting. Finally, we move on to our lower bounds. These are of two kinds, a reduction from Subset Sum to 2-edge-SAT, and the generic lower bound under SETH against any problem Inv(p)-SAT. For the former, recall that the partial 2-edge operation is equivalent to u2 , and thus contains all constraints which can be phrased as linear equations, e.g., Subset Sum instances. But we are also required to provide an extension oracle for each constraint, which is clearly infeasible if we plug in the Subset Sum equation as-is. However, √ √ this is easily solved by splitting the binary expansion of the target number into O( n) blocks of O( n) 8 bits each. With some moderate guessing, each block reduces to one linear equation, and via the tabulation √ algorithm for Subset Sum an extension oracle each such block can be produced with a query time of 2O( n) . The generic bounds, in turn, work via a generic padding argument: we show that for every level k, and any set X of n variables, there is a universal padding formula R(X, Y ) on |Y | = Θ(n) additional variables such that R′ (X, Y ) ≡ R′ (X)∧ R(X, Y ) is k-NU for any relation R′ (X). Furthermore, random parity-check variables suffice to produce this padding formula, allowing for an efficient extension oracle for the relation R′ (X, Y ). Finally, by the regularity of the padding formula, we can reuse the same variables Y for all constraints in an input instance of q-SAT, for any q, and only pay with |Y | = Θ(n) extra variables in total. The fact that some such padding exists was previously known [37]. Recall that every operation p considered has at least one tuple of values for which it is undefined. Then, if we add enough random variables, for every attempt p(t1 , . . . , tr ) of finding a valid application of p on a relation R there will be a padding variable j such that (t1 [j], . . . , tr [j]) takes the values of such a tuple, and p is undefined. The fact that parity-check variables suffice in our case follows from the fact that p contains k arguments that form a partial k-NU operation. It is easy to check that almost all parity-check variables form an undefined tuple of values already over these arguments. This construction could be derandomized using a universal hash family, possibly at the cost of a larger constant |Y |/|X|, but we do not pursue this. 1.4 Related work Our work can be seen as an amalgamation of the following areas: fine-grained time complexity and lower bounds under the SETH, and the algebraic approach for studying classical complexity of CSP. Concerning the former, SETH has turned out to be a highly useful conjecture for exact algorithms since a relative lower bound from SETH shows that any further improvements also implies a breakthrough speed-up for SAT. Many different problems have been shown to admit lower bounds via the SETH, but in the current context of SAT, in addition to the foundational works of Impagliazzo et al. [25, 26] it is worth mentioning the lower bound for Not-all-equal SAT (NAE-SAT) by Cygan et al. [15] and the lower bound for Π2 3-SAT by Calabro et al. [11]. However, to the best of our knowledge, all concrete lower bounds using SETH for exponential-time algorithms falls into one of the following cases: either the lower bound matches the running time of a trivial algorithm, as in the case of Hitting Set, NAE-SAT, and Π2 -3-SAT, showing that no improvement is possible; or the lower bounds are with respect to a much more permissive complexity parameter than n, such as treewidth [41]. The one other example we are aware of is from the study of infinite-domain CSPs by Jonsson and Lagerkvist [30], who obtained upper bounds of the form O∗ (2f (n) ) for non-linear functions f and a lower bound stating that the CSPs are not solvable in O(cn ) time for any constant c. These bounds are therefore in a sense closer to non-subexponentiality results usually obtained from the ETH. SETH and other conjectures have also seen significant applications over recent years in producing conditional lower bounds for polynomial-time solvable problems, but these are only tangentially relevant here. With regards to the algebraic approach we wish to highlight a few related but different results. Partial polymorphisms and the link to qfpp-definitions were first introduced to the CSP community by Schnoor & Schnoor [50] even though these notions were well-known in the algebraic community much longer [21, 47]. However, the principal motivation by Schnoor & Schnoor was to obtain dichotomy theorems for CSPlike problems incompatible with existential quantification, and the explicit connection to fine-grained time complexity of CSP was not realized until later by Jonsson et al. [31]. This work utilized a lattice-informed approach which exploited the structure of the inclusion structure of closed sets of partial polymorphisms, in order to identify an NP-complete SAT(Γ) problem such that c(Γ) ≤ c(∆) for every other NP-complete SAT(∆). This problem was referred to as the easiest NP-complete SAT problem and was later generalized to a broad class of finite-domain CSPs [32]. However, continued advancements in understanding this inclusion structure revealed that even severely restricted classes of constraint languages had a very complicated 9 structure [12, 35]. In a similar vein of negative results it was also proven that (1) pPol(Γ) cannot be generated by any finite set of partial operations whenever Γ is finite and SAT(Γ) is NP-hard, and (2) if P is a finite set of partial operations such that Inv(P)-SAT is NP-hard, then any pp-definable relation over Inv(P) can be transformed into a pp-definition using only a linear number of existentially quantified variables [37]. In plain language, these results show that finite constraint languages result in complex partial polymorphisms, and that simple partial polymorphisms result in complex constraint languages. A previous attempt at grappling with this difficulty provided closure operators that generate pPol(Γ) for a finite Γ from a finite basis [34], but this intrinsically uses that Γ is finite, and is not applicable in the current paper. Our approach in this paper avoids the pitfalls of the lattice-informed approach since it is sufficient to understand the behaviour of individual pSDI-operations. This is in line with how the research programme of classifying the complexity of finite-domain CSPs evolved into a project of describing properties of operations defined by system of identities (see the survey by Barto et al. for more details [3]). Another related paper by the present authors investigates the existence of polynomial (or linear) kernels for problems SAT(Γ), using ideas of extending the language Γ into a tractable CSP on a larger domain [36], including extensions into 2-edge (i.e., Maltsev) and k-edge languages. However, there is no concrete technical connection between that paper and this one, as having polynomial kernels turns out to be a much more restricted property than admitting improved algorithms. 1.5 Concluding remarks and open questions Our principal motivation in this paper is to study the SETH-hardness of the parameterized SAT(Γ) problem. To simplify our study we restricted our focus to sign-symmetric constraint languages, which is a common assumption for SAT problems studied in practice. Moreover, due to the connection between sign-symmetric constraint languages and pSDI-operations, understanding the inclusion structure between sign-symmetric constraint languages is tantamount to describing the expressive power of pSDI-operations. Even better, pSDI-operations can in many cases be understood as the partial analouges of well-studied operations such as Maltsev operations, NU-operations and edge-operations, making them easier to reason with. The main open question is whether our results can be strengthened into a dichotomy for sign-symmetric SAT problems. One direction is already clear: if Γ is not preserved by any k-universal operation then SAT(Γ) is SETH-hard and does not admit an improved algorithm without breaking the SETH. The other direction is harder and requires a substantially better understanding of languages invariant under a given k-universal operation; such languages include, but are not limited to, relations expressible as roots of polynomial equations of degree at most k + 1, where an improved algorithm is known [42]. It is not clear at this point how much richer the set Inv(uk ) is, compared to this class of problems. Existing (conjectured) lower bounds against polynomial-time problems captured by abstract Inv(p)-problems also indicate that the problem might be more difficult for remaining cases. We also proved that the SAT problems under consideration admit lower bounds under the SETH. To the best of our knowledge, this is the first result showcasing both a non-trivial upper bound and a concrete lower bound under the SETH in terms of a natural parameter n. These bounds were obtained in the extension oracle setting and it is currently unclear if matching bounds can also be obtained if constraints are represented explicitly. The padding construction is still valid in this setting, but it is a challenge to apply it without creating constraints with exponentially many tuples. Last, our approach easily extends to finite-domain CSPs, as evidenced by the improved algorithms for 2-edge-CSP and 3-NU-CSP. The notion of a pSDI-operation is only relevant in the Boolean domain, but a similar notion can likely be defined for arbitrary finite domains. For example, instead of self-duality, essentially meaning that the partial operation is closed under negation, we would require that the operation is closed under every unary operation over the domain. However, it is not clear if the inclusion structure of such generalized pSDI-operations can be characterized in a similar hierarchy as the Boolean pSDI-operations. 10 2 Preliminaries A k-ary relation over a domain D is a subset of D k . If t = (x1 , . . . , xn ) is a k-ary tuple we for every 1 ≤ i ≤ k let t[i] = xi , and if i1 , . . . , ik′ ∈ [k] = {1, . . . , k} we write Proji1 ,...,ik′ (t) = (t[i1 ], . . . , t[ik′ ]) for the projection of t on the coordinates i1 , . . . , ik′ . This notation easily extends to relations and we write Proji1 ,...,ik′ (R) for the relation {Proji1 ,...,ik′ (t) | t ∈ R}. A set of relations is called a constraint language, or simply a language, and will usually be denoted by Γ and ∆. We will typically define relations either by their defining logical formulas or by their defining equations. For example, the relation R1/3 = {(0, 0, 1), (0, 1, 0), (1, 0, 0)} may be defined by the expression R1/3 ≡ x1 + x2 + x3 = 1. However, we will not always make a sharp distinction between relations and their defining logical formulas and will sometimes treat e.g. a k-clause as a relation. We write ar(R) for the arity of a relation R, and use the notation EqD to denote the equality relation {(x, x) | x ∈ D} over D. A k-ary relation R is said to be totally symmetric, or just symmetric, if there exists a set S ⊆ [k] = {1, . . . , k} such that (x1 , . . . , xk ) ∈ R if and only if x1 + . . . + xk ∈ S. For example, R1/3 is totally symmetric as witnessed by the set S = {1}. Symmetric relations will prove to be useful since it is sometimes considerably simpler to describe the symmetric relations invariant under a partial operation. 2.1 The parameterized SAT and CSP Problems Let Γ be a Boolean constraint language. The parameterized satisfiability problem over Γ (SAT(Γ)) is the computational decision problem defined as follows. Instance: A set V of variables and a set C of constraint applications R(v1 , . . . , vk ) where R ∈ Γ, ar(R) = k, and v1 , . . . , vk ∈ V . Question: Is there a function f : V → {0, 1} such that (f (v1 ), . . . , f (vk )) ∈ R for each R(v1 , . . . , vk ) in C? The constraint satisfaction problem over a constraint language Γ (CSP(Γ)) is defined analogously with the only distinction that Γ is not necessarily Boolean. We write (d, k)-CSP for the CSP problem over a domain with d elements where each constraint has arity at most k. 2.2 The extension oracle model Recall from Section 1.2 that we consider two distinct representations of SAT and CSP instances. We now define these in more detail. In the first representation each relation R occurring in a constraint R(x1 , . . . , xk ) is represented as a list of tuples. We call this representation the explicit representation. This is one of the most frequently occurring representation methods in the algebraic approach to CSP, but it is fair to say that it is not convenient in any practical application since a relation may contain exponentially many tuples with respect to the number of arguments. We therefore consider a more implicit representation where each constraint is represented by a procedure which can verify whether a partial assignment of its variables is consistent with the constraint. Definition 7. Let R be an n-ary relation over a set D. A computable function which given indices ′ i1 , . . . , in′ ∈ [n] and t ∈ Dn answers yes if and only if t ∈ Proji1 ,...,in′ (R) is called an extension oracle representation of R. Hence, given a constraint R(x1 , . . . , xn ) and a partial truth assignment f : X → D, X ⊆ {x1 , . . . , xn }, the extension oracle representation can be used to decide whether f can be completed into a satisfying assignment of R(x1 , . . . , xn ). Example 8. CNF-SAT can be succinctly represented in the extension oracle model. Consider e.g. a positive clause (x1 ∨ . . . ∨ xn ) and a partial truth assignment f on {x1 , . . . , xn }. We can then answer yes if and only if not every variable xi occurring in the clause is assigned the value 0. 11 2.3 Sign-symmetric constraint languages An n-ary sign pattern is an tuple s where s[i] ∈ {+, −} for each 1 ≤ i ≤ n. If t is an n-ary Boolean tuple and s an n-ary sign pattern then we let ts be the tuple where ts [i] = t[i] if s[i] = + and ts [i] = 1 − t[i] if s[i] = −. Similarly, if if R is a Boolean relation and s an n-ary sign pattern we by Rs denote the relation {ts | t ∈ R}. Last, for 1 ≤ i ≤ n and c ∈ {0, 1} we let Ri=c = {t | t ∈ R, t[i] = c} be the relation resulting from freezing the ith argument of R to c. Definition 9. A Boolean constraint language Γ is said to be sign-symmetric if (1) Rs ∈ Γ for every n-ary R ∈ Γ and every n-ary sign pattern s and (2) Ri=c ∈ Γ for every c ∈ {0, 1} and every 1 ≤ i ≤ n. 2.4 Partial polymorphisms and quantifier-free primitive positive definitions Let D be a finite set of values. A k-ary partial operation, or a partial function, f over D is a mapping X → D where X ⊆ Dk . The set X is said to be the domain of f and we let domain(f ) = X denote this set and ar(f ) = k denote the arity of f . If f and g are two n-ary partial operations over D such that domain(g) ⊆ domain(f ) and g(x1 , . . . , xn ) = f (x1 , . . . , xn ) for every (x1 , . . . , xn ) ∈ domain(g) then g is said to be a subfunction of g. For n ≥ 1 the i-ary projection, 1 ≤ i ≤ n, is the operation πin (x1 , . . . , xi , . . . , xn ) = xi and a partial projection is any subfunction of a total projection. If R is an n-ary relation over D and f a k-ary partial operation over D we say that f is a partial polymorphism of R, that R is invariant under f , or that f preserves R, if f (t1 , . . . , tk ) ∈ t or f (t1 , . . . , tk ) is undefined, for each sequence of tuples t1 , . . . , tk . We let pPol(R) be the set of all partial polymorphisms of the relation R, and if Γ is a constraint language we let pPol(Γ) denote the set of partial operations preserving each relation in Γ. The notion of a total polymorphism can be defined simply by requiring that f is total, i.e., domain(f ) = D k , and we let Pol(Γ) be the set of all total polymorphsims of the constraint language Γ. Similarly, if P is a set of partial operations we let Inv(P) be the set of all relations invariant under P . Each set of partial operations P naturally induces a SAT problem SAT(Inv(P)) where each relation involved in a constraint is preserved by every partial operation in P . Recall from Section 1.2 that we as a shorthand denote this problem by Inv(P)-SAT. The two operators Inv(·) and pPol(·) are related by the following Galois connection. Theorem 10 ([21, 47]). Let Γ and ∆ be two constraint languages. Then Γ ⊆ Inv(pPol(∆)) if and only if pPol(∆) ⊆ pPol(Γ). The applicability of partial polymorphism in the context of fine-grained time complexity might not be evident from these definitions. However, sets of the form Inv(P), called weak systems or weak co-clones, are closed under certain restricted first-order formulas which are highly useful in this context. Say that a k-ary relation R has a quantifier-free definition (qfpp-definition) over a constraint language Γ over a domain D if R(x1 , . . . , xk ) ≡ R1 (x1 ) ∧ . . . ∧ Rm (xm ) where each Ri ∈ Γ ∪ {Eq D } and each xi is a tuple of variables of length ar(Ri ). It is then known that Inv(P) for any set of partial operations P is closed under taking qfpp-definitions. With this property the following theorem is then a straightforward consequence. Theorem 11. [31] Let Γ and ∆ be two finite constraint languages. If pPol(Γ) ⊆ pPol(∆) then there exists a polynomial-time many-one reduction from SAT(∆) to SAT(Γ) which maps an instance (V, C) of SAT(∆) to an instance (V ′ , C ′ ) of SAT(Γ) where |V ′ | ≤ |V | and |C ′ | ≤ c|C|, where c depends only on Γ and ∆. In particular this implies that if CSP(Γ) is solvable in O(cn ) time and pPol(Γ) ⊆ pPol(∆) then CSP(∆) is solvable in O(cn ) time, too. We will now briefly describe the closure properties of pPol(Γ), which are usually called strong partial clones. First, if f, g1 , . . . , gm ∈ pPol(Γ) where f is m-ary and each gi is n-ary, then the composition f ◦ g1 , . . . , gm (x1 , . . . , xn ) = f (g1 (x1 , . . . , xn ), . . . , gm (x1 , . . . , xn )) is also included 12 in pPol(Γ). This operation will be defined on a tuple (x1 , . . . , xn ) ∈ D n if and only if each gi (x1 , . . . , xn ) is defined and the resulting application over f is defined. Second, pPol(Γ) contains every partial projection, which is known to imply that pPol(Γ) is closed under taking subfunctions (i.e., if f ∈ pPol(Γ) then every subfunction of f is included in pPol(Γ)). If P is a set of partial operations we write [P ]s = pPol(Inv(P)) for the smallest strong partial clone containing P . 2.5 Polymorphism patterns In this section we describe a method for constructing partial polymorphisms that have a strong connection to the sign-symmetric constraint languages defined in Section 2.3. As a shorthand we will sometimes denote the k-ary constant tuple (d, . . . , d) by dk . Definition 12. Let f be a Boolean partial operation. We say (1) that f is self-dual if x ∈ domain(f ) for every x ∈ domain(f ) and f (x) = 1 − f (x), where x denotes the complement of the tuple x, and (2) that f is idempotent if dk ∈ domain(f ) and f (dk ) = d for every d ∈ D. In the sequel, we will call a Boolean partial operation which is both self-dual and idempotent a pSDIoperation, short for partial, self-dual, and idempotent operation. Let a polymorphism pattern of arity r be a set of pairs (t, x) where t is an r-ary tuple of variables and where x occurs in t. We say that a r-ary partial operation f over a set of values D satisfies an r-ary polymorphism pattern P if domain(f ) = {(τ (x1 ), . . . , τ (xr )) | ((x1 , . . . , xr ), x) ∈ P, τ : {x1 , . . . , xr } → D} and f (τ (x1 ), . . . , τ (xr )) = τ (x) for every ((x1 , . . . , xr ), x) ∈ P and every τ : {x1 , . . . , xr } → D. A Boolean operation is pSDI if and only if it satisfies a polymorphism pattern. To see this, note that if f is pSDI, then it is easy to create a polymorphism pattern P by letting each tuple t ∈ domain(f ) such that f (t) = 0 correspond to an entry in P . Similarly, it is not difficult to show that any partial operation satisfying a polymorphism pattern must be self-dual and idempotent. We then have the following link between sign-symmetric constraint languages and partial operations satisfying polymorphism patterns. Theorem 13. [38] Let f be a pSDI-operation. Then Inv(f) is sign-symmetric. Hence, pSDI-operations provide a straightforward way to describe broad classes of sign-symmetric constraint languages. It is also known that if Γ is sign-symmetric and SAT(Γ) is NP-hard, then every partial polymorphism of Γ is a subfunction of a pSDI-operation preserving Γ [38][Theorem 3] (see Lagerkvist [34] for a full proof). We will now define the pSDI-operations that will play a central role in our current pursuit. Definition 14. Let k ≥ 2. A (k+1)-ary partial operation is a partial k-edge operation if it satisfies the pattern consisting of ((x, x, y, y, y, . . . , y, y), y), ((x, y, x, y, y, . . . , y, y), y), and for each i ∈ {4, . . . , k + 1}, the tuple ((y, . . . , y, x, y, . . . , y), y), where x appears in position i. We will typically denote partial k-edge operations by ek , and, if the underlying set D is important, by eD . k A partial 2-edge operation will sometimes be called a partial Maltsev operation. Definition 15. Let k ≥ 3. A k-ary partial operation is a partial k-ary near-unanimity operation (partial kNU operation) if it satisfies the pattern which for each i ∈ {1, . . . , k} contains ((x, x, . . . , x, y, x, . . . , x), x), where y occurs in position i. We write nuD k to denote this operation over the domain D, and nuk if the domain is clear from the context, or not relevant. Ternary partial NU-operations will sometimes be called partial majority operations. Note that the partial majority operation is total in the Boolean domain but is properly partial for every larger domain. Last, we define the following class of self-dual partial operations. Say that the argument i of a k-ary partial operation f is redundant if there exists j 6= i such that t[i] = t[j] for every t ∈ domain(f ). 13 Subset Sum Linear Equations 1-in-k SAT Sidon Sets Degree-2 Polynomials 2-edge = 2-universal 2-SAT (d, 2)-CSP Graph k-Clique 3-NU 3-edge 3-universal 3-SAT (d, 3)-CSP (3, ℓ)-Hyperclique 4-NU 4-edge 4-universal ... ... ... k-NU k-edge k-universal (k − 1)-SAT (d, k − 1)-CSP (k − 1, ℓ)-Hyperclique Degree-3 Polynomials Degree-(k − 1) Polynomials Figure 1: The inclusion structure between selected minimal pSDI-operations (solid outlines), and some problems that reduce to the corresponding SAT or CSP problem (dotted outlines). Several classes on each level k ≥ 3 have been omitted. Definition 16. Let k ≥ 2. The k-universal operation uk is the Boolean (2k − 1)-ary pSDI-operation defined on 2k +2 tuples such that (1) uk is not a partial projection and (2) uk does not have any redundant arguments. While not immediate from the definition, the operation uk is in fact unique up to permutation of arguments. To see this, simply take the k non-constant tuples t1 , . . . , tk ∈ domain(uk ) such that uk (t1 ) = . . . = uk (tk ) = 0. Since uk is not a projection and is pSDI, it follows that there cannot exist i ∈ [2k − 1] such that (t1 [i], . . . , tk [i]) = 0k . Hence, since uk does not have any redundant arguments, there for every t ∈ {0, 1}k \ {0k } must exist a unique i ∈ [2k − 1] such that (t1 [i], . . . , tk [i]) = t. Last, we remark that there is a connection between our notion of polymorphism patterns and the operations studied in connection to the CSP dichotomy (see e.g. the survey by Barto et al. [3]). In technical terms polymorphism patterns essentially matches strong Maltsev condititions where the right-hand side is restricted to a single variable. Similar restrictions, called height-1 identities, have been considered earlier and it is known that the complexity of a CSP(Γ) problem only depends on the height-1 identities satisfied by the operations in Pol(Γ) [33]. 3 Structure of Constraint Languages under Minimal Restrictions We now properly begin the first part of the paper, investigating the structure of maximally expressive, yet restricted sign-symmetric constraint languages. This investigation is performed via the study of the weakest non-trivial pSDI-operations, including the operations defined in Section 2.5. As a preview of the structure, and of some of the included problems, we refer to Figure 1. The problem and language inclusions illustrated in this figure will be shown across the next two subsections. More precisely, by “weakest” pSDI-operations, we mean partial operations that are minimal in the following sense. Recall that for every pSDI-operation f and every subfunction f ′ of f , we have Inv(f) ⊆ Inv(f ′ ). This motivates the following definition. 14 Definition 17. Let f be a pSDI-operation. We say that f is trivial if it is a subfunction of a projection, and a minimal non-trivial pSDI-operation if f is non-trivial but every proper subfunction f ′ of f which is a pSDI-operation is trivial. Our study in this section is focused on constraint languages Γ = Inv(f) where f is a single minimal non-trivial pSDI-operation, since these are the most expressive sign-symmetric constraint languages that are still restricted in expressive power. We begin by giving some examples for the particular classes of k-NU, k-edge and k-universal partial operations defined in Section 2.5. 3.1 Properties of specific sign-symmetric constraint languages In this section, we provide some illustrative examples of languages included in Inv(f) for particular pSDIoperations f . We first recall the following result from Lagerkvist & Wahlström. Theorem 18. [37] Let F be a finite set of partial operations such that Inv(F)-SAT is NP-complete. Then any n-ary Boolean relation has a pp-definition over Inv(F) using at most O(n) existentially quantified variables. In effect, this implies that any constraint language Inv(F), where F is a finite set of pSDI-operations, cn is extremely expressive. One direct consequence is that Inv(F) contains at least 22 n-ary relations for some constant 0 < c ≤ 1. This makes such constraint languages markedly different from finite constraint languages, since for any finite constraint language Γ, the number of n-ary qfpp-definable relations over Γ is bounded by O(2p(n) ) for a polynomial p depending on Γ. This also implies that there cannot exist a finite Γ such that pPol(Γ) = [F]s . In fact, the relations of Inv(F) for such an F are dense enough that for any n-ary relation R, a random padding of R by O(n) parity-check variables is enough to create a variable in Inv(F) with high probability. This fact will be exploited in Section 5.3. Despite this, we will see that the pSDI-operations defined in Section 2.5 do correspond roughly to natural restrictions on the expressive power of a language Γ. We now illustrate the classes with a few examples. In the process will occasionally refer to the language inclusions illustrated in Figure 1. Proofs of these inclusions is given in Theorem 29 in Section 3.2. Let us now begin with a basic example. Lemma 19. R ∈ Inv(nuk ) for every (k − 1)-ary relation R, k ≥ 3. Proof. Let t1 , . . . , tk ∈ R be such that nuk (t1 , . . . , tk ) is defined, and for i ∈ [k − 1] let t(i) = (t1 [i], . . . , tk [i]). For every i ∈ [k − 1], either t(i) is constant or there is a single index j where t(i) [j] deviates from its other entries. By the pigeonhole principle, there is at least one index j ∈ [k] such that t(i) [j] does not deviate from the majority for any i ∈ [k − 1]. Then we have nuk (t1 , . . . , tk ) = tj . We also show a corresponding negative statement. By the inclusions shown in the next section, this will imply that a k-clause is not preserved by any operation at “level k” of the hierarchy in Figure 1. Lemma 20. Let R ⊂ {0, 1}k be a k-clause, i.e., |R| = 2k − 1, k ≥ 2. Then R is not preserved by the partial k-universal operation. Proof. By sign-symmetry, we assume that R = {0, 1}k \ {0k }. Let t1 , . . . , tk be the non-constant tuples in domain(uk ) such that uk (ti ) = 0 for each i ∈ [k]. Then for each i ∈ [2k −1], the tuple t(i) = (t1 [i], . . . , tk [i]) defines a tuple of R; thus the application k −1) uk (t(1) , . . . , t(2 ) = 0k is defined and shows that R ∈ / Inv(uk ). Next, we consider a canonical example of a useful relation preserved by the partial 2-edge operation. 15 Lemma 21. Let R(x1 , . . . , xn ) ⊆ {0, 1}n be defined via a linear equation n X αi xi = β i=1 evaluated over a finite field F. Then R ∈ Inv(e2 ). Proof. This is a special case of the notion of a Maltsev embedding of R previously investigated by the authors [36]. It is known that a relation with a Maltsev embedding is closed under a family of partial operations, of which e2 is the simplest. A particular example of such relations is the Exact SAT problem. We show that its 1-in-k relations are also not closed under nuk . s Lemma 22. Let R1/k = {(x1 , . . . , xk ) ∈ {0, 1}k | x1 + . . . + xk = 1}, and ΓXSAT = {R1/k | k ≥ 1, s is a k-ary sign-pattern}. Then ΓXSAT ⊆ Inv(e2 ) but is not preserved by nuk for any k. Proof. The positive direction follows from Lemma 21, since R1/k can be phrased as a linear equation over the integers mod p, for p ≥ k + 1. The negative direction is immediate: let R1/k = {t1 , . . . , tk }. Then nuk (t1 , . . . , tk ) is defined and equals 0k . Another example of a problem with the character of linear equations is Subset Sum. Even though an instance of Subset Sum is defined by just a single linear equation rather than as a SAT(Γ) instance, we show in Section 5.2 that the complexity of 2-edge-SAT and Subset Sum are closely connected. As for the class Inv(ek ) for k ≥ 3, the inclusions illustrated in Figure 1 imply that this class contains both relations with linear equation extensions and all (k − 1)-clauses. Finally, we show two examples for the partial k-universal operation uk . The first is a previously studied class of Lokshtanov et al. [42]. Note this problem does admit an improved algorithm. Definition 23. Let Pd denote the set of Boolean relations such that each n-ary R ∈ Pd is the set of roots of an n-variate polynomial equation where each polynomial has degree at most d. Lemma 24. Let R ∈ Pd be an n-ary relation. Then R is preserved by ud+1 , but not by any other non-trivial pSDI-operation of domain size at most 2d + 2. Proof. For the first direction, let P (x1 , . . . , xn ) be the polynomial defining R, and let t1 , . . . , tr ∈ R be such that ud+1 (t1 , . . . , tr ) = t′ is defined. Since the set of relations representable by bounded-degree polynomials is sign-symmetric, we may assume for simplicity that t′ = 1n . The tuples (t1 , . . . , tr ) define a new polynomial of degree at most d and with at most d + 1 variables, defined by identifying all pairs of variables xi and xj that have the same pattern in (t1 , . . . , tr ), i.e., if ta [i] = ta [j] for every a ∈ [r]. We also eliminate any variable xi such that tj [i] = 1 for every j ∈ [r] by replacing xi by the constant 1 in P . Let P ′ be the resulting polynomial, and let R′ be the corresponding relation. If ar(R′ ) < d + 1, then by Lemma 20 R′ is preserved by nud+1 and thus by ud+1 as well (see Theorem 29). Otherwise, for each Q I ⊂ [d + 1] let αI be the coefficient of the monomial i∈I xi in P ′ , and let χI ∈ {0, 1}d+1 be the tuple such P that χI [i] = 1 if and only if i ∈ I. Note that P ′ (χI ) = I ′ ⊆I αI ′ . We find that αI = 0 for every I. Indeed, α∅ = 0 since 0d+1 ∈ R′ ; and α{i} = 0 for every i since P ′ (χ{i} ) = α{i} + α∅ = α − {i} = 0; and so on, in order of increasing cardinality of I. Then P ′ is the constantly-zero polynomial, and 1d+1 ∈ R′ , hence t′ = 1n ∈ R. We have thus shown that relations defined as roots of polynomials of degree d are preserved by the (d + 1)-universal operation. In the other direction, the same argument will show that for any pSDI-operation f with |domain(f )| ≤ 2d+2 other than the (d+1)-universal operation, it is possible to define a polynomial on (|domain(f )|−2)/2 16 variables and of degree at most d such that the corresponding relation is not preserved by f . Indeed, let n = (|domain(f ) − 2|)/2 and r = ar(f ), and let t1 , . . . , tr be tuples of arity n such that no tuple (t1 [i], . . . , tr [i]) is constant and f (t1 , . . . , tr ) = 1n is defined. If n ≤ d, then we may simply consider the Q polynomial P (x1 , . . . , xn ) = i∈[n] xi , whose corresponding relation R is not preserved by f . Otherwise, let I ⊂ [d + 1] be such that χI ∈ / {t1 , . . . , tr }; this exists since f is not the (d + 1)-universal partial operation. Let P ′ be the d + 1-variate polynomial with coefficients αJ = 0 if I 6⊆ J, and with αJ = (−1)|J|−|I| otherwise, for all J ⊂ [d + 1]. Then P ′ (tI ) = 1, and it can be verified that P ′ (tJ ) = 0 for every J ⊂ [d + 1], J 6= I, whereas P ′ (1d+1 ) = −(−1)d+1−|I| . Hence the relation corresponding to P ′ is not preserved by f. Finally, we give one example of a symmetric relation in Inv(u3 ) that has no obvious connection to roots of polynomials. A Sidon set is a set S ⊆ {0, . . . , n} in which all sums i + j, i, j ∈ S are distinct. Lemma 25. Let S ⊆ {0, . . . , n} be a Sidon set, and define a relation R(x1 , . . . , xn ) ⊆ {0, 1}n as n X R(x1 , . . . , xn ) ≡ ( i=1 xi ∈ S). Then R is preserved by u3 . Proof. Assume that there exists t1 , . . . , t7 ∈ R such that u3 (t1 , . . . , t7 ) = t ∈ / R. For i ∈ [n], let xi = (t1 [i], . . . , t7 [i]) be the tuple of values taken by argument i of R in these tuples. Then the tuples xi take up to 8 different values, partitioned as two constant tuples and three pairs of complementary tuples. Let Xj for j = 1, 2, 3 be the set of arguments i ∈ [n] such that the tuple xi belongs to the j:th of these pairs, and let nj be the difference in Hamming weight compared to t if flipping all values belonging to Xj . Let W be the Hamming weight of t. Then S contains the values W + n1 , W + n2 , W + n1 + n3 and W + n2 + n + 3, forming two pairs of weights with common difference n3 . Since n3 6= 0, we must have n1 = n2 . By symmetry, we have n1 = n2 = n3 . But then S contains the values W + n1 , W + n1 + n2 = W + 2n1 , and W + n1 + n2 + n3 = W + 3n1 , which is a contradiction. Thus nj = 0 for at least one j, hence W ∈ S and t ∈ R, contradicting the original assumption. 3.2 Structure of minimal non-trivial pSDI-operations Note that if f is a pSDI-operation, then |domain(f )| = 2k + 2 for some k, since f is defined on the two constant tuples and since the tuples of the domain can be paired up as (t, t) where t is the complement of t. Hence, we define the level of a minimal non-trivial pSDI operation f as (|domain(f )| − 2)/2. We find no examples on level 0 or 1, and the only non-trivial example on level 2 is the 2-edge operation. At each level k ≥ 3 the partial k-NU and k-universal operations are the unique strongest and weakest minimal non-trivial pSDI-operation, respectively, whereas the k-edge operation is intermediate. This structure is also illustrated in Figure 1. We also find that the k-universal operations uk are maximally weak in the sense that any non-trivial pSDI-operation with a domain of size 2k + 2 can define uk . We begin with the following lemma, which formalizes one of the main methods of constructing a (k + 1)-ary partial operation from a k-ary partial operation. We refer to g as an argument padding of f . Lemma 26. Let f be a k-ary partial operation and let g be a (k + 1)-ary partial operation such that (1) Proj1,...,k (domain(g)) = domain(f ) and (2) f (x1 , . . . , xk ) = g(x1 , . . . , xk , xk+1 ) for every (x1 , . . . , xk , xk+1 ) ∈ domain(g). Then g ∈ [f ]s . Proof. Let f and g be as in the statement, and first construct the (k + 1)-ary partial operation f ′ (x1 , . . . , xk , xk+1 ) = f (π1k+1 (x1 , . . . , xk , xk+1 ), . . . , πkk+1 (x1 , . . . , xk , xk+1 )). 17 Clearly, f ′ ∈ [f ]s , since it is a composition of f and the projections π1k+1 , . . . , πkk+1 , and it is not difficult to see that Proj1,...,k (domain(f ′ )) = domain(f ) and that g can be obtained as a subfunction of f ′ . Since [f ]s is closed under taking subfunctions it follows that g ∈ [f ]s . The following will aid us in reasoning about minimal non-trivial pSDI-operations. Lemma 27. Let f be a pSDI-operation with |domain(f )| = 2k + 2, k ≥ 3. Then f is a minimal non-trivial operation if and only if f is an argument padding of nuk . Proof. In the one direction, assume that f is a padding of nuk . It is not hard to verify that every subfunction f ′ of f which is pSDI is a partial projection, and that f is non-trivial. Thus, f is minimal non-trivial. In the other direction, assume that f is minimal and non-trivial, and let r = ar(f ). Let t1 , . . . , tk be the non-constant tuples such that f (t1 ) = 0 is defined. For each i ∈ [k], let ji ∈ [r] be such that making f undefined on ti and its complement ti leaves a subfunction of πjri . It follows that for all a ∈ [k], ta [ji ] 6= 0 if and only if a = i. Then the arguments j1 , . . . , jk of f define the partial k-NU operation, and f is a padding of it. Our claims about the weakest and strongest operations follows from this. Lemma 28. The following hold. 1. The unique non-trivial non-total pSDI-operation at level k < 3 is the partial 2-edge operation. 2. For any minimal non-trivial pSDI-operation f at level k ≥ 3, we have Inv(nuk ) ⊆ Inv(f) ⊆ Inv(uk ). k −k−1 3. There are at most 22 distinct minimal non-trivial pSDI-operations at level k. Proof. 1. It is easy to verify that no non-trivial operation is possible on level 1. Let f be a non-trivial pSDI-operation on level 2, and let t1 , t2 ∈ domain(f ) be the non-constant tuples such that f (t1 ) = 0. Consider the options for the pairs (t1 [i], t2 [i]) for i ∈ [ar(f )]. If two distinct positions i, i′ give identical pairs, then t[i] = t[i′ ] for every t ∈ domain(f ) and i and i′ are redundant arguments in f , which we may assume does not occur. If t1 [i] = t2 [i] = 0 for some i ∈ [ar(f )] then f is a partial projection. This leaves three possible arguments, and unless all three exist, f will be a total operation. The remaining case is that f = e2 . 2. By Lemma 27 f is a padding of nuk , which provides the first inclusion. For the second, we may assume that f has no redundant arguments, since otherwise f is equivalent to an operation with fewer arguments. But then by design, uk is a padding of f , and the second inclusion follows. 3. By Lemma 27, we can restrict our attention to paddings of nuk . Since f is a pSDI-operation, it is defined by the values of the k non-constant tuples t in the domain with f (t) = 0. Let t1 , . . . , tk be those tuples, and for i ∈ [ar(f )] let t(i) = (t1 [i], . . . , tk [i]). As above, we may assume that t(i) 6= t(j) for all distinct i, j ∈ [ar(f )]. This leaves at most 2k possible arguments. Furthermore, t(i) cannot be all-zero unless f is a partial projection, and k arguments are determined by nuk . This leaves 2k − k − 1 arguments, whose presence or absence defines f . The inclusion structure between the k-NU, k-edge and k-universal partial operations are now straightforward to prove with these results. Theorem 29. Let k ≥ 3. Then the following inclusions hold. 1. Inv(e2 ) ⊂ Inv(ek ), 2. Inv(nuk ) ⊂ Inv(ek ) ⊂ Inv(uk ), 18 3. Inv(nuk ) ⊂ Inv(nuk+1 ), 4. Inv(ek ) ⊂ Inv(ek+1 ), and 5. Inv(uk ) ⊂ Inv(uk+1 ). Proof. For the inclusions, the second item follows from Lemma 28, and every other inclusion follows from Lemma 26. Indeed, it is readily verified that for every k ≥ 3, ek is an argument padding of ek−1 and nuk+1 is an argument padding of nuk . For the universal operations, let t1 , . . . , tk+1 be the non-constant tuples of domain(uk+1 ) such that uk+1 (ti ) = 0, i ∈ [k + 1]. Then the tuples t(i) = (t1 [i], . . . , tk+1 [i]), i ∈ [2k+1 − 1] spell out all (k + 1)-tuples except 0k+1 , without repetition. Consider the subset I ⊂ [ar(uk+1 )] consisting of indices i such that tk+1 [i] = 0. Note that t(i) for i ∈ I enumerates all k-tuples except 0k , padded with a 0. It follows that ProjI (uk+1 ) = domain(uk ) and that uk+1 is an argument padding of uk . By Lemma 26 the inclusion follows. To show that the inclusions are strict, consider the following: a k-clause is preserved by nu k+1 (Lemma 19) but not by uk (Lemma 20); a 1-in-k constraint is preserved by e2 but not by nuk (Lemma 22); and the language Pk−1 of roots of polynomials of degree at most k − 1 is preserved by uk but not by any other operation on level k by Lemma 24. Finally, we have an easy consequence in more general terms. Corollary 30. Let f be a pSDI-operation with |domain(f )| = 2k + 2. Then Inv(f) ⊆ Inv(uk ). Proof. Let f ′ be an arbitrary minimal pSDI-operation that is a subfunction of f . Then f ′ belongs to some level k′ ≤ k, hence Inv(f) ⊆ Inv(uk′ ) ⊆ Inv(uk ) by Lemma 28 and Theorem 29. 3.3 Complementary consequences We now consider some dual questions, i.e., what consequences can we (in general) draw from the information that some sign-symmetric language Γ is not preserved by f , for some pSDI-operation f ? We begin with an easy result, which forms the building block of later results. Lemma 31. Let Γ be a sign-symmetric language which is not preserved by nuk , for some k ≥ 3. Then Γ can qfpp-define a k-ary symmetric relation R such that R does not contain tuples of weight 0, but does contain tuples of weight 2. Proof. Let k ≥ 3 be an arbitrary constant, and let R ∈ Γ be a relation not preserved by nuk of some arity n = ar(R). Let t1 , . . . , tk ∈ R be witnesses to this, i.e., t = nuk (t1 , . . . , tk ) is defined and t ∈ / R. Define t(i) = (t1 [i], . . . , tk [i]). By sign-symmetry, we may assume that t = 0n . Furthermore, if there is an argument i ∈ [n] such that t(i) = 0k , then we can find a smaller counterexample by fixing argument i of R to be constantly 0. Thus, for every i ∈ [n], the tuple t(i) now contains precisely one non-zero value. Let us define a new relation R′ (x1 , . . . , xk ) of arity k by identifying arguments according to this, i.e., for every position i ∈ [n] such that t(i) is non-zero in position j ∈ [k], insert variable xj in position i in R. Additionally define R′′ as the result of the conjunction of all k! applications of R′ with permuted argument order. Then R′′ is a symmetric relation which contains all tuples of weight 1 but none of weight 0. Thus, Γ qfpp-defines a relation Rk = R′′ as described of every arity k ≥ 3. By a similar strategy, we have an important result about languages not preserved by the k-universal operation. 19 Lemma 32. Let Γ be a sign-symmetric language not preserved by uk for some k ≥ 2. Then Γ can qfpp-define all k-clauses. Proof. Let R ∈ Γ be a relation not preserved by uk , and let n = ar(R) and r = 2k − 1 be the arity of uk . Let t1 , . . . , tr ∈ R be such that uk (t1 , . . . , tr ) = t is defined and t ∈ / R. By sign-symmetry of Γ, we may assume t = 0n . Create a new relation by identifying all variables xi and xj in R(x1 , . . . , xn ) for which ta [i] = ta [j] for every a ∈ [r]. Also assume that there is no variable xi such that ta [i] = 0 for every a ∈ [r], or else replace xi by the constant 0 in R (again by sign-symmetry). This defines a new relation R′ of arity at most k. Since t ∈ / {t1 , . . . , tr }, we find that R′ has arity precisely k and contains every possible k-tuple except 0k , i.e., R′ qfpp-defines a k-clause. By sign-symmetry, Γ qfpp-defines all k-clauses. 3.3.1 Infinitary case Finally, we consider consequences of a language not being preserved by any operation in a family of operations. Theorem 33. Let Γ be a sign-symmetric language that is not preserved by the partial k-NU operation, for any k. Then one of the following holds. 1. Γ can qfpp-define all k-clauses for every k. 2. Γ can qfpp-define 1-in-k-clauses for every k. 3. There is a fixed prime p such that Γ can qfpp-define relations k X i=1 xi ≡ a (mod p) for every 0 ≤ a < p, of every arity k. Before we proceed with the proof, let us make a simple observation about qfpp-definitions among symmetric relations. Lemma 34. Let R be a symmetric n-ary relation, including tuples of weights S ⊆ {0, . . . , n}. Using R, we can qfpp-define symmetric relations of the following descriptions. 1. Shift down: a relation of arity n − 1 accepting values S ′ = {x − 1 | x ∈ S, x > 0}. 2. Truncate: a relation of arity n − 1 accepting values S ′ = {x ∈ S | x < n}. 3. Grouping: for any integer p > 1, a relation of arity ⌊n/p⌋ accepting values S ′ = {x′ | x′ p ∈ S}. Proof. These are implemented by, respectively, fixing an argument to 1 in R; fixing an argument to 0 in R; and grouping arguments of R in groups of size p (after truncating ar(R) to an even multiple of p). We can now show the result. Proof of Theorem 33. Let k ≥ 3 be an arbitrary constant. By Szemerédi’s theorem [54] there is a constant n = N (2k, 1/2(k +1)) such that every set S ⊆ [n] with |S| ≥ n/(2k +1) contains an arithmetic progression a, a + p, . . . of at least 2k items. Let Rn be a relation produced by Lemma 31 of arity n, and let S be the accepted weights for Rn . Say that an arithmetic progression a, a + p, . . . is complete in S if S contains all values {x ∈ {0, . . . , n} | x ≡ a (mod b)}. We consider a few cases. 20 Case: S contains an incomplete arithmetic progression with at least k items. We show that in this case, Γ can qfpp-define all k-clauses. Let a, a + p, . . . , a + (k − 1)p ∈ S be an arithmetic progression that in one direction does not continue. If a ≥ p and a − p ∈ / S, then by shifting, truncating and grouping we can P / S, then we can qfpp-define the k-ary relation ( i xi ≥ 1); in the other case, if a + kp ≤ n and a + kp ∈ P similarly qfpp-define the k-ary relation ( i xi < k). In both cases, taking closure under sign-symmetry shows that we can qfpp-define all k-clauses. This finishes this case. Case: S is sparse. Assume that |S| < n/(2k + 2) and that S contains no incomplete arithmetic progression of at least k items. By truncation, we can assume that n is an even multiple of k + 1. By self-intersecting Rn by its shifted variant, if needed repeated up to k times, we can further ensure that S contains no pairs i, i + 1, except possibly in a chain n − i, n − i + 1, . . . ending with n, while retaining that n is a multiple of k. By only doing this as many times as needed, we can be sure that there is at least one isolated weight w, 0 < w < n, such that tuples of weight w are accepted but not w − 1 or w + 1 (recall that we start with a relation with 1 ∈ S). Now partition {0, . . . , n} into windows (0, . . . , k), (k + 1, . . . , 2k + 1), . . . of length k + 1. By the density of S (which did not increase during our modifications), at least half the windows contain no elements. We may safely assume n ≥ 5k; thus there is an empty window that is not the first or the last. Let w be an isolated weight. Then by sliding the window containing w towards the internal empty window, we must eventually reach a window where there is an isolated weight which is either in position 1 or k − 1 of the window. This lets us qfpp-define either a 1-in-k-clause or a (k − 1)-in-k-clause; and in the latter case we get a 1-in-k-clause by negating all variables. Thus if S is sparse and contains no incomplete progressions of length k, we can qfpp-define a 1-in-k-clause. Case: S is dense. Finally, we assume that |S| ≥ n/(2k + 2) but does not contain any incomplete progressions of length k. By Szemerédi’s theorem, S contains at least one complete progression {x | 0 ≤ x ≤ n, x ≡ a (mod p)} for some a and p, with at least 2k entries (i.e., (2k−1)p ≤ n). Let Rn−i be the (n−i)−(k−1)p ary relation produced by shifting Rn i steps down and consider the relation Rn′ = Rn ∧ Rn−p ∧ . . . ∧ Rn −i of arity n − (k − 1)p, with applications of Rn and Rn padded with zeroes as necessary. Then Rn′ is the union of complete progressions with difference p, since every weight w accepted by Rn′ corresponds to a progression of length k in S. Furthermore, the same holds for any constant shift Rn′−i of Rn′ , i < p. Note that Rn′ still has arity at least pk. Let A ⊆ {0, . . . , p − 1} be the weights a such that Rn′ contains the complete progression with offset a. Note that 0 ∈ / A. By shifting and self-intersecting we can reduce to the case that |A| = 1, i.e., the remaining P relation is equivalent to ( xi ≡ a (mod p)) for some a and p. If p ≥ k, then clearly Rn′ qfpp-defines a 1-in-k relation by further shifting and truncation. Thus, if the difference p of the relations produced this way can grow without bound, then Γ qfpp-defines 1-in-k relations of all arities k. Otherwise, if none of the above cases applies infinitely often, then there is a fixed p such that this P process produces relations ( xi ≡ a (mod p)) of infinitely many arities k, which leads to the last case in the theorem. Assume we are in this case. If p is not a prime, we fix a prime p′ that divides p, and let a′ = a mod (p/p′ ). Shift the relation down by a′ and group the variables into blocks of size p/p′ . Then the P remaining relation is equivalent to ( i xi ≡ a′′ (mod p)′ ) for some a′′ . By shifting, and by starting from a sufficiently large relation with period p′ , we can produce all relations as in the last case in the theorem. Finally, we note that since k-clauses can qfpp-define the other two kinds of clauses, the same statement holds with only 1-in-k clauses and the counting relations mod p. Section summary. In summary of this section, towards the purpose of discussing sign-symmetric languages Γ such that SAT(Γ) does, or does not, admit an improved algorithm under SETH, we conclude the following. Recall that ΓkSAT denotes the language of all k-clauses. We find that ΓkSAT is preserved by every minimal 21 operation on level k′ > k (in particular, by nuk+1 ); not preserved by any operation on a level k′ ≤ k; and that any sign-symmetric language Γ which is not preserved by the k-universal partial operation uk can qfpp-define ΓkSAT. Assuming SETH, the minimal non-trivial pSDI-operations that preserve Γ therefore appear to be reasonable proxies for the complexity of SAT(Γ). Finally, for each level k, there is a language – namely the language of roots of polynomials of degree less than k – which is preserved by uk but not by any other operation at level k′ ≤ k, and which does admit an improved algorithm [42]. This shows that any “dichotomy” characterizing sign-symmetric languages Γ for which SAT(Γ) admits an improved algorithm under SETH, cannot require a minimal non-trivial pSDI-operation other than uk for some k. It remains to show that these very mild restrictions, of requiring only the presence of a single non-trivial pSDI-operation f preserving Γ, can be powerful enough to ensure that SAT(Γ) admits an improved algorithm. This is our topic of study for the next section. 4 Upper bounds for sign-symmetric satisfiability problems In this section, we consider the feasibility of designing an improved algorithm directly for Inv(f)-SAT and Inv(f)-CSP for a minimal non-trivial pSDI-operation f , i.e., an improved algorithm that only uses the abstract properties guaranteed by such an operation f . We show this unconditionally for f = e2 and for f = nu3 , over arbitrary finite domains (where the latter result is only interesting for the non-Boolean case, since the Boolean case is in P). The algorithms for these cases use, respectively, a Subset Sum-style meet-in-the-middle algorithm and fast matrix multiplication over exponentially large matrices. These algorithms all work in the extension oracle model. We also show conditional or partial results. We show two conditional results for partial k-NU operations, showing that k-NU-CSP admits an improved algorithm in the oracle model if the (k, k − 1)-hyperclique problem admits an improved algorithm, and that k-NU-SAT admits an improved algorithm in the explicit representation model if the Erdős-Rado sunflower conjecture [18] holds for sunflowers with k sets. The first of these results is a direct generalisation of the matrix multiplication strategy; the second uses fast local search in the style of Schöning [52]. Finally, we also consider the symmetric special case of 3-edge-SAT, and show that this problem reduces to a problem of finding a unit-coloured triangle in an edge-coloured graph. This, in turn, follows from fast algorithms for sparse triangle detection. Several of the algorithms we reduce to have a running time that depends on the matrix multiplication exponent ω; the best currently known value is ω < 2.373 [39, 55]. Before we begin, we need the following lemma, which shows that if a relation is preserved by a pSDIoperation, then it is possible to view the relation as a relation of smaller arity over a larger domain, which is preserved by the corresponding partial operation over the larger domain. Lemma 35. Let R be an n-ary relation over a set of values D, P a polymorphism pattern, and f a partial operation preserving R and satisfying P . Let I1 . . . , Im be a partition of [n], and RI1 ,...,Im the m-ary relation RI1 ,...,Im = {(ProjI1 (t), . . . , ProjIm (t)) | t ∈ R} over the set of values {ProjI1 (R) ∪ . . . ∪ Proj(Im )(R)}. Then every partial operation f ′ satisfying P over {ProjI1 (R) ∪ . . . ∪ Proj(Im )(R)} preserves RI1 ,...,Im Proof. Let k = ar(f ′ ) = ar(f ). Let t1 , . . . , tk ∈ R and let t′1 , . . . , t′k ∈ RI1 ,...,Im be the corresponding tuples of RI1 ,...,Im . Assume that f ′ (t1 , . . . , tk ) is defined, i.e., (t1 [j], . . . , tk [j]) ∈ domain(f ′ ) for each j ∈ [k]. Let i ∈ [n] and let Ij be the index set such that i ∈ Ij . Since f ′ (t1 [j], . . . , tk [j]) is defined it must be an instantiation of a tuple p ∈ P . It follows that (t′1 [i], . . . , t′k [i]) must be an instantiation of p as well, implying that f (t′1 [i], . . . , t′k [i]) is defined. Hence, f ′ preserves RI1 ,...,Im . 22 n 4.1 An O ∗ (|D| 2 ) algorithm for 2-edge-CSP Given a binary relation R one can construct a bipartite graph where two vertices x and y have an edge between them if and only if (x, y) ∈ R. Formally, the vertices V1 ∪ V2 of this graph will consist of the disjoint union of Proj1 (R) and Proj2 (R), i.e., V1 = {(1, x) | x ∈ Proj1 (R)} and V2 = {(2, x) | x ∈ Proj2 (R)}. However, whenever convenient, we will not make this distinction and instead assume that V1 = Proj1 (R) and V2 = Proj2 (R). We say that a binary relation R is rectangular if its bipartite graph representation is a disjoint union of bicliques. Lemma 36. Let φD be the partial Maltsev operation over a domain D. Then every binary relation preserved by φD is rectangular. Proof. The proof is very similar to the total case, which is essentially folklore in universal algebra. First note that R is rectangular if and only if a path of length 4 between nodes x, x′ , y, y ′ implies that there is an edge between x and y ′ . Therefore, let (x, y), (x′ , y), (x′ , y ′ ) ∈ R. But then φD ((x, y), (x′ , y), (x′ , y ′ )) = (φD (x, x′ , x′ ), φD (y, y, y ′ )) = (x, y ′ ), implying that (x, y ′ ) ∈ R since R is preserved by φD . Hence, R is rectangular. If R is an n-ary relation, I1 ∪ I2 a partition of [n], and s ∈ ProjI1 (R), t ∈ ProjI2 (R), we write s I1×I2 t to denote the n-ary tuple in R satisfying ProjI1 (s I1 ×I2 t) = s and ProjI2 (s I1 ×I2 t) = t. Let D = {d0 , d1 , . . . , dk−1 } be a finite set of values. We can then order D according to a total order <, by letting d0 < d1 < . . . < dk−1 . This order easily extends to n-ary tuples s and t over D by letting s < t if and only if there exists an i ∈ [n] such that Proj1,...,i (s) = Proj1,...,i (t) and s[i + 1] < t[i + 1]. Given a relation R we say that the tuple t is lex-min if t ∈ R and there does not exist any t′ ∈ R such that t′ 6= t and t′ < t. Lemma 37. Let R be an n-ary relation preserved by φD and let I1 ∪ I2 be a partition of [n]. Then there exists a bipartite graph (V, E) where V is the disjoint union of ProjI1 (R) and ProjI2 (R) such that 1. (V, E) is a disjoint union of bicliques, 2. {s, t} ∈ E if and only if s I1×I2 t ∈ R, 3. for every s ∈ V occurring in a biclique C1 ∪ C2 a pair s0 ∈ C1 , t0 ∈ C2 such that s0 is lex-min in C1 and t0 lex-min in C2 can be computed in O(poly(n, |D|)) time in the extension oracle model. Proof. Consider the binary relation RI1 ,I2 = {(ProjI1 (t), ProjI2 (t)) | t ∈ R} over the set of values ProjI1 (R) ∪ ProjI2 (R). By Lemma 35 this relation is preserved by φ over the larger domain, and Lemma 36 then implies that RI1 ,I2 is rectangular. Take the bipartite graph representation (V1 ∪ V2 , E) of RI1 ,I2 (which by the rectangularity property is a disjoint union of bicliques), and thus satisfies property (1). Property number (2) then follows easily from the construction of the bipartite graph (V1 ∪ V2 , E) since two vertices s and t are connected with an edge if and only if (s, t) ∈ RI1 ,I2 , which holds if and only if s I1 ×I2 t ∈ R. For property (3) we need to show that we, given s ∈ V , can compute lex-min representatives of the biclique C1 ∪ C2 containing s, in polynomial time with respect to n and |D|. Assume without loss of generality that s ∈ V1 , and order I2 in ascending order as i1 , . . . , i|I2 | . Then determine the smallest value d1 ∈ D such that s I1×{i1 } (d1 ) is included in the projection ProjI1 ∪{i1 } (R). This can be computed in polynomial time using the extension oracle. Then continue, by for each i2 , . . . , ij determine the smallest dj ∈ D such that s I1×{i1 } (d1 ) ∈ ProjI1 ∪{i1 ,...,ij } (R). Let t0 denote the resulting tuple, and observe that t0 ∈ C2 and that {s, t0 } ∈ E. We then repeat this using the index set I1 in order to obtain a lex-min tuple s0 such that {s0 , t0 } ∈ E, which again can be done in polynomial time in the extension oracle model. n Theorem 38. 2-edge-CSP is solvable in O∗ (|D| 2 ) time in both the extension oracle model and the explicit representation. 23 Proof. Let (V, C) be an instance of 2-edge-CSP, where V = {x1 , . . . , xn } and C = {C1 , . . . , Cm }. Assume without loss of generality that n is even, and let I = [ n2 ] and J = [n] \ I. Consider two sets P and Q constructed as follows. Initially we let P and Q consist of all n2 -ary tuples over D. Then, for each p ∈ P , q ∈ Q we enumerate each constraint in the instance containing only variables indexed by I or J and check whether p or q is contradicted by the constraint. If this is the case we remove p from P or q from Q. More formally, if p ∈ P and Ri (xi1 , . . . , xik ) ∈ C, k = ar(Ri ), such that {i1 , . . . , ik } ⊆ I, we check whether Proji1 ,...,ik (p) ∈ Proji1 ,...,ik (Ri ), and similarly for q ∈ Q. Each such step can be done in O(poly(k)) time in the extension oracle model and in O(k + |Ri |) time if constraints are explicitly represented. By repeating this for all elements in P and Q we will therefore obtain two sets of partial assignments that do not directly contradict individual constraints in the input instance. Next, for each p ∈ P and q ∈ Q create two m-ary tuples p′ and q ′ . By using Lemma 37 we for each constraint Ci ∈ C will associate the ith element of p′ and q ′ with a representative of the biclique corresponding to Ci , p, and q. Hence, let Ci = Ri (xi1 , . . . , xik ) ∈ C, k = ar(Ri ), be a constraint. We distinguish between two cases. First, assume that {i1 , . . . , ik } ⊆ I or that {i1 , . . . , ik } ⊆ J. In this case we for every t ∈ P ∪ Q let t′ [i] = 1. Second, assume that i1 , . . . , ik ∈ I ∪ J but that {i1 , . . . , ik } 6⊆ I and {i1 , . . . , ik } 6⊆ J. In other words the constraint contains variables indexed by members of both I and J. For every p ∈ P compute the lex-min representatives p0 and q0 of the biclique containing p, with respect to the two index sets Pi = {j | ij ∈ I} and Qi = {j | ij ∈ J}. This can be done in polynomial time via Lemma 37. Assign the ith value to the tuple p′ the value (p0 , q0 ), and then repeat this for every q ∈ Q. Let P ′ = {p′ | p ∈ P } and Q′ = {q ′ | q ∈ Q} be the sets resulting from repeating this for every constraint in the instance. We observe that the combination of p ∈ P and q ∈ Q satisfies a constraint Ri (xi1 , . . . , xik ) ∈ C if and only if p′ [i] = q ′ [i], due to property (2) in Lemma 37. Hence, the instance is n satisfiable if and only if the two sets P ′ and Q′ intersect. Since P ′ and Q′ contain at most |D| 2 tuples, each n of length m, this test can easily be accomplished in O∗ (|D| 2 ) time using standard algorithms. 4.2 An O ∗ (|D| ωn 3 ) algorithm for 3-NU-CSP The algorithm in Section 4.1 used the rectangularity property of binary relations in order to obtain an ωn improved algorithm for 2-edge-CSP. In this section we will devise an O∗ (|D| 3 ) time algorithm for 3NU-CSP by exploiting a structural property that is valid for all ternary relations preserved by nu3 . Here, ω < 2.373 is the matrix multiplication exponent. We will need the following definition. Definition 39. An n-ary relation R over D is k-decomposable if there for every t ∈ / R exists an index set I ⊆ [n], |I| ≤ k, such that ProjI (t) ∈ / ProjI (R). In the total case it is known that R is k-decomposable if R is preserved by a total k-ary NU-operation [29]. In general, this is not true for partial NU-operations, but we still obtain the following result. Lemma 40. Let R be a k-ary relation preserved by nuk . Then R is (k − 1)-decomposable. Proof. Let t be a k-ary tuple not included in R. Assume that ProjI (t) ∈ ProjI (R) for every index set I ⊆ [k], |I| < k. But then there must exist t1 , . . . , tk ∈ R such that each ti differ from t in at most one position. This furthermore implies that nuk (t1 , . . . , tk ) is defined, and therefore also that nuk (t1 , . . . , tk ) = t ∈ / R. This contradictions the assumption that nuk preserves R, and we therefore conclude that there must exist an index set I ⊆ [k] of size at most k − 1, such that ProjI (t) ∈ / ProjI (R). ωn Theorem 41. 3-NU-CSP is solvable in O∗ (|D| 3 ) time in both the extension oracle model and the explicit representation, where ω < 2.373 is the matrix multiplication exponent. 24 Proof. Let (V, C) be an instance of 3-NU-CSP where V = {x1 , . . . , xn } and C = {C1 , . . . , Cm }. Partition [n] into three sets I1 , I2 , I3 such that |Ii | = n3 (or, if this is not possible, as close as possible). Let F1 , F2 , F3 n denote the set of all partial truth assignments corresponding to I1 , I2 , I3 , and observe that |Fi | ≤ |D| 3 . First, for each partial truth assignment f ∈ Fi , remove it from the set Fi if there exists a constraint in the instance which is not satisfied by f . This can be done in polynomial time with respect to the number of constraints in the instance, using a extension oracle query for each constraint. Second, construct a 3-partite graph where the node set is the disjoint union of F1 , F2 and F3 , and add an edge between two nodes in this graph if and only if the combination of this partial truth assignment is not contradicted by any constraint in the instance. Last, answer yes if and only if the resulting graph contains a triangle. We begin by proving correctness of this algorithm and then analyse its complexity. We first claim that if the combination of f1 ∈ F1 , f2 ∈ F2 , f3 ∈ F3 does not satisfy a constraint in the instance, then there exists g1 , g2 ∈ F1 ∪ F2 ∪ F3 which do not satisfy the instance either. Hence, take a constraint R(xi1 , . . . , xik ) ∈ C, k = ar(R), which is not satisfied by the combination of f1 , f2 , f3 . Let I1′ = {j | ij ∈ I1 }, I2′ = {j | ij ∈ I2 }, and I3′ = {j | ij ∈ I3 } and consider the relation RI1′ ,I2′ ,I3′ = {(ProjI1 (t), ProjI2 (t), ProjI3 (t)) | t ∈ R} over the set of values ProjI1 (R) ∪ ProjI2 (R) ∪ ProjI3 (R). By Lemma 35 this relation is preserved by the nuk operation over the larger domain, and it then follows from Lemma 40 that this relation is 2-decomposable. But then it is easy to see that there must exist partial truth assignments y1 , y2 ∈ F1 ∪ F2 ∪ F3 such that y1 and y2 do not satisfy R(xi1 , . . . , xik ). Hence, if (V, C) is satisfiable, then there clearly exists a triangle in the 3-partite graph, and if there exists a triangle, then by following the reasoning above, the instance must be satisfiable. For the complexity, we begin by enumerating the three sets of partial truth assignments, which takes n O(|D| 3 ) time. We then remove any partial truth assignment which is not consistent with the instance, which increases this by a polynomial factor, depending only on the number of constraints and the extension queries for each constraint. Similarly, when constructing the 3-partite graph we enumerate all binary combinations of partial truth assignments from the three sets and check whether they are consistent. After this we check n nω for the existence of a triangle in the resulting graph with O(|D| 3 ) nodes, which can be solved in O(|D| 3 ) time for ω < 2.373, using fast matrix multiplication. 4.3 Strategies for k-NU-SAT It is easy to see that the strategy used in Theorem 41 extends to reducing k-NU-CSP problems to (k, k − 1)hyperclique, i.e., the problem of finding a k-vertex hyperclique in a (k − 1)-regular hypergraph. Thus we get the following. Lemma 42. Assume that (k, k − 1)-hyperclique on n vertices can be solved in time O∗ (nk−ε ) for some ε > 0. Then k-NU-CSP admits an improved algorithm in the extension oracle model, i.e., an algorithm ′ running in time O∗ (|D|(1−ε )n ) on domain size D and on n variables, for some ε′ > 0. However, it should be noted that this is a notoriously difficult problem, and there is some evidence against such results [40]. Thus, we also investigate a less general algorithm that rests on a milder assumption. 4.3.1 k-NU-SAT via local search We show that subject to a popular conjecture, k-NU-SAT admits an improved algorithm in the explicit representation model via a local search strategy. To state this we need a few basic definitions. A sunflower (with k sets) is a collection of k sets S1 , . . . , Sk with common intersection S = S1 ∩ . . . ∩ Sk , called the core, such that for every pair i, j ∈ [k], i 6= j, we have Si ∩ Sj = S. Note that we may have S = ∅. The sunflower conjecture [18], in the form we will need, states that for every k there is a constant Ck such that for every n, every collection of at least Ckn sets of cardinality n contains a sunflower with k petals. This 25 conjecture was the subject of the Polymath 10 collaborative mathematics project, but remains a notorious open problem. See Alon, Shpilka and Umans [1] for variations of the conjecture and connections to other problems. We first show a simple connection between the sunflower conjecture for sunflowers with k sets and relations R ∈ Inv(nuk ). For convenience, for a set S ⊆ [n] we denote by χnS the tuple t ∈ {0, 1}n such that for each i ∈ [n], t[i] = 1 is i ∈ S and t[i] = 0 otherwise. Lemma 43. Let R ⊂ {0, 1}n be a relation with 0n ∈ / R. Say that a tuple t = χnS is minimal in R if t ∈ R ′ n / R. For i ∈ [n], let Fi be the set of minimal tuples in R of Hamming but for every S ⊂ S we have χS ′ ∈ weight i. If R is preserved by nuk , then Fi does not contain a sunflower of k sets. Proof. Let Fi be as in the statement, and assume that R is preserved by nuk . Assume that there are distinct sets S1 , . . . , Sk forming a sunflower with some core S, such that χSj ∈ Fi for every j ∈ [k]. But then the operation nuk (χS1 , . . . χSk ) is defined, and produces the tuple χS . This contradicts that the tuples are minimal in R. We show that the sunflower conjecture is sufficient to allow an improved algorithm. Lemma 44. Assume that the sunflower conjecture holds for sunflowers with k sets, with some constant Ck . Let Γ be a sign-symmetric language preserved by nuk . Assume that for every n-ary relation R ∈ Γ and every p ∈ [n], the minimal tuples in R of Hamming weight at most p can be enumerated in time O∗ (2O(p) ). Then SAT(Γ) admits an improved algorithm. Proof. We first show that the assumptions are sufficient to allow a solution for the local search problem for SAT(Γ), in the following form. Let an instance (V, C) of SAT(Γ) with |V | = n, a tuple t ∈ {0, 1}n , and an integer p ∈ [n] be provided. We can in O∗ (2O(p) ) time decide whether there is a tuple t′ ∈ {0, 1}n with Hamming distance at most p from t that satisfies (V, C). For this, we repeatedly perform the following procedure. Verify whether the present tuple t satisfies (V, C), and if not, let R(X) be a constraint in C falsified by t, and let I ⊆ [n] be the set of indices corresponding to the set of variables X. Let s be the sign pattern such that (ProjI (t))s = 0|X| . Note that Rs ∈ Γ by assumption. We then enumerate the minimal tuples in Rs of Hamming weight at most p, and for every such tuple t′ , of weight i, let t′′ be the tuple t with bits flipped according to t′ , and recursively solve the local search problem from tuple t′′ with new parameter p − i. Correctness is clear, since the search is exhaustive (because we loop through all minimal tuples). We argue that this solves the local search problem itself in O∗ (2O(p) ) time. For the running time, assume for simplicity that producing the tuples takes O∗ (cp ) time and, for the same constant c, there are at most ci minimal tuples of weight i (by Lemma 43). Up to polynomial factors, the running time is then bounded by a recurrence T (p) = cp + p X i=1 ci T (p − i), which is bounded as T (p) ≤ (2c)p . From here on, well-known methods can be used to complete the above into an improved algorithm; cf. Schöning’s algorithm for k-SAT [52] and its derandomization [16], or even restrict the above to monotone local search instead of arbitrary local search and apply the method of Fomin et al. [20]. In particular, this is allows for an algorithm in the explicit representation model. Theorem 45. Assume that the sunflower conjecture holds for sunflowers with k sets. Then k-NU-SAT admits an improved algorithm in the explicit representation model. 26 We leave it as an open question whether access to an extension oracle (also known as an interval oracle) suffices to solve the local search problem in single-exponential time. The problem, of course, is that the bounds above only apply to the minimal tuples, and while it is easy to find a single minimal tuple using an extension oracle, it is less obvious how to test for the existence of a minimal tuple within a given interval. Meeks [43] showed how a similar result is possible, but her method would require an oracle for finding minimal satisfying tuples of weight exactly i, which is also not clear how to do. 4.3.2 k-NU-SAT and bounded block sensitivity Finally, we briefly investigate connections between the nuk partial operation and a notion from Boolean function analysis known as block sensitivity, introduced by Nisan [44]. See also the book by O’Donnell [45]. We first introduce some temporary notation. For any relation R ⊆ {0, 1}n , let fR : {0, 1}n → {0, 1} be a function defined as fR (t) = [t ∈ R], i.e., fR (t) = 1 if t ∈ R and fR (t) = 0 otherwise. For a tuple t ∈ {0, 1}n and a set S ⊆ [n], let tS denote the tuple t with the bits of S flipped. A function f : {0, 1}n → {0, 1} has block sensitivity bounded by b if for every t ∈ {0, 1}n there are at most b disjoint sets S1 , . . . , Sb ⊆ [n] such that f (tSi ) 6= f (t) for every i ∈ [b]. We show that nuk can be seen as a one-sided version of block sensitivity. Lemma 46. Let R ⊆ {0, 1}n be a relation. Then fR has block sensitivity less than k if and only if both R and its complement R := {0, 1}n \ R are preserved by nuk . Proof. In the first direction, assume that f has block sensitivity at least k. Let t ∈ {0, 1}n be a tuple and let [n] = X0 ∪ . . . ∪ Xk be a partition of [n] into blocks such that for each 1 ≤ i ≤ k, we have f (tXi ) 6= f (t). Then if f (t) = 1, then the tuples tXi form a witness that R is not preserved by nuk , and if f (t) = 0 they form a witness against R being preserved by nuk . In the other direction, let t1 , . . . , tk ∈ R be such that nuk (t1 , . . . , tk ) = t is defined and t ∈ / R. For i ∈ [k], let Xi be the positions j where t[j] 6= ti [j]. Then X1 ∪ . . . ∪ Xk forms a subpartition of [n], showing that f has block sensitivity at least k. The case that R is not preserved by nuk , instead of R, is completely dual. It is known that a block sensitivity of at most b implies a certificate complexity of at most b2 , i.e., for any / R [44]. This relation R ∈ Inv(nuk ) and any tuple t ∈ R, there are at most b2 bits in t that certify that t ∈ suggests a branching or local search algorithm for SAT(Γ) where Γ contains such relations. However, more strongly, it implies that R has a decision tree of bounded depth [44], and thus, since k is a constant, that R only depends on constantly many arguments. Thus, block sensitivity is a significantly stronger restriction than what nuk imposes. However, one related question remains. Assume that R is an n-ary relation preserved by nuk , and which does depend on all its arguments. Is there a non-trivial upper bound on |R|, e.g., does it hold that |R| ≤ (2 − εk )n for some εk depending on k? A positive answer to this question would imply a trivial improved algorithm for k-NU-SAT via enumeration of satisfying assignments, constraint by constraint. 4.4 Symmetric 3-edge-SAT We finish this section with a result showing that a number of special cases of 3-edge-CSP admits an improved algorithm via sparse triangle finding. The class in particular contains 3-edge-SAT for symmetric relations R ∈ Inv(e3 ). We begin by characterising the symmetric relations in Inv(e3 ). Lemma 47. Let R ⊆ {0, 1}n be a symmetric relation preserved by e3 , Let S ⊆ {0, . . . , n} be the weights accepted by R. Then either S is a complete arithmetic progression (possibly a trivial one, of length 1), or S = {a, a + b} or S = {n − a, n − a − b} for some a < b. 27 Proof. Let us first make a simpler claim: If a, a + b ∈ S is a pair that does not extend to a complete progression in S, then either a − b < 0 or a + 2b > n. To see this, let a, a + b ∈ S, and assume a + 2b ∈ / S, a + 2b ≤ n. First assume a ≥ b. We subpartition [n] into one set T0 of size a − b ≥ 0 and three sets Ti of size b, i = 1, 2, 3. This is possible since a − b + 3b = a + 2b ≤ n. Let t = χT0 ∪...∪T3 and for i = 1, 2, 3 let ti = tTi . Finally, let t4 = tT1 ∪T2 . Then e3 (t1 , . . . , t4 ) is defined and produces t. Thus we conclude a < b, i.e., a − b < 0. By the symmetric argument, if a, a + b ∈ S with a − b ≥ 0 and a − b ∈ / S, then a + 2b > n. This finishes the claim. Next, assume that |S| > 2 and that S contains some pair a, a + b such that the progression does not continue. Let b > 0 be the smallest value such that such a pair exists, and again by symmetry assume that a+ 2b ≤ n; thus a− b < 0. Let c ∈ S \{a, a+ b}. First assume c > a+ 2b. Then we may, similarly to above, pack sets with |T0 | = a, |T1 | = |T2 | = b, and |T3 | = c − a − 2b, and we have a witness showing a + 2b ∈ S. But in the remaining cases, c must be involved in a complete progression with either a or a + b, by the choice of a and b. It is easy to check that this implies the existence of a value c′ ∈ S with a < c′ < a + b, and that iterating the claim eventually produces an arithmetic progression of step size dividing b, covering a and a + b, contradicting the assumption that a + 2b ∈ / S. Thus |S| = 2, i.e., S = {a, a + b}. In particular, this lemma shows that every symmetric relation in Inv(e2 ) is a simple arithmetic progression. It also shows that R has a simple-to-compute 2-edge embedding, i.e., R̂ ⊇ R, R̂ ∩ {0, 1}ar(R) = R, and R̂ is preserved by a total 2-edge operation [36], produced by extending S into a complete progression. We now describe the algorithm. Let R be a relation with arguments X. For a partition X = X1 ∪ X2 and an assignment f to X1 , we refer to the 2-edge label of f as the pair (f0 , g0 ) produced by first extending f to a lex-min assignment g0 such that (f, g0 ) ∈ R, then extending g0 to a lex-min assignment f0 such that (f0 , g0 ) ∈ R. Note that this is the same procedure used in the algorithm for 2-edge-CSP. We extend this to 3-partite graphs as follows. Let the variable set be partitioned as [n] = X ∪ Y ∪ Z, and define a graph G = (V, E) with partition V = VX ∪ VY ∪ VZ , where the nodes of each part represent partial assignments as in Section 4.2. For each edge, verify that the corresponding partial assignment is consistent with each relation in the input instance. We proceed to give labels to edges of G for each relation R as follows. We assume that for each relation, the “type” of R is known to us (2-edge, 3-NU, or symmetric 3-edge). If R ∈ Inv(nu3 ), all edges get the same label. Otherwise, let R̂ ⊇ R be the 2-edge-embedding of R (with R̂ = R if R is already 2-edge). Let pq be an edge in G, corresponding to partial assignments p, q. If one of these assignments, say p, is an assignment to X, then we set the label of pq to the 2-edge label of p in the partition X ∪ (Y ∪ Z). Otherwise, p ∪ q is an assignment to Y ∪ Z, and we set the label of pq to the 2-edge label of this assignment in X ∪ (Y ∪ Z). We show that this label scheme captures our language. Lemma 48. Let R be a relation with arguments U , for some U ⊆ [n], and let G = (V, E) and X ∪ Y ∪ Z be as above. If either R ∈ Inv(e2 ), or R ∈ Inv(nu3 ), or R is Boolean, symmetric and R ∈ Inv(e3 ), then a triple (f, g, h) with f ∈ VX , g ∈ Vy , h ∈ Vz satisfies R if and only if f gh is a triangle in G where the edges f g, f h, gh all have the same label. Proof. Refer to a triangle f gh with all edge labels identical as a single-label triangle. We will also slightly abuse notation by treating R as a 3-ary relation taking values from VX × VY × VZ . First assume that R ∈ Inv(e2 ), and recall that R is rectangular. Let f gh be a single-label triangle with shared label L = (f0 , g0 h0 ); we show that (f, g, h) ∈ R. Since L is the label of the edge gh, it must be that (f0 , g, h), (f0 , g0 , h0 ) ∈ R, and by the edges f g and f h it must be that (f, g0 , h0 ) ∈ R as well. By the partial 2-edge operation, this implies (f, g, h) ∈ R. Thus every single-label triangle corresponds to a satisfying assignment. In the other direction, let (f, g, h) ∈ R. Since R is rectangular, there is a unique lex-min pair (f0 , g0 h0 ) in the biclique containing (f, gh), and both extensions (f, g0 h0 ) and (f0 , gh) are compatible with R. Thus all three edges get the same label and the algorithm works for R ∈ Inv(e2 ). 28 The case R ∈ Inv(nu2 ) is trivial. Since such a relation is 2-decomposable, the entire verification of R happens in the stage where edges are filtered, and in the remaining graph, every triangle represents a satisfying assignment and every triangle is single-label. Finally, assume R ∈ Inv(e3 ) and is symmetric. If R ∈ Inv(e2 ), then we argue as above. Otherwise, by Lemma 47, either S = {a, a + b} or S = {n − a, n − a − b} for a < b, and R̂ verifies that each assignment (f, g, h) has the correct weight when computed mod b. First assume that f gh is a single-label triangle in G. First assume S = {a, a + b}. By the edge-filtering step, we know that for each of the edges f g, gh, f h the corresponding partial assignment has weight at most a + b. Thus the total weight of (f, g, h) is at most (a + b)(3/2) ≤ a + b + (a + b)/2 < a + 2b. Dually, assume S = {n − a − b, n − a}. No edge in f gh has more than a + b zeroes, thus the total assignment has weight greater than n − a − 2b. In both case, since the edge-labels work to verify the value mod b, we conclude (f, g, h) ∈ R. On the other hand, assume (f, g, h) ∈ R. Since the edge labels verify the more permissive relation R̂, the triangle f gh is a single-label triangle. The remaining problem can now be solved via algorithms for triangle-finding in sparse graphs. Theorem 49. Assume a CSP or SAT problem with the following characteristic: for every relation R, either R ∈ Inv(e2 ) and R is labelled with type e2 , or R ∈ Inv(nu3 ) and R is labelled with type nu3 , or the language is Boolean, R is a symmetric relation in Inv(e3 ) and R is labelled with type e3 . This problem can ω+3 be solved in time O∗ (|D| 6 ) in the extension oracle model, where ω < 2.373 is the matrix multiplication exponent. Proof. By the description above, we create a 3-partite graph G on 3|D|n/3 vertices (where |D| = 2 in the Boolean case), and for every edge in G we give it a vector of labels, one label per relation in the input instance. We refer to this vector as the colour of the edge. Note that a symmetric relation R can be “inspected” using its extension oracle to find out the set S of accepted weights. By Lemma 48, the instance has a satisfying assignment if and only if G has a triangle where all edges have the same colour. This we solve as follows. For every colour c used by an edge in G, we generate the graph Gc consisting of all edges of colour c. Let mc be the number of edges of Gc , and let N ≤ 3|D|n/3 be the number of vertices in G. We check if Gc contains a triangle. If Gc is dense enough, then we use the usual triangle-finding algorithm for this, with running time O∗ (N ω ), otherwise we use an algorithm for triangle finding in sparse 2ω/(ω+1) graphs. Alon, Yuster and Zwick [2] show such an algorithm with running time O(mc ), where ω < 2.373 is the matrix multiplication exponent. Hence, the crossover point at which we use the dense P algorithm is mc ≥ N (ω+1)/2 =: N α . Summing over all colours, we have c mc ≤ N 2 . Since the algorithm for sparse graphs has a super-linear running time, the worst case is when we are at the crossover density and use the sparse algorithm N 2−α times for a cost of O(N ω ) each time. This works out to a total running time O(N (ω+3)/2 ) for triangle-finding, i.e., the CSP is solved in time O∗ (|D|(ω+3)n/6 ) = O∗ (|D|0.896n ) using ω = 2.373. We do not know whether this strategy can be extended to arbitrary relations R ∈ Inv(e3 ), even for a non-uniform algorithm. Section summary. We have proven that it is indeed feasible to construct improved algorithms for Inv(p)SAT and Inv(p)-CSP for individual pSDI-operations p. A crucial step for constructing algorithms of this form is first to identify non-trivial properties of relations invariant under p, which for the partial 2-edge operation turned out be rectangularity, and for the partial 3-NU operation 2-decomposability. However, it might not always be the case that every invariant relation satisfies such a clear-cut property, and for 3-edge-SAT we had to settle for an improved algorithm for symmetric relations. 29 For k-NU-CSP and k-NU-SAT we also gave conditional improvements in terms of (k, k−1)-hyperclique and the sunflower conjecture. At the present, it is too early to say whether these algorithms constitute the only source of improvement or if more direct arguments are applicable. 5 Lower Bounds In this section we turn to the problem of proving lower bounds for sign-symmetric SAT problems. 5.1 Lower bounds based on k-SAT As an easy warm-up, we first consider languages Γ such that SAT(Γ) is at least as hard as k-SAT for some k. For each k ≥ 3 let ck ≥ 0 denote the infimum of the set {c | k-SAT is solvable in O(2cn ) time}. Under the ETH, ck > 0 for each k ≥ 3, and for each k ≥ 3 there exists k′ > k such that ck′ > ck [25]. The best known upper bounds yield ck ≤ 1 − Θ(1/k), but no methods for lower-bounding the values ck are known. Recall that Lemma 32 gives a condition under which a language Γ can qfpp-define all k-clauses. We observe the immediate consequence of this. Lemma 50. Let Γ be a sign-symmetric constraint language not preserved by the k-universal partial operation. Then SAT(Γ) cannot be solved in time O∗ (2cn ) for any c < ck , even in the non-uniform model. Proof. By Lemma 32, Γ can qfpp-define all k-clauses. More concretely, there is a finite set Γ′ ⊆ Γ of relations such that every k-clause has a fixed, finite-sized gadget implementation over Γ′ . Thus, given a k-SAT instance on n variables, we can produce an equivalent instance of SAT(Γ′ ) in linear time, with the same variable set. As a consequence, ck is also a lower bound on the running time for Inv(f)-SAT for every minimal pSDIoperation at level k + 1 and higher. However, this above lemma applies to any sign-symmetric constraint language, and not just to the special case when Γ = Inv(f). We can also observe a similar consequence for SETH-hardness. Corollary 51. Let Γ be a sign-symmetric constraint language not preserved by the k-universal partial operation for any k. Then assuming SETH, SAT(Γ) does not admit an improved algorithm, even in the non-uniform model. Proof. By SETH, there is for every ε > 0 a constant k such that k-SAT cannot be solved in O∗ ((2 − ε)n ) time. By Lemma 50, there is a reduction from k-SAT to SAT(Γ) for this k. Thus, SAT(Γ) does not admit an improved non-uniform algorithm. 5.2 2-edge-SAT and Subset Sum Next, we sharpen the connection between Subset Sum and 2-edge-SAT. Recall that an instance of Subset Sum consists of a set S = {x1 , . . . , xn } of n numbers and a target integer t, with the question of whether P there is a set X ′ ⊆ S such that X ′ = t. This can also be phrased as asking for z1 , . . . , zn ∈ {0, 1} such that n X zi xi = t. i=1 Also recall from Lemma 21 that such a relation is contained in Inv(e2 ). However, this does not by itself imply a problem reduction, since an instance or 2-edge-SAT assumes the existence of an extension oracle for every constraint. We show that such a reduction can be implemented by splitting the above equation apart into several equations, based on the bit-expansion of t. 30 Theorem 52. If 2-edge-SAT is solvable in O(2cn ) time for c > 0 in the extension oracle model, then Subset Sum is solvable in O(2(c+ε)n ) time for every ε > 0. Proof. Let x1 , . . . , xn , t ∈ N be the input to a Subset Sum instance. We will reduce this instance in subexponential time to a disjunction over 2-edge-SAT instances on n variables each. We proceed as follows. Harnik and Naor [22] give a randomized procedure for this that reduces a Subset Sum instance to bit length at most 2n + log ℓ, where ℓ is the bit length of the input. If ℓ ≥ 2n , then we solve the instance by brute force in time polynomial in the input length, otherwise we are left with an instance of bit length ℓ′ ≤ 3n. √ Next, set a parameter k = n, and split the binary expansion of the input integers into k blocks of equal √ √ length, giving n blocks of length O( n). For each block guess the contribution of the solution to the target value. Note that the maximum overflow that can carry over to the next block is n, which means that for a single block there are O(n2 ) options for the contribution within the block. We get at most O(n2k ) = 2o(n) √ P guesses in total, after which we have replaced the original equation i zi xi = t by the conjunction of n √ linear equations, each with a target integer of O( n) √ bits. This allows us to implement an extension oracle for every such constraint with a running time of 2O( n) , using the well-known tabulation approach. This encodes an instance of 2-edge-SAT in the extension oracle model with n variables. Using an algorithm for this problem, and multiplying its running time by the time required for answering an oracle query, yields the claimed running time for Subset Sum. Given that the running time for 2-edge-SAT in the extension oracle model given in this paper matches the best known running time for Subset Sum, and given that improving the latter is a long-open problem, it seems at the very least that an improvment to 2-edge-SAT would require significant new ideas. 5.3 Padding formulas We now give a combinatorial interlude, showing how relations R ⊆ {0, 1}n can be padded with additional variables such that the new relation lies in Inv(f), for any non-total partial operation f . This will be leveraged in the next section to finally provide concrete lower bounds on the running time of Inv(f)-SAT for pSDI-operations f . For a partial operation p, say of arity k, and a sequence of tuples t1 , . . . , tk , we say that p(t1 , . . . , tk ) is a projective application if p(t1 , . . . , tk ) is either undefined or p(t1 , . . . , tk ) ∈ {t1 , . . . , tk }. Similarly, if p(t1 , . . . , tk ) is defined and p(t1 , . . . , tk ) ∈ / {t1 , . . . , tk } we call p(t1 , . . . , tk ) a non-projective application. Definition 53. Let R ⊆ {0, 1}n be a relation and P a set of Boolean partial operations. A padding of R with respect to P is an (n + m)-ary relation PR such that (1) Proj1,...,n (PR ) = R, (2) |PR | = |R|, and (3) PR ∈ Inv(P). A universal padding formula for n ≥ 1 with respect to P is an (n + m)-ary relation U P P which (1) is a padding of the relation {0, 1}n and (2) p(t1 , . . . , tar(p) ) is a projective application for every partial operation p ∈ P and every sequence of tuples t1 , . . . , tar(p) ∈ U P P . Note that if R is a relation and p a k-ary partial operation such that p(t1 , . . . , tk ) is a projective application for every sequence t1 , . . . , tk ∈ R, then R ∈ Inv(P). In particular this implies that U P P ∈ Inv(P) for every universal padding formula U P P of P . Also, critically, if U P P is an (n + m)-ary universal padding formula for a set of partial operations P , and R is an n-ary relation, then the relation R′ (x1 , . . . , xn , y1 , . . . , ym ) ≡ R(x1 , . . . , xn ) ∧ U P P (x1 , . . . , xn , y1 , . . . , ym ) is a padding formula for R. Hence, a universal padding formula can be viewed as a blueprint which can be applied to obtain a concrete padding formula for any relation. It is known that if P contains no total operation, then a universal padding formula can be constructed using a universal hash family [37]. 31 Lemma 54. Let P be a finite set of partial operations such that the only total functions in [P ]s are projections. For every n ≥ 1 there exists an (n + m)-ary universal padding formula U P P such that m ≤ c · n, for a constant c depending on P . Proof. See Lagerkvist & Wahlström [37, Lemma 35]. A quick note is in place on the role of universal padding formulas in obtaining lower bounds for Inv(P)SAT, when P is a finite set of partial operations. Note that in a standard “gadget” reduction from CNF-SAT to some problem SAT(Γ), one would introduce some number of local variables for every clause of the input, to create an equivalent output formula that only uses constraints from Γ. The existence of padding formulas does allow us to do this for Inv(P)-SAT, but for lower bounds under SETH this is not useful since we have no control over the number of additional variables created this way. However, the universality property of universal padding formulas allow us to reuse the padding variables between different constraints, to produce an output which only has n + m = O(n) variables in total. The details are given in the next section, but first we investigate concrete values of the constant c for partial k-edge and k-NU operations. L Lemma 55. Let X = {x1 , . . . , xn } be a set of variables, and let y = i∈S xi be the parity sum for a set S ⊆ [n] chosen uniformly at random. For any tuple t ∈ {0, 1}n , let t′ be t padded by y. Let p be a partial operation as specified below, let r = ar(p), and let (t1 , . . . , tr ) be a sequence of tuples in {0, 1}n such that p(t1 , . . . , tr ) is a non-projective application. Then the following hold. 1. If p is the partial 2-edge operation, with r = 3, then the probability that p(t′1 , t′2 , t′3 ) is defined is 3/4. 2. If p is the partial 3-edge operation, with r = 4, then the probability that p(t′1 , . . . , t′4 ) is defined is 1/2. 3. If p is the partial k-NU operation, k ≥ 4, then the probability that p(t′1 , . . . , t′r ) is defined is (2k+2)/2k . For every weaker operation, e.g., for the partial k-edge or k-universal operations, the probability is at most this high. 4. If p is the partial k-universal operation, k ≥ 3, then the probability that p(t′1 , . . . , t′r ) is defined is (k + 1)/2k . L Proof. Throughout the proof, we write y(t) = i∈S t[i]. Let us consider each case in turn. 1. We have ar(p) = 3. Let I respectively J be the set of indices i ∈ [n] such that t1 [i] = t2 [i] 6= t3 [i], respectively, t1 [i] 6= t2 [i] = t3 [i]. Note that both I and J are non-empty since p(t1 , t2 , t3 ) is a non-projective application. Then p(y(t1 ), y(t2 ), y(t3 )) is undefined if and only if the parity of S ∩ I and S ∩ J are both odd. Since I and J are disjoint, the probability of this is exactly 1/4. 2. For the partial 3-edge operation, recall from Theorem 28 that p can be constructed by adding a fictitious argument to the partial 3-NU operation. Hence, the arguments i ∈ [n] such that (t1 [i], . . . , t4 [i]) is non-constant partition into three sets I1 , I2 , I3 ⊆ [n], and since p(t1 , . . . , t4 ) is a non-projective application, all three sets must be nonempty. It can be verified that p(y(t1 ), . . . , y(t4 )) is defined if and only if S ∩ Ii is odd for at most one i ∈ [3]. This happens with exactly 1/2 probability. 3. For the partial k-NU operation, we have ar(p) = k; let p(t1 , . . . , tk ) = t. There are k non-empty pairwise disjoint sets I1 , . . . , Ik such that ti [j] 6= t if and only if j ∈ Ii , for each i ∈ [k], j ∈ [n]. The tuple (y(t1 ), . . . , y(tk )) has one value, say b, in every row i ∈ [k] where S ∩ Ii is odd, and another value, 1 − b, in every row i where S ∩ Ii is odd. Thus p(y(t1 ), . . . , y(tk )) is defined if either S ∩ Ii is odd for at most one index or S ∩ Ii is even for at most one index; these are 2k + 2 possibilities. For all other 2k − (2k + 2) possibilities, the operation is undefined. Note that all these possibilities happen with equal probability, since the sets Ii are non-empty and pairwise disjoint. 4. We have ar(p) = 2k − 1 = r, with the non-constant parts of domain(p) partitioned into k pairs. Let Ii , i ∈ [k] be the sets of indices j ∈ [n] such that (t1 [j], . . . , tr [j]) belongs to the ith of these pairs, in some 32 enumeration. We claim that p(y(t1 ), . . . , y(tr )) is defined if and only if S ∩ Ii is odd for at most one i ∈ [k]. On the one hand, if this holds, then (y(t1 ), . . . , y(tr )) is contained in pair number i or is constant, and it is clear that the operation is defined. Otherwise, let S ∩ Ii and S ∩ Ij both be odd, i 6= j. Let t = p(t1 , . . . , tr ); let a ∈ [r] be the argument such that ta [i] 6= t[i] if and only if i ∈ Ii ; let b ∈ [r] be the argument such that tb [i] 6= t[i] if and only if i ∈ Ij ; and let c ∈ [r] be the argument such that tc [i] 6= t[i] if and only if i ∈ Ii ∪ Ij . Then the three positions y(ta ), y(tb ), y(tc ) have a pattern that is not compatible with any domain element of p. It follows that the probability that p(t′1 , . . . , t′r ) is defined is exactly (k + 1)/2k . Lemma 56. Let p be a partial operation. There are (|domain(p)|)n sequences (t1 , . . . , tar(p) ) of tuples in {0, 1}n such that p(t1 , . . . , tar(p) ) is defined. Proof. For every argument i ∈ [n], we choose which element from domain(p) the tuple (t1 [i], . . . , tar(p) [i]) will correspond to. Every such choice results in a distinct sequence of tuples. Lemma 57. Let R(x1 , . . . , xn , y1 , . . . , ym ) be a padding formula for {0, 1}n , where each yi is a a parity bit over {x1 , . . . , xn } chosen uniformly at random. Then the following hold. 1. For the partial 2-edge operation, R(x1 , . . . , xn , y1 , . . . , ym ) is a universal padding formula with probability at least 1 − ε if m ≥ 6.23n + log(1/ε). 2. For the partial 3-edge operation, R(x1 , . . . , xn , y1 , . . . , ym ) is a universal padding formula with probability at least 1 − ε if m ≥ 3n + log(1/ε). 3. For the partial k-NU operation, k ≥ 4, and for any operation weaker than it, R(x1 , . . . , xn , y1 , . . . , ym ) is a universal padding formula with exponentially small failure probability if m = Ω( logk k n). Proof. 1. By Lemma 56, there are 6n triples such that p is defined. For each such triple such that the application of p is non-projective, the probability that it remains defined after the addition of a single random parity bit is 3/4. Thus after adding t parity bits, the expected number of non-projective triples is at most 6n (3/4)t = 2n log 6−t log(4/3) . With t = (n log 6)/(log 4/3)+d, this number equals 1/2d , which means that with probability at least 1−1/2d , no defined triples remain. The constant factor works out to (log 6)/(log(4/3)) = (1 + log 3)/(2 − log 3) < 6.23. 2. There are 8n tuples (t1 , . . . , t4 ) such that p is defined, and for each of them which is non-projective the probability of remaining defined after the addition of a single parity bit is 1/2. Thus adding 3n + d parity bits leaves in expectation at most 8n (1/2)3n+d = 2−d non-projective tuples, and the probability that no non-projective tuples remain is at least 1 − 1/2d . 3. In the general case, there are (2k + 2)n = 2(1+log(k+1))n defined tuples, and the probability of a non-projective tuple remaining defined after the addition of a random parity bit is O(k/2k ). Note that (ck/2k )t = 2(log c+log k−k)t . Thus the expected number of non-projective tuples after t parity bits is at most ′ 2(1+log(k+1))n−(k−log k−c )t , and it suffices to let t = Ω( logk k n). We remark that with a padding strategy other than simple parity bits, a significantly lower scaling ratio may be possible for the partial k-universal operation. However, the advantage of paddding with parity bits is that the padding can be efficiently inverted, allowing for efficient extension oracles for the padded relation. 33 5.4 Lower bounds in the extension oracle model In this section we use the bounds obtained in Section 5.3 to obtain lower bounds for Inv(P)-SAT in the extension oracle model. Lemma 58. Let U P P be an (n + m)-ary universal padding formula via the construction in Lemma 57. Let R = {0, 1}k \ {t} for a k-ary tuple t ∈ {0, 1}k . Then there is a polynomial-time extension oracle for R(x1 , . . . , xk ) ∧ U P P (x1 , . . . , xn , y1 , . . . , ym ). Proof. Let α : X → {0, 1}, X ⊆ {x1 , . . . , xk , y1 , . . . , ym }, be a partial truth assignment. We need to show that we can decide if α is consistent with R(x1 , . . . , xk ) ∧ U P P (x1 , . . . , xn , y1 , . . . , ym ) in polynomial time. First, we check whether α is consistent with the constraint R(x1 , . . . , xk ), which is easy to do due to the L representation of R. Second, recall that there for each yi exists an index set Si such that yi = s∈Si xs . Hence, the partial assignment α together with R(x1 , . . . , xk ) ∧ U P P (x1 , . . . , xn , y1 , . . . , ym ) induces a system of linear equations over GF(2) where the unknown variables are those unassigned by α. We may thus solve this system and check whether it has any solution f where f [i] 6= t[i] for some i ∈ [k]. Theorem 59. Let P be a set of partial operations, and set m ≥ cn + log n such that a random paritypadded formula U P P (x1 , . . . , xn , y1 , . . . , ym ) is a universal padding formula with high probability. Then Inv(P)-SAT cannot be solved in time O∗ (2(1/(c+1)−ε)n ) for any ε > 0, assuming the randomized version of the SETH is true. In particular, we have the following lower bounds for specific problems: 1. 2-edge-SAT cannot be solved in O(2(c−ε)n time for any ε > 0, where c ≈ 1/7.28. 2. 3-edge-SAT cannot be solved in O(2(c−ε)n time for any ε > 0, where c = 1/3. 3. For k ≥ 4, k-NU-SAT cannot be solved in O(2(c−ε)n ) time for any ε > 0, where c = 1 − Θ( logk k ), and the same bound holds for the harder problems k-edge-SAT and k-universal SAT. Proof. Let F be a CNF-SAT instance on variable set X, |X| = n, and compute a random padding formula U P P (x1 , . . . , xn , y1 , . . . , ym ), with m as stated. We assume that the construction is successful, i.e., that the resulting relation is a universal padding formula with respect to P . For every clause in the input, defined on a tuple of variables (xi1 , . . . , xir ), let R(xi1 , . . . , xir ) be the corresponding relation, and let R′ (xi1 , . . . , xir ) ∧ U P P (x1 , . . . , xn , y1 , . . . , ym ) be the relation as in Lemma 58 (up to the ordering of variables). Note that we do not need to explicitly enumerate the tuples in this relation, since we may simply provide the extension oracle proven to exist in Lemma 58. Then the output is a conjunction of Inv(P)-SAT relations, with a polynomial-time extension oracle for each one, and the resulting instance is equivalent to F. Since the output instance has n + m = (c + 1) · n variables, an algorithm solving Inv(P)-SAT faster than the time stated would imply an improved algorithm for CNF-SAT. The bounds for specific problems follow from the bounds for universal padding formulas computed in Lemma 57. Finally, we note that the convergence of the lower bounds for k-NU-SAT towards 2n , assuming SETH, is at a slower rate than the upper bounds for the best known algorithms for k-SAT, which scale as ck ≤ 1 − Θ(1/k) [25]. There are also significant differences in problem model (finite language versus infinite language, and concrete constraints versus extension oracles). It would be interesting to improve these results, to either improve the convergence rate or provide bounds in some explicit representation model, assuming SETH. 34 Section summary. We have proven lower bounds under SETH. The bounds obtained in Theorem 59 are only valid in the extension oracle model, and it does not appear entirely straightforward to extend them to the explicit representation. However, for 2-edge-SAT we also gave a lower bound subject to the Subset Sum n problem, which as remarked is strong evidence that the O∗ (2 2 ) algorithm from Theorem 38 is the best we could reasonably hope for. 6 Discussions and Conclusions We have investigated the structure of constraint languages under fine-grained reductions, with a focus on sign-symmetric Boolean languages, and applied the results to an analysis of the time complexity of NP-hard SAT problems, in a general setting. The structural analysis uses an algebraic connection to analyse constraint languages via their partial polymorphisms. Thereby the structural conclusions are relevant for any problem that takes as input a constraint formula over some fixed constraint language, under just a few assumptions: (1) that the constraints in the formula are “crisp” rather than soft, and are required to all be satisfied (as opposed to problems such as MAX-SAT, where a feasible solution may falsify some constraints); (2) that there are no structural restrictions of the formula itself (e.g., no bounds on the number of occurrences per variable); and (3) that the constraint language is sign-symmetric, i.e., allows the free application of negated variables and the use of constants in constraints. Thus it naturally applies to SAT(Γ) problems, but would also be relevant for the analysis of problems such as #SAT and optimisation problems, or even parameterized problems such as Local Search SAT(Γ) – is there a solution within distance k of a given non-satisfying assignment t? Structural results. The expressive power of sign-symmetric languages is characterised by the restricted partial polymorphisms in this paper referred to as pSDI-operations. We characterise the structure of all minimal non-trivial pSDI-operations, and find that they are organised into a hierarchy, whose levels correspond to the problem complexity, with close connections to being able to express the k-SAT languages. Moreover, we described the weakest and strongest operations on each level. We find that particular families of pSDI-operations correspond to partially defined versions of well-known algebraic conditions from the study of CSPs; in particular, the strongest operation at each level k corresponds to the k-NU condition. Finally, we also give a result in the “vertical” direction of the hierarchy, giving a simple characterisation of languages not preserved by the partial k-NU operation for any k. By the above discussion, this result should be of interest also for other inquiries. Complexity of SAT(Γ) problems. We apply our results to an analysis of the fine-grained time complexity of SAT(Γ) for sign-symmetric languages, under SETH. We consider previously studied languages with improved algorithms – i.e., such that SAT(Γ) can be solved in time O∗ (cn ) for some c < 2 – and find that they correspond well to particular classes of the hierarchy. Conversely, every known language Γ such that SAT(Γ) is SETH-hard – i.e., admits no improved algorithm assuming SETH – lives entirely outside of the hierarchy. We also show the feasibility of giving improved algorithms whose correctness relies only and directly on the above-mentioned pSDI-operations, by showing that known algorithmic strategies such as fast matrix multiplication and (conjecturally) fast local search can be extended to work for such classes. Finally, we give complementary lower bounds – for every invariant f as above, there is a constant cf such that Inv(f)-SAT cannot be solved in O∗ (cn ) time for any c < cf , assuming SETH. These results are arguably the first of their kind; every previously known concrete lower bound under SETH has either been for showing that a problem admits no non-trivial algorithm, or has been applied to problems analysed under more permissive parameters such as treewidth. In particular, 2-edge-SAT is the first SAT problem which simultaneously has non-trivial upper and lower bounds on the running time under SETH. 35 6.1 The abstract problem and polynomial-time connections Finally, let us make a short detour to consider what we may call the abstract problem. We have noted that for every Boolean pSDI-operation f , there is a set of equational conditions that characterise f , similarly to definitions of varieties in universal algebra, and for every larger domain D, these conditions will uniquely determine a partial operation over the domain D. Furthermore, these conditions are preserved under taking powers of the domain, which we have exploited for particular cases of Inv(f)-SAT and Inv(f)-CSP to reduce input instances to instances of polynomial-time solvable problems on exponentially many variables. These polynomial-time problem will in general be search problems, like CSPs, and will be preserved by the same type of operation f , but have a fixed number of variables d and with an unbounded domain size n. Let us refer to this as the abstract Inv(f)-problem. The question can be raised, for which pSDI-operations f does such a problem allow improved polynomial-time algorithms? We refrain from phrasing the question formally, because the polynomial-time complexity may be strongly affected by details such as constraint representation, but we note that the class of problems defined this way, unlike the original problems SAT(Γ), contain several problems conjectured not to have such an improvement. First, we note that every constraint of arity less than d is preserved by the k-NU-type partial operation with k ≥ d. This in particular includes the k-hyperclique problem for (k − 1)-uniform hypergraphs, which has been conjectured not to be solvable in time O(nk−ε ) for any ε > 0 and k > 3 [40]. Thus the abstract d-NU problem does not admit an improved algorithm for d > 3 under this conjecture. Second, it can be verified that the problem of finding a zero-weight triangle, under arbitrary large edge weights, if viewed as a single constraint of arity d = 3, is preserved by the corresponding 3-universal partial operation. It is known that subject to the 3SUM conjecture, this problem cannot be solved in O(n3−ε ) for any ε > 0 [56]. If we restrict ourselves to the minimal non-trivial pSDI-operations f defined for the Boolean domain in this paper, this leaves only a small number of concrete problems open under the above conjectures. By the inclusions we have established, any operation f at a level k > 3 yields an abstract problem as hard as the k-NU operation. Furthermore, the abstract 3-NU problem does admit an improved algorithm via fast matrix multiplication. It can be easily checked that up to argument permutation, there are only eight distinct pSDI-operations f at level 3 of the hierarchy; and by the above discussion, the easiest and the hardest are (conjecturally) resolved. We consider it an interesting question to investigate the complexity of the problem for these remaining cases. 6.2 Regarding a dichotomy for sign-symmetric SAT problems Ignoring for the moment the lower bounds discussed in the previous section, the results throughout our paper suggest a simple potential dichotomy between NP-complete SAT problems solvable in O(2cn ) time for c < 1 and SAT problems not solvable in O(2cn ) time for any c < 1 unless SETH fails. We can formulate this conjecture as follows. To simplify the conjecture we restrict ourselves to the non-uniform model. Conjecture 60. Let Γ be a possibly infinite sign-symmetric Boolean constraint language such that SAT(Γ) is NP-complete. Then SAT(Γ) admits a non-uniform algorithm with running time in O(2cn ) time for c < 1 if and only if Γ is preserved by a non-trivial pSDI-operation. Note that by Corollary 51, the negative direction of this conjecture is already known, up to SETH. It thus remains to consider whether k-universal SAT admits a non-uniform improved algorithm for every k. Furthermore, as discussed in the Introduction, the class of constraints definable as the roots of bounded-degree multivariate polynomials represents an example which by Lemma 24 is directly associated with k-universal SAT, and which has an improved algorithm by Lokshtanov et al. [42]. Thus, the above conjecture at least represent a kind of Occam’s razor-type extrapolation of least mathematical surprise. 36 However, at the moment this conjecture seems difficult to settle. An extreme negative result, such as the conclusion that the full problem Inv(f)-SAT admits an improved algorithm only when the abstract Inv(f)problem does, would by Theorem 45 need to refute the sunflower conjecture. A full positive resolution would need to generalise the result of Lokshtanov et al. [42] to apply based only on a weak abstract condition, whereas their present algorithm strongly uses properties specific to polynomials. Intermediate outcomes are of course possible, but would raise further questions of which pSDI-operations f are powerful enough to guarantee the existence of an improved algorithm. 6.3 Future work The investigations in this paper leave several concrete open questions, and significant avenues for future work, regarding all parts of the paper. Let us highlight a few. Structural aspects. Assuming that the class of partial k-edge operations turn out to be relevant for the analysis of future problems, it would be valuable to have a set of canonical consequences to a language not being preserved by any partial k-edge operation, similarly to Theorem 33. To this aim, it may also be enlightening to fully describe the symmetric relations contained in various classes in the hierarchy. Another concrete question is regarding the structure of Inv(nuk ) for k > 3. Assume that R ∈ Inv(nuk ) is an n-ary Boolean relation, which depends on every argument. Is there a non-trivial upper bound on |R|? Extension to CSPs. Many questions remain regarding an extension of the project to CSPs on nonBoolean domains. While the minimal non-trivial pSDI-operations defined in this paper do have higherdomain analogues, via polymorphism patterns, and while these analogues do in some cases have useful consequences for the complexity of the corresponding CSP, it is not clear that they are in general the only kind of condition that is relevant for the fine-grained complexity of CSPs. In particular, in the Boolean domain there is a known correspondence between pSDI-operations and sign-symmetric languages. No such correspondence has been shown for CSPs in general. In a different vein, for higher-domain CSPs there are also classes of NP-hard problems whose time complexity is far better than O∗ (|D|n ), e.g., k-Colouring corresponds to a CSP of domain size |D| = k and can be solved in O∗ (2n ) time for every k [4]. Arguably, we do not have a good understanding of when this occurs in general, and we cannot claim that an O(cn ) time algorithm for c < |D| is necessarily an improvement. A reasonable starting point to mitigate some of these technical difficulties is to initially only consider consider constraint languages whose total polymorphisms are the projections. Problems. Let us mention a few concrete algorithmic questions. First of all, by Lemma 25, symmetric relations defined by Sidon sets are preserved by the 3-universal operation, but they do not seem to be captured by currently known algorithms for problems in this class. Does the language consisting of all such relations admin an improved algorithm? Another problem is to find a generalisation of the algorithm for constraints defined via bounded-degree polynomials [42], without explicitly using properties specific to polynomials. A different generalisation of this class was considered by the present authors (see the arXiv version of [36]), in the form of relations with bounded-degree Maltsev embeddings. Since this properly generalises bounded-degree polynomials, it is natural to ask whether this class admits an improved algorithm. More broadly, as remarked earlier, the classification of the expressiveness of sign-symmetric constraint languages may be of interest for questions other than just satisfiability. The algorithm for 2-edge-SAT, for instance, can be used to solve the corresponding counting problem, showing that pSDI-operations may be powerful enough also in other settings. Concrete questions to consider here include improved algorithms for the counting problem #SAT(Γ) and the parameterized problem Local search SAT(Γ). Lower bounds. Can the padding scheme be improved to give better asymptotics with respect to the level k? Recall that the lower bound behaves as a bound of 2 − Θ((log k)/k), whereas all known algorithmic strategies yield running times of the form (2 − Θ(1/k))n . 37 It would also be very interesting to have a SETH-based lower bound in the explicit representation model. As discussed earlier the padding construction is valid also in this representation, but is difficult to implement in practice since the resulting relations may contain exponentially many tuples with respect to the number of variables. References [1] N. Alon, A. Shpilka, and C. Umans. On sunflowers and matrix multiplication. Computational Complexity, 22(2):219–243, 2013. [2] N. Alon, R. Yuster, and U. Zwick. Finding and counting given length cycles. Algorithmica, 17(3):209– 223, 1997. [3] L. Barto, A. Krokhin, and R. Willard. Polymorphisms, and How to Use Them. In A. Krokhin and S. Zivny, editors, The Constraint Satisfaction Problem: Complexity and Approximability, volume 7 of Dagstuhl Follow-Ups, pages 1–44. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 2017. [4] A. Björklund, T. Husfeldt, and M. Koivisto. Set partitioning via inclusion-exclusion. SIAM Journal on Computing, 39(2):546–563, 2009. [5] V. G. Bodnarchuk, L. A. Kaluzhnin, V. N. Kotov, and B. A. Romov. Galois theory for Post algebras. I. Cybernetics, 5:243–252, 1969. [6] V. G. Bodnarchuk, L. A. Kaluzhnin, V. N. Kotov, and B. A. Romov. Galois theory for Post algebras. II. Cybernetics, 5:531–539, 1969. [7] A. Bulatov. A dichotomy theorem for nonuniform CSPs. In Proceedings of the 58th Annual Symposium on Foundations of Computer Science (FOCS-2017). IEEE Computer Society, 2017. [8] A. Bulatov and V. Dalmau. A simple algorithm for Mal’tsev constraints. SIAM Journal On Computing, 36(1):16–27, 2006. [9] A. Bulatov, P. Jeavons, and A. Krokhin. Classifying the complexity of constraints using finite algebras. SIAM Journal on Computing, 34(3):720–742, Mar. 2005. [10] C. Calabro, R. Impagliazzo, and R. Paturi. The complexity of satisfiability of small depth circuits. In Parameterized and Exact Computation, 4th International Workshop (IWPEC 2009), pages 75–85, 2009. [11] C. Calabro, R. Impagliazzo, and R. Paturi. On the exact complexity of evaluating quantified k-CNF. Algorithmica, 65(4):817–827, Apr 2013. [12] M. Couceiro, L. Haddad, V. Lagerkvist, and B. Roy. On the interval of Boolean strong partial clones containing only projections as total operations. In Proceedings of the 47th International Symposium on Multiple-Valued Logic (ISMVL-2017), pages 88–93. IEEE Computer Society, 2017. [13] M. Couceiro, L. Haddad, K. Schölzel, and T. Waldhauser. Relation graphs and partial clones on a 2-element set. In Proceedings of the 44th International Symposium on Multiple-Valued Logic (ISMVL2014), pages 161–166. IEEE Computer Society, 2014. 38 [14] N. Creignou and H. Vollmer. Boolean constraint satisfaction problems: When does Post’s lattice help? In N. Creignou, P. G. Kolaitis, and H. Vollmer, editors, Complexity of Constraints, volume 5250 of Lecture Notes in Computer Science, pages 3–37. Springer Berlin Heidelberg, 2008. [15] M. Cygan, H. Dell, D. Lokshtanov, D. Marx, J. Nederlof, Y. Okamoto, R. Paturi, S. Saurabh, and M. Wahlström. On problems as hard as CNF-SAT. ACM Transactions on Algorithms, 12(3):41:1– 41:24, 2016. [16] E. Dantsin, A. Goerdt, E. A. Hirsch, R. Kannan, J. M. Kleinberg, C. H. Papadimitriou, P. Raghavan, and U. Schöning. A deterministic (2 − 2/(k + 1))n algorithm for k-SAT based on local search. Theoretical Computer Science, 289(1):69–83, 2002. [17] E. Dantsin and A. Wolpert. Derandomization of Schuler’s algorithm for SAT. In Proceedings of Theory and Applications of Satisfiability Testing (SAT-2004), pages 80–88, 2005. [18] P. Erdős and R. Rado. Intersection theorems for systems of sets. Journal of the London Mathematical Society, s1-35(1):85–90, 1960. [19] T. Feder and M. Vardi. The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory. SIAM Journal on Computing, 28(1):57–104, 1998. [20] F. V. Fomin, S. Gaspers, D. Lokshtanov, and S. Saurabh. Exact algorithms via monotone local search. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing (STOC 2016), pages 764–775, 2016. [21] D. Geiger. Closed systems of functions and predicates. Pacific Journal of Mathematics, 27(1):95–100, 1968. [22] D. Harnik and M. Naor. On the compressibility of NP instances and cryptographic applications. SIAM Journal on Computing, 39(5):1667–1713, 2010. [23] T. Hertli. 3-SAT faster and simpler - unique-SAT bounds for PPSZ hold in general. SIAM Journal on Computing, 43(2):718–729, 2014. [24] E. Horowitz and S. Sahni. Computing partitions with applications to the knapsack problem. Journal of the ACM, 21(2):277–292, Apr. 1974. [25] R. Impagliazzo and R. Paturi. On the complexity of k-SAT. Journal of Computer and System Sciences, 62(2):367 – 375, 2001. [26] R. Impagliazzo, R. Paturi, and F. Zane. Which problems have strongly exponential complexity? Journal of Computer and System Sciences, 63:512–530, 2001. [27] B. M. P. Jansen and A. Pieterse. Optimal sparsification for some binary CSPs using low-degree polynomials. In Proceedings of the 41st International Symposium on Mathematical Foundations of Computer Science (MFCS-2016), volume 58, pages 71:1–71:14, 2016. [28] P. Jeavons. On the algebraic structure of combinatorial problems. Theoretical Computer Science, 200:185–204, 1998. [29] P. Jeavons, D. Cohen, and M. Gyssens. Closure properties of constraints. Journal of the ACM, 44(4):527–548, July 1997. 39 [30] P. Jonsson and V. Lagerkvist. An initial study of time complexity in infinite-domain constraint satisfaction. Artificial Intelligence, 245:115–133, 2017. [31] P. Jonsson, V. Lagerkvist, G. Nordh, and B. Zanuttini. Strong partial clones and the time complexity of SAT problems. Journal of Computer and System Sciences, 84:52 – 78, 2017. [32] P. Jonsson, V. Lagerkvist, and B. Roy. Time complexity of constraint satisfaction via universal algebra. In Proceedings of the 42nd International Symposium on Mathematical Foundations of Computer Science (MFCS-2017), pages 17:1–17:15, 2017. [33] M. P. L. Barto, J. Oprsal. The wonderland of reflections. Israel Journal of Mathematics. To appear. [34] V. Lagerkvist. Strong Partial Clones and the Complexity of Constraint Satisfaction Problems: Limitations and Applications. PhD thesis, Linköping University, The Institute of Technology, 2016. [35] V. Lagerkvist and B. Roy. A Preliminary Investigation of Satisfiability Problems Not Harder than 1-in-3-SAT. In Proceedings of the 41st International Symposium on Mathematical Foundations of Computer Science (MFCS-2016), pages 64:1–64:14, 2016. [36] V. Lagerkvist and M. Wahlström. Kernelization of constraint satisfaction problems: A study through universal algebra. In Principles and Practice of Constraint Programming - 23rd International Conference (CP 2017), pages 157–171, 2017. [37] V. Lagerkvist and M. Wahlström. The power of primitive positive definitions with polynomially many variables. Journal of Logic and Computation, 27(5):1465–1488, 2017. [38] V. Lagerkvist, M. Wahlström, and B. Zanuttini. Bounded bases of strong partial clones. In Proceedings of the 45th International Symposium on Multiple-Valued Logic (ISMVL-2015), pages 189–194, 2015. [39] F. Le Gall. Powers of tensors and fast matrix multiplication. In Proceedings of the International Symposium on Symbolic and Algebraic Computation (ISSAC-2014), pages 296–303, 2014. [40] A. Lincoln, V. Vassilevska Williams, and R. Williams. Tight hardness for shortest cycles and paths in sparse graphs. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA-2018), pages 1236–1252, 01 2018. [41] D. Lokshtanov, D. Marx, and S. Saurabh. Known algorithms on graphs of bounded treewidth are probably optimal. In Proceedings of the Twenty-second Annual ACM-SIAM Symposium on Discrete Algorithms (SODA-2011), pages 777–789, 2011. [42] D. Lokshtanov, R. Paturi, S. Tamaki, R. R. Williams, and H. Yu. Beating brute force for systems of polynomial equations over finite fields. In P. N. Klein, editor, Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2017), pages 2190–2202, 2017. [43] K. Meeks. Randomised enumeration of small witnesses using a decision oracle. In 11th International Symposium on Parameterized and Exact Computation (IPEC 2016), pages 22:1–22:12, 2016. [44] N. Nisan. CREW PRAMs and decision trees. SIAM Journal On Computing, 20(6):999–1007, 1991. [45] R. O’Donnell. Analysis of Boolean Functions. Cambridge University Press, 2014. [46] E. Post. The two-valued iterative systems of mathematical logic. Annals of Mathematical Studies, 5:1–122, 1941. 40 [47] B. Romov. The algebras of partial functions and their invariants. Cybernetics, 17(2):157–167, 1981. [48] T. Schaefer. The complexity of satisfiability problems. In Proceedings of the 10th Annual ACM Symposium on Theory Of Computing (STOC-1978), pages 216–226. ACM Press, 1978. [49] D. Scheder and J. P. Steinberger. PPSZ for general k-SAT - making Hertli’s analysis simpler and 3-SAT faster. In Proceedings of the 32nd Computational Complexity Conference (CCC-2017), pages 9:1–9:15, 2017. [50] H. Schnoor and I. Schnoor. Partial polymorphisms and constraint satisfaction problems. In N. Creignou, P. G. Kolaitis, and H. Vollmer, editors, Complexity of Constraints, volume 5250 of Lecture Notes in Computer Science, pages 229–254. Springer Berlin Heidelberg, 2008. [51] K. Schölzel. Dichotomy on intervals of strong partial Boolean clones. Algebra Universalis, 73(34):347–368, 2015. [52] U. Schöning. A probabilistic algorithm for k-SAT and constraint satisfaction problems. In Proceedings of the 40th Annual Symposium on Foundations of Computer Science (FOCS-1999), pages 410–414, 1999. [53] R. Schroeppel and A. Shamir. A T = O(2n/2 ), S = O(2n/4 ) algorithm for certain NP-complete problems. SIAM Journal On Computing, 10(3):456–464, 1981. [54] E. Szemerédi. On sets of integers containing no k elements in arithmetic progression. Acta Arithmetica, 27:199–245, 1975. [55] V. V. Williams. Multiplying matrices faster than Coppersmith-Winograd. In Proceedings of the 44th Symposium on Theory of Computing Conference (STOC 2012), pages 887–898, 2012. [56] V. V. Williams and R. Williams. Finding, minimizing, and counting weighted subgraphs. SIAM Journal On Computing, 42(3):831–854, 2013. [57] D. Zhuk. The proof of CSP dichotomy conjecture. In Proceedings of the 58th Annual Symposium on Foundations of Computer Science (FOCS-2017). IEEE Computer Society, 2017. 41
8cs.DS
Compressing and Indexing Stock Market Data Gianni Decaroli1 and Giovanni Manzini1,2 arXiv:1606.05724v2 [cs.DS] 13 Sep 2016 1 Computer Science Institute, University of Eastern Piedmont, Italy 2 IIT-CNR, Pisa, Italy Abstract We show how to build a compressed index for the offline Order Preserving Pattern Matching problem. Our solution is based on the new approach of decomposing the sequence to be indexed into an order component, containing ordering information, and a δ component, containing information on the absolute values. The Order Preserving Matching problem is then transformed into an exact matching problem on the order component followed by a verification phase on the δ component. Experiments show that this approach is viable and it is the first one offering simultaneously small space usage and fast retrieval. 1 Introduction The problem of Order Preserving Pattern Matching consists in finding, inside a numerical sequence T , all subsequences whose elements are in a given relative order. For example, if the pattern is P = (1, 2, 3, 4, 5) we need to find all increasing subsequences of length five; so if T = (10, 20, 25, 30, 31, 50, 47, 49) we have a first match starting with the value 10, a second match starting with the value 20, and no others. This problem is a natural generalization of the classic exact matching problem where we search for subsequences whose values are exactly those of the pattern. Order preserving matching is useful to search for trends in time series like stock market data, biomedical sensor data, meteorological data, etc..1 In the last few years this problem has received much attention. Not surprisingly, most of the results are generalization of algorithms and techniques used for exact matching. In [1, 6, 16, 18] the authors propose solutions inspired by the classical linear time Knuth-Morris-Pratt and Boyer-Moore algorithms [15, Chap. 2]. In [7] the authors consider the offline problem in which T can be preprocessed and propose an index that generalizes the classical Suffix Tree data structure [15, Chap. 5]. Finally in [2, 3, 4, 5, 9, 11] the authors consider approaches based on the concept of filtration and seminumerical matching [15, Chap. 4]. In this paper we extend to Order Preserving Matching another well known idea of exact matching: simultaneously compressing and indexing a sequence of values [20]. We show how to compactly represent a sequence T so that given a pattern P we can efficiently report all subsequences of T whose elements are in the same relative order as the elements of P . Our contribution is based on the new idea of decomposing the sequence T into two components: the order component and the δ component. Informally, the order component 1 The title of the paper is an attempt to find an easy-to-remember name for this problem: we do not claim our results are particularly suitable to stock market data. 1 stores the information about the relative order of the elements of T inside a window of a preassigned size, while the δ component contains the information required for reconstructing T given the order component. The order component is stored into a compressed suffix array while the δ component is stored using an ad-hoc compression technique. To search for a pattern we compute its ordering information and then we search it in the compressed suffix array of the order component. Since the information in the order component is only partial, this search gives us a list of potential candidates which are later verified using the δ component. In other words, the search in the compressed suffix array is a sort of filtering phase that uses the index to quickly select a set of candidates, discarding all other subsequences in T that certainly do not match. This approach can be seen as a generalization of the offline strategy in [4] as we will comment in the next section. The overall efficiency of our approach depends on some parameters of the algorithm whose influence will be experimentally analyzed in Section 6. The bottom line is that our index takes roughly the same space as the compressor gzip and can report the order preserving occurrences of a pattern order of magnitude faster than a scan based algorithm. 2 Problem formulation and previous results Let T [1, n] denote a sequence of n = |T | numerical values. We write T [i] to denote the i-th element and T [j, k] to denote the subsequence T [j]T [j + 1] · · · T [k]. Given two sequences P , Q, we say that they are order isomorphic, and write P ≈ Q, if |P | = |Q| and the relative order of P ’s and Q’s elements is the same, that is P [i] ≤ P [j] ⇐⇒ Q[i] ≤ Q[j] for 1 ≤ i, j ≤ |P |. (1) Hence (1, 3, 4, 2) is order isomorphic to (100, 200, 999, 101) but not to (1, 3, 4, 5). Given a reference sequence T [1, n] and a pattern P [1, p] the order preserving pattern matching problem consists in finding all subsequences T [i + 1, i + p] such that T [i + 1, i + p] ≈ P [1, p]. In this paper we consider the offline version of the problem in which the sequence T is given in advance and we are allowed to preprocess it in order to speedup subsequent searches. For the offline problem, the authors of [7] describe a generalization of the Suffix Tree data structure that reports the occurrences of a pattern P in O(|P | + occ) time, where occ is the number of (order-preserving) occurrences. Like the classical Suffix Tree, the one described in [7] has the drawback of using O(n log n) bits of space. The only other offline solution we are aware of is the one in [4] where the authors build an index which is used as a filter to get a list of potential matches. The index used in [4] is a FM-index [10] built on the binary sequence t1 · · · tn−1 such that ti = 1 iff T [i + 1] > T [i]. The pattern to be searched is also transformed with the same rule and the corresponding binary string is searched in the index. This provides a list of potential matches that are later verified using the actual sequence T . In this paper, following a well established research line [20], we consider the problem of designing a compressed index for the Order Preserving Matching problem. We describe a data structure that uses roughly 30% of the space used by the sequence T , and supports the efficient retrieval of order isomorphic subsequences. Our starting point is a generalization of the index in [4]. However, instead of extracting a binary sequence from T we use a sliding window of size q and we extract an order component defined over the alphabet {0, 1, . . . , q − 1}. In addition, we compute a δ component containing the information not 2 stored in the order component. We show that these components can be compactly stored and at the same time used as an index for Order Preserving Matching. Our solution makes use of compressed suffix array implemented using a FM-index [10]. The reader should be familiar with the basic concepts of this data structure, namely the fact that it works in terms of ranges of Suffix Array rows (even if the Suffix Array itself is not available) and its two basic operations: backward search and LF mapping [20]. 3 Basic results In the following we assume that all sequences contain distinct values. If this is not the case, we force this property assuming that if i < j and entries T [i] and T [j] contain the same value then T [i] is considered smaller than T [j]. This is the same assumption used in [16]. In some applications equal values are important and it is natural to require that equal values in the pattern correspond to equal values in T . Since our algorithms are slightly more complex for this case we postpone their discussion to Section 5.1. Given a positive parameter q and a sequence T [1, n] we define a new sequence To [1, n] with elements over the set {0, 1, . . . , q − 1}. Let iq = max(1, i − q + 1); for i = 1, . . . , n we define ( 0 if T [i] = min T [iq , i] To [i] = (2) k if T [i − k] = max{T [j] | iq ≤ j < i ∧ T [j] < T [i]}. In other words, we set To [i] = k > 0 when T [i − k] is the immediate predecessor of T [i] in the subsequence T [iq , i], that is, T [i − k] is the largest element smaller than T [i] in T [iq , i]. If T [i] is the smallest element in the sequence, then it has no predecessor and To [i] = 0. For example, if q = 4 for T = (3, 8, 3, 5, −2, 9, 6, 6) it is To = (0, 1, 2, 1, 0, 2, 3, 1) (recall we are assuming T [1] < T [3] and T [7] < T [8]). We call To the order component for T since it encodes ordering information for T ’s elements within a size-q window. Formally the sequence To depends also on q, but since we use the same q for all sequences for simplicity we omit it from the notation. Representations similar to To , but without a sliding window, have been used in [7, 16]. Obviously, if P and Q have the same length and P ≈ Q then Po = Qo . However, we are interested in finding the order preserving occurrences of P within a (much) longer reference sequence T , so we will make use of the following more general result. Lemma 1. Let P [1, p] be any pattern and T a reference sequence. Let i be such that P [1, p] ≈ T [i + 1, i + p]. It is To [i + j] = Po [j] for every j such that 2≤j≤p (j − To [i + j]) ≥ 1. and Proof. Let j be such that the above condition is satisfied and let w = min(q, i + j) and v = min(q, j). Note that w (resp. v) is the size of the subsequence which is considered for determining To [i + j] (resp. Po [i + j]). Clearly w ≥ v. If To [i + j] = 0, then T [i + j] is the smallest element in the subsequence T [i + j − w + 1, i + j]. A fortiori T [i + j] is the smallest element in T [i + j − v + 1, i + j]. The hypothesis P [1, p] ≈ T [i + 1, i + p] implies that likewise P [j] must be the smallest element in P [j − v + 1, j] so it must be Po [j] = 0. Assume now To [i + j] > 0 and let ℓj = j − To [i + j]. By construction T [i + ℓj ] is the immediate predecessor of T [i + j] in the subsequence T [i + j − w + 1, i + j]. The condition 3 j − To [i + j] ≥ 1 implies 1 ≤ ℓj < j. We want to show that Po [j] = To [i + j], that is, P [ℓj ] is the immediate predecessor of P [j] in P [j − v + 1, j]. Since P [1, p] ≈ T [i + 1, i + p] and T [i + ℓj ] < T [i + j] we have P [ℓj ] < P [j]. To complete the proof we need to show that there is no k, j − v < k < j, such that P [ℓj ] < P [k] < P [j]. But if this were the case we would have T [i + ℓj ] < T [i + k] < T [i + j] contrary to the assumption that T [i+ℓj ] is the immediate predecessor of T [i+j] in T [i+j −w+1, i+j]. Since it is always To [i+j] ≤ q−1, the above lemma tells us that if P [1, p] ≈ T [i+1, i+p] we must have To [i + j] = Po [j] for every j, q ≤ j ≤ p. For j = 2, 3, . . . , q − 1 the lemma establishes that To [i + j] must be either equal to Po [j] or larger than j − 1. Summing up we have the following corollary. Corollary 2. Given a reference T [1, n] and a pattern P [1, p] with p > q, if P [1, p] ≈ T [i + 1, i + p] then we must have To [i + 2, i + p] = x2 x3 · · · xq−1 Po [q] Po [q + 1] · · · Po [p] (3) where for j = 2, . . . , q − 1 either xj = Po [j] or xj ≥ j. In view of the above corollary, our strategy to solve the order preserving matching problem is to build a compressed index for the sequence To . Then, given a pattern P [1, p] with p > q, we compute Po [1, p] and then the set of positions i1 , i2 , . . . , im satisfying (3). Clearly, we can have P [1, p] ≈ T [i + 1, i + p] only if i ∈ {i1 , i2 , . . . , im }. However, since Corollary 2 states only a necessary condition, some of these positions could be false positives and a verification step is necessary. For the verification step we need the actual values of the sequence T . Since we are interested in indexing and compressing T , instead of the original representation we save space using a representation that takes advantage of the values in To that are stored in the index. Given T [1, n] and the corresponding ordering component To [1, n], we define a new sequence Tδ [1, n] as follows. Let Tδ [1] = T [1]. For i = 2, . . . , n let iq = max(1, i − q + 1) and: ( min T [iq , i − 1] − T [i] if To [i] = 0 (4) Tδ [i] = T [i] − T [i − To [i]] if To [i] > 0. Observe that for i ≥ 2, Tδ [i] ≥ 0. Indeed, if To [i] = 0 then by (2) T [i] ≤ min T [iq , i − 1]. If To [i] > 0 since T [i − To [i]] is the immediate predecessor of T [i] in T [iq , i] it is Tδ [i] ≥ 0. The sequence Tδ is called the δ component of T . While To provides information on the ordering of T ’s elements, Tδ contains information on the absolute values of T ’s elements. Together these two sequences contain the same information as T , as shown by the following lemma. Lemma 3. Given To [1, n] and Tδ [1, n] it is possible to retrieve T [1, n] in linear time. Proof. It is T [1] = Tδ [1]. For i = 2, . . . , n let iq = max(1, i − q + 1). From (4) we get ( min T [iq , i − 1] − Tδ [i] if To [i] = 0, T [i] = Tδ [i] + T [i − To [i]] if To [i] > 0. Summing up, our approach to compress and index an integer sequence T and support order preserving pattern matching is the following: 4 1. Select a window size q and build the ordering component To and the δ component Tδ . 2. Build a compressed full-text index for To and compress Tδ taking advantage of To . The compressed index for To and the compressed representation of Tδ constitute our index. To search the order preserving occurrences of a pattern of length at least q using our index: 1. Given P [1, p] compute the corresponding ordering component Po . 2. Use the full-text index for To to find the set of candidate positions i1 , i2 , . . . , im satisfying Corollary 2. 3. For each candidate position ik use To and Tδ to retrieve T [ik + 1, ik + p] and verify whether P [1, p] ≈ T [ik + 1, ik + p]. The above description is quite general and can be realized in many different ways. In the following sections we describe our particular implementation and experimentally measure its effectiveness. 4 Representation of the components To and Tδ We represent To [1, n] using a Compressed Suffix Array (csa) consisting of a Huffman shaped Wavelet Tree [14] built on the BWT of the sequence To (in our experiments we used the csa wt class from the sdsl-lite library [12]). This approach guarantees a reasonable compression of To and supports very efficiently the search inside To . More precisely, given a pattern p the above csa computes in O(p) time the range of rows [b, e] of the Suffix Array of To which are prefixed by p (see [10, 20] for details). To find the actual position in To of each occurrence of p, the csa stores the set of Suffix Array entries containing text positions which are multiple of a previously chosen block size B. Then, for each row r ∈ [b, e] we walk backward in the text using the LF-map until we reach a marked Suffix Array entry from which we can derive the position in To of the occurrence that prefixes row r. The above scheme uses O(n + (n/B) log n) bits of space and can find the position of all (exact) occurrence of p in To in O(|p| + B occ) time, where occ = e − b + 1 is the number of occurrences. Clearly, the parameter B offers a trade-off between space usage and running time. Having chosen a representation for To we now consider the problem of compactly storing the information in Tδ [1, n]. We do not need to search inside Tδ however, during the verification phase, we do need to extract (decompress) the values in random portions of Tδ . For this reason we split Tδ in blocks of size B (ie the same size used for the blocks in the csa of To ) and we compress each block independently. The k-th block consists of the subsequence Tδ [kB + 1, kB + B], except for the last block which has size n mod B. Additionally, we use a header storing the starting position of each block. Hence, given a block number we can decompress it in O(B) time. To compactly represent a block of Tδ we take advantage of the fact that the corresponding values in To are available during compression and decompression. Recalling the definition of Tδ [i] in (4), we partition the values in T into three classes: 1. those such that T [i] = min T [iq , i] are called minimal; 2. those such that T [i] = max T [iq , i] are called maximal; 5 Name ibm prices tmax ecg rwalk rand # Values 2,167,147 31,559,990 15,476,000 20,140,000 50,000,000 50,000,000 Description ibm stock tick data from Sep. 2011 to Feb. 2016 daily, hourly, and 5min US stock prices max daily temperature from 424 US stations 22 hours and 23 minutes of ECG data random walk with integer steps in the range [−20, 20] random integers in the range [−20, 20] Figure 1: Files used in our experiments. All values are 32-bit integers so the size in bytes of the files is four times the number of values. All test files and the source code of our algorithms are available at https://people.unipmn.it/manzini/stockmarket/. 3. all other values are called intermediate. The class of a value can be easily determined by both compressor and decompressor: minimal values are those such that Tδ [i] = 0; maximal values are those such that Tδ [i] 6= 0 and T [i − Tδ [i]] = max T [iq , i − 1]; all other values are intermediate. For each block we define m = max{Tδ [i] | i is minimal}, M = max{Tδ [i] | i is maximal}; and we store these two values at the beginning of the block. When we encounter a minimal (resp. maximal) value T [i] we know that the corresponding value Tδ [i] will be in the range [0, m + 1) (resp. [0, M + 1)). The interval is semi-open since the right extreme is excluded. When we encounter a intermediate value T [i] we know that Tδ [i] will be in the range [0, v − T [i − To [i]]) where v is the smallest element in T [iq , i − 1] largest than T [i − To [i]] (note that if v = T [i − To [i]] + 1 it is Tδ [i] = 0 and there is nothing to encode). Summing up, compressing a block of the sequence Tδ amounts to compressing a sequence of non-negative integers ℓ1 , ℓ2 , . . . , ℓB with the additional information that for i = 1, . . . , B, ℓi < wi where the values w1 , . . . , wB are known during both compression and decompression.2 Let bin(k) denote the binary representation of the integer k. We have experimented with three different integer encoders. lsk: Log-skewed coding described in [19] (but probably known for a long time). Encodes an integer ℓ ∈ [0, w) using at most |bin(w − 1)| bits. If w is not a power of two the smallest values in the range [0, w) are encoded using less than |bin(w − 1)| bits. The encoding takes at most log(w) + O(1) bits. dlt: Delta coding [8]. Encodes an integer ℓ ∈ [0, w) using 2|bin(ℓ + 1)| − 1 bits consisting of the unary representation of |bin(ℓ + 1)| followed by the bits of bin(ℓ + 1) except for the most significant bit. This encoding takes 2 log(ℓ + 1) + O(1) bits, is efficient for small ℓ but does not take advantage of w. lsd: Log-skewed-delta coding: a new approach combining lsk and dlt. Encodes ℓ ∈ [0, w) by first using lsk to encode the integer |bin(ℓ + 1)| ∈ [0, |bin(w)|] followed by the bits of bin(ℓ + 1) except for the most significant bit. The encoding takes at most log(ℓ + 1) + log log w + O(1) bits. 6 We have tested the above three coders for different values of the window size q and of the block size B on the collection of test files described in Fig. 1. The results for B = 32 are shown in Table 1 together with the space occupancy of the csa for the sequence To . We can summarize this first set of experiments as follows: 1. Among the three encoders lsk is the one that compresses better, closely followed by lsd, while dlt is clearly worse. We have also tested a mixed approach in which intermediate values are encoded with lsk while minimal and maximal values are encoded with lsd, but this strategy did not improve over the simpler lsk encoder. For this reason in rest of the paper delta values are always encoded with lsk. 2. As the window size q increases the cost of storing Tδ decreases while the csa size increases. This was to be expect since a larger q means that more information is contained in To . Summing up, for a given block size B and window size q our “stock market index” (smi from now on, again with no claim that it is particularly suitable for stock market data) consists of the csa for To and a compressed representation of Tδ obtained using the lsk encoder. Table 2 shows the overall space of our index for different values of B and q compared to the space used by gzip and by the state of the art compressor xz. We can see that smi’s space usage is essentially at par with gzip’s: it can be smaller or larger depending on the block size B. As expected xz compression is clearly superior to both. These data show that smi uses an amount of space similar to modern compressed full text indices for exact pattern matching [13]. 5 Searching a Stock Market Index Given a pattern P [1, p], to find its order-preserving occurrences in T we compute its order component Po and use Corollary 2. For example, if q = 4 and Po = (0, 0, 1, 3, 2, 0), Corollary 2 tells us that in correspondence to Po [4, p] = (3, 2, 0) To must be (3, 2, 0) (an exact match), while in correspondence of Po [3] = 1, To must be either 1 or 3, and in correspondence of Po [2] = 0, To must be either 0, 2, or 3. In other words if T [i+1, i+p] ≈ P then To [i + 2, i + p] must be one of the following 6 sequences: (0, 1, 3, 2, 0) (0, 3, 3, 2, 0) (2, 1, 3, 2, 0) (2, 3, 3, 2, 0) (3, 1, 3, 2, 0) (3, 3, 3, 2, 0). In general, if the window size is q the number of sequences satisfying Corollary 2 is (q −1)!. Clearly, not all the (q − 1)! subsequences will necessarily occur inside To . Using To ’s csa we compute the range of Suffix Array rows which are prefixed by each one of the (q − 1)! subsequences mentioned above. Recall that the basic operation of a csa is the backward search in which, given the range of rows prefixed by a substring α and a character c, we find in O(1) time the range of rows prefixed by cα. This suggests to compute the desired set of row ranges with a two steps procedure: first (Phase 1) with p−q +1 backward search steps we compute the range of rows prefixed by P [q, p]; then (Phase 2) with additional backward search steps we compute the range of rows prefixed by x2 x3 · · · xq−1 P [q] · · · P [p] for each (q − 2)-tuple x2 , . . . , xq−1 satisfying the conditions of Corollary 2. Phase 2 can 2 While Tδ blocks are compressed independently, To values are defined globally. Hence for the first q − 1 values of a block To may point to a value in the previous block. In this case we store in Tδ also the position of the predecessor inside the block. 7 B = 32 q=4 B = 32 q=8 B = 32 q = 12 csa lsk dlt lsd csa lsk dlt lsd csa lsk dlt lsd ibm 0.09 0.18 0.19 0.18 0.11 0.17 0.18 0.17 0.12 0.17 0.18 0.17 prices 0.10 0.25 0.30 0.26 0.13 0.24 0.29 0.25 0.14 0.23 0.28 0.25 tmax 0.10 0.22 0.25 0.23 0.13 0.20 0.23 0.21 0.15 0.19 0.23 0.21 ecg 0.09 0.18 0.20 0.19 0.11 0.17 0.20 0.18 0.13 0.17 0.19 0.18 rwalk 0.10 0.24 0.28 0.26 0.13 0.23 0.27 0.25 0.15 0.22 0.27 0.24 rand 0.11 0.24 0.28 0.26 0.14 0.22 0.25 0.23 0.16 0.21 0.25 0.22 Table 1: Space usage of To ’s csa and of Tδ compressed with three different encoders: logskewed (lsk), delta coding (dlt), and log-skewed delta (lsd). The reported values are the ratio between the size of compressed file over the size of the test file (both expressed in bytes). smi q = 4 B = 32 smi q = 8 smi q = 12 smi q = 4 B = 64 smi q = 8 smi q = 12 smi q = 4 B = 96 smi q = 8 smi q = 12 gzip --best xz --best ibm 0.26 0.27 0.28 0.20 0.21 0.21 0.18 0.19 0.19 0.22 0.13 prices 0.35 0.37 0.38 0.29 0.30 0.31 0.27 0.28 0.28 0.37 0.24 tmax 0.32 0.33 0.34 0.26 0.26 0.27 0.24 0.24 0.25 0.24 0.17 ecg 0.27 0.29 0.30 0.21 0.22 0.23 0.19 0.20 0.21 0.19 0.12 rwalk 0.34 0.36 0.37 0.28 0.29 0.30 0.25 0.27 0.28 0.36 0.23 rand 0.35 0.36 0.37 0.28 0.28 0.29 0.26 0.26 0.26 0.24 0.18 Table 2: Space usage of the Stock Market Index (smi) for different values of B and q. Each value is the ratio between the size of the index over the size of the test file, both expressed in bytes. For completeness we show also the space usage for gzip and xz. 8 require up to q! backward search steps, but the number of steps is also upper bounded by q times the number of row ranges obtained at the end of the phase, which is usually much smaller. At the end of Phase 2 we are left with a set of rows each one representing a position in T where an order preserving match can occur. To verify if there is actually a match we have to decompress the corresponding subsequence of T and compare it with P . This is done (Phase 3) taking again advantage of the properties of To ’s csa. Given a row index r representing a position in To prefixed by a string x2 x3 · · · xq−1 P [q] · · · P [p] we use the LF-map to move backward in To until we reach a marked position, that is, a position in To (and hence in T ) which is a multiple of the block size B (say position ℓB) and marks the beginning of block ℓ. Each time we apply the LF-map we also obtain a symbol yi of To hence when we reach the beginning of the block we also have the sequence y1 y2 · · · yk x2 x3 · · · xq−1 P [q] · · · P [p] of To values from the beginning of the block till the position corresponding to P [p]. Using this information and the compressed representation of Tδ (whose blocks are compressed independently) we are able to retrieve the corresponding T values T [ℓB + 1]T [ℓB + 2] · · · T [ℓB + k]T [ℓB + k + 1] · · · T [ℓB + k + p − 1] and determine if there is an actual order preserving match between the last p values of the above sequence and P [1, p]. If there is match the algorithm outputs the starting position in T of the matching sequence (the value ℓB + k in the above example). Phase 3 is usually the most expensive step since the algorithm has to consider one candidate at a time and for each candidate we need to reach the beginning of the block containing it. We can therefore expect that its running time is linearly affected by the block size B. Note that in our implementation Phase 2 and 3 are interleaved: as soon as we have determined a range of rows prefixed by one of the patterns in Corollary 2 we execute Phase 3 for all rows in the range before considering any other row range. 5.1 Strict index: Taking care of equal values In this section we discuss the modifications which must be made to our index and algorithms in the general case when we cannot assume all values in our sequences are distinct. If equal values can occur, according to definition (1), to have P [1, p] ≈ T [i + 1, i + p] whenever P [j] = P [k] we must have T [i+j] = T [i+k]. In Section 3 we side-stepped this problem assuming that later occurrences of a value are greater that previous occurrences: Under that assumption, if P [j] = P [k] with j < k it is acceptable also that T [i + j] < T [i + k]. Since, if P [1, p] ≈ T [i + 1, i + p] according to the stricter definition they are order isomorphic also under the assumption used in Section 3, we can build an index for T as described above and only change the verification of the single candidates (Phase 3). However, there is a non-trivial improvements that can be made to the algorithm to reduce the number of candidates. The improvement is a consequence of the following lemma. Lemma 4. In the presence of equal values, if P [1, p] ≈ T [i+1, i+p] and P [j −Po [j]] = P [j] with Po [j] > 0, then it is To [i + j] = Po [j]. Proof. If Po [j] > 0 and P [j − Po [j]] = P [j] then P [j − Po [j]] must be rightmost value to the left of P [j] which is equal to P [j]. The hypothesis P [1, p] ≈ T [i + 1, i + p] implies that the same should be true for T [i + j − Po [j]] with respect to T [i + j]. Hence we must have To [i + j] = Po [j] as claimed. 9 ssmi q = 4 B = 32 ssmi q = 8 ssmi q = 12 ssmi q = 4 B = 64 ssmi q = 8 ssmi q = 12 ssmi q = 4 B = 96 ssmi q = 8 ssmi q = 12 gzip --best xz --best ibm prices tmax ecg rwalk rand 0.27 0.28 0.29 0.20 0.21 0.22 0.18 0.19 0.20 0.22 0.13 0.35 0.37 0.39 0.29 0.31 0.32 0.27 0.29 0.30 0.37 0.24 0.32 0.34 0.35 0.26 0.27 0.28 0.24 0.25 0.26 0.24 0.17 0.28 0.30 0.31 0.21 0.23 0.24 0.19 0.21 0.22 0.19 0.12 0.34 0.36 0.38 0.27 0.29 0.30 0.25 0.27 0.28 0.36 0.23 0.35 0.36 0.37 0.28 0.29 0.30 0.26 0.26 0.27 0.24 0.18 Table 3: Space usage of the Strict Stock Market Index (ssmi) for different values of B and q. Each value is the ratio between the size of the index over the size of the test file, both expressed in bytes. For completeness we show also the space usage for gzip and xz. Because of the above Lemma, in the presence of equal values Corollary 2 should be modified so that for j = 2, . . . , q − 1 we should consider the case xj > j only if Po [j] = 0 or P [j − Po [j]] 6= P [j]. Indeed, by Lemma 4 whenever Po [j] 6= 0 and P [j − Po [j]] = P [j] we must have To [i + j] = Po [j]. Hence, in the presence of equal values in the pattern we need to do consider a smaller number of candidates (see the discussion of Phase 2 of the search algorithm at the beginning of Section 5). If we are only interested to search in strict mode, ie considering equal values, we can take advantage of the presence of equal values in T to completely avoid the encoding of some of the δ components. This will yield a smaller compressed file and faster search. To achieve this result we slightly change the definition of the order component given in (2) as follows. When computing To [i], assume the immediate predecessor of T [i] in T [iq , i − 1] is some value y that appears at least twice in T [iq , i−1]. Say y = T [k1 ] = T [k2 ] = · · · = T [kh ] with iq ≤ kh < · · · k2 < k1 ≤ i−1. If this is the case, if T [i] = y we set as usual To [i] = i−k1 ; whereas if T [i] > y we set To [i] = i − k2 (ie we skip an occurrence of y). Using this scheme, whenever To [i] = k > 0 and there is another occurrence of T [i−k] in T [iq , i−1], both the coder and the decoder can tell whether T [i] = T [i−k] or T [i] > T [i−k] depending on the position of the other occurrence of T [i − k]. In particular, if both the coder and decoder know that T [i] = T [i − k] there is no need to compute and store the corresponding value Tδ [i]. The space saving for Tδ can be significant when T contain long stretches of equal values. If the modified procedure is used to compute both To and Po the search algorithm does not need to be modified. A completely different approach to search in strict mode is to add an additional bit to each nonzero entry of To to distinguish whether T [i − To [i]] is equal to T [i] or not. More precisely, we define the order component as follows:   if T [i] < min T [iq , i − 1] 0 To [i] = 2k if T [i − k] = max{T [j] | iq ≤ j < i ∧ T [j] ≤ T [i]}, T [i − k] 6= T [i].   2k − 1 if T [i − k] = max{T [j] | iq ≤ j < i ∧ T [j] ≤ T [i]}, T [i − k] = T [i]. With this approach To contains values in the range [0, 2q − 1] so we expect its index to take 10 more space. However, we also expect Tδ to takes less space since values corresponding to odd entries in To don’t have to be encoded. We have implemented this variant, from now on called the strict index, and its space usage is shown in Table 3. Comparing Table 3 with Table 2 we see that for the same values B and q the strict index takes only slightly more space, the difference being about 1% of the original (uncompressed) file size. 6 Experimental results All tests have been performed on a desktop PC with eight Intel-I7 3.40GHz CPUs running Linux-Debian 8.3. All tests used a single CPU. Note that Phase 3 of our algorithm can be easily parallelized using multiple threads (and to some extent also Phase 2), but we leave this development to future research. All tests involved 1000 patterns of length 15, 20, and 50 extracted from the same file where the patterns are later searched, so every search reports at least one occurrence. The patterns where extracted selecting 1000 random position in the in file. Note that patterns occurring more often are more likely to be selected so this setting is the least favorable for our algorithm: like all algorithms based on an index, it is much faster when the pattern does not occur, or occurs relatively few times. 6.1 Filtering effectiveness Since Phases 1 and 2 of our algorithms produce a set of candidates that must be verified in Phase 3, in our first experiment we measure how effective are the first two Phases in producing only a small number of candidates which are later discarded (that is, how effective are Phases 1 and 2 in producing a small number of false positives). The results of this experiment for smi are reported in Table 4. We see that for patterns of length 15 the average number of occurrences is surprisingly high, with a peak of 73000+ average occurrences for the file ecg (recall the random selection of patterns favors those which occur more often). Despite this, we see that in most cases for Phase 2 the ratio is smaller than 1.50, that is, the number of candidates at the end of Phase 2 is less than one and a half times the number or actual occurrences. Note that the poor performance of Phase 1 for q = 12 was to be expected since when |P | = 15 Phase 1 will only search in To ’s csa the last 4 symbols of Po which cannot provide an effective filter. Not surprisingly for patterns of length 20 and 50 both phases are much more effective. In particular, the number of false positives at the end of Phase 2 is usually smaller than 10% the number of occurrences (ratio below 1.10). Note that in terms of filtering power there is not a clear winner among the different window sizes. The reason is that a larger window implies that the information stored in To is “more accurate” but at the same time Phase 2 will start earlier and be less effective since it will generate (q − 1)! row ranges. For the search in strict mode the number of false positives as a function of the window size q follows a similar trend. The data are shown in Table 7 in the Appendix. 6.2 Running times Our search algorithms have no direct competitors since they are the first ones to combine compression and indexing. We expect them to be faster than scan based (online) algorithms [2, 6, 16, 18, 5], at least for sufficiently long files, and slower than the offline algorithms [4, 7] designed without considering the problem of compressing the reference 11 |P | = 15 ibm prices tmax 1 2 1 2 1 2 1155.43 2.22 1.23 7.00 1.21 42.73 1.28 293.83 1.97 1.21 8.99 1.19 170.71 1.31 1469.18 1.17 1.01 1.58 1.01 5.20 1.02 73054.84 4.36 1.00 1.33 15.87 13.07 1.06 6.45 6.24 2.46 139.62 5.79 1.05 3.52 1.09 7.75 13745.64 2620.21 1.06 13.32 1.79 |P | = 20 ave # occs q = 4 Phase 1 Phase 2 ibm 273.43 1.69 1.11 prices 55.45 1.17 1.05 tmax 1168.09 1.05 1.00 ecg 24299.10 1.21 1.05 Phase 1 Phase 2 4.95 1.14 3.42 1.08 1.41 1.01 q = 12 Phase 1 Phase 2 14.38 1.20 9.66 1.11 ibm 1.00 2.14 1.08 2.47 1.00 4.86 1.00 prices 1.00 1.00 1.00 1.00 1.00 1.00 1.00 ave # occs q = 4 Phase Phase q = 8 Phase Phase q = 12 Phase Phase q=8 |P | = 50 ave # occs q = 4 Phase Phase q = 8 Phase Phase q = 12 Phase Phase 1 2 1 2 1 2 ecg rwalk rand rwalk 1.01 1.40 1.19 rand 1.00 1.02 1.01 2.31 1.04 1.92 1.02 1.00 1.00 1.56 1.01 4.57 1.06 89.67 1.07 1.01 1.00 tmax 380.55 1.02 1.00 1.07 1.00 1.12 1.01 ecg 5.45 2.05 1.78 1.77 1.14 2.53 1.05 rwalk 1.00 1.00 1.00 1.00 1.00 1.00 1.00 rand 1.00 1.00 1.00 1.00 1.00 1.00 1.00 Table 4: False positives as a function of the window size q. The first row shows the average number of actual occurrences for the patterns in the test set. The other rows show the ratios between candidates and actual occurrences at the end of Phase 1 and 2. sequence. We plan a comprensive experimental analysis in a future study; in this section we are mainly interested in optimizing our algorithms and understanding the influence of the window size q and of the block size B on the running times. Table 5 reports the running times of our stock market index (smi) for different values of q and B. As a reference we report also the running times of a simple scan based search algorithm in which we check each text position with the verification algorithm outlined in [5, Sec. 3] (this is the same verification algorithm used by Phase 3 of our algorithm). We observe that for the largest files (prices, rwalk, rand) smi is at least two order of magnitudes faster than scan, the difference being more evident when the average number of occurrences is small. On the other hand, for the file ecg with |P | = 15 there are 73000+ average occurrences per pattern, and our algorithm is slower than scan. The explanation is that just to extract 73000 length-15 subsequences smi decompresses more than one million input values which is roughly 1/20 of the entire file. Since subsequences are extracted in random order and there are additional overheads due to compression, it is 12 |P | = 15 ave # occs ibm 1155.43 prices 293.83 tmax 1469.18 ecg 73054.84 rwalk 4.36 rand 1.00 q=4 B = 32 q = 8 q = 12 q=4 B = 64 q = 8 q = 12 scan 3.64 5.09 7.34 6.49 9.19 12.88 17.28 0.94 1.38 2.32 1.71 2.54 4.02 206.44 3.01 4.50 5.77 6.01 8.99 11.55 101.90 220.34 318.10 399.17 407.17 604.65 768.24 129.71 0.15 0.15 1.09 0.26 0.25 1.55 300.89 0.04 0.02 0.08 0.07 0.03 0.11 352.94 |P | = 20 ave # occs q=4 B = 32 q = 8 q = 12 q=4 B = 64 q = 8 q = 12 scan ibm 273.43 0.78 1.14 1.64 1.39 2.04 2.93 17.10 prices 55.45 0.14 0.22 0.29 0.26 0.39 0.51 208.34 tmax 1168.09 2.44 4.13 4.73 4.69 7.24 9.79 101.65 ecg 24299.10 77.52 114.90 143.78 139.45 210.68 268.84 127.16 rwalk 1.01 0.01 0.02 0.03 0.02 0.03 0.04 303.01 rand 1.00 0.01 0.02 0.03 0.02 0.03 0.04 367.82 |P | = 50 ave # occs q=4 B = 32 q = 8 q = 12 q=4 B = 64 q = 8 q = 12 scan ibm 1.00 0.01 0.02 0.03 0.01 0.02 0.03 16.76 prices 1.00 0.02 0.03 0.04 0.02 0.03 0.04 202.29 tmax 380.55 0.91 1.44 1.92 1.52 2.40 3.20 100.38 ecg 5.45 0.04 0.05 0.07 0.07 0.07 0.09 120.99 rwalk 1.00 0.02 0.03 0.04 0.02 0.04 0.05 296.46 rand 1.00 0.02 0.03 0.04 0.03 0.04 0.05 380.01 Table 5: smi vs scan: Average running times, in milliseconds, for searching 1000 random patterns of length 15, 20, and 50. Running times do not include the time to load the compressed index (for smi) or the uncompressed text (for scan). 13 |P | = 15 ave # occs ibm 92.63 prices 59.70 tmax 1392.66 ecg 2142.49 rwalk 2.38 rand 1.00 q=4 B = 32 q = 8 q = 12 q=4 B = 64 q = 8 q = 12 scan 0.23 0.25 0.29 0.43 0.49 0.57 16.47 0.17 0.21 0.44 0.31 0.41 0.64 252.64 3.04 3.80 3.77 6.39 8.01 8.65 122.92 7.73 9.39 11.98 14.26 18.89 23.65 135.78 0.06 0.09 0.72 0.11 0.13 0.88 406.92 0.02 0.03 0.05 0.03 0.03 0.06 419.95 |P | = 20 ave # occs q=4 B = 32 q = 8 q = 12 q=4 B = 64 q = 8 q = 12 scan ibm 24.22 0.06 0.07 0.08 0.11 0.13 0.17 16.59 prices 1.49 0.02 0.03 0.04 0.02 0.04 0.05 246.37 tmax 988.39 2.15 2.73 2.70 4.26 5.54 5.82 121.52 ecg 106.78 0.47 0.56 0.81 0.85 1.07 1.46 132.68 rwalk 1.00 0.01 0.03 0.05 0.02 0.03 0.06 403.77 rand 1.00 0.01 0.03 0.04 0.02 0.04 0.05 410.79 |P | = 50 ave # occs q=4 B = 32 q = 8 q = 12 q=4 B = 64 q = 8 q = 12 scan ibm 1.00 0.02 0.02 0.03 0.01 0.02 0.03 15.92 prices 1.00 0.02 0.03 0.05 0.02 0.04 0.06 241.06 tmax 371.99 0.87 1.01 0.97 1.55 1.90 1.87 114.22 ecg 1.00 0.02 0.03 0.04 0.02 0.03 0.04 131.76 rwalk 1.00 0.02 0.04 0.06 0.02 0.04 0.06 392.10 rand 1.00 0.02 0.04 0.06 0.03 0.05 0.07 345.17 Table 6: ssmi vs scan: Average running times, in milliseconds, for searching 1000 random patterns of length 15, 20, and 50. Running times do not include the time to load the compressed index (for ssmi) or the uncompressed text (for scan). 14 not surprising that a simple scan is faster. This suggests that to efficiently deal with this almost pathological number of occurrences it is necessary to use ad hoc techniques as it was done for other indices [17, 21]. The results for the two smallest files in our collection (ibm 2 million values, tmax 15 million values) show that our approach clearly outperforms scan also when the number of occurrences is relatively large and the size of the input is relatively small. The results in Table 5 show that doubling the block size B from 32 to 64 usually doubles smi’s running time which is and indirect confirmation that Phase 3 (the only phase influenced by B) is the most time consuming. We also see that the smallest running times are obtained consistently with q = 4, the only exception being rwalk and rand for |P | = 15. The likely explanation here is that for a smaller q all operations on the Wavelet Tree underlying the csa are faster and this makes up for the better filtration obtained in some instances by Phase 1 and 2 for larger values of q. Since, according to Table 1, q = 4 also gives the highest compression, among the tested values q = 4 appears to be the optimal choice. We have tested smi also for q = 3 (smi requires q > 2). We do not report the results here, but it turns out that q = 3 yields essentially the same compression as q = 4 and very similar search speed (there is not a clear winner among the two). Table 6 shows the search performance of our strict stock market index (ssmi). Since the order preserving matching is strict, the average number of occurrences of each pattern is much smaller (up to 200 times for ecg for |P | = 15) and is at most 2142. Hence, we do not have the pathological cases we had previously and ssmi was always faster than scan. For B = 32 and q = 4 the minimum speedup was 17 (for ecg and |P | = 15). For ssmi we see that q = 4 always gives the smallest space usage and the fastest speed, and that doubling the block size doubles the running times, showing again that also for ssmi the cost of Phase 3 dominates the overall cost. 7 Concluding Remarks In this paper we have proposed a compressed index for the order preserving pattern matching problem, considering both the weak and the strict order preserving matching models. Our approach is based on the new idea of splitting the original sequence into two complementary components: the order component and the δ component. The problem of finding the order preserving occurrences of a pattern is transformed into an exact search problem on the order component followed by a verification phase using the δ component. Experiments show that our index has a space usage similar to gzip and can find order preserving occurrences much faster than a sequential scan. Our approach is quite general and improvements could be obtained by changing some implementation choices. For example, we index the order component using a Wavelet-Tree based FM-index; to improve the performances for inputs with many (order preserving) repetitions we can use a different compressed full-text index. The compression of the δ component can also be radically changed without altering the overall scheme. References [1] Djamal Belazzougui, Adeline Pierrot, Mathieu Raffinot, and Stéphane Vialette. Single and multiple consecutive permutation motif search. In ISAAC, volume 8283 of Lecture Notes in Computer Science, pages 66–77. Springer, 2013. 15 [2] Domenico Cantone, Simone Faro, and M. Oguzhan Külekci. An efficient skip-search approach to the order-preserving pattern matching problem. In Stringology, pages 22–35. Department of Theoretical Computer Science, Czech Technical University in Prague, 2015. [3] Tamanna Chhabra, Emanuele Giaquinta, and Jorma Tarhio. Filtration algorithms for approximate order-preserving matching. In SPIRE, volume 9309 of Lecture Notes in Computer Science, pages 177–187. Springer, 2015. [4] Tamanna Chhabra, M. Oguzhan Külekci, and Jorma Tarhio. Alternative algorithms for order-preserving matching. In Stringology, pages 36–46. Department of Theoretical Computer Science, Czech Technical University in Prague, 2015. [5] Tamanna Chhabra and Jorma Tarhio. A filtration method for order-preserving matching. Inf. Process. Lett., 116(2):71–74, 2016. [6] Sukhyeun Cho, Joong Chae Na, Kunsoo Park, and Jeong Seop Sim. A fast algorithm for order-preserving pattern matching. Inf. Process. Lett., 115(2):397–402, 2015. [7] Maxime Crochemore, Costas S. Iliopoulos, Tomasz Kociumaka, Marcin Kubica, Alessio Langiu, Solon P. Pissis, Jakub Radoszewski, Wojciech Rytter, and Tomasz Walen. Order-preserving incomplete suffix trees and order-preserving indexes. In SPIRE, volume 8214 of Lecture Notes in Computer Science, pages 84–95. Springer, 2013. [8] Peter Elias. Universal codeword sets and representations of the integers. IEEE Trans. Information Theory, 21(2):194–203, 1975. URL: http://dx.doi.org/10.1109/TIT.1975.1055349, doi:10.1109/TIT.1975.1055349. [9] Simone Faro and M. Oguzhan Külekci. Efficient algorithms for the order preserving pattern matching problem. In Algorithmic Aspects in Information and Management, volume 9778, 2016. URL: ttp://www.springerlink.com/index/10.1007/978-3-642-02158-9, doi:10.1007/978-3-642-02158-9. [10] Paolo Ferragina and Giovanni Manzini. An experimental study of a compressed index. Inf. Sci., 135(1-2):13–28, 2001. URL: http://dx.doi.org/10.1016/S0020-0255(01)00098-6, doi:10.1016/S0020-0255(01)00098-6. [11] Pawel Gawrychowski and Przemyslaw Uznanski. Order-preserving pattern matching with k mismatches. In CPM, volume 8486 of Lecture Notes in Computer Science, pages 130–139. Springer, 2014. [12] Simon Gog, Timo Beller, Alistair Moffat, and Matthias Petri. From theory to practice: Plug and play with succinct data structures. In SEA, volume 8504 of Lecture Notes in Computer Science, pages 326–337. Springer, 2014. [13] Simon Gog and Matthias Petri. Optimized succinct data structures for massive data. Softw., Pract. Exper., 44(11):1287–1314, 2014. URL: http://dx.doi.org/10.1002/spe.2198, doi:10.1002/spe.2198. 16 [14] Roberto Grossi, Ankur Gupta, and Jeffrey Scott Vitter. High-order entropycompressed text indexes. In SODA, pages 841–850. ACM/SIAM, 2003. [15] D. Gusfield. Algorithms on Strings, Trees, and Sequences: Computer Science and Computational Biology. Cambridge University Press, 1997. [16] Jinil Kim, Peter Eades, Rudolf Fleischer, Seok-Hee Hong, Costas S. Iliopoulos, Kunsoo Park, Simon J. Puglisi, and Takeshi Tokuyama. Order-preserving matching. Theor. Comput. Sci., 525:68–79, 2014. [17] Sebastian Kreft and Gonzalo Navarro. On compressing and indexing repetitive sequences. Theor. Comput. Sci., 483:115–133, 2013. [18] Marcin Kubica, Tomasz Kulczynski, Jakub Radoszewski, Wojciech Rytter, and Tomasz Walen. A linear time algorithm for consecutive permutation pattern matching. Inf. Process. Lett., 113(12):430–433, 2013. [19] Giovanni Manzini and Marcella Rastero. A simple compressor. Softw., Pract. Exper., 34(14):1397–1411, http://dx.doi.org/10.1002/spe.619, doi:10.1002/spe.619. and fast DNA 2004. URL: [20] Gonzalo Navarro and Veli Mäkinen. Compressed full-text indexes. ACM Comput. Surv., 39(1), 2007. URL: http://doi.acm.org/10.1145/1216370.1216372, doi:10.1145/1216370.1216372. [21] Gonzalo Navarro, Simon J. Puglisi, and Jouni Sirén. Document retrieval on repetitive collections. In ESA, volume 8737 of Lecture Notes in Computer Science, pages 725– 736. Springer, 2014. 17 Appendix: Additional tables |P | = 15 ave # occs q = 4 Phase Phase q = 8 Phase Phase q = 12 Phase Phase |P | = 20 ave # occs q = 4 Phase Phase q = 8 Phase Phase q = 12 Phase Phase 1 2 1 2 1 2 ibm 92.63 2.10 1.01 9.63 1.02 120.22 1.03 prices 59.70 2.43 1.04 6.58 1.03 304.25 1.09 tmax 1392.66 1.15 1.00 1.50 1.00 2.19 1.00 ecg 2142.49 2.28 1.07 8.99 1.04 60.70 1.06 rwalk 2.38 10.20 4.04 142.49 2.63 19105.57 7.68 1 2 1 2 1 2 ibm 24.22 2.42 1.01 7.87 1.02 31.38 1.03 prices 1.49 1.13 1.02 42.19 1.01 140.24 1.01 tmax 988.39 1.05 1.00 1.44 1.00 1.59 1.00 ecg 106.78 3.31 1.24 21.75 1.09 93.16 1.15 rwalk 1.00 1.14 1.07 1.26 1.00 39.29 1.01 rand 1.00 1.00 1.00 1.00 1.00 1.00 1.00 ibm prices tmax ecg rwalk rand 1.00 1.00 1.00 1.00 1.00 2.18 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 371.99 1.02 1.00 1.07 1.00 1.12 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 |P | = 50 ave # occs q = 4 Phase Phase q = 8 Phase Phase q = 12 Phase Phase 1 2 1 2 1 2 rand 1.00 3.58 2.02 1.43 1.00 436.38 1.02 Table 7: False positives as a function of the window size q for the Strict Stock Market Index (ssmi). The first row shows the average number of actual occurrences for the patterns in the test set. The other rows show the ratios between candidates and actual occurrences at the end of Phase 1 and 2. 18
8cs.DS
1 Knowledge Projection for Effective Design of Thinner and Faster Deep Neural Networks arXiv:1710.09505v1 [cs.CV] 26 Oct 2017 Zhi Zhang, Guanghan Ning, and Zhihai He Abstract—While deeper and wider neural networks are actively pushing the performance limits of various computer vision and machine learning tasks, they often require large sets of labeled data for effective training and suffer from extremely high computational complexity. In this paper, we will develop a new framework for training deep neural networks on datasets with limited labeled samples using cross-network knowledge projection which is able to improve the network performance while reducing the overall computational complexity significantly. Specifically, a large pre-trained teacher network is used to observe samples from the training data. A projection matrix is learned to project this teacher-level knowledge and its visual representations from an intermediate layer of the teacher network to an intermediate layer of a thinner and faster student network to guide and regulate its training process. Both the intermediate layers from the teacher network and the injection layers from the student network are adaptively selected during training by evaluating a joint loss function in an iterative manner. This knowledge projection framework allows us to use crucial knowledge learned by large networks to guide the training of thinner student networks, avoiding over-fitting, achieving better network performance, and significantly reducing the complexity. Extensive experimental results on benchmark datasets have demonstrated that our proposed knowledge projection approach outperforms existing methods, improving accuracy by up to 4% while reducing network complexity by 4 to 10 times, which is very attractive for practical applications of deep neural networks. Index Terms—Deep neural networks, knowledge projection, transfer learning, network distillation. I. I NTRODUCTION R ECENTLY, large neural networks have demonstrated extraordinary performance on various computer vision and machine learning tasks. Visual competitions on large datasets such as ImageNet [1] and MS COCO [2] suggest that wide and deep convolutional neural networks tend to achieve better performance, if properly trained on sufficient labeled data with well-tuned hyper-parameters, at the cost of extremely high computational complexity. Over-parameterization in large networks seems to be beneficial for the performance improvement [3], [4], however, the requirements for large sets of labeled data for training and high computational complexity pose significant challenges for us to develop and deploy deep neural networks in practice. First, low power devices such as mobile phones, cloud based services with high throughput demand, and real-time systems, have limited computational resources, which requires that the Z. Zhang, G. Ning and Z. He are with the Department of Electrical and Computer Engineering, University of Missouri, Columbia, MO, 65203 USA. network inference or testing should have low computational complexity. Besides the complexity issue, a large network often consumes massive storage and memory bandwidth. Therefore, smaller and faster networks are often highly desired in real-world applications. Recently, great efforts have been made to address the network speed issue. A variety of model compression approaches [5], [6], [7], [8], [9] were proposed to obtain faster networks that mimic the behavior of large networks. Second, in practical applications, we often have access to very limited labeled samples. It is very expensive to obtain human labeled ground-truth samples for training. In some applications domains, it is simply not feasible to accumulate enough training examples for deep networks [10], [11], [12], [13] . Interestingly, these two problems are actually coupled together. The network capacity is often positively correlated to its task complexity. For instance, we would expect a small network classifier of two classes (e.g. , dog and cat) to achieve a similar level of accuracy as a significantly larger network for tens of thousand classes of objects. Existing solutions to obtaining a fast network on new tasks is often based on a twostep approach: train the network on a large dataset, then apply model compression or distillation to the network after finetuning or transfer learning on the new dataset [9]. Each step is performed separately and they are not jointly optimized. Therefore, how to jointly address the problems of network compression, speed up, and domain adaptation becomes a very important and intriguing research problem. A successful line of work [14], [9], [15], [16], [17] suggest that cumbersome large neural networks, despite their redundancy, have very robust interpretation of training data. By switching learning targets from labels to interpreted features in small networks, we have observed not only speed-ups but also performance improvements. Inspired by this phenomenon, we are interested to explore if this interpretation power is still valid across different (at least similar) domains, and to what extent of performance a newly trained student network can achieve with the help of a large model pre-trained on different datasets. In this paper, we propose a Knowledge Projection Network (KPN) with a two-stage joint optimization method for training small networks under the guidance of a pre-trained large teacher network, as illustrated in Figure 1. In KPN, a knowledge projection matrix is learned to extract distinctive representations from the teacher network, and used to regularize the training process of the student network. We carefully design the teacher-student architecture and joint loss function so that the smaller student network can benefit from extra guidance 2 Learned Projection Large Teacher Network Testing [OFF] Desired Network Training [ON] Training Small domain dataset Fig. 1. System overview. We apply learned projection during training to guide a standard thinner and faster network for inference on a smaller domain dataset. while learning towards specific tasks. Our major observation is that, by learning necessary representations from a teacher network which is fully trained on a large dataset, a student network can disentangle the explanatory factors of variations in the new data and achieve more precise representation of the new data from a smaller number of examples. Thus, same level performance can be achieved using a smaller network. Extensive experimental results on benchmark datasets have demonstrated that our proposed knowledge projection approach outperforms existing methods, improving accuracy by up to 4% while reducing network complexity by 4 to 10 times, which is very attractive for practical applications of deep neural networks. Our contributions in this paper are summarized as follows: (1) we propose a new architecture to transfer the knowledge from a large teacher network pre-trained on a large dataset into a thinner and faster student network to guide and facilitate its training on a smaller dataset. Our approach addresses the issues of network adaptation and model compression at the same time. (2) We have developed a method to learn a projection matrix which is able to project the visual features from the teacher network into the student network to guide its training process and improve its overall performance. (3) We have developed an iterative method to select the optimal path for knowledge projection between the teacher and student networks. (4) We have implemented the proposed method in MXNet and conducted extensive experiments on benchmark datasets to demonstrate that our method is able to significantly reduce the network computational complexity by 4-10 times while largely maintaining or even improving the network performance by a significant margin. The rest of this paper is organized as follows. Related work is reviewed in Section II. We present the proposed Knowledge Projection Network in Section III. Experimental results are presented in Section IV. Finally, Section V concludes this paper. II. R ELATED W ORK Large neural networks have demonstrated extraordinary performance on various computer vision and machine learning tasks. During the past a few years, researchers have been investigating how to deploy these deep neural networks in practice. There are two major problems that need to be carefully addressed: the high computational complexity of the deep neural network and the large number labeled samples required to train the network [18], [19]. Our work is closely related to domain adaptation and model compression, which are reviewed in this section. To address the problem of inadequate labeled samples for training, methods for network domain adaptation [20], [12], [21] have been developed, which enable learning on new domains with few labeled samples or even unlabeled data. Transfer learning methods have been proposed over the past several years, and we focus on supervised learning where a small amount of labeled data is available. It has been widely recognized that the difference in the distributions of different domains should be carefully measured and reduced [21]. Learning shallow representation models to reduce domain discrepancy is a promising approach, however, without deeply embedding the adaptation in the feature space, the transferability of shallow features will be limited by the taskspecific variability. Recent transfer learning method coupled with deep networks can learn more transferable representations by embedding domain adaptations in the architecture of deep learning [22] and outperforms traditional methods by a large margin. Tzeng et al. [13] optimizes domain invariance by correcting the marginal distributions during domain adaptation. The performance has been improved, but only within a single layer. Within the context of deep feed-forward neural networks, fine-tune is an effective and overwhelmingly popular method [23], [24]. Feature transferability of deep neural networks has been comprehensively studied in [25]. It should be noted that this method does not apply directly to many real problems due to insufficient labeled samples in the target domain. There are also some shallow architectures [26], [27] in the context of learning domain-invariant features. Limited by representation capacity of shallow architectures, the performance of shallow networks is often inferior to that of deep networks [21]. With the dramatically increased demand of computational resources by deep neural networks, there have been considerable efforts to design smaller and thinner networks from larger pre-trained network in the literature. A typical approach is to prune unnecessary parameters in trained networks while retaining similar outputs. Instead of removing close-to-zero weights in the network, LeCunn et al. proposed Optimal Brain Damage (OBD) [5] which uses the second order derivatives to find trade-off between performance and model complexity. Hassibi et al. followed this work and proposed Optimal Brain Surgeon (OBS) [6] which outperforms the original OBD method, but was more computationally intensive. Han et al. [28] developed a method to prune state-of-art CNN models without loss of accuracy. Based on this work, the method of deep compression [7] achieved better network compression 3 ratio using ensembles of parameter pruning, trained quantization and Huffman coding, achieved 3 to 4 times layer-wise speed up and reduced the model size of VGG-16 [29] by 49 times. This line of work focuses on pruning unnecessary connections and weights in trained models and optimizing for better computation and storage efficiency. Various factorization methods have also been proposed to speed up the computation-intensive matrix operations which are the major computation in the convolution layers. For example, methods have been developed to use matrix approximation to reduce the redundancy of weights. Jenderberg et al. [8] and Denton et al. [30] use SVD-based low rank approximation. For example, Gong et al. [31] use a clustering-based product quantization to reduce the size of matrices by building an indexing. Zhang et al. [32] successfully compressed very deep VGG-16 [29] to achieve 4 times speed up with 0.3% loss of accuracy based on Generalized Singular Value Decomposition and special treatment on non-linear layers. This line of approaches can be configured as data independent processes, but fine-tuned with training data to improve the performance significantly. In contrast to off-line optimization, Ciresan et al. [33] trained a sparse network with random connections, providing good performance with better computational efficiency than densely connected networks. Rather than pruning or modifying parameters from existing networks, there has been another line of work in which a smaller network is trained from scratch to mimic the behavior of a much larger network. Starting from the work of Bucila et al. [14] and Knowledge Distillation (KD) by Hinton et al. [9], the design of smaller yet efficient networks has gained a lot of research interest. Smaller networks can be shallower (but much wider) than the original network, performing as well as deep models, as shown by Ba and Caruna in [34]. The key idea of knowledge distillation is to utilize the internal discriminative feature that is implicitly encoded in a way not only beneficial to original training objectives on source training dataset, but also has a side-effect of eliminating incorrect mappings in networks. It has been demonstrated in [9] that small networks can be trained to generalize in the same way as large networks with proper guidance. FitNets [15] achieved better compression rate than knowledge distillation by designing a deeper but much thinner network using trained models. The proposed hint-based training is one step further beyond knowledge distillation which uses a finer network structure. Nevertheless, training deep networks has proven to be challenging [35]. Significant efforts have been devoted to alleviate this problem. Recently, adding supervision to intermediate layers of deep networks is explored to assist the training process [36], [37]. These methods assume that source and target domains are consistent. It is still unclear whether the guided training is effective when the source and target domains are significantly different. In this paper, we consider a unique setting of the problem. We use a large network pre-trained on a large dataset (e.g. , the ImageNet) to guide the training of a thinner and faster network on a new smaller dataset with limited labeled samples, involving adaptation over different data domains and model compression at the same time. III. K NOWLEDGE P ROJECTION N ETWORK In this section, we present the proposed Knowledge Projection Network (KPN). We start with the KPN architecture and then explain the knowledge projection layer design. A multi-path multi-stage training scheme coupled with iterative pruning for projection route selection is developed afterwards. A. Overview An example pipeline of KPN is illustrated in Figure 2. Starting from a large teacher network pre-trained on a large dataset, a student network is designed to predict desired outputs for the target problem with guidance from the teacher network. The student network uses similar buiding blocks as the teacher network, such as Residue [38], Inception [39] or stacks of plain layers [29], sub-sampling and BatchNorm [40] layers. The similarity in baseline structure ensures smooth transferability. Note that the convolution layers consume most of the computational resources. Their complexity can be modeled by the following equation C= N −1 X Ci · Hi · Wi · Ci+1 · KiH · KiW , (1) i=1 where the computational cost is multiplicatively related to the number of input Ci and output channels Ci+1 , the spatial size of input feature map Hi · Wi where Hi and Wi are the height and width of the feature map at the i-th layer, and kernel size KiH · KiW . The student network is designed to be thinner (in terms of filter channels) but deeper to effectively reduce network capacity while preserves enough representation power [34], [15]. We depict the convolutional blocks in Figure 3 that are used to build the thin student networks. In contrast to standard convolutional layers, a squeeze-then-expand [41], [42] structure is effective in reducing the channel-wise redundancy by inserting spatially narrow (1 × 1) convolutional layers between 3 × 3 standard convolutional layers. We denote this structure as bottleneck Type A and extend it to a more compact squeeze-expand-squeeze shape, namely bottleneck Type B. With (1), we can calculate the proportional layerwise computation cost for the standard convolutional layer, bottleneck Type A and B, respectively. For simplicity, feature map dimensions are denoted in capital letters, and we use identical size for kernel height and width, denoted as K, without loss of generality: Cstandard = C · H · W · C 0 · K 2 , (2) CT ypeA = C · H · W · X + X · H · W · C 0 · K 2 , (3) CT ypeB = C ·H ·W ·X +X 2 ·H ·W ·K 2 +X ·H ·W ·C 0 . (4) Combining (2), (3) and (4), we define the reductions in computation for Type A and B as X X X CT ypeA = 0 + ≈ , Cstandard C · K2 C C (5) 4 1 1 32 100 256 192 96 Teacher network 64 Image 1 64 Knowledge Projection Layer 1 1 LKP 3 2 16 Forward path Backward path Cross-entropy loss Student network 32 128 10 64 64 16 192 128 128-channel output 96 64 Knowledge Projection with 64×96×1×1 kernel 1 2 Conditional paths Gradients Fig. 2. KPN architecture. Solid arrows showing the forward data-flow, dotted arrows showing the paths for gradients. C×H×W C×H×W C×H×W 3×3 Conv 1x1 Conv 1x1 Conv C’ × H × W X×H×W X×H×W 3x3 Conv 3x3 Conv C’ × H × W X×H×W 1x1 Conv C’ × H × W Fig. 3. Left: Standard 3x3 Convolutional layer. Middle: Bottleneck type A. computational cost while preserve the dimension of feature map and receptive field, and the layer-wise reduction is controlled by X. For example, by cutting the bottleneck channels by half, i.e. , X = C2 , we have the approximate reduction rate 21 for Type A, 41 ∼ 18 for Type B. In practice, the output channel C 0 is equal to or larger than input channel C: C 0 ∈ [C, 2C]. We replace standard convolutional layers by bottleneck structures A and B in the teacher network according to computational budget and constitute corresponding student network. Layer-wise width multipliers α = X C are the major contributor to model reduction. We use smaller α in deep layers where the feature is sparse and computational expensive layers where the gain is significant. The flexibility of bottleneck structures and elastic value range of α ensured we have enough degrees of freedom controlling the student network capacity. In our KPN, the student network is trained by optimizing the following joint loss function: Right: Bottleneck type B. H and W are feature spatial height and width, C, X, C 0 are input, reduced and output channels for this building block, Ws∗ = arg min λ · LKP (Ws , Wk ) + Lp (Ws ) + R, (7) Ws respectively. For simplicity, batch-norm and activation layers are omitted in this figure. CT ypeB X X2 X X2 = 0 + + ≈ , (6) Cstandard C · K2 C · C0 C · K2 C · C0 Bottleneck structures A and B can effectively reduce the where LKP and Lp are loss from the knowledge projection layer and problem specific loss, respectively. For example, for the problem-specific loss, we can choose the cross-entropy loss in many object recognition tasks. λ is the weight parameter decaying during training, Wk is the trained teacher network, R is a L−2 regularization term, and Ws∗ is the trained parameters in the student network. Unlike traditional supervised training, the knowledge projection loss LKP plays an important role in 5 guiding the training direction of KPN, which will be discussed in more detail in the following section. network by generating a strong and explicit gradient applied to backward path to the injection layer in the following form ∂LKP , ∂Ws,i ∆Ws,i = −λ · B. Knowledge Projection Layer Design In this work, the pre-trained teacher network and the student network analyze the input image simultaneously. To use the teacher network to guide the student network, we propose to map the feature FT of size N learned at one specific layer of the teacher network into a feature vector FS of size M and inject it into the student network to guide its training process. For the mapping, we choose linear projection FS = P · FT , (8) where P is an N × M matrix. In deep convolutional neural networks, this linear projection matrix P can be learned by constructing a convolution layer between the teacher and student network. Specifically, we use a convolutional layer to bridge teacher’s knowledge layer and student’s injection layer. A knowledge layer is defined as the output of a teacher’s hidden convolutional layer responsible for guiding the student’s learning process by regularizing the output of t student’s injection convolutional layer. Let Oht , Ow and Oct be the spatial height, spatial width, and number of channels of the knowledge layer output in the teacher network, respectively. s and Ocs be the corresponding sizes of student’s Let Ohs , Ow injection layer output, respectively. Note that there are a number of additional layers in the student network to further analyze the feature information acquired in the inject layer and contribute to the final network output. We define the following loss function: LKP (Ws ,Wk ) = h[µ(x; Wk )]·|r[µ(x; Wk ); WKP ] − v[x; Ws ]| , (9) ( 1, if x ≥ 0, h(x) = (10) η, otherwise where µ and v represent the deep nested functions (stacks of convolutional operations) up to the knowledge and injection layer with network parameters Wk and Ws , respectively. r[·] is the knowledge projection function applied on µ[·] with parameter WKP which is another convolution layer in this work. µ, v and r must be comparable in terms of spatial dimensionality. The knowledge projection layer is designed as a convolutional operation with a 1 × 1 kernel in the spatial domain. As a result, WKP is a Oct × Ocs × 1 × 1 tensor. As a comparison, a fully connected adaptation layer will require t s Oht × Ow × Oct × Ohs × Ow × Ocs parameters which is not feasible in practice especially when the spatial size of output is relatively large in the early layers. Using the convolutional adaptation layer is not only beneficial for lower computational complexity, but also provides a more natural way to filter distinctive channel-wise features from the knowledge layers while preserve spatial consistency. The output of the knowledge projection layer will guide the training of student (11) where Ws,i is the weight matrix of injection layer in student network. Note that in (9), h[µ(x; Wk )] is applied to LKP with respect to the hidden output of knowledge projection layer as a relaxation term. For negative responses from µ(x; Wk ), LKP is effectively reduced by the slope factor η, which is set to 0.25 by cross-validation. Overall, LKP acts as a relaxed L1 loss. Compared to L2 loss, LKP is more robust to outliers, but still has access to finer level representations in r[µ(x; Wk ); WKP ]. Student subnet Teacher subnet Projection layer convolution convolution 3 convolution 1 activation activation convolution Subsampling /2 4 activation convolution 2 Subsampling /2 convolution 5 1 2 Knowledge output 3 4 5 Projected guidance 1 3 1 4 2 5 Candidate routes 1 5 2 3 2 4 Discarded routes Fig. 4. Candidate Routes of Knowledge Projection. Candidate routes are paths from teacher’s knowledge layer to student’s injection layer. Only one route will survive after iterative pruning. C. Multi-Path Multi-Stage Training In the student network, layers after the injection layer are responsible for adapting the projected feature to the final network output. This adaptation must be memorized throughout the training process. Those network layers before the injection layer aim to learn distinctive low-level features. Therefore, in our KPN framework, the student network and knowledge projection layer are randomized and trained in two stages: initialization stage and end to end joint training stage. In the initialization stage, Path 2 in Figure 2 is disconnected, i.e. the knowledge projection layer together with the lower part of student network is trained to adapt the intermediate output of teacher’s knowledge layer to the final target by minimizing Lp , which is the loss for target task, e.g., softmax or linear regression loss. The upper part of student 6 network is trained sorely by minimizing LKP . In this stage, we use the projection matrix as an implicit connection between upper and lower parts in the student network. The upper student network layers are always optimized towards features interpreted by the projection matrix, and have no direct access to targets. This strategy prevents the student network from over-fitting quickly during the early training stage which is very hard to correct afterwards. After the initialization stage, we then disconnect Path 1 and reconnect Path 2 , the training now involves jointly minimizing the objective function described in (7). Using the results from stage 1 as the initialization, the joint optimization process aims to establish smooth transitions inside the student network from the input to the final output. The loss LKP injected into the student network continues to regularize the training process. In this way, the student network is trained based on a multi-loss function which has been used in the literature to regulate deep networks [43]. D. Iterative Pruning for Projection Route Selection One important question in knowledge projection between the teacher and student networks is to determine which layers from the teacher network should be chosen as the knowledge layer and which layers from the students should be chosen for the injection layer. In this work, we propose to explore an iterative pruning and optimization scheme to select the projection route. Assume that the teacher network Nt and the student network Ns have Lt and Ls layers, respectively. Candidate projection routes are depicted in Figure 4. We use only convolution layers as candidates for the knowledge and injection layers. To satisfy the constraints on spatial size and receptive field, candidate knowledge projection routes are computed and denoted as Ri,j ∈ G, where i is the index of knowledge layer in the teacher network, j is the index of injection layer in the student network, and G is the set of all candidate routes. We follow the procedure for computing the center of receptive field in [44] for calculating the size of receptive field in layer L: SL = L p−1 X Y ( Sq )(Fp − 1), (12) p=1 q=1 where Sq and Fp are the layer-wise stride and kernel size, assuming they are identical along x and y directions for simplicity. Routes with constrained receptive filed are kept after calculation with a small tolerance β = 0.2: (1 − β) · Si ≤ Sj ≤ (1 + β) · Si . (13) For example, in Figure 4, we have {R1,3 , R1,4 , R2,5 } ⊂ G (14) and the rest routes in this figure are not valid due to mismatched spatial shapes. The idea of iterative pruning for the projection route selection is to traverse all possible routes with same training hyper-parameters, and determine the best route for knowledge-injection pair on-the-fly. Specifically, we randomly initialize |G| KPNs according to each Ri,j . Each KPN stores a student network Ws , knowledge projection parameter WKP and routing Ri,j , teacher network Wt is shared across all KPNs to save computation and memory overhead. The target is to find the KPN setting with minimum joint loss 0 0 {Ws0 , WKP , Ri,j }= arg min (λ · LKP + Lp ). (15) {Ws ,WKP ,Ri,j } We assume that the pre-trained teacher network Wt is responsible for guiding the training of a specifically designed student network Ws which satisfies the computational complexity requirement. According to (13), we can generate a list L of candidate KPNs. Each KPN is a copy of the designed student network Ws with different projection routing Ri,j and corresponding parameters WKP . Within a period of k epochs, the KPNs are optimized separately using Stochastic Gradient Descend to minimize the joint loss described in (15). Note that even though the optimization target is a joint loss, as depicted in Fig. 2, the upper and bottom layers of the student network are receiving different learning targets from the teacher network and dataset distribution, respectively. At the end of k epochs, the joint loss of each KPN computed on the validation dataset is used to determine which KPN to prune. The same procedure is applied on the remaining KPNs in the list L iteratively. This iterative pruning procedure is summarized in Algorithm 1: Only one KPN will survive after the iterative pruning process. We continue the multi-stage training with or without adjusting the batch-size depending on the released memory size after sweeping out bad KPNs. The stopping criteria can either be plateau of validation accuracy or a pre-defined end epoch. IV. E XPERIMENTAL R ESULTS In this section, we provide comprehensive evaluations of our proposed method using three groups of benchmark datasets. Each group consists of two datasets, the large dataset Dt used to train the teacher network and the smaller dataset Ds used to train the student network. The motivation is that, in practical applications, we often need to learn a network to recognize or classify a relatively small number of different objects and the available training dataset is often small. We also wish the trained network to be fast and efficient. The large dataset is often available from existing research efforts, for example, the ImageNet. Both the large and the small datasets have the same image dimensions so that pre-trained models are compatible with each other in terms of shape. We use the existing teacher network model already trained by other researchers on the public dataset Dt . We compare various algorithms on the benchmark dataset Ds where stateof-the-art results have been reported. Performance reports on small datasets are rare, thus we choose existing large famous benchmark datasets in following experiments, and aggressively reduce the size of training set to simulate the shortage of labeled data in real world scenarios. 7 Algorithm 1: Iterative pruning algorithm for projection route selection. Input : List L of KPNs, as in form {Ws,n , WKP,n , Rin ,jn }, where n = 1, ..., |G|, and teacher network Wt ∗ ∗ Output: Ws∗ , WKP and Ri,j 1 Configure all KPNs as initialization stage. 2 while |L| > 1 do 3 for k epochs do to be 0.6, and gradually decays to 0. The pruning frequency is 10000 and we also randomly revoke the initialization stage during joint training stage, to repetitively adjusting network guidance strength. For fine-tuning, we test with a wide variety of experimental settings. Starting from pre-trained networks, we adjust the last layer to fit to the new dataset, and randomly initialize the last layer. The reshaped network is trained with standard backpropagation with respect to labels on the new dataset, and unfreeze one more layer from the bottom one at a time. The best result from all configurations was recorded. To make sure all networks are trained using the optimal hyper-parameter set, we extensively try a wide range of learning rates, and repeat experiments on the best parameter set for at least 5 times. The average performance of the best 3 runs out of 5 will be reported. Data augmentation is limited to random horizontal flip if not otherwise specified. for Batch x in Data do 4 5 Forward teacher: yt ← µ(x; Wk ); 6 for {Ws , WKP , Ri,j } ∈ L do Forward-backward w.r.t. Ws , WKP ; 7 end 8 end 9 10 end 11 0 0 , Ri,j } ← arg min(λ · LKP + Lp ); {Ws0 , WKP 12 0 0 , Ri,j } in L; Remove {Ws0 , WKP 13 end 14 ∗ ∗ return {Ws∗ , WKP , Ri,j } in L; A. Network Training We have implemented our KPN framework using the MXNet [45], a deep learning framework designed for both efficiency and flexibility. The dynamically generated computational graph in MXNet allows us to modify network structures during run time. The KPNs are trained on NVidia Titan X 12GB with CUDNN v5.1 enabled. Batch-sizes vary from 16 to 128 depending on the KPN group size. For all experiments, we train using the Stochastic Gradient Descend (SGD) with momentum 0.9 and weight decay 0.0001 except the knowledge projection layers. The weight decay for all knowledge projection layers is 0.001 in the initialization stage and 0 for the joint training stage. 40% of iterations are used for the initialization stage, and the rest goes to be joint training stage. The weight controller parameter λ for joint loss is set B. Results on the CIFAR-10 Dataset We first evaluate the performance of our method on the CIFAR-10 dataset guided by a teacher network pre-trained on CIFAR-100 dataset. The CIFAR-10 and CIFAR-100 datasets [50] have 60000 32×32 color images with 10 and 100 classes, respectively. They were both split into 50K-10K sets for training and testing. To validate our approach, we trained a 38-layer Resnet on the CIFAR-100 as reported in [38], and use it to guide a 50-layer but significantly slimmer Resnet on the CIFAR-10. We augment the data using random horizontal flip and color jittering. Table I summarizes the results, with comparisons against the state-of-the-art results which cover a variety of optimization techniques including Layer-sequential unit-variance initialization [49], pooling-less [48], generalized pooling [47] and maxout activation [46]. We choose different sizes ST of the training set and list the accuracy. For network complexity, we compute its number of model parameters NP ara and the number of multiplication and additions NM A needed for the network inference. It should be noted that for methods in the literature we do not have their accuracy results on down-sized training sets. We do not apply specific optimization techniques used in the state-of-the-art methods due to some structures not reproducible in certain conditions. To compare, we trained a standard 38-layer Residue Network, a 50-layer slimmer version of ResNet (each convolutional layer is half the capacity of the vanilla ResNet) and a fine-tuned model of 38layer ResNet (from CIFAR-100) on CIFAR-10 with different amount of training samples. With all 50000 training data, our proposed method outperforms direct training and best finetuning results and still match the state-of-the-art performance. We believe the performance gain specified in [47], [49] can be also applied to our method, i.e. , ensemble of multiple techniques could achieve better performance. The proposed KPN method has improved the accuracy by up to 1.2% while significantly reducing the network size by about 11 times, from 3.1M network parameters to 273K parameters. It also demonstrated strong robustness against aggressive reduction of labeled training samples. 8 TABLE I CIFAR-10 ACCURACY AND NETWORK CAPACITY COMPARISONS WITH STATE - OF - THE - ART METHODS . R ESULTS USING RANDOMLY SAMPLED SUBSETS FROM TRAINING DATA ARE ALSO REPORTED . N UMBER OF NETWORK PARAMETERS ARE CALCULATED BASED ON REPORTS IN RELATED WORK . Accuracy with Different ST NP ara NM A - 9M 379M - - 0.86M 53M - - - 2.5M 107M 93.95 - - - 3.5M 362M ALL-CNN-C [48] 92.7 - - - 1.0M 257M Good Init [49] 94.16 - - - 2.5M 166M ResNet-50 slim 87.53 71.92 55.86 48.17 0.27M 31M ResNet-38 90.86 75.28 61.74 51.62 3.1M 113M ResNet-38 fine-tune 91.15 89.61 86.26 83.45 3.1M 113M Our method 92.37 90.35 88.73 87.61 0.27M 31M Methods 50000 5000 1000 500 Maxout [46] 90.18 - - FitNets-11 [15] 91.06 - FitNets [15] 91.61 GP CNN [47] (1) (2) (3) (4) (5) (6) Fig. 5. (1)(2): CIFAR-100/10 sample images; (3): Imagenet 2012; (4) Pascal VOC 2007; (5) MNIST; (6) Omniglot; C. Results on the Pascal VOC 07 Dataset We evaluate the proposed method on the PASCAL Visual Object Classes Challenge(VOC) dataset [54] with a VGG16 model [29] pre-trained on the ILSVRC 2012 dataset [1]. The pre-training usually takes several weeks, thus we downloaded and converted the teacher network from the Caffe model available online. We compare our method with stateof-the-art results obtained on this dataset in the literature, including the VGG16+SVM method [29], the segment hy- potheses based multi-label HCP-VGG method [52], and the FisherNet-VGG16 method [53] which encodes CNN feature with fisher vector. These papers have reported results on the original whole dataset with 5011 images. To test the learning capability of the network on smaller datasets with reduced samples, we also implement the fine-tuning method. We try different combination of network update scheme and learning parameters and use the best result for performance comparison with our method. We conducted our experiments on the entire training set with 5011 images and test set with 4952 images. In addition, we randomly sample 50 and 10 images from each class, generating two small datasets with 1000 and 200 training images, respectively. The results are summarized in Table II. We list the test accuracy of the network for each configuration. We compute the corresponding complexity of the network, including the number of model parameters NP ara and the number of multiplication and additions NM A . It should be noted that for methods in the literature we do not have their accuracy results on down-sized training sets. It can be seen that our proposed method outperforms standard training and fine-tuning by a large margin while reducing the model size by 2 times and improving the inference speed by 4.6 times. D. Results on the Ommniglot Dataset We are interested in how the proposed KPN method works on very small datasets, for example, the Ommniglot handwritten recognition dataset. The MNIST [55] is a famous handwritten digits dataset, consists of 60000 training images and 10000 test images, 28x28x1 in size, organized into 10 9 TABLE II PASCAL VOC 2007 TEST OBJECT CLASSIFICATION PERFORMANCES COMPARISON . R ESULTS USING RANDOMLY SAMPLED SUBSETS FROM TRAINING DATA ARE ALSO REPORTED . N UMBER OF CONVOLUTION LAYER PARAMETERS ARE LISTED FOR FAIR COMPARISON BASED ON REPORTS IN RELATED WORK . Accuracy at Different ST NP ara NM A - 6.5M 2483M - - 14.7M 15470M 89.3 - - 21.8M 15470M HCP-VGG [52] 90.9 - - 14.7M 15470M FisherNet-VGG16 [53] 91.7 - - 14.7M 15470M VGG16 standard BP 83.5 65.2 <30 14.7M 15470M Fine-tune VGG16 last layer (softmax) 89.6 87.4 85.7 14.7M 15470M Fine-tune VGG16 2+ learnable layers 90.2 86.3 82.8 14.7M 15470M Our method 91.2 88.4 86.5 8M 3361M Methods 5011 1000 200 Chatfield et al. [51] 82.4 - VGG16+SVM [29] 89.3 VGG19+SVM [29] classes. The Omniglot [56] is a similar but much smaller dataset, containing 1623 different handwritten characters from 50 alphabets. Each of the 1623 characters was drawn online via Amazon’s Mechanical Turk by 20 different people. All images are binarized and resized to 28×28×1 with no further data augmentation. We use all 70000 images from MNIST for training a 5-layer Maxout convolutional model as the teacher network Nt as proposed in [46]. We report experimental results of various algorithms across a wide range of number of training examples, from 19280 to merely 1000, shown in Table III. Note that we use class dependent shuffling to randomly select training subsets, which is critical to avoid unbalanced class distribution in Omniglot due to the limited number of samples for each class. We can see that the proposed KPN is able to reduce the error rate by 1.1-1.3%. Table III also provides some interesting insights of how models are transferred to different tasks. First, the fine-tuning methods are all affected by the number of learnable parameters and training samples. Smaller training set will result in significant over-fitting, thus breaking the fragile co-adaptation between layers. If the training set is large enough, the number of learnable parameters are positively related to the performance. This phenomenon is also discussed in [25], where transferring knowledge from the pre-trained model to an exactly same network is extensively tested. E. Algorithm Parameter Analysis In this section, we study how the performance of the our method is impacted by the selection of major parameters. TABLE III T EST ERROR RATE COMPARISONS BETWEEN EXPERIMENTAL SETTINGS AND BASELINE METHODS . Error Rates at Different ST Methods 19280 5000 1000 Deep CNN [56] 13.5% - - Deep Siamese CNN [56] 8.0 % - - Large CNN standard BP 9.3% 12.9% 19.4% Small CNN standard BP 12.1% 18.5% 23.8% Fine-tuned from MNIST 6.8% 7.4% 9.2% Our method 5.9% 6.6% 7.9% (1) Trade-off between Performance and Efficiency. To evaluate how the size of network affects the performance, we measure the test accuracy, number of parameters, and network speed up ratio of various student networks on the CIFAR10 dataset. Figure 6 shows the results. Student networks are designed based on a multi-layer Resnet denoted as N - or N -, where N is the number of layers, - and - - indicate it’s a slim or slimmer version of Resnet. The detailed network configurations are listed in Table IV. As expected, deeper and slimmer networks are more difficult to train with limited train- 10 TABLE IV N ETWORK CONFIGURATIONS FOR EXTENSIVE BENCHMARKS ON O MNIGLOT DATASET. N - DENOTES SLIM NETWORK WITH N LAYERS , SIMILARLY, N LAYER SLIMMER NETWORK IS DENOTED AS N - -. N OTE THAT 1 × 1 ADAPTIVE CONVOLUTIONS FOR RESIDUE MODULES ARE NOT INCLUDED IN THIS TABLE . # Layers 50 50- 50- - 44- 44- - 38- 38- - 32- 32- - 26- 26- - Conv3 × 3 /s1 16 16 16 16 16 16 16 16 16 16 16 ResConv3 × 3 /s2 32 ×16 32 ×16 16 ×16 32 ×14 16 ×14 32 ×12 16 ×12 32 ×10 16 ×10 32 ×8 16 ×8 ResConv3 × 3 /s1 64 ×16 32 ×16 32 ×16 32 ×14 32 ×14 32 ×12 32 ×12 32 ×10 32 ×10 32 ×8 32 ×8 ResConv3 × 3 /s2 128 ×16 64 ×16 48 ×16 64 ×14 48 ×14 64 ×12 48 ×12 64 ×10 48 ×10 64 ×8 48 ×8 Conv3 × 3 /s1 256 128 96 128 96 128 96 128 96 128 96 SURSRVHG VWDQGDUGES      RFFXUDQFHVRYHUWHVWV $FFXUDF\           103     0HDQHUURU 3DUDPV N  102    6SHHGXS UDWLR                      Fig. 7. Iterative pruning analysis. Top: occurrences of projection route t-s  W           1HWZRUNFRQILJXUDWLRQV over 32 standalone tests. Bottom: mean classification error of projection route t-s by disable iterative pruning. t-s: network with knowledge layer t from teacher to injection layer s from student. Fig. 6. Network capacity and performance analysis. Top: test accuracies with proposed KPN and normal training with standard back-propagation; Middle: number of parameters (×103 ), note that the y-axis is in logarithmic scale; Bottom: actual inference speed up ratio with respect to Resnet-50. Network notations: t is teacher network, N - denotes slim network with N layers, similarly, N layer slimmer network is denoted as N - -. ing data. However, with proposed method enabled, the depth is beneficial, and networks are less suffered from performance drop. Impressively, we could obtain a model which is 34 times faster using less than 2% parameters, with about 3% accuracy loss, compared to the teacher network. (2) Analysis of Iterative Pruning for Automatic Route Selection. The knowledge projection route is critical for the network training and test performance. Intuitively, the projection route should not be too shallow or too deep. Shallow layers may contain only low-level texture features, while deep layers close to output may be too task specific. To study how the iterative pruning works during training, we record the pruning results and compare them with respect to manually defined projection routes, shown in Figure 7. We can see that the statistics of survival projection routes is highly correlated to the training accuracy, which is evaluated by manually defining projection route from t to s and disabling iterative pruning during training. The result also indicates that choosing the middle layers for projection is potentially better. Reducing 11 the size of training data also affects the pruning results. This might relate to the difficulty of fitting knowledge projection layer to the target domain when very limited data is presented. As a result, projection layers tend to appear more on very deep layers close to the output, so that the penalty from adaptation loss will not dominate. The bottom line is, even though the iterative pruning method is a random optimization process, it is reliably producing satisfactory results. [2] T. Lin, M. Maire, S. J. Belongie, L. D. Bourdev, R. B. Girshick, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick, “Microsoft COCO: common objects in context,” CoRR, vol. abs/1405.0312, 2014. [Online]. Available: http://arxiv.org/abs/1405.0312 1 [3] M. Denil, B. Shakibi, L. Dinh, N. de Freitas et al., “Predicting parameters in deep learning,” in Advances in Neural Information Processing Systems, 2013, pp. 2148–2156. 1 F. Discussion and Future Work Our KPN is designed in a highly modular manner. The training of projection layers is removed during actual network testing, and the network capacity is highly configurable for performance/speed trade-off. This KPN method can be easily extended to other problems such as object detection, object segmentation, and pose estimation by replacing softmax loss layer used in the classification problems. Since the deployed network is a pure standard network, another research direction is to apply KPN as a building block in traditional model compression techniques to reshape the network in a new perspective. Although we have focused on the advantage of KPN with thinner networks on smaller datasets, there are potential benefits to apply KPN on large network and relatively large datasets, for example, performance oriented situations where speed is not an issue. [4] G. E. Hinton, N. Srivastava, A. Krizhevsky, I. Sutskever, and R. R. Salakhutdinov, “Improving neural networks by preventing co-adaptation of feature detectors,” arXiv preprint arXiv:1207.0580, 2012. 1 [5] Y. LeCun, J. S. Denker, and S. A. Solla, “Optimal brain damage,” in Advances in Neural Information Processing Systems 2, D. S. Touretzky, Ed. Morgan-Kaufmann, 1990, pp. 598–605. [Online]. Available: http://papers.nips.cc/paper/250-optimal-brain-damage.pdf 1, 2 [6] B. Hassibi, D. G. Stork et al., “Second order derivatives for network pruning: Optimal brain surgeon,” Advances in neural information processing systems, pp. 164–164, 1993. 1, 2 [7] S. Han, H. Mao, and W. J. Dally, “Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman V. C ONCLUSION We have developed a novel knowledge projection framework for deep neural networks the address the issues of domain adaptation and model compression in training simultaneously. We exploit the distinctive general features produced by the teacher network trained on large dataset, and use a learned matrix to project them into domain relevant representations to be used by the student network. A smaller and faster student network is trained to minimize joint loss designed for domain adaptation and knowledge distillation simultaneously. Extensive experimental results have demonstrated that our unified training framework provides an effective way to obtain fast high-performance neural networks on small datasets with limited labeled samples. coding,” arXiv preprint arXiv:1510.00149, 2015. 1, 2 [8] M. Jaderberg, A. Vedaldi, and A. Zisserman, “Speeding up convolutional neural networks with low rank expansions,” arXiv preprint arXiv:1405.3866, 2014. 1, 3 [9] G. Hinton, O. Vinyals, and J. Dean, “Distilling the knowledge in a neural network,” arXiv preprint arXiv:1503.02531, 2015. 1, 3 [10] S. J. Pan, I. W. Tsang, J. T. Kwok, and Q. Yang, “Domain adaptation via transfer component analysis,” IEEE Transactions on Neural Networks, vol. 22, no. 2, pp. 199–210, 2011. 1 [11] K. Zhang, B. Schölkopf, K. Muandet, and Z. Wang, “Domain adaptation under target and conditional shift.” in ICML (3), 2013, pp. 819–827. 1 R EFERENCES [12] X. Wang and J. Schneider, “Flexible transfer learning under support and model shift,” in Advances in Neural Information Processing Systems, [1] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, 2014, pp. 1898–1906. 1, 2 Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and [13] E. Tzeng, J. Hoffman, T. Darrell, and K. Saenko, “Simultaneous L. Fei-Fei, “ImageNet Large Scale Visual Recognition Challenge,” deep transfer across domains and tasks,” in Proceedings of the IEEE International Journal of Computer Vision (IJCV), vol. 115, no. 3, pp. International Conference on Computer Vision, 2015, pp. 4068–4076. 1, 211–252, 2015. 1, 8 2 12 [14] C. Bucilu, R. Caruana, and A. Niculescu-Mizil, “Model compression,” processing systems, 2014, pp. 3320–3328. 2, 9 in Proceedings of the 12th ACM SIGKDD international conference on [26] H. Ajakan, P. Germain, H. Larochelle, F. Laviolette, and M. Marchand, ACM, 2006, pp. 535–541. 1, “Domain-adversarial neural networks,” arXiv preprint arXiv:1412.4446, Knowledge discovery and data mining. 3 2014. 2 [15] A. Romero, N. Ballas, S. E. Kahou, A. Chassang, C. Gatta, and Y. Ben- [27] M. Ghifary, W. B. Kleijn, and M. Zhang, “Domain adaptive neural net- gio, “Fitnets: Hints for thin deep nets,” arXiv preprint arXiv:1412.6550, works for object recognition,” in Pacific Rim International Conference 2014. 1, 3, 8 on Artificial Intelligence. Springer, 2014, pp. 898–904. 2 [16] Y. Hou, Z. Li, P. Wang, and W. Li, “Skeleton optical spectra based action [28] S. Han, J. Pool, J. Tran, and W. Dally, “Learning both weights and con- recognition using convolutional neural networks,” IEEE Transactions on nections for efficient neural network,” in Advances in Neural Information Circuits and Systems for Video Technology, 2016. 1 Processing Systems, 2015, pp. 1135–1143. 2 [17] C. Xiong, L. Liu, X. Zhao, S. Yan, and T.-K. Kim, “Convolutional fusion [29] K. Simonyan and A. Zisserman, “Very deep convolutional networks for network for face verification in the wild,” IEEE Transactions on Circuits large-scale image recognition,” arXiv preprint arXiv:1409.1556, 2014. and Systems for Video Technology, vol. 26, no. 3, pp. 517–528, 2016. 1 3, 8, 9 [18] K. Kim, S. Lee, J.-Y. Kim, M. Kim, and H.-J. Yoo, “A configurable [30] E. L. Denton, W. Zaremba, J. Bruna, Y. LeCun, and R. Fergus, heterogeneous multicore architecture with cellular neural network for “Exploiting linear structure within convolutional networks for efficient real-time object recognition,” IEEE Transactions on Circuits and Sys- evaluation,” in Advances in Neural Information Processing Systems, tems for Video Technology, vol. 19, no. 11, pp. 1612–1622, 2009. 2 2014, pp. 1269–1277. 3 [19] N. Sudha, A. Mohan, and P. K. Meher, “A self-configurable systolic [31] Y. Gong, L. Liu, M. Yang, and L. Bourdev, “Compressing deep architecture for face recognition system based on principal component convolutional networks using vector quantization,” arXiv preprint neural network,” IEEE transactions on circuits and systems for video arXiv:1412.6115, 2014. 3 technology, vol. 21, no. 8, pp. 1071–1084, 2011. 2 [32] X. Zhang, J. Zou, K. He, and J. Sun, “Accelerating very deep convolu- [20] S. J. Pan and Q. Yang, “A survey on transfer learning,” IEEE Trans- tional networks for classification and detection,” IEEE transactions on actions on knowledge and data engineering, vol. 22, no. 10, pp. 1345– pattern analysis and machine intelligence, vol. 38, no. 10, pp. 1943– 1359, 2010. 2 1955, 2016. 3 [21] M. Long, Y. Cao, J. Wang, and M. I. Jordan, “Learning transferable [33] D. C. Cireşan, U. Meier, J. Masci, L. M. Gambardella, and J. Schmidhu- features with deep adaptation networks.” in ICML, 2015, pp. 97–105. 2 ber, “High-performance neural networks for visual object classification,” [22] Y. Ganin and V. Lempitsky, “Unsupervised domain adaptation by backpropagation,” arXiv preprint arXiv:1409.7495, 2014. 2 [23] M. D. Zeiler and R. Fergus, “Visualizing and understanding convolutional networks,” in European conference on computer vision. Springer, 2014, pp. 818–833. 2 [24] M. Oquab, L. Bottou, I. Laptev, and J. Sivic, “Learning and transferring mid-level image representations using convolutional neural networks,” in Proceedings of the IEEE conference on computer vision and pattern recognition, 2014, pp. 1717–1724. 2 arXiv preprint arXiv:1102.0183, 2011. 3 [34] J. Ba and R. Caruana, “Do deep nets really need to be deep?” in Advances in neural information processing systems, 2014, pp. 2654– 2662. 3 [35] D. Erhan, P.-A. Manzagol, Y. Bengio, S. Bengio, and P. Vincent, “The difficulty of training deep architectures and the effect of unsupervised pre-training.” in AISTATS, vol. 5, 2009, pp. 153–160. 3 [36] C.-Y. Lee, S. Xie, P. W. Gallagher, Z. Zhang, and Z. Tu, “Deeplysupervised nets.” in AISTATS, vol. 2, no. 3, 2015, p. 5. 3 [25] J. Yosinski, J. Clune, Y. Bengio, and H. Lipson, “How transferable are [37] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, features in deep neural networks?” in Advances in neural information V. Vanhoucke, and A. Rabinovich, “Going deeper with convolutions,” 13 in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2015, pp. 1–9. 3 [49] D. Mishkin and J. Matas, “All you need is a good init,” arXiv preprint arXiv:1511.06422, 2015. 7, 8 [38] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image [50] A. Krizhevsky and G. Hinton, “Learning multiple layers of features recognition,” in Proceedings of the IEEE Conference on Computer Vision from tiny images,” Master’s thesis, Department of Computer Science, and Pattern Recognition, 2016, pp. 770–778. 3, 7 University of Toronto, 2009. 7 [39] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna, “Rethinking [51] K. Chatfield, K. Simonyan, A. Vedaldi, and A. Zisserman, “Return of the inception architecture for computer vision,” in Proceedings of the the devil in the details: Delving deep into convolutional nets,” arXiv IEEE Conference on Computer Vision and Pattern Recognition, 2016, preprint arXiv:1405.3531, 2014. 9 pp. 2818–2826. 3 [52] Y. Wei, W. Xia, M. Lin, J. Huang, B. Ni, J. Dong, Y. Zhao, and S. Yan, [40] S. Ioffe and C. Szegedy, “Batch normalization: Accelerating deep “Hcp: A flexible cnn framework for multi-label image classification,” network training by reducing internal covariate shift,” arXiv preprint IEEE transactions on pattern analysis and machine intelligence, vol. 38, arXiv:1502.03167, 2015. 3 no. 9, pp. 1901–1907, 2016. 8, 9 [41] F. N. Iandola, S. Han, M. W. Moskewicz, K. Ashraf, W. J. Dally, and K. Keutzer, “Squeezenet: Alexnet-level accuracy with 50x fewer parameters and¡ 0.5 mb model size,” arXiv preprint arXiv:1602.07360, 2016. 3 [42] J. Redmon and A. Farhadi, “Yolo9000: Better, faster, stronger,” arXiv preprint arXiv:1612.08242, 2016. 3 [43] C. Xu, C. Lu, X. Liang, J. Gao, W. Zheng, T. Wang, and S. Yan, “Multiloss regularized deep neural network,” IEEE Transactions on Circuits and Systems for Video Technology, vol. 26, no. 12, pp. 2273–2283, 2016. 6 [44] K. Lenc and A. Vedaldi, “R-cnn minus r,” arXiv preprint arXiv:1506.06981, 2015. 6 [45] T. Chen, M. Li, Y. Li, M. Lin, N. Wang, M. Wang, T. Xiao, B. Xu, C. Zhang, and Z. Zhang, “Mxnet: A flexible and efficient machine learning library for heterogeneous distributed systems,” arXiv preprint arXiv:1512.01274, 2015. 7 [46] I. J. Goodfellow, D. Warde-Farley, M. Mirza, A. C. Courville, and Y. Bengio, “Maxout networks.” ICML (3), vol. 28, pp. 1319–1327, 2013. 7, 8, 9 [47] C.-Y. Lee, P. W. Gallagher, and Z. Tu, “Generalizing pooling functions in convolutional neural networks: Mixed, gated, and tree,” in International conference on artificial intelligence and statistics, 2016. 7, 8 [48] J. T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller, “Striving for simplicity: The all convolutional net,” arXiv preprint arXiv:1412.6806, 2014. 7, 8 [53] P. Tang, X. Wang, B. Shi, X. Bai, W. Liu, and Z. Tu, “Deep fishernet for object classification,” arXiv preprint arXiv:1608.00182, 2016. 8, 9 [54] M. Everingham, L. Van Gool, C. K. Williams, J. Winn, and A. Zisserman, “The pascal visual object classes (voc) challenge,” International journal of computer vision, vol. 88, no. 2, pp. 303–338, 2010. 8 [55] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, “Gradient-based learning applied to document recognition,” Proceedings of the IEEE, vol. 86, no. 11, pp. 2278–2324, 1998. 8 [56] B. M. Lake, R. Salakhutdinov, and J. B. Tenenbaum, “Human-level concept learning through probabilistic program induction,” Science, vol. 350, no. 6266, pp. 1332–1338, 2015. 9
7cs.IT
INTRODUCTION TO THE SP THEORY OF INTELLIGENCE arXiv:1802.09924v1 [cs.AI] 24 Feb 2018 Aiming to simplify and integrate observations and concepts across artificial intelligence, mainstream computing, mathematics, and human learning, perception, and cognition. J Gerard Wolff∗ February 28, 2018 Abstract This article provides a brief introduction to the SP Theory of Intelligence and its realisation in the SP Computer Model. The overall goal of the SP programme of research, in accordance with long-established principles in science, has been the simplification and integration of observations and concepts across artificial intelligence, mainstream computing, mathematics, and human learning, perception, and cognition. In broad terms, the SP system is a brain-like system that takes in “New” information through its senses and stores some or all of it as “Old” information. A central idea in the system is the powerful concept of SP-multiple-alignment, borrowed and adapted from bioinformatics. This the key to the system’s versatility in aspects of intelligence, in the representation of diverse kinds of knowledge, and in the seamless integration of diverse aspects of intelligence and diverse kinds of knowledge, in any combination. There are many potential benefits and applications of the SP system. It is envisaged that the ∗ Dr Gerry Wolff, BA (Cantab), PhD (Wales), CEng, MBCS, MIEEE; CognitionResearch.org, Menai Bridge, UK; [email protected]; +44 (0) 1248 712962; +44 (0) 7746 290775; Skype: gerry.wolff; Web: www.cognitionresearch.org. 1 system will be developed as the SP Machine, which will initially be a software virtual machine, hosted on a high-performance computer, a vehicle for further research and a step towards the development of an industrial-strength SP Machine. 1 Introduction The SP theory of intelligence and its realisation in the SP computer model is a system that has been under development since about 1987, with a break between early 2006 and late 2012. Potential benefits and applications of the SP system include versatility in aspects of intelligence, versatility in the representation of diverse forms of knowledge, seamless integration of aspects of intelligence and kinds of knowledge in any combination, helping to solve nine problems with big data, providing a model for aspects of neuroscience, solving several problems with deep learning, and many more. A key idea in the SP system is the powerful concept of SP-multiplealignment, borrowed and adapted from the concept of ‘multiple sequence alignment’ in bioinformatics. This may prove to be as significant for an understanding of human intelligence as is DNA in biological sciences: SPmultiple-alignment may prove to be the “double helix” of intelligence. Although there are still residual problems to be solved [13, Section 3.3], it is envisaged that the SP computer model will be the basis for an SP machine as a software virtual machine, hosted on a high-performance computer. This would be a vehicle for further research and a basis for an industrialstrength SP machine with many potential benefits and application, as shown schematically in Figure 1. A programme of development for the SP machine is described in [6]. 2 SP theory and SP computer model High parallel In the cloud SP MACHINE Open source Good user interface Natural language processing Representation of knowledge Several kinds of reasoning Planning & problem solving Unsupervised learning Information compression Pattern recognition Information retrieval MANY APPLICATIONS Figure 1: Schematic representation of the development and application of the SP machine. Reproduced from Figure 2 in [13], with permission. 2 Background The overall goal of the SP programme of research, in accordance with longestablished principles in science, has been the simplification and integration of observations and concepts across artificial intelligence, mainstream computing, mathematics, and human learning, perception, and cognition. From the beginning, a unifying theme in the SP research has been that all kinds of processing would be done by compression of information via a search for patterns that match each other and via the merging or ‘unification’ of patterns that are the same. The reason for the emphasis on the matching and unification of patterns is that this seems to provide a better handle on possible mechanisms in natural or artificial systems than do the more mathematically-oriented approaches to information compression. The main motivation for the focus on information compression is research by Fred Attneave [1], Horace Barlow [2, 3], and others, showing the importance of information compression in the workings of brains and nervous systems. Solomonoff’s seminal work on the development of algorithmic probability theory [8, 9] is also important. Since people often ask, the name “SP” stands for Simplicity and Power, two ideas which, together, mean the same as information compression. This is because information compression may be seen to be a process of maximising ‘simplicity’ in a body of information, by reducing redundancy in that 3 information, whilst at the same time retaining as much as possible of its non-redundant expressive ‘power’. 3 The SP system The SP system is described in outline here and in Appendix I of [20], in more detail in [13], and in even more detail in [11]. Distinctive features and advantages of the SP system are described in [20]. In broad terms, the SP system is a brain-like system that takes in New information through its senses and stores some or all of it as Old information, as shown schematically in Figure 2. Old (compressed) New (uncompressed) Figure 2: Schematic representation of the SP system from an ‘input’ perspective. Reproduced, with permission, from Figure 1 in [13]. 3.1 SP-multiple-alignment A central idea in the SP system, is the concept of SP-multiple-alignment, borrowed and adapted from the concept of ‘multiple sequence alignment’ in bioinformatics. Probably the best way to explain the idea is by way of examples, shown in Figures 3 and 4. Figure 3 shows an example of multiple sequence alignment in bioinformatics. Here, there are five DNA sequences which have been arranged one above the other, and then, by judicious ‘stretching’ of one or more of the sequences in a computer, symbols that match each other across two or more sequences have been brought into line. A ‘good’ multiple sequence alignment, like the one shown, is one with a relatively large number of matching symbols from 4 row to row. The process of discovering a good multiple sequence alignment is normally too complex to be done by exhaustive search, so heuristic methods are needed, building multiple sequence alignments in stages and, at each stage, selecting the best partial structures for further processing. G | G | A | | G | G G | G | G | G | G A | | G | A C T | A A | C A G C | | G C C C | | | | G C C C | | | C A | A | A | A | A G | G | G | G | G G | G | G | G | G G | G | G | G | G A | A | | | A | A G | G | G | G | G G | G | G | G | G A T | | A | | | | G C T | | A | A | C G G G G A | | | | | G G C G G G A | | | | | G G A | G A | | | | | G G G G A | | | | | G G G G A Figure 3: A ‘good’ multiple alignment amongst five DNA sequences. Reproduced with permission from Figure 3.1 in [11]. Figure 4 shows an example of an SP-multiple-alignment, superficially similar to the one in Figure 3, except that sequences are called SP-patterns and, more importantly, one of the SP-patterns is New information and is normally shown in row 0, while the remaining SP-patterns are Old information, and these are shown in the remaining rows. 0 1 2 3 4 5 6 f | | | | | | | N 4 f | NP 2 N | S 0 NP o | | | | | | | o r | | | | | | | r t | | | | | | | t u | | | | | | | u n | | | | | | | n e | | | | | | | e #N | #N #NP | #NP f a v o u r | | | | | | Vr 6 f a v o u r #Vr | | V 7 Vr #Vr | VP 3 V | | | | | VP 7 8 9 s | | | s #V | #V NP | | | | | | | | | NP 1 D | D 8 t | | | | | | | | | | | | | | | | | t h | | | | | | | | | | | | | | | | | h e | | | | | | | | | | | | | | N 5 | | | #D N | | e #D b | | | | | | | | | | | | | b r | | | | | | | | | | | | | r a | | | | | | | | | | | | | a v | | | | | | | | | | | | | v e 0 | | 1 | | 2 | | #NP #VP 3 | | | | | | 4 | | | | | | 5 | | | | | #VP #S 6 | | e #N | 7 | | #N #NP 8 9 Figure 4: The best SP-multiple-alignment produced by the SP computer model with a New SP-pattern, ‘f o r t u n e f a v o u r s t h e b r a v e’, representing a sentence to be parsed and a repository of user-supplied Old SP-patterns representing grammatical categories, including morphemes and words. Reproduced with permission from Figure 2 in [19]. As can be seen from this example, the building of an SP-multiple-alignment may achieve the effect of parsing a sentence (‘f o r t u n e f a v o u r s t h e b r a v e’ in this example) into its grammatical parts and subparts. But as we shall see later, the SP system has strengths in several 5 different aspects of intelligence, and in the representation of several different kinds of knowledge—and most of this versatility flows from the building of SP-multiple-alignments. To create an SP-multiple-alignment like the one shown in Figure 4, the SP system starts with a relatively large repository of Old SP-patterns, each one representing a syntactic structure in English, which may be a morpheme, a word, or a higher-level structure. The Old SP-patterns would ideally be learned by the system, but pending full development of the learning processes, the Old SP-patterns may be supplied to the system by the user. With a repository of Old SP-patterns in place, the SP system is supplied with the New SP-pattern (‘f o r t u n e f a v o u r s t h e b r a v e’) and the system tries to build one or more SP-multiple-alignments, each of which allows the New SP-pattern to be encoded economically in terms the Old SP-patterns in the SP-multiple-alignment. The details of how the encoding is done need not detain us here, but it is relevant to note that the SP-multiple-alignment construct, in conjunction with unsupervised learning in the SP system (outlined below), appears to provide a means of achieving relatively high levels of information compression with many kinds of data. As with the building of ‘good’ multiple sequence alignments in bioinformatics, the creation of one or more ‘good’ SP-multiple-alignments is normally too complex to be done by any exhaustive process. As with multiple sequence alignments in bioinformatics, heuristic search is needed, building SP-multiple-alignments in stages and, at each stage, selecting the best partial structures for further processing. With this approach, it is not normally possible to guarantee that the best possible SP-multiple-alignment has been found, but it is normally possible to create SP-multiple-alignments that are ‘good enough’. 3.2 Learning in the SP system In the SP system, learning is special. Instead of it being a by-product of the building of SP-multiple-alignments it is a process of creating grammars, where each grammar is a collection of Old SP-patterns (many of which would normally be derived from partial matches between SP-patterns within SPmultiple-alignments), and each grammar is scored in terms of its effectiveness via SP-multiple-alignment in the economical encoding of a target set of New SP-patterns. As with the building of SP-multiple-alignments, the process is too complex for exhaustive search so heuristic methods are needed. In the SP system, learning is normally ‘unsupervised’, deriving structures from incoming sensory information without the need for any kind of ‘teacher’, 6 or ‘reinforcement’, or anything equivalent. But in case this seems unduly narrow, it appears that unsupervised learning is the most general kind of learning and that, within the framework of unsupervised learning in the SP system, there is potential to model other kinds of learning such as ‘supervised’ learning, ‘reinforcement’ learning, and more. 3.3 SP-neural A potentially useful feature of the SP system is that it is possible to see how abstract constructs and processes in the system may be realised in terms of neurons and their interconnections. This is the basis for SP-neural, a ‘neural’ version of the SP system, described in an early form in [11, Chapter 11], and in an updated and more detailed form in [19], and illustrated in Figure 5. In this connection, it is relevant to mention that the SP system, in both its abstract and neural forms, is quite different from deep learning in artificial neural networks [7] and has substantial advantages compared with such systems, as described in [20, Section V] and in [23]. Some examples of those advantages are outlined in Section 8, below. 3.4 Generalising the SP system for two-dimensional SP-patterns, both static and moving This brief description of the SP system and how it works may have given the impression that it is intended to work entirely with sequences of SP-symbols, like multiple sequence alignments in bioinformatics. But it is envisaged that, in future development of the system, two-dimensional SP-patterns will be introduced, with potential to represent and process such things as photographs and diagrams, and structures in three dimensions as described in [14, Section 6.1 and 6,2], and procedures that work in parallel as described in [15, Sections V-G, V-H, and V-I, and Appendix C]. It is envisaged that, at some stage, the SP system will be generalised to work with sequences of two-dimensional ‘frames’ from moving visual media. 7 NP 1 D #D N #N #NP D 9 o n e #D N 5 b r a v e #N D 1 t h e #D N 9 t a b l e #N … t .... h .... e .... b .... r .... a .... v .... e … | | | | | | | | t h e b r a v e receptor array sensory data Figure 5: A schematic representation of a partial SP-multiple-alignment in SP-neural, as discussed in [19, Section 4]. Each broken-line rectangle with rounded corners represents a pattern assembly—corresponding to an SP-pattern in the main SP theory; each character or group of characters enclosed in a solid-line ellipse represents a neural symbol corresponding to an SP-symbol in the main SP theory; the lines between pattern assemblies represent nerve fibres with arrows showing the direction in which impulses travel; neural symbols are mainly symbols from linguistics such as ‘NP’ meaning ‘noun phrase, ‘D’ meaning a ‘determiner’, ‘#D’ meaning the end of a determiner, ‘#NP’ meaning the end of a noun phrase, and so on. Reproduced with permission from Figure 3 in [19]. 8 4 Versatility in aspects of intelligence Strengths and potential of the SP system are summarised in this section and in those that follow. Further information may be found in [13, Sections 5 to 12], [11, Chapters 5 to 9], [20], and in other sources referenced in the sections that follow. This section outlines the SP system’s versatility in aspects of intelligence. The system has, first, strengths and potential in the ‘unsupervised’ learning of new knowledge. As we saw in Section 3.2, this is an aspect of intelligence in the SP system that is different from others because it is not a by-product of the building of multiple alignments but is, instead, achieved via the creation of grammars, drawing on information within SP-multiplealignments. Secondly, other aspects of intelligence exhibited by the SP system are modelled via the building of SP-multiple-alignments. These other aspects of intelligence include: the analysis and production of natural language; pattern recognition that is robust in the face of errors in data; pattern recognition at multiple levels of abstraction; computer vision [14]; best-match and semantic kinds of information retrieval; several kinds of reasoning (next paragraph); planning; and problem solving. Thirdly, kinds of reasoning that may be modelled in the SP system include: one-step ‘deductive’ reasoning; chains of reasoning; abductive reasoning; reasoning with probabilistic networks and trees; reasoning with ‘rules’; nonmonotonic reasoning and reasoning with default values; Bayesian reasoning with ‘explaining away’; causal reasoning; reasoning that is not supported by evidence; the inheritance of attributes in class hierarchies; and inheritance of contexts in part-whole hierarchies. Where it is appropriate, probabilities for inferences may be calculated in a straightforward manner ([11, Section 3.7], [13, Section 4.4]). There is also potential in the system for spatial reasoning [15, Section IV-F.1], and for what-if reasoning [15, Section IV-F.2]. It seems unlikely that the features of intelligence mentioned above are the full extent of the SP system’s potential to imitate what people can do. The close connection that is known to exist between information compression and concepts of prediction and probability [8, 9, 5], the central role of information compression in the SP-multiple-alignment framework, and the versatility of the SP-multiple-alignment framework in aspects of intelligence suggests that there there are more insights to come. 9 5 Versatility in the representation of knowledge Although SP-patterns are not very expressive in themselves, they come to life in the SP-multiple-alignment framework. Within that framework, they may serve in the representation of several different kinds of knowledge, including: the syntax of natural languages; class-inclusion hierarchies (with or without cross classification); part-whole hierarchies; discrimination networks and trees; if-then rules; entity-relationship structures [12, Sections 3 and 4]; relational tuples (ibid., Section 3), and concepts in mathematics, logic, and computing, such as ‘function’, ‘variable’, ‘value’, ‘set’, and ‘type definition’ ([11, Chapter 10], [17, Section 6.6.1], [22, Section 2]). As previously noted, the addition of two-dimensional SP patterns to the SP computer model is likely to expand the representational repertoire of the SP system to structures in two-dimensions and three-dimensions, and the representation of procedural knowledge with parallel processing. As with the SP system’s generality in aspects of intelligence, it seems likely that the SP system is not constrained to represent only the forms of knowledge that have been mentioned. The generality of information compression as a means of representing knowledge in a succinct manner, the central role of information compression in the SP-multiple-alignment framework, and the versatility of that framework in the representation of knowledge, suggest that the SP system may prove to be a means of representing all the kinds of knowledge that people may work with. 6 Seamless integration of diverse aspects of intelligence, and diverse kinds of knowledge, in any combination An important third feature of the SP system, alongside its versatility in aspects of intelligence and its versatility in the representation of diverse kinds of knowledge, is that there is clear potential for the SP system to provide seamless integration of diverse aspects of intelligence and diverse kinds of knowledge, in any combination. This is because diverse aspects of intelligence and diverse kinds of knowledge all flow from a single coherent and relatively simple source: the SP-multiple-alignment framework. It appears that seamless integration of diverse aspects of intelligence and diverse kinds of knowledge, in any combination, is essential in any artificial system that aspires to the fluidity, versatility and adaptability of the human 10 mind. Figure 6 shows schematically how the SP system, with SP-multiplealignment centre stage, exhibits versatility and integration. e heory of intellig t P en S Unsupervised learning e c Th Several kinds of reasoning: deductive; abductive; chains of reasoning; probabilistic networks and trees; with ‘rules’; nonmonotonic; Bayesian; Pattern recognition: causal; inheritance of robust against attributes; with errors in data; potential for at multiple levels SPmore. of abstraction. multipleInformation alignment Computer vision retrieval: scene analysis best-match and more. and ‘semantic’. Seamless integration of diverse kinds of intelligence and knowledge, in any combination. Analysis and production of natural language Figure 6: A schematic representation of versatility and integration in the SP system, with SP-multiple-alignment centre stage. 7 Potential benefits and applications of the SP system Apart from its strengths and potential in modelling aspects of the human mind, it appears that, in more humdrum terms, the SP system has several potential benefits and applications. These include: • Big data. Somewhat unexpectedly, it has been discovered that the SP system has considerable potential to help solve nine significant problems associated with big data [16]. These are: overcoming the problem 11 of variety in big data; the unsupervised learning of structures and relationships in big data; interpretation of big data via pattern recognition, natural language processing and more; the analysis of streaming data; compression of big data; model-based coding for efficient transmission of big data; potential gains in computational and energy efficiency in the analysis of big data; managing errors and uncertainties in data; and visualisation of structure in big data and providing an audit trail in the processing of big data. • Autonomous robots. The SP system opens up a radically new approach to the development of intelligence in autonomous robots [15]; • An intelligent database system. The SP system has potential in the development of an intelligent database system with several advantages compared with traditional database systems [12]. In this connection, the SP system has potential to add several kinds of reasoning and other aspects of intelligence to the ‘database’ represented by the World Wide Web, especially if the SP machine were to be supercharged by replacing the search mechanisms in the foundations of the SP machine with the high-parallel search mechanisms of any of the leading search engines. • Medical diagnosis. The SP system may serve as a vehicle for medical knowledge and to assist practitioners in medical diagnosis, with potential for the automatic or semi-automatic learning of new knowledge [10]; • Computer vision and natural vision. The SP system opens up a new approach to the development of computer vision and its integration with other aspects of intelligence. It also throws light on several aspects of natural vision [14]; • Neuroscience. As outlined in Section 3.3, abstract concepts in the SP theory map quite well into concepts expressed in terms of neurons and their interconnections in a version of the theory called SP-neural ([19], [11, Chapter 11]). This has potential to illuminate aspects of neuroscience and to suggest new avenues for investigation. • Commonsense reasoning. In addition to the previously-described strengths of the SP system in several kinds of reasoning, the SP system has strengths in the surprisingly challenging area of “commonsense reasoning”, as described by Ernest Davis and Gary Marcus [4]. How the SP system may meet the several challenges in this area is described in [18]. 12 • Other areas of application. The SP system has potential in several other areas of application including [17]: the simplification and integration of computing systems; applications of natural language processing; best-match and semantic forms of information retrieval; software engineering [22]; the representation of knowledge, reasoning, and the semantic web; information compression; bioinformatics; the detection of computer viruses; and data fusion. • Mathematics. The concept of information compression via the matching and unification of patterns provides an entirely novel interpretation of mathematics [21]. This interpretation is quite unlike anything described in existing writings about the philosophy of mathematics or its application in science. There are potential benefits in science from this new interpretation of mathematics. 8 Other strengths of the SP system Apart the strengths of the SP system described in the previous four sections, there are others described mainly in [20]. A selection of what appear to be the more important ones are outlined here: • The amounts of data and processing required for learning. There is now widespread recognition of the unreasonably large amounts of data that are currently required by deep learning systems to learn anything useful, and the correspondingly large amount of processing that is needed.1 Although there is still work to be done in the development of unsupervised learning in the SP system, it is clear from the overall approach and from what has been achieved already that the learning of meaningful knowledge by the SP system is likely to require substantially less data and processing than with deep learning systems [20, Sections V-D and V-E]. • Transparency in the representation of knowledge, and in processing. It is now widely recognised that a major problem with deep learning systems is that the way in which learned knowledge is represented in deep learning systems is far from being transparent and comprehensible by people, and that the way in which deep learning systems arrive at their conclusions is difficult or impossible for people to understand. 1 See, for example, “Greedy, brittle, opaque, and shallow: the downsides to deep learning”, Wired, 2018-02-03, bit.ly/2nM1ccg. 13 These deficiencies are of concern for reasons of safety, legal liability, and more.2 By contrast, and as with big data (Section 7), knowledge in the SP system is represented in a manner that is familiar to people, using such devices as class-inclusion hierarchies, part-whole hierarchies, and others. And there is an audit trail for all processing in the SP system, so that it is explicit and comprehensible by people. • Catastrophic forgetting and continuous learning. A major problem with deep learning—‘catastrophic forgetting’—is that new leaning wipes out old learning. A related problem is that, to be practical, a learning system, like a person, should be able to learn continuously from its environment without old knowledge being disturbed by new knowledge.3,4 A robust solution to this problem is intrinsic to the design of the SP system: new learning does not disturb old learning. • Learning with generalisation, and learning from ‘dirty data’. A general problem with any system for unsupervised learning is how to generalise beyond the finite body of information that has been seen since the ‘birth’ of the learning system, and how to correct over-generalisations and under-generalisations without the provision of a ‘teacher’ or anything equivalent. A related problem is how ‘correct’ knowledge may be learned from ‘dirty data’, meaning data that contains ‘errors’. With systems for deep learning, several different solutions to the generalisation problem have been proposed, but none of them have any good theoretical underpinning [20, Section V-H]. It appears that, with deep learning systems, no solutions have been offered to the problem of learning from ‘dirty data’. By contrast, the SP system offers a relatively simple solution to both problems that derives directly from the unifying principe—compression of information—that lies at the heart of the SP system. How compression of information may generalise correctly from its raw data, and how it may achieve learning from ‘dirty data’ is described in [11, Section 9.5.3] and [13, Section 5.3]. There is also relevant discussion in [20, 2 See, for example, “Inside DARPA’s push to make artificial intelligence explain itself”, CET US News, 2017-08-10, bit.ly/2FQMoAr. 3 Even if, for example, a person changes their name, the system should be able to retain both names and the date when the name was changed. 4 It appears that this problem is a matter of concern to military planners as described, for example, in “DARPA seeking AI that learns all the time”, IEEE Spectrum, 2017-11-21, bit.ly/2BdERfZ. 14 Sections V-H and XI-C]. Experiments with computational models of learning suggest that the analysis is sound. 9 Conclusion It seems that the overarching goal of this research—the simplification and integration of observations and concepts across artificial intelligence, mainstream computing, mathematics, and human learning, perception, and cognition—has, to a large extent, been achieved. The SP system provides a favourable combination of simplicity and power: the concept of SP-multiple-alignment, together with some relatively simple procedures for unsupervised learning, have proved to be remarkably versatile across diverse aspects of intelligence, in the representation of diverse kinds of knowledge, and in the seamless integration of diverse aspects of intelligence, and diverse kinds of knowledge, in any combination. That last feature—seamless integration of diverse aspects of intelligence and diverse kinds of knowledge—appears to be essential in any artificial system that aspires to the fluidity, versatility, and adaptability of the human mind. The SP system, compared with AI-related alternatives considered in [20], appears to provide a relatively firm foundation for the development of general human-like intelligence. References [1] F. Attneave. Some informational aspects of visual perception. Psychological Review, 61:183–193, 1954. [2] H. B. Barlow. Sensory mechanisms, the reduction of redundancy, and intelligence. In HMSO, editor, The Mechanisation of Thought Processes, pages 535–559. Her Majesty’s Stationery Office, London, 1959. [3] H. B. Barlow. Trigger features, adaptation and economy of impulses. In K. N. Leibovic, editor, Information Processes in the Nervous System, pages 209–230. Springer, New York, 1969. [4] E. Davis and G. Marcus. Commonsense reasoning and commonsense knowledge in artificial intelligence. Communications of the ACM, 58(9):92–103, 2015. 15 [5] M. Li and P. Vitányi. An Introduction to Kolmogorov Complexity and Its Applications. Springer, New York, 3rd edition, 2014. [6] V. Palade and J. G. Wolff. Development of a new machine for artificial intelligence. Technical report, CognitionResearch.org, 2017. Submitted for publication. bit.ly/2tWb88M, arXiv:1707.0061 [cs.AI]. [7] J. Schmidhuber. Deep learning in neural networks: an overview. Neural Networks, 61:85–117, 2015. [8] R. J. Solomonoff. A formal theory of inductive inference. Parts I and II. Information and Control, 7:1–22 and 224–254, 1964. [9] R. J. Solomonoff. The discovery of algorithmic probability. Journal of Computer and System Sciences, 55(1):73–88, 1997. [10] J. G. Wolff. Medical diagnosis as pattern recognition in a framework of information compression by multiple alignment, unification and search. Decision Support Systems, 42:608–625, 2006. bit.ly/1F366o7, arXiv:1409.8053 [cs.AI]. [11] J. G. Wolff. Unifying Computing and Cognition: the SP Theory and Its Applications. CognitionResearch.org, Menai Bridge, 2006. ISBNs: 09550726-0-3 (ebook edition), 0-9550726-1-1 (print edition). Distributors, including Amazon.com, are detailed on bit.ly/WmB1rs. [12] J. G. Wolff. Towards an intelligent database system founded on the SP theory of computing and cognition. Data & Knowledge Engineering, 60:596–624, 2007. bit.ly/1CUldR6, arXiv:cs/0311031 [cs.DB]. [13] J. G. Wolff. The SP theory of intelligence: an overview. Information, 4(3):283–341, 2013. bit.ly/1NOMJ6l, arXiv:1306.3888 [cs.AI]. [14] J. G. Wolff. Application of the SP theory of intelligence to the understanding of natural vision and the development of computer vision. SpringerPlus, 3(1):552–570, 2014. bit.ly/2oIpZB6, arXiv:1303.2071 [cs.CV]. [15] J. G. Wolff. Autonomous robots and the SP theory of intelligence. IEEE Access, 2:1629–1651, 2014. bit.ly/18DxU5K, arXiv:1409.8027 [cs.AI]. [16] J. G. Wolff. Big data and the SP theory of intelligence. IEEE Access, 2:301–315, 2014. bit.ly/2qfSR3G, arXiv:1306.3890 [cs.DB]. This paper, with minor revisions, is reproduced in Fei Hu (Ed.), Big Data: Storage, 16 Sharing, and Security (3S), Taylor & Francis LLC, CRC Press, 2016, pp. 143–170. [17] J. G. Wolff. The SP theory of intelligence: benefits and applications. Information, 5(1):1–27, 2014. bit.ly/1FRYwew, arXiv:1307.0845 [cs.AI]. [18] J. G. Wolff. Commonsense reasoning, commonsense knowledge, and the SP theory of intelligence. Technical report, CognitionResearch.org, 2016. Submitted for publication. bit.ly/2eBoE9E, arXiv:1609.07772 [cs.AI]. [19] J. G. Wolff. Information compression, multiple alignment, and the representation and processing of knowledge in the brain. Frontiers in Psychology, 7:1584, 2016. bit.ly/2esmYyt, arXiv:1604.05535 [cs.AI]. [20] J. G. Wolff. The SP theory of intelligence: its distinctive features and advantages. IEEE Access, 4:216–246, 2016. bit.ly/2qgq5QF, arXiv:1508.04087 [cs.AI]. [21] J. G. Wolff. On the “mysterious” effectiveness of mathematics in science. Technical report, CognitionResearch.org, 2017. Submitted for publication. bit.ly/2otrHD0, viXra:1706.0004, hal-01534622. [22] J. G. Wolff. Software engineering and the SP theory of intelligence. Technical report, CognitionResearch.org, 2017. bit.ly/2w99Wzq, arXiv:1708.06665 [cs.SE]. [23] J. G. Wolff. Solutions to problems with deep learning. Technical report, CognitionResearch.org, 2018. bit.ly/2AJzu4j, arXiv:1801.05457 [cs.LG]. 17
2cs.AI
arXiv:1610.05016v1 [cs.NE] 17 Oct 2016 Weekly maintenance scheduling using exact and genetic methods Andrew W. Palmer, Robin Vujanic, Andrew J. Hill, Steven J. Scheding October 18, 2016 Abstract The weekly maintenance schedule specifies when maintenance activities should be performed on the equipment, taking into account the availability of workers and maintenance bays, and other operational constraints. The current approach to generating this schedule is labour intensive and requires coordination between the maintenance schedulers and operations staff to minimise its impact on the operation of the mine. This paper presents methods for automatically generating this schedule from the list of maintenance tasks to be performed, the availability roster of the maintenance staff, and time windows in which each piece of equipment is available for maintenance. Both Mixed-Integer Linear Programming (MILP) and genetic algorithms are evaluated, with the genetic algorithm shown to significantly outperform the MILP. Two fitness functions for the genetic algorithm are also examined, with a linear fitness function outperforming an inverse fitness function by up to 5% for the same calculation time. The genetic algorithm approach is computationally fast, allowing the schedule to be rapidly recalculated in response to unexpected delays and breakdowns. 1 Introduction Maintenance activities are a significant cost in the mining sector, making up between 30% and 60% of the total operating cost of a mine (Singleton & Krellis, 1998; Lewis & Steinberg, 2001; Dhillon, 2008). In addition to direct costs, poorly planned maintenance can have a large impact on mine productivity—equipment spending longer in maintenance than needed effectively reduces the total tonnes of ore that a mine can produce. As a result, generating maintenance schedules that minimise the impact on the operation of the mine is of great importance to mine operators. Existing work on planning maintenance in the mining industry has looked at modelling the reliability of the equipment (Summit & Halomoan, 2015), or focused on long timescales, allocating equipment to tasks with the objective to minimise the expected maintenance costs over the lifetime of the mine (Topal & Ramazan, 2010). This paper examines the problem of generating the weekly maintenance schedule for the multitude of activities to be performed 1 on each piece of equipment, with the objective of minimising the impact of the maintenance on the mine operations. The proposed approach is aware of constraints such as the number of maintenance bays and the availability roster of the maintainers, and is demonstrated on real and simulated datasets that reflect practical problem sizes. The current approach to producing weekly maintenance schedules is largely manual, and requires the dedicated schedulers to coordinate with the operations planners to develop a schedule that satisfies operational constraints. While the intention is that the schedule should be generated once for the week, they are frequently revised to incorporate unexpected breakdown of equipment and delays (Tomlingson, 2007). The aim of this work is to automatically and quickly generate the schedule given the list of maintenance tasks that are to be performed, the availability roster of the maintenance staff, and time windows for each piece of equipment in which the equipment can be taken down for maintenance with minimal impact on the mine operations. To the best of the authors’ knowledge, the weekly maintenance scheduling problem has not been studied in the literature. Some related maintenance scheduling problems are examined by Gopalakrishnan et al. (2001); Deris et al. (1999); Ben Ali et al. (2011); Jiu et al. (2013); Jin et al. (2009); Aissani et al. (2009); Pandey et al. (2011); Najid et al. (2011). Many of these authors used meta-heuristics such as tabu-search (Gopalakrishnan et al. , 2001) and Genetic Algorithms (GAs) (Deris et al. , 1999; Ben Ali et al. , 2011; Jiu et al. , 2013) to generate a schedule. These meta-heuristic approaches were shown to produce near-optimal solutions in reasonable calculation times. An option-based cost model was used by Jin et al. (2009), while a novel reinforcement learning approach was utilised by Aissani et al. (2009). Methods for jointly optimising maintenance and production were developed by Pandey et al. (2011); Najid et al. (2011). Najid et al. (2011) formulated this as a Mixed-Integer Linear Program (MILP) and solved it using commercial optimisation software. However, the authors pointed out that only small problem instances were solvable, and stated that they intend to investigate meta-heuristics for solving larger instances. The major difference between the above problems and producing a weekly mine maintenance schedule is in the size of the problem. Typical weekly maintenance schedules can contain over 100 pieces of equipment, with up to 50 individual activities per piece of equipment. Durations for each activity can range from half an hour to several days, and approximately 25 different types of workers, such as fitters, electricians, and boilermakers, are required. The availability of these workers varies both day to day and between the day and night shifts. One of the characteristics of mining in general is that it is very dynamic, with unexpected events such as equipment failures occurring frequently. Thus, one of the requirements of the scheduling system is that it should be computationally fast to allow rapid replanning in response to these unexpected events. Two approaches to this problem are proposed in this paper—a MILP formulation that is solved using Gurobi (Gur, n.d.), and a GA. While the MILP approach generates optimal solutions, it will be shown to be computationally 2 infeasible for realistic problem sizes, motivating the use of the GA. The specific contributions of this paper are: • A MILP formulation of the problem • A GA approach that utilises a greedy heuristic to ensure that feasible schedules are generated from the chromosomes • A comprehensive evaluation of the MILP method and the GA using two different fitness functions The remainder of this paper is structured as follows: Section 2 presents a MILP formulation of the problem, and Section 3 develops the GA. A comparison of the methods is presented in Section 4, and concluding remarks are provided in Section 5. 2 MILP Formulation The weekly maintenance problem is to schedule a given set of tasks (equipment) i ∈ I with associated subtasks (work orders) j ∈ Ji . Each task has a ready time that specifies the earliest a task can be started, and a deadline that specifies when it should be completed by. Some tasks require a maintenance bay, and subtasks have a specified duration and worker requirement. Subtasks can have a precedence requirement where they require other subtasks of the task to be performed before it can be performed. An example task with 7 subtasks is shown in Figure 1. The worker requirements of the subtasks in the example are denoted by the colours and specified numbers in the subtasks, and the subtasks have been scheduled to respect the precedence of the subtasks. The schedule is split into discrete, equally-sized time periods. The objective of the problem is to schedule the subtasks to minimise the sum of the makespan and lateness of the tasks. Makespan is simply the length of a task, and lateness is incurred if the task is completed after the deadline. The rest of this section formally presents the MILP model. 2.1 Indices and Sets t∈T time periods, where T = {0, . . . , tmax } i∈I tasks j∈J subtasks p∈P worker types The set of tasks that require a maintenance bay is M ⊆ I, the set of subtasks that compose task i is Ji ⊆ J, and the set of subtasks that must be performed before j is Kj ⊆ J. Subtasks can only belong to one task, so Ji ∩ Jk = ∅ ∀i ∈ I, k ∈ I\{i}. 3 Figure 1: An example task with its subtasks scheduled as early as possible taking into account the precedence constraints. Examples of the precedence constraints seen in this example are the vehicle must be washed before further tasks are performed, and the tyres must be removed and replaced before and after the brake service. The colour of the subtask specifies the type of personnel required (5 in the example, which could include electrician, fitter, boilermaker, etc.), and the number of people required is specified by the number in each subtask. 2.2 Parameters dj rj,p,s,t ap,t m bi ci fi gi 2.3 the duration of subtask j ∈ J in time periods the number of workers of type p ∈ P required for subtask j ∈ J in timestep t ∈ T if j started in timestep s ∈ {max(0, t − dj , . . . , t)} the number of workers of type p ∈ P available in time period t ∈ T the number of maintenance bays ready time for task i ∈ I deadline for task i ∈ I the weighting of the makespan of task i ∈ I the weighting of the lateness of task i ∈ I Optimisation Variables xstart ∈ {0, 1} j,t xi,t ∈ {0, 1} xstart ∈ {0, 1} i,t xfinish ∈ {0, 1} i,t yimakespan ∈ R yilateness ∈ R 1 iff subtask j ∈ J starts in time period t ∈ T 1 iff task i ∈ I is being performed in time period t ∈ T 1 iff task i ∈ I starts in time period t ∈ T 1 iff task i ∈ I finishes in time period t ∈ T makespan of task i ∈ I lateness of task i ∈ I 4 2.4 Objective function The objective function is the sum of the weighted makespan and lateness of each task: X J= fi yimakespan + gi yilateness (1) i∈I 2.5 2.5.1 Constraints Subtasks The first set of constraints specify when a subtask can start. Firstly, (2) enforces that each subtask has to start exactly once, and (3) specifies that it has to be completed before the end of the schedule. Constraint (4) encodes the precedence constraints as specified in Kj . X xstart =1 ∀j ∈ J (2) j,t t X (txstart j,t ) + dj ≤ tmax + 1 ∀j ∈ J (3) t X X (txstart (txstart j,t ) ≥ k,t ) + dk t 2.5.2 ∀j ∈ J, k ∈ Kj (4) t Tasks The next set of constraints deal with the tasks. Constraint (5), similar to (2), specifies that a task can only start once. The period that the task starts in is defined in (6) as the earliest starting period of its subtasks. The makespan of the task is calculated in (7) by specifying that the task must finish no earlier than any of its subtasks. Constraint (8) enforces that the task can only finish once, and (9) specifies that the period in which the task is finished in is no earlier than its start period plus its makespan. The lateness of the task is calculated in (10). Constraint (11) calculates whether a task is being performed in a time period or not based on whether it was being performed in the previous time period, and the time period in which the task starts and finishes. For (11) to work when t = 0, a dummy variable is added for each task in the time period t = −1 and assigned the value of 0 in (12). X xstart =1 ∀i ∈ I (5) i,t t X X (txstart (txstart i,t ) ≤ j,t ) t ∀i ∈ I, j ∈ Ji X X makespan (txstart ≥ (txstart i,t ) + yi j,t ) + dj t (6) t t 5 ∀i ∈ I, j ∈ Ji (7) X xfinish =1 i,t ∀i ∈ I (8) t X X (txfinish )≥ i,t t makespan (txstart i,t ) + yi ∀i ∈ I (9) t yilateness ≥ X (txfinish ) − ci i,t ∀i ∈ I (10) t xi,t = xi,t−1 + xstart − xfinish i,t i,t ∀i ∈ I xi,−1 = 0 2.5.3 ∀i ∈ I, t ∈ T (11) (12) Resources There are two resource constraints, namely a limited number of maintenance bays, and a limited number of workers. Constraint (13) enforces a limit on the number of maintenance bays being used in each time period. Note that only a subset of the tasks require a maintenance bay. Constraint (14) encodes the limit on the number of each type of worker in each time period. X xi,t ≤ m ∀t ∈ T (13) i∈M X X xstart j,s rj,p,s,t ≤ ap,t ∀p, t (14) j∈J s∈{max(0,t−dj ),...,t} 2.6 Optimisation Problem The maintenance scheduling problem is therefore expressed as the optimisation model P : ( minimise (1) P = subject to (2) − (14) Two solution methods to this optimisation problem are proposed—a branch and bound approach using commercial software package Gurobi Gur (n.d.), and a GA that is developed in the next section. As will be shown later in the results, this optimisation problem is hard for Gurobi, motivating the development of the genetic algorithm. 6 3 Genetic Algorithm Genetic algorithms are a class of meta-heuristics that aim to emulate the process of natural selection. They use a population of chromosomes to represent possible solutions to a problem, with each chromosome consisting of a set of genes that describe the solution. To create a new generation of chromosomes, chromosomes from the current generation are randomly combined in proportion to their fitness. In this way, traits from the strongest chromosomes are most likely to be carried forward to the next generation (Mitchell, 1998). Genes are also randomly mutated to avoid being trapped in local optima. This process is outlined in Figure 2. A common addition to GAs is elitism, in which the best chromosome(s) from the current generation are propagated to the next generation without modification. Elitism guarantees that solution quality will not decrease (Baluja & Caruana, 1995). The set of chromosomes in a given population will be denoted by N . The rest of this section first discusses possible chromosome representations and how a maintenance schedule is generated from a chromosome, before presenting the methods used in each step of the GA. 3.1 Chromosome representation and schedule generation Several different chromosome representations were considered. An obvious representation to choose is a direct representation, where the genes consist of binary variables corresponding to the optimisation variables introduced in Section 2. However, most of the values that this chromosome representation can take result in infeasible schedules due to the constraints on the availability of workers and maintenance bays. Thus, it was desirable to develop a representation that would reliably produce feasible schedules. The chromosome representation proposed for this application is an ordered list of tasks. The tasks are then scheduled using a greedy heuristic in the order specified by the chromosome to determine the values of the optimisation variables outlined in Section 2.3. The greedy heuristic places the subtasks of each task as early as possible while satisfying the constraints in Section 2.5. Provided there is always at least 1 maintenance bay and the minimum number of workers required for any subtasks available in each time period, then this representation is guaranteed to always produce a feasible solution. Figure 3 shows the schedules resulting from using the greedy heuristic on the two possible chromosomes for a scenario with two tasks. The greedy heuristic can fail to produce a feasible schedule in certain cases. For example, if the type of worker required for a specific subtask is only available for a small number of time periods at the beginning of the schedule, and the task requires a maintenance bay, then if the task is too late in the chromosome the greedy heuristic can fail to find a valid spot for the subtasks to be placed. 7 Initial population Calculate fitness Select parents Mate parents using crossover Mutate children No Final generation? Yes Best solution Figure 2: Flowchart outlining the steps in the genetic algorithm. 8 (a) Tasks scheduled in order 1,2 (b) Tasks scheduled in order 2,1 Figure 3: This figure shows two tasks being scheduled by the greedy heuristic. Task 1 becomes available for maintenance in time period 0, and task 2 in time period 2 (denoted by the striped area). The tasks are otherwise identical, consisting of two subtasks that each require 1 worker to complete. The first subtask of each task has a duration of 1 time period, and the second subtask has a duration of 2 time periods. For this example, there is only 1 worker available and the tasks do not require maintenance bays. In (a), the tasks are greedily scheduled in the order 1,2, while in (b) the tasks are greedily scheduled in the order 2,1. 9 3.2 Initial population The characteristics of the initial population of chromosomes can have a large impact on the performance of the algorithm (Diaz-Gomez & Hougen, 2007). There is a trade-off between having an initial population that contains good initial solutions, which improves the probability of finding a good final solution (Burke et al. , 2004), and having a diverse initial population, which helps avoid premature convergence (Leung et al. , 1997). To strike a balance between diversity and quality, two of the chromosomes in the initial population are selected using heuristics, while the remaining are randomly generated. The first of the heuristics creates a chromosome by sorting the tasks by their ready times. The reasoning behind this heuristic is that it should avoid situations like Figure 3b where the task with the later ready time is performed in between the subtasks of the other task, leading to a large makespan for the first task. The second heuristic is primarily aimed at producing a feasible schedule in scenarios where many of the chromosomes are unable to be converted into a feasible schedule by the greedy heuristic. Tasks that have subtasks that can only be performed in a limited range of times are placed earlier in the chromosome so that they are likely to be able to be scheduled by the greedy heuristic. 3.3 Calculating the fitness of a chromosome Two fitness functions were investigated. The first fitness function calculates the fitness of the n-th chromosome, φ1n , as: φ1n = max{Jν ∀ν ∈ N } − Jn (15) where Jn is calculated using the objective function from Eq. (1). Note that the max term considers only the chromosomes that result in a feasible schedule. The second function calculates the fitness, φ2n , as: φ2n = Jn − P 1 fi min-makespani (16) i∈I In this formula, the minimum possible makespan cost is subtracted from the value of the objective function. A perfect schedule in which all tasks take the minimum possible time and are completed before their deadlines would therefore result in a denominator value of 0, and a corresponding infinite fitness value. Note that if a perfect schedule is found, this can simply be returned as the best schedule without running the GA to completion. 3.4 Parent selection A pair of parents are randomly selected for each chromosome in the next generation in proportion to their fitness using the roulette wheel selection method (Davis, 1991). Chromosomes that do not result in feasible schedules do not have a fitness and are not considered as valid parents. 10 3.5 Crossover Two-point crossover is used to generate a new chromosome from the two parents, as illustrated in Figure 4. First, one of the parents is selected at random to be the dominant parent and two crossover points in the chromosome are randomly selected. If the number of tasks between the crossover points is larger than the number of tasks outside the crossover points, then the dominant parent’s tasks between the crossover points are copied to the child chromosome. Otherwise, the dominant parent’s tasks outside of the crossover points are copied to the child chromosome. The tasks that were not copied across are then greedily placed into the child chromosome in the order in which they appear in the non-dominant parent. 3.6 Mutation The final step in each round of the GA is to mutate the children. A probabilistic check against the mutation rate is performed for each gene in the chromosome. If the check succeeds, then the gene is swapped with another randomly selected gene in the chromosome. The result of this is shown in Figure 4d. 4 Computational Study Two weekly maintenance schedules from a sample mine were used to generate the input datasets used in this paper. Each weekly schedule had just under 100 pieces of equipment, and each piece of equipment had between 1 and 50 subtasks, yielding a total of approximately 800 subtasks. 25 different types of people were required for performing the work, each with differing availability levels. Some types of people were only available during the day-shift, while others were available during both the day-shift and night-shift, but in varying numbers. Approximately 1/3rd of the pieces of equipment required a maintenance bay, while the remaining were serviced in the field. The mine site under consideration had 5 bays in the maintenance shed available for equipment being serviced. This section first evaluates the performance of the commercial solver and GA approaches as the number of tasks is varied, followed by a comprehensive comparison of the methods on randomly generated datasets with the task and worker tightnesses varied. The commercial solver used was Gurobi (Gur, n.d.), and, unless otherwise specified, a time limit of 600s was used for solving the model. The methods tested were the GA with the fitness function defined in (15) (GA1), the GA with the fitness function defined in (16) (GA2), the Gurobi (MILP), and Gurobi seeded with an initial solution using a heuristic (MILP+H). The heuristic used in the MILP+H method simply sorted the tasks by their ready time. The GA used a population size of 100 chromosomes, 60 generations, a mutation rate of 0.1% per gene, and elitism of 1 chromosome. These values were experimentally found to give good performance. These parameters were not 11 Parent 1 1 2 3 4 5 6 7 8 9 10 Parent 2 10 9 8 7 6 5 4 3 2 1 Child (a) Before crossover Parent 1 1 2 3 4 5 6 7 8 9 10 Parent 2 10 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 Child (b) Dominant parent’s genes copied across Parent 1 1 2 3 4 5 6 7 8 9 10 Parent 2 10 9 8 7 6 5 4 3 2 1 Child 10 2 3 4 5 6 7 9 8 1 (c) Non-dominant parent’s genes copied across Child 10 2 3 4 5 6 7 9 8 1 Mutated 10 2 7 4 5 6 3 9 8 1 (d) Mutation Figure 4: Demonstration of the crossover and mutation process on chromosomes consisting of 10 genes. Parent 1 is selected as the dominant parent, and crossover points between the 1st and 2nd genes, and between the 7th and 8th genes are chosen. In (b), the genes between the crossover points in parent 1 are copied to the child. In (c), the genes not currently in the child chromosome are inserted in the order they appear in parent 2. Finally, in (d), a random mutation swaps the 3rd and 7th genes. 12 varied for the different fitness functions as the intention was to show the difference due only to the choice of fitness function. The purpose of this paper was also not to determine the optimal parameters for the GA, as these should be tuned for the specific scenario under consideration. Unless otherwise noted, all calculation times are from an i7-4810MQ with 16GB of RAM, and Gurobi was set to use a maximum of 4 threads. The GA was programmed by the authors in Python and is single threaded. 4.1 Varying the number of tasks The performance of the approaches as the size of the problem was varied was first examined. The number of tasks was varied to correspond to approximately 1, 2, 3, 4, 5, 6, and 7 days worth of tasks in the original schedule. Figure 5 shows the optimality gap for each method, where the optimality gap was calculated based on the best lower bound calculated by Gurobi using the following formula: best solution cost −1 (17) best bound Gurobi was only able to find a solution in the first case, in which it found the optimal solution. When provided with an initial solution, it found the optimal solution in the first two cases, but was unable to improve upon the heuristically generated initial solution in the remaining cases. Figure 6 shows the calculation times of each method. As can be seen, Gurobi very quickly hit the time limit of 600s, while the maximum calculation time for the GA approaches was approximately 230s. To highlight the infeasibility of the commercial solvers for realistic problem sizes, Gurobi was run for 6 hours using 8 threads on the full 7 days worth of tasks. In this case, the models have over 300,000 binary variables to solve for. Even running for 6 hours, Gurobi was unable to find a feasible solution for the MILP model, or improve from the initial solution for the MILP+H model. In addition, Gurobi was unable to improve the lower bound from the lower bound produced by the initial root relaxation of the model. optimality gap = 4.2 Random scenarios A set of random scenarios was generated from the input schedules to comprehensively test the performance of each method. Two aspects of the problem were varied—the tightness of the deadline, and the tightness of the worker availability constraints. While the tightness of the deadline impacts the objective value of the optimal schedule, it does not impact on the difficulty of the problem. The tightness of the worker availability constraints, on the other hand, impacts both the objective value of the optimal schedule as well as the problem difficulty. 100 random scenarios were created by randomly sampling the ready time of each task. The deadline of each task was generated from the ready time, minimum possible makespan of the task, and the specified deadline tightness, π, using the following formula: 13 Optimality gap versus number of tasks GA1 GA2 MILP MILP+H 40 35 Optimality gap (%) 30 25 20 15 10 5 0 10 20 30 40 50 60 70 Number of tasks 80 90 100 Figure 5: Optimality gap versus number of tasks. Note that a feasible solution was only found in the first case for Gurobi solving the MILP. Calculation time versus number of tasks 600 Calculation time (s) 500 400 GA1 GA2 MILP MILP+H 300 200 100 0 10 20 30 40 50 60 70 Number of tasks 80 90 Figure 6: Calculation time versus number of tasks. 14 100 ci = bi + π × min-makespani (18) Values of π ∈ {1, 1.5, 2} were tested. Three levels of worker tightness were also considered. The tightest level used the actual number of workers available for the supplied schedules—in this case, there were between 1 and 6 workers of most types available, depending on whether it was the day shift of night shift, while 1 or 2 of the types of workers had 10 workers available. The next tightest level assumed that there were 10 workers of every type available. In this way, most of the worker availability constraints become somewhat irrelevant, reducing the difficulty of the problem. Finally, the loosest level of worker tightness assumed that 15 workers of every type available. Each of the 100 random scenarios was tested using every combination of deadline tightness and worker tightness, yielding 900 different scenarios in total. A summary of the results are displayed in Tables 1 and 2. Note that the results for the MILP method are omitted as Gurobi was only able to find a feasible solution in 6 of the 900 instances. The heuristic used to seed the MILP+H method produced feasible solutions in all but 3 of the instances, and in 14 cases Gurobi found the optimal solution. It should be noted, though, that the GA1 and GA2 methods also found the optimal solution in those 14 cases, suggesting that they were particularly easy instances. Table 1 shows the average optimality gap of each method calculated using (17) and the best lower bound found by Gurobi. It is clear that Gurobi is significantly outperformed by the GA approaches, while, in general, the GA1 approach outperformed the GA2 approach. Similar to the scenarios in Section 4.1, Gurobi struggled to improve upon both the heuristically generated initial solution and the initial lower bound. It is therefore difficult to comment on how close to the true optimal solution the GA approaches were. Table 2 shows the relative performance of each method using the GA1 method as the reference point. As can be seen, the GA1 method clearly outperforms the GA2 approach when both the deadlines and worker constraints are tight, with an almost 5% difference in their costs. As these constraints are loosened, the performance difference between the methods decreases. This is a characteristic of the different fitness functions used—when the cost of the schedules are high, the fitness function in (15) provides much better discrimination between chromosomes than the fitness function in (16). This is highlighted in Figure 7a, where the GA1 approach is shown to converge significantly quicker than the GA2 approach. On the other hand, when the schedule costs are very low, the GA2 method can converge significantly quicker than the GA1 method, as shown in Figure 7b. While GA2 converges faster however, the cost of the best chromosome progresses similarly with the number of generations for both methods. 15 Table 1: Average optimality gap to best known bound for random scenarios Deadline tightness Tight → Loose Worker tightness Method Tight MILP+H GA1 GA2 100.1% 48.6% 55.6% 100.4% 43.1% 46.6% 63.0% 22.1% 24.0% ↓ MILP+H GA1 GA2 52.2% 23.5% 25.1% 42.7% 15.3% 15.1% 20.7% 3.3% 3.6% Loose MILP+H GA1 GA2 15.3% 5.3% 5.9% 16.8% 4.9% 4.9% 7.5% 0.3% 0.6% Table 2: Average performance deficit relative to GA1 for random scenarios. Bold entries are the cases where the GA1 method was outperformed by the respective method. Deadline tightness Tight → Loose Worker tightness Method Tight MILP+H GA1 GA2 34.4% 0.0% 4.9% 39.2% 0.0% 2.5% 32.6% 0.0% 1.5% ↓ MILP+H GA1 GA2 21.6% 0.0% 1.3% 22.3% 0.0% -0.1% 16.4% 0.0% 0.4% Loose MILP+H GA1 GA2 9.2% 0.0% 0.5% 11.0% 0.0% 0.0% 7.0% 0.0% 0.2% 16 Cost versus Generation 22000 GA1 min GA1 avg GA1 max GA2 min GA2 avg GA2 max 20000 Cost 18000 16000 14000 12000 10000 8000 0 10 20 30 Generation 40 50 60 (a) High cost Cost versus Generation 9000 GA1 min GA1 avg GA1 max GA2 min GA2 avg GA2 max 8000 Cost 7000 6000 5000 4000 3000 0 10 20 30 Generation 40 50 60 (b) Low cost Figure 7: Performance of the GA1 and GA2 methods as the number of generations is increased. The minimum, average, and maximum costs in each generation are reported. In (a), the solution costs are significantly higher than the lowest possible schedule cost of approximately 2900, while in (b) the solution costs are very close to it. 17 5 Conclusion This paper developed and compared several methods for automatically generating a maintenance schedule for a typical fleet of mining equipment. Current approaches for scheduling maintenance are manual and time intensive. A mixedinteger linear programming model of the problem was formulated. Commercial optimisation software was unable to sufficiently solve the model, even when supplied with a heuristically generated starting schedule, necessitating the development of alternative strategies. To this end, a genetic algorithm approach was developed, which significantly outperformed the commercial optimisation software. Two fitness functions were also compared, with a linear fitness function shown to in general outperform an inverse fitness function. There are several avenues for future work. Further improvements to the performance of the genetic algorithm without increasing the computation time can be achieved by switching from Python to a compiled language such as C++. Genetic algorithms are also embarrassingly parallelisable, so further reductions in the computation time can be achieved in this way. On the algorithmic side, running multiple independent genetic algorithms in parallel may improve the robustness of the approach by helping to avoid local minima. Dynamically switching the fitness function used based on the current chromosome costs could also yield potential improvements in the convergence rate of the algorithm. Finally, methods for incorporating the previous schedule as a starting point when replanning could be investigated. Acknowledgements This work was supported by the Rio Tinto Centre for Mine Automation and the Australian Centre for Field Robotics, University of Sydney, Australia. References Gurobi Optimization. Aissani, N., Beldjilali, B., & Trentesaux, D. 2009. Dynamic scheduling of maintenance tasks in the petroleum industry: A reinforcement approach. Engineering Applications of Artificial Intelligence, 22(7), 1089–1103. Baluja, Shumeet, & Caruana, Rich. 1995. Removing the genetics from the standard genetic algorithm. Icml, 1–11. Ben Ali, M., Sassi, M., Gossa, M., & Harrath, Y. 2011. Simultaneous scheduling of production and maintenance tasks in the job shop. International Journal of Production Research, 49(13), 3891–3918. Burke, Edmund K., Gustafson, Steven, & Kendall, Graham. 2004. Diversity in Genetic Programming: An Analysis of Measures and Correlation with Fitness. IEEE Transactions on Evolutionary Computation, 8(1), 47–62. 18 Davis, Lawrence. 1991. Handbook of genetic algorithms. Van Nostrand Reinhold. Deris, Safaai, Omatu, Sigeru, Ohta, Hiroshi, Shaharudin Kutar, Lt.Cdr, & Abd Samat, Pathiah. 1999. Ship maintenance scheduling by genetic algorithm and constraint-based reasoning. European Journal of Operational Research, 112(3), 489–502. Dhillon, Balbir S. 2008. Mining equipment reliability, maintainability, and safety. Springer Science & Business Media. Diaz-Gomez, Pa, & Hougen, Df. 2007. Initial Population for Genetic Algorithms: A Metric Approach. Proceedings of the 2007 International Conference on Genetic and Evolutionary Methods, 43–49. Gopalakrishnan, M, Mohan, S, & He, Z. 2001. A tabu search heuristic for preventive maintenance scheduling. Computers & Industrial Engineering, 40(12), 149–160. Jin, Xiaoning, Li, Lin, & Ni, Jun. 2009. Option model for joint production and preventive maintenance system. International Journal of Production Economics, 119(2), 347–353. Jiu, Song, Zhou, Zhili, & Liu, Jiyin. 2013. The equipment maintenance scheduling problem in a coal production system. International Journal of Production Research, 51(17), 5309–5336. Leung, Yee, Gao, Yong, & Xu, Zong Ben. 1997. Degree of population diversity A perspective on premature convergence in genetic algorithms and its Markov chain analysis. IEEE Transactions on Neural Networks, 8(5), 1165–1176. Lewis, Michael W., & Steinberg, Luiz. 2001. Maintenance of mobile mine equipment in the information age. Journal of Quality in Maintenance Engineering, 7(4), 264–274. Mitchell, Melanie. 1998. An Introduction to Genetic Algorithms. MIT press. Najid, Najib M., Alaoui-Selsouli, Marouane, & Mohafid, Abdelmoula. 2011. An integrated production and maintenance planning model with time windows and shortage cost. International Journal of Production Research, 49(8), 2265– 2283. Pandey, Divya, Kulkarni, Makarand S, & Vrat, Prem. 2011. A methodology for joint optimization for maintenance planning, process quality and production scheduling. Computers & Industrial Engineering, 61(4), 1098–1106. Singleton, T, & Krellis, O. 1998. Mine maintenance - the cost of operation. Coal Operators Conference, 81–90. 19 Summit, Raymond, & Halomoan, David. 2015. Reliability modelling for maintenance scheduling of mobile mining equipment. Pages 526–540 of: Proceedings of the 11th Biennial Engineering Mathematics and Applications Conference, vol. 55. Tomlingson, Paul D. 2007. Mine Maintenance Management Reader. Society for Mining, Metallurgy, and Exploration. Topal, Erkan, & Ramazan, Salih. 2010. A new MIP model for mine equipment scheduling by minimizing maintenance cost. European Journal of Operational Research, 207(2), 1065–1071. 20
9cs.NE
Simple groups, product actions, and generalised quadrangles arXiv:1702.07308v1 [math.GR] 23 Feb 2017 John Bamberg, Tomasz Popiel, Cheryl E. Praeger Abstract. The classification of flag-transitive generalised quadrangles is a long-standing open problem at the interface of finite geometry and permutation group theory. Given that all known flag-transitive generalised quadrangles are also point-primitive (up to point–line duality), it is likewise natural to seek a classification of the point-primitive examples. Working towards this aim, we are led to investigate generalised quadrangles that admit a collineation group G preserving a Cartesian product decomposition of the set of points. It is shown that, under a generic assumption on G, the number of factors of such a Cartesian product can be at most four. This result is then used to treat various types of primitive and quasiprimitive point actions. In particular, it is shown that G cannot have holomorph compound O’Nan–Scott type. Our arguments also pose purely group-theoretic questions about conjugacy classes in non-Abelian finite simple groups, and about fixities of primitive permutation groups. 1. Introduction Generalised quadrangles are point–line incidence geometries introduced by Tits [25] in an attempt to find geometric models for simple groups of Lie type. The classical generalised quadrangles arise in this way [22, Section 3]. Each admits one of the simple classical groups T = PSp(4, q) ∼ = Ω5 (q), PSU(4, q) ∼ (q) or PSU(5, q) acting transitively on flags (incident point–line pairs). Moreover, the = PΩ− 6 point and line stabilisers are certain maximal subgroups of T , so T acts primitively on both points and lines. The classification of flag-transitive generalised quadrangles is a long-standing open problem. In addition to the classical families, only two other flag-transitive examples are known (up to point–line duality), each admitting an affine group acting point-primitively but line-imprimitively. Hence, all of the known flag-transitive generalised quadrangles are also point-primitive (up to duality), and so it is natural to seek a classification of the point-primitive examples. Indeed, this is arguably a more difficult problem, because one begins with essentially no information about the action of the collineation group on lines, nor any notion of what ‘incidence’ means, whereas in a flag-transitive point–line geometry, points and lines correspond to cosets of certain subgroups of the collineation group, and incidence is determined by non-empty intersection of these cosets. Here we prove the following theorem. The abbreviations HS (holomorph simple), HC (holomorph compound), SD (simple diagonal), CD (compound diagonal), PA (product action), AS (almost simple) and TW (twisted wreath) refer to the possible types of non-affine primitive permutation group actions, in the sense of the O’Nan–Scott Theorem as stated in [19, Section 6]. In the second column of Table 1, soc(G) denotes the socle of the group G, namely the subgroup generated by its minimal normal subgroups. By fixΩ (h) we mean the number of elements fixed by a permutation h of the set Ω, and Q− (5, 2) is the unique generalised quadrangle of order (2, 4). Theorem 1.1. If Q is a thick finite generalised quadrangle with a non-affine collineation group G that acts primitively on the point set P of Q, then the action of G on P does not have O’Nan–Scott type HC, and the conditions in Table 1 hold for the remaining O’Nan–Scott types. 2010 Mathematics Subject Classification. primary 51E12; secondary 20B15, 05B25. Key words and phrases. generalised quadrangle, primitive permutation group, finite simple group, centraliser, fixity. The first author acknowledges the support of the Australian Research Council (ARC) Future Fellowship FT120100036. The second author acknowledges the support of the ARC Discovery Grant DP140100416. The research reported in the paper forms part of the ARC Discovery Grant DP140100416 of the third author. We thank Elisa Covato and Tim Burness for making available to us the results quoted in Section 6, and Luke Morgan for helpful discussions. 1 2 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER Type soc(G) Necessary conditions HS T is of Lie type Aε5 , Aε6 , B3 , C2 , C3 , Dε4 , Dε5 , Dε6 , Eε6 , E7 or F4 T is a sporadic simple group or T ∼ = Altn with n 6 18; or T is an exceptional Lie type group; or T has Lie type A1 , Aεn with 2 6 n 6 8; Bn or Cn with 2 6 n 6 4; or Dεn with 4 6 n 6 8 r = 2 and T ∼ = Altn with n 6 9; or r = 2 and T is a sporadic simple group with T ∼ 6 Suz, Co2 , Fi22 , Fi23 , B or M; or = r = 2 and T has Lie type A1 , Aε2 , Aε3 , B2 , 2 B2 , 2 F4 , G2 or 2 G2 ; or r = 3 and T ∼ = J1 or T is of Lie type A1 or 2 B2 T ×T SD Tk CD (T k )r PA Tr r = 2 and fixΩ (h) < |Ω|3/5 for all h ∈ H \ {1}; or 3 6 r 6 4, T is a group of Lie type, and fixΩ (h) < |Ω|1−r/5 for all h ∈ H \ {1}; or 3 6 r 6 4, H = T ∼ = Altp with point stabiliser p. p−1 2 for a prime p ≡ 3 (mod 4) AS T TW Tr fixP (g) < |P|4/5 for all g ∈ G \ {1}; or Q = Q− (5, 2) with T ∼ = PSU4 (2) fixP (g) < |P|4/5 for all g ∈ G \ {1} Table 1. Conditions for Theorem 1.1. Here T is a non-Abelian finite simple group, k > 2 and r > 2. If G acts primitively of type CD (respectively PA) on P, then G 6 H ≀ Symr for some primitive group H 6 Sym(Ω) of type SD (respectively AS) with socle T k (respectively T ). Note also that, in the notation for finite simple groups of Lie type used in Table 1 (and throughout + − − 2 + − 2 2 the paper), ε = ± and A+ n = An , An = An , Dn = Dn , Dn = Dn , E6 = E6 , E6 = E6 . Before we proceed, a remark is in order about the assumption in Theorem 1.1 that G not be an affine group. If G is affine, then the generalised quadrangle Q necessarily arises from a so-called pseudo-hyperoval in a projective space PG(3n − 1, q) with q even [12]. In joint work with Glasby [6], we were able to classify the generalised quadrangles admitting an affine group that acts primitively on points and transitively on lines: they are precisely the two flag-transitive, point-primitive, lineimprimitive generalised quadrangles mentioned above. However, without the extra assumption of transitivity on lines, the problem is equivalent to the classification of the pseudo-hyperovals that have an irreducible stabiliser. As explained in [6, Remark 1.3], this latter problem would appear to be extremely difficult, and possibly intractable. It also has a rather different flavour to the cases treated in the present paper, and so we do not consider it further here. Let us now establish some definitions and notation, before discussing further. By a point–line incidence geometry we mean a triple Γ = (P, L, I ), where P and L are sets whose elements are called points and lines, respectively, and I ⊆ P × L is a symmetric binary relation called incidence. We write Γ = (P, L) instead of (P, L, I ) when we do not need to refer to the incidence relation explicitly. Two points (respectively lines) of Γ are said to be collinear (respectively concurrent) if they are incident with a common line (respectively point). A collineation of Γ is a permutation of P ∪ L that preserves P and L setwise and preserves the incidence relation. By a collineation group of Γ we mean a subgroup of the group of all collineations of Γ, which is called the full collineation group. A generalised quadrangle is a point–line incidence geometry Q = (P, L) that satisfies the following two axioms: (i) two distinct points are incident with at most one common line, and (ii) given a point P and a line ℓ not incident with P , there exists a unique point incident with ℓ that is collinear with P . The second axiom implies that every pair in P ∪ L is contained in an ordinary quadrangle, and that Q contains no triangles. All generalised quadrangles considered in this paper are assumed to be finite, in the sense that P and L are finite sets. If every point is incident with at least three lines, and every line is incident with at least three points, then Q is said to be thick. In this case, there exist constants s > 2 and t > 2 such that every point is incident with exactly t + 1 lines and every line is incident with exactly s + 1 points [27, Corollary 1.5.3]. The pair (s, t) is called the order of Q. Observe also that there is a natural concept of point–line duality for generalised quadrangles: if (P, L) is a generalised quadrangle, then so is (L, P); and if (P, L) has order (s, t), then (L, P) has order (t, s). SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 3 Let us now discuss Theorem 1.1 further. The primitive permutation groups on a finite set ∆ are classified into eight types according to the O’Nan–Scott Theorem as presented in [19, Section 6]. In 2012, Bamberg et al. [3] showed that if a thick finite generalised quadrangle admits a collineation group G that acts primitively on both points and lines, then G must be an almost simple (AS type) group. That is, T 6 G 6 Aut(T ) for some non-Abelian finite simple group T . Given that there exist point-primitive generalised quadrangles that are line-transitive but line-imprimitive, our initial aim was to extend the result of [3] by relaxing the line-primitivity assumption to line-transitivity. In addition to handling the affine (HA type) case with Glasby [6], we were also able to show that no such examples arise if the point action has type HS or HC [8]. Theorem 1.1 significantly strengthens and expands upon the results of [3, 8]. The idea behind its proof begins with the following observations. A primitive group G 6 Sym(∆) of O’Nan–Scott type HC, CD, PA or TW preserves a Cartesian product decomposition ∆ = Ωr , for some set Ω and some r > 2. Therefore, in studying point-primitive generalised quadrangles, we are led in particular to consider generalised quadrangles with collineation groups that preserve a Cartesian product decomposition of the point set. The following theorem shows that the number of factors of such a decomposition becomes severely restricted under a fairly generic assumption on the group. Here a semiregular permutation group action is one in which only the identity element fixes a point, and if H1 , . . . , Hr are Qrpermutation groups on sets Ω1 , . . . , Ωr , respectively, then the product action of the direct product i=1 Hi on the Q Cartesian product ri=1 Ωi is the action (ω1 , . . . , ωr )(h1 ,...,hr ) = (ω1h1 , . . . , ωrhr ). We also recall that a permutation group is said to act regularly if it acts transitively and semiregularly. Theorem 1.2. Let Ω1 , . . . , Ωr be finite sets with 2 6 |Ω1 | 6 · · · 6 |Ωr |, where r > 1, and let Hi 6 Sym(Ωi ) for each i ∈ {1, . . . , r}. Assume further that H1 is non-trivial and that its action on Q Ω1 is not semiregular. Suppose that N = ri=1 Hi is a collineation group Q of a thick finite generalised quadrangle Q = (P, L) of order not equal to (2, 4), such that P = ri=1 Ωi and N has the product action on P. Then r 6 4, and every non-identity element of H1 fixes less than |Ω1 |1−r/5 points of Ω1 . The proof of Theorem 1.2 relies on the existence of a non-identity element h1 of H1 that fixes at least one point (h1 , 1, . . . , 1) ∈ N of Q that Q Q of Ω1 . If r > 2, one can then construct a collineation fixes at least ri=2 |Ωi | points of the Cartesian product P = ri=1 Ωi . Theorem 1.2 is then deduced from the following result, which bounds the number of points fixed by a non-identity collineation of an arbitrary thick finite generalised quadrangle. The proofs of both theorems are given in Section 2. Theorem 1.3. Let θ be a non-identity collineation of a thick finite generalised quadrangle Q = (P, L). Then either θ fixes less than |P|4/5 points of Q, or Q is the unique generalised quadrangle Q− (5, 2) of order (2, 4) and θ fixes exactly 15 of the 27 points of Q. Remark 1.4. Theorem 1.3 improves a particular case of a recent result of Babai on automorphism groups of strongly regular graphs [1, Theorem 1.7]. If Q has order (s, t) then its collinearity graph, namely the graph with vertex set P and two vertices adjacent if and only if they are collinear in Q, is a strongly regular graph with parameters v = |P| = (s + 1)(st + 1), k = s(t + 1), λ = s − 1 and µ = t + 1. Roughly speaking, we have v ≈ s2 t and k ≈ st, so the condition k 6 n3/4 in assertion (b) of [1, Theorem 1.7] becomes t 6 s2 , which is just Higman’s inequality for generalised quadrangles (see Lemma 2.1(ii)). Babai’s result, which applies far more generally to strongly regular graphs that are non-trivial, non-graphic and non-geometric, therefore implies that a non-identity collineation θ of Q can fix at most O(|P|7/8 ) points. Theorem 1.3 sharpens the 7/8 exponent in this bound to 4/5 in the case of collinearity graphs of generalised quadrangles. (Note also that assertion (a) of [1, Theorem 1.7] sharpens the 7/8 exponent to 5/6 when, roughly, t >√ s: the condition k > n2/3 roughly translates to √ t > s, and the corresponding bound is O( kn), with kn ≈ s3/2 t > (s2 t)5/6 ≈ |P|5/6 when t > s.) To aid our discussion, let us now state the following immediate corollary of Theorem 1.2. Corollary 1.5. Let Ω be a finite set with |Ω| > 2, and suppose that H 6 Sym(Ω) is non-trivial and not semiregular. Suppose that N = H r , r > 1, is a collineation group of a thick finite generalised quadrangle Q = (P, L) of order not equal to (2, 4), such that P = Ωr and N has the product action on P. Then r 6 4, and every non-identity element of H fixes less than |Ω|1−r/5 points of Ω. 4 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER T r=1 r=2 r=3 Altn sporadic exceptional Lie type PSLn+1 (q) PSUn+1 (q) PSp2n (q) or Ω2n+1 (q) PΩ± 2n (q) 5 6 n 6 18 any any 16n68 26n68 26n64 46n68 56n69 56n66 any except Suz, Co2 , Fi22 , Fi23 , B, M J1 2 2 F4 (q), G2 (q), 2 G2 (q), 2 B2 (q) B2 (q) 16n63 n = 1, q 6= 7 26n63 — n=2 — — — Table 2. Possibilities for a non-Abelian finite simple group T with the property that |CT (x)| < |T |1−r/5 for all x ∈ T \ {1}, for r equal to one of 1, 2 or 3. We apply Corollary 1.5 to groups N that arise as subgroups of certain types of primitive groups. This in turn motivates certain questions about non-Abelian finite simple groups. As illustration, consider the case where Ω = T for some non-Abelian finite simple group T , with H = T × T acting ′ on Ω via ω (x,x ) = x−1 ωx′ . This situation arises when N is the socle (the subgroup generated by the minimal normal subgroups) of a primitive group of type HS (r = 1) or HC (r > 2). If x′ = x then the element (x, x′ ) = (x, x) ∈ H fixes precisely |CT (x)| points of Ω, where CT (x) is the centraliser of x in T . Corollary 1.5 therefore implies that r 6 4, and that |CT (x)| < |T |1−r/5 for all x ∈ T \ {1}. We therefore ask which non-Abelian finite simple groups T satisfy this condition. If r = 4 then we require that |CT (x)| < |T |1/5 for all x ∈ T \ {1}, which is false for every non-Abelian finite simple group T . Indeed, it is well known that every non-Abelian finite simple group T contains an involution x with |CT (x)| > |T |1/3 (in fact, every involution in T has this property [21, Proposition 2.4]). For r ∈ {1, 2, 3}, we verify the following result in Section 3. Although this result follows from routine calculations, we include it here in case it proves to be a convenient reference. Proposition 1.6. Let r ∈ {1, 2, 3} and let T be a non-Abelian finite simple group. Then either |CT (x)| > |T |1−r/5 for some x ∈ T \ {1}, or T is one of the groups listed in Table 2. Our new results about generalised quadrangles with point-primitive collineation groups are proved in Sections 4–6. Corollary 1.5 is applied not only to actions of type HS or HC as illustrated above, but also to types SD, CD and PA. In particular, the proof of Theorem 1.1 is free from the Classification of Finite Simple Groups (CFSG) to the extent that, for G of type HC, CD or PA with socle T r × T r , T (k−1)r or T r respectively, the proof that r 6 4 depends only on Corollary 1.5. The CFSG is, however, needed to prove Proposition 1.6 and some of the results in Section 5. For type PA, the group H in Corollary 1.5 is an almost simple primitive group, so we are led to consider lower bounds on the fixity of such a group, namely the maximum number of fixed points of a non-identity element. In Section 6, we discuss how refinements of a recent result of Liebeck and Shalev [21, Theorem 4] on this problem, currently being carried out by Elisa Covato at the University of Bristol as part of her PhD research [11], can be adapted to further improve the bound r 6 4 in this case. In particular, for r ∈ {3, 4} we are able to show that T cannot be a sporadic simple group, and to rule out the case T ∼ = Altn except in one specific action when n is a prime congruent to 3 modulo 4 (see Table 1). The proof of Theorem 1.1 is presented in Section 7. Section 8 concludes the paper with a discussion and some open problems. In light of the growing body of work towards a classification of point-primitive generalised quadrangles, and the possible avenues outlined in Remark 5.11, Remark 6.4 and Section 8 for attacking the cases left open by Theorem 1.1, we feel that the following conjecture can be made with a reasonable amount of confidence. Conjecture 1.7. If a thick finite generalised quadrangle Q admits a collineation group G that acts primitively on the point set of Q, then G is either affine or almost simple. 2. Bounding the number of points fixed by a collineation The facts summarised in the following lemma are well known. (The existence of an order is proved in [27, Corollary 1.5.3], and proofs of assertions (i)–(iii) may be found in [22, Section 1.2].) SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 5 Lemma 2.1. Let Q be a thick finite generalised quadrangle. Then Q has an order (s, t), and the following properties hold: (i) Q has (s + 1)(st + 1) points and (t + 1)(st + 1) lines, (ii) s1/2 6 t 6 s2 6 t4 (Higman’s inequality), (iii) s + t divides st(st + 1). A point–line incidence geometry S = (P, L, I ) is called a grid if there exist positive integers s1 and s2 such that P can be written as {Pij | 0 6 i 6 s1 , 0 6 j 6 s2 }, L can be written as {ℓk | 0 6 k 6 s1 } ∪ {ℓ′k | 0 6 k 6 s2 }, and we have Pij I ℓk if and only if i = k, and Pij I ℓ′k if and only if j = k. Each point of S is then incident with exactly two lines, and |P| = (s1 + 1)(s2 + 1). Let us say that such a grid has parameters s1 and s2 . Note that a grid with parameters s1 = s2 is a generalised quadrangle of order (s1 , 1). A dual grid is defined analogously, by swapping the roles of points and lines. That is, there exist positive integers t1 and t2 such that L can be written as {ℓij | 0 6 i 6 t1 , 0 6 j 6 t2 }, P can be written as {Pi | 0 6 i 6 t1 } ∪ {Pj′ | 0 6 j 6 t2 }, Pk I ℓij if and only if i = k, and Pk′ I ℓij if and only if j = k. In this case, each line is incident with exactly two points, and |P| = (t1 + 1) + (t2 + 1). Let us say that such a dual grid has parameters t1 and t2 . If θ is a collineation of a generalised quadrangle Q = (P, L), then it makes sense to consider the point–line incidence geometry Qθ = (Pθ , Lθ ) with Pθ = {P ∈ P | P θ = P }, Lθ = {ℓ ∈ L | ℓθ = ℓ}, and incidence inherited from Q. Here we call Qθ the substructure of Q fixed by θ. It may happen that Qθ is a grid or a dual grid, or a generalised quadrangle. More specifically, we have the following result, based on the description of the possible structures of Qθ given by Payne and Thas [22, 2.4.1]. Lemma 2.2. Let Q = (P, L) be a thick finite generalised quadrangle of order (s, t). Let θ be a non-identity collineation of Q, and let Qθ = (Pθ , Lθ ) be the substructure of Q fixed by θ. Then at least one of the following conditions holds. (i) Pθ is empty. (ii) Lθ is empty and Pθ is a set of pairwise non-collinear points. In particular, |Pθ | 6 st + 1. (iii) All points of Qθ are incident with a common line, and |Pθ | 6 s + 1. (iv) All points of Qθ are collinear with a common point, and |Pθ | 6 s(t + 1) + 1. (v) Qθ is a grid. In this case, either |Pθ | = (s + 1)2 and s 6 t, or |Pθ | < s2 . (vi) Qθ is a dual grid, and |Pθ | 6 2(t + 1). (vii) Qθ is a thick generalised quadrangle, and |Pθ | 6 (s + 1)(t + 1). In particular, either |Pθ | 6 (s + 1)(t + 1); or s > t + 3, Qθ is a grid and |Pθ | < s2 . Proof. The possible structures (i)–(vii) of Qθ are given by [22, 2.4.1]. We verify the claimed upper bounds for |Pθ |. The bounds in cases (iii) and (iv) are immediate, because every line of Q is incident with exactly s + 1 points, and every point of Q is incident with exactly t + 1 lines. For case (ii), note [22, Section 2.7] that the maximum size of a set of pairwise non-collinear points in Q is st + 1. For (v), if Qθ is a dual grid with parameters t1 and t2 , then t1 6 t and t2 6 t, and hence |Pθ | 6 2(t + 1). Now suppose that Qθ is a grid with parameters s1 and s2 , noting that s1 6 s and s2 6 s, and assuming (without loss of generality) that s1 > s2 . If s1 = s2 = s then |Pθ | = (s + 1)2 , and Qθ is a generalised quadrangle of order (s, 1), so [22, 2.2.2(i)] implies that s 6 t. The case s2 = s − 1 cannot occur, because if θ fixes s points incident with a line then it must also fix the final point; and if s2 6 s − 2 then |Pθ | 6 (s + 1)(s − 1) < s2 . Finally, suppose that Q is a thick finite generalised quadrangle, and let (s′ , t′ ) denote its order. Then |Pθ | = (s′ + 1)(s′ t′ + 1) by Lemma 2.1(i). If t′ = t then s′ < s because θ 6= 1, so [22, 2.2.1] implies that s′ t = s′ t′ 6 s, and hence |Pθ | 6 (s/t + 1)(s + 1) 6 (t2 /t + 1)(s + 1) = (s + 1)(t + 1), where for the second inequality we use Lemma 2.1(ii). If t′ < t then the dual statement of [22, 2.2.1] yields s′ t′ 6 t, so |Pθ | = (s′ + 1)(s′ t′ + 1) 6 (s + 1)(t + 1). The final assertion is deduced by comparing the upper bounds on |Pθ | established in each case. We observe that |Pθ | 6 (s + 1)(t + 1) except possibly in the second case of (v), where our bound is |Pθ | < s2 . However, if s 6 t + 2 then in this case we have |Pθ | < s2 < (s + 1)(t + 1).  Remark 2.3. We mention a paper of Frohardt and Magaard [17, Section 1.3], in which results analogous to Lemma 2.2 are obtained for generalised d-gons with d ∈ {6, 8} (that is, generalised hexagons and octagons). The known examples of such geometries admit point- and line-primitive 6 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER actions of almost simple groups with socle 3 D4 (q) or G2 (q) (for d = 6) and 2 F4 (q) (for d = 8). Frohardt and Magaard use the aforementioned results to determine upper bounds for fixities of primitive actions of groups G with generalised Fitting subgroup 3 D4 (q), G2 (q) or 2 F4 (q) (and they also treat the other exceptional Lie type groups of Lie rank 1 or 2). By comparison, we instead apply Lemma 2.2 to determine which groups might act primitively on the points of a generalised d-gon (with d = 4 in our case). (We remark that we have also investigated point-primitive generalised hexagons and octagons, although via different methods than in the present paper [7, 18].) We now use Lemma 2.2 to prove Theorem 1.3, from which we deduce Theorem 1.2. Proof of Theorem 1.3 Let (s, t) be the order of Q, and let Qθ = (Pθ , Lθ ) be the substructure of Q fixed by θ. We must show that either |Pθ | < |P|4/5 , or (s, t) = (2, 4) and |Pθ | = 15 for Q = Q− (5, 2). First suppose that s 6= 2. By Lemma 2.2, we have either |Pθ | < s2 or |Pθ | 6 (s + 1)(t + 1). If |Pθ | < s2 then |Pθ | < |P|4/5 since |P| = (s+1)(st+1) > s2 t > s5/2 by Lemma 2.1. If |Pθ | 6 (s+1)(t+1) then it suffices to show that the function f (s, t) = ((s + 1)(st + 1))4/5 − (s + 1)(t + 1) is positive for all s > 3, for all s1/2 6 t 6 s2 . This is readily checked when s ∈ {3, 4}, so assume that s > 5. Thinking of s and t as real variables, we have (s + 1)(4s − h(s, t)) ∂f (s, t) = , ∂t h(s, t) where h(s, t) = 5((s + 1)(st + 1))1/5 . Since s and t are positive, this derivative is positive if and only if 4s − h(s, t) > 0. Since s > 5 and 2 6 11 1/5 s4/5 . Hence, 4s − h(s, t) > s4/5 (4s1/5 − 5( 33 )1/5 ). t 6 s2 , we have h(s, t) 6 5( 65 s)1/5 ( 10 st)1/5 6 5( 33 25 ) 25 4125 The right-hand side of this inequality is positive if s > ( 45 )5 ( 33 25 ) = 1024 ≈ 4.028, and so certainly ∂f 1/2 6 t 6 s2 . Since f (s, t) > f (s, s1/2 ) and f (s, s1/2 ) > 0 for s > 5, it ∂t (s, t) > 0 when s > 5 and s follows that f (s, t) > 0 for all s > 5, for all s1/2 6 t 6 s2 . Now suppose that s = 2. Then t ∈ {2, 4} by Lemma 2.1. There exist unique generalised quadrangles of orders (2, 2) and (2, 4), namely the symplectic space W(3, 2) and the elliptic quadric Q− (5, 2), respectively [22, 5.2.3 and 5.3.2]. The full collineation groups of these generalised quadrangles are PΓSp4 (2) and PΓU4 (2), respectively. One may use the package FinInG [4] in the computer algebra system GAP [14] to check that every non-identity collineation of W(3, 2) fixes at most 7 points. Since W(3, 2) has a total of 15 points and 154/5 ≈ 8.73 > 7, the claimed inequality |Pθ | < |P|4/5 holds for every non-identity collineation θ in this case. On the other hand, there exist 36 non-identity collineations of Q− (5, 2) that fix 15 points, but the total number of points of Q− (5, 2) is 27 and 274/5 ≈ 13.97 < 15. We also remark that the substructure fixed by such a collineation is, in fact, a generalised quadrangle of order (2, 2). Every other non-identity collineation of Q− (5, 2) fixes at most 9 points.  Proof of Theorem 1.2. Since the action of H1 on Ω1 is not semiregular, there exists h1 ∈ H1 \ {1} fixing at least one point of Ω1 . Let f1 be the number of points of Ω1 fixed by h1 . Let θ = (h1 , 1, . . . , 1) ∈ N , and let f be the number of points of Q fixed by θ. If Q r = 1 then Theorem 1.3Qimplies that f1 = f < |P|4/5 = |Ω1 |4/5 . If r > 2 then Theorem 1.3 gives f1 ri=2 |Ωi | = f < |P|4/5 = ( ri=1 |Ωi |)4/5 , Q Q so f1 ( ri=2 |Ωi |)1/5 < |Ω1 |4/5 . Since ( ri=2 |Ωi |)1/5 > |Ω1 |(r−1)/5 , it follows that f1 < |Ω1 |1−r/5 . In particular, 1 − r/5 > 0 because f1 > 1, and so r 6 4.  We also use Lemma 2.2 to sharpen the 4/5 exponent bound in Theorem 1.3 in some special cases. The proofs are just modifications of the proof of Theorem 1.3, but since the details are somewhat tedious to check, we include them in Appendix A to save the reader having to reproduce them. We also remark that the exponent 94/125 = 0.752 in case (i) of Proposition 2.5 could be changed to 3/4+ǫ for any ǫ > 0 at the expense of increasing the upper bound on s in case (ii), but that this would not have been useful for our arguments in Section 5. Proposition 2.4. Let Q = (P, L) be a finite generalised quadrangle of order (s, t), let θ be any non-identity collineation of Q, and let Qθ = (Pθ , Lθ ) be the substructure of Q fixed by θ. Then either (i) |Pθ | < |P|7/9 , (ii) s ∈ {2, 3}, t = s2 and Qθ is a generalised quadrangle of order (s, s), or (iii) s > t + 3, Qθ is a grid and |Pθ | < s2 . SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 7 Proposition 2.5. Let Q = (P, L) be a finite generalised quadrangle of order (s, t), let θ be any non-identity collineation of Q, and let Qθ = (Pθ , Lθ ) be the substructure of Q fixed by θ. Then either (i) |Pθ | < |P|94/125 , (ii) s < 2.9701 × 1015 , or (iii) s > t + 3, Qθ is a grid and |Pθ | < s2 . Proposition 2.6. Let Q = (P, L) be a finite generalised quadrangle of order (s, t), let θ be any non-identity collineation of Q, and let Pθ denote the set of points fixed by θ. Suppose that t = s + 2. Then |Pθ | < |P|7/9 if s > 3, and |Pθ | < |P|13/18 if s > 5. 3. Centraliser orders in non-Abelian finite simple groups Here we verify a series of lemmas about centraliser orders in non-Abelian finite simple groups, from which Proposition 1.6 is deduced. Specifically, we need to know which non-Abelian finite simple groups T contain non-identity elements x with ‘large’ centralisers, in the sense that |CT (x)| > |T |1−r/5 for r equal to one of 1, 2 or 3. This question is readily and exactly answered for alternating groups and sporadic simple groups in the following two lemmas. Note that we treat the Tits group 2 F4 (2)′ in Lemma 3.2 along with the sporadic groups. Lemma 3.1. Let T ∼ = Altn with n > 5. Then 4/5 (i) |CT (x)| < |T | for all x ∈ T \ {1} if and only if n 6 18, (ii) |CT (x)| < |T |3/5 for all x ∈ T \ {1} if and only if n 6 9, (iii) |CT (x)| < |T |2/5 for all x ∈ T \ {1} if and only if n 6 6. Proof. If n > 19 and x ∈ T is a 3-cycle, then |CT (x)| = 23 (n − 3)! > ( 12 n!)4/5 = |T |4/5 . The remaining assertions are readily verified using GAP [14].  Lemma 3.2. Let T be either (i) |CT (x)| < |T |4/5 for all (ii) |CT (x)| < |T |3/5 for all (iii) |CT (x)| < |T |2/5 for all a sporadic finite simple group or the Tits group 2 F4 (2)′ . Then x ∈ T \ {1}, x ∈ T \ {1} if and only if T ∼ 6 Suz, Co2 , Fi22 , Fi23 , B or M, = x ∈ T \ {1} if and only if T ∼ = J1 . Proof. This is readily verified upon checking maximal centraliser orders in the ATLAS [10].  Next we consider the exceptional Lie type groups, namely those of type E8 , E7 , Eε6 (where ε = ±), F4 , 2 F4 , G2 , 2 G2 , 3 D4 or 2 B2 . Note that we make no attempt to check the converse of assertion (i) (although this could be done using standard references including those cited here). Lemma 3.3. Let T be a finite simple group of exceptional Lie type. (i) If T has type E8 , E7 , Eε6 , F4 or 3 D4 , then there exists x ∈ T \ {1} with |CT (x)| > |T |3/5 . (ii) |CT (x)| < |T |2/5 for all x ∈ T \ {1} if and only if T has type 2 B2 . Proof. (i) For T ∼ = E8 (q), F4 (q) or 3 D4 (q), take x ∈ T to be a unipotent element of type A1 in the sense of [20, Tables 22.2.1 and 22.2.4] and [23], respectively. Then |CT (x)| = q 57 |E7 (q)|, q 15 |C3 (q)| or q 12 (q 6 − 1), respectively, and it is readily checked that |CT (x)| > |T |3/5 in each case. Now suppose that T ∼ = E7 (q) or Eε6 (q), and write G := Inndiag(T ). Take x ∈ T to be a unipotent element of type A1 in the sense of [20, Tables 22.2.2 and 22.2.3], respectively. Then xT = xG by [9, Corollary 17.10], so |CT (x)| = |CG (x)|/|G : T | = q 33 |D6 (q)|/ gcd(2, q − 1) or q 21 |Aε5 (q)|/ gcd(3, q − ε), respectively, and again one can check that |CT (x)| > |T |3/5 in each case. (ii) If T ∼ = 2 B2 (q) then |CT (x)| 6 q 2 < (q 2 (q 2 + 1)(q − 1))2/5 = |T |2/5 for all x ∈ T \ {1} [24]. It remains to check that |CT (x)| > |T |2/5 for some x ∈ T \ {1} when T has type 2 F4 , G2 or 2 G2 . In these respective cases, take x to be a unipotent element of type (Ã1 )2 , A1 or (Ã1 )3 in the sense of [20, Tables 22.2.5–22.2.7], so that |CT (x)| = q 10 |2 B2 (q)|, q 5 |A1 (q)| or q 3 .  Finally, we consider the finite simple classical groups. Again, we do not check the converses of assertions (i) or (ii), remarking only that one could do so using the monograph [9] of Burness and Giuidici, where the conjugacy classes of elements of prime order in these groups are classified. 8 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER Lemma 3.4. Let T be a finite simple classical group. (i) If T has type Aεn , Dn or 2 Dn with n > 9, or type Bn or Cn with n > 5, then there exists x ∈ T \ {1} with |CT (x)| > |T |4/5 . (ii) If T has type Aεn with n > 4, type Bn or Cn with n > 3, or type Dn or 2 Dn with n > 4, then there exists x ∈ T \ {1} with |CT (x)| > |T |3/5 . (iii) |CT (x)| < |T |2/5 for all x ∈ T \ {1} if and only if T ∼ = PSL2 (q) with q 6= 7. Proof. Throughout the proof, we write q = pf with p a prime and f > 1. First suppose that T has type A1 . That is, T ∼ = PSL2 (q), with q > 4. The smallest non-trivial conjugacy class of T has size 1 2 q(q − 1), 2 (q − 1) or 12 q(q − 1) according as whether p = 2, q ≡ 1 (mod 4) or q ≡ 3 (mod 4). Hence, every non-trivial conjugacy class of T has size greater than |T |3/5 if and only if q 6= 7. Equivalently, |CT (x)| < |T |2/5 for all x ∈ T \ {1} if and only if q 6= 7. Now suppose that T has type Aεn with n > 2. That is, T ∼ = PSLεn+1 (q) (where L+ := L, L− := U). ε Let x ∈ G := PGLn+1 (q) be an element of order p with one Jordan block of size 2 and n − 1 Jordan blocks of size 1. That is, a1 = n − 1, a2 = 1 and a3 = · · · = ap = 0 in the notation of [9, Section 3.2.3]. Then x ∈ T , and xT = xG by [9, Propositions 3.2.7 and 3.3.10], so by [9, Tables B.3 and B.4] we have |CT (x)| = |CG (x)|/|G : T | = d1 |CG (x)| = 1d q 2n−1 |GLεn−1 (q)|, where d := gcd(n + 1, q − ε). Therefore, (1) n−1 n+1 1 n(n+1)/2 Y i 1 n(n+1)/2 Y i i (q − ε ) and |T | = q (q − εi ). |CT (x)| = q d d i=1 i=2 For n ∈ {2, 3} we must show that |CT (x)| > If n = 2 then d 6 3, so |CT (x)| > 13 q 3 (q − ε) while |T | 6 q 3 (q 2 − ε2 )(q 3 − ε3 ). This implies that |CT (x)| > |T |2/5 for all q > 7, and one may check directly that this inequality also holds for q < 7. If n = 3 then d 6 4, so |CT (x)| > 41 q 6 (q − ε)(q 2 − ε2 ) while |T | 6 q 6 (q 2 − ε2 )(q 3 − ε3 )(q 4 − ε4 ). This implies that |CT (x)| > |T |2/5 for all q > 3, and a direct calculation shows that this inequality also holds for q = 2. Now suppose that 4 6 n 6 8. We must show that |CT (x)| > |T |3/5 . Since q > 2, (1) gives 2 1  3 n n2 +2n 1 qn q , and |T | 6 |CT (x)| > d 2n−1 d 2 |T |2/5 . 2 and so it suffices to show that q 2n −6n > d2 22n−5 33n . Indeed, since d 6 n + 1, it suffices to show that 2 q 2n −6n > (n + 1)2 22n−5 33n . This inequality holds for all q > 2 if n ∈ {7, 8}, for all q > 3 if n = 6, for all q > 4 if n = 5, and for all q > 11 if n = 4. In the remaining cases, where (n, q) = (6, 2), (5, 2), (5, 3) or (4, q) with q < 11, one may check directly that |CT (x)| > |T |3/5 . It remains to show that |CT (x)| > |T |4/5 for all q > 2 when n > 9. If q > 3 then (1) gives 1  4 n n2 +2n 1  2 n−1 n2 and |T | 6 q q , |CT (x)| > d 3 d 3 2 so it suffices to show that q n −8n > d · 23n+5 3n−5 . Indeed, since d 6 n + 1, we can just show that 2 q n −8n > (n + 1)23n+5 3n−5 . This inequality holds for all q > 3 if n > 11; if n = 10, it holds for all q > 5, and if n = 9, it holds for all q > 29. For n = 10 with 2 6 q < 5 and n = 9 with 2 6 q < 29, one may check directly that |CT (x)| > |T |4/5 . Finally, we must check that |CT (x)| > |T |4/5 when q = 2 255 i i and n > 9. Since n > 9, and since 256 q 6 q i − ε 6 257 256 q for i > 8, (1) gives 7 |CT (x)| > 1  255 n−8 n2 −28 Y i (q − 1) and q d 256 i=1 7 |T | 6 1  257 n−8 n2 +2n−27 Y i (q − 1). q d 256 i=2 Noting also that d 6 3, we see that it suffices to show that 2n 2 −8n−32 2555n−40 7 Y i=2 (q i − 1) > 3 · 256n−8 2574n−32 . This inequality holds for all n > 9, and so the proof of the Aεn case is complete. Next, suppose that T has type Cn , where n > 2. That is, T ∼ = PSp2n (q). Write G := PGSp2n (q), noting that |G : T | = gcd(2, q − 1). If p > 2, take x ∈ G of order p with one Jordan block of size 2 and SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 9 2(n − 1) Jordan blocks of size 1. That is, a1 = 2(n − 1), a2 = 1 and a3 = · · · = ap = 0 in the notation of [9, Section 3.4.3]. Then x ∈ T , and by [9, Proposition 3.4.12], xG splits into two T -conjugacy classes and hence |CT (x)| = 2|CG (x)|/|G : T | = 12 q 2n−1 |Sp2(n−1) (q)|. If p = 2 then T = G and we take x to be an involution of type b1 as in [9, Table 3.4.1], so that |CT (x)| = q 2n−1 |Sp2(n−1) (q)|. Hence, for every p, we have n−1 1 n2 Y 2i (q − 1) and |CT (x)| = q d (2) i=1 n 1 2 Y 2i |T | = q n (q − 1), d i=1 1 4 2 2 q (q − 1) and |T | 6 q 4 (q 2 − 1)(q 4 − 1), where d = gcd(2, q − 1) 6 2. If n = 2 then |CT (x)| > and it follows that |CT (x)| > |T |2/5 for all q > 2. Similarly, for n ∈ {3, 4} one may check that |CT (x)| > |T |3/5 for all q > 2. Now suppose that n > 5. Since q 2i > 4, we have q 2i − 1 > 34 q 2i for all 2 2 i > 1, and so |CT (x)| > 21 ( 43 )n−1 q 2n −n , while |T | < q 2n +n . Hence, to show that |CT (x)| > |T |4/5 , it 2 suffices to show that ( 34 )5n−5 q 2n −9n > 2. This inequality holds for all q > 2 when n > 6, and for all q > 4 when n = 5; for (n, q) = (5, 2) and (5, 3), one may check directly that |CT (x)| > |T |4/5 . Now suppose that T has type Bn , where n > 2. That is, T ∼ = Ω2n+1 (q) with q odd. For q ≡ 1 or 3 (mod 4), let x ∈ G := PGO2n+1 (q) be an involution of type tn or t′n , respectively, in the sense of [9, Sections 3.5.2.1 and 3.5.2.2]. Then x ∈ T and xT = xG , so |CT (x)| = |CG (x)|/|G : T | = 21 |CG (x)| = |SO± 2n (q)| by [9, Table B.8]. Now, n |SO± 2n (q)| = q (3) 2 −n (q n ∓ 1) n−1 Y i=1 (q 2i − 1) > n−1 1 n2 Y 2i (q − 1), q 2 i=1 and the right-hand side above is the value of |CT (x)| that we obtained in the Cn case. Since |Ω2n+1 (q)| = |PSp2n (q)|, we therefore reach the same conclusions as for type Cn . Now suppose that T has type Dεn , namely T ∼ = PΩε2n (q) with n > 4. Let G := Inndiag(PΩε2n (q)), as defined on [9, p. 56]. Assume first that p > 2, noting that |G : T | divides 4. Take x ∈ G of order p with one Jordan block of size 2(n − 2) and two Jordan blocks of size 2. That is, a1 = 2(n − 2), a2 = 2 and a3 = · · · = ap = 0 in the notation of [9, Section 3.5.3]. Then x ∈ T , and [9, Propositions 3.5.14(i) and (ii,b)] imply that xT = xG . Therefore, [9, Table B.12] gives |CT (x)| = |CG (x)|/|G : T | > 1 4n−7 1 1 |Oε2(n−2) (q)||Sp2 (q)|, where the value of ε1 = ± depends on n and q as described 4 |CG (x)| = 8 q 1 there. Multiplying the inequality in (3) by 2 to get a lower bound for |Oε2(n−2) (q)|, it follows that n−3 (4) Y 1 2 |CT (x)| > q n −2 (q 2 − 1) (q 2i − 1), 8 i=1 where d = (5) gcd(4, q n − ε). Since q 2i n−1 Y 1 while |T | = q n(n−1) (q n − ε) (q 2i − 1), d i=1 qn 34 > 9 for all i > 1, and in particular > = 81, we have   82 2 1 8 n−2 2n2 −5n+6 q and |T | < q 2n −n . |CT (x)| > 8 9 81 2 For 4 6 n 6 8 we need |CT (x)| > |T |3/5 , so by (5) it suffices to show that ( 98 )5n−10 q 4n −22n+30 > 82 3 ) , which holds unless (n, q) = (4, 3) or (4, 5). For (n, q) = (4, 5), (4) implies that |CT (x)| > |T |3/5 ; 85 ( 81 for (n, q) = (4, 3), a GAP [14] calculation shows that there exist elements x ∈ T \ {1} for which this inequality holds. For n > 9 we claim that |CT (x)| > |T |4/5 , and we now have q n > 39 = 19683, so we 82 8 5n−10 2n2 −21n+30 19684 4 can replace the 81 in (5) by 19684 q > 85 ( 19683 ) . 19683 to see that it suffices to show that ( 9 ) If n > 10 then this inequality holds for all q > 3, and if n = 9 then it holds for q > 127. For n = 9 and Qn−3 2i 2 (q − 1), which q < 127, using the equality in (3) we obtain |CT (x)| > 14 q n −n (q n−2 − 1)(q 2 − 1) i=1 4/5 implies that |CT (x)| > |T | except when q = 3 and ε = +. However, in this case we have |G : T | = 2 (compare [9, Figure 2.5.1 and Lemma 2.2.9], noting that the discriminant of a hyperbolic quadratic form on F2n q with (n, q) = (9, 3) is ⊠, in the notation used there, because n(q − 1)/4 = 9 is odd), so 1 the 4 in the above estimate for |CT (x)| may be replaced by 21 , and we again obtain |CT (x)| > |T |4/5 . Finally, suppose that T ∼ = PΩε2n (q) with q even, noting that T = G in this case. Take x ∈ G to be an involution of type a2 as in [9, Table 3.5.1]. Then |CT (x)| = q 4n−7 |Ωε2(n−2) (q)||Sp2 (q)| and 10 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER gcd(4, q n − ε) = 1, so instead of (4) we have n−3 (6) Y 1 2 |CT (x)| > q n −2 (q 2 − 1) (q 2i − 1) 4 i=1 and |T | = q n(n−1) n (q − ε) n−1 Y i=1 (q 2i − 1). 1 4 (In the bound for |CT (x)| we drop a factor of because |G : T | = 1 for q even, but pick up a factor of 21 because Ωε2(n−2) (q) has index 2 in SOε2(n−2) (q).) For 4 6 n 6 8 we need |CT (x)| > |T |3/5 . Since 2 3 q i > 2 for all i > 1, and in particular q n > 16, it suffices to show that ( 34 )5n−10 q 4n −22n+30 > 45 ( 17 16 ) . This inequality holds unless (n, q) = (4, 2) or (4, 4), in which cases a direct calculation shows that |CT (x)| > |T |3/5 . For n > 9 we must show that |CT (x)| > |T |4/5 . We now have q n > 512, and so 2 4 it suffices to show that ( 43 )5n−10 q 2n −21n+30 > 45 ( 513 512 ) . This inequality holds unless (n, q) = (10, 2) or n = 9 and q 6 28 . One may use (6) to check that |CT (x)| > |T |4/5 in each of these cases except (n, q) = (9, 2), in which case the desired inequality may be verified by a direct calculation.  4. Quasiprimitive point actions of type SD or CD We now apply Corollary 1.5 to permutation groups N that arise as subgroups of certain types of primitive groups. In some cases, we are also able to treat quasiprimitive groups, namely those in which every non-trivial normal subgroup is transitive. In this section, we consider the case where the group N in Corollary 1.5 has a ‘diagonal’ action. Specifically, we work under the following hypothesis. Hypothesis 4.1. Let T be a non-Abelian finite simple group, let k > 2, and write H = T k . Let Ω = {(y1 , . . . , yk−1 , 1) | y1 , . . . , yk−1 ∈ T } 6 H, and let H act on Ω by (7) −1 (y1 , . . . , yk−1 , 1)(x1 ,...,xk ) = (x−1 k y1 x1 , . . . , xk yk−1 xk−1 , 1). Suppose that N = H r is a collineation group of a thick finite generalised quadrangle Q = (P, L, I ) of order (s, t), such that P = Ωr and N has the product action on P. This situation arises when N is the socle of a primitive permutation group G 6 Sym(Ω) of type HS, HC, SD or CD. For type HS (respectively HC) we have k = 2 and r = 1 (respectively r > 2), G has two minimal normal subgroups, each isomorphic to T r , and the socle of G is T r × T r , which is isomorphic to N . For type SD (respectively CD) we have k > 2 and r = 1 (respectively r > 2), and G has a unique minimal normal subgroup, isomorphic to T kr ∼ = N . Note that the notation k and r is consistent with that of Table 1. Of course, G must (usually) satisfy certain other conditions [19, Section 6] in order to actually be primitive, but these conditions are not needed for the proof of Proposition 4.2. It suffices that there is a subgroup of the form N . In particular, we are also able to treat quasiprimitive groups [19, Section 12], because the (action of the) socle of G is the same as in the respective primitive types. (Note that a quasiprimitive group of type HS or HC is necessarily primitive, but a quasiprimitive group of type SD or CD need not be primitive.) Proposition 4.2 shows, in particular, that the parameter r in Hypothesis 4.1 can be at most 3. As illustrated after Corollary 1.5, the proof relies on the information about centraliser orders in nonAbelian finite simple groups given in Proposition 1.6. We also observe that when r = 3, there always exists a solution (s, t) = (|Ω| − 1, |Ω| + 1) of the equation |Ω|3 = |Ω|r = |P| = (s + 1)(st + 1), and this solution satisfies properties (ii) and (iii) of Lemma 2.1. Hence, although we are unable to rule out the case r = 3 completely, we verify that this ‘obvious’ situation cannot occur. Proposition 4.2. If Hypothesis 4.1 holds then r 6 3 and |CT (x)| < |T |1−r/5 for all x ∈ T \ {1}, and in particular T must appear in Table 2. Moreover, if r = 3 then (s, t) 6= (|Ω| − 1, |Ω| + 1). Proof. Note first that |P| = |Ω|r = |T |(k−1)r . In particular, the excluded case (s, t) = (2, 4) in Corollary 1.5 does not arise, because |P| > |T | > |Alt5 | = 60 > (2 + 1)(2 · 4 + 1). If we take x := x1 = · · · = xk 6= 1 in (7), then (y1 , . . . , yk−1 , 1) ∈ Ω is fixed if and only if y1 , . . . , yk−1 ∈ CT (x). That is, (x, . . . , x) ∈ H fixes precisely |CT (x)|k−1 elements of Ω (and, in particular, the action of H on Ω is not semiregular). Corollary 1.5 therefore implies that r 6 4 and |CT (x)|k−1 < |Ω|1−r/5 = |T |(k−1)(1−r/5) , namely |CT (x)| < |T |1−r/5 , for all x ∈ T \ {1}. If r = 4 then we have a contradiction because every non-Abelian finite simple group T contains a non-identity element x with |CT (x)| > |T |1/5 . For SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 11 example, it is well known that every non-Abelian finite simple group T contains an involution x with |CT (x)| > |T |1/3 (in fact, every involution has this property [21, Proposition 2.4]). Therefore, r 6 3. In particular, Proposition 1.6 tells us that T must be one of the groups appearing in Table 2. To prove the final assertion, suppose towards a contradiction that r = 3 and (s, t) = (|Ω| − 1, |Ω| + 1). Take any x ∈ T with |CT (x)| > |T |1/3 . Then ((x, . . . , x), (1, . . . , 1), (1, . . . , 1)) ∈ H r = H 3 = N fixes |CT (x)|k−1 |T |2(k−1) > |T |7(k−1)/3 = |P|7/9 points of Q, contradicting Proposition 2.6.  The following immediate consequence of Proposition 4.2 (and the preceding observations) implies the SD and CD cases of Theorem 1.1. Proposition 4.3. Let Q = (P, L) be a thick finite generalised quadrangle admitting a collineation group G that acts quasiprimitively of type SD or CD on P. Then the conditions in Table 1 hold. 5. Primitive point actions of type HS or HC We now consider the case where k = 2 in Hypothesis 4.1 in more detail. As explained above, this case arises when N is the socle of a primitive permutation group G 6 Sym(Ω) of type HS (r = 1) or HC (r > 2). When k = 2 it is natural to simplify the notation of Hypothesis 4.1 by identifying the set Ω with T r , so we first re-cast the hypothesis in this way and also establish some further notation. (8) Hypothesis 5.1. Let T be a non-Abelian finite simple group and let N = T r × T r act on T r by y (u1 ,u2 ) = u−1 2 yu1 . Let M = {(u, 1) | u ∈ T r } 6 N , so that M may be identified with T r acting regularly on itself by right multiplication. Suppose that N is a collineation group of a thick finite generalised quadrangle Q = (P, L, I ) of order (s, t) with P = T r . Let P1 ⊂ P denote the set of points collinear with but not equal to the identity element 1 ∈ T r = P, and let L1 ⊂ L denote the set of lines incident with 1. Given a line ℓ ∈ L, let ℓ̄ ⊂ P denote the set of points incident with ℓ. The following lemma may essentially be deduced from [26, Lemma 10] upon observing that the assumption gcd(s, t) > 1 imposed there is not necessary (as far as we can tell, and at least not in our more restrictive setting). We include a proof to make it clear that we do not need to make this assumption. Our notation differs from that of [26, p. 654] as follows: the point-regular group G is our M∼ = T r , and the point O is our point 1, so that ∆ is our P1 \ {1}. Lemma 5.2. Suppose that Hypothesis 5.1 holds. Let x ∈ P1 \ {1}, and let ℓx be the unique line in r L1 incident with x. Then, for every i ∈ {1, . . . , |x| − 1}, the conjugacy class (xi )T is contained in P1 . Moreover, the collineation (x, 1) ∈ M fixes ℓx . Proof. Let us first establish some notation. Given u ∈ T r = P, write fixP (u) = {P ∈ P | P (u,1) = P }, collP (u) = {P ∈ P | P (u,1) is collinear with but not equal to P }, fixL (u) = {ℓ ∈ L | ℓ(u,1) = ℓ}, concL (u) = {ℓ ∈ L | ℓ(u,1) is concurrent with but not equal to ℓ}. Since the subgroup M = {(u, 1) | u ∈ T r } of N acts regularly on P, fixP (u) is empty. Moreover, −1 −1 P ∈ collP (u) if and only if P (P ,1) = 1 and (P u)(P ,1) = P uP −1 are collinear, which is if and only r if P uP −1 ∈ uT ∩ P1 . Since for g, h ∈ T r we have gug−1 = huh−1 if and only if g−1 h ∈ CT r (u), it follows that r | collP (u)| = |uT ∩ P1 ||CT r (u)|, as in the proof of [26, Lemma 3]. Then (again, as in that proof) [22, 1.9.2] implies that (9) r | collP (u)| = (s + 1)| fixL (u)| + | concL (u)| = |uT ∩ P1 ||CT r (u)| (for every u ∈ T r ). Now, since x ∈ P1 , we have u−1 xu = x(u,u) ∈ P1 for every collineation of the form (u, u) ∈ N , because such collineations (are precisely those that) fix the point 1. That is, every T r -conjugate of x r r is in P1 . In other words, xT ∩ P1 = xT , and so (9) implies that (10) r | collP (x)| = (s + 1)| fixL (x)| + | concL (x)| = |xT ||CT r (x)| = |T r | = |P| = (s + 1)(st + 1). 12 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER In particular, we have collP (x) = P; that is, every point of Q is mapped to a collinear point under the collineation (x, 1) ∈ M . We now claim that concL (x) is empty. If not, then some line ℓ is concurrent with its image under the collineation (x, 1). Let P denote the unique point incident with both ℓ and ℓ(x,1) . Then P x−1 is incident with ℓ, being the image of P under the collineation (x, 1)−1 = (x−1 , 1), and P x−1 6= P because x 6= 1 and M acts regularly on P. Since Q is thick, there exists a third (x,1) point P3 incident with ℓ, distinct from P and P x−1 . Since collP (x) = P, the points P3 = P3 x and P3 are collinear. Moreover, P3 x is collinear with P , because both of these points are incident with ℓ(x,1) . Therefore, P3 x is collinear with two distinct points that are incident with ℓ, namely P3 and P , and so P3 x is itself incident with ℓ because Q contains no triangles. This, however, means that P3 x is incident with both ℓ and ℓ(x,1) , which forces P3 x = P and hence P3 = P x−1 , a contradiction. Therefore, | concL (x)| = 0 as claimed, and so (10) implies that (11) r | fixL (x)| = st + 1. Next, we show that (xi )T ⊆ P1 for all i ∈ {1, . . . , |x| − 1}. For each such i, we certainly have fixL (x) ⊆ fixL (xi ), because if the collineation (x, 1) fixes a line then so too does (x, 1)i = (xi , 1). In particular, | fixL (xi )| > | fixL (x)| = st + 1, by (11). On the other hand, no two lines fixed by (xi , 1) can be concurrent, because if they were, then the unique point incident with both lines would be fixed by (xi , 1), a contradiction since M acts regularly on P. Hence, the total number of points that are incident with some line in fixL (xi ) is (s + 1)| fixL (xi )|. As this number cannot exceed |P| = (s + 1)(st + 1), we must also have | fixL (xi )| 6 st + 1. Therefore, | fixL (xi )| = st + 1. Now (9) implies, on the one hand, that | collP (xi )| = (s + 1)| fixL (xi )| + | concL (xi )| = |P| + | concL (xi )|. Since | collP (xi )| 6 |P|, this implies that | concL (xi )| = 0, and then in turn that |P| = | collP (xi )|. r Appealing again to (9), we now deduce that |(xi )T ∩ P1 ||CT r (xi )| = |P| = |T r |, which implies that r (xi )T ⊆ P1 as required. The first assertion is therefore proved. Finally, we must show that the collineation (x, 1) fixes the unique line ℓx ∈ L1 incident with x. If |x| = 2, then (x, 1) fixes ℓx because it fixes setwise the subset {1, x} of points incident with ℓx . That is, it maps 1 to 1(x,1) = 1x = x and x to x(x,1) = x2 = 1. Now suppose that |x| > 2. Then the point 2 1(x,1) = x2 6= 1 is collinear with x because x is collinear with 1. On the other hand, (x2 )Tr ⊆ P1 by the first assertion, so in particular x2 is collinear with 1. Therefore, x2 is collinear with two distinct points incident with ℓx (namely 1 and x), and so is itself incident with ℓx because Q contains no triangles. Hence, (x, 1) fixes ℓx because it maps two points incident with ℓx , namely 1 and x, to another two points incident with ℓx , namely x and x2 .  Hypothesis 5.1 imposes the following restrictions on the points and lines incident with the identity element of T r = P, and on the order (s, t) of Q. Lemma 5.3. The following assertions hold under Hypothesis 5.1. (i) P1 is a union of T r -conjugacy classes. (ii) Every line ℓ ∈ L1 has the property that ℓ̄ is a subgroup of T r . Specifically, ℓ̄ = {u ∈ T r | (u, 1) ∈ M fixes ℓ}. (iii) Every line ℓ ∈ L1 is incident with an involution. (iv) If some line in L1 is incident with representatives of every T r -conjugacy class of involutions in P1 , then N acts transitively on the flags of Q and r > 2. (v) T r has at least three conjugacy classes of involutions. (vi) If T r has exactly three conjugacy classes of involutions, then either P1 contains exactly two of these classes, or N acts transitively on the flags of Q and r > 2. (vii) gcd(s, t) = 1 and t > s + 1. Proof. (i) This follows immediately from Lemma 5.2. (ii) If u ∈ ℓ̄ then the collineation (u, 1) ∈ M fixes ℓ by Lemma 5.2. Conversely, if (u, 1) fixes ℓ then, because 1 ∈ P is incident with ℓ, so too is 1(u,1) = u; that is, u ∈ ℓ̄. SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 13 (iii) If ℓ ∈ L1 is not incident with any involution, then ℓ̄, which is a subgroup of T r by (ii), must have odd order. That is, s + 1 = |ℓ̄| must be odd. However, (s + 1)(st + 1) = |T |r is even by the Feit–Thompson Theorem [13], so s must be odd and hence s + 1 must be even, a contradiction. (iv) If ℓ ∈ L1 is incident with representatives of every conjugacy class of involutions in P1 , then ℓ can be mapped to any other line in L1 by some element of the stabiliser N1 = {(u, u) | u ∈ T r } in N of the point 1 ∈ P = T r . Since N acts transitively on P, this means that N acts transitively on the flags of Q. If r = 1, this contradicts the main result of our earlier paper [8, Theorem 1.1], so r > 2. (v) Suppose towards a contradiction that T r contains at most two conjugacy classes of involutions. Then r = 1, because if r > 2 then any involution x ∈ T gives rise to the three pairwise non-conjugate involutions (x, 1, . . . , 1), (1, x, 1, . . . , 1) and (x, x, 1, . . . , 1) in T r . Hence, by (iii), T must have exactly two conjugacy classes of involutions, say xT and y T , and both must be contained in P1 . Without loss of generality, x and y commute, because at least one of them centralises a Sylow 2-subgroup of T . Therefore, xy is an involution, and so must be collinear with 1 ∈ P. Since 1 is collinear with x, the images of 1 and x under the collineation (y, 1) ∈ M are collinear. That is, 1(y,1) = y is collinear with x(y,1) = xy. Similarly, 1 and y are collinear, and hence so too are 1(x,1) = x and y (x,1) = yx = xy. Since the involution xy is also collinear with 1 and Q contains no triangles, the points 1, x, y and xy must be incident with a common line. In particular, x and y are incident with a common line in L1 . Since r = 1, this contradicts (iv). (vi) Let x, y and z denote representatives of the three T r -conjugacy classes of involutions. If P1 contains exactly one of these classes, then N acts flag-transitively by (iv), and it follows from [8, Theorem 1.1] that r > 2. Now suppose that P1 contains all three of xT , y T and z T . Without loss of generality, x centralises a Sylow 2-subgroup of T r and both y and z commute with x, so xy = yx and xz = zx are involutions. Arguing as in the proof of (iii), we deduce that 1, x, y and xy are incident with a common line ℓ ∈ L1 . Replacing y by z in this argument, we see that z is also incident with ℓ, so (iv) again implies that N acts flag-transitively (and it follows as above that r > 2). (vii) If gcd(s, t) > 1 then [26, Lemma 6(i)] implies that every T r -conjugacy class intersects P1 . However, assertion (i) then implies that P1 = P, which is impossible. Therefore, gcd(s, t) = 1. In particular, to show that t > s + 1 it suffices to show that t > s. The proof of this assertion is adapted from that of [8, Corollary 2.3]. Choose two distinct lines ℓ1 , ℓ2 ∈ L1 , so that ℓ̄1 and ℓ̄2 are subgroups of T r by (ii). For brevity, we now abuse notation slightly and identify ℓ1 and ℓ2 with ℓ̄1 and ℓ̄2 , respectively, dropping the ‘bar’ notation. Since ℓ1 is a subgroup of T r and right multiplication by any element of T r is a collineation of Q (identified with an element of M ), we have in particular that every right coset ℓ1 g2 of ℓ1 with g2 ∈ ℓ2 corresponds precisely to the set of points incident with some line of Q. Similarly, left multiplications (identified with elements of {1} × T r 6 N ) are collineations, so every left coset g1 ℓ2 of ℓ2 with g1 ∈ ℓ1 is a line of Q. Therefore, L′ = {g1 ℓ2 | g1 ∈ ℓ1 } ∪ {ℓ1 g2 | g2 ∈ ℓ2 } is a subset of L. Consider also the subset P ′ = ℓ1 ℓ2 of P = T r , and let I ′ be the restriction of I to (P ′ × L′ ) ∪ (L′ × P ′ ). If we can show that Q′ = (P ′ , L′ , I ′ ) is a generalised quadrangle of Q of order (s, 1), then [22, 2.2.2(i)] will imply that t > s. Let us first check that Q′ satisfies the generalised quadrangle axiom. Let ℓ ∈ L′ and take P ∈ P ′ not incident with ℓ. Then, since Q satisfies the generalised quadrangle axiom, there is a unique point P0 ∈ P incident with ℓ and collinear with P . Since ℓ ⊂ P ′ , we have P0 ∈ P ′ , and so Q′ also satisfies the generalised quadrangle axiom. It remains to check that Q′ has order (s, 1). Every line in L′ is incident with s + 1 points in P ′ , being a coset of either ℓ1 or ℓ2 , so it remains to show that every point in P ′ is incident with exactly two lines in L′ . Given P = g1 g2 ∈ P ′ , where g1 ∈ ℓ1 , g2 ∈ ℓ2 , each line ℓ ∈ L′ incident with P is either of the form h1 ℓ2 for some h1 ∈ ℓ1 or ℓ1 h2 for some h2 ∈ ℓ2 , and since P ∈ ℓ, we must have h1 = g1 or h2 = g2 , respectively. Therefore, P is incident with exactly two lines in L′ , namely g1 ℓ2 and ℓ1 g2 .  Proposition 4.2 restricts the possibilities for the simple group T in Hypothesis 5.1 to those listed in Table 2. The following result shows that, furthermore, T must be a Lie type group. Proposition 5.4. If Hypothesis 5.1 holds then T is a Lie type group. Proof. We have |P| = |T |r , and r ∈ {1, 2, 3} by Proposition 4.2. For each of the alternating and sporadic simple groups T in Table 2, we check computationally for solutions of |T |r = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1 (see Remark 5.5). If r = 3 then the 14 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER r T s t s(t + 1) 1 1 2 2 2 Alt7 Alt8 Alt6 M11 J1 11 19 19 89 419 19 53 341 7831 175141 220 1026 6498 697048 73384498 Table 3. Alternating and sporadic groups in the proof of Proposition 5.4. only such solutions have the form (s, t) = (|T | − 1, |T | + 1) = (|Ω| − 1, |Ω| + 1), and this contradicts the final assertion of Proposition 4.2. If r ∈ {1, 2} then the possibilities for T and (s, t) are as in Table 3. By Lemma 5.3(i), P1 is a union of T r -conjugacy classes, and so we must be able to partition |P1 | = s(t + 1) into a subset of the sizes of these classes (respecting multiplicities). When r = 1 and T ∼ = Alt7 or Alt8 , this is impossible: the non-trivial conjugacy class sizes not exceeding s(t + 1) are 70, 105 and 210 in the first case, and 105, 112 and 210 in the second (with each occurring exactly once). Similarly, if r = 2 and T ∼ = J1 , one may check computationally that there is no partition of s(t + 1), where (s, t) = (419, 175141), into non-trivial T 2 -conjugacy class sizes. Hence, it remains to consider the cases where r = 2 and T ∼ = Alt6 or M11 . Here we first determine computationally the possible partitions of s(t + 1) into non-trivial T 2 -conjugacy class sizes to obtain a list of possible partitions P1 into T 2 -conjugacy classes. Now, because the point graph of Q is a strongly regular graph in which adjacent vertices have λ := s − 1 common neighbours and non-adjacent vertices have µ := t + 1 common neighbours, P1 must be a partial difference set of T 2 with these parameters. That is, each non-identity element y ∈ T 2 must have exactly λ representations of the form y = zi zj−1 for zi , zj ∈ P1 if y ∈ P1 , and exactly µ such representations if y 6∈ P1 . A computation verifies that this condition is violated for each of the partitions of P1 determined in the previous step.  Remark 5.5. In the proof of Proposition 5.4, and at several other points in Sections 5 and 6, we need to check computationally whether certain positive integers X can be equal to the number of points of a thick finite generalised quadrangle. That is, we check for integral solutions (s, t) of the equation (s + 1)(st + 1) = X subject to the constraints s > 2, t > 2, s1/2 6 t 6 s2 6 t4 and s + t | st(st + 1) imposed by Lemma 2.1. In Section 5, X has the form |T |m for some non-Abelian finite simple group T and some m 6 3, and in Section 6 we instead have X = Y m with m 6 4 and Y the index of a maximal subgroup of an almost simple group. The above inequalities imply that s must lie between X 1/4 − 1 and X 5/2 , so it suffices to consider every integer s in this range and determine whether t = ((X − 1)/s − 1)/(s + 1) is an integer and, if so, whether s + t | st(st + 1). We remark that we found it useful to also observe that s must divide X − 1, because it turned out that X − 1 had only a very small number of divisors in many of the cases that we had to consider. We now show that r cannot equal 3, and deduce some further restrictions on T when r ∈ {1, 2}. Proposition 5.6. If Hypothesis 5.1 holds then r 6 2 and T is a Lie type group with the property that |CT (x)| < |T |1−2r/9 for all x ∈ T \ {1}. Proof. By Propositions 4.2 and 5.4, T is a Lie type group and r 6 3. We now show that |CT (x)| < |T |1−2r/9 for all x ∈ T \ {1} and deduce from this that r 6= 3. Suppose, towards a contradiction, that there exists x ∈ T \ {1} with |CT (x)| > |T |1−2r/9 . Define w = (x, 1, . . . , 1) ∈ T r and let Qθ = (Pθ , Lθ ) be the substructure of Q fixed by θ = (w, w) ∈ N1 . Then Pθ = CT (x) × T r−1 , and hence (12) |Pθ | > |T |(1−2r/9)+(r−1) = |T |7r/9 = |P|7/9 . Proposition 2.4 then says that either s > t + 3, or (s, t) ∈ {(2, 4), (3, 9)}. The first of these conditions contradicts Lemma 5.3(vii); the second implies that |T |r = (s + 1)(st + 1) ∈ {27, 112}, which is impossible because |T | > 60. Hence, every x ∈ T \ {1} must satisfy |CT (x)| < |T |1−2r/9 . For r = 3 this says that |CT (x)| < |T |1/3 for all x ∈ T \ {1}, a contradiction because we can always find some x with |CT (x)| > |T |1/3 (as noted in the proof of Proposition 4.2). Therefore, r 6 2.  SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 15 Proposition 5.6 allows us to further reduce the list of candidates for the simple group T in Hypothesis 5.1 in the remaining cases r ∈ {1, 2}. Let us first consider r = 2. Corollary 5.7. If Hypothesis 5.1 holds with r = 2 then T is of Lie type A1 , Aε2 , 2 B2 or 2 G2 . In particular, T has a unique conjugacy class of involutions. Proof. The result is verified by straightforward calculations involving the bound on centraliser orders imposed by Proposition 5.6, but we include the details in Appendix A.  We can now prove the HC case of Theorem 1.1. Theorem 5.8. If Q is a thick finite generalised quadrangle with a collineation group G that acts primitively on the point set P of Q, then the action of G on P does not have O’Nan–Scott type HC. Proof. As explained above, the socle of G is a group N = T r ×T r as in Hypothesis 5.1, for some r > 2. However, Corollary 5.7 tells us that r = 2 and that T has a unique conjugacy class of involutions. In particular, T r = T 2 has exactly three conjugacy classes of involutions, with representatives (x, 1), (1, y) and (x, y), where x and y are involutions in T . Now, [8, Theorem 1.1] says that G cannot act transitively on the flags of Q, so in particular N cannot act transitively on the flags of Q. Lemma 5.3(vi) therefore implies that P1 = T 2 must contain exactly two T 2 -conjugacy classes. Hence, without loss 2 of generality, P1 contains the class (x, 1)T . Since G acts primitively on P, it induces a subgroup of Aut(T 2 ) = Aut(T ) ≀ Sym2 that swaps the two simple direct factors of T 2 . Therefore, P1 also contains 2 2 the class (1, y)T , and so does not contain the class (x, y)T . In particular, no line ℓ ∈ L1 can be incident with both a conjugate of (x, 1) and a conjugate of (1, y), because by Lemma 5.3(ii), ℓ would then also be incident with the product of these elements, a conjugate of (x, y). Hence, L1 is partitioned into two sets of lines: those incident with conjugates of (x, 1), and those incident with conjugates of (1, y). Since G1 swaps these sets, G acts flag-transitively, in contradiction with [8, Theorem 1.1].  For r = 1 we are left with the following list of candidates for T . Corollary 5.9. Suppose that Hypothesis 5.1 holds with r = 1. Then T is of Lie type A1 , Aεn with 2 6 n 6 6, B2 , C2 , C3 , Dεn with 4 6 n 6 6, or exceptional Lie type other than E8 . Proof. By Propositions 4.2 and 5.4, T is one of the Lie type groups in the first column of Table 2. By arguing as in the proof of Proposition 5.6 but applying Proposition 2.5 instead of Proposition 2.4 in the first paragraph, we conclude that one of the following conditions must also hold: (i) every non-identity element x ∈ T satisfies |CT (x)| < |T |94/125 , or (ii) s 6 2.9701 × 1015 . By choosing appropriate elements x ∈ T as in the proofs in Section 3, we are able to use this to deduce that T does not have type Aε7 , Aε8 , B4 , C4 , Dε7 , Dε8 or E8 . We rule out E8 here as an example, and include details of the remaining cases in Appendix A. If T ∼ = E8 (q) then (s + 1)4 > |P| = |T | > |E8 (2)| ≈ 3.378 × 1074 and hence s > |E8 (2)|1/4 − 1 ≈ 4.287 × 1018 , contradicting (ii), so (i) must hold. However, as noted in the proof of Lemma 3.3, there exists x ∈ T ∼ = E8 (q) with |CT (x)| = q 57 |E7 (q)| ∼ q 190 , while |T |94/125 ∼ (q 248 )94/125 < q 187 . Indeed, one may check that |CT (x)| > |T |94/125 for all q > 2.  Finally, we use Lemma 5.3 to reduce the list of candidates for T in Corollary 5.9 to those given in the first row of Table 1, thereby proving the HS case of Theorem 1.1. Proposition 5.10. Let Q = (P, L) be a thick finite generalised quadrangle admitting a collineation group G that acts primitively of type HS on P, with socle T × T for some non-Abelian finite simple group T . Then T has Lie type Aε5 , Aε6 , B3 , C2 , C3 , Dε4 , Dε5 , Dε6 , Eε6 , E7 or F4 . Proof. We are assuming that Hypothesis 5.1 holds with r = 1, so T must be one of the groups listed in Corollary 5.9. It remains to show that, further, T cannot have Lie type A1 , Aε2 , Aε3 , Aε4 , 2 B2 , 2 G2 , 2 F , G or 3 D . This follows from Lemma 5.3(v), because in each of these cases T has at most two 4 2 4 conjugacy classes of involutions. (This may be verified using, for example, [16, Table 4.5.1] for odd characteristic and [20] for even characteristic.)  16 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER Remark 5.11. Proposition 5.10 begs the obvious question of whether we can rule out the last remaining candidates for T listed there. We are confident that we will eventually be able to do this, but it seems that it will require even more new ideas and a detailed case-by-case analysis. Of course, some of the remaining groups can be ruled out in certain cases using Lemma 5.3(v); in particular, if T has Lie type C2 , C3 , F4 or Eε6 in characteristic p, then we must have p = 2, because in odd characteristic these groups have only two conjugacy classes of involutions. When T has exactly three conjugacy classes of involutions, we can begin by applying Lemma 5.3(v) (because we know from [8] that N cannot act transitively on the flags of Q), and then the arguments in the proof of Lemma 5.3(iv– vi) can be extended to deduce some restrictions on which involutions can appear in P1 . However, even with this extra information, we have thus far been unable to completely rule out any of the remaining candidates for T . These kinds of arguments become more difficult when T has more than three conjugacy classes of involutions, and in any case, it seems that it will be necessary to treat each group individually, and to use the structure of its involution centralisers in some detail. Although not an ideal state of affairs, we therefore leave the remaining cases for a future project. 6. Primitive point actions of type PA We now apply Corollary 1.5 to the case where N is the socle of a primitive permutation group G of O’Nan–Scott type PA. The notation of Hypothesis 6.1 coincides with that of Table 1. Hypothesis 6.1. Let Q = (P, L) be a thick finite generalised quadrangle of order (s, t) admitting a collineation group G that acts primitively of type PA on P, writing T r 6 G 6 H ≀ Symr for some almost simple primitive group H 6 Sym(Ω) with socle T , where r > 2. Proposition 6.2. If Hypothesis 6.1 holds then 2 6 r 6 4 and every non-identity element of H fixes less than |Ω|1−r/5 points of Ω. Proof. The socle of G is N = T r and the action of H on Ω is not semiregular, so the result follows immediately from Corollary 1.5.  To say more than this, we would like to have generic lower bounds for the fixity f (H), namely the maximum number of fixed points of a non-identity element, of an almost simple primitive group H 6 Sym(Ω). This problem was investigated in a recent paper of Liebeck and Shalev [21], who proved that f (H) > |Ω|1/6 except in a short list of exceptions. This lower bound is not quite large enough to force further restrictions on r in Proposition 6.2, because to rule out r = 4 (as we did for types HC and CD) we would need f (H) to be at least |Ω|1/5 . However, Liebeck and Shalev remark (after [21, Theorem 4]) that their |Ω|1/6 bound could potentially be improved generically to around |Ω|1/3 , which would be sufficient for this purpose. Work in this direction is currently being undertaken by Elisa Covato at the University of Bristol as part of her PhD research [11], with the aim of classifying the almost simple primitive permutation groups H 6 Sym(Ω) containing an involution that fixes at least |Ω|4/9 points. As of this writing, the alternating and sporadic cases have been completed, and so we are able to apply these results to sharpen Proposition 6.2 as follows. Proposition a sporadic simple r ∈ {3, 4}, H = T 6.3. Suppose that Hypothesis 6.1 holds with r > 2 and T an alternating group or group, and let S 6 H denote the point stabiliser in the action of H on Ω. Then ∼ = Altp with p a prime congruent to 3 modulo 4, and S ∩ T = p. p−1 2 . Proof. Since r > 2, Proposition 6.2 tells us that r ∈ {3, 4}, and that the fixity f (H) of H must be at most |Ω|1−r/5 . If f (H) 6 |Ω|1−3/5 = |Ω|2/5 then Covato’s results [11] imply that either (i) T ∼ = Altp p−1 with p ≡ 3 (mod 4) a prime and S ∩ T = p. 2 , or (ii) H and S are in Table 4. In case (i) we can at least deal with the situation where H = Symp . Indeed, by the argument in [21, Section 6], there is an involution u ∈ S = p.(p − 1) fixing 2(p−3)/2 ( p−3 2 )! elements of Ω, which is 2/5 2/5 greater than |Ω| = (2(p − 2)!) provided that p > 7. If p = 7 then we observe that u still fixes more than |Ω|1/3 elements. This rules out r = 4, because then 1/3 > 1 − r/5 = 1/5. For r = 3 we apply Proposition 2.6. We have |Ω| = 2 · 5! = 120 and hence |P| = |Ω|3 = 1203 , and the only solution of 1203 = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1 is (s, t) = (119, 121), so Proposition 2.6 implies that every non-identity collineation of Q fixes at most SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES H Alt9 J1 J1 He He.2 Th S 2 3 : SL2 (3) 23 .7.3 7:6 72 : 2.PSL2 (7) 72 : 2.PSL2 (7).2 25 .PSL5 (2) H S J3 .2 O’N.2 M23 Th B 19.9 31.15 23.11 31.15 47.23 17 Table 4. Actions with small fixity in Proposition 6.3. |P|7/9 points. However, the collineation (u, 1, 1) ∈ G fixes more than |Ω|1/3 |Ω|2 = |P|7/9 points, a contradiction. Therefore, if we are in case (i) then we must have H = Altp , as per the assertion. Now suppose that H and S are in Table 4. First consider the six cases on the left-hand side of the table. In each of these cases, f (H) is at least |Ω|1/5 , so r = 4 is ruled out. For r = 3, we apply Proposition 2.6 as above. Since f (H) > |Ω|1/5 , we have in particular f (H) > |Ω|1/6 . Choose u ∈ H fixing at least |Ω|1/6 elements of Ω, and consider the collineation (u, 1, 1) ∈ G, which fixes at least |Ω|1/6+2 = |Ω|13/6 = |P|13/18 points of Q. Since the only solutions of |Ω|3 = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1 are those with t = s+2, Proposition 2.6 provides a contradiction. Now consider the five cases on the right-hand side of Table 4. The actions of J3 .2, O’N.2 and Th all have fixity greater than |Ω|1/6 [21, Lemma 5.3], so these are ruled out for both r = 3 and r = 4 by the same arguments as above. Now consider the action of M23 . Here |Ω| = 40320, and for r = 4 there are no solutions of |Ω|r = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1. If r = 3, the only solution is (s, t) = (40319, 40321). By [21, Lemma 5.3], we have f (H) = 5, realised by an element u of order 11, and so we can construct a collineation θ = (u, 1, 1) ∈ G of Q fixing 5|Ω|2 = 8128512000 points. However, s = t − 2 < t + 3, so the final assertion of Lemma 2.2 implies that |Pθ | 6 (s + 1)(s + 3) = 1988752683 < 8128512000, and we have a contradiction. Finally, consider the given action of B, for which |Ω| = 3843461129719173164826624000000. For r = 4 there is no admissible solution of |Ω|r = (s + 1)(st + 1). For r = 3 the only admissible solution is (s, t) = (|Ω| − 1, |Ω| + 1), and so the final assertion of Lemma 2.2 implies that any non-identity collineation of Q fixes at most (|Ω| + 1)(|Ω| + 3) points. However, [21, Lemma 5.3] tells us that f (H) = 22, so we can construct a collineation with 22|Ω|2 points to yield a contradiction.  Remark 6.4. Further improvements to Proposition 6.2 will be made in a future project. In the first instance, we hope to use Covato’s results [11] on fixities of Lie type groups (once available), to complete our treatment of the cases r = 3 and r = 4. We also note that it is straightforward to handle the case r = 2 with T a sporadic simple group, and likewise the almost simple case with sporadic socle, computationally along the lines of [3, Section 6] (but assuming only point-primitivity and not line-primitivity). However, we omit these computations from the present paper for brevity. 7. Proof of Theorem 1.1 Let us now summarise the proof of Theorem 1.1. If the primitive action of G on P has O’Nan– Scott type AS or TW, then the conditions stated in Table 1 follow immediately from Theorem 1.3. Types HS, HC and PA are treated in Proposition 5.10, Theorem 5.8 and Proposition 6.3, respectively. Types SD and CD are treated together in Proposition 4.3. 8. Discussion and open problems We feel that the results presented in this paper represent a substantial amount of progress towards the classification of point-primitive generalised quadrangles, but there is evidently still a good deal of work to do. We conclude the paper with a brief discussion, and outline some open problems that could be investigated independently and then potentially applied to our classification program. As discussed in Remark 5.11, we are confident that we will eventually be able to finish the HS case, and it is at least somewhat clear how this might be done. The SD and CD cases would appear to be 18 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER more difficult, however. The arguments used in Section 5 do not work in these cases, because the proof of Lemma 5.2 (and therefore Lemma 5.3) relies in a crucial way on having k = 2 in Hypothesis 4.1, so that conjugation by an element of the underlying point-regular group M is a collineation. We have thus far been unable to find a way to work around this difficulty in any sort of generality. On the other hand, a primitive (respectively quasiprimitive) group of type SD must induce a primitive (respectively transitive) permutation group on the set of simple direct factors of its socle T k , and it seems that it should be possible to use this extra structure to say more about the SD and CD types, at least in the primitive case (especially since we have already reduced the list of candidates for T to those in Table 1). Although we have made some preliminary investigations along these lines, we do not yet know how to finish the SD and CD cases, and so we leave this task for a future project. 8.1. Point-regular collineation groups, and a number-theoretic problem. There is, of course, a potential — but apparently extremely challenging — way to deal with all of the types HS, SD and CD, and also with type TW, in one fell swoop. In each of these cases, the full collineation group must have a point-regular subgroup of the form T m , for some m, with T a non-Abelian finite simple group. Hence, it would certainly be sufficient to show that such a group cannot act regularly on the points of a generalised quadrangle. However, this would appear to be a very difficult problem in light of the (limited) existing literature. Yoshiara [26] managed to show that a generalised quadrangle of order (s, t) with s = t2 cannot admit a point-regular group, while Ghinelli [15] considered the case where s is even and t = s, showing that such a group must have trivial centre and cannot be a Frobenius group. Beyond this, not much else seems to be known in the way of restrictions on groups that can act regularly on the points of a generalised quadrangle (though certainly many of the known generalised quadrangles admit point-regular groups [5], and the Abelian case is understood [12]). Although Yoshiara [26] has an extensive suite of lemmas that one might attempt to use to investigate (in particular) the possibility that a group of the form T n acts point-regularly on a generalised quadrangle Q, the bulk of these lemmas assume that the order (s, t) of Q satisfies gcd(s, t) 6= 1. Although this condition holds under Yoshiara’s intended assumption that s = t2 , it seems to be difficult to guarantee in general. Indeed, according to Lemma 5.3(ii) (and perhaps not surprisingly), it must fail in our HS case. On the other hand, one might seek a contradiction by examining the arithmetic nature of the equation |T |m = (s + 1)(st + 1) subject to the constraints s > 2, t > 2, s1/2 6 t 6 s2 6 t4 and s + t | st(st + 1) imposed by Lemma 2.1, and asking when it can be guaranteed that a solution must satisfy gcd(s, t) 6= 1. More generally, one might simply ask whether this equation can have any such solutions at all. This motivates the following problem. Problem 8.1. Determine for which non-Abelian finite simple groups T , and which positive integers m, there exist integral solutions (s, t) of the equation (13) |T |m = (s + 1)(st + 1) with s > 2, t > 2, s1/2 6 t 6 s2 6 t4 and s + t | st(st + 1). Failing this, determine when such a solution must satisfy gcd(s, t) 6= 1. As noted before Proposition 4.2, there is always an ‘obvious’ solution of (13) when m is divisible by 3, namely (s, t) = (|T |m/3 − 1, |T |m/3 + 1), and gcd(s, t) = 1 in this case because |T | is even. It would be useful even to know whether this is the unique solution in this particular situation. We do know that (13) has solutions for certain T when m = 1 or 2, as demonstrated by Table 3, but we do not recall encountering any solutions apart from the aforementioned ‘obvious’ ones when m > 3. Moreover, it is straightforward to run numerical computations that suggest that certain combinations of families of T and values of m will never yield a solution of (13). For example, if T ∼ = PSL2 (q) and m = 1 then there is no solution if q < 106 , but we do not see how to go about proving that there is no solution for any q. One might also ask about gearing Problem 8.1 towards the PA and AS cases, by seeking solutions of (13) with |T | replaced by |H : S| for H an almost simple group with socle T and S a maximal subgroup of H (compare Hypothesis 6.1, which reduces to the AS case if r is taken to be 1). However, solutions of (13) seem to be rather more common in this setting, and so other methods are needed to rule out cases where solutions arise. For example, if we take H = T = McL (the McLaughlin sporadic simple group) then there are five (classes of) maximal subgroups S of H for which |H : S|2 = (s + 1)(st + 1) SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 19 has an ‘admissible’ solution: four maximal subgroups of order 40320, which yield (s, t) = (296, 5644), and the maximal subgroup PSU4 (3), for which (s, t) = (24, 126). 8.2. Fixities of primitive groups of type TW. We conclude with a brief discussion of the TW case. Let N = T1 × · · · × Tr , where T1 ∼ = ··· ∼ = Tr ∼ = T for some non-Abelian finite simple group T . A primitive permutation group G 6 Sym(Ω) of type TW is a semidirect product N ⋊ P with socle N acting regularly by right mutlitplication, and P 6 Symr acting by conjugation in such a way that T1 , . . . , Tr are permuted transitively. Certain other rather complicated conditions must also hold [2], and in particular T must be a section of P . If we intend to apply Theorem 1.1 to classify the generalised quadrangles with a point-primitive collineation group of TW type, then we will need ‘good’ lower bounds for fixities of primitive TW-type groups. Liebeck and Shalev [21, Section 4] show that, for every T and r, the fixity of G is at least |T |r/3 . Although this is very far away from the 4/5 exponent bound imposed by Theorem 1.1, we would be interested to know under what conditions it could be improved to something ‘close’ to 4/5, so that we could at least rule out some of the subgeometries listed in Lemma 2.2 and then perhaps use the underlying point-regular group to say more. In [21, Section 4], Liebeck and Shalev consider an involution x ∈ P (which must exist because T is a section of P and |T | is even) and observe that x induces a permutation of {T1 , . . . , Tr } that fixes at least |T |ca+b elements of Ω ≡ T r , where the induced permutation has cycle structure (1a , 2b ) and every involution g ∈ Aut(T ) satisfies |CT (g)| > |T |c . By [21, Proposition 2.4], we can take c = 1/3 independently of T , and so because a/3+b > (r−2)/3+2/3 = r/3, it follows that x fixes at least |T |r/3 elements. Now, c can certainly be taken larger than 1/3 in at least some non-Abelian finite simple groups T (though presumably never as large as 4/5), and if we happen to have c > 1/2 then ca + b is maximised when b = 1 (else it is maximised when a = 0). Hence, roughly speaking, if c happens to be somewhat large (for a given T ) and we happen to be able to guarantee that x can be chosen with b quite small, then we might have a useful bound on the fixity of G to work with. Bounds on c can certainly be determined on a case-by-case basis from standard results about involution centralisers, but in light of the rather involved necessary and sufficient conditions for P to be a maximal subgroup of G, it is not clear to us what can be said about the cycle structure of permutations of {T1 , . . . , Tr } induced by involutions in P . We therefore pose the following (somewhat vaguely worded) problem. Problem 8.2. Under what conditions can a primitive permutation group of type TW and degree d be guaranteed to have large fixity, where by “large” we mean, say, d3/4 or more? Appendix A. Additional proofs Proof of Proposition 2.4. Suppose that we are not in case (iii). Then, by the final assertion of Lemma 2.2, we have |Pθ | 6 (s + 1)(t + 1), and we argue as in the proof of Theorem 1.3. We must show that we are either in case (ii), or that f (s, t) = ((s + 1)(st + 1))7/9 − (s + 1)(t + 1) is positive. 2/9 . If s > 13 then We have ∂f ∂t (s, t) = (s + 1)(7s − h(s, t))/h(s, t), where h(s, t) = 9((s + 1)(st + 1)) 14 2/9 27 2/9 s8/9 , and so 7s − h(s, t) > s) ( 26 st)2/9 6 9( 189 (using also 2 6 t 6 s2 ) we have h(s, t) 6 9( 13 169 ) 189 2/9 8/9 1/9 2 s (7s − 9( 169 ) ). The right-hand side is positive if and only if s > ( 79 )9 ( 189 169 ) ≈ 12.01 > 12, and so it follows that f (s, t) > 0 for all s > 13, for all s1/2 6 t 6 s2 . If 4 6 s 6 12 then a direct calculation shows that f (s, t) > 0 for all s1/2 6 t 6 s2 , so it remains to consider s ∈ {2, 3}. If s = 2 then, by the final paragraph of the proof of Theorem 1.3, either t = 2 and every non-identity collineation of Q fixes at most 7 < |P|7/9 = 157/9 ≈ 8.22 points, or t = 4 and we are in case (ii). Finally, if s = 3 then 31/2 6 t 6 32 , and a direct calculation shows that f (3, t) > 0 for 31/2 6 t 6 7. Moreover, Q cannot have order (s, t) = (3, 8) by Lemma 2.1(iii). If (s, t) = (3, 9) then Q is the elliptic quadric Q− (5, 3) [22, 5.3.2], and a FinInG [4] calculation shows that (up to conjugacy) there is a unique non-identity collineation θ fixing 40 > |P|7/9 = 1127/9 ≈ 39.25 points. Moreover, Qθ is a generalised quadrangle of order (3, 3), and every other non-identity collineation of Q fixes at most 16 < 1127/9 points.  Proof of Proposition 2.5. Suppose that we are not in case (ii) or (iii). Then |Pθ | 6 (s + 1)(t + 1) by the final assertion of Lemma 2.2. We show that f (s, t) = ((s+1)(st+1))94/125 −(s+1)(t+1) is positive. 31/125 . Let a = We have ∂f ∂t (s, t) = (s + 1)(94s − h(s, t))/h(s, t), where h(s, t) = 125((s + 1)(st + 1)) 31/125 ( 2a+1 st)31/125 6 2.9701×1015 . Then s > a, so (using also 2 6 t 6 s2 ) we have h(s, t) 6 125( a+1 a s) 2a 20 JOHN BAMBERG, TOMASZ POPIEL, CHERYL E. PRAEGER )31/125 s124/125 , and hence 94s − h(s, t) > s124/125 (94s1/125 − 125( (2a+1)(a+1) )31/125 ). The 9( (2a+1)(a+1) 2a2 2a2 125 ( (2a+1)(a+1) )31 ≈ 2.97009 × 1015 , and it follows right-hand side is positive because s > a > ( 125 94 ) 2a2 that f (s, t) > 0 for all s > a, for all s1/2 6 t 6 s2 .  Proof of Proposition 2.6. Since s = t − 2 < t + 3, the final assertion of Lemma 2.2 implies that |Pθ | 6 (s + 1)(t + 1) = (s + 1)(s + 3). The result follows upon comparing this with |P| = (s + 1)3 .  Proof of Corollary 5.7. By Propositions 4.2 and 5.4, T is one of the Lie type groups in the second column of Table 2. However, by Proposition 5.6, we must also have |CT (x)| < |T |5/9 for all x ∈ T \{1}. We use this to show that T cannot have type Aε3 , B2 = C2 , 2 F4 or G2 . If T ∼ = G2 (q) then q > 3 (because G2 (2) is not simple), |T | = q 6 (q 6 − 1)(q 2 − 1), and we can choose x ∈ T with |CT (x)| = q|A1 (q)| = q 6 (q 2 − 1)/ gcd(2, q − 1) as in the proof of Lemma 3.3(ii). If q is even or q > 19 then |CT (x)| > |T |5/9 , and if q ∈ {3, 5, 7, 9, 11, 13, 17, 19} then there is no solution of |T |2 = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1. If T ∼ = 2 F4 (q) then q = 22n+1 with n > 1 (because 2 F4 (2) is not simple and 2 F4 (2)′ was treated in Proposition 5.4), |T | = q 12 (q 6 + 1)(q 4 − 1)(q 3 + 1)(q − 1) and, as in the proof of Lemma 3.3(ii), we can choose x ∈ T with |CT (x)| = q 10 |2 B2 (q)| = q 12 (q 2 + 1)(q − 1). This yields |CT (x)| > |T |5/9 for all q. If T ∼ = PSp4 (q) ∼ = Ω5 (q) then q > 3 (because PSp2 (2) ∼ = Sym6 is not simple), |T | = 4 4 2 q (q − 1)(q − 1)/ gcd(2, q − 1), and taking x ∈ T with |CT (x)| = q 4 (q 2 − 1)/ gcd(2, q − 1) as in the proof of Lemma 3.4 yields |CT (x)| > |T |5/9 for all q > 3. Finally, if T ∼ = PSLε4 (q) (where + − 6 4 2 3 L := L and L := U), then |T | = q (q − 1)(q − 1)(q − ε)/ gcd(4, q − ε) and we can choose x ∈ T with |CT (x)| = q 5 |GLε2 (q)|/ gcd(4, q − ε) = q 6 (q 2 − 1)(q − ε)/ gcd(4, q − ε) as in the proof of Lemma 3.4. This yields |CT (x)| > |T |5/9 unless ǫ = + and q = 2, and in this case there is no solution of |T |2 = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1.  Proof of Corollary 5.9 (continued). Now suppose that T ∼ = PSLε (q) with n ∈ {7, 8}, and n+1 choose x ∈ T as in the proof of Lemma 3.4, so that (1) holds. If n = 8 then |CT (x)| > |T |7/9 for all q > 2, so Proposition 5.6 gives a contradiction. If n = 7 then |CT (x)| > |T |94/125 for all q > 2, so condition (ii) must hold. That is, s 6 2.9701 × 1015 , so (14) |T | = |P| < (s + 1)4 6 (2.9701 × 1015 + 1)4 < 7.78188 × 1061 . This implies that q 6 9, in which case there is no solution of |T | = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1. If T ∼ = PSp8 (q) then, as per (2), |T | = q 16 (q 2 − 1)(q 4 − 1)(q 6 − 1)(q 8 − 1)/ gcd(2, q − 1) and we can choose x ∈ T with |CT (x)| = q 16 (q 2 − 1)(q 4 − 1)(q 6 − 1)/ gcd(2, q − 1). This yields |CT (x)| > |T |94/125 for all q > 2, so again (14) must hold. This implies that q 6 53, in which case there is no solution of |T | = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1. Similarly, if T ∼ = Ω9 (q) then we can take x ∈ T as in the proof of Lemma 3.4, so that with |CT (x)| = |SO± 2n (q)| = 12 q (q 4 ± 1)(q 2 − 1)(q 4 − 1)(q 6 − 1) as in (3). This yields |CT (x)| > |T |94/125 for all q > 2, so (14) must hold, and we immediately have a contradiction because |Ω9 (q)| = |PSp8 (q)|. Finally, suppose that T ∼ = PΩ± 2n (q) with n ∈ {7, 8}, and choose x ∈ T as in the proof of Lemma 3.4. If n = 8 then by using (4) (for q odd) and (6) (for q even), one may check that |CT (x)| > |T |94/125 for all q > 2. Hence, (14) must hold, and this implies that q ∈ {2, 3}, in which case there is no solution of |T | = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1. Now suppose that n = 7. Then (14) holds if and only if q 6 4, and in this case there is no solution of |T | = (s + 1)(st + 1) satisfying s > 2, t > 2 and properties (ii) and (iii) of Lemma 2.1 for q ∈ {2, 4}. Therefore, we must have q > 5. However, in this case |CT (x)| > |T |94/125 , so we have a contradiction. (To check this, note that |CT (x)| > c · q 42 (q 5 − 1)(q 2 − 1)2 (q 4 − 1)(q 6 − 1)(q 8 − 1) where c = 12 or 41 according as q is even or odd.)  References [1] L. Babai, “On the automorphism groups of strongly regular graphs II”, J. Algebra 421 (2015) 560–578. [2] R. W. Baddeley, “Primitive permutation groups with a regular non-abelian normal subgroup”, Proc. London Math. Soc. 67 (1993) 547–595. SIMPLE GROUPS, PRODUCT ACTIONS, AND GENERALISED QUADRANGLES 21 [3] J. Bamberg, M. Giudici, J. Morris, G. F. Royle, and P. Spiga, “Generalised quadrangles with a group of automorphisms acting primitively on points and lines”, J. Combin. Theory Ser. A 119 (2012) 1479–1499. [4] J. Bamberg, A. Betten, P. Cara, J. De Beule, M. Lavrauw, and M. Neunhöffer, FinInG — Finite Incidence Geometry, Version 1.0, 2014. [5] J. Bamberg and M. Giudici, “Point regular groups of automorphisms of generalised quadrangles”, J. Combin. Theory, Ser. A 118 (2011) 1114–1128. [6] J. Bamberg, S. P. Glasby, T. Popiel, and C. E. Praeger, “Generalised quadrangles and transitive pseudo-hyperovals”, J. Combin. Des. 24 (2016) 151–164. [7] J. Bamberg, S. P. Glasby, T. Popiel, C. E. Praeger and C. Schneider, “Point-primitive generalised hexagons and octagons”, J. Combin. Theory, Ser. A 147 (2017), 186–204. [8] J. Bamberg, T. Popiel, and C. E. Praeger, “Point-primitive, line-transitive generalised quadrangles of holomorph type”, to appear in J. Group Theory, doi:10.1515/jgth-2016-0042. [9] T. C. Burness and M. Giudici, Classical groups, derangements, and primes, Australian Mathematical Society Lecture Series 25, Cambridge University Press, Cambridge, 2016. [10] J. H. Conway, R. T. Curtis, S. P. Norton, R. A. Parker and R. A. Wilson, ATLAS of finite groups, Oxford University Press, Oxford, 1985. [11] E. Covato, The involution fixity of simple groups, PhD Thesis, University of Bristol, in preparation. [12] S. De Winter and K. Thas, “Generalized quadrangles with an abelian Singer group”, Des. Codes Cryptogr. 39 (2006) 81–87. [13] W. Feit and J. G. Thompson, “Solvability of groups of odd order”, Pacific J. Math. 13 (1963) 775–1029. [14] The GAP Group, GAP — Groups, Algorithms, and Programming, Version 4.7.8, 2015. [15] D. Ghinelli, “Regular groups on generalized quadrangles and nonabelian difference sets with multiplier −1”, Geom. Dedicata 41 (1992) 165–174. [16] D. Gorenstein, R. Lyons and R. Solomon, The classification of the finite simple groups, number 3, Mathematical Surveys and Monographs 40, American Mathematical Society, Providence, 1998. [17] D. Frohardt and K. Magaard, “Fixed point ratios in exceptional groups of rank at most two”, Comm. Algebra 30 (2002) 571–602. [18] L. Morgan and T. Popiel, “Generalised polygons admitting a point-primitive almost simple group of Suzuki or Ree type”, Electronic J. Combin. 23 (2016) P1.34. [19] C. E. Praeger, C.-H. Li and A. C. Niemeyer, “Finite transitive permutation groups and finite vertex-transitive graphs”, in: G. Hahn and G. Sabidussi (Eds.), Graph symmetry, Kluwer, 1997, pp. 277–318. [20] M. W. Liebeck and G. M. Seitz, Unipotent and nilpotent classes in simple algebraic groups and Lie algebras, Mathematical Surveys and Monographs 180, American Mathematical Society, Providence, RI, 2012. [21] M. W. Liebeck and A. Shalev, “On fixed points of elements in primitive permutation groups”, J. Algebra 421 (2015) 438–459. [22] S. E. Payne and J. A. Thas, Finite generalized quadrangles, Pitman, London, 1984. [23] N. Spaltenstein, “Caractères unipotents de 3 D4 (Fq )”, Comment. Math. Helvetici 57 (1982) 676–691. [24] M. Suzuki, “On a class of doubly transitive groups”, Annals Math. 75 (1962) 105–145. [25] J. Tits, “Sur la trialité et certains groupes qui s’en déduisent”, Inst. Hautes Études Sci. Publ. Math. 2 (1959) 13–60. [26] S. Yoshiara, “A generalized quadrangle with an automorphism group acting regularly on the points”, European J. Combin. 28 (2007) 653–664. [27] H. Van Maldeghem, Generalized polygons, Birkháuser, Basel, 1998. Centre for the Mathematics of Symmetry and Computation, School of Mathematics and Statistics, The University of Western Australia, 35 Stirling Highway, Crawley, W.A. 6009, Australia. Email: {john.bamberg, tomasz.popiel† , cheryl.praeger‡ }@uwa.edu.au † Current address: School of Mathematical Sciences, Queen Mary University of London, Mile End Road, London E1 4NS, United Kingdom. ‡ Also affiliated with King Abdulaziz University, Jeddah, Saudi Arabia.
4math.GR
Memory Based Online Learning of Deep Representations from Video Streams arXiv:1711.07368v1 [cs.CV] 17 Nov 2017 Federico Pernici, Federico Bartoli, Matteo Bruni and Alberto Del Bimbo MICC – Media Integration and Communcation Center University Of Florence Abstract Memory 1000110101 0010101000 We present a novel online unsupervised method for face identity learning from video streams. The method exploits deep face descriptors together with a memory based learning mechanism that takes advantage of the temporal coherence of visual data. Specifically, we introduce a discriminative feature matching solution based on Reverse Nearest Neighbour and a feature forgetting strategy that detect redundant features and discard them appropriately while time progresses. It is shown that the proposed learning procedure is asymptotically stable and can be effectively used in relevant applications like multiple face identification and tracking from unconstrained video streams. Experimental results show that the proposed method achieves comparable results in the task of multiple face tracking and better performance in face identification with offline approaches exploiting future information. Code will be publicly available. 1010010101 0010101001 1010101001 0101010100 1010101001 1010011010 ... 1000101001 1001101010 0010101001 1010011010 Figure 1. Memory based appearance representation. Left: Each element in the memory consists of a descriptor with an associated identity (indicated by box color) and an associated scalar value reflecting the degree of redundancy (indicated by grey box area) with respect to the current representation. Right: The shaded regions represent the original appearance representation (i.e. VGGface). The descriptors outside those regions are learned from the video and extend the original appearance representation. tically similar information. This provides a variety of conditions in which an object can be framed, and therefore a comprehensive representation of its appearance can be obtained. Accordingly, tracking a subject in the video could, at least in principle, support a sort of unsupervised incremental learning of its appearance. This would avoid or reduce the cost of annotation as time itself would provide a form of self-supervision. However, this solution is not exempt of problems [5]. On the one hand, parameter re-learning of Deep Networks, to adequately incorporate the new information without catastrophic interference, is still an open challenge [6, 7], especially when re-learning should be done in real time while tracking, without the availability of labels and with data coming from a stream which is often nonstationary. On the other hand, classic object tracking [8] has substantially divergent goals from continuous incremental learning. While in tracking the object appearance is learned only for detecting the object in the next frame (the past information is gradually forgotten), continuous incremental learning would require that all the past visual information of the object observed so far is collected in a comprehensive and cumulative representation. This requires that tracking does not drift in the presence of occlusions or appearance 1. Introduction Visual data is massive and is growing faster than our ability to store and index it, nurtured by the diffusion and widespread use of social platforms. Their fundamental role in advancing object representation, object recognition and scene classification research have been undoubtedly assessed by the achievements of Deep Learning [1]. However, the cost of supervision remains the most critical factor for the applicability of such learning methods as linear improvements in performance require an exponential number of labelled examples [2]. Efforts to collect large quantities of annotated images, such as ImageNet [3] and Microsoft coco [4], while having an important role in advancing object recognition, don’t have the necessary scalability and are hard to be extended, replicated or improved. They may also impose a ceiling on the performance of systems trained in this manner. Semi or unsupervised Deep Learning from image data still remains hard to achieve. An attracting alternative would be to learn the object appearance from video streams with no supervision, both exploiting the large quantity of video available in the Internet and the fact that adjacent video frames contain seman1 changes and that incremental learning should be asymptotically stable in order to converge to an univocal representation. In this paper, we present a novel online unsupervised method for face identity learning from unconstrained video streams. The method exploits CNN based face detectors and descriptors together with a novel incremental memory based learning mechanism that collects descriptors and distills them based on their redundancy with respect to the current representation. This allows building a sufficiently compact and complete appearance representation of the individual identities as time advances (Fig. 1). While we obtained comparable results with offline approaches exploiting future information in the task of multiple face tracking, our model is able to achieve better performance in face identification from unconstrained video. In addition to this, it is shown that the proposed learning procedure is asymptotically stable and the experimental evaluation confirms the theoretical result. In the following, in Section 2, we cite a few works that have been of inspiration for our work. In Section 3 we highlight our contributions, in Section 4 we expounded the approach in detail and finally, in Section 5, experimental results are given. 2. Related Work Memory Based Learning: Inclusion of a memory mechanism in learning [9] is a key feature of our approach. On domains that have temporal coherence like Reinforcement Learning (RL) memory is used to store the past experience with some priority and to sample mini-batches to perform incremental learning [10] [11]. This makes it possible to break the temporal correlations by mixing more and less recent experiences. More recently, Neural Turing Machine architectures have been proposed in [12, 13] and [14] that implement an augmented memory to quickly encode and retrieve new information. These architectures have the ability to rapidly bind never-before-seen information after a single presentation via an external memory module. However, in these cases, training data are still provided supervisedly and the methods don’t scale with massive video streams. Open Set: In addition to the incremental learning procedure, the system needs to have the capability to discriminate between already known and unknown classes (open set) [15]. The open set classification is a problem of balancing known space (specialization) and unknown open space (generalization) according to the class rejection option. Formalization for open space risk is considered as the relative measure of open space compared to the overall measure space [15, 16, 17, 18]. The underlying assumption in these approaches is that data is I . I . D . which allows sampling the overall space uniformly. However, in a continuously data stream context, as in this paper, data is no longer independent and identically distributed, therefore balancing the known space vs the unknown space is more difficult since space with absence of data may be misinterpreted for open space. Storing data in a memory module can limit these effects [19, 20]. Open World: The other fundamental problem is incorporating the identified novel classes into the learning system (open world) [21]. This requirement favors non-parametric methods, since they can quickly learn never seen before information by simply storing examples. The Nearest Class Mean (NCM) classifier proposed in [22], has been shown to work well and be more robust than standard parametric classifiers in an incremental learning setting [22] [23] [24]. NCM’s main shortcomings are: it is not a discriminative classifiers and nonlinear data representation and/or non I . I . D . data streams limit the effectiveness of using the mean. We adopt from NCM the idea of prototype-based classification. However, the prototypes we use are not the average features vectors but we keep a representative non redundant discriminative subset. Multiple Object Tracking: All the methods we described so far make use of ground truth labels and typically address the categorization problem in which data is manually cropped around the object boundary. An alternative approach that in principle accomplishes the classincremental learning criteria expounded above (i.e. open set and open world) but with the addition of unknown labels and with data coming from the output of a detector (i.e. no manual cropped data) is Multiple Object Tracking (MOT) [25, 26]. Recent Multiple Object Tracking algorithms typically adopt appearance and motion cues into an affinity model to estimate and link detections to form tracklets which are afterwards combined into final trajectories [27, 28, 29, 30, 31, 32]. Most existing MOT methods are applied to pedestrian tracking and either use simple color histogram features [28, 33, 34, 35, 36] or hand-crafted features [37, 38, 39, 40] as the appearance representation of objects and have simple appearance update mechanisms. Few exceptions can operate online and use deep features [41, 42, 43, 44] but they still assume continuous motion and do not update the appearance. MOT methods are not suited to abrupt changes across different shots or scenes since the assumptions of continuous motion no longer hold. Abrupt changes across different shots are typically handled offline by exploiting tracklets into predetermined non-overlapping shots as in clustering face descriptors [45] [46] [47] [48]. Long Term Object Tracking: Finally, another relevant research subject to our learning setting is long-term object tracking [49]. The aim of long-term object tracking is to track a specific object over time and re-detect it when the target leaves and re-enters the scene. Only a few works on tracking have reported drift-free results on on very long video sequences ([50, 51, 52, 53, 54] among the few), and only few of them have provided convincing evidence on 6 Face Detection neighbor described in the next section. Unmatched descriptors of the faces in the incoming frame are stored in the memory module with a new Id. They ideally represent hypothesys of new identities that have not been observed yet and will eventually appear in the following frames. In order to learn a cumulative and comprehensive identity representation of each observed subject, two distincts problems are addressed. They are concerned with matching in consecutive frames and control of the memory module. These are separately addressed in the following subsections respectively. 1 Controller Memory New Ids Generation Descriptor Extraction ko Discriminative Matching ok 4.1. Reverse Nearest Neighbour Matching Figure 2. Block diagram presenting the major work flow and functional components in the proposed method. The gray shaded region highlights the components discussed in this paper. The memory module and the matching strategy run on the GPU. the possibility of incremental appearance learning strategies that are asymptotically stable [50][52]. However, all of these works only address tracking and perform incremental learning to detect the target in the next frame. 3. Contributions 1. We firstly combine in a principled manner Multiple Object Tracking in an online Open World learning system in which the learning strategy is shown to be asymptotically stable. 2. The proposed method performs very well with respect to offline clustering methods which exploits future information. 3. Different from several existing approaches, our proposed method operates online and and hence have a wider range of applications particularly face recognition with auto-enrollment of unrecognized subjects. 4. The proposed approach In our system, deep face descriptors are computed on face regions detected by a face detector and stored in a memory module as: N (t) M(t) = {(xi , Idi , ei , ai )}i=1 While tracking in consecutive frames, it is likely that the face of the same individual will have little differences from one frame to the following. In this case, highly similar descriptors will be stored in the memory and quickly a new face descriptor of the same individual will have comparable distances to the nearest and the second nearest descriptor already in the memory. In this case, a discriminative classifier like the Nearest Neighbor (NN) based on the distanceratio criterion [55] does not work properly and matching cannot be assessed. We solved this problem by performing descriptor matching according to Reverse Nearest Neighbour (ReNN) [56]: n o ||x −1NN (x )|| M? = (xi , Idi , ei , ai ) ∈ M(t) | ||xii −2NNIIt (xii )|| < ρ̄, (2) t where ρ̄ is the distance ratio threshold for accepting a match, xi is a deep face descriptor in the memory module and 1NNIt (xi ) and 2NNIt (xi ) are respectively its nearest and second nearest neighbor deep face descriptor in the incoming frame It . Fig. 3 shows the effects of this change of perspective: here two new observations are detected (two distinct faces, respectively marked as o1 and o2 ). They both have distance ratio close to 1 to the nearest xi s in the memory (the dots inside the grey region S). Therefore both their matchings are undecidable. Differently from NN, ReNN is able to correctly determine the nearest descriptor for each new (1) where xi is the deep descriptor, Idi is the object identity (an incremental number), ei is the eligibility factor (discussed in the following), ai tracks the age of items stored in memory and N (t) is the number of descriptors at time t in the memory module. The block diagram of the proposed system is shown in Fig. 2. As video frames are observed, new faces are detected and their descriptors are matched with those already in the memory. Each newly observed descriptor will be assigned with the object identity of its closest neighbour according to a discriminative strategy based on reverse nearest 𝐨1 1 𝑆 𝐱𝑖 𝐨2 Figure 3. Reverse Nearest Neighbor for a repeated temporal visual structure (S) with the distance ratio criterion. All elements xi match with o1 , for clarity only one of them is highlighted to show the distances (thick black lines). descriptor in the incoming frame. In fact, with ReNN, the roles of xi and oi are exchanged and the distance ratio is computed between each xi and the oi as shown in figure for one of the xi s (the yellow dot is associated to the newly observed red dot). Due to the fact that with ReNN a large number of descriptors (those accumulated in the memory module) is matched against a relatively small set of descriptors (those observed in the current image), calculation of the ratio between distances could be computationally expensive if sorting is applied to the entire set. However, minimum distances can be efficiently obtained by performing twice a brute force search, with parallel implementation on GPU [57]. This technique not only leverages the very efficient CUDA matrix multiplication kernel for computing the squared distance matrix but it also exploits the GPU parallelism since each query is independent. GPU limited bandwidth is not an issue being the memory incrementally populated. The other important advantage of using ReNN is that all the descriptors xi of the shown repeated structure S of Fig. 3 match with the descriptor o1 resulting in a one to many correspondence: {o1 } ↔ {xi }. This capability provides a simple and sound method in the selection of those redundant descriptors that need to be condensed into a more compact representation. The feature o1 will be used, as described in the next section, to influence the other matched (redundant) features xi regarding the fact that they belong to the same repeated structure. Therefore not only ReNN restores the discriminative matching capability under the distance ratio criterion but it also creates the foundation for the development of memory control strategies to correctly forget the redundant feature information. 4.2. Memory Control Descriptors that have been matched according to ReNN ideally represent different appearances of a same subject face. However, collecting these descriptors indefinitely could quickly determine memory overload. To detect redundant descriptors and discard them appropriately, we defined a dimensionless quantity ei referred to as eligibility. This is set to ei = 1 as a descriptor is entered in the memory module and hence decreased at each match with a newly observed descriptor, proportionally to the distance ratio: ei (t + 1) = ηi ei (t). (3) When doing this, we also re-set the age: ai = 0. Eligibility allows to take into account both discriminative spatial redundancy at a rate proportional to the success of matching in consecutive frames. In fact, as the eligibility ei of a face descriptor xi in the memory drops below a given threshold ē (that happens after a number of matches), that descriptor with its associated identity, age and relative eligibility is 6 1 𝐨1 𝐨2 Low 𝐱𝑖 Figure 4. The shape of the density (here in 2D) down-weighting the eligibility associated to each matched descriptor in the memory. Features xi in proximity of the observed descriptor o1 have their eligibility decreased to encourage their redundancy. The asymmetric shape of the density encourages more diversity in the open space far from the identity o2 rather than close. removed from the memory module: if (ei < ē) then M(t + 1) = M(t) \ {(xi , Idi , ei , ai )}. (4) The value ηi is computed according to:  ηi = 1 d1i ρ̄ d2i α , (5) where d1i and d2i are respectively the distances between xi and its first and second nearest neighbour oi , the value ρ̄ is the distance-ratio threshold of Eq. 2 here used to normalize ηi in the unit interval. The value of α emphasizes the effect of the distance-ratio. With every memory update we also increment the age ai of all non-matched elements by 1. Eq. 5 defines a density that weights more the eligibility around the matched features and less the eligibility far apart from their second nearest neighbor. This definition is similar to discriminative distance metric learning in which the features belonging to two different classes are expected to be separated as much as possible in the feature space. The density defined by Eq. 5 can be visualized in Fig. 4 for some values of the distance ratio below the matching threshold ρ̄. Each 2D circle in the figure visually represents the density weighting the eligibility of the matching descriptors. The geometric shape of the density is a generalization to multiple dimensions of the Apollonious circle1 . In particular, the asymmetric shape of the density induced by the distance ratio encourages learning feature diversity in the open space. Therefore not only the matching is discriminative and indicated for rejecting hypotheses (Open Set) but also well suited for learning in an Open World. 1 Apollonius of Perga (c. 262 BC - c. 190 BC) showed that a circle may also be defined as the set of points in a plane having a constant ratio of distances to two fixed foci. 1 𝐨1 𝐱𝑖 𝐨2 Figure 5. Matching with multiple identities. The identity o1 matches with two identities (yellow and green). The ambiguity is resolved by assigning o1 with the Id having the largest number of matched descriptors (i.e. the yellow identity). 4.3. Temporal Coherence in Image Space The model previously described exploits video temporal coherence in the deep descriptor space, further spatiotemporal coherence is exploited in the image space introducing the following constraints: 1. Id novelty: Potential novel identities in the current frame are included in the memory only if at least one known identity is recognized in the current frame. This allows introducing novel identity information which is known to be reasonably different from the recognized ones. 2. Id temporal coherence: An identity is assigned and included in the memory only if has been assigned in two consecutive frames. After the assignment (i.e. memory inclusion) it must match at least once in the following 3 frames, otherwise it is discarded. 3. Id uniqueness: Duplicated Ids in the current frame are not considered. 4. Id ambiguity: A subject may match with multiple identities. This ambiguity is resolved by assigning all the matched descriptors with the Id having the largest number of matched descriptors as shown in Fig. 5. Bounding box overlap, typically used in multiple object tracking, is not exploited since not effective in unconstrained video with abrupt motions. Video temporal coherence in the image space is explicitly enforced by the 2nd constraint. 4.4. Memory Overflow Control Our method, operating online, does not require any prior information about how many identity classes will occur, and can run for an unlimited amount of time. However, since the memory requirement is dominated by the size of the stored exemplars, if the number of identities increases indefinitely the exemplar removal based on eq. 4 may not be sufficient in handling redundancy and the system may overflow its bounded memory. In this condition the system is forced to remove some stored exemplars by the memory limita- tions. To overcome this issue we follow a strategy similar to [14, 58] that involves the use of a policy based on removing from the memory the Least Recently Used Access (LRUA) exemplars. This is achieved by finding memory items with maximum age ai in the memory, and write to one of those. Therefore the system preserves recently encoded information according to the Eligibility strategy, or writes to the last used location according to the LRUA strategy. The latter can function as an update of the memory with newer, possibly more relevant information by avoiding the deletion of rare but useful descriptors. A benefit of the LRUA strategy is that of handling those features collected in the memory that will never obtain matches. This effect is largely due to scene occluders or with descriptors extracted from bounding boxes computed from false positives of the face detector. In the long run such features may waste critical space in the memory buffer. 4.5. Asymptotic stability Under the assumption that descriptors are sufficiently distinctive (as in the case of deep face descriptors), the incremental learning procedure described above stabilizes asymptotically around the probability density function of the descriptors of each individual subject face. This can be proved by studying the discrete dynamic system of Eq. 3 relating e(t + 1) to e(t) by the map T : X 7→ X as e(t + 1) = T (e(t)). A fixed point of T corresponds to an equilibrium state of the discrete dynamical system. In particular if T is a contraction there is a unique equilibrium state and the system approaches this state as time goes to infinity starting from any initial state. In this case the fixed point is globally asymptotically stable. More formally: Theorem (Contraction Mapping) 1 Let (X, d) be a complete metric space and T : X 7→ X be the map of Eq. 3 such that d(T (e), T (e0 )) ≤ c · d(e, e0 ) for some 0 < c ≤ 1 and all e and e0 ∈ X. Then T has a unique fixed point in X. Moreover, for any e(0) ∈ X the sequence e(n) defined as e(n + 1) = T (e(n)), converges to the fixed point of T . The key element that guarantees such theoretical asymptotic stability is that the ReNN distance ratio is always below 1. In fact, it is easy to demonstrate that the updating rule of Eq. 3 is a contraction and converges to its unique fixed point 0 according to the Contraction Mapping theorem (Banach fixed-point theorem). The asymptotic stability of the method is illustrated in Fig. 6 with a simple one-dimensional case. Two patterns of synthetic descriptors, respectively modeling the case of a distinctive identity (red curve) and a non distinctive identity (black curve) are generated by two distinct 1D Gaussian distributions. The learning method was ran for 1000 iterations for three different configurations of the two distributions. The configurations reflect the limit case in which the dis- Figure 7. MOTA for each video sequence in the BBT dataset. Figure 6. Asymptotic stability of . incremental learning of a face identity in a sample sequence tinctiveness assumption of the deep descriptors no longer holds. Mismatches might therefore corrupt the distinctive identity. The blue points represent the eligibility of the distinctive identity. The histogram in yellow represents the distribution of the distinctive identity as incrementally learned by the system. The three figures represent distinct cases in which the non distinctive identity is progressively overlapping the distinctive one. The ReNN matching mechanism and the memory control mechanism still keep the learned distinctive identity close to its ground truth pdf. 5. Quantitative Experiments We focus on tracking/identifying multiple faces according to their unknown identities in unconstrained videos consisting of many shots typically taken from different cameras. We used the Music-dataset in [48] which includes 8 music videos downloaded from YouTube with annotations of 3,845 face tracks and 117,598 face detections. We also add the first 6 episodes from Season 1 of the Big Bang Theory TV Sitcom (referred as BBT01-06) [36]. Each video is about more than 20 minutes long with 5-13 people and is taken mostly indoors. The main difficulty lies in identifying faces of the same subject from a long video footage. The two algorithm parameters in Eq. 5 are set empirically to: ρ̄ = 1.6 and α = 0.01. Deep face descriptor are extracted according to [62]. We firstly show the capability of the proposed method to perform online learning without drifting using the long sequences of the BBT dataset. This consists on monitoring the performance degradation of the system as time advances. A decrease in performance may eventually hinder learning being the system in a condition from which is not possible to recover. In order to build a pic- ture of the performance over time we evaluate the method with the metric set commonly used in multiple object tracking [63]. In particular we report the MOTA: The Multiple Object Tracking Accuracy that takes into account false positives, wrongly P rejected identities and identity switches as: (FNt +FPt +IDSt ) where GTt , FNt , FPt and MOTA = 1 − t P t GTt IDSt are respectively the number of ground truth objects, the number of false negatives, the number of false positives and the number of identity switches at time t. The identity switches are defined as the total number of times that a tracked trajectory changes its matched GT identity. Fig. 7 shows the MOTA curves as time progresses for each video sequence of the BBT dataset for about 30000 frames. Each individual frame is used to test the model before it is used for training by the incremental learning procedure [64]. As can be seen from the figure the curves reveal the stability of the learning mechanism confirming the theoretical result of Sec. 4.5. The initial fluctuations typically vary from sequence to sequence and reflect the approximate invariance of the original representation. That is, the few descriptors entering in the memory at the beginning of each sequence do not provide substantial improvement with respect to the original representation. However, as time advances, the reduction of fluctuations reveal that the proposed method is able to learn by collecting all the non-redundant descriptors it can from the video stream until no more improvement is possible. We further compare the proposed algorithm with other state-of-the-art MOT trackers, including modified versions of TLD [65], ADMM [60], IHTLS [61]. We specifically compare with two multi-face tracking methods using the TLD method implemented as described in [48]. The first method, called mTLD, runs multiple TLD trackers for all targets, and each TLD tracker is initialized with the ground truth bounding box in the first frame. The second method, referred as mTLD2, is used to generate shot-level trajectories within each shot initializing TLD trackers with untracked detections, and link the detections in the following frames according to their overlap scores with TLD outputs. The methods indicated as Pre-trained, SymTriplet, Table 1. Quantitative comparison with other state-of-the-art multi-object tracking methods on the Music video dataset Method mTLD [59] ADMM [60] IHTLS [61] Pre-Trained [48] mTLD2 [59] Siamese [48] Triplet [48] SymTriplet [48] MuFTiR-dpm MuFTiR-tiny Method mTLD ADMM IHTLS Pre-Trained mTLD2 Siamese Triplet SymTriplet MuFTiR-dpm MuFTiR-tiny A PINK Mode IDS ↓ Offline 31 Offline 179 Offline 173 Offline 100 Offline 173 Offline 124 Offline 140 Offline 78 Online 121 Online 191 MOTA ↑ -2.2 72.4 74.9 54.0 77.4 79.0 78.9 80.0 21.8 55.1 G IRLS A LOUD Mode IDS ↓ MOTA ↑ Offline 9 -1.1 Offline 487 46.6 Offline 396 51.8 Offline 138 42.7 Offline 322 46.7 Offline 112 51.6 Offline 80 51.7 Offline 64 51.6 Online 51 -2.7 Online 339 49.3 Method mTLD ADMM IHTLS Pre-Trained mTLD2 Siamese Triplet SymTriplet MuFTiR-dpm MuFTiR-tiny B RUNO M ARS Mode IDS ↓ MOTA ↑ MOTP ↑ Method Offline 35 -8.7 65.3 mTLD Offline 428 50.6 85.7 ADMM Offline 375 52.7 85.8 IHTLS Offline 151 48.3 88.0 Pre-Trained Offline 278 52.6 87.9 mTLD2 Offline 126 56.7 87.8 Siamese Offline 126 56.6 87.8 Triplet Offline 105 56.8 87.8 SymTriplet Online 78 4.5 61 MuFTiR-dpm Online 420 48.8 65.5 MuFTiR-tiny H ELLO B UBBLE MOTP ↑ Method Mode IDS ↓ MOTA ↑ MOTP ↑ Method 71.0 mTLD Offline 7 -3.5 66.5 mTLD 87.1 ADMM Offline 115 47.6 69.9 ADMM 87.2 IHTLS Offline 109 52.0 69.9 IHTLS 87.7 Pre-Trained Offline 71 36.6 68.5 Pre-Trained 88.2 mTLD2 Offline 139 52.6 70.5 mTLD2 87.8 Siamese Offline 105 56.3 70.6 Siamese 87.8 Triplet Offline 82 56.2 70.5 Triplet 87.8 SymTriplet Offline 69 56.5 70.5 SymTriplet 61 MuFTiR-dpm Online 170 4.0 59.0 MuFTiR-dpm 66.1 MuFTiR-tiny Online 88 51.4 69.9 MuFTiR-tiny TARA W ESTLIFE Mode IDS ↓ MOTA ↑ MOTP ↑ Method Mode IDS ↓ MOTA ↑ Offline 130 1.4 67.9 mTLD Offline 20 -34.7 Offline 251 29.4 63.8 ADMM Offline 223 62.4 Offline 218 35.3 63.8 IHTLS Offline 113 60.9 Offline 143 57.3 72.4 Pre-Trained Offline 85 57.0 Offline 251 56.0 72.6 mTLD2 Offline 177 58.1 Offline 106 58.4 72.5 Siamese Offline 74 64.1 Offline 94 59.0 72.5 Triplet Offline 89 64.5 Offline 75 59.2 72.4 SymTriplet Offline 57 68.6 Online 124 15 68 MuFTiR-dpm Online 47 -0.2 Online 270 39.5 76.4 MuFTiR-tiny Online 76 58.9 MOTP ↑ 71.2 76.1 76.1 75.5 76.3 76.3 76.3 76.3 61 65.4 Method mTLD ADMM IHTLS Pre-Trained mTLD2 Siamese Triplet SymTriplet MuFTiR-dpm MuFTiR-tiny Triplet and Siamese refers to the four alternatives methods proposed in [48]. In these methods including ADMM, mTLD, mTLD2 and IHTLS, shot changes are detected and the video is divided into non-overlapping shots. Within each shot, a face detector is applied and adjacent detections are linked into tracklets. The recovered collection of tracklets are used as face pairs (Siamese) or face triplets (Triplet and SymTriplet) to fine-tune a CNN initial face feature descriptor based on the AlexNet architecture trained on the CASIA-WebFace (Pre-trained). Then, appearance of each detection is represented with the fine-tuned feature descriptors and tracklets within each shot are linked into shotlevel tracklets according to a global multiple object tracking [34, 66]. Finally tracklets across shots are subsequently merged across multiple shots into final trajectories according to the Hierarchical Agglomerative Clustering. We reported two alternative versions using the (Deformable Part Model) DPM [67] and the Tiny [68] face detectors. They are indicated as MuFTiR-DPM and MuFTiRTINY respectively. For such comparisons we also include the multiple target metric MOTP: The Multiple Object Tracking Precision. MOTP is the average dissimilarity between all true positives and their corresponding ground truth targets. MOTP is a measure of localization precision. Given the quite different nature between offline and online this comparison is to be considered a proof-of-concept. However, given the good performance of the offline methods we DARLING Mode IDS ↓ MOTA ↑ Offline 24 -22.0 Offline 412 53.0 Offline 381 62.7 Offline 115 42.7 Offline 278 59.8 Offline 214 69.5 Offline 187 69.2 Offline 169 70.5 Online 64 2.2 Online 449 62.1 P USSYCAT D OLLS Mode IDS ↓ MOTA ↑ Offline 24 3.1 Offline 287 63.2 Offline 248 70.3 Offline 128 65.1 Offline 296 68.3 Offline 107 70.3 Offline 99 69.9 Offline 82 70.2 Online 55 -13.5 Online 83 30.7 MOTP ↑ 69.9 88.4 88.4 88.5 89.3 88.9 88.9 88.9 63.7 66.0 MOTP ↑ 71.3 63.5 63.5 64.9 64.9 64.9 64.9 64.9 61.1 62.7 MOTP ↑ 56.9 87.5 87.5 88.2 88.1 88.0 88.0 88.1 61.5 66.1 compare to, it is certainly non-trivial for our online method to do any better. Table 1 shows that our online tracking algorithm does reasonably well with respect to offline algorithms, although there are some exceptions. In H EL LO B UBBLE, B RUNO M ARS , DARLING , TARA and W ESTL IFE our best performing method has the MOTA score similar to the ADMM and IHTLS methods with little less identity switches. Despite the on par performance, our method achieves the results without exploiting future information. Performance are still good in A PINK, the identity switches are still comparable despite a decrease in MOTA. Excluding Siamese, Triplet and SymTriplet that use a refined descriptor specifically tailored to the clustered identities extracted with the multiple passes over the sequence, our method is on par with the other offline methods. Our main observation is that with modern CNN based face detector and descriptor, the state-of-the-art offline trackers do not have expected advantages over the simpler online ones. Advantages further thin when processing long video sequences that do not fit into memory. Results are confirmed in the BBT dataset as shown in Table 2. As in the previous comparison on the Music dataset, except for the Siamese, Triplet and SymTriplet the overall performance are very good. In the Episode four we achieved better results. Considering that CNN descriptor fine-tuning takes around 1 hour per sequence on a modern GPU, our method perform favorably in those applications Table 2. Quantitative comparison with other state-of-the-art multi-object tracking methods on the BBT dataset. BBT _ S 01 E 02 BBT _ S 01 E 01 Method mTLD [59] ADMM [60] IHTLS [61] Pre-Trained [48] mTLD2 [59] Siamese [48] Triplet [48] SymTriplet [48] MuFTiR-tiny Mode Offline Offline Offline Offline Offline Offline Offline Offline Online IDS ↓ 1 323 312 171 223 144 164 156 24 MOTA ↑ -16.3 42.5 45.7 41.9 58.4 69.0 69.3 72.2 59.9 MOTP ↑ 74.8 64.0 64.0 73.3 73.8 73.7 73.6 73.7 70.3 MOTA ↑ -15.9 9.7 13.3 0.1 11.6 23.0 18.0 19.5 53.2 MOTP ↑ 76.8 65.8 65.8 66.3 66.3 66.4 66.4 66.4 69.6 Method mTLD ADMM IHTLS Pre-Trained mTLD2 Siamese Triplet SymTriplet MuFTiR-tiny BBT _ S 01 E 04 Method mTLD ADMM IHTLS Pre-Trained mTLD2 Siamese Triplet SymTriplet MuFTiR-tiny Mode Offline Offline Offline Offline Offline Offline Offline Offline Online IDS ↓ 0 298 295 46 103 85 103 77 84 IDS ↓ MOTA ↑ MOTP ↑ 1 -7.6 82.8 395 41.3 71.3 394 42.4 71.4 130 27.4 74.5 174 43.6 75.9 116 60.4 75.8 143 60.2 75.7 102 61.6 75.7 57 45.1 68.8 BBT _ S 01 E 05 Mode IDS ↓ MOTA ↑ MOTP ↑ Offline 1 -15.5 76.9 Offline 380 37.4 68.2 Offline 360 33.8 68.2 Offline 98 32.3 75.0 Offline 169 46.4 74.9 Offline 128 60.7 75.0 Offline 118 60.5 74.9 Offline 90 60.9 74.9 Online 36 44.5 69.3 Mode Offline Offline Offline Offline Offline Offline Offline Offline Online Method mTLD ADMM IHTLS Pre-Trained mTLD2 Siamese Triplet SymTriplet MuFTiR-tiny operating on real time streaming data. Currently our approach runs at 10 frame per second on 800x600 video frame resolution on a Nvidia GeForce GTX TITAN X (Maxwell). MOTA2 , while largely used to evaluate performance in multiple object tracking, it is not fully appropriate to evaluate the performance of identification in a open world scenario. In fact, it does not explicitly handle target reidentification. Different identities assigned to the same individual in two distinct scenes are not accounted as an identity switch. This effect has particular impact with videos obtained from multiple cameras or with many shots. In order to take into account this case, for each sequence we alsoPreport the weighted cluster purity, defined as: W = 1 c mc pc , where c is the identity cluster, mc the number M of assigned identities, pc the ratio between the most frequently occurred identity and mc , and M denotes the total number of identity detections in the video. Table 3 and 2 Provided by www.motchallenge.org Table 3. Clustering results on Music Dataset. Weighted purity of each video is measured on ideal number of clusters. Videos HOG AlexNet Pre-trained VGG-Face Siamese Triplet SymTriplet MuFTiR-tiny Apink 0.20 0.22 0.29 0.24 0.48 0.60 0.72 0.51 B. Mars 0.36 0.36 0.50 0.44 0.88 0.83 0.90 0.96 M USIC DATASET Darling Girls A. Hello B. 0.19 0.29 0.35 0.18 0.30 0.31 0.24 0.33 0.34 0.20 0.31 0.29 0.46 0.67 0.54 0.49 0.67 0.60 0.70 0.69 0.64 0.73 0.89 0.59 P. Dolls 0.28 0.31 0.31 0.46 0.77 0.77 0.78 0.97 T-ara 0.22 0.25 0.31 0.23 0.69 0.68 0.69 0.72 Westlife 0.27 0.37 0.37 0.27 0.54 0.52 0.56 0.98 Table 4. Clustering results on Big Bang Theory Dataset. Weighted purity of each video is measured on ideal number of clusters. Episodes HOG AlexNet Pre-trained VGG-Face Siamese Triplet SymTriplet MuFTiR-tiny BBT01 0.37 0.47 0.62 0.91 0.94 0.94 0.94 0.98 B IG BANG T HEORY BBT02 BBT03 BBT04 0.32 0.38 0.35 0.32 0.45 0.35 0.72 0.73 0.57 0.85 0.83 0.54 0.95 0.87 0.74 0.95 0.92 0.74 0.95 0.92 0.78 0.98 0.98 0.85 BBT05 0.29 0.29 0.52 0.65 0.70 0.68 0.85 0.98 BBT06 0.26 0.26 0.52 0.46 0.70 0.70 0.75 0.94 BBT _ S 01 E 03 Method mTLD ADMM IHTLS Pre-Trained mTLD2 Siamese Triplet SymTriplet MuFTiR-tiny Method mTLD ADMM IHTLS Pre-Trained mTLD2 Siamese Triplet SymTriplet MuFTiR-tiny IDS ↓ MOTA ↑ 5 -2.1 370 30.8 376 33.5 110 17.8 142 38.0 109 52.6 121 50.7 126 51.9 14 43.6 BBT _ S 01 E 06 Mode IDS ↓ MOTA ↑ Offline 0 -3.9 Offline 527 47.5 Offline 515 43.2 Offline 191 27.8 Offline 192 37.7 Offline 156 46.2 Offline 185 45.4 Offline 196 47.6 Online 222 42.9 Mode Offline Offline Offline Offline Offline Offline Offline Offline Online MOTP ↑ 69.4 68.1 68.0 67.5 67.9 67.9 67.8 67.8 68.4 MOTP ↑ 89.3 97.6 97.7 98.2 97.8 97.9 98.0 98.0 69.2 Figure 8. Four frames from the B RUNO M ARS video sequence with the superimposed estimated identities are shown. 4 show the quantitative results of the comparison with the Music and the BBT datasets. HOG, AlexNet and VGGface indicate the method [48] using alternative descriptors. HOG uses a conventional hand-crafted feature with 4356 dimensions, AlexNet uses a generic feature representation with 4096 dimensions. Our proposed approach achieves the best performance in six out of eight videos in the Music dataset and it achieves state of the art in all the BBT video sequences. Finally, Fig. 8 shows four frames of the of the B RUNO M ARS sequence with the learned identities superimposed. Faces appear sensibly diverse (see f.e. individual number 1), nonetheless it can be observed that the learning mechanism is capable to extend the original representation to preserve identities under large pose variations including face profiles not included in the original representation. 6. Conclusion In this paper we exploited deep CNN based face detection and descriptors coupled with a novel memory based learning mechanism that learns face identities from video sequences unsupervisedly, exploiting the temporal coherence of video frames. Particularly, all the past observed information is learned in a comprehensive representation. We demonstrate the effectiveness of the proposed method with respect multiple face tracking on the Music and BBT datasets. The proposed method is simple, theoretically sound, asymptotically stable and follows the cumulative and convergent nature of human learning. It can be applied in principle to any other context for which a detectordescriptor combination is available (i.e. car, person, boat, traffic sign). Acknowledgment This research is based upon work supported in part by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via IARPA contract number 2014-14071600011. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of ODNI, IARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purpose notwithstanding any copyright annotation thereon. References [1] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, volume 1, page 4, 2012. 1 [2] Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017. 1 [3] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pages 248–255. IEEE, 2009. 1 [4] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European Conference on Computer Vision, pages 740–755. Springer, 2014. 1 [5] Greenberg Andy. Watch a 10-year-old’s face unlock his mom’s iphone x. https://www.wired.com/story/ 10-year-old-face-id-unlocks-mothersiphone-x/, November 2017. [Online; posted 14November-2017]. 1 [6] Zhizhong Li and Derek Hoiem. Learning without forgetting. In European Conference on Computer Vision, pages 614– 629. Springer, 2016. 1 [7] Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016. 1 [8] Matej Kristan, Ales Leonardis, Jiri Matas, Michael Felsberg, Roman Pflugfelder, Luka Cehovin Zajc, Tomas Vojir, Gustav Hager, Alan Lukezic, Abdelrahman Eldesokey, and Gustavo Fernandez. The visual object tracking vot2017 challenge results. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017. 1 [9] Dharshan Kumaran, Demis Hassabis, and James L McClelland. What learning systems do intelligent agents need? complementary learning systems theory updated. Trends in cognitive sciences, 20(7):512–534, 2016. 2 [10] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015. 2 [11] Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. In International Conference on Learning Representations, Puerto Rico, 2016. 2 [12] Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014. 2 [13] Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka Grabska-Barwińska, Sergio Gómez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538(7626):471–476, 2016. 2 [14] Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Meta-learning with memory-augmented neural networks. In International conference on machine learning, pages 1842–1850, 2016. 2, 5 [15] Walter J Scheirer, Anderson de Rezende Rocha, Archana Sapkota, and Terrance E Boult. Toward open set recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(7):1757–1772, 2013. 2 [16] Walter J. Scheirer, Lalit P. Jain, and Terrance E. Boult. Probability models for open set recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence (T-PAMI), 36, November 2014. 2 [17] Abhijit Bendale and Terrance E. Boult. Towards open set deep networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016. 2 [18] Ethan M Rudd, Lalit P Jain, Walter J Scheirer, and Terrance E Boult. The extreme value machine. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017. 2 [19] Antoine Cornuéjols. Machine Learning: The Necessity of Order (is order in order ?). In E. Lehtinen & T. O’Shea (Eds.) F. Ritter, J. Nerb, editor, In order to learn: How the sequences of topics affect learning. Oxford University Press, 2006. 2 [20] Antoine Cornuéjols. On-line learning: where are we so far? In Ubiquitous knowledge discovery, pages 129–147. Springer, 2010. 2 [21] Abhijit Bendale and Terrance Boult. Towards open world recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1893–1902, 2015. 2 [34] Chang Huang, Bo Wu, and Ramakant Nevatia. Robust object tracking by hierarchical association of detection responses. In European Conference on Computer Vision, pages 788– 801. Springer, 2008. 2, 7 [22] Thomas Mensink, Jakob Verbeek, Florent Perronnin, and Gabriela Csurka. Distance-based image classification: Generalizing to new classes at near-zero cost. IEEE transactions on pattern analysis and machine intelligence, 35(11):2624– 2637, 2013. 2 [35] Yuan Li, Chang Huang, and Ram Nevatia. Learning to associate: Hybridboosted multi-target tracker for crowded scene. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pages 2953–2960. IEEE, 2009. 2 [23] Thomas Mensink, Jakob Verbeek, Florent Perronnin, and Gabriela Csurka. Metric learning for large scale image classification: Generalizing to new classes at near-zero cost. Computer Vision–ECCV 2012, pages 488–501, 2012. 2 [36] Baoyuan Wu, Siwei Lyu, Bao-Gang Hu, and Qiang Ji. Simultaneous clustering and tracklet linking for multi-face tracking in videos. In Proceedings of the IEEE International Conference on Computer Vision, pages 2856–2863, 2013. 2, 6 [24] Marko Ristin, Matthieu Guillaumin, Juergen Gall, and Luc Van Gool. Incremental learning of ncm forests for largescale image classification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3654–3661, 2014. 2 [25] Laura Leal-Taixé, Anton Milan, Konrad Schindler, Daniel Cremers, Ian Reid, and Stefan Roth. Tracking the trackers: An analysis of the state of the art in multiple object tracking. arXiv preprint arXiv:1704.02781, 2017. 2 [37] Markus Roth, Martin Bäuml, Ram Nevatia, and Rainer Stiefelhagen. Robust multi-pose face tracking by multi-stage tracklet association. In Pattern Recognition (ICPR), 2012 21st International Conference on, pages 1012–1016. IEEE, 2012. 2 [26] Wenhan Luo, Xiaowei Zhao, and Tae-Kyun Kim. Multiple object tracking: A review. CoRR, abs/1409.7618, 2014. 2 [38] Bing Wang, Gang Wang, Kap Luk Chan, and Li Wang. Tracklet association by online target-specific metric learning and coherent dynamics estimation. IEEE transactions on pattern analysis and machine intelligence, 39(3):589–602, 2017. 2 [27] William Brendel, Mohamed Amer, and Sinisa Todorovic. Multiobject tracking as maximum weight independent set. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pages 1273–1280. IEEE, 2011. 2 [39] Cheng-Hao Kuo and Ram Nevatia. How does person identity recognition help multi-person tracking? In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pages 1217–1224. IEEE, 2011. 2 [28] Li Zhang, Yuan Li, and Ramakant Nevatia. Global data association for multi-object tracking using network flows. In Computer Vision and Pattern Recognition, 2008. CVPR 2008. IEEE Conference on, pages 1–8. IEEE, 2008. 2 [40] Ramazan Gokberk Cinbis, Jakob Verbeek, and Cordelia Schmid. Unsupervised metric learning for face identification in tv video. In Computer Vision (ICCV), 2011 IEEE International Conference on, pages 1559–1566. IEEE, 2011. 2 [29] Anton Andriyenko, Konrad Schindler, and Stefan Roth. Discrete-continuous optimization for multi-target tracking. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pages 1926–1933. IEEE, 2012. 2 [30] Yuan Li, Haizhou Ai, Chang Huang, and Shihong Lao. Robust head tracking with particles based on multiple cues fusion. In European Conference on Computer Vision, pages 29–39. Springer, 2006. 2 [31] Yuan Li, Haizhou Ai, Takayoshi Yamashita, Shihong Lao, and Masato Kawade. Tracking in low frame rate video: A cascade particle filter with discriminative observers of different life spans. IEEE Transactions on Pattern Analysis and Machine Intelligence, 30(10):1728–1740, 2008. 2 [32] Seung-Hwan Bae and Kuk-Jin Yoon. Robust online multiobject tracking based on tracklet confidence and online discriminative appearance learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1218–1225, 2014. 2 [33] Horesh Ben Shitrit, Jerome Berclaz, Francois Fleuret, and Pascal Fua. Tracking multiple people under global appearance constraints. In Computer Vision (ICCV), 2011 IEEE International Conference on, pages 137–144. IEEE, 2011. 2 [41] Fengwei Yu, Wenbo Li, Quanquan Li, Yu Liu, Xiaohua Shi, and Junjie Yan. Poi: Multiple object tracking with high performance detection and appearance feature. In European Conference on Computer Vision, pages 36–42. Springer, 2016. 2 [42] Alex Bewley, Zongyuan Ge, Lionel Ott, Fabio Ramos, and Ben Upcroft. Simple online and realtime tracking. In 2016 IEEE International Conference on Image Processing (ICIP), pages 3464–3468, 2016. 2 [43] Amir Sadeghian, Alexandre Alahi, and Silvio Savarese. Tracking the untrackable: Learning to track multiple cues with long-term dependencies. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017. 2 [44] Nicolai Wojke, Alex Bewley, and Dietrich Paulus. Simple online and realtime tracking with a deep association metric. CoRR, abs/1703.07402, 2017. 2 [45] Baoyuan Wu, Yifan Zhang, Bao-Gang Hu, and Qiang Ji. Constrained clustering and its application to face clustering in videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3507–3514, 2013. 2 [46] Makarand Tapaswi, Omkar M Parkhi, Esa Rahtu, Eric Sommerlade, Rainer Stiefelhagen, and Andrew Zisserman. Total cluster: A person agnostic clustering method for broadcast videos. In Proceedings of the 2014 Indian Conference on Computer Vision Graphics and Image Processing, page 7. ACM, 2014. 2 [47] Shijie Xiao, Mingkui Tan, and Dong Xu. Weighted blocksparse low rank representation for face clustering in videos. In European Conference on Computer Vision, pages 123– 138. Springer, 2014. 2 [48] Shun Zhang, Yihong Gong, Jia-Bin Huang, Jongwoo Lim, Jinjun Wang, Narendra Ahuja, and Ming-Hsuan Yang. Tracking persons-of-interest via adaptive discriminative features. In European Conference on Computer Vision, pages 415–433. Springer, 2016. 2, 6, 7, 8 [49] Long term detection and tracking workshop. In Conjunction With The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops (LTDT2014), June 2014. 2 [50] Z. Kalal, J. Matas, and K. Mikolajczyk. P-n learning: Bootstrapping binary classifiers by structural constraints. In CVPR, june 2010. 2, 3 [51] Thang Ba Dinh, Nam Vo, and G. Medioni. Context tracker: Exploring supporters and distracters in unconstrained environments. In CVPR, june 2011. 2 [52] Federico Pernici and Alberto Del Bimbo. Object tracking by oversampling local features. IEEE transactions on pattern analysis and machine intelligence, 36(12):2538–2551, 2014. 2, 3 [53] Yang Hua, Karteek Alahari, and Cordelia Schmid. Occlusion and motion reasoning for long-term tracking. In Computer Vision–ECCV 2014, pages 172–187. Springer, 2014. 2 [54] Zhibin Hong, Zhe Chen, Chaohui Wang, Xue Mei, Danil Prokhorov, and Dacheng Tao. Multi-store tracker (muster): A cognitive psychology inspired approach to object tracking. June 2015. 2 [55] David G. Lowe. Distinctive image features from scaleinvariant keypoints. IJCV, 60:91–110, 2004. 3 [56] Flip Korn and S. Muthukrishnan. Influence sets based on reverse nearest neighbor queries. In Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, SIGMOD ’00, pages 201–212, New York, NY, USA, 2000. ACM. 3 [57] Shengren Li and Nina Amenta. Brute-force k-nearest neighbors search on the gpu. In International Conference on Similarity Search and Applications, pages 259–270. Springer, 2015. 4 [58] Lukasz Kaiser, Ofir Nachum, Aurko Roy, and Samy Bengio. Learning to remember rare events. International Conference on Learning Representations (ICLR), 2017. 5 [59] Z Kalal, J Matas, and K Mikolajczyk. Tracking-learningdetection. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2011. 7, 8 [60] Caglayan Dicle, Octavia I Camps, and Mario Sznaier. The way they move: Tracking multiple targets with similar appearance. In Proceedings of the IEEE International Conference on Computer Vision, pages 2304–2311, 2013. 6, 7, 8 [61] Mustafa Ayazoglu, Mario Sznaier, and Octavia I Camps. Fast algorithms for structured robust principal component analysis. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pages 1704–1711. IEEE, 2012. 6, 7, 8 [62] O. M. Parkhi, A. Vedaldi, and A. Zisserman. Deep face recognition. In British Machine Vision Conference, 2015. 6 [63] Laura Leal-Taixé, Anton Milan, Ian Reid, Stefan Roth, and Konrad Schindler. Motchallenge 2015: Towards a benchmark for multi-target tracking. arXiv preprint arXiv:1504.01942, 2015. 6 [64] João Gama, Indrė Žliobaitė, Albert Bifet, Mykola Pechenizkiy, and Abdelhamid Bouchachia. A survey on concept drift adaptation. ACM Comput. Surv., 46(4):44:1–44:37, March 2014. 6 [65] Zdenek Kalal, Krystian Mikolajczyk, and Jiri Matas. Tracking-learning-detection. IEEE transactions on pattern analysis and machine intelligence, 34(7):1409–1422, 2012. 6 [66] Junliang Xing, Haizhou Ai, and Shihong Lao. Multiobject tracking through occlusions by local tracklets filtering and global tracklets association with detection responses. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pages 1200–1207. IEEE, 2009. 7 [67] Markus Mathias, Rodrigo Benenson, Marco Pedersoli, and Luc Van Gool. Face detection without bells and whistles. In European Conference on Computer Vision, pages 720–735. Springer, 2014. 7 [68] Peiyun Hu and Deva Ramanan. Finding tiny faces. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017. 7
1cs.CV
Embedding AC Power Flow in the Complex Plane Part I: Modelling and Mathematical Foundation arXiv:1604.03425v2 [cs.SY] 18 Jul 2016 Sina S. Baghsorkhi, Member, IEEE, and Sergey P. Suetin Abstract—Part I of this paper embeds the AC power flow problem with voltage control and exponential load model in the complex plane. Modeling the action of network controllers that regulate the magnitude of voltage phasors is a challenging task in the complex plane as it has to preserve the framework of holomorphicity for obtention of these complex variables with fixed magnitude. The paper presents two distinct approaches to modelling the voltage control of generator nodes. Exponential (or voltage-dependent) load models are crucial for accurate power flow studies under stressed conditions. This new framework for power flow studies exploits the theory of analytic continuation, especially the monodromy theorem for resolving issues that have plagued conventional numerical methods for decades. Here the focus is on the indispensable role of Padé approximants for analytic continuation of complex functions, expressed as power series, beyond the boundary of convergence of the series. The zero-pole distribution of these rational approximants serves as a proximity index to voltage collapse. Finally the mathematical underpinnings of this framework, namely the Stahl’s theory and the rate of convergence of Padé approximants are explained. Index Terms—AC power flow, voltage control, exponential load model, power flow feasibility, saddle-node bifurcation, algebraic curves, analytic continuation, monodromy, continued fractions, Padé approximants, reduced Gröbner basis, Stahl’s compact set. I. I NTRODUCTION Power flow, the most fundamental concept in power system engineering, is at the heart of studies ranging from daily operation to long-term planning of electricity networks. The AC power flow problem is a system of nonlinear algebraic equations that mathematically models the steady-state relations between the phasor representation of parameters and unknown states in an AC circuit. The parameters typically consist of the power generated and consumed by source and sink nodes and the electrical properties, i.e. the impedance, of lines that connect these nodes. The unknown states are primarily voltage phasors but could also include continuous or discrete variables associated with network controllers, e.g. FACTS devices and tap-changing or phase-shifting transformers. The accurate and reliable determination of these states is imperative for control and thus for efficient and stable operation of the network. In certain studies it is equally vital to determine for which parameter values the power flow problem becomes infeasible as this condition is intimately linked to saddlenode bifurcation and the voltage collapse phenomenon where the system loses structural stability [3]–[5]. The concept of structural stability is only applicable to dynamical systems [6], [7]. However as demonstrated previously in the context of the differential-algebraic equations that model a power system, the analysis of the static model, i.e. the algebraic equations, is sufficient to determine where exactly in the parameter space the system loses structural stability. The dynamical model of load and generators are only needed to capture oscillatory instability phenomena, such as Hopf bifurcation, that can arise from the interaction of generators and their controllers with the network [8]. Thus the distance in the parameter space to power flow infeasibility might be1 regarded as the margin of voltage stability [5]. Voltage collapse and bifurcation is certainly one of the most theoretical areas in electrical engineering. As conventional power systems undergo a fundamental transformation by large-scale highly-variable wind and solar generation distributed across the network, this field may experience a resurgence [9]. Given the inherent limitations of traditional methods, deeper understanding of these complicated phenomena requires new theoretical approaches rooted in complex analysis and algebraic geometry. The basis of power flow is Kirchhoff’s current law which states that for every node i in N , the set of all nodes, Ii , the net current flowing out of that node, is related to its voltage Vi and those of its adjacent nodes Vk in the following way: Ii = X Iik = k∈N (i) X X Vi − Vk Vk Yik = Zik k∈N (i) (1) k∈N [i] N (i) and N [i] are the open and closed neighborhoods of node i. Iik is the current flow through the line connecting node i and k and Zik = Rik + jXik is the impedance of that line which is used to construct the diagonal and off-diagonal elements of the admittance matrix as, X 1 1 Yii = , Yik = − (2) Zik Zik k∈N (i) Since complex power is Si = Pi + jQi = Vi Ii∗ , the power flow problem in its complex form can be expressed as, X Vi∗ Vk Yik ∀i ∈ N − {r} (3) Si∗ = k∈N [i] Here r is the voltage reference node with |Vr | = constant and arg(Vr ) = 0. It also serves as the slack node meaning that Sr is a free parameter that accounts for the mismatch of complex power and its losses throughout the network. The numerical methods, developed historically to solve this problem, take the polynomial system of (3) out of its complex form by reformulating it in rectangular or polar forms. These techniques, all based on Newton’s method or its variants, iteratively linearize the equations and approximate the solution, starting from an initial guess. There are two inherent shortcomings in such methods that can arise near the feasibility boundary of (3) characterized by the saddle-node bifurcation manifold in its parameter spaces. 1 As demonstrated in Part II of this paper, the power flow feasibility and saddle-node bifurcation boundaries are not necessarily equivalent. In that case, the power flow would be still feasible, albeit with a non-physical solution, beyond the closest saddle-node bifurcation. Physically, proximity to the feasibility boundary corresponds to a network operating close to its loadability limit such as periods of peak electricity demand. The first issue is the increased likelihood of non-convergence even though the operating point is still feasible. The second issue near the feasibility boundary where different algebraic branches coalesce is convergence to solutions that lie on other algebraic branches. Although dependent on the dynamical model of the physical system, these solutions in power systems typically signify unstable [5] or low voltage [10] operating points. Most of these operating points cannot be physically realized and are thus false solutions. The region of initial guesses in Newton’s method that converge to a particular solution has a fractal boundary [11]. The multiple fractal domains of convergence are pressed together near the bifurcation manifold which explains erratic behavior of such methods in finding the desirable, i.e. stable, solution even with seemingly reasonable initial guesses. Recently a semidefinite relaxation of rectangular power flow has been reformulated as a special case of optimal power flow where the objective function of the semidefinite programming (SDP) is minimizing active power loss [12]. This addresses the convergence failure of iterative methods but has its own serious drawbacks. First, the relaxation may not be tight and yield a high rank matrix where it is impossible to recover any solution to the original power flow, let alone the desirable one. Second, if the solution of the relaxed problem is high rank, nothing can be concluded on the feasibility of the power flow in the same vein as non-convergence of iterative methods cannot rule out the existence of solutions. Third, the suggested heuristic, i.e. active power loss minimization, does not always find the stable solution branch. The first two problems can be remedied, at least in theory, by obtaining higher-order and thus tighter relaxations of power flow equations. The computation cost however, explodes with the order of relaxation and the number of variables. Reference [13] discusses the theoretical underpinning of this approach in the context of the generalized moment problem and highlights its connection to real algebraic geometry which we see as an obstacle to distinguishing the desirable solution branch for algebraic systems. Among the above issues, the challenge of finding the solution on the desirable branch, more than anything else, underlines the significance of embedding the power flow problem in the complex plane where the extraordinary potentials of analytic continuation theory for multi-valued complex functions can be tapped. This is pioneered by the idea of holomorphic embedding load flow (HELM) which builds on the fact that under no load/no generation (Si = 0 ∀i ∈ N ), the network has a trivial non-zero solution for voltage phasors. This corresponds to all currents Iik being zero and reference voltage Vr propagated across the network and this trivial solution characterizes the stable branch2. Analytic continuation of this solution (or more accurately speaking, the germs developed at z = 0) is guaranteed by monodromy theorem to yield the desirable solution all the way to the saddle-node bifurcation in the parameter space of (3) where there is a non-trivial monodromy (Appendix) and the physical solution ceases to exist. 2 These concepts are explained more concretely in Part II of this paper. Although the idea of HELM has aroused significant interest in the power system community, it still needs much further development before it can prove its superiority over conventional methods. Here we demonstrate how the magnitude of power flow complex variables, considered as functions of a single complex variable z, can be held fixed while preserving the framework of holomorphicity. This is an important step in the embedding of power flow as it models the action of network controllers in the complex plane. Under stressed conditions, i.e. near the feasibility boundary, voltage magnitudes tend to deviate far below their nominal values. Hence the modelling of voltage-dependent or more generally exponential load is another crucial aspect that is developed here. We also show the indispensable role of Padé approximants in the cases of voltage control and exponential load models. Throughout the paper we refer to this method as PA to highlight the central role of rational approximation of functions of a complex variable for recovering the power flow solution. With this abbreviation we also wish to emphasize the critical direction of research and potential challenges for further development of this method. The Part I of this paper is organized as follows. In Section II we review the main ideas of HELM as presented in the original paper [1], i.e. for the PQ buses, introduce the concept of rational approximation of analytic functions in relation to power series and continued fractions and explore the zeropole structure of Padé approximants for a 3-bus example. In Section III we introduce the mathematical static model of the most prevalent controller in the network, the automatic voltage regulator (AVR) of the generator. We demonstrate through modification of the previous 3-bus network, this time with a generator (PV bus), how the approximation of functions of a single complex variable is essential for analytic continuation of the voltage phasors with fixed magnitude. We start from the analysis of the parameterized polynomial system of equations and obtain their corresponding algebraic curves via reduced Gröbner basis method. We obtain the critical points of these curves, interpret the zero-pole structure of Padé approximants and its transformation as the solution reaches the feasibility (or bifurcation) boundary and explain the significance of the zeropole distribution of the Padé approximants in terms of voltage stability margin at a given operating point. In Section IV we introduce an alternative approach for modelling the voltage magnitude constraints. In Section V we address the shortcomings of a previous formulation in the literature that attempts to incorporate the PV buses into the general framework of HELM. In section VI we introduce the exponential load model and its special case the ZIP load. In the Appendix we explain the mathematical underpinning of this paper including the concept of germ and the monodromy of multi-valued algebraic functions in relation to the Stahl’s theory. We also explain the rate of convergence of Padé approximants in the context of the Stahl’s maximal domain and its Green’s function. As illustrated in Section III, the method of embedding the equations and the resulting structure of the analytic arcs (branch cuts) has implications for the rate of convergence of Padé approximants and may hinder the effective analytic continuation of the developed germs. The numerical values of power flow variables and parameters presented in this paper are all in per unit. II. E MBEDDING S YSTEM OF E QUATIONS C OMPLEX P LANE THE IN THE Consider the following parametrization of complex power flow equations in terms of z ∈ C with Vi∗ replaced with independent variables Wi , X Wi Vk Yik ∀i ∈ N − {r} (4a) zSi∗ = k∈N [i] zSi = X Vi Wk Yik∗ k∈N [i] ∀i ∈ N − {r} (4b) From a geometric point of view, the 2n equations of (4) define generically an affine algebraic curve in (z, V1 , V2 , ..., Wn ). It follows from the Kirchhoff’s current law and the existence of the voltage reference node (with Vr appearing in (4) as a parameter) that the polynomials P on the right side of (4a)-(4b) P (i.e. k∈N [i] Wi Vk Yik and k∈N [i] Vi Wk Yik∗ ∀i ∈ N − {r}) are algebraically independent. To establish this algebraic independence in relation to the reference node requires rigorous analysis, a task which lies outside the scope of this paper. Taking the algebraic independence of these polynomials for granted, degenerate cases where the equations of (4) define not an algebraic curve but a higher-dimension algebraic variety can only arise when the power flow problem is ill-defined as in the case of networks with disconnected graphs. This is in line with the physical intuition that in the absence of a reference voltage, voltages are floating and a given Vi can assume any value in C. The equations of (4) generate an ideal and give a starting basis for finding the corresponding reduced Gröbner basis [14]. For any lexicographic order, such as ... > Vi > z, this gives a last basis element which is a bivariate polynomial fi (Vi , z) for well-defined problems. fi (Vi , z) = 0 can be solved for an algebraic (multi-valued) function Vi = Vi (z) which has holomorphic branches where ∂fi (Vi , z)/∂Vi 6= 0. By permuting the order, we arrive at 2n algebraic functions Vi = Vi (z), Wi = Wi (z), i = 1, ..., n, giving an algebraic parametrization of the curve defined by (4). A z-critical point of this curve will be where any of the components Vi (z) or Wi (z) has a branch point, i.e., fi (Vi , z) = 0 and ∂fi (Vi , z)/∂Vi = 0 (similarly for the Wi ) [15]. The branch point closest to the point z0 at which the Taylor series expansion of any single-valued branch is developed, determines the radius of convergence of the series. Branch points play a critical role in the analytic continuation of these functions and the PA method (Appendix). This analysis also extends to the case of voltage control where we introduce new functions V i (z), Qi (z) and Si (z). Since Vi (z) is analytic in z, (Vi (z ∗ ))∗ is also analytic in z and identical to the conjugate of Vi (z) on the real axis. Hence the solution process involves analytic continuation of the functions of a single complex variable from z = 0 to z = 1 in the following system, X zSi∗ Vk (z)Yik = ∗ ∗ (Vi (z )) k∈N [i] ∀i ∈ N − {r} (5) P∞ [i] P∞ [i] By defining Vi (z) = n=0 cn z n , 1/Vi (z) = n=0 dn z n P ∞ ∗ [i] n and 1/(Vi (z ∗ ))∗ = n=0 dn z , and requiring that ∗ ∗ (Vi (z )) 6= 0 this system is adequately described by the following set of power series relations, zSi∗ ∞ X ∞ X X cn [k] z n ) ∀i ∈ N − {r} (6a) d∗n [i] z n = (Yik n=0 k∈N [i] ∞ ∞ X X n n ( c[i] d[i] n z )( n z ) n=0 n=0 n=0 ∀i ∈ N − {r} (6b) =1 The procedure to obtain the coefficients of (6) starts by setting z = 0 in (6a). This gives the linear system of P [k] = 0 which always yields the trivial solution k∈N [i] Yik c0 [i] [i] [i] (i.e. c0 = Vr ∀i ∈ N − {r}). Next d0 = 1/c0 by setting z = 0 in (6b). The higher order coefficients are progressively obtained by solving the linear system of (7a) (∀i ∈ N − {r}) which itself is obtained by differentiating (6a) with respect to z and evaluating at z = 0 and the convolution formula of (7b). Si∗ d∗n−1 [i] = X Yik cn [k] k∈N [i] d[i] n = − [i] [i] m=0 cn−m dm [i] c0 Pn−1 ∀i ∈ N − {r} (7a) ∀i ∈ N − {r} (7b) The radius of convergence is R = limn→∞ |cn |/|cn+1 |, if the limit exists. This marks the distance from the origin to the closest branch point. Notice that when an analytic function does not have a closed-form expression as in this case, its representation as a power series expansion can be approximated by a partial sum of a finite order. Since this approximation for Vi (z) does not converge for |z| > R the analytic continuation of these complex functions toward z = 1 requires an alternative representation of these analytic functions. One such representation, with superior convergence properties, is a continued C-fraction which is approximated by truncation. The relation between these two representations is crucial for understanding Padé approximants and is described below [17], For a given power series V (z) = c0 + c1 z + c2 z 2 + ..., assume the existence of the reciprocal relation between the original series, as modified below, and a new series indexed by superscript (1) , c2 z c3 z 2 (1) (1) 1+ + + ... = (1 + c1 z + c2 z 2 + ...)−1 (8) c1 c1 Now the original power series can be expressed as, (0) c1 z (9) c0 + c1 z + c2 z 2 + ... = c0 + (1) (1) 1 + c1 z + c2 z 2 + ... Next assume the existence of another reciprocal relation between the modified series from the denominator of the fraction in (9) and a new series indexed by superscript (2) , (1) 1+ c2 z (1) c1 (1) + c3 z 2 (1) c1 (2) (2) + ... = (1 + c1 z + c2 z 2 + ...)−1 (10) This allows the expansion of the denominator of (9) in terms of another fraction, (0) c1 z c0 + c1 z + c2 z 2 + ... = c0 + (1) c1 z 1+ (2) (2) 1 + c1 z + c2 z 2 + ... (11) By successively forming the reciprocal series we obtain a C-fraction, written in a compact form as, (2) Bus 2 S2 −0.20−j0.10 (0) 1 (1) (c0 (c1 (2) (13) (0) Bus 3 (Reference) V3 =1.00 0 (0) (2) + c1 ) + c1 )z + c1 c1 z 2 (1) (2) 1 + (c1 + c1 )z (1) (2) where c1 = c1 , c1 = −c2 /c1 and c1 = (c22 −c1 c3 )/(c1 c2 ). The diagonal Padé approximant of degree M of V (z), hereafter appearing frequently in the text, is the (2M +1)th convergent of its C-fraction representation in (12), A2M (z) PA[M/M ]V (z) = (14) B2M (z) In general a given analytic function can be approximated by PA[L/M ](z) where L and M are not necessarily equal, L+M X 00 j1. (0) c0 + (c0 c1 + c1 )z A2 (z) = , (1) B2 (z) 1+c z c0 + A3 (z) = B3 (z) 1 L Fig. 1: 3-bus network with no voltage magnitude constraint 1.4 1.2 1 0.8 0.6 0.4 0.2 0 a0 + a1 z + ... + aL z + O(z L+M+1 ) (15) b0 + b1 z 1 + ... + bM z M −0.2 Setting b0 = 1, the denominator coefficients b1 , ..., bM are obtained by cross-multiplying (4), equating the coefficients of z L+1 ,z L+2 ,...,z L+M to zero and solving the resulting linear system. Next the numerator coefficients a0 , a1 , ..., aL are obtained similarly by considering the coefficients of z 0 ,z 1 ,...,z L. Now consider the network of Figure 1 where the per-unit values of power flow parameters are shown and the unknown states are voltage phasors V1 and V2 . The Taylor series for V1 (z) and V2 (z) are obtained based on (7) which are then used to compute the Padé coefficients. The concentration of zeros (o) and poles (∗) of the diagonal Padé approximant, shown in Figure 2, defines the closest common branch point of V1 (z) and V2 (z) at zb ≈ 1.2 which is also given by Fabry’s theorem [19] as zb = limn→∞ cn /cn+1 . Note that the branch point is the common limit point of the sequences of zeros and poles (See the discussion of the Stahl’s compact set in the Appendix). A closer inspection of the zeros and poles reveals the exact location of the branch point at 1.21510. This means that if the loading in the network is increased by this factor the new operating point is infeasible. When the loading is increased by 1.21509, PA[100/100] recovers the solution of the network with active and reactive power mismatches smaller than 10−5 . Here, as it is often the case for the class of problems in (5), i.e. for networks with only PQ buses and a voltage reference, analytic continuation of the germs by rational approximation is unnecessary as all the power series already converge at z = 1 (highlighted as a red dot) and thus are sufficient for computing V1 and V2 . However, Padé approximants are much more efficient for evaluating these functions as they converge to a given function at a much −0.8 n=0 cn z n = S1 −0.10−j0.00 0+ 1.0 By truncating the C-fraction in (12) we obtain its convergents which are rational fractions in z. For example the first 4 convergents of (12) are given as, A0 (z) A1 (s) (0) = c0 , = c0 + c1 z, B0 (z) B1 (z) (1) Bus 1 0.20 + j0.30 j1. 00 (1) c1 z c1 z c1 z 1 + 1 + 1 +... (12) 0.8 0+ (0) c0 + c1 z + c2 z 2 + ... = c0 + higher rate than the original power series does [19] and can also discover the analytic structure of a given multi-valued function [20]. −0.4 −0.6 −1 −1.2 −1.4 −1.4 −1.2 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 Fig. 2: Zero-pole distribution of PA[100/100] corresponding to the network of Fig. 1 III. E MBEDDING THE VOLTAGE M AGNITUDE C ONSTRAINTS IN THE C OMPLEX P LANE3 For a generator node i ∈ G ⊂ N , the real (active) power output, Pi = Re(Si ), is fixed whereas the imaginary (reactive) power, Qi = Im(Si ), is a free parameter which is adjusted so as to fix the magnitude of the voltage phasor Vi at a given setpoint value Mi . Extending the general framework of the holomorphic embedding to this case is particularly challenging as here the magnitude of a holomorphic function, Vi (z), is to be held fixed. Such a function has to be constant by the open mapping theorem [18] as the image of Vi (z) in the complex plane is a subset of a circle and thus Vi can no longer be an open map. To resolve this contradiction we define an analytic P∞ [i] n function V i (z) = independently of Vi (z) for n=0 cn z i ∈ G. Note that V i (z) 6= (Vi (z ∗ ))∗ and this distinction is the essential concept behind embedding voltage constraints and allows Vi (z) to adopt the value of Vr at z = 0 with its magnitude approaching Mi as z increases. However the challenge remains as how these two independent functions 3 The modelling approaches defined here and in the following section are the improved versions and evolution of our earliest formulation in [21]. 3 Bus 2 Bus 1 |V1 |=1.00 0.20 + j0.30 G S2 −0.50−j0.30 0 1.0 +j +j 1.0 0 Re(S1)=1.00 0.8 0 0 1.0 should be related to Mi so that at z = 1, V i (z) = (Vi (z ∗ ))∗ for i ∈ G. An approach that enforces Vi (z)V i (z) = Mi2 , leaves the possibility that at z = 1 Vi (z)V i (z) = Mi2 while V i (z) 6= (Vi (z ∗ ))∗ . In other words the relaxation of V ∗ into W may not yield a tight solution for the original algebraic equations. To remedy this problem we relax V ∗ into W for a given generator node i in the following relations, X Vk∗ Yik∗ + Vi Wi Yii∗ (16a) Pi + jQi = Vi k∈N (i) ∗ (Pi + jQi ) = Wi X Vk Yik + Vi Wi Yii (16b) Bus 3 (Reference) V3 =1.00 0 k∈N (i) Vi Wi = Mi2 (16c) Note that here we have made no assumption that Qi is realvalued. Since P is real-valued, one can check that V ∗ = W if and only if Qi is real-valued, i.e. when (Pi +jQi )∗ = Pi −jQi and by equating the expressions of Q from (16a) and (16b) we reach the following identity relating Vi , Wi and Mi , X X Vk Yik + Vi Yii∗ ) = 2Pi − Mi2 Yii − Vi Vk∗ Yik∗ (17a) Wi ( k∈N (i) k∈N (i) Now if we incorporate (16) into the existing embedding framework of (4) and demonstrate that Q is algebraic in z then (17a) guarantees that the Taylor series expansion of Q has real coefficients. Consider the following parametrization of the power flow equations augmented by the generator nodes, X Wi Vk Yik ∀i ∈ N − {r} − G (18a) zSi∗ = k∈N [i] zSi = X Vi Wk Yik∗ k∈N [i] z(Pi − jQi ) = z(Pi + jQi ) = Wi ( (18b) (18c) X Wi Vk Yik ∀i ∈ G X Vi Wk Yik∗ ∀i ∈ G (18d) k∈N [i] k∈N [i] X ∀i ∈ N − {r} − G X Vi Wk Yik∗ Vk Yik + Vi Yii∗ ) = 2Pi − Mi2 Yii − Fig. 3: 3-bus network with voltage control at bus 1 and other variables associated with generator nodes such as Q and V are unambiguously defined in relation to this germ. As analytic functions their sole purpose is to facilitate the construction of Si∗ (V, Mi , Pi ). Also notice that W and V are eliminated in both (19a) and (19b) and this rules out the possibility of ghost solutions where Wi (z) 6= (Vi (z ∗ ))∗ . With this clarification we propose the following embedding for networks with generator nodes4 , X zSi∗ Vk (z)Yik = (Vi (z ∗ ))∗ k∈N [i] ∀i ∈ N − {r} (20a) z(Si (z ∗ ))∗ X Vk (z)Yik = (Vi (z ∗ ))∗ k∈N [i] X Si (z) = V i (z)Yii∗ + (Vk (z ∗ ))∗ Yik∗ Vi (z) k∈N (i) X Vk (z)Yik + Vi (z)Yii∗ ) = V i (z)( ∀i ∈ G (20b) ∀i ∈ G (20c) ∀i ∈ G (20d) k∈N (i) X Vi (z)(Vk (z ∗ ))∗ Yik∗ 2Pi − Mi2 Yii − k∈N (i) k∈N (i) k∈N (i) ∀i ∈ G (18e) Notice that in contrast to (4) here for each generator node there are three algebraically independent equations and three variables. This parameterization of power flow equations defines generically an affine algebraic curve in (z, V1 , V2 , ..., Wn , Qi , ...). Here again the reduced Gröbner basis for a lexicographic order, such as ... > Qi > z, gives a bivariate polynomial fi (Qi , z) for well-defined problems and thus it follows that Qi is a multi-valued algebraic function of z and can be represented as a power series expansion. The general principle for defining and analytically continuing a given solution germ can be summed up by reducing the system of (18) in (19). X zSi∗ Vk (z)Yik ∀i ∈ N − {r} (19a) = (Vi (z ∗ ))∗ k∈N [i] zSi∗ (V, Mi , Pi ) X Vk (z)Yik = (Vi (z ∗ ))∗ k∈N [i] ∀i ∈ G (19b) Note that a given set of voltage phasors V that satisfies (19) uniquely characterizes a germ to the expanded system of (18) Here Qi (z), by construction, has real coefficients and Si (z) = Pi + jQi (z) ∀i ∈ G. The embedding of (20) is based on the parametrization introduced in (18) and at z = 1 sufficiently determines the AC power flow relations in a network with load and generation. Notice the different embedding of (20b) and (20c). The former corresponds to (19b) and in combination with (20a) is used to develop the germ of the stable branch and ensures that Vi (z) has the trivial solution Vr at z = 0. The latter constructs Si (z) = Pi + jQi (z) based on the relation that is enforced between Vi (z) and V i (z) in (20d). Thanks to this unique construction of Qi (z) and subsequently Si (z) one can easily inspect that the combination of (20b) and (20c) enforces V i (z) = (Vi (z ∗ ))∗ at z = 1 and as such we succeed in implementing the reduced system of (19) while enforcing the voltage magnitude and active power constraints of the generators. The resulting algebraic system is adequately described by the following set of power series relations, 4 There are a number of minor variations to this specific formulation that might be more advantageous from a computational point of view. We chose this formulation as it was simpler to mathematically justify the key condition of V i (z) = (Vi (z ∗ ))∗ at z = 1. ∞ ∞ X X X zSi∗ d∗n [i] z n = (Yik cn [k] z n ) ∀i ∈ N−{r}−G n=0 n=0 k∈N [i] ∞ ∞ ∞ X X [i] X X z( g ∗ n z n )( d∗n [i] z n ) = (Yik cn [k] z n )∀i ∈ G n=0 n=0 k∈N [i] n=0 ∞ ∞ X X n n ( c[i] d[i] ∀i ∈ N − {r} n z )( n z )= 1 n=0 n=0 ∞ ∞ ∞ X X X X n ( (Yik cn [k] z n ) + Yii∗ cn [i] z n ) = c[i] n z )( n=0 n=0 n=0 k∈N (i) ∞ ∞ X X X Mi2 Yii − 2Pi + (Yik∗ c∗n [k] z n )( cn [i] z n )∀i ∈ G n=0 n=0 k∈N (i) ∞ ∞ X X n ( gn[i] z n )( d[i] n z ) = n=0 n=0 ∞ ∞ X X X ∗ n (Y c∗n [k] z n ) ∀i ∈ G c[i] z + Yii∗ ik n n=0 k∈N (i) n=0 (21a) (21b) (21c) (21d) (21e) [i] The key coefficients cn (∀i ∈ N − {r}) are progressively obtained by differentiating (21a) and (21b) with respect to z, evaluating at z = 0 and solving the resulting linear system [i] [i] [i] which itself requires the prior knowledge of dm , cm and gm for m = 1, ..., n − 1. These coefficients are already obtained at previous stages. Once this linear system of size |N | − 1 [i] [i] is solved for cn (∀i ∈ N − {r}), cn (∀i ∈ G) are obtained [i] from (21d). Then we can compute g n (∀i ∈ G) from (21e) and repeat the previous steps to obtain the next set of coefficients. [i] [i] [i] [i] Notice that by construction g0 = Pi +jq0 and gn = jqn for n > 1 where q [i] , the coefficients of Qi (z), are real-valued. It is straightforward to enforce the reactive limit of a generator node i which changes (Si (z ∗ ))∗ to Si∗ in (20b) and removes the corresponding equations in (20c)-(20d). Accordingly the corresponding power series on the left side of (21b) is replaced by (21a) and the ones in (21d) and (21e) are eliminated. Now consider the modified network of Figure 3 where bus 1 has a generator that regulates its voltage magnitude at 1.00 and generates P1 = 1.00. Consider the embedding of (24). ∗ ∗ ∗ z(P1 + jQ1 ) = V1 (W1 Y11 + W2 Y12 + V3∗ Y13 ) z(P1 − jQ1 ) = W1 (V1 Y11 + V2 Y12 + V3 Y13 ) (24a) (24b) ∗ ∗ ∗ P1 + jQ1 = V1 (V 1 Y11 + W2 Y12 + V3∗ Y13 ) (24c) ∗ V 1 (V2 Y12 + V3 Y13 + V1 Y11 )= 2 ∗ ∗ 2P1 − M1 Y11 − V1 (W2 Y12 + V3∗ Y13 ) ∗ ∗ ∗ ∗ zS2 = V2 (W1 Y12 + W2 Y22 + V3 Y23 ) zS2∗ = W2 (V1 Y12 + V2 Y22 + V3 Y23 ) (24d) (24e) (24f) Here z is the embedding parameter and the unknown states are (V1 , W1 , V2 , W2 , V 1 , Q1 ). All other quantities are parameters of the power flow problem. Notice that (24a)-(24d) represent the embedding of the power flow relations of bus 1 (PV) with (24c)-(24d) modeling the action of the generator AVR in the complex plane enforcing |V1 | = |V 1 | = M1 at z = 1. Equations (24e)-(24f) correspond to the power flow relations of bus 2 (PQ). From a geometric point of view, the algebraically independent equations of (24) define an affine algebraic variety of dimension 1, i.e. an algebraic curve in (z, V1 , W1 , V2 , W2 , V 1 , Q1 ). There is a polynomial ideal I ⊂ C[z, V1 , W1 , V2 , W2 , V 1 , Q1 ] corresponding to this algebraic variety and the equations of (24) are only one basis, among many different bases, that generate I [14]. These equations can be the starting basis for finding the corresponding reduced Gröbner basis of I with the unique property that for a given lexicographic (lex) order, such as ... > V1 > z, the last element of this special basis is a bivariate polynomial f (V1 , z). The elements of the reduced Gröbner basis have a triangular structure in terms of the appearance of the unknown states and z and, as such, the algorithms for obtaining this special basis are the nonlinear generalization of the Gaussian elimination in linear algebra. To highlight the significance of this analysis for voltage collapse studies let us compute f (V2 , z) first for the set of power flow parameters shown in Figure 3 and next for when the power flow reaches its feasibility boundary at P1 = 2.6785. The coefficient matrices these two bivariate polynomials P6 ofP 6 which have the form i=0 k=0 aik V2i z k are shown in (22) and (23) respectively. Note that the rows of the matrices correspond to (1, V2 , V22 , ..., V26 ) and the columns correspond to (1, z, z 2, ..., z 6 ). So the element in the ith row and the kth column is the coefficient of V i−1 z k−1 . We can recover all solutions of the power flow by simply setting z = 1 and solving for the roots of the resulting univariate polynomial in V2 . This will include all valid solutions of V2 as well as solutions where V2 6= W2∗ . By evaluating the next basis element at z = 1 and a given solution of V2 we can obtain the numerical value of the next unknown in the lex order, for example V1 if the lex order was chosen as ... > V1 > V2 > z. This value of V1 corresponds to that particular solution of V2 . However this is not the focus of our paper. The critical points of the projection of these algebraic curves onto C, the extended complex plane, are where ∂fi (Vi , z)/∂Vi = 0. A subset of these so-called z-critical points [15] for the two cases of P1 = 1.0000 and P1 = 2.6785 are shown in Table I. These points, as explained later, are the branch points of power flow variables, considered as analytic functions of a single complex variable, i.e. z and play an important role in the analytic continuation of the germ from a trivial solution to the actual power flow solution and contain vital information on the voltage stability margin of the operating point. However there is absolutely no need to compute the reduced Gröbner basis in order to locate these branch points in C. In fact computation of these basis is exponential space complete [16] and requires time that is at least exponential in the number of solutions of the polynomial system. Hence there is little prospect in the near future for applying the concept of reduced Gröbner basis to industrial power flow studies. Instead we develop the germs of the unknown states (V1 , V2 , V 1 , Q1 ), according to (21). Figure 4 shows the zeropole distribution of the diagonal Padé approximant for V1 (z) forming the Stahl’s compact sets corresponding to the network of Figure 3 for P1 = 1.0000 (Figure 4a) and P1 = 2.6785 (Figure 4b). Notice that the analytic arcs (branch cuts) of voltage phasors are highlighted by the distribution of zeros (o) and 0 0     0.00106−0.00018i   0.00065−0.00842i  −0.03691+0.00834i   0.03275+0.16840i  0.27347−0.00447i 0 0.00251−0.00171i 0 0.06219−0.04894i 0 0.07360−0.19166i 0 0 0.10368+0.00834i −0.04226−0.04332i 0.01831−0.02968i −0.05020−0.56373i −0.46670−0.47703i 0.38542−0.41374i −0.22562+0.08679i −0.03951−0.10721i −1.53037+0.00275i −0.93086+1.70712i −0.68418−1.05204i −0.19620+0.26933i 0.72469+3.04445i 3.55535−1.19261i −0.91634+0.33716i 0.01889+0.58108i 0.33003+0.12123i 0.61071+0.63059i 1.58947−2.87746i −2.37011−1.93190i −0.48693−1.03924i −1.37499+0.56371i 0.15033+0.76564i 0.11278+0.83042i 0.00650−0.14824i 0.08156−0.12479i 0 0 0 −0.27099−0.16367i −0.22579+0.38863i 0.29999+0.04936i 0 0 0    0.00012+0.00009i   0.00091−0.00078i  −0.00452−0.00286i  −0.01357+0.02012i  0.02779+0.02690i 0.00058+0.00030i 0.00681−0.00255i 0.01500+0.00427i 0.09960−0.01779i −0.00130−0.00754i −0.01718+0.11334i 0 0 0.31730−0.43239i 0.45355−0.23719i 0.67023+0.07099i 0.03391−0.03513i 0.25444+0.19442i 0 0.01547−0.01417i 0 0 0 TABLE I 2.5742 −0.8496 −0.3672+0.6263i −0.3672−0.6263i −0.4644+1.2672i −0.4644−1.2672i   0.04075−0.04565i   0.01180−0.06678i   0  0 0 0 0.18759+0.15906i −1.14552−0.28566i −0.26170+0.94492i P1 = 1.0000 0.02509−0.00623i  0  0.03594−0.05669i −0.02112+0.10596i 0.02158−0.06639i −0.00479+0.00533i   0.14498−0.10685i 0.07458+0.50024i −0.00671−0.34180i 0.03068+0.01416i  0.19685+0.00828i 0.39108+0.66032i −0.20047+0.44572i 0.35001+0.33909i −1.13221+0.70117i 0.54878+0.53354i −0.24357−0.30435i −0.37291+0.24887i −0.01073−0.04347i −0.06144+0.01628i 0.02506+0.03494i Branch Points zB z1 z2 z3 z4 z5 z6 z7  (22) 0  0 0 0.00019+0.00524i  P1 = 2.6785 Bifurcation 1.0000 −0.2266 −0.6170+1.1219i −0.6170−1.1219i 0.7611+0.9593i 0.7611−0.9593i 0.9638+0.2129i 0.9638−0.2129i poles (∗) of the truncated C-fraction, i.e. Padé approximant. The points of infinite density of the zeros and poles are exactly (within 5 decimal digits for PA[1000/1000]) the branch points (cf. Table I) of V1 (z) which, in this case, are common with V 1 (z), V2 (z) and Q1 (z). These branch points are a subset the z-critical points of the algebraic curve that we computed earlier as the last element of reduced Gröbner basis of the polynomial system of (24). An analytic arc emanates from each branch point and culminates in a different branch point or in a Chebotarev’s point of the Stahl’s compact set. The region of convergence is a disk bounded by the closest branch points, a pair of complex conjugate points at zb = −0.3672±j0.6263. In contrast to the previous case where the region of convergence of the series contained z = 1, here, the concept of analytic continuation by Padé approximants is elegantly illustrated. Since limn→∞ |cn+1 |/|cn | ≈ 1.4, the coefficients tend to explode rapidly. Without Padé approximants based on these otherwise useless coefficients, it is impossible to recover the power flow solution. Figure 4b shows the transformation of the Stahl’s compact set as the power flow solution reaches the feasibility boundary at P1 = 2.6785. The branch point on the positive real axis has now moved to z = 1. Since past the branch point, there is a non-trivial monodromy, examining the PA solutions, as the degree of the diagonal Padé approximants is increased, reveals whether the power flow problem has a stable solution or not. This procedure is shown concretely in sections V and VI. The location of this branch point can also serve as a proximity index to the feasibility boundary where the saddle- 0.06940−0.00611i   0.02803−0.02035i   0 0 (23) node bifurcation, i.e. loss of structural stability, occurs. It is worth mentioning that the power flow is still feasible at P1 = 2.6785 and the PA method recovers the solution whereas Newton-Raphson method fails to converge for P1 > 2.6750. IV. A N A LTERNATIVE A PPROACH TO E MBEDDING THE VOLTAGE M AGNITUDE C ONSTRAINTS IN THE C OMPLEX P LANE In Section III we essentially constructed Si∗ (V, Mi , Pi ) (∀i ∈ G) to be incorporated into (5). This involved, at each stage, a matrix-vector multiplication to obtain the coefficients of voltage phasors V which were subsequently used to obtain the coefficients of V i and later the real-valued coefficients of Qi (∀i ∈ G). The matrix dimension for developing the power series expansion of voltage phasors was the same as the number of load and generator nodes, i.e. |N |−1. An alternative approach is to develop the power series expansion of V , V and Q simultaneously. For Q to have real-valued coefficients, the auxiliary variables V are extended to load nodes, in contrast to the previous approach which V was exclusively defined for generator nodes. The embedded equations take the following form, X zSi∗ Vk (z)Yik = ∗ ∗ (Vi (z )) k∈N [i] ∀i ∈ N − {r} (25a) X z(Si (z ∗ ))∗ Vk (z)Yik = ∗ ∗ (Vi (z )) ∀i ∈ G (25b) X zSi = V k (z)Yik∗ ∗ ∗ (V i (z )) k∈N [i] ∀i ∈ N − {r} (25c) X zSi (z) V k (z)Yik∗ = ∗ ∗ (V i (z )) k∈N [i] ∀i ∈ G (25d) k∈N [i] Vi (z)V i (z) = Vr2 + z(Mi2 − Vr2 ) ∗ ∗   0 ∀i ∈ G (25e) where Si (z) = Pi + jQ(z) and (Si (z )) = Pi − jQ(z) in (25b) and (25d) with Qi (z) coefficients being real-valued a fact that follows from the symmetry of embedded equations (25a) through (25d) in combination with (25e) which 2 1.5 4 1 2 0.5 1 0 B −0.5 3 −1 5 −1.5 −2 −4 −3.5 −3 −2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 (a) The Stahl’s compact set when the operating point is far from the power flow feasibility boundary (P2 = 1.0000). 2 1.5 2 1 4 0.5 6 1 0 B 7 −0.5 −1 5 3 −1.5 −2 −4 −3.5 −3 −2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 (b) Transformation of the Stahl’s compact set when the operating point is precisely on the feasibility boundary (P2 = 2.6785) Fig. 4: Zero-pole distributions of PA[1000/1000] depicting the Stahl’s compact set, i.e. the analytic structure and the common branch points of V1 (z), V 1 (z), V2 (z) and Q2 (z) (corresponding to the network of Fig. 3). 0.5 0 −0.5 −1 −0.5 0 0.5 1 1.5 2 Fig. 5: Zero-pole distribution of PA[1000/1000] depicting the Chebotarev’s point reaching z = 1 at bifurcation point (corresponding to Fig. 3 and the approach defined by (27a)) enforces a complex-conjugate relationship5 between the coefficients of V i (z) and those of Vi (z). Note that at z = 0 Vi (z) = V i (z) = Vr and this characterizes the unstressed (zero-current) state of the network. The resulting algebraic system is adequately described by the following set of power series relations, ∞ ∞ X X X zSi∗ d∗n [i] z n = (Yik cn [k] z n ) ∀i ∈ N−{r}−G (26a) n=0 z( ∞ X n=0 n=0 ∞ X k∈N [i] n=0 ∞ X n=0 k∈N [i] n=0 ∞ X X ∗ [i] dn z n = (Yik∗ zSi z( n=0 k∈N [i] ∞ ∞ X X X n ∗ [i] n (Y cn [k] z n )∀i ∈ G (26b) z )( d z ) = g ∗ [i] ik n n cn [k] z n ) ∀i ∈ N−{r}−G (26c) n=0 ∞ ∞ X X X ∗ [i] gn[i] z n )( dn z n ) = (Yik∗ cn [k] z n ) ∀i ∈ G (26d) n=0 k∈N [i] n=0 ∞ ∞ X X ( cn [i] z n )( cn [i] z n )=Vr2 + z(Mi2 − Vr2 ) ∀i ∈ G (26e) n=0 ∞ X ( n=0 ∞ X ( n=0 n=0 n c[i] n z )( ∞ X n=0 ∞ X n c[i] n z )( n d[i] n z )= 1 [i] dn z n ) = 1 n=0 [i] [i] ∀i ∈ N − {r} (26f) ∀i ∈ N − {r} (26g) [i] The coefficients cn and cn (∀i ∈ N−{r}) and gn (∀i ∈ G) are progressively obtained by differentiating (26a) through (26e) with respect to z, evaluating at z = 0 and solving the resulting linear system which itself requires the prior [i] [i] [i] [i] [i] knowledge of cm , dm , cm , dm and gm for m = 1, ..., n−1, already obtained at previous stages. This involves matrix-vector multiplication with the size of matrix being 2|N | + |G| − 2 (Contrast with |N |−1 in Section III). Notice that here, similar [i] [i] to the previous approach defined in (21), g0 = Pi + jq0 and [i] [i] gn = jqn for n > 1 where q [i] , the coefficients of Qi (z), are real-valued. The distinction between this approach and the one proposed earlier in Section III is primarily related to the required degree of Padé approximants to achieve a certain level of solution accuracy. We have noticed in all cases examined so far that with the exception of a few this alternative approach requires lower degrees of Padé approximants. However, the advantage of the first method is the smaller dimension of the matrix used in developing the voltage phasor power series. This dimension is expected to be critical for the computational performance of the embedding method on extremely large networks. The Padé degree requirement of each of these two approaches will be examined in the context of medium and large-scale networks in Part III of this paper. V. A P ROBLEM WITH A PREVIOUSLY PROPOSED APPROACH Previously, a different approach to modeling PV (generator) nodes was proposed that eliminates reactive power by manipulating the power flow equations of the generator node in the 5 This condition can be exploited to enhance the computational performance of this approach and we will explain this in a future publication on the computational aspects of different embedding approaches. following way [22], X X Yik∗ Vk∗ Yik Vk = 2Pi Vi − Vi2 Mi2 k∈N [i] (27a) k∈N [i] This formulation can be incorporated into the general framework of the holomorphic embedding for developing the germ solution. However there are two major issues with this approach. First (27a) does not adequately constrain the voltage magnitude and one can check that the analytically continued power series of the network of Figure 3, obtained based on the specific embedded form of (27a) as presented in equation (20) of reference [22], satisfies neither the voltage magnitude nor the active power constraints. So there is a need to consider V i (z). However, since reactive power is not considered, it is difficult to see how a relation similar to (20d) can be enforced in this case to guarantee V i (z) = (Vi (z ∗ ))∗ at z = 1. Even under the assumption that a stronger relation is enforced between V i (z), Vi (z) and Mi , for example V i (z)Vi (z) = Mi2 or V i (z)Vi (z) = (1 − z)Vr2 + zMi2 in the case of the network of Figure 3, there arises an even more fundamental problem. In Figure 4b we showed that the branch point on the real-axis reaches z = 1 as the system experiences saddle-node bifurcation. In the approach based on (27a) it is the Chebotarev’s point that reaches z = 1 (see Figure 5). Chebotarev’s point is a 0-density point for the equilibrium measure that is concentrated on the Stahl’s compact set. In the generic case, from each Chebotarev’s point exactly three analytic arcs emanate and each arc culminates at either another Chebotarev’s point or a branch point of f . In contrast, from each branch point of f only a single analytic arc emanates and culminates at either a Chebotarev’s point or another branch point. Thus the local structure of the Stahl’s compact set at a branch point is different from its local structure at a Chebotarev’s point. The rate of convergence of Padé approximants at a given point z declines as that point gets closer to the Stahl’s compact set and this can be explained in terms of the value of the Green’s function gS (z, 0) (see the Appendix). However this is not the unique reason for the rate of convergence to decline. The structure of the Stahl’s compact set can also cause the rate of convergence to decline. Notice the peculiar form of the analytic arcs in Figure 5 forming a pair of pincers that encompass the segment of the real axis from z ≈ 0.1 to z = 1. In particular notice the small gap at the opening of the pincers. As this gap shrinks, the value of the Green’s function for the space contained within the pincers gets smaller. No matter how large the space inside the pincers is, the small gap at the opening of the pincers causes the rate of convergence of Padé approximants to suffer drastically and this makes the effective analytic continuation of the germ impossible when the Chebotarev’s point is close to z = 1. This has implications for power flow studies near the feasibility boundary where embedding the power flow in the complex plane is most needed as other methods tend to fail. By contrasting these two approaches we intend to highlight the significance of the correct embedding approach both for efficiently solving the power flow and also for obtaining a reliable proximity index to power flow infeasibility and voltage collapse based on the zero-pole distribution of the rational approximants. VI. E XPONENTIAL AND ZIP LOAD MODELS In real systems loads are voltage dependent and their representation as constant parameters may render the power flow analysis grossly inaccurate. In this section we describe how the exponential load model and its special case ZIP load model can be incorporated into the framework of embedding the power flow in the complex plane. Exponential load model is described as, P = |V |a P0 (28a) Q = |V |b Q0 (28b) where a and b are rational constants and each can be expressed as a fraction of two relatively prime integers (m, n). Consider the following relations assuming a = b (we later relax this constraint), m V I ∗ = |V | n S0 ∗ V I = |V | m n S0∗ (29b) 2 V mn (I ∗ )mn = |V |m S0mn 2 |V |2mn I mn = |V |m V mn (S0∗ )mn (30a) (30b) m−n From (29) we have II ∗ = S0 S0∗ (V V ∗ ) n which transforms (30) into a purely phasor relation between the current, voltage and apparent power of an exponential load given as, V m (S0∗ )2n (V ∗ )2n−m (31) Now suppose a = m/n and b = r/s in (28a) then we can consider I as the sum of Ip and Iq given by, V m P02n (V ∗ )2n−m r V (−jQ0 )2s = (V ∗ )2s−r Ip2n = Iq2s (32a) (32b) One can check that the case of m = 2, n = 1 in (31) corresponds to constant-impedance load and the case of m = 1, n = 1 models constant-current load. By putting m = 0 in (31) we obtain the familiar constant-power load model. Hence the ZIP load model can be expressed as a relation between each current component satisfying (31) for its corresponding (m, n) and the net current being the sum of each component current similar to I = Ip + Iq in (32). Now that we have established the algebraic relations between the phasor quantities of various components of voltagedependent load model we can consider each component current as an algebraic function in z. The general principle is similar to the case of voltage magnitude constraint where we develop the germ of voltage phasors by constructing Si∗ (V, Mi , Pi ) for a given generator node i. Here we construct Ii (Vi , Si , m, n) which is again unambiguously defined in relation to the germ of the stable solution. The corresponding equation that should be added to (19) is as follows, z X k∈L[i] Iik (Vi , Sik , mk , nk ) = X k∈N [i] ∞ ∞ ∞ X X X ( xk z k )2 = (S0∗ )2 ( ck z k )( d∗k z k ) k=0 Vk (z)Yik ∀i ∈ E (33) k=0 (34) k=0 P∞ k The power series I(z) = is developed by k=0 xk z successive application of the concept of convolution. The coefficient xk is obtained based on cj , dj and xj for j = 1, ..., k − 1, all given from previous stages, as follows, (29a) which are equivalent to, I 2n = where L[i] is the set of load components of node i each characterized by its S0 and (m, n) and E is the set of nodes with exponential load components. Suppose a given node has a constant-current load where m = n = 1 in (31) then the corresponding power series relation is given as, (S0∗ )2 xk = k X j=0 ck−j d∗j − 2x0 k−1 X j=1 xk−j xj (35) Note that the order of power series convolution in the right side of (35) increases as m and n assume larger values in (31). Thus the corresponding formula for obtaining xk can be much more complicated. The increasing complexity is related to the partitioning of integers. For example to compute x100 , the 101st coefficient of I, for n = 7, we need to have obtained, beforehand, all partitions of integer 100 with number of parts less than or equal to 2n = 14. One such partition has only a single part which is 100 itself and its corresponding term is 2nx2n−1 x100 . All other partitions have corresponding terms 0 that are solely expressed in terms of x0 , x1 , ..., x99 , all obtained in previous stages. This task is, however, independent of the problem itself and is purely in the realm of number theory and combinatorics. In fact there are generating algorithms for these partitions [23]. All that is needed is to somehow compute and store these partitions for relevant combinations of (m, n). We expect that I coefficients are obtained quite efficiently via parallel computing when m and n are small integers but we leave these aspects, including the need for higher numerical precision, for future publications. Here we focus on the ZIP load model, especially its constant-current component. Figure 6a shows the Stahl’s compact set corresponding to the network of Figure 3 where bus 2 has a constantcurrent load, i.e. P2 = −0.50|V2 | and Q2 = −0.30|V2 |, and P1 = 1.00. The Padé approximated solution of V2 (z) and I2 (z) are 0.7795 + j0.3032 and −0.5747 + j0.0983 and hence |I2 | = |S2 | as expected. For this operating point the voltage dependency of the load enhances the stability margin as seen by the location of the branch point on the positive real axis at zb = 9.5700). This is because as the system is stressed by increased loading and as the voltage at bus 2 declines, the realized load which is proportional to voltage magnitude decreases further and further from the load at nominal voltage. This drop in the actual load is clearly beneficial for the voltage stability of the system. The situation is the opposite when the system is stressed by increasing active power generation. Under this condition where the voltage magnitude of the load is suppressed by increasing the injection of active power a voltage-dependent load would further stress the system by accentuating the effect of increased active power injection. 2 1.5 1 0.5 0 −0.5 −1 −1.5 −2 −4 −3.5 −3 −2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 9 2 9.5 10 10.5 11 (a) Zero-pole concentration forms the Stahl’s compact set highlighting the common branch points of V1 (z), V 1 (z), S1 (z) and V2 (z) (P1 = 1.00). 2 1.5 1 0.5 0 −0.5 −1 −1.5 −2 −4 −3.5 −3 −2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 (b) Transformation of the Stahl’s compact set on the feasibility boundary (P1 = 2.6785) Fig. 6: Zero-pole distribution of PA[1000/1000] depicting the analytic structure of V1 (z) (corresponding to Fig. 3) . This becomes evident by contrasting Figure 6b where bus 2 has a constant-current load and Figure 4b where bus 2 has a constant-power load. Notice that under constant-power load the network can absorb P1 = 2.6785 whereas this level of generation is no longer feasible under constant-current load as clearly shown by the analytic arc on real axis covering z = 1. This contrast highlights the significance of appropriate load models for voltage stability studies. A PPENDIX O N THE S TAHL’ S T HEORY AND THE RATE OF C ONVERGENCE OF PAD É A PPROXIMANTS Assume we are given a germ at point z0 of a multi-valued analytic function f . Typically this means that we are given the following power series, S(z) ≃ ∞ X k=0 ck (z − z0 )k (36) This is the Taylor series expansion of the analytic function developed at z = z0 and its radius of convergence might be calculated via Cauchy–Hadamard formulae as, 1 = lim |ck |1/k . R k→∞ (37) Pn Let Sn (z)= k=0 ck (z − z0 )k be a partial sum of the power series and S∞ (z) the limit of Sn (z) as n → ∞. Then f can be evaluated in the disk DR := {z ∈ C : |z − z0 | < R} as, f (z) = S∞ (z) for |z − z0 | < R (38) Now suppose that f is a multi-valued analytic function on the Riemann sphere C punctured at a finite set Σ = Σf of the remarkable points of f at least one of which is a branch point of f . Let Σ = {b1 , . . . , bp } and suppose z0 ∈ / Σ. The case when multi-valued function f is an algebraic function is of great interest to us. Function f is an algebraic of degree m if there exists an irreducible complex polynomial P (z, w) in two complex variables z and w and of degree m in w such that P (z, f (z)) ≡ 0 for z ∈ / Σ. One can invoke Cauchy’s argument principle to show that an algebraic function (assuming m > 2) is also a multi-valued analytic function. Recall that the essential idea of holomorphic embedding is to analytically continue the germ of voltage phasors from z = z0 = 0 where the power flow has a trivial stable solution to z = 1. So hereafter we assume z0 = 0. By definition, analyticity of f in the domain G := C \ Σ implies that a germ of f given at the point z = 0 might be continued analytically from z = 0 to each point z = a, a ∈ / Σ, along every path γ such that γ avoids points of the set Σ, i.e. γ ⊂ C \ Σ. Since function f is multi-valued in G, two different paths, say γ1 and γ2 , such that γ1 , γ2 ⊂ G and both of γ1 and γ2 connect the original point z = 0 with the end point z = a, might lead to two different germs f1 and f2 of f at just the same point z = a. In others words, one can obtain f1 (z) 6= f2 (z) in some neighborhood of a. This is always the case when two paths γ1 and γ2 form a closed curve γ = γ1 ∪ γ2 such that it encircles exactly one branch point bj ∈ Σ of f . This is an example of a nontrivial monodromy of the closed path γ. Now suppose that we fix some simply connected subdomain D of G such that {0, a} ⊂ D. Recall that simple connectivity means that C \ D, the complement of D, is a connected set. From this it follows immediately that for each path γ in D its monodromy is trivial. Then from the classical monodromy theorem it follows that for every two paths γ1 and γ2 which both lead from z = 0 to z = a the corresponding germs f1 and f2 are identical, i.e. f1 (z) ≡ f2 (z) in some neighborhood of the point z = a. From now on we shall restrict our attention to the case of algebraic functions only. Given a germ at z = 0 of a multi-valued analytic function f with a finite set Σ = {b1 , . . . , bp } of remarkable points, one can evaluate the function f (z) for |z| < R, where R = min{|bj |, j = 1, . . . , p}, via the equality f (z) = S∞ (z). Since the disk DR = {|z| < R} is a simply connected domain, from the monodromy theorem it follows that for each closed path γ from the disk DR its monodromy is trivial. There exists a powerful method to evaluate the analytic function via its germ, given at the point z = 0, beyond the boundary of the disk of convergence of the corresponding power series. In this method which is also classical and is based on the notion of continued fractions (to be more precise continued C-fractions), we start from the given power series and use the classical Viskovatov algorithm to obtain (under some additional assumptions of nondegeneracy of a given germ as it is generically always the case) the formal expansion, (0) S(z) ≃ c0 + c1 z + c2 z 2 + · · · ≃ c0 + c1 z (1) 1+ c1 z ≃ C(z) (2) 1+ c1 z 1 + ... (39) This classical approach of evaluating an analytic function from its germ was known, in some partial forms, since the time of Jacobi and Gauss as continued fraction expansion (or J-fraction expansion named after Jacobi). But at that time it was used to expand only special functions, in particular the hypergeometric functions. They had recognized that Jfraction expansions give the single valued continuation of a germ of a multivalued analytic function from the origin into an unknown domain which is much larger than the initial disk of convergence. Let us now consider a germ of an algebraic function f , developed at z = 0, and let Cn (z) be the n-th truncate of the C-fraction (39), i.e. (0) c1 z (40) Cn (z) = c0 + (1) c1 z 1+ (2) c1 z 1+ (n−2) c1 z .. . (n−1) 1 + c1 z Let C∞ (z) be the limit of the truncated Cn (z) as n → ∞. Then a number of fundamental problems arise around the equality (cf. (38)) f (z) = C∞ (z) (41) The main problems are as follows. In what domain D of the complex variable z and in what sense the equality (41) holds true? Since all Cn (z) functions are rational in z and thus single-valued on C, the limit function C∞ (z) is also singlevalued. This is in contrast to that fact that the initial function f is multi-valued. It is well-known that in general for each n there is a finite number of the so-called spurious zero-pole pairs of Cn (z) that do not correspond to any singularity of the given function f (and neither correspond to a pole or a zero of f ; see [24] and also [17, Chapter 2, § 2.2] and [26]). Such pairs are usually referred to as ‘Froissart doublets’. As n tends to infinity, pole and zero in such a pair come close to each other. On one hand, they cancel each other as n → ∞, but on the other, for a fixed n, they are distinct from each other and as n → ∞ they are dense everywhere on the Riemann sphere C. For a Riemann surface of genus 1 they make some kind of ’winding of the torus’. By that reason there can not be a pointwise convergence of Cn (z) to f (z) for z ∈ D, i.e. the pointwise equality f (z) = C∞ (z) in D should not be expected at all. Recall once again that for an algebraic function f the number of Froissart doublets is finite, i.e. is independent of n, and depends on f only. For example, let f be given √ by the algebraic equation (1−z 2 )w2 −1 ≡ 0, i.e. f (z) = 1/ 1 − z 2 , and let us fix the germ at z = 0 by the equality f (0) = 1. Then all zeros and poles of Cn (z) belong to the complement R \ [−1, 1] of the closed segment [−1, 1] and its inverses has the limit distribution on the segment [−1, 1] that coincide with dx 1 , x ∈ [−1, 1]. There Chebyshev measure given by √ π 1 − x2 are no Froissart doublets in that case and thus the equality f (z) = C∞ (z) holds true pointwise for z ∈ D := C \ [−1, 1]. In contrast, the equality f (z) = S∞ (z) holds true only for the unit disk, i.e. for |z| < 1. The problem of equality in (41) f (z) = C∞ (z) for an arbitrary multi-valued function with a finite set of branch points Σ = {b1 , . . . , bp } was completely solved by H. Stahl in 1985–1986 (see [29]– [33], [35] and also [20], [26]). Given a germ6 f of a multi-valued analytic function f with a finite number of branch points, the seminal Stahl’s theorem7 gives the complete answer to the problem of limit zero-pole distribution of the classical Padé approximants and the equality of C∞ to f . The keystone of the Stahl’s theorem is the existence of a unique so-called ‘maximal domain’ of holomorphy of a given multi-valued function f , i.e. a domain D = D(f ) ∋ 0 such that the given germ f can be continued as holomorphic (i.e. analytic and single-valued) function from a neighborhood of z = 0 to D (i.e. the function f is continued analytically along each path that belongs to D). ‘Maximal’ means that ∂D is of ‘minimal capacity’ (with respect to the point z = 0) among all compact sets ∂G such that G is a domain, G ∋ 0 and f ∈ H (G). Such ‘maximal’ domain D is unique up to a compact set of zero capacity. Compact set S = S(f ) := ∂D is now called the ‘Stahl’s compact set’ or the ‘Stahl’s S-compact set’ and D is called the ‘Stahl’s domain’. The crucial properties of S for the Stahl’s theorem to be true are the following: the complement D = C \ S is a domain, S consists of a finite number of analytic arcs, and finally S possesses some special property of ‘symmetry’8. From the Stahl’s theorem it follows that the limit points of the zero and pole distributions of rational functions Cn (z) as n → ∞ exists and coincides with a unique so-called probability equilibrium measure for the Stahl’s compact set S. From the numerical point of view this means, first, that zeros and poles of Cn (z) are attracted as n → ∞ to the Stahl’s compact set S. Second, they accumulate to each9 branch point bk ∈ S ∩Σ of f with a density similar to that of the Chebyshev dx for S = [−1, 1] at the end points ±1. measure π1 √1−x 2 On the Stahl’s compact set S there are also a finite number of the so-called Chebotarev’s points that do not correspond to any branch point of the initial function f and at these points the equilibrium measure of S has a zero density similar √ to that of the measure 1 − x2 dx at the end points ±1. These Chebotarev’s points are the transcendental parameters 6 That is the convergent power series at the point z = z0 . the reason of its very general character and the various subjects of complex analysis involved into the proof of the theorem, it is sometimes considered as ‘Stahl’s Theory’. 8 Compact sets of such type are usually referred to as ‘S-compact sets’ or ‘S-curves’, see [28], [27]. 9 To be more precise, to each ‘active’ branch point. All the so-called ‘inactive’ branch points are hidden on the other ‘nonphysical’ sheets of the Riemann surface of the given function; see [37]. 7 By of the problem, i.e. they can not be recovered from the branch points of a given function over elementary functions but only over transcendental functions. For example in the case of the function f (z) = (b1 − z)1/3 (b2 − z)1/3 (b3 − z)−2/3 with the three branch points b1 , b2 , b3 this means that the Chebotarev’s point v is uniquely determined from the condition that the both periods of the Abelian integral are purely imaginary: Z z r v − η dη B3 (η) η (42) Q3 where B3 (η) := j=1 (bj − η). Chebotarev’s points, jointly with the branch points of f , determine the Stahl’s twosheeted hyperelliptic Riemann surface associated with f . Thus numerically in a neighborhood of a Chebotarev’s point, zeros and poles of Cn (z) are very sparse compared to the number n. It might be concluded that zeros and poles of Cn (z) as n becomes large enough, eventually will recover numerically the complete structure of the Stahl’s compact set S and the Stahl’s domain D. Finally in the Stahl’s theorem it is proved that the equality f (z) = C∞ (z) holds true in the Stahl’s domain D = D(f ) not pointwise but ‘in capacity’. The convergence in capacity inside the Stahl’s domain D (recall that f ∈ H (D)) means that for every compact set K ⊂ D and for every small ε > 0 the following holds, cap{z ∈ K : |f (z)−[n/n]f (z)| > ε > 0} → 0, n → ∞, z ∈ D (43) where cap(·), is the logarithmic capacity [36]. The only reason for this specific mode of convergence is the existence of a finite number of Froissart doublets. In fact the truncated Cn (z) of the C-fraction in (38) gives a very good numerical approximation of f (z) in all the points z of the Stahl’s domain up to a finite number of ‘wandering’ Froissart doublets. The rate of the convergence in (43) is completely characterized by the equality cap |(f − [n/n]f )(z)|1/n −→ e−2gS (z,0) , n → ∞, z ∈ D (44) where gS (z, 0) is the Green’s function of the domain D with a logarithmic singularity at the point z = 0. gS (z, 0) is defined in relation to a given branch point bj in the following way, gS (z, 0) := Re Z z bj r v − η dη B3 (η) η (45) Thus the rate of convergence at a given point z ∈ D depends on the value of the Green’s function gS (z, 0) for the domain D ∋ 0 at that point. The closer the point z gets to the boundary S := ∂D of D, the smaller the rate of convergence becomes. In the disk DR the convergence of Cn (z) to f (z) is much faster than the convergence of partial sums Sn (z). Finally we should mention that in generic cases for an algebraic function f given by polynomial equation P (z, f (z)) ≡ 0, the corresponding Stahl’s compact set is stable under small perturbations of complex coefficients of the polynomial P . R EFERENCES [1] A. Trias, “The Holomorphic Embedding Load Flow method,” Proceedings of Power and Energy Society General Meeting, 22-26 July 2012. [2] A.I. Markushevich, Theory of Functions of a Complex Variable, Translated by R.A. Silverman, 2nd Edition, American Mathematical Society, 2005. [3] V.A. Venikov, V.A. Stroev, V.I. Idelchick, and V.I. Tarasov, “Estimation of electrical power system steady-state stability in load flow calculations,” IEEE Transactions on Power Apparatus and Systems, vol.94, no.3, pp.1034-1041, May 1975. [4] P.W. Sauer and M.A. Pai, “Power system steady-state stability and the load-flow Jacobian,” IEEE Transactions on Power Systems, vol.5, no.4, pp.1374-1383, Nov. 1990. [5] I.A. Dobson, et al.,“Chapter 2: Basic Theoretical Concepts,” in Voltage Stability Assessment: Concepts, Practices and Tools, IEEE-PES, 2002. [6] A.A. Andronov, A.A. Vitt and S.E. Khaikin, Theory of Oscillators, (Translation from Russian), Pergamon Press, 1966. [7] V.I. Arnold, Geometrical Methods in the Theory of Ordinary Differential Equations, (Translation from Russian), Springer-Verlag, 1983. [8] I. Dobson, “The irrelevance of electric power system dynamics for the loading margin to voltage collapse and its sensitivities,” Bulk power system voltage phenomena III, voltage stability, security & control, ECC/NSF workshop, Davos, Switzerland, August 1994 [9] S.S. Baghsorkhi, “Computing Saddle-Node and Limit-Induced Bifurcation Manifolds for Subtransmission and Transmission Wind Generation,” Proceedings of the IEEE Power and Energy Society General Meeting, Denver, CO, July 2015. [10] P.W. Sauer, B.C. Lesieutre and M.A. Pai, “Maximum Loadability and Voltage Stability in Power Systems,” International Journal of Electrical Power and Energy Systems, vol. 15, pp.145-154 1993. [11] J.S. Thorp and S.A. Naqavi, “Load-flow fractals draw clues to erratic behavior,” IEEE Computer Applications in Power, pp. 59-62, Jan. 1997. [12] D.K. Molzahn, “Application of Semidefinite Optimization Techniques to Problems in Electric Power Systems,” Ph.D. Dissertation, University of Wisconsin-Madison, Department of Electrical Engineering, August 2013. [13] J.B. Lasserre, Moments, Positive Polynomials and Their Applications, Imperial College Press, 2010. [14] D. Cox, J. Little and D. O’Shea, Ideals, Varieties, and Algorithms, 3rd Edition, Springer, 2006. [15] J.-D. Boissonnat and M. Teillaud, Effective Computational Geometry for Curves and Surfaces (Mathematics and Visualization), Springer, 2006. [16] K. Kuhnle and E.W. Mayr, “Exponential space computation of Gröbner bases,” Proceedings of the 1996 International Symposium on Symbolic and Algebraic Computation (ISAAC96), pp 63-71. ACM Press, New York (1996) [17] G.A. Baker and P. Graves-Morris, Padé Approximants. Cambridge University Press, 1996. [18] E.M. Stein and R. Shakarchi, Complex Analysis. Princeton University Press, 2003. [19] S.P. Suetin, “Padé approximants and the effective analytic continuation of a power series,” Russian Math. Surveys, 57:1 (2002), 43-141. [20] A.I. Aptekarev, V.I. Buslaev, A. Martinez-Finkelshtein, S.P. Suetin, “Padé approximants, continued fractions, and orthogonal polynomials,” Russian Math. Surveys, 66:6 (2011), 1049-1131. [21] S.S. Baghsorkhi, S.P. Suetin, “Embedding AC Power Flow with Voltage Control in the Complex Plane: The Case of Analytic Continuation via Padé Approximants”, 2015 , 9 pp., arXiv: 1504.03249 [22] M.K. Subramanian, F. Yang, and D. Tylavsky “PV bus modeling in a holomorphically embedded power-flow formulation,” North American Power Symposium (NAPS), pp. 1-6. 2013. [23] G.E. Andrews and K. Eriksson, Integer Partitions. Cambridge University Press, 2004. [24] M. Froissart, “Approximation de Pade: application a la physique des particules elementaires”, Recherche Cooperative sur Programme (RCP), 9, eds. Carmona, J., Froissart, M., Robinson, D.W., Ruelle, D., Centre National de la Recherche Scientifique (CNRS), Strasbourg, 1969 pages 3, 1-13. [25] A.A. Gonchar, “Rational Approximations of Analytic Functions”, Sovrem. Probl. Mat., 1, Steklov Math. Inst., RAS, Moscow, 2003, 83106; Proc. Steklov Inst. Math., 272:, suppl. 2 (2011), S44-S57 pages. [26] N.R. Ikonomov, R.K. Kovacheva, S.P. Suetin, “On the limit zero distribution of type I Hermite-Padé polynomials”, 2015, 67, arXiv: 1506.08031 pages 3. [27] Kuijlaars, Arno B.J.; Silva, Guilherme L.F., “S-curves in polynomial external fields”, J. Approx. Theory, 191 (2015), 1-37 pages 4. [28] E.A. Rakhmanov, “Orthogonal polynomials and S-curves” (Recent advances in orthogonal polynomials, special functions and their applica- tions), Contemp. Math., 578, Amer. Math. Soc., Providence, RI pages 4, 2012, 195-239. [29] H. Stahl, “Extremal domains associated with an analytic function. I”, Complex Variables Theory Appl., 4 (1985), 311-324 pages 3. [30] H. Stahl, “Extremal domains associated with an analytic function. II”, Complex Variables Theory Appl., 4 (1985), 325-338 pages. [31] H. Stahl, “Structure of extremal domains associated with an analytic function, Complex Variables Theory Appl., 4 (1985), 339-354 pages. [32] H. Stahl, “Orthogonal polynomials with complex valued weight function. I”, Constr. approx., 2 (1986), 225-240 pages. [33] H. Stahl, “Orthogonal polynomials with complex valued weight function. II”, Constr. approx., 2 (1986), 241-251 pages 3. [34] H. Stahl, “Diagonal Padé approximants to hyperelliptic functions”, Ann. Fac. Sci. Toulouse Math. (6), 1996, Special Issue, 121-193 pages. [35] H. Stahl, “The convergence of Padé approximants to functions with branch points”, J. Approx. Theory, 91:2 (1997), 139-204 pages 3. [36] E. Saff and V. Totik, Logarithmic Potentials with External Fields. Grundlehren der Matematischen Wissenschaften, 316, Springer, 1997. [37] H. Stahl, “Sets of Minimal Capacity and Extremal Domains”, arXiv:1205.3811, 2012, 112 pages.
3cs.SY
Delft University of Technology Software Engineering Research Group Technical Report Series Applying and Combining Three Different Aspect Mining Techniques M. Ceccato, M. Marin, K. Mens, L. Moonen, P. Tonella, and T. Tourwé Report TUD-SERG-2006-002 SERG TUD-SERG-2006-002 Published, produced and distributed by: Software Engineering Research Group Department of Software Technology Faculty of Electrical Engineering, Mathematics and Computer Science Delft University of Technology Mekelweg 4 2628 CD Delft The Netherlands ISSN 1872-5392 Software Engineering Research Group Technical Reports: http://www.se.ewi.tudelft.nl/techreports/ For more information about the Software Engineering Research Group: http://www.se.ewi.tudelft.nl/ c copyright 2006, Software Engineering Research Group, Department of Software Technology, Faculty of Electrical Engineering, Mathematics and Computer Science, Delft University of Technology. All rights reserved. No part of this series may be reproduced in any form or by any means without prior written permission of the publisher. SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques Applying and Combining Three Different Aspect Mining Techniques M. Ceccato1 , M. Marin2 , K. Mens3 , L. Moonen2,4 , P. Tonella1 , and T. Tourwé4 1 ITC-irst, Trento, Italy Delft University, The Netherlands 3 Université catholique de Louvain, Belgium 4 CWI, The Netherlands [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] 2 Abstract. Understanding a software system at source-code level requires understanding the different concerns that it addresses, which in turn requires a way to identify these concerns in the source code. Whereas some concerns are explicitly represented by program entities (like classes, methods and variables) and thus are easy to identify, crosscutting concerns are not captured by a single program entity but are scattered over many program entities and are tangled with the other concerns. Because of their crosscutting nature, such crosscutting concerns are difficult to identify, and reduce the understandability of the system as a whole. In this paper, we report on a combined experiment in which we try to identify crosscutting concerns in the JHotDraw framework automatically. We first apply three independently developed aspect mining techniques to JHotDraw and evaluate and compare their results. Based on this analysis, we present three interesting combinations of these three techniques, and show how these combinations provide a more complete coverage of the detected concerns as compared to the original techniques individually. Our results are a first step towards improving the understandability of a system that contains crosscutting concerns, and can be used as a basis for refactoring the identified crosscutting concerns into aspects. 1 Introduction The increasing popularity of aspect-oriented software development (AOSD) is largely due to the fact that it recognises that some concerns cannot be captured adequately using the abstraction mechanisms provided by traditional programming languages. Several examples of such crosscutting concerns have been identified, ranging from simple ones such as logging, to more complex ones such as transaction management [1] and exception handling [2, 3]. An important problem with such crosscutting concerns is that they affect the understandability of the software system, and as a result reduce its evolvability and maintainability. First of all, crosscutting concerns are difficult to understand, because their implementation can be scattered over many different packages, TUD-SERG-2006-002 1 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques II classes and methods. Second, in the presence of crosscutting concerns, ordinary concerns become harder to understand as well, because they get tangled with the crosscutting ones: particular classes and methods do not only deal with the primary concern they address, but also may need to take into account some secondary, crosscutting concerns. Several authors have presented automated code mining techniques, generally referred to as aspect mining techniques, that are able to identify crosscutting concerns in the source code [4]. The goal of these techniques is to provide an overview of the source-code entities that play a role in a particular crosscutting concern. This not only improves the understandability of the concern in particular and of the software in general, but also provides a first step in the migration towards applying aspect-oriented software development techniques. However, since the research field is still in its infancy, very few experiments have been conducted on real-world case studies, comparisons of different techniques are lacking, and no agreed-upon benchmark is available that allows to evaluate the existing techniques. This paper reports on an experiment involving three independently developed aspect mining techniques: fan-in analysis [5, 6], identifier analysis [7, 8] and dynamic analysis [9]. In the experiment, each of these techniques is applied to the same case study: the JHotDraw graphical editor framework. The goal of the experiment is not to identify the “best” aspect mining technique, but rather to mutually compare the individual techniques and assess their major strengths and weaknesses. Additionally, by identifying where the techniques overlap and where they are complementary, the experiment allows us to propose interesting combinations and to apply these combinations on the same benchmark to verify whether they actually perform better. The JHotDraw framework which we selected as benchmark case was originally developed to illustrate good use of object-oriented design patterns [10] in Java programs. This implies that the case study has been well-designed and that care has been taken to cleanly separate concerns and make it as understandable as possible. Nevertheless, JHotDraw exposes some of the modularisation limitations present even in well-designed systems, and contains some quite interesting crosscutting concerns. The contributions of this paper can be summarised as follows: – We provide an overview of the major strengths and weaknesses of three aspect mining techniques. This information is valuable for developers using these techniques, as it can help them choosing a technique that suits their needs. Other aspect mining researchers can take this information into account to compare their techniques to ours, or to fine-tune our techniques; – We discuss how the individual techniques can be combined in order to perform better, and validate whether this is indeed the case by applying the combined techniques on the same benchmark application and comparing the results; – We present a list of all crosscutting concerns that the three techniques identified in the JHotDraw framework. Such information is valuable for other 2 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques III interface A { public void m(); } class B implements A { public void m() {}; } class C1 extends B { public void m() {}; } class C2 extends B { public void m() { super.m();}; } class D { void f1(A a) { a.m(); } void f2(B b) { b.m(); } void f3(C1 c) { c.m(); } } Fig. 1. Various (polymorphic) method calls. aspect mining researchers who want to validate their techniques, and might lead to JHotDraw becoming a de-facto benchmark for aspect mining techniques; The paper is structured as follows. Section 2 introduces the necessary background concepts required to understand the three aspect mining techniques explained in Section 3. Section 4 presents the results of applying each technique on the common benchmark, while Section 5 uses these results for discussing the benefits and drawbacks of each technique with respect to the others. Based on this discussion, Section 6 presents useful combinations of the techniques, and reports on the experience of applying such combinations on the benchmark application. Section 7 presents our conclusions. For an overview of related work concerning aspect mining, we refer to the papers discussing the individual techniques [5–9] and to an initial survey on aspect mining [4]. 2 2.1 Background concepts Fan-in The fan-in metric, as defined by Henderson-Sellers, counts the number of locations from which control is passed into a module [11]. In the context of objectorientation, the module-type to which this metric is applied is the method. We define the fan-in of a method M as the number of distinct method bodies that can invoke M . Because of polymorphism, one call site can affect the fan-in of several methods: a call to method M contributes to the fan-in of M , but also to all methods refined by M , as well as to all methods that are refining M [6]. TUD-SERG-2006-002 3 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques IV Method A.m B.m C1.m C2.m Potential D.f1, D.f2, D.f1, D.f2, D.f1, D.f2, D.f1, D.f2 callers Fan-in D.f3 3 D.f3, C2.m 4 D.f3 3 2 Fig. 2. Fan-in values for program in Figure 1. As an example, Figure 2 shows the calculated fan-in for the methods named m in the program of Figure 1. Note that D.f 3 is reported among the potential callers of B.m, even though this situation cannot actually occur at run-time. However, the resulting effect of having higher fan-in values reported for methods in super-classes is arguably positive for the purpose of the present analysis, as it emphasizes the concern implemented by the super-class method, which generally is addressed by its overriding methods as well. 2.2 Concept analysis Formal concept analysis (FCA) [12] is a branch of lattice theory that can be used to identify meaningful groupings of elements that have common properties.5 Programming lang. object-oriented functional logic static typing dynamic typing √ √ Java √ √ Smalltalk √ √ C++ √ √ Scheme √ √ Prolog Table 1. Programming languages and their supported programming paradigms. FCA takes as input a so-called context, which consists of a (potentially large, but finite) set of elements E, a set of properties P on those elements, and a Boolean incidence relation T between E and P . An example of such a context is given in √ Table 1, which relates different programming languages and properties. A mark in a table cell means that the element (programming language) in the corresponding row has the property of the corresponding column. Starting from such a context, FCA determines maximal groups of elements and properties, called concepts, such that each element of the group shares the properties, every property of the group holds for all of its elements, no other 5 4 We use the terms element and property instead of object and attribute used in traditional FCA literature, because these latter terms have a very specific meaning in OO software development. TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques V element outside the group has those same properties, nor does any property outside the group hold for all elements in the group. √ Intuitively, a concept corresponds to a maximal ‘rectangle’ containing only marks in the table, modulo any permutation of the table’s rows and columns. Formally, the starting context is a triple (E, P, T ), where T ⊆ E × P is a binary relation between the set of all elements E and the set of all considered element properties P . A concept c is defined as a pair of sets (X, Y ) such that: X = {e ∈ E | ∀p ∈ Y : (e, p) ∈ T } (1) Y = {p ∈ P | ∀e ∈ X : (e, p) ∈ T } (2) where X is said to be the extent of the concept (Ext[c]) and Y is said to be its intent (Int[c]). It should be noticed that the definition above is not “constructive”, being mutually recursive between X and Y . However, given a pair (X, Y ), it allows deciding whether it is a concept or not. FCA algorithms provide constructive methods to determine all pairs (X, Y ) satisfying the constraints (1) and (2). {} {Java, Smalltalk, C++, Scheme, Prolog} {OO} {dynamic typing} {Java, C++, Smalltalk} {Scheme, Prolog, Smalltalk} {static typing, OO} {dyn. typing, OO} {dyn. typing, funct.} {dyn. typing, logic} {Java, C++} {Smalltalk} {Scheme} {Prolog} {OO, funct., logic, static typing, dyn. typing} {} Fig. 3. The concept lattice for Table 1. The containment relationship between concept extents (or, equivalently, intents) defines a partial order over the set of all concepts, which can be shown to be a lattice [12]. Figure 3 shows the concept lattice corresponding to Table 1. The lattice’s bottom concept contains those elements that have all properties. Since there is no such programming language in our example, that concept contains no elements (its extent is empty). Similarly, the top concept contains those properties that hold for all elements. Again, there is no such property (the concept’s intent is empty). Other concepts represent related groups of programming languages, such as the concept ({Java, C++}, {static typing, OO }), which groups all statically-typed object-oriented languages, a sub-concept of all OO languages. Intuitively, the sub-concept relationship can thus be interpreted as a specialization of more general notions. Elements (resp. properties) in boldface TUD-SERG-2006-002 5 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques VI are those that are most concept-specific, being attached to the largest lower bound (resp. least upper bound) concept. When using the so-called sparse labeling of the concept lattice, only these boldface labels are retained, without loss of information. More precisely, when using sparse labeling, a node c is marked with an element e ∈ Ext[c] only if it is associated with the most specific (i.e., lowest) concept c having e in the extent; a node c is marked with a property p ∈ Int[c] only if it is associated with the most general (i.e., highest) concept c having p in its intent. The (unique) node of a lattice L marked with a given element e is thus: γ(e) = inf{c ∈ L | e ∈ Ext[c]} (3) where inf gives the infimum (largest lower bound) of a set of concepts. Similarly, the unique lattice node marked with a given property p is: µ(p) = sup{c ∈ L | p ∈ Int[c]} (4) where sup gives the supremum (least upper bound) of a set of concepts. The set of elements in the extent of a lattice node c can then be computed as the set of all elements at or below c, while the set of properties in its intent are those marking c or any node above c. The labeling introduced by the functions µ and γ give the most specific concept for a given element (resp. property). Thus, with sparse labeling, the elements and properties that label a given concept are those that characterize it most specifically. Sometimes it is convenient to get the labels of a given concept through the following functions: α(c) = {p ∈ P | µ(p) = c} (5) β(c) = {e ∈ E | γ(e) = c} (6) α(c) gives the set of properties labeling a concept c, while β(c) gives the concept’s elements, according to the sparse labeling. 2.3 Terminology We conclude this background section by introducing some terminology that will be used throughout the remainder of this paper. A concern is a collection of related source-code entities, such as classes, methods, statements or expressions, that implement a particular functionality or feature of the application. A crosscutting concern is a concern whose entities are not captured into a single localised abstraction, but are scattered over many different locations and tangled with other concerns. A (concern) seed is a single source-code entity, such as a method, or a collection of such entities, that strongly connotes a crosscutting concern. It offers a starting point for further exploration and understanding the whole extent of that concern’s implementation. 6 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques VII A candidate seed is identified by an automated aspect mining technique as a potential concern seed but is not yet confirmed to be an actual concern seed or rather a false positive. Seed expansion is the manual or automated process of completing the set of source-code entities constituting a seed into the entire set of source-code entities of which the crosscutting concern corresponding to that seed consists. 3 The three aspect mining techniques In this section, we give a brief overview of three techniques, developed independently by different research groups, that support the automated discovery of crosscutting concerns in the source code of a software system that is written in a non aspect-oriented way. 3.1 Fan-in analysis Crosscutting functionality can occur at different levels of modularity. Classes, for instance, can assimilate new concerns by implementing multiple interfaces or by implementing new methods specific to super-imposed roles. At the method level, crosscutting in many cases resides in calls to methods that address a different concern than the core logic of the caller. Typical examples include logging, tracing, pre- and post-condition checks, and exception handling. It is exactly this type of crosscutting that fan-in analysis tries to capture. When we study the mechanics of AOSD, we see that it employs the so-called advice construct to eliminate crosscutting at method level. This construct is used to acquire control of program execution and to add crosscutting functionality to methods without an explicit invocation from those methods. Rather, the crosscutting functionality is isolated in a separate module, called aspect, and woven with the method implicitly based on the advice specification. Fan-in analysis reverses this line of reasoning and looks for crosscutting functionality that is explicitly invoked from many different methods scattered throughout the code. The hypothesis is that the amount of calls to a method implementing this crosscutting functionality (fan-in) is a good measure for the importance and scattering of the discovered concern. To perform the fan-in analysis, a fan-in metric was implemented as a plug-in for the Eclipse platform6 , and integrated it into an iterative process that consists of three steps: 1. Automatic computation of the fan-in metric for all methods in the investigated system. 2. Filtering of the results from the previous step by – eliminating all methods with fan-in values below a chosen threshold (in the experiment, a threshold of 10 was used); 6 http://swerl.tudelft.nl/view/AMR/FINT TUD-SERG-2006-002 7 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques VIII – eliminating the accessor methods (methods whose signature matches a get* /set* pattern and whose implementation only returns or sets a reference); – eliminating utility methods, like toString() and collection manipulation methods, from the remaining subset. 3. (Partially automated) analysis of the methods in the resulting, filtered set by exploring the callers, call sites, naming convention used, the implementation and the comments in the source code. Besides code exploration, the tool supports automatic recognition of a number of relations between the callers of a method, such as common roles, consistent call positions, etc. The result of the fan-in analysis is a set of candidate seeds, represented as methods with high fan-in. 3.2 Identifier analysis In the absence of designated language constructs for aspects, naming conventions are the primary means for programmers to associate related but distant program entities. This is especially the case for object-oriented programming, where polymorphism allows methods belonging to different classes to have the same signature, where it is good practice to use intention-revealing names [13], and where design and other programming patterns provide a common vocabulary known by many programmers. Identifier analysis relies on this assumption and identifies candidate seeds by grouping program entities with similar names. More specifically, it applies FCA with as elements all classes and methods in the analyzed program (except those that generate too much noise in the results, like test classes and accessor methods), and as properties the identifiers associated with those classes and methods. The identifiers associated with a method or class are computed by splitting up its name based on where capitals appear in it. For example, a method named createUndoActivity yields three identifiers create, undo and activity. In addition, we apply the Porter stemming algorithm [14] to make sure that identifiers with the same root form (like undo and undoable) are mapped to one single representative identifier or ‘stem’. It is these stems that are used as properties for the concept analysis. The FCA algorithm then groups entities with the same identifiers. When such a group contains a certain minimum number of elements (in the experiment, a threshold of 4 was used) and the entities contained in it cut across multiple class hierarchies, the group is considered a candidate seed. The only remaining but most difficult task is that of deciding manually whether a candidate seed is a real seed or a false positive. To help the developer in this last task, the DelfSTof source-code mining tool presents the concepts in such a way that they can be browsed easily by a software engineer and so that he or she can readily access the code of the classes and methods belonging to a discovered seed. 8 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques IX 3.3 Dynamic analysis Formal concept analysis has been used to locate ‘features’ in procedural programs [15]. In that work, the goal was to identify the computational units (procedures) that specifically implement a feature (i.e., requirement) of interest. Execution traces obtained by running the program under given scenarios provided the input data (dynamic analysis). In a similar way, dynamic analysis can be used to locate aspects in program code [9] according to the following procedure. Execution traces are obtained by running an instrumented version of the program under analysis, for a set of scenarios (use-cases). The relationship between execution traces and executed computational units (methods) is subjected to concept analysis. The execution traces associated with the use-cases are the elements of the concept analysis context, while the executed methods are the properties. In the resulting concept lattice (with sparse labeling), the use-case specific concepts are those labeled by at least one trace for some use-case (i.e. α contains at least one element), while the concepts with zero or more properties as labels (those with an empty α) are regarded as generic concepts. Thus, use-case specific concepts are a subset of the generic ones. Both use-case specific concepts and generic concepts carry information potentially useful for aspect mining, since they group specific methods that are always executed under the same scenarios. When the methods that label one such concept (using the sparse labeling) crosscut the principal decomposition, a candidate aspect is determined. Formally, let C be the set of all the concepts and let Cs be the set of use-case specific concepts (|α(c)| > 0). A concept c is considered a candidate seed iff: Scattering: ∃p, p0 ∈ β(c) | pref (p) 6= pref (p0 ) Tangling: ∃p ∈ β(c), ∃c0 ∈ Ω, ∃p0 ∈ β(c0 ) | c 6= c0 ∧ pref (p) = pref (p0 ) where Ω = Cs for the use-case specific seeds, while Ω = C for the generic seeds. The first condition (scattering) requires that more than one class contributes to the functionality associated with the given concept (pref(p) is the fully scoped name of the class containing the method p). The second condition (tangling) requires that the same class addresses more than one concern. In summary, a concept is a candidate seed if: (1) scattering: more than one class contributes to the functionality associated with the given concept; (2) tangling: the class itself addresses more than one concern. The first condition alone is typically not sufficient to identify crosscutting concerns, since it is possible that a given functionality is allocated to several modularized units without being tangled with other functionalities. In fact, it might be decomposed into sub-functionalities, each assigned to a distinct module. It is only when the modules specifically involved in a functionality contribute to other functionalities as well (i.e. the second condition) that crosscutting is detected, hinting for a candidate seed. TUD-SERG-2006-002 9 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques X Concern type # Seed’s description Consistent behavior 4 Methods implementing the consistent behavior shared by different callers, such as checking and refreshing figures/views that have been affected by the execution of a command. 4 Method implementing a contract that needs to be enforced, such as checking the reference to the editor’s active view before executing a command. Contract enforcement Undo 1 Methods checking whether a command is undoable/redoable and the undo method in the superclass, which is invoked from the overriding methods in subclasses. Persistence and resurrection 1 Methods implementing functionality common to persistent elements, such as read/write operations for primitive types wrappers (e.g., Double, Integer, etc.) which are referenced by the scattered implementations of persistence/resurrection. Command design pattern Observer design pattern Composite design pattern Decorator design pattern Adapter design pattern 1 The execute method in the command classes and command constructors. 1 The observers’ manipulation methods and notify methods in classes acting as subject. 2 The composite’s methods for manipulating child components, such as adding a new child. 1 Methods in the decorator that pass the calls on to the decorated components. 1 Methods that manipulate the reference from the adapter (Handle) to the adaptee (Figure). Table 2. Summary of the results of the fan-in analysis experiment. 4 Results of the aspect mining In this section, we present the results of applying each technique to version 5.4b1 of JHotDraw, a Java program with approximately 18,000 non-commented lines of code and around 2800 methods. We mutually compare the results of the techniques, and discuss the limitations of each technique as well as their complementarity. 4.1 The fan-in analysis experiment As described in Subsection 3.1, fan-in analysis first performs a number of successive steps to filter the methods in the analyzed system. The threshold-based filtering, which selects methods with high fan-in values, kept around 7% of the total number of methods. The filters for accessors and utility methods eliminated around half of the remaining methods. In the remaining subset, more than half of the methods (52%) were categorized as seeds, based on manual analysis. 10 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XI Table 2 gives an overview of the types of crosscutting concerns that were identified and the seeds that led to their identification. Several of these concern types, such as consistent behavior or contract enforcement [16], have more than one instance in JHotDraw; that is, multiple unrelated (crosscutting) concerns exist that conform to the same general description. For example, one instance of contract enforcement checks a priori conditions to a command’s execution, while another instance verifies common requirements for activating drawing tools. The number of different instances that were detected is indicated in the # column. We distinguish three different ways in which the fan-in metric can be associated with the crosscutting structure of a concern implementation (also indicated in Table 2): 1. The crosscutting functionality is implemented through a method and the crosscutting behavior resides in the explicit calls to this method. Examples in this category include consistent behavior and contract enforcement. 2. The implementation of the crosscutting concern is scattered throughout the system, but makes use of a common functionality. The crosscutting resides in the call sites, and can be detected by looking at the similarities between the calling contexts and/or the callers. Examples of concerns in this category are persistence and undo [6]. 3. The methods reported by the fan-in analysis are part of the roles superimposed to classes that participate in the implementation of a design pattern. Many of these roles have specific methods associated to them: the subject role in an Observer design pattern is responsible to notify and manage the observer objects, while the composite role defines specific methods for manipulating child components. In general, establishing a relation between these seed-methods and the complete concern to which they appertain might require a better familiarity of the human analyzer with the code being explored, than for the previous two categories. However, many of these patterns are well-known and have a clear defined structure, which eases their recognition [17]. For more details regarding fan-in analysis and a complete discussion of the JHotDraw results, we refer to [6]. 4.2 The identifier analysis experiment Applying the identifier analysis technique of Subsection 3.2 on JHotDraw yielded 230 concepts and took about 31 seconds when using a threshold of 4 for the minimum number of elements in a concept. With a threshold of 10, the number of concepts produced was significantly less: only 100 concepts remained after filtering, for a similar execution time.7 In both cases, 2193 elements and 507 properties were considered. It is a good sign that the number of properties is 7 Whereas the threshold of 4 was chosen arbitrarily, the threshold of 10 was determined experimentally: below that threshold the amount of concepts that were regarded as noise was significantly higher than above the threshold. TUD-SERG-2006-002 11 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XII Crosscutting concern Concept(s) #elements Some elements Observer change(d) check listener release command executed execut(abl)e undo(able) redo(able) visit file storable load register 67 14 65 12 4 51 53 14 12 15 5 8 7 figureChanged(e) checkDamage() createDesktopListener() ... commandExecuted(...) commandExecutable(...) createUndoActivity() redo() visit(FigureVisitor) registerFileFilters(c) readStorable() loadRegisteredImages loadRegisteredImages draw move 112 36 draw(g) moveBy(x,y) moveSelection(dx,dy) 5 iterator(), listIterator(), . . . Command execution Undo Visitor Persistence Drawing figures Moving figures Iterating over collections iterator Table 3. Selection of results of the identifier analysis experiment. significantly smaller than the total number of elements considered, as it implies that there is quite some overlap in the identifiers of the different source-code entities, which was one of the premisses of the identifier analysis technique. The manual part of the experiment, i.e. deciding which concepts were real seeds, was much more time-consuming. Overall, this took about three days for the experiment with threshold 4, where 230 seed candidates needed to be investigated. For each of the discovered concepts, the code of the entities in its extent had to be inspected to decide whether (most of) these entities addressed a similar concern. Other than allowing to browse the source code of the elements in the extent of a concept, the DelfSTof code mining tool provided no direct support for this. Table 3 presents some of the seeds discovered by manually analyzing the classes and methods belonging to the extent of the concepts produced by the FCA algorithm. The first column names the concern, the second column shows the identifiers shared by the elements belonging to the concept(s) corresponding to that concern. The third column shows the size of the extent for each concept. Finally, for illustration purposes, the fourth column shows some program entities appearing in the extent of the discovered concepts. Out of 230 candidate seeds, 41 seeds were retained, when using a threshold of 4 for the minimum number of elements in a concept. These discovered concerns were classified in three different categories: 1. Some of these concerns looked like aspects in the more traditional sense (e.g., observer, undo and persistence). 12 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XIII 2. Many other concerns seemed to represent a crosscutting functionality that was part of the business logic (e.g., drawing figures, moving figures). The distinction between these two first categories was somewhat subjective, however. 3. Three Java-specific concerns were discovered (e.g., iterating over collections) that are difficult to factor out into an aspect because they rely on or extend specific Java code libraries. 4.3 The dynamic analysis experiment The dynamic analysis technique of Subsection 3.3 is supported by the Dynamo aspect mining tool8 . The first step required by Dynamo is the definition of a set of use-cases. To accomplish this task, the documentation associated with the main functionalities of JHotDraw was used to define a use-case for each functionality described in the documentation. Amongst others, a use-case was created to draw a rectangle, one to draw a line using the scribble tool, one to create a connector between two existing figures, one to attach a URL to a graphical element, and so on. In total, 27 use-cases were obtained. When executed they exercised 1262 methods belonging to JHotDraw classes, so that the initial context for the concept analysis algorithm contained 27 elements and 1262 properties. The resulting concept lattice contained 1514 nodes. Crosscutting concern Concepts Methods Undo Bring to front Send to back Connect text 2 1 1 1 36 3 3 18 Persistence Manage handles Manage figure change event Move figure Command executability Connect figures Figure observer Add text Add URL to figure Manage figures outside drawing Get attribute Set attribute Manage view rectangle Visitor 1 4 3 1 1 1 4 1 1 1 1 1 1 1 30 60 8 7 25 55 11 26 10 2 2 2 2 6 Table 4. Summary of the results of the dynamic analysis experiment. 8 Available from http://star.itc.it/dynamo/ under GPL. TUD-SERG-2006-002 13 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XIV Among the concepts in the lattice, 11 satisfied the crosscutting conditions (scattering and tangling), described in Section 3, for the use-case specific concepts, while 56 (including the 11 above) satisfied the conditions for the generic concepts. Next, both the use-case specific and generic concepts were revisited manually, to determine which ones could be regarded as plausible seeds and which ones should be considered false positives. The criterion followed in this assessment was the following: a concept satisfying the crosscutting conditions is considered a seed if – it can be associated to a single, well-identified functionality (this usually accounts for the possibility to give it a short description that labels it), and – some of the classes involved in such a functionality have a different primary responsibility (indicating crosscutting with respect to the principal decomposition). Of course, due to the nature of crosscutting concerns and the related design decisions, some level of subjectivity still remains (as is the case for the other techniques). In the end, the list of candidate seeds shown in Table 4 was obtained. The four topmost concerns are use-case specific. As apparent from the second column of the table, and as was the case for the identifier analysis experiment, some crosscutting concerns were detected by multiple concepts. In total, among the 56 generic concepts satisfying the crosscutting conditions, 24 concepts were judged to be associated with 18 crosscutting concerns. The methods associated with each candidate seed (counted in the last column of Table 4) are indicative of the “aspectizable” functionality. Although they may be not the complete list (dynamic analysis is partial) and may contain false positives, they represent a good starting point for a refactoring intervention aimed at migrating the application to AOSD. 5 Comparing the results In this section we discuss some selected concerns that were identified by the different techniques. We selected some concerns that were detected by all three techniques, as well as a representative set of concerns that were detected by some techniques but not by others. This allows us to clearly pinpoint the strengths and weaknesses of each individual technique. 5.1 Selected concerns Table 5 summarises the concerns we selected. The first column names the concern. The other columns show by what technique(s) the concern was discovered: if a technique discovered the concern, we put a + sign in the corresponding column, otherwise a - sign is in the table. 14 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XV Concern Observer Undo Persistence Consistent behavior / Contract enforcement Command execution Bring to front / Send to back Manage handles Move Figures Fan-In Analysis + + + + + + (discarded) Identifier Dynamic Analysis Analysis + + + + + + + + + + + + + Table 5. A selection of detected concerns in JHotDraw. Observer The Observer design pattern is an example of a concern reported by all techniques. Other examples include Command execution, Undo functionality and Persistence, whose implementation in JHotDraw is described in [6]. Their identification should come as no surprise, because they correspond to well-known aspects, frequently mentioned in AOSD literature, or to functionalities for which an AOSD implementation looks quite natural. Concerns identified by all three techniques are probably the best starting point for migrating a given application to AOSD, because developers can be quite confident that the concern is very likely to be an aspect. However, the fact that only four of such concerns were discovered, stresses the need for an approach that combines the strengths of different techniques. Contract enforcement / consistent behavior The contract enforcement and consistent behavior concerns [16] generally describe common functionality required from, or imposed on, the participants in a given context, such as a specific pre-condition check on certain methods in a class hierarchy. An example from the JHotDraw case is the Command hierarchy for which the execute methods contain code to ensure the pre-condition that an ‘active view’ reference exists (is not null). We classify these concerns as a combination of contract enforcement and consistent behavior since these types often have very similar implementations, and choosing a particular type depends mainly on the context and on (personal) interpretation. Fan-in analysis is particularly suited to address this kind of scattered, crosscutting functionalities, which involve a large number of calls to the same method, while the other two techniques potentially miss it. In fact, contract enforcement and consistent behavior are usually associated with method calls that occur in every execution scenario, so that they cannot be discriminated by any specific use-case. On the other hand, identifier analysis will miss those cases where the methods that enforce a given contract or ensure consistent behavior do not share a common naming scheme. TUD-SERG-2006-002 15 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XVI Command execution This concern deals with the executability and the actual execution of objects whose class belongs to the Command hierarchy. Identifier analysis identified a concept which contains exactly the execute methods in the Command hierarchy. Dynamic analysis identified the classes containing isExecutable methods. Indeed, the execute methods all have the same name and manual inspection showed they exhibit similar behavior: they nearly all make a super call to an execute method, invoke a checkDamage method and (though not always) invoke a setUndoAcivity and getUndoActivity method. A similar argument can be made for isExecutable. Hence, whereas identifier and dynamic analysis may not detect the more generic Contract enforcement / Consistent behavior aspect directly, they can identify some locations (pointcuts) where potentially such an aspect could be introduced. Bring to front / Send to back The functionality associated with this concern consists of the possibility to bring figures to the front or send them to the back of an image. When exercised, it executes specific methods that have a low fan-in, hence they were not detected by fan-in analysis. Identifier analysis also missed them, because there were not enough methods with a sufficiently similar name to surpass the threshold. Hence, dynamic analysis is the only technique that identified this concern. This example is a good representative of crosscutting concerns that are reported only by dynamic analysis: whenever the methods involved in a functionality are not characterized by a unifying naming scheme (or there are not enough of them), neither do they have high fan-in, the other two techniques are likely to fail. Manage handles A crosscutting functionality is responsible for managing the handles associated with the graphical elements. Such handles support interactive operations, such as resizing of an element, conducted by clicking on the handle and dragging the mouse. This seed is interesting because it is detected by dynamic analysis and by identifier analysis, but in different ways. Identifier analysis detects this concern based on the presence of the word ‘handle’ in identifiers. Consequently, it misses methods such as north(), south(), east(), west(), which are clearly related to this concern, but do not share the lexicon with the others. On the other hand, dynamic analysis reports both the latter methods and (some of) those containing the word ‘handle’. However, since not all possible handle interactions have been exercised, the output of dynamic analysis is partial and does not include all the methods reported by identifier analysis. The manage handles concern was missed by the fan-in analysis because the calls are too specific: they are similar but different calls instead of one single called method with a high fan-in. Moving figures The three techniques discard concerns on different bases: some of the concerns are filtered automatically while others are excluded manually. 16 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XVII The move figures concern, seeded by the moveBy method in the Figure classes, is one example where different, subjective decisions can be made depending on whether the concept is classified either as a candidate aspect or as part of the principal decomposition. The moveBy methods allow to move a figure with a given offset. The team which used fan-in analysis argued that the original design seems to consider this functionality as part of a Figure’s core logic. The other two teams considered it as part of a crosscutting functionality and included it in the list of reported seeds. This example highlights the difficulty of deciding objectively on what is and what is not an aspect and corroborates our choice to conduct a qualitative, instead of a quantitative, comparison. 5.2 Limitations As a consequence of applying each technique to the same case, some of the limitations of the respective techniques have become obvious. For example, we obtained a better idea of potential ‘false negatives’, i.e. concerns that were not identified by a particular technique but that were identified by another. Below, we summarise some of the discovered limitations. In the next section we then describe how to partly overcome these limitations by combining different techniques. Fan-in analysis mainly addresses crosscutting concerns that are largely scattered and that have a significant impact on the modularity of the system. The downside of this characteristic is that concerns with a small code footprint and thus with low fan-in values associated, will be missed. For example, the identification of Observer design pattern instances is dependent on the number of classes implementing the observer role. These classes contain calls to specific methods in the subject class for registering as listeners to the subject’s changes. The number of observer classes will determine to a large extent the number of calls to the registration method in the subject role. A collateral effect is the anticipated unsuitability of the technique for analysing small case studies. Identifier analysis tends to produce a lot of detailed results. However, these results typically contain too much noise (false positives), so a more effective filtering of the discovered concepts, as well as of the elements inside those concepts, is needed. In addition, the discovered concepts are often incomplete, in the sense that they do not completely “cover” an aspect or crosscutting concern. Often, more than one concept is needed to describe a single concern, as was the case for the Observer aspect. The individual concepts themselves may also need to be completed with additional elements that are not contained in those concepts. This was the case for the Undo aspect: in addition to the methods with ‘undo’ or ‘undoable’ in their name, some of the methods calling these undo methods need to be considered as part of the core aspect as well. TUD-SERG-2006-002 17 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XVIII Dynamic analysis is partial (i.e., not all methods involved in an aspect are retrieved), being based on specific executions, and it can determine only aspects that can be discriminated by different execution scenarios (e.g., aspects that are exercised in every program execution cannot be detected). Additionally, it does not deal with code that cannot be executed (e.g., code that is part of a larger framework, but that is not used in a specific application). 5.3 Complementarity The three proposed techniques address symptoms of crosscutting functionality, such as scattering and tangling, in quite different ways. As shown in Table 6, fan-in analysis and dynamic analysis show largely complementary result sets: among the 30 concerns identified by either dynamic or fan-in analysis, only 4 are identified by both techniques. This is an expected result. Fan-in analysis focuses on identifying those methods that are called at multiple places. However, when a method is called many times, it is likely to occur in most (if not all) execution traces. Hence, no specific use-case can be defined to isolate the associated functionality, and dynamic analysis will fail to identify it as a seed. Identifier analysis is the least discriminating of the three techniques and has a large overlap with the other two techniques. When a concern can be identified through fan-in analysis and/or dynamic analysis, identifier analysis can often isolate it too, since a common lexicon is often used in the names of the involved methods. In the next section, we will use these observations to propose a new aspect mining technique that is a clever combination of the three individual techniques. Technique Concerns Dynamic analysis 18 Fan-in analysis S 16 Dynamic analysis T Fan-in analysis 30 Dynamic analysis Fan-in analysis 4 Table 6. Concerns identified by either dynamic or fan-in analysis. 6 Toward interesting combinations Based on the discussion in the previous section, this section presents three combined aspect mining techniques and reports on the results of applying these combined techniques on the JHotDraw application. Based on the analysis indicators of recalled methods and seed quality we compare whether these combined techniques provide a more complete coverage of the detected concerns than each of the original techniques individually. 18 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XIX 6.1 Motivation As has been explained in the previous sections, the fan-in analysis and dynamic analysis techniques are largely complementary, and address different symptoms of crosscutting. An obvious and interesting combination of these techniques thus consists of simply applying each technique individually and taking the union of the results. Additionally, the seeds in the intersection of the results (if any) are likely to represent the best aspect candidates, because both techniques identify them. This was illustrated in our experiment, in which both techniques identified the Observer, Undo, Persistence and Command execution candidates. As for other combinations of the techniques, two interesting observations were considered. First, the manual intervention required by identifier analysis is very time-consuming and is not justified by the fact that it produces more interesting results. This makes the technique less suited than the others for large(r) cases. Second, both fan-in analysis and dynamic analysis identify only candidate seeds that serve as a starting point for seed expansion. Dynamic analysis in particular suffers from this problem as it is based on a (necessarily partial) list of execution scenarios. Similarly, fan-in analysis is only focused on invocations of high fanin methods, which represent just a portion of the whole concern. Interestingly, while performing fan-in analysis and dynamic analysis, we observed that the classes and methods in the seed expansion often exhibited similar identifiers. Consequently, we believe better results can be obtained if we use identifier analysis as a seed expansion technique for the seeds identified by either fan-in analysis or dynamic analysis, or by the seeds identified by both these techniques. In this way, the search space for identifier analysis is reduced significantly, and more automation is provided for the manual seed expansion needed by both fan-in analysis and dynamic analysis. A final manual refinement step is anyway necessary, since the expanded seeds may contain false positives and negatives. In the remainder of this section, we will present three different techniques: a combination of fan-in analysis with identifier analysis, of dynamic analysis with identifier analysis, and of the union of fan-in analysis and dynamic analysis with identifier analysis. 6.2 Definition of the combined techniques The combined techniques work as follows: 1. Identify interesting candidate seeds by applying fan-in analysis, dynamic analysis or both to the application; – For candidate seeds identified by dynamic analysis, (manually) filter out those methods that do not pertain to the concern; 2. For each method in the candidate seed, find its enclosing class, and compute the identifiers occurring in the method and the class name, according to the algorithm used by identifier analysis; 3. Apply identifier analysis to the application, and search for a concept, among the concepts it reports, that is “nearest”. The nearest concept is the concept TUD-SERG-2006-002 19 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XX that contains most of the identifiers generated in the previous step. If more than one nearest concept exists, take the union of all their elements. 4. Add the methods contained in the nearest concept(s) to the candidate seed. 5. Revise the expanded list of candidate seeds manually to remove false positives and add missing seeds (false negatives). In what follows, we experimentally validate these techniques on the JHotDraw case. 6.3 Analysis indicators Before applying the combined techniques, we define two measures to validate the results. The goal is to measure how identified seeds change in terms of precision and recall. Unfortunately, this requires information about all crosscutting concerns present in the application, and this is not available. Therefore, we have chosen alternative metrics, which we call recalled methods and seed quality. Recalled methods is the number of methods reported in a seed that actually belong to the crosscutting concern. Seed quality is the percentage of a seed’s recalled methods with respect to the total number of methods in the seed. This indicator estimates how difficult it is to spot a concern in the methods provided by the seed. With respect to the definitions above, it is important to remark that for fanin, two interpretations of seeds are possible: the first takes only the callees with high fan-in into account; the second interpretation includes, besides the callees with high fan-in, also all callers to these methods. These differences stem from the fact that the fan-in technique is actually based on the call-relation and the interpretations use either one or both sides of the relation in seed representations. During exploration these differences aren’t that important because we can easily navigate from caller to callee and vise versa. However, when we start assessments based on counting elements, these interpretations do have considerable impact. In the first case, the number of recalled methods will be low (since callsites are not considered in the seeds), and the seed quality will always be 100% since the high fan-in callees belong to the concern by definition. The second interpretation will result in higher values of recall and yields a more complete picture of the concern. However lower values for seed quality are possible since not all calls may be caused by a crosscutting concern. Section 6.4 describes the results of applying combined techniques on the JHotDraw appication, and evaluates the above indicators before and after the experiment. We include results for both interpretations of fan-in seeds discussed above. 6.4 Experimental results Table 7 shows the values of the indicators before and after the completion experiment (based on the first interpretation of seeds for fan-in). Although the 20 TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XXI Concerns Technique Undo Command execution Recalled Seed Recalled Seed Methods? Quality? Methods? Quality? Dynamic analysis 23 64% 20 80% Fan-in analysis 3 100% 3 100% S Dyn Fan-in 24 63% 22 81% Dyn + Identifier 183 55% 132 80% Fan-inS+ Identifier 94 100% 132 80% (Dyn Fan-in) + Identifier 183 55% 132 80% Concerns Technique Persistence Observer Recalled Seed Recalled Seed Methods? Quality? Methods? Quality? Dynamic analysis 29 97% 3 100% Fan-in analysis 6 100% 10 100% S Dyn Fan-in 32 97% 13 100% Dyn + Identifier 104 100% 121 14% Fan-inS+ Identifier 104 100% 146 15% (Dyn Fan-in) + Identifier 104 100% 146 15% Table 7. Recalled methods and seed quality before and after completion (? based on the first interpretation of seeds for fan-in) completion technique can be applied to all concerns identified by either fan-in analysis or dynamic analysis, we performed the experiment only on the concerns identified by all three techniques. The sole reason is that we need to assess how the completion technique influences the recalled methods and seed quality indicators as compared to their initial values, which can only be done for the Undo, Command execution, Persistence and Observer concerns. When looking at the common results, it is important to note that fan-in seeds point to distinct crosscutting concerns sorts that can occur as parts of more complex structures like implementations of the Observer pattern [18, 19]. In the experiments, these are grouped to obtain the same level of granularity obtained by the other techniques. A deeper look into the results of the completion with identifier analysis reveals interesting information: For the Undo concern, the results of both fan-in analysis and dynamic analysis improve a lot in terms of recalled methods (from 23 and 3 up to 183 and 94). There is a negative impact on the seed quality for (completed) dynamic analysis (from 64% down to 55%), but the seed quality for fan-in plus identifier analysis remains at 100%. For the Command execution and Persistence concerns, the number of recalled methods increases significantly for the completion technique (from 20 and 3 up to 132 and from 29 and 6 up to 104), while the seed quality remains at the same level. For the Observer concern, the results are less encouraging than for the other concerns. Even though the number of recalled methods increases for the completion technique, the quality of the seeds drops to an unacceptable level (from TUD-SERG-2006-002 21 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XXII Seed Recalled Seed Methods Quality Undo (callee #1) Undo (callee #2) Undo (callee #3) 24 25 24 92% 88% 83% Undo (combined) 73 88% Observer (combined) 83 100% Table 8. Recalled methods and seed quality for fan-in analysis based on the second interpretation of seeds for fan-in 100% down to 14% and 15%). Clearly, the completion does not provide a good expansion of the original seeds. Closer inspection reveals that no clearly distinctive naming convention has been used to implement the Observer concern. The Undo, Command execution and Persistence concerns employ distinctive identifiers such as undo/undoable, execute/command and store/storable, which are used extensively only within the concern implementation. Consequently, the completion provided by identifier analysis gives good seed expansions. However, the identifiers used for the Observer concern are the more general figure/update/... that are used extensively in throughout the application, and not only in the concern implementation. Therefore, identifier analysis is not able to provide a good expansion for the seeds found by the other techniques. An overview of results based on the second interpretation of seeds for fan-in, i.e. taking also the call-sites into account, is shown in Table 8. For the Undo concern, we show both the individual values for each of the three high fan-in callees reported as seeds earlier and the recall and seed quality of the combination of these three. The seed quality is lower than 100% in these cases since some of the calls found were not considered to be part of the actual crosscutting concern. For the Observer concern we only show the value for the combined high fan-in callees since it would go too far to go over all individual values here. The seed quality is 100% in these cases since there are no calls from outside this concern to the reported callees. For a detailed discussion of these measurements and an assessment of various quality metrics, we refer to [20] and the fan-in website9 . 7 Summary and future work The purpose of the paper was to compare three different aspect mining techniques, discuss their respective strengths and weaknesses by applying them to a common benchmark application, and develop combined techniques based on this discussion. 9 22 http://swerl.tudelft.nl/amr/ TUD-SERG-2006-002 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XXIII We observed that all three techniques were able to identify seeds for wellknown crosscutting concerns, but that interesting differences arose for other concerns. These differences are largely due to the different ways in which the techniques work. Fan-in analysis is good at identifying seeds that are largely scattered throughout the system and that involve a lot of invocations of the same method, but it cannot be used to analyse smaller applications. Identifier analysis is able to identify seeds when the associated methods have low fanin, but only if these methods share a common lexicon. The main drawback of this technique is the large number of reported seeds that had to be inspected manually. Finally, dynamic analysis is able to find seeds in the absence of high fan-in values and common identifiers, but the technique is only partial because it relies on execution traces. We also observed that the three techniques are quite complementary: fan-in analysis and dynamic analysis require a manual effort to expand the seeds into full concerns, whereas identifier analysis covers a large part of a concern, but requires extensive filtering of the reported seeds. Hence, to improve automation of both fan-in analysis and dynamic analysis, and to reduce the search space for identifier analysis, we proposed a combined technique in which seeds from either fan-in analysis or dynamic analysis are expanded automatically by applying identifier analysis. To verify the performance of this combined technique, we applied it to JHotDraw and interpreted the results in terms of two indicators: recalled methods and seed quality. The measures show that for three out of the four concerns we considered, the combined technique outperforms the individual techniques. In only one case, the combined technique performed worse. Future work mainly consists of extending our comparison with other aspect mining techniques, and potentially proposing new interesting combinations with such techniques. This will not only allow us to come up with better (combined) aspect mining techniques, but will also allow us to evaluate the three considered techniques even better, as new concerns will be identified that we were not aware of. Additionally, we could come up with extra quality indicators that complement the recalled methods and seed quality indicators, and empirically establish their validity by considering other benchmark applications as well. References 1. Fabry, J.: Modularizing Advanced Transaction Management - Tackling Tangled Aspect Code. PhD thesis, Vrije Universiteit Brussel (2005) 2. Lippert, M., Lopes, C.V.: A study on exception detection and handling using aspect-oriented programming. In: Proceedings of the International Conference on Software Engineering (ICSE), ACM Press (2000) 418–427 3. Bruntink, M., Deursen, A., Tourwé, T.: Discovering faults in idiom-based exception handling. In: Proceedings of the 28th International Conference on Software Engineering (ICSE) (to appear), ACM Press (2006) 4. Kellens, A., Mens, K.: A survey of aspect mining tools and techniques. Technical report, INGI 2005-07, Université catholique de Louvain, Belgium (2005) TUD-SERG-2006-002 23 SERG Ceccato et al – Applying and Combining Three Different Aspect Mining Techniques XXIV 5. Deursen, A., Marin, M., Moonen, L.: Aspect mining and refactoring. In: Proceedings of the First International Workshop on REFactoring: Achievements, Challenges, Effects (REFACE03). (2003) 6. Marin, M., Deursen, A., Moonen, L.: Identifying aspects using fan-in analysis. In: Proc. of the 11th IEEE Working Conference on Reverse Engineering (WCRE 2004), IEEE Computer Society (2004) 7. Mens, K., Tourwé, T.: Delving source-code with formal concept analysis. Elsevier Journal on Computer Languages, Systems & Structures 31(3–4) (2005) 183–198 Special Issue: Smalltalk. 8. Tourwé, T., Mens, K.: Mining aspectual views using formal concept analysis. In: Proc. of the Fourth IEEE International Workshop on Source Code Analysis and Manipulation (SCAM 2004), IEEE Computer Society (2004) 9. Tonella, P., Ceccato, M.: Aspect mining through the formal concept analysis of execution traces. In: Proceedings of the 11th IEEE Working Conference on Reverse Engineering (WCRE 2004), IEEE Computer Society (2004) 10. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley (1994) 11. Henderson-Sellers, B.: Object-oriented metrics: measures of complexity. PrenticeHall (1996) 12. Ganter, B., Wille, R.: Formal Concept Analysis: Mathematical Foundations. Springer-Verlag (1999) 13. Beck, K.: Smalltalk: best practice patterns. Prentice-Hall (1997) 14. Porter, M.: An algorithm for suffix stripping. Program 14(3) (1980) 130–137 15. Eisenbarth, T., Koschke, R., Simon, D.: Locating features in source code. IEEE Transactions on Software Engineering 29(3) (2003) 195–209 16. The AspectJ Team: The AspectJ Programming Guide. Palo Alto Research Center. (2003) Version 1.2. 17. Hannemann, J., Kiczales, G.: Design pattern implementation in Java and AspectJ. In: Proceedings of the 17th Annual ACM conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), ACM Press (2002) 161– 173 18. Marin, M., Moonen, L., Deursen, A.: An approach to aspect refactoring based on crosscutting concern types. In: Proceedings of the First International Workshop on the Modeling and Analysis of Concerns in Software, International Conference on Software Engineering, St. Louis, USA (2005) 19. Marin, M., L.Moonen, Deursen, A.: A classification of crosscutting concerns. In: Proceedings International Conference on Software Maintenance (ICSM 2005), IEEE Computer Society (2005) 20. Marin, M.: Reasoning about assessing and improving the seed quality of a generative aspect mining technique. In: Proc. of the Second Workshop on Linking Aspect Technology and Evolution at AOSD 2006. (2006) 24 TUD-SERG-2006-002 TUD-SERG-2006-002 ISSN 1872-5392 SERG
2cs.AI
The classification of fused links Timur R. Nasybullov∗† arXiv:1511.00136v3 [math.GT] 30 Dec 2015 April 2, 2018 Abstract We construct the complete invariant for fused links. It is proved that the set of equivalence classes of n-component fused links is in one-to-one correspondence with the set of elements of the abelization U V Pn /U V Pn0 up to conjugation by the elements from the symmetric group Sn < U V Bn . Keywords: Fused links, unrestricted virtual braid group, knot invariant. 1 Introduction Knot invariants are functions of knots that do not change under isotopies. The study of knot invariants is at the core of knot theory. Indeed, the isotopy class of a knot is, tautologically, a knot invariant. During last years different authors constructed vast number of knot invariants: the (self) linking number, the unknotting number, the knot group, the knot quandle, the Jones polynomial, the Conway polynomial and so on (see, for example, [19, 7, 12]). The disadvantage of a large number of easy countable invariants is that they are not complete, i. e. they do not distinguish some knots or links. At the same time there are few examples of complete knot invariants, but usually it is difficult to understand if the value of the invariant on the knot coincides with the value of this invariant on the another knot. The complement of a knot itself (as a topological space) is known to be a complete invariant of the knot by the theorem of C. Gordon and J. Luecke [10] in the sense that it distinguishes the given knot from all other knots up to ambient isotopy and mirror image. Some invariants associated with the knot complement include the knot group which is just the fundamental group of the complement. The knot quandle is also a complete invariant in this sense [12] but it is difficult to determine if two quandles are isomorphic. ∗ † The author is supported by Russian Science Foundation (project 14-21-00065) e-mail: [email protected], [email protected] 1 Thus an important problem in knot theory is to construct a complete knot invariant which can be easily found and used. Recently some generalizations of classical knots and links were defined and studied: singular links [20, 5], virtual links [11, 18], welded links [8] and fused links [13, 3, 17]. The problem of constructing invariants is also important for all of this knot theories. One of the ways of studying classical links is to study the braid group. Singular braids [5, 2], virtual braids [18, 21], welded braids [8] and unrestricted virtual braids [16, 13] were defined similar to the classical braid group adding the extra generators and relations. Theorem of A. A. Markov [6, §2.2] reduces the problem of classification of links to some algebraic problems of the theory of braid groups. There are generalizations of Markov theorem for virtual links, welded links and fused links [14]. In the paper we study fused links, which were defined by L. Kauffman and S. Lambropoulou in [17], and their invariants. Fused links are represented as generic immersions of circles in the plane (fused link diagrams) where double points can be classical (with the usual information on overpasses and underpasses) or virtual (see Fig. 1). Figure 1: Crossings in the double welded knot diagram Fused link diagrams are equivalent under ambient isotopy and some types of local moves (generalized Reidemeister moves): classical Reidemeister moves (see Fig. 2), virtual Reidemeister moves (see Fig. 3), mixed Reidemeister moves (see Fig. 4) and Forbidden moves (see. Fig. 5). Figure 2: Classical Reidemmeister moves Figure 3: Virtual Reidemeister moves 2 Figure 4: Mixed Reidemeister moves Figure 5: Forbidden moves In the theory of fused links every knot is equivalent to the unknot [15]. However not every link is equivalent to the trivial link. For example, trivial 2-component link, Hopf link and Hopf link with one virtual crossing and with one classical crossing all are different (see Fig. 6). Figure 6: Different 2-component fused links The full classification of fused links is not (completely) trivial. In particular, A. Fish and E. Keyman proved that the fused link with classical crossings only is completely determined by the linking numbers of each pair of components [9]. It means that the set of linking numbers for each pair of components of fused links is a full invariant for fused links which have only classical crossings. In the present paper we find all non-equivalent classes of fused links and construct an easy computable full invariant for fused links. We use the following proposition, which is implicitly formulated in [3]. Proposition. There exists a map %∗ : U V B∞ → U V P∞ , such that the closures of the braids β and %∗ (β) are equivalent as fused links. Denote by T the set of coset representatives of U V Pn /U V Pn0 and for the element α ∈ U V Pn denote by α ∈ T the unique coset representative αU V Pn0 = αU V Pn0 . Then the main result of the paper can be formulated in the following form. Theorem. Let α and β be unrestricted virtual braids. Then their closures α b and ∗ ∗ b β are equivalent as fused links if and only if % (α) and % (β) are conjugated by the element from Sn < U V Bn . Sn Thus the map α b → %∗ (α) is a complete invariant for fused links and in order to understand that two fused links α b an βb are equivalent or not we just need to 3 Sn Sn compare two finite sets %∗ (α) and %∗ (β) , or equivalently, to understand that the Sn element %∗ (α) belongs to the finite set %∗ (β) or not. At the almost same time B. Audoux, P. Bellingeri, J.-B. Meilhan and E. Wagner found the full classification of fused links independently from the author [1, Theorem 2.5]. Using the different from the author’s methods they proved that every fused link is completely determined by the set of virtual linking numbers for each pair of components. The result is the same (however in different formulation) and these two approaches seem to us complementary and both interesting. The author is grateful to Valeriy Bardakov for multiple helpful advices during the work on the paper. Also the author would like to thank the University of Bologna (Italy) where a part of this work was completed and especially Prof. Michele Mulazzani for his help and support. 2 Definitions and results In this section we fix notation and recall basic definitions and known results about different generalizations of braid groups. The classical braid group Bn on n strands (n > 1) is the group generated by the elements σ1 , . . . , σn−1 (see Fig. 7) Figure 7: Geometric braids representing σi (on the left) and σi−1 (on the right) with the following defining relations. i = 1, . . . , n − 2; |i − j| ≥ 2. σi σi+1 σi = σi+1 σi σi+1 σi σj = σj σi (B1 ) (B2 ) There exists a homomorphism ι : Bn → Sn from the braid group Bn onto the symmetric group Sn on n letters. This homomorphism maps the generator σi to the transposition τi = (i, i + 1) for i = 1, 2, . . . , n − 1. The kernel of this homomorphism is called pure braid group on n strands and denoted by Pn . The virtual braid group V Bn is a group obtained from Bn adding new generators ρ1 , . . . , ρn−1 (see Fig. 8) and additional relations i = 1, . . . , n − 2; |i − j| ≥ 2; i = 1, . . . , n − 1; ρi ρi+1 ρi = ρi+1 ρi ρi+1 ρi ρj = ρj ρi ρ2i = 1 4 (P1 ) (P2 ) (P3 ) |i − j| ≥ 2; i = 1, . . . , n − 2. σi ρj = ρj σi ρi ρi+1 σi = σi+1 ρi ρi+1 (M1 ) (M2 ) It is easy to verify that the elements ρ1 , . . . , ρn−1 generate the symmetric group Sn . Also it is known that the elements σ1 , . . . , σn−1 generate the braid group Bn . In the paper [11] it is proved that the relations i = 1, . . . , n − 2; i = 1, . . . , n − 2; ρi σi+1 σi = σi+1 σi ρi+1 ρi+1 σi σi+1 = σi σi+1 ρi (F1 ) (F2 ) do not hold in the group V Bn . According to [8] the welded braid group W Bn on n strands is a quotient of the group V Bn by the forbidden relation (F1 ), i. e. it is a group with the generators σ1 , . . . , σn−1 , ρ1 , . . . , ρn−1 and relations (B1 )–(F1 ). If we add to the group W Bn the second forbidden relation (F2 ) the we get the unrestricted virtual braid group U V Bn . The elements σ1 , . . . , σn−2 , ρ1 , . . . , ρn−2 generate the subgroup U V Bn−1 in the group U V Bn . Then we have the following chain of inclusions. [ U V B2 < U V B3 < U V B4 < · · · < U V B∞ = U V Bn n≥2 The homomorphism ι can be extended to the homomorphism U V Bn → Sn by the rule ι : σi , ρi 7→ τi = (i i + 1). The kernel of this homomorphism is called pure unrestricted virtual braid group and is denoted by U V Pn . The group U V P∞ is defined analogically to the group U V B∞ . [ U V P2 < U V P3 < U V P4 < · · · < U V P∞ = U V Pn n≥2 The symmetric group Sn acts on the set {1, . . . , n}. By the symbol π(k) we denote an image of the integer k ∈ {1, . . . , n} under the permutation π. If for the braid α we have ι(α)(k) = k, then we say that α fixes k or k is fixed by α. We say that the braid α does not involve the strand j if α belongs to the group hσ1 , . . . , σj−2 , σj+1 , . . . , σn−1 , ρ1 , . . . , ρj−2 , ρj+1 , . . . , ρn−1 i. It is obvious that the braid α ∈ hρ1 , . . . , ρn−1 i which fixes the strands n − 1, n does not involve an n-strand. We say that the braid β ∈ U V Bn+1 is obtained from the braid α ∈ U V Bn by right stabilization of positive (negative, virtual) type if β = ασn (β = ασn−1 , Figure 8: Geometric braid representing ρi 5 β = αρn respectively). In this case we say that the braid α is obtained from the braid β by the opposite to the right stabilization of positive (negative, virtual) type transformation. S. Kamada proved an analogue of Markov theorem for welded links in [14, Theorem 2]. Theorem 1. Closures of two welded braids α and β are equivalent as welded links if and only if they are related by the finite sequence of the following transformations. 1. A conjugation in the welded braid group, 2. A right stabilization of positive, negative or virtual type, 3. An opposite to a right stabilization of positive, negative or virtual type transformation. This theorem also holds for fused links since every relation of welded braid group is fulfilled in the unrestricted virtual braid group. Let us define some element of U V Bn . For i = 1, . . . , n − 1 : λi,i+1 = ρi σi−1 , λi+1,i = ρi λi,i+1 ρi = σi−1 ρi . For 1 ≤ i < j − 1 ≤ n − 1: λi,j = ρj−1 ρj−2 . . . ρi+1 λi,i+1 ρi+1 . . . ρj−2 ρj−1 , λj,i = ρj−1 ρj−2 . . . ρi+1 λi+1,i ρi+1 . . . ρj−2 ρj−1 . The elements λi,j and λj,i for i < j belong to the pure unrestricted virtual braid group U V Pn and have the following geometric interpretation (see Fig. 9). Figure 9: Geometric braids representing λi,j (on the left) and λj,i (on the right) The following lemma is proved in [4, Lemma 1] for the corresponding elements in V Bn and therefore is also true in the quotient U V Bn . Lemma 1. The following conjugating rules are fulfilled in U V Bn : 6 1. for 1 ≤ i < j ≤ n and k < i − 1 or i < k < j − 1 or k > j: ρk λi,j ρk = λi,j , ρk λj,i ρk = λj,i ; 2. for 1 ≤ i < j ≤ n: ρi−1 λi,j ρi−1 = λi−1,j , ρi−1 λj,i ρi−1 = λj,i−1 ; 3. for 1 ≤ i < j − 1 ≤ n: ρi λi,i+1 ρi = λi+1,i , ρi λi,j ρi = λi+1,j , ρi λi+1,i ρi = λi,i+1 , ρi λj,i ρi = λj,i+1 ; 4. for 1 ≤ i + 1 < j ≤ n: ρj−1 λi,j ρj−1 = λi,j−1 , ρj−1 λj,i ρj−1 = λj−1,i ; 5. for 1 ≤ i < j ≤ n: ρj λi,j ρj = λi,j+1 , ρj λj,i ρj = λj+1,i . The following result on the structure of the pure unrestricted virtual braid group U V Pn is presented in [3, Theorem 2.7]. Theorem 2. The group U V Pn has a presentation with generators λk,l for 1 ≤ k 6= l ≤ n, and defining relations: λi,j commutes with λk,l if and only if {i, j} = 6 {k, l}. Let Uj be the subgroup of U V Pn generated by the elements {λi,j , λj,i | 1 ≤ i < j}. Then by Theorem 2 we have Uj = hλ1,j , λj,1 i × hλ2,j , λj,2 i × · · · × hλj−1,j , λj,j−1 i = F2 × · · · × F2 , (1) U V Pn = U2 × U3 × · · · × Un . (2) The structure of the unrestricted virtual braid group U V Bn follows from Lemma 1 and the theorem 2 and is also given in [3, Theorem 2.4]. Theorem 3. The group U V Bn is isomorphic to the semidirect product U V Pn hSn , where the symmetric group Sn acts by permutations on the indices of generators λi,j of U V Pn . Denote by Bi,j = ρj−1 ρj−2 . . . ρi+1 ρi if i < j and Bi,j = 1 in other cases. Using simple calculations in the group Sn it is easy to see that for i < j the image ι(Bi,j ) is a cycle (i i + 1 . . . j). 7 3 Construction of %∗ In this section we construct the map %∗ : U V B∞ → U V P∞ , which is implicitly constructed in [3]. At first we prove the following lemma. Lemma 2. Let α ∈ U V Bn and s ∈ {1, . . . , n} be a maximal number, such that ι(α)(s) 6= s. Then α can be uniquely expressed in the form α = γxs Bks ,s xs+1 xs+2 . . . xn , where xi ∈ Ui and the braid γ ∈ U V Bn does not involve the strands s, s + 1, . . . , n. Proof. By the theorem 3 for certain elements β ∈ U V Pn and π ∈ Sn we have α = βπ. (3) Let ks = π(s) = ι(βπ)(s) = ι(α)(s) 6= s. Since ι(α) is a bijection of {1, . . . , n} and ι(α)(s) = ks , then we have ι(α)(ks ) 6= ks . Since s is a maximal number with the condition ι(α)(s) 6= s then ks < s and therefore Bks ,s 6= 1. Since the permutations π and Bk−1 act identically on the integers s + 1, . . . , n, s ,s −1 then the permutation δ = πBks ,s also acts identically on the integers s + 1, . . . , n. Moreover the image of the integer s under the permutation δ is equal to s Bk−1 s ,s π s −−−→ ks −−−−→ s, therefore δ = πBk−1 acts identically on the integers s, . . . , n. s ,s By the equality (2) for certain elements yj ∈ Uj we have β = y2 y3 . . . yn , and therefore we can rewrite the equality (3). α = βπ = y2 y3 . . . yn δBks ,s = δ(y2 y3 . . . yn )δ Bks ,s (4) Since (y2 . . . yn ) is a pure braid, then (y2 y3 . . . yn )δ is a pure braid and therefore by the equality (2) we have (y2 y3 . . . yn )δ = z2 . . . zn for certain elements zj ∈ Uj . The braids z2 , . . . , zs−1 do not involve the strands s, s + 1, . . . , n, therefore the braid γ = δz2 . . . zs−1 does not involve the strands s, s + 1, . . . , n. Then the equality (4) can be rewritten in the following form. α = δ(y2 y3 . . . yn )δ Bks ,s = δz2 . . . zs−1 zs zs+1 . . . zn Bks ,s B B ks ,s = γzs zs+1 . . . zn Bks ,s = γzs Bks ,s (zs+1 . . . zn )Bks ,s = γzs Bks ,s zs+1 . . . zn ks ,s Since zj ∈ Uj = hλ1,j , λj,1 i×hλ2,j , λj,2 i×· · ·×hλj−1,j , λj,j−1 i, then by the theorem B 3 for every j = s + 1, . . . , n we have zj ks ,s ∈ Uj . Therefore, if we denote xs = zs , Bks ,s B xs+1 = zs+1 , . . . , xn = zn ks ,s then we have α = γxs Bks ,s xs+1 . . . xn . 8 and we proved that the braid α can be written in the form from the formulation of the lemma. To prove that such a representation is unique we consider another representation of α in the form from the formulation of the lemma α = γxs Bks ,s xs+1 . . . xn = ηys Bts ,s ys+1 . . . yn (5) and prove that γ = η, ks = ts and xj = yj for every j = s, . . . , n. From the equality (5) we have η −1 γ = ys Bts ,s ys+1 . . . yn (xs Bks ,s xs+1 . . . xn )−1 (6) Without loss of generality consider that ts ≤ ks and look at the images of the braids from the right and left sides of this equality under the homomorphism ι. The permutation ι(ys Bts ,s ys+1 . . . yn (xs Bks ,s xs+1 . . . xn )−1 ) maps s to s if ts = ks and maps s to ts if ts < ks ι(ys Bt ι((xs Bk ,s ys+1 ...yn ) −1 ) ,s xs+1 ...xn ) s s −−−−−− −−−−−−→ ts −−−−−−s−−−−−−−−−→ ts . At the same time since η and γ does not involve the strands s, . . . , n, then s is fixed by the permutation ι(η −1 γ) and therefore ts = ks . Then from the equality (6) we have ι(ys Bts ,s ys+1 . . . yn (xs Bks ,s xs+1 . . . xn )−1 ) = 1 and ι(η −1 γ) = 1. Therefore η −1 γ ∈ U V Pn and since it does not involve the strands s, s + 1, . . . n, we have η −1 γ ∈ hU2 , . . . , Us−1 i. On the other side the braid ys Bts ,s ys+1 . . . yn (xs Bks ,s xs+1 . . . xn )−1 can be rewritten in the following form. −1 −1 −1 ys Bts ,s ys+1 . . . yn (xs Bks ,s xs+1 . . . xn )−1 = ys Bts ,s ys+1 . . . yn x−1 n . . . xs+1 Bts ,s xs −1 −1 −1 Bts ,s −1 = ys Bts ,s Bt−1 (ys+1 . . . yn x−1 xs n . . . xs+1 xs ) s ,s −1 −1 −1 Bts ,s −1 = ys (ys+1 . . . yn x−1 xs n . . . xs+1 xs ) B −1 −1 Bts ,s By the theorem 3 for every j = s + 1, . . . , n we have yj ts ,s ∈ Uj , (x−1 ∈ Uj , j ) therefore ys Bts ,s ys+1 . . . yn (xs Bks ,s xs+1 . . . xn )−1 ∈ hUs , . . . , Un i. From the equality (2) we have hU2 , . . . , Us−1 i ∩ hUs , . . . , Un i = 1, therefore η = γ and xs Bks ,s xs+1 . . . xn = ys Bts ,s ys+1 . . . yn . The lemma is proved. The following lemma has a bit different formulation in the paper [3] and it completely proved there. However here we formulate the lemma in the other words and repeat the proof from [3] since this lemma is extremely important in our paper. 9 Lemma 3. There exists a map % : U V B∞ → U V B∞ with the following conditions. 1. For any α the closures of α and %(α) are equivalent as double welded links. 2. If α ∈ U V P∞ , then %(α) = α. 3. If α ∈ U V Bn \ U V Pn , then %(α) ∈ U V Bn−1 . Proof. We explicitly construct the image of the braid α ∈ U V Bn under the map %. If α ∈ U V Pn , then %(α) = α and there is nothing to construct. So let α ∈ U V Bn \ U V Pn , then the algorithm of finding %(α) has the following steps. Step 1. Find a maximal number s ∈ {1, . . . , n} with the condition ι(α)(s) = ks 6= s. n−s Step 2. Conjugate the braid α by the element B1,n . s−n n−s α1 = B1,n δB1,n The fused link α b1 is equivalent to α b, and the permutation induced by the braid α1 maps n to kn = n − s + ks < n s−n B1,n n−s B1,n α n −−−−→ s −−−→ ks −−−−→ n − s + ks = kn . Step 3. By Lemma 2 express the braid α1 in the form α1 = γw1 . . . wn−1 ρn−1 Bkn ,n−1 , where the braid γ does not involve the strand n and wi ∈ hλi,n , λn,i i for i = 1, . . . , n (see Fig. 10). Figure 10: The braid α1 By Lemma 2 we have α1 = γxn Bkn ,n , where the braid γ does not involve an n-strand and xn ∈ Un . By the equality (1) we have xn = w1 . . . wn−1 for wi ∈ hλi,n , λn,i i. Sine Bkn ,n 6= 1, then Bkn ,n = ρn−1 Bkn ,n−1 . 10 Step 4. Change the braid α1 by the braid α2 = γw1 . . . wn−2 ρn−1 Bkn ,n−1 . From the figure 10 it is obvious that all the crossings of wn−1 belong to the same component of α b1 , therefore, we can virtualize all the classical crossings of wn−1 ρn−1 using Kanenobu’s technique [15, Proof of the theorem 1], i. e. to change σn−1 to ρn−1 in the representation of wn−1 and to obtain a braid α2 such that α b2 and α b1 are equivalent as fused links. −1 −1 Since wn−1 ∈ hλn−1,n , λn,n−1 i and λn−1,n = ρn−1 σn−1 , λn,n−1 = σn−1 ρn−1 , then after virtualization of classical crossings the braid wn−1 ρn−1 involved an odd number of ρn−1 and we obtain ρn−1 instead of wn−1 ρn−1 . Therefore the closure of the braid α2 = γw1 . . . wn−2 ρn−1 Bkn ,n−1 is equivalent to the closure of the braid α1 as fused link. Step 5. Construct %(α). Note that by Lemma 1 for all λj,n and λn,j with j < n − 1 we have: λj,n ρn−1 = ρn−1 λj,n−1 , λn,j ρn−1 = ρn−1 λn−1,j . ρ 0 Bkn ,n−1 , where wi0 = wi n−1 is a braid from Therefore α2 = γρn−1 w10 . . . wn−2 hλi,n−1 , λn−1,i i and hence does not involve an n-strand (see Fig. 11). Figure 11: The braid α2 In the braid α2 there is only one (virtual) crossing on the n-strand, so, using 0 Markov moves we obtain a new braid α3 = γw10 . . . wn−2 Bkn ,n−1 whose closure is again equivalent to α b and has n − 1 strands. We have constructed the braid 0 Bkn ,n−1 . %(α) = α3 = γw10 . . . wn−2 The lemma is proved. 11 Remark 1. It is obvious that the equality %(α) = %(α1 ) = %(α2 ) holds in Lemma 2. Let α ∈ U V Bn , then the sequence %(α), %2 (α), . . . is stabilized on some step. Let %∗ be such a map which maps the braid α to the braid %k (α), where k is a minimal integer such that %k (α) = %k+1 (α). Every step of finding %(α) is clearly defined, therefore %∗ is a correct function. Using simple induction on the number n it is easy to prove the following fact. Remark 2. Let α ∈ U V Bn be the braid, such that %∗ (α) ∈ U V Pm . If α = βγ for β ∈ U V Bn , γ ∈ U V Pn0 , then %∗ (α) = %∗ (β)δ, where δ ∈ U V Pm0 . From Lemma 3 We have the following corollary which is formulated and proved in the paper [3]. Proposition 1. Let α ∈ U V Bn be an unrestricted virtual braid, such that its closure α b has m components. Then there exists a pure unrestricted virtual braid b β ∈ U V Pm , such that α b = β. Proof. β = %∗ (α). 4 Proof of the main results Lemma 4. Let α ∈ U V Pn and u, v ∈ hλn−1,n , λn,n−1 i. Then the closure of the braids α and α[u, v] are equivalent as fused links. Proof. Let γ be the following braid from U V Bn+2 γ = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 Bn−1,n+2 . Here the braid αu−1 ρn−1 does not involve the strands n + 1, n + 2 and the braid uρn ρn−1 belongs to hλn,n+1 , λn+1,n i. Let us find the braid %(γ). Step 1. Since ι(γ)(n + 2) = n − 1, then the maximal number which is not fixed by γ is equal to n + 2. Step 2. γ1 = γ. Step 3. γ = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 Bn−1,n+2 , where the braid αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 does not involve the strand n + 2. Step 4. γ2 = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 ρn+1 Bn−1,n+1 . Step 5. %(γ) = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 Bn−1,n+1 . 12 Let us find the braid %2 (γ). Step 1. Since ι(%(γ))(n + 1) = n, then the maximal number which is not fixed by %(γ) is equal to n + 1. Step 2. %(γ)1 = %(γ). Step 3. The braid %(γ) can be rewritten %(γ) = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 Bn−1,n+1 = αu−1 ρn−1 uρn ρn−1 ρn−1 ρn = αu−1 ρn−1 uρn ρn−1 ρn−1 ρn = αu−1 uρn ρn , where the braid αu−1 does not involve the strand n + 1 and uρn belongs to hλn−1,n+1 , λn+1,n−1 i. Step 4. %(γ)2 = αu−1 uρn ρn . Step 5. %2 (γ) = α. Since %2 (γ) = α is a pure braid, then %∗ (γ) = α. Let w = v ρn−1 Bn−1,n+1 Bn−1,n+2 , then by Lemma 1 the braid w belongs to hλn+2,n+1 , λn+1,n+2 i. Denote by δ = wγw−1 and find the braid %∗ (δ). At first find the braid %(δ). Step 1. Since w is a pure braid, then the maximal number, which is not fixed by δ is equal to the maximal number which is not fixed by γ and is equal to n + 2. Step 2. δ1 = δ. Step 3. The braid δ can be rewritten in details δ = wγw−1 = wαu−1 ρn−1 uρn ρn−1 Bn−1,n+1 Bn−1,n+2 w−1 −1 = αu−1 ρn−1 uρn ρn−1 wBn−1,n+1 (w−1 )Bn−1,n+2 Bn−1,n+2 −1 = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 wBn−1,n+1 (w−1 )Bn−1,n+2 Bn−1,n+2 −1 = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 (w−1 )Bn−1,n+2 wBn−1,n+1 Bn−1,n+2 , −1 where the braid αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 (w−1 )Bn−1,n+2 does not involve the strand n + 2 and the braid wBn−1,n+1 belongs to hλn+2,n , λn,n+2 i. −1 Step 4. δ2 = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 (w−1 )Bn−1,n+2 wBn−1,n+1 ρn+1 Bn−1,n+1 . −1 Step 5. %(γ) = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 (w−1 )Bn−1,n+2 wBn−1,n+1 ρn+1 Bn−1,n+1 . Let us fin the braid %2 (δ) 13 Step 1. Since ι(%(δ))(n + 1) = n, then n + 1 is maximal number which is not fixed by %(δ). Step 2. %(δ)1 = %(δ). Step 3. The braid %(δ) can be rewritten in details −1 %(δ) = αu−1 ρn−1 uρn ρn−1 Bn−1,n+1 (w−1 )Bn−1,n+2 wBn−1,n+1 ρn+1 Bn−1,n+1 −1 −1 −1 −1 −1 −1 = αu−1 ρn−1 uρn ρn−1 (w−1 )Bn−1,n+2 Bn−1,n+1 wBn−1,n+1 ρn+1 Bn−1,n+1 Bn−1,n+1 Bn−1,n+1 = αu−1 ρn−1 uρn ρn−1 (w−1 )Bn−1,n+2 Bn−1,n+1 wBn−1,n+1 ρn+1 Bn−1,n+1 ρn−1 ρn −1 −1 −1 = αu−1 uρn (w−1 )Bn−1,n+2 Bn−1,n+1 ρn−1 wBn−1,n+1 ρn+1 Bn−1,n+1 ρn−1 ρn −1 −1 −1 = αu−1 (w−1 )Bn−1,n+2 Bn−1,n+1 ρn−1 uρn wBn−1,n+1 ρn+1 Bn−1,n+1 ρn−1 ρn , −1 −1 where the braid αu−1 (w−1 )Bn−1,n+2 Bn−1,n+1 ρn−1 does not involve the strand n+1 −1 and the braid uρn wwBn−1,n+1 ρn+1 Bn−1,n+1 ρn−1 belongs to hλn−1,n+1 , λn+1,n−1 i. −1 −1 −1 Step 4. %(δ)2 = αu−1 (w−1 )Bn−1,n+2 Bn−1,n+1 ρn−1 uρn wBn−1,n+1 ρn+1 Bn−1,n+1 ρn−1 ρn . Step 5. The braid %2 (δ) follows −1 −1 −1 %2 (δ) = αu−1 (w−1 )Bn−1,n+2 Bn−1,n+1 ρn−1 uwBn−1,n+1 ρn+1 Bn−1,n+1 ρn−1 ρn . −1 −1 Since w = v ρn−1 Bn−1,n+1 Bn−1,n+2 , then (w−1 )Bn−1,n+2 Bn−1,n+1 ρn−1 = v −1 and −1 wBn−1,n+1 ρn+1 Bn−1,n+1 ρn−1 ρn = v −1 ρn−1 Bn−1,n+1 Bn−1,n+2 Bn−1,n+1 ρn+1 Bn−1,n+1 ρn−1 ρn = v ρn−1 Bn−1,n+1 Bn−1,n+2 Bn−1,n+1 ρn+1 ρn−1 ρn ρn−1 ρn = v ρn−1 Bn−1,n+1 Bn−1,n+2 Bn−1,n+1 ρn+1 ρn ρn−1 = v ρn−1 Bn−1,n+2 Bn,n+2 Bn−1,n+1 ρn+1 ρn ρn−1 = v ρn−1 Bn−1,n+2 ρn+1 ρn−1 ρn+1 ρn ρn−1 = v ρn−1 Bn−1,n+2 ρn−1 ρn ρn−1 = v ρn−1 ρn+1 ρn−1 = v ρn+1 =v (since v ∈ hλn−1,n , λn,n−1 i) Therefore %2 (δ) = αu−1 v −1 uv = α[u, v]. Since %2 (δ) is a pure braid, then %∗ (δ) = %2 (δ) = α[u, v]. −1 Since the closures of the braids γ and δ = γ w define equivalent fused links, then the closures of the braids %∗ (γ) = α and %∗ (δ) = α[u, v] define equivalent fused links. The lemms is proved. Denote by T the set of coset representatives of U V Pn /U V Pn0 and for the element α ∈ U V Pn denote by α ∈ T the unique coset representative αU V Pn0 = αU V Pn0 . The following statement almost immediately follows from Lemma 4. 14 Corollary 1. Let α, β ∈ U V Pn be unrestricted virtual braids, such that α and β are conjugated by the element from Sn . Then the fused links α b and βb are equivalent. Proof. Since α and β are conjugated by the element from Sn then the closures of the braids α and β are equivalent fused links. Therefore it is enough to prove that the closure of the braid α is equivalent to the closure of the braid α and the closure of the braid β is equivalent to the closure of the braid β. Since αU V Pn0 = αU V Pn0 , then α = α[u1 , v1 ][u2 , v2 ] . . . [uk , vk ] for certain elements ui , vi ∈ U V Pn , i = 1, . . . , k. By Theorem 2 we can consider that ui , vi ∈ hλri ,si , λsi ,rI i. Denote by α0 = α, α1 = α0 [u1 , v1 ], α2 = α1 [u2 , v2 ], . . . , αk = αk−1 [uk , vk ] = α. If we prove that the closure of αi and the closure of αi−1 define the same fused link for every i = 1, . . . , k, then we prove that the closures of the braids α and α are equivalent as fused links. Therefore we can consider that α = α[u, v] for some u, v ∈ hλr,s , λs,r i. The closure of the braid α is equivalent to the closure of the braid αµ for any µ ∈ Sn < U V Bn . If µ is a permutation which maps s to n − 1 and maps r to n, then the closure of the braid α is equivalent to the closure of the braid αµ = αµ [uµ , v µ ]. By Theorem 3 the braids uµ , v µ belong to hλn−1,n , λn,n−1 i, thus by Lemma 4 the closure of the braid α is equivalent to the closure of the braid αµ and is also equivalent to the closure of α. The closure of β is equivalent to the closure of β by the same reasons. The corollary is proved. Proposition 2. Let α, β ∈ U V B∞ be unrestricted virtual braids, such that α b ∗ ∗ b and β are equivalent fused links with m components. Then % (α) and % (β) are conjugated by the element from Sn . Proof. Since the links α b and βb are equivalent, then by Theorem 1 the braids α and β are related by the finite sequence of Markov’s transformations. It means that there is a finite sequence of braids α = α0 , α1 , . . . , αk = β such that αj+1 is obtained from αj by conjugation in U V B∞ , by right stabilization or by inverse to right stabilization transformation. If we prove that %∗ (αj ) and %∗ (αj+1 ) are conjugated by the element from Sn for every j = 0, . . . , k − 1, than we prove that %∗ (α) and %∗ (β) are conjugated by the element from Sn , therefore we can consider that β is obtained from α using only one Markov’s transformation. Case 1. The braid β is obtained from the braid α by right stabilization of positive, negative or virtual type. We consider only the case of right stabilization of positive type (β = ασn ), the cases of right stabilization of negative and virtual type are similar. Let us count the image of β under the map %: 15 Step 1. Since β = ασn , then ι(β)(n + 1) = ι(ασn )(n + 1) = n 6= n + 1 α σ n → n, n + 1 −−−→ n + 1 −−− therefore n + 1 is a maximal number which is not fixed by β. n+1−(n+1) Step 2. β1 = B1,n+1 n+1−(n+1) βB1,n+1 = β. Step 3. We can rewrite the braid β1 in the following form β1 = β = ασn = ασn ρn ρn = αλ−1 n,n+1 ρn , where the braid α does not involve the strand n+1 and λ−1 n,n+1 ∈ hλn,n+1 , λn+1,n i. Step 4. β2 = αρn . Step 5. %(β) = α. Since %(β) = α, then %∗ (β) = %∗ (α) (and they the braids %∗ (β) and %∗ (α) are certainly conjugated). Case 2. The braid β is obtained from the braid α by an opposite to a right stabilization of positive, negative or virtual type transformation. In this case the braid α is obtained from the braid β by right stabilization of positive (negative, virtual) type and by the case 1 we have %∗ (α) = %∗ (β). Case 3. The braid β is obtained from the braid α by conjugation in U V Bn . Since the braid α and β are conjugated, then for some braid θ we have β = αθ . Since σi = ρi λi,i+1 , then θ = y1 y2 . . . yr , where ±1 ±1 yi ∈ {ρ1 , . . . , ρn−1 , λ±1 1,2 , λ2,3 , . . . , λn−1,n }. If we denote δ1 = α, δ2 = δ1y1 , δ3 = δ2y2 , . . . , δr+1 = δryr = β and prove that %∗ (δj ) is conjugated with %∗ (δj+1 ) by the element from Sn for every j = 1, . . . , r + 1, then we prove that %∗ (α) is conjugated with %∗ (β) by the element from Sn . Therefore we can consider that β is obtained from α conjugating by ρi or λ±1 i,i+1 for some i. We use the induction by the parameter n − m, i. e. by the difference between the number of strands in the braid α and the number components in the link α b. ∗ ∗ If n−m = 0, then α and β are pure braids and % (α) = α, % (β) = β. Let β = αµ for some braid µ ∈ U V Bn , then by Theorem 3 for certain elements β ∈ U V Pn and π ∈ Sn the braid µ can be presented as a product µ = βπ. Therefore %∗ (β) = β = αµ = µ−1 αµ = π −1 β −1 αβπ = π −1 αβ −1 [β −1 , α]βπ = π −1 α[β −1 , α]β π = π −1 %∗ (α)[β −1 , αβ ]π 16 Since α, β ∈ U V Pn , then [β −1 , αβ ] ∈ U V Pn0 , therefore %∗ (α)[β −1 , αβ ] = %∗ (α) and π %∗ (β) = %∗ (α) . If n − m > 0, then α, β ∈ U V Bn \ U V Pn , %∗ (α) 6= α, %∗ (β) 6= β and we have the following cases Case 3.1. The braid β is obtained from α conjugating by ρi . Let us find %(α). Step 1. Let s be a maximal number which is not fixed by α and ι(α)(s) = ks . s−n n−s Step 2. Since α1 = B1,n αB1,n , then ι(α1 )(n) = ks + n − s = kn 6= n. s−n B1,n n−s B1,n α n −−−−→ s −−−→ ks −−−−→ ks + n − s = kn . Step 3. Express the braid α1 in the form n−s s−n = γw1 . . . wn−1 ρn−1 Bkn ,n−1 , αB1,n α1 = B1,n (7) where the braid γ does not involve the strand n and wi ∈ hλi,n , λn,i i. Step 4. α2 = γw1 . . . wn−2 ρn−1 Bkn ,n−1 . Step 5. The braid %(α) has the following form ρ ρ n−1 %(α) = γw1 n−1 . . . wn−2 Bkn ,n−1 , (8) ρ where wj n−1 ∈ Un−1 does not involve the strand n. Case 3.1.1. i ≤ ks − 2. Let us count the braid %(β) = %(ρi αρi ). Step 1. Since i ≤ ks − 2, then ρi fixes s and ks , therefore s is a maximal number which is not fixed by β and ι(β)(s) = ks . ρi ρi α s −−−→ s −−−→ ks −−−→ ks s−n n−s Step 2. We have β1 = B1,n βB1,n , then the permutation ι(β) maps n to kn 6= n. s−n B1,n n−s B1,n β n −−−−→ s −−−→ ks −−−−→ ks + n − s = kn Step 3. For i ≤ ks − 2 we have ρi B1,n = ρi ρn−1 . . . ρ1 = ρi ρn−1 . . . ρi+2 ρi+1 ρi ρi−1 . . . ρ1 = ρn−1 . . . ρi+2 ρi ρi+1 ρi ρi−1 . . . ρ1 = ρn−1 . . . ρi+2 ρi+1 ρi ρi+1 ρi−1 . . . ρ1 = ρn−1 . . . ρi+2 ρi+1 ρi ρi−1 . . . ρ1 ρi+1 = B1,n ρi+1 , 17 n−s n−s therefore ρi B1,n = B1,n ρi+n−s and hence we have s−n n−s s−n n−s s−n n−s β1 = B1,n βB1,n = B1,n ρi αρi B1,n = ρi+n−s B1,n αB1,n ρi+n−s = ρi+n−s γw1 . . . wn−1 ρn−1 Bkn ,n−1 ρi+n−s ρi+n−s ρi+n−s ρi+n−s = γ ρi+n−s (w1 . . . wn−2 )ρi+n−s wn−1 ρn−1 Bkn ,n−1 Since i ≤ ks − 2, then i + n − s ≤ ks − 2 + n − s = kn − 2 < n − 2, therefore ρ ρi+n−s ρi+n−s Bkni+n−s = wn−1 , ρn−1 = ρn−1 and the braid γ ρi+n−s does ,n−1 = Bkn ,n−1 , wn−1 not involve the strand n. Since ρi+n−s fixes n, then (w1 . . . wn−2 )ρi+n−s belongs to hλ1,n , λn,1 i × · · · × hλn−2,n , λn,n−2 i. Then we have β1 = γ ρi+n−s (w1 . . . wn−2 )ρi+n−s wn−1 ρn−1 Bkn ,n−1 . Step 4. β2 = γ ρi+n−s (w1 . . . wn−2 )ρi+n−s ρn−1 Bks ,n−1 Step 5. Since i + n − s < n − 2, then ρn−1 and ρi+n−s commute, therefore the braid %(β) has the following form %(β) = γ ρi+n−s (w1 . . . wn−2 )ρi+n−s ρn−1 Bkn ,n−1 = γ ρi+n−s (w1 . . . wn−2 )ρn−1 ρi+n−s Bkn ,n−1 ρ = γ ρi+n−s ((w1 . . . wn−2 )ρn−1 )ρi+n−s Bkni+n−s ,n−1 = (γ(w1 . . . wn−2 )ρn−1 Bkn ,n−1 )ρi+n−s = %(α)ρi+n−s Therefore %(β) = %(α)ρi+n−s and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.1.2. i = ks − 1. Let us find the braid %(β). Step 1. Since ks ≤ s − 1, then i = ks − 1 ≤ s − 2 and ρi fixes the strands s. Then the image of s under the permutation β = ρks −1 αρks −1 is equal to ks − 1. ρk −1 ρk α −1 s s s −−− −→ s −−−→ ks −−− −→ ks − 1. Therefore s is a maximal number which is not foxed by β. n−s s−n and ι(β1 )(n) = kn − 1. Step 2. We have β1 = B1,n βB1,n s−n B1,n n−s B1,n β n −−−−→ s −−−→ ks − 1 −−−−→ n − s + ks − 1 = kn − 1 Step 3. Using the same arguments as in the case 3.1.1 we have n−s n−s n−s ρks −1 B1,n = B1,n ρn−s+ks −1 = B1,n ρkn −1 . 18 Therefore the braid β1 has the following form n−s s−n n−s s−n n−s s−n ρkn −1 αB1,n = ρkn −1 B1,n ρks −1 αρks −1 B1,n = B1,n βB1,n β1 = B1,n = ρkn −1 γw1 . . . wn−1 ρn−1 Bkn ,n−1 ρkn −1 ρkn −1 ρkn −1 ρkn −1 ρn−1 Bkn ,n−1 = γ ρkn −1 (w1 . . . wn−2 )ρkn −1 wn−1 ρ ρ −1 kn −1 = ρkn −1 Bkn −1,n , then we have Bknkn,n−1 Since ρn−1 ρ kn −1 ρkn −1 Bn,kn −1 β1 = γ ρkn −1 (w1 . . . wn−2 )ρkn −1 wn−1 ρkn −1 ρkn −1 (w1 . . . wn−2 )wn−1 Bn,kn −1 =γ = γ ρkn −1 ρkn −1 (w1 . . . wn−2 )wn−1 ρn−1 Bn−1,kn −1 Since kn ≤ n − 1, then kn − 1 ≤ n − 2, therefore the braid γ ρkn −1 ρkn −1 does not involve the strand n. Step 4. β2 = γ ρkn −1 ρkn −1 (w1 . . . wn−2 )ρn−1 Bn−1,kn −1 Step 5. The braid %(β) has the following form. %(β) = γ ρkn −1 ρkn −1 (w1 . . . wn−2 )ρn−1 Bn−1,kn −1 = γ ρkn −1 (w1 . . . wn−2 )ρn−1 ρkn −1 ρkn −1 Bn−1,kn −1 ρkn −1 = γ ρkn −1 (w1 . . . wn−2 )ρn−1 ρkn −1 Bn−1,k = %(α)ρkn −1 n Therefore %(β) = %(α)ρkn −1 and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.1.3. i = ks . Case 3.1.3.1. ks ≤ s − 2. Let us find the image of the braid β = ρks αρks under the map %. Step 1. Since ks ≤ s−2, then and ρks fixes s and the image of s under the permutation ι(β) is equal to ks + 1. ρk α ρk s −−−s→ s −−−→ ks −−−s→ ks + 1 Therefore s is a maximal number which is not fixed by β. s−n n−s βB1,n and ι(β1 )(n) = kn + 1. Step 2. We have β1 = B1,n s−n B1,n n−s B1,n β n −−−−→ s −−−→ ks + 1 −−−−→ kn + 1, 19 n−s n−s Step 3. Analogically to the case 3.1.1, since ks ≤ s − 2, then ρks B1,n = B1,n ρkn . Therefore the braid β1 has the following form. s−n n−s s−n n−s s−n n−s β1 = B1,n βB1,n = B1,n ρks αρks B1,n = ρkn B1,n αB1,n ρk n = ρkn γw1 . . . wn−1 ρn−1 Bkn ,n−1 ρkn ρ ρkn ρkn ρn−1 Bknkn,n−1 = γ ρkn (w1 . . . wn−2 )ρkn wn−1 ρ ρ kn Bknkn,n−1 ρkn Bkn +1,n , then we have Since ρn−1 ρ kn ρkn Bkn +1,n β1 = γ ρkn (w1 . . . wn−2 )ρkn wn−1 ρkn = γ ρkn (w1 . . . wn−2 )wn−1 Bkn +1,n . Since ks ≤ s − 2, then kn ≤ n − 2 and the braid γ ρkn ρkn does not involve the strand n. Step 4. β2 = γ ρkn ρkn (w1 . . . wn−2 )ρn−1 Bkn +1,n−1 Step 5. The braid %(β) has the form %(β) = γ ρkn ρkn (w1 . . . wn−2 )ρn−1 Bkn +1,n−1 = γ ρkn (w1 . . . wn−2 )ρn−1 ρkn ρkn Bkn +1,n−1 ρ = γ ρkn (w1 . . . wn−2 )ρn−1 ρkn Bknkn,n−1 = %(α)ρkn Therefore %(β) = %(α)ρkn and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.1.3.2. ks = s − 1. Case 3.1.3.2.1. ι(α)(s − 1) = s. From the formulas (7) and (8) we have α1 = γw1 . . . wn−1 ρn−1 Bkn ,n−1 , %(α) = γ(w1 . . . wn−2 )ρn−1 Bkn ,n−1 . Let us rewrite this equalities in more details. Since ι(α)(s) = s − 1, then ι(α1 )(n) = n − 1 and Bkn ,n = ρn−1 . s−n Bs,n n−s Bs,n α n −−−−→ s −−−→ s − 1 −−−−→ n − 1 Since ι(α)(s − 1) = s then ι(α1 ) maps (n − 1) to n. s−n Bs,n α n−s Bs,n n − 1 −−−−→ s − 1 −−−→ s −−−−→ n Therefore, since γ = α1 (Bkn ,n w1 . . . wn−1 )−1 , then ι(γ)(n − 1) = n − 1 −1 (Bkn ,n w1 ...wn−1 ) n − 1 −−−→ n −−−−−−−−−−−−−→ n − 1 α1 20 and by Lemma 2 we have γ = ηv1 . . . vn−2 , where η does not involve the strand n−1 and vj ∈ hλj,n−1 , λn−1,j i for j = 1, . . . , n−2. Therefore α1 = ηv1 . . . vn−2 w1 . . . wn−1 ρn−1 , %(α) = ηv1 . . . vn−2 (w1 . . . wn−2 )ρn−1 . Let us find the braid %(β). Step 1. Since ks = s−1 and ι(α)(s−1) = s, then the image of s under the permutation ι(β) = ι(ρks αρks ) = ι(ρs−1 αρs−1 ) is equal to s − 1. ρs−1 ρs−1 a α s −−−−→ s − 1 −−−→ s −−−−→ s − 1, then s is a maximal number which is not fixed by β. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = n − 1. s−n B1,n n−s B1,n β n −−−−→ s −−−→ s − 1 −−−−→ n − 1, n−s n−s Step 3. Since ρs−1 B1,n = B1,n ρn−1 , then we have s−n n−s s−n n−s s−n n−s β1 = B1,n βB1,n = B1,n ρs−1 αρs−1 B1,n = ρn−1 B1,n αB1,n ρn−1 = ρn−1 ηv1 . . . vn−2 w1 . . . wn−1 ρn−1 ρn−1 ρ ρn−1 ρn−1 ρn−1 ρn−1 = η ρn−1 v1 n−1 . . . vn−2 w1 . . . wn−2 wn−1 ρn−1 Since the braid η does not involve the strands n − 1, n, then η ρn−1 = η. Also by Lemma 1 for j = 1, . . . , n − 2 we have ρ ρ vj n−1 ∈ hλj,n , λn,j i, wj n−1 ∈ hλj,n−1 , λn−1,j i ρ n−1 and wn−1 ∈ hλn,n−1 , λn−1,n i. Therefore ρ ρ ρ ρ ρ n−1 n−1 n−1 β1 = ηw1 n−1 . . . wn−2 v1 n−1 . . . vn−2 wn−1 ρn−1 , ρ ρ ρ n−1 where the braid ηw1 n−1 . . . wn−2 does not involve the strand n, the braid vj n−1 ρn−1 belongs to hλj,n , λn,j i for j = 1, . . . , n − 2 and wn−1 ∈ hλn,n−1 , λn−1,n i. ρ ρ ρ ρ n−1 n−1 ρn−1 v1 n−1 . . . vn−2 Step 4. β2 = ηw1 n−1 . . . wn−2 Step 5. The braid %(β) has the following form ρ ρ n−1 v1 . . . vn−2 %(β) = ηw1 n−1 . . . wn−2 ρn−1 ρn−1 ρ ρn−1 , v1 . . . vn−2 ] = ηv1 . . . vn−2 w1 . . . wn−2 [w1 n−1 . . . wn−2 21 Therefore by the remark 2 the braids %∗ (β) and %∗ (α) are equal modulo U V Pm0 , i. e. %∗ (α) = %∗ (β) and these braids are certainly conjugated. Case 3.1.3.2.2. ι(α)(s − 1) = ks−1 ≤ s − 2. By the equalities (7) and (8) we have α1 = γw1 . . . wn−1 ρn−1 Bkn ,n−1 , %(α) = γ(w1 . . . wn−2 )ρn−1 Bkn ,n−1 . Let us rewrite these equalities in more details. Since ι(α1 )(n) = kn = n − 1, then Bkn ,n−1 = 1. Also we have ι(α1 )(n − 1) = n − s + ks−1 = kn−1 s−n B1,n n−s B1,n α n − 1 −−−−→ s − 1 −−−→ ks−1 −−−−→ n − s + ks−1 = kn−1 , Since γ = α1 (Bkn ,n w1 . . . wn−1 )−1 , then ι(γ) maps n − 1 to kn−1 −1 (Bkn ,n w1 ...wn−1 ) −−−−−−−−−−−−−→ kn−1 , α1 n − 1 −−−→ kn−1 therefore by Lemma 2 we have γ = ηv1 . . . vn−2 Bkn−1 ,n−1 , where η does not involve the strand n − 1, n and vj belongs to hλj,n−1 , λn−1,j i for j = 1, . . . , n − 2. Therefore we have α1 = ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 ρn−1 , %(α) = ηv1 . . . vn−2 Bkn−1 ,n−1 (w1 . . . wn−2 )ρn−1 . Let us count %2 (α). Step 1. Since η does not involve the strand n − 1, then ι(%(α))(n − 1) = kn−1 , then n − 1 is a maximal number which is not fixed by %(α). Step 2. %(α)1 = %(α) = ηv1 . . . vn−2 Bkn−1 ,n−1 (w1 . . . wn−2 )ρn−1 . Step 3. Let us rewrite the braid %(α)1 in the required form. %(α)1 = ηv1 . . . vn−2 Bkn−1 ,n−1 (w1 . . . wn−2 )ρn−1 ρn−1 Bk−1 = ηv1 . . . vn−2 (w1 . . . wn−2 ) n−1 ,n−1 Bkn−1 ,n−1 = ηv1 . . . vn−2 (w1 . . . wkn−1 −1 wkn−1 wkn−1 +1 . . . wn−2 ) = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 · v1 . . . vn−3 vn−2 wkn−1 n−1 ,n−1 ρn−1 Bk−1 ,n−1 n−1 Bkn−1 ,n−1 22 ρn−1 Bk−1 n−1 ,n−1 Bkn−1 ,n−1 ρ B −1 By Theorem 3 the braid η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 kn−1 ,n−1 does not involve the strand n − 1, the braid vj ∈ hλj,n−1 , λn−1,j i for j = 1, . . . , n − 3 and ρn−1 Bk−1 vn−2 wkn−1 n−1 ,n−1 ∈ hλn−1,n−2 , λn−2,n−1 i. ρn−1 Bk−1 Step 4. %(α)2 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 v1 . . . vn−3 ρn−2 Bkn−1 ,n−2 Step 5. The braid %2 (α) follows %(α)2 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 n−1 ,n−1 (v1 . . . vn−3 )ρn−2 Bkn−1 ,n−2 Let us count %(β) Step 1. Since ks = s − 1 and ι(α)(s − 1) = ks−1 ≤ s − 2, then the image of s under the permutation β = ρks αρks = ρs−1 αρs−1 is equal to ks−1 . ρs−1 ρs−1 α s −−−−→ s − 1 −−−→ ks−1 −−−−→ ks−1 , then s is a maximal number which is not fixed by β. The image of s − 1 under the permutation β = ρks αρks = ρs−1 αρs−1 is equal to s. ρs−1 ρs−1 α s − 1 −−−−→ s −−−→ s − 1 −−−−→ s, s−n n−s Step 2. We have β1 = Bn,1 βBn,1 and ι(β1 )(n) = ks−1 + n − s = kn−1 , ι(β1 )(n − 1) = n s−n Bn,1 n−s B1,n β n −−−−→ s −−−→ ks−1 −−−−→ ks−1 + n − s = kn−1 , s−n Bn,1 s−n Bn,1 β n − 1 −−−−→ s − 1 −−−→ s −−−−→ n, n−s n−s Step 3. Since ks = s − 1 < s then ρs−1 B1,n = B1,n ρn−1 , therefore we have s−n n−s s−n n−s s−n n−s β1 = B1,n βB1,n = B1,n ρs−1 αρs−1 B1,n = ρn−1 B1,n αB1,n ρn−1 = ρn−1 ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 ρn−1 ρn−1 ρn−1 ρn−1 = η ρn−1 (v1 . . . vn−2 )ρn−1 Bkn−1 ρn−1 ,n−1 (w1 . . . wn−1 ) =η ρn−1 (v1 . . . vn−2 ) ρn−1  ρ −1 ρn−1 Bk n−1,n−1 (w1 . . . wn−1 ) n−1 Bk−1 = η ρn−1 (v1 . . . vn−2 )ρn−1 (w1 . . . wn−1 ) n−1 ,n−1 Bk−1 ,n n−1 = η ρn−1 (v1 . . . vn−2 )ρn−1 (w1 . . . wn−1 ) ρn−1 ρ n−1 Bkn−1 ,n−1 ρn−1 Bkn−1 ,n Bkn−1 ,n Bk−1 = η ρn−1 (v1 . . . vn−2 )ρn−1 (w1 . . . wkn−1 −1 wkn−1 wkn−1 +1 . . . wn−1 ) Bk−1 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) 23 n−1 ,n n−1 ,n Bkn−1 ,n Bk−1 ,n n−1 (v1 . . . vn−2 )ρn−1 wkn−1 Bkn−1 ,n Bk−1 By Theorem 3 the braid η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) n−1 ,n Bk−1 ρ does not ,n n−1 involve the strand n, vj n−1 ∈ hλj,n , λn,j i for j = 1, . . . n−2 and wkn−1 belongs to hλn−1,n , λn,n−1 i. Bk−1 Step 4. β2 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) n−1 ,n (v1 . . . vn−2 )ρn−1 ρn−1 Bkn−1 ,n−1 Step 5. The braid %(β) has the following form %(β) = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) Bk−1 n−1 ,n (v1 . . . vn−2 )Bkn−1 ,n−1 (9) Let us count %2 (β) Step 1. From the equality (9) the image of n − 1 under the permutation ι(%(β)) is equal to kn−1 , therefore n − 1 is a maximal number which is not fixed by %(β). Step 2. %(β)1 = %(β). Step 3. Rewrite the braid %(β)1 in the required form Bk−1 %(β)1 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) n−1 ,n Bk−1 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n (v1 . . . vn−2 )Bkn−1 ,n−1 Bk−1 ,n v1 . . . vn−3 wn−1n−1 vn−2 Bkn−1 ,n−1 Since η does not involve the strands n − 1, n, then η ρn−1 = η does not involve the strand n − 1. Bk−1 By Lemma 1 the braid vn−2 wn−1n−1 ,n belongs to Bk−1 ,n n−1 hλn−1,n−2 , λn−2,n−1 i, the braid (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) belongs to hλ1,n−1 , λn−1,1 i × · · · × hλn−1,n−2 , λn−2,n−1 i. Step 4. %(β)2 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bk−1 n−1 ,n Bk−1 Step 5. %2 (β) = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n v1 . . . vn−3 v1 . . . vn−3 ρn−2 Bkn−1 ,n−2 ρn−2 (v1 . . . vn−3 )ρn−2 Bkn−1 ,n−2 Using simple calculations in symmetric group it is easy to show that Bk−1 ρ = n−1 ,n n−2 −1 ρn−1 Bkn−1 ,n−1 ρn−1 , therefore B −1 ρ (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) kn−1 ,n n−2 =  ρn−1 ρn−1 Bk−1 ,n−1 n−1 = (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) 24 B −1 ρ and since (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 kn−1 ,n−1 does not involve the strands n − 1, n, then ρn−1  ρ B −1 = (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 kn−1 ,n−1 = (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 n−1 ,n−1 Therefore %2 (α) = %2 (β) and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.1.4. ks + 1 ≤ i ≤ s − 2. Let us count the braid %(β) = %(ρi αρi ). Step 1. Since ks ≤ s − 3 and ks + 1 ≤ i ≤ s − 2, then the braid ρi fixes s and ks , and therefore the image of s under the permutation ι(β) = ι(ρi αρi ) is equal to ks . ρi ρi α s −−−→ s −−−→ ks −−−→ ks Therefore s is a maximal number which is not fixed by β. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = kn . s−n B1,n n−s B1,n β n −−−−→ s −−−→ ks −−−−→ kn , n−s n−s Step 3. Since i ≤ s − 2, then ρi B1,n = B1,n ρn−s+i , and therefore the braid β1 follows. s−n n−s s−n n−s s−n n−s β1 = B1,n βB1,n = B1,n ρi αρi B1,n = ρi+n−s B1,n αB1,n ρi+n−s = ρi+n−s γw1 . . . wn−1 ρn−1 Bkn ,n−1 ρi+n−s ρi+n−s ρi+n−s ρi+n−s = γ ρi+n−s (w1 . . . wn−2 )ρi+n−s wn−1 ρn−1 Bkn ,n−1 Using simple calculation in the permutation group it is easy to show that ρi+n−s ρi+n−s ρ ρn−1 Bkn ,n−1 = Bkni+n−s = ρi+n−s ρi+n−s−1 Bkn ,n , hence ,n ρ i+n−s β1 = γ ρi+n−s (w1 . . . wn−2 )ρi+n−s wn−1 ρi+n−s ρi+n−s−1 Bkn ,n ρi+n−s−1 ρi+n−s =γ ρi+n−s ρi+n−s−1 (w1 . . . wn−2 )ρi+n−s−1 wn−1 Bkn ,n Since i ≤ s − 2, then i + n − s − 1 ≤ n − 3 and the braid γ ρi+n−s ρi+n−s ρi+n−s−1 does not involve the strand n. Also by Lemma 1 (w1 . . . wn−2 )ρi+n−s−1 belongs ρi+n−s−1 to hλ1,n , λn,1 i × · · · × hλn−2,n , λn,n−2 i and wn−1 = wn−1 ∈ hλn−1,n , λn,n−1 i. Step 4. β2 = γ ρi+n−s ρi+n−s ρi+n−s−1 (w1 . . . wn−2 )ρi+n−s−1 ρn−1 Bkn ,n−1 Step 5. The braid β has the following form %(β) = γ ρi+n−s ρi+n−s ρi+n−s−1 (w1 . . . wn−2 )ρi+n−s−1 ρn−1 Bkn ,n−1 = γ ρi+n−s (w1 . . . wn−2 )ρi+n−s−1 ρn−1 ρi+n−s−1 ρi+n−s ρi+n−s ρi+n−s−1 Bkn ,n−1 ρ ρi+n−s = γ ρi+n−s (w1 . . . wn−2 )ρn−1 ρi+n−s Bkni+n−s ,n−1 = %(α) 25 Therefore %(β) = %(α)ρi+n−s and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.1.5. i = s − 1. In this case we can consider that ks < s − 1 since the case when ks = s − 1 = i is already solved in the case 3.1.3.2. Case 3.1.5.1. ι(α)(s − 1) = s. By the equalities (7) and (8) the braids α1 and %(α) have the following forms α1 = γw1 . . . wn−1 ρn−1 Bkn ,n−1 , %(α) = γ(w1 . . . wn−2 )ρn−1 Bkn ,n−1 . Let us rewrite this equalities in more details. Since ι(α)(s − 1) = s, then the permutation ι(α1 ) maps n − 1 to n. s−n B1,n α B1,nn−s n − 1 −−−−→ s − 1 −−−→ s −−−−−−→ n Therefore the permutation ι(γ) = ι(α1 (w1 . . . wn−1 ρn−1 Bkn ,n−1 )−1 ) fixes n − 1 −1 (w1 ...wn−1 ρn−1 Bkn ,n−1 ) n − 1 −−−→ n −−−−−−−−−−−−−−−−−→ n − 1, α1 and by Lemma 2 we have γ = ηv1 . . . vn−2 , where η does not involve the strands n − 1, n and vj ∈ hλj,n−1 , λn−1,j i. Therefore the braids α1 , %(α) can be rewritten. α1 = ηv1 . . . vn−2 w1 . . . wn−1 ρn−1 Bkn ,n−1 %(α) = ηv1 . . . vn−2 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 Let us count %2 (α) Step 1. Since ks < s − 1, then kn < n − 1, therefore Bk1 ,n−1 6= 1, then n − 1 is a maximal number which is not fixed by %(α). Step 2. %(α)1 = %(α). Step 3. The braid %(α)1 has the following form. %(α)1 = %(α) = ηv1 . . . vn−2 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 ρn−1 = ηv1 . . . vn−3 (w1 . . . wn−3 )ρn−1 vn−2 wn−2 Bkn ,n−1 Here the braid η does not involve the strand n − 1, by Lemma 1 the braid v1 . . . vn−3 (w1 . . . wn−3 )ρn−1 belongs to hλ1,n−1 , λn−1,1 i×· · ·×hλ1,n−3 , λn−3,1 i and ρn−1 vn−2 wn−2 belongs to hλn−1,n−2 , λn−2,n−1 i. 26 Step 4. %(α)2 = ηv1 . . . vn−3 (w1 . . . wn−3 )ρn−1 ρn−2 Bkn ,n−2 Step 5. The braid %2 (α) follows. %2 (α) = η(v1 . . . vn−3 )ρn−2 (w1 . . . wn−3 )ρn−1 ρn−2 Bkn ,n−2 (10) Let us find the braid %(β) = %(ρi αρi ) = %(ρs−1 αρs−1 ). Step 1. Since i = s − 1 and ι(α)(s − 1) = s, then the image of s under the permutation β = ρs−1 αρs−1 is equal to s − 1 ρs−1 α ρs−1 s −−−−→ s − 1 −−−→ s −−−−→ s − 1, then s is a maximal number which is not fixed by β. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = n − 1. s−n B1,n β n−s B1,n n −−−−→ s −−−→ s − 1 −−−−→ n − 1 n−s n−s Step 3. Since ρs−1 B1,n = B1,n ρn−1 , then then we have s−n n−s s−n n−s s−n n−s β1 = B1,n βB1,n = B1,n ρs−1 αρs−1 B1,n = ρn−1 B1,n αB1,n ρn−1 = ρn−1 ηv1 . . . vn−2 w1 . . . wn−1 ρn−1 Bkn ,n−1 ρn−1 ρ = η ρn−1 (v1 . . . vn−2 )ρn−1 (w1 . . . wn−1 )ρn−1 ρn−1 Bknn−1 ,n−1 = η ρn−1 (v1 . . . vn−2 )ρn−1 (w1 . . . wn−1 )ρn−1 Bkn ,n−1 ρn−1 = η ρn−1 Bkn ,n−1 (v1 . . . vn−2 )ρn−1 Bkn ,n−1 (w1 . . . wn−1 )ρn−1 Bkn ,n−1 ρn−1 = η ρn−1 Bkn ,n−1 (v1 . . . vn−2 )Bkn ,n (w1 . . . wn−1 )Bkn ,n ρn−1 B B B B kn ,n kn ,n = η ρn−1 Bkn ,n−1 (v1 . . . vn−3 )Bkn ,n (w1 . . . wn−2 )Bkn ,n wn−1 vn−2 ρn−1 kn ,n kn ,n = η ρn−1 Bkn ,n−1 (w1 . . . wn−2 )Bkn ,n (v1 . . . vn−3 )Bkn ,n wn−1 vn−2 ρn−1 Since η does not involve the strands n − 1, n, then η ρn−1 = η and the braid η ρn−1 Bkn ,n−1 (w1 . . . wn−2 )Bkn ,n does not involve the strand n. By Lemma 2 the Bkn ,n braid (v1 . . . vn−3 )Bkn ,n wn−1 belongs to hλ1,n , λn,1 i × · · · × hλn−2,n , λn,n−2 i and Bkn ,n vn−2 belongs to hλn−1,n , λn,n−1 i. B kn ,n Step 4. β2 = η ρn−1 Bkn ,n−1 (w1 . . . wn−2 )Bkn ,n (v1 . . . vn−3 )Bkn ,n wn−1 ρn−1 B kn ,n Step 5. %(β) = η ρn−1 Bkn ,n−1 (w1 . . . wn−2 )Bkn ,n (v1 . . . vn−3 )Bkn ,n ρn−1 wn−1 Let us count the braid %2 (β) = %(%(β)). 27 ρn−1 Step 1. Since η does not involve the strand n − 1, n therefore η ρn−1 = η and ι(η) Bkn ,n ρn−1 is fixes n − 1. Moreover since (w1 . . . wn−2 )Bkn ,n (v1 . . . vn−3 )Bkn ,n ρn−1 wn−1 a pure braid, that the image of n − 1 under the permutation ι(%(β)) is equal to ι(Bkn ,n−1 )(n − 1) = kn . Therefore n − 1 is a maximal number which is not fixed by %(β). Step 2. %(β)1 = %(β). Step 3. The braid %(β)1 has the following form B kn ,n %(β)1 = η ρn−1 Bkn ,n−1 (w1 . . . wn−2 )Bkn ,n (v1 . . . vn−3 )Bkn ,n ρn−1 wn−1 −1 ρn−1 −1 = η ρn−1 (w1 . . . wn−2 )Bkn ,n Bkn ,n−1 (v1 . . . vn−3 )Bkn ,n ρn−1 Bkn ,n−1 Bk −1 ,n ρn−1 Bkn ,n−1 · wn−1n Bkn ,n−1 Since Bkn ,n Bk−1 = ρn−1 , Bkn ,n ρn−1 Bk−1 = ρn−2 ρn−1 , then we have n ,n−1 n ,n−1 ρ ρ n−2 n−1 %(β)1 = η ρn−1 (w1 . . . wn−2 )ρn−1 (v1 . . . vn−3 )ρn−2 ρn−1 wn−1 Bkn ,n−1 ρ ρ n−1 n−2 ρn−1 = η ρn−1 (w1 . . . wn−3 )ρn−1 (v1 . . . vn−3 )ρn−2 ρn−1 wn−2 wn−1 Bkn ,n−1 Here the braid η ρn−1 = η does not involve the strand n − 1. Also by Lemma 2 the braid (w1 . . . wn−3 )ρn−1 (v1 . . . vn−3 )ρn−2 ρn−1 belongs to the group hλ1,n−1 , λn−1,1 i× ρn−2 ρn−1 · · · × hλn−3,n−1 , λn−1,n−3 i and wn−1 ∈ hλn−1,n−2 , λn−2,n−1 i. Step 4. %(β)2 = η ρn−1 (w1 . . . wn−3 )ρn−1 (v1 . . . vn−3 )ρn−2 ρn−1 ρn−2 Bkn ,n−2 Step 5. The braid %2 (β) has the following form %2 (β) = η ρn−1 (w1 . . . wn−3 )ρn−1 ρn−2 (v1 . . . vn−3 )ρn−2 ρn−1 ρn−2 Bkn ,n−2 %2 (β) = η ρn−1 (v1 . . . vn−3 )ρn−2 ρn−1 ρn−2 (w1 . . . wn−3 )ρn−1 ρn−2 · [(w1 . . . wn−3 )ρn−1 ρn−2 , (v1 . . . vn−3 )ρn−2 ρn−1 ρn−2 ]Bkn ,n−2 By Lemma 2 it is obvious that (v1 . . . vn−3 )ρn−2 ρn−1 ρn−2 = (v1 . . . vn−3 )ρn−2 and therefore by the remark 2 the braids %∗ (β) and %∗ (α) are equal modulo U V Pm0 , i. e. %∗ (α) = %∗ (β). Case 3.1.5.2. ι(α)(s − 1) = s − 1. Since β = ρs−1 αρs−1 then ι(β) fixes s and maps s − 1 to ks . ρs−1 ρs−1 α s −−−−→ s − 1 −−−→ s − 1 −−−−→ s ρs−1 ρs−1 α s − 1 −−−−→ s −−−→ ks (≤ s − 2) −−−−→ ks 28 Therefore s − 1 is maximal number which is not fixed by β, and β1 has the following form. s−1−n n−s+1 −1 s−n n−s B1,n β1 = B1,n βB1,n = B1,n B1,n ρs−1 αρs−1 B1,n −1 s−n n−s −1 = B1,n ρn−1 B1,n αB1,n ρn−1 B1,n = B1,n−1 α1 B1,n−1 ρ n−2 = α1 , then it is obvious If we denote by δ1 = β1 , δ2 = δ1ρ1 , δ3 = δ2ρ2 , . . . , δn−1 = δn−2 that n is not fixed by ι(δj ) for every j. Since δj+1 is obtained from δj conjugating by ρj (j < n − 1), then by the cases 3.1.1–3.1.4 the braids %∗ (δj+1 ) and %∗ (δj ) are µj conjugated by the element from Sn , i. e. %∗ (δj ) = %∗ (δj+1 ) . Therefore we have µ1 %∗ (β1 ) = %∗ (δ1 ) = %∗ (δ2 ) = %∗ (δ3 ) µ2 µ1 µn−2 ...µ1 = · · · = %∗ (δn−1 ) µn−2 ...µ1 = %∗ (α1 ) , so the braids %∗ (β) = %∗ (β1 ) and %∗ (α) = %∗ (α1 ) are conjugated by the element from Sn . Case 3.1.5.3. ι(α)(s − 1) ≤ s − 2. Case 3.1.5.3.1. ι(α)(s − 1) ≥ ι(α)(s) + 1. By the equalities (7) and (8) the braids α1 and %(α) have the following forms. α1 = γw1 . . . wn−1 ρn−1 Bkn ,n−1 %(α) = γ(w1 . . . wn−2 )ρn−1 Bkn ,n−1 Let us rewrite this equalities in more details. Since ι(α)(s − 1) ≤ s − 2, then ι(α1 )(n − 1) = n − s + ι(α)(s − 1). s−n B1,n n−s B1,n α n − 1 −−−−→ s − 1 −−−→ ι(α)(s − 1) −−−−→ n − s + ι(α)(s − 1) Therefore since ι(α)(s−1) ≥ ι(α)(s)+1, then the braid γ = α1 (w1 . . . wn−1 ρn−1 Bkn ,n−1 )−1 maps n − 1 to kn−1 = n − s + ι(α)(s − 1) − 1 ≥ n − s + ι(α)(s) = kn −1 (w1 ...wn−1 ρn−1 Bkn ,n−1 ) n − 1 −−−→ n − s + ι(α)(s − 1) −−−−−−−−−−−−−−−−−→ n − s + ι(α)(s − 1) − 1, α1 and by Lemma 2 we have γ = ηv1 . . . vn−2 Bkn−1 ,n−1 , where η does not involve the strands n − 1, n and vj belongs to hλj,n−1 , λn−1,j i for j = 1, . . . , n − 1. Therefore α1 = ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 ρn−1 Bkn ,n−1 %(α) = ηv1 . . . vn−2 Bkn−1 ,n−1 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 and kn−1 ≥ kn . Let us count %2 (α) 29 Step 1 The permutation ι(%(α)) maps n − 1 to kn−1 + 1 = n − s + ι(α)(s − 1) − 1 + 1 = n − s + ι(α)(s − 1) 6= n, therefore n − 1 is a maximal number which is not foxed by %(α). Step 2 %(α)1 = %(α). Step 3 The braid %(α)1 = %(α) can be rewritten. %(α1 ) = ηv1 . . . vn−2 Bkn−1 ,n−1 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 ρn−1 Bk−1 = ηv1 . . . vn−2 (w1 . . . wn−2 ) n−1 ,n−1 Bkn−1 ,n−1 Bkn ,n−1 Since kn−1 ≥ kn , then Bkn−1 ,n−1 Bkn ,n−1 = Bkn ,n−2 Bkn−1 +1,n−1 and ρn−1 Bk−1 %(α1 ) = ηv1 . . . vn−2 (w1 . . . wn−2 ) n−1 ,n−1 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bkn ,n−2 Bkn−1 +1,n−1 ρn−1 Bk−1 n−1 ,n−1 ρn−1 Bk−1 v1 . . . vn−2 wkn−1 n−1 ,n−1 · Bkn ,n−2 Bkn−1 +1,n−1 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 n−1 ,n−1 ρn−1 Bk−1 ,n−1 Bkn ,n−2 n−1 · (v1 . . . vn−2 )Bkn ,n−2 wkn−1 Bkn ,n−2 Bkn−1 +1,n−1 ρn−1 Bk−1 ,n−1 n−1 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wkn−1 ) Bkn ,n−2 ρn−1 Bk−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 wkn−1 Bkn ,n−2 B kn ,n−2 n−1 ,n−1 vn−3 Bkn−1 +1,n−1 ρn−1 Bk−1 By Lemma 1 the braid η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bkn ,n−2 ρn−1 Bk−1 ,n−1 Bkn ,n−2 n−1 ,n−1 does not involve the strand n−1, the braid (v1 . . . vn−4 vn−2 )Bkn ,n−2 wkn−1 B n−1 kn ,n−2 belongs to hλ1,n−1 , λn−1,1 i×· · ·×hλn−3,n−1 , λn−1,n−3 i and vn−3 ∈ λn−2,n−1 , λn−1,n−2 i. Step 4 The braid %(α)2 has the following form ρn−1 Bk−1 %(α)2 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 ,n−1 Bkn ,n−2 n−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 wkn−1 30 n−1 ,n−1 Bkn ,n−2 ρn−2 Bkn−1 +1,n−2 Step 5 Finally, the braid %2 (α) follows %2 (α) = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 n−1 ,n−1 Bkn ,n−2 ρn−1 Bk−1 ,n−1 Bkn ,n−2 ρn−2 n−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 wkn−1 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bkn ,n−2 ρn−2 Bk−1 n ,n−2 · (v1 . . . vn−4 vn−2 ) Bkn−1 +1,n−2 ρn−1 Bk−1 ,n−1 n−1 ρn−1 Bk−1 n−1 ,n−1 wkn−1 Bkn ,n−2 ρn−2 Bk−1 n ,n−2 · Bkn ,n−2 Bkn−1 +1,n−2 Let us count %(β) = %(ρs−1 αρs−1 ). Step 1 An image of s under the braid β = ρs−1 αρs−1 is equal to ι(α)(s − 1). ρs−1 ρs−1 α s −−−−→ s − 1 −−−→ α(s − 1) −−−−→ α(s − 1) Therefore s is a maximal number which is not fixed by β. s−n n−s Step 2 β1 = B1,n βB1,n . n−s n−s Step 3 Since ρs−1 B1,n = B1,n ρn−1 , then we have s−n n−s s−n n−s s−n n−s β1 = B1,n βB1,n = B1,n ρs−1 αρs−1 B1,n = ρn−1 B1,n αB1,n ρn−1 = ρn−1 α1 ρn−1 = ρn−1 ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 ρn−1 Bkn ,n−1 ρn−1 ρn−1 ρn−1 ρn−1 = η ρn−1 (v1 . . . vn−2 )ρn−1 Bkn−1 Bkn ,n ,n−1 (w1 . . . wn−1 ) = η ρn−1 (v1 . . . vn−2 )ρn−1 (w1 . . . wn−1 ) Bk−1 n−1 ,n−1 ρn−1 ρ ρ n−1 n−1 Bkn−1 ,n−1 Bkn ,n Using simple calculations in the symmetric group, it is easy to see that ρ ρ n−1 n−1 Bkn−1 ,n−1 Bkn ,n = Bkn ,n−1 ρn−2 Bkn−1 +1,n , (11) therefore Bk−1 β1 = η ρn−1 (v1 . . . vn−2 )ρn−1 (w1 . . . wn−1 ) n−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 Bkn−1 +1,n Bk−1 ,n−1 ρn−1 n−1 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) Bk−1 n−1 · (v1 . . . vn−2 )ρn−1 wkn−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 Bkn−1 +1,n Bk−1 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) n−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 Bk−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 n−1 · (v1 . . . vn−2 )ρn−1 Bkn ,n−1 ρn−2 wkn−1 Bk−1 ,n−1 ρn−1 n−1 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) Bkn−1 +1,n Bkn ,n−1 ρn−2 Bk−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 n−1 · (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 wkn−1 31 ρ n−1 vn−3 Bkn ,n−1 ρn−2 Bkn−1 +1,n By Theorem 3 the braid η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) Bk−1 n−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 does not involve the strand n, the braid Bk−1 n−1 (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 wkn−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρ n−1 belongs to hλ1,n , λn,1 i × · · · × hλn−2,n , λn,n−2 i and the braid vn−3 belongs to hλn−1,n , λn,n−1 i. Bkn ,n−1 ρn−2 Step 4 The braid β2 follows β2 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) Bk−1 n−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 Bk−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 n−1 · (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 wkn−1 ρn−1 Bkn−1 +1,n−1 Step 5 The braid %(β) is the following. Bk−1 %(β) = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) n−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 Bk−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 n−1 · (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 wkn−1 Bkn−1 +1,n−1 Let us find the braid %2 (β). Step 1 Since η ρn−1 does not involve the strands n − 1, n, then the image of n − 1 under the permutation ι(%(β)) is equal to the image of n − 1 under the permutation ι(Bkn ,n−1 ρn−2 Bkn−1 +1,n−1 ) and is equal to kn . Then n − 1 is a maximal number which is not fixed by %(β). Step 2 %(β)1 = %(β). Step 3 The braid %(β)1 can be rewritten %(β)1 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) Bk−1 n−1 ,n−1 ρn−1 −1 · (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bk−1 n−1 · wkn−1 −1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 · Bkn ,n−1 ρn−2 Bkn−1 +1,n−1 The following equality is faithful in the symmetric group Bkn ,n−1 ρn−2 Bkn−1 +1,n−1 = ρn−3 Bkn−1 ,n−2 Bkn ,n−1 = Bkn−1 ,n−3 Bkn ,n−1 , 32 (12) therefore Bk−1 %(β)1 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−1 ) n−1 ,n−1 ρn−1 −1 · (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bk−1 n−1 ,n−1 · wkn−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bk−1 n ,n−1 · Bkn−1 ,n−3 Bkn ,n−1 −1 = η ρn−1 (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bk−1 · (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 Bk−1 −1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bk−1 ,n−1 ρn−1 n−1 · wkn−1 · wn−1n−1 ρn−1 Bkn−1 ,n−3 Bkn ,n−1 −1 = η ρn−1 (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bkn−1 ,n−3 Bk−1 · (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 ρn−1 Bkn−1 ,n−3 Bk−1 −1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bkn−1 ,n−3 Bk−1 ,n−1 ρn−1 Bkn−1 ,n−3 n−1 · wkn−1 · wn−1n−1 Bkn ,n−1 −1 Here the braid η ρn−1 (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bkn−1 ,n−3 does not involve the strand n − 1, the braid (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bk−1 n−1 ,n−1 ρn−1 Bkn−1 ,n−3 · Bk−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bk−1 B n ,n−1 kn−1 ,n−3 n−1 · wkn−1 Bk−1 belongs to hλn−1,1 , λ1,n−1 i×· · ·×hλn−3,n−1 , λn−1,n−3 i and wn−1n−1 belongs to hλn−2,n−1 , λn−1,n−2 i. ,n−1 ρn−1 Bkn−1 ,n−3 Step 4 The braid %(β)2 follows. −1 %(β)2 = η ρn−1 (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bkn−1 ,n−3 Bk−1 · (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bk−1 n−1 · wkn−1 n−1 ,n−1 ρn−1 Bkn−1 ,n−3 −1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bkn−1 ,n−3 33 ρn−2 Bkn ,n−2 Step 5 The braid %2 (β) has the following form. −1 %2 (β) = η ρn−1 (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bkn−1 ,n−3 Bk−1 · (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bk−1 n−1 ,n−1 · wkn−1 n−1 ,n−1 ρn−1 Bkn−1 ,n−3 ρn−2 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bk−1 B ρ n ,n−1 kn−1 ,n−3 n−2 Bkn ,n−2 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bk−1 n ,n−1 = η ρn−1 (v1 . . . vn−4 vn−2 ) Bk−1 · (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bk−1 n−1 · wkn−1 n−1 ,n−1 ρn−1 Bkn−1 ,n−3 ρn−2 Bk−1 n−1 ,n−3 −1 −1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 Bkn−1 ,n−3 ρn−2 Bkn−1 ,n−3 · Bkn−1 ,n−3 Bkn ,n−2 Bk−1 = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 ρn−1 Bkn−1 ,n−3 ρn−2 Bk−1 n−1 ,n−3 −1 · (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 −1 · [(v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 , Bk−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 ρn−1 Bkn−1 ,n−3 ρn−2 Bk−1 n−1 ,n−3 Bk−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bk−1 B ρ B −1 n ,n−1 kn−1 ,n−3 n−2 kn−1 ,n−3 n−1 · wkn−1 · Bkn−1 ,n−3 Bkn ,n−2 Now we have Bk−1 %2 (β) = η ρn−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 ρn−1 Bkn−1 ,n−3 ρn−2 Bk−1 n−1 ,n−3 −1 · (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 −1 · [(v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 , Bk−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 ρn−1 Bkn−1 ,n−3 ρn−2 Bk−1 n−1 ,n−3 Bk−1 ,n−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bk−1 B ρ B −1 n ,n−1 kn−1 ,n−3 n−2 kn−1 ,n−3 n−1 · wkn−1 · Bkn−1 ,n−3 Bkn ,n−2 ρn−1 Bk−1 %2 (α) = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) −1 n−1 ,n−1 ρn−1 Bk−1 (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 Bkn ,n−2 wkn−1 Bkn ,n−2 Bkn−1 +1,n−2 34 n−1 ,n−1 Bkn ,n−2 ρn−2 Bk−1 n ,n−2 ] ] Note that the following equalities are faithful in the symmetric group Bkn−1 ,n−3 Bkn ,n−2 = Bkn ,n−2 Bkn−1 +1,n−2 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bk−1 = ρn−1 ρn−2 ρn−3 ρn−2 ρn−1 ρn−2 ρn−3 ρn−2 n ,n−1 = ρn−1 ρn−3 ρn−2 ρn−3 ρn−1 ρn−2 ρn−3 ρn−2 = ρn−1 ρn−3 ρn−2 ρn−1 ρn−3 ρn−2 ρn−3 ρn−2 = ρn−1 ρn−3 ρn−2 ρn−1 ρn−3 ρn−3 ρn−2 ρn−3 = ρn−1 ρn−3 ρn−2 ρn−1 ρn−2 ρn−3 = ρn−3 ρn−1 ρn−2 ρn−1 ρn−2 ρn−3 = ρn−3 ρn−1 ρn−1 ρn−2 ρn−1 ρn−3 = ρn−3 ρn−2 ρn−1 ρn−3 Bkn ,n−2 ρn−2 Bk−1 n ,n−2 = ρn−3 ρn−2 ρn−3 ρn−1 = ρn−3 ρn−2 ρn−3 Therefore we have −1 (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 = ((v1 . . . vn−4 vn−2 )ρn−3 ρn−2 ρn−3 )ρn−1 , and since (v1 . . . vn−4 vn−2 )ρn−3 ρn−2 ρn−3 does not involve the strands n − 1, n, then ((v1 . . . vn−4 vn−2 )ρn−3 ρn−2 ρn−3 )ρn−1 = = (v1 . . . vn−4 vn−2 )ρn−3 ρn−2 ρn−3 = −1 = (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 Bkn ,n−2 and we have −1 −1 (v1 . . . vn−4 vn−2 )ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bkn ,n−1 = (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 Bkn ,n−2 . Also, since Bk−1 ρ Bkn−1 ,n−3 ρn−2 Bk−1 = Bk−1 ρ ρ n−1 ,n−1 n−1 n−1 ,n−3 n−1 ,n−1 n−1 n−2 = Bk−1 ρ ρ n−1 ,n−1 n−1 n−2 = ρkn−1 . . . ρn−3 ρn−2 ρn−1 ρn−2 = ρkn−1 . . . ρn−3 ρn−1 ρn−2 ρn−1 = ρn−1 ρkn−1 . . . ρn−3 ρn−2 ρn−1 = ρn−1 Bk−1 ρ , n−1 ,n−1 n−1 then B −1 ρ B ρ B −1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) kn−1 ,n−1 n−1 kn−1 ,n−3 n−2 kn−1 ,n−3 =  ρn−1 ρ B −1 = (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 kn−1 ,n−1 , 35 ρn−1 Bk−1 and since the braid (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) strands n − 1, n, then Bk−1 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 n−1 ,n−1 ρn−1 Bkn−1 ,n−3 ρn−2 Bk−1 does not involve the n−1 ,n−3 = = (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bk−1 n−1 ,n−1 wkn−1 ρn−1 Bkn ,n−1 ρn−2 ρn−1 ρn−2 Bk−1 B ρ B −1 n ,n−1 kn−1 ,n−3 n−2 k n−1 ,n−3 ρn−1 Bk−1 n−1 ,n−1 = ρn−1 Bk−1 ,n−1 Bkn ,n−2 ρn−2 Bk−1 n ,n−2 n−1 = wkn−1 Finally since η does not involve the strands n − 1, n, then η ρn−1 = η. Therefore the 0 braids %2 (α) and %2 (β) are equal modulo U V Pn−2 and by the remark 2 the braids ∗ ∗ 0 ∗ % (β) and % (α) are equal modulo U V Pm , i. e. % (α) = %∗ (β). Case 3.1.5.3.2. α(s − 1) < α(s) + 1. This case literally repeats the case 3.1.5.3.1 using the fact that in this case kn−1 < kn and then using the equalities Bkn−1 ,n−1 Bkn ,n−1 = Bkn −1,n−2 Bkn−1 ,n−1 ρ ρ n−1 n−1 Bkn−1 ,n−1 Bkn ,n = Bkn −1,n−1 ρn−2 Bkn−1 ,n instead of equalities (11) and (12). Case 3.1.6. i = s. In this case the braid β = ρs αρs maps s + 1 to ks . ρs α ρs s + 1 −−−→ s −−−→ ks −−−→ ks Therefore s + 1 is a maximal number, which is not fixed by β and we have s+1−n n−s−1 s−n n−s −1 β1 = B1,n βB1,n = B1,n B1,n ρs−1 αρs−1 B1,n B1,n s−n n−s −1 = B1,n ρn−1 B1,n αB1,n ρn−1 B1,n −1 −1 = B1,n ρn−1 α1 ρn−1 B1,n = ρn−2 B1,n α1 B1,n ρn−2 ρ ρ B −1 n−2 n−1 If we denote by δ1 = α1 , δ2 = δ1ρ1 , δ3 = δ2ρ2 , . . . , δn−1 = δn−2 , δn = δn−1 = α1 1,n , δn+1 = δnρn−2 = β1 , then it is obvious, that ι(δi )(n) 6= n for i = 1 . . . n − 1. Therefore by the previous cases %∗ (δi ) and %∗ (δi+1 ) are conjugated by the element from Sn for every i = 1 . . . n − 1. %(δi ) = %(δi+1 )µi Also since ι(δn )(n − 1) 6= n − 1 B1,n B1,n α 1 n − 1 −−−−→ n −−− → kn 6= n −−−−→ kn − 1 (mod n) 6= n − 1 36 then by the previous cases %∗ (δn ) = %∗ (δn+1 ) µ1 %∗ (β1 ) = %∗ (δ1 ) = %∗ (δ2 ) = %∗ (δ3 ) µ2 µ1 µn and we have µn−2 ...µ1 = · · · = %∗ (δn−1 ) µn−2 ...µ1 = %∗ (α1 ) Therefore the braids %∗ (β) = %∗ (β1 ) and %∗ (α) = %∗ (α1 ) are conjugated by the element from Sn . Case 3.1.7. i ≥ s + 1. In this case the maximal number which is not fixed by the braid β = ρi αρi is s and we have ρi α ρi s −−−→ s −−−→ ks −−−→ ks Since i ≥ s + 2, then we have i−s n−i−1 i−s n−i−1 n−s ρn−1 B1,n B1,n = B1,n B1,n B1,n = ρi B1,n ρi B1,n n−i−1 i−s n−i−1 i−s−1 = B1,n B1,n−1 B1,n = B1,n B1,n−1 B1,n B1,n n−i−1 i−s−1 n−i−1 i−s−1 = B1,n B1,n B2,n B1,n = B1,n B1,n B2,n ρ1 ρ1 B1,n n−i+1 i−s−1 n−i+1 i−s−1 n−s = B1,n ρ1 B1,n = B1,n B1,n ρi−s = B1,n ρi−s Therefore the braid β1 can be rewritten s−n n−s s−n n−s s−n n−s β1 = B1,n βB1,n = B1,n ρi αρi B1,n = ρi−s B1,n αB1,n ρi−s = ρi−s α1 ρi−s Since ι(α1 )(n) 6= n and i − s < n, then %∗ (α1 ) and %∗ (β1 ) are conjugated by the previous cases. Case 3.2. The braid β is obtained from α conjugating by λ±1 i,i+1 . If β is obtained −1 from α conjugating by λi,i+1 , then α is obtained from β conjugating by λi,i+1 and we can consider that β is obtained from α conjugating by λi,i+1 . As we already found in the case 3.1 (equalities (8) and (7)) the braids %(α) and α1 has the following forms α1 = γw1 . . . wn−1 ρn−1 Bkn ,n−2 , %(α) = γ(w1 . . . wn−2 )ρn−1 Bkn ,n−1 , where kn = n − s + ks and ks is a maximal number which is not fixed by α. Case 3.2.1. i ≤ ks − 2. Let us count the braid %(β) = %(λ−1 i,i+1 αλi,i+1 ). Step 1. Since λi,i+1 is a pure braid, then the maximal number which is not fixed by β is equal to the maximal number which is not fixed by β and is equal to s. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. 37 n−s n−s Step 3. By Lemma 1 we have λi,i+1 B1,n = B1,n λi+n−s,i+n−s+1 . If we denote by j = i + n − s, then the braid β1 can be rewritten in more details s−n −1 n−s n−s s−n λi,i+1 αλi,i+1 B1,n = B1,n βB1,n β1 = B1,n −1 s−n n−s = λ−1 j,j+1 B1,n αB1,n λj,j+1 = λj,j+1 α1 λj,j+1 = λ−1 j,j+1 γw1 . . . wn−1 Bkn ,n λj,j+1 B −1 kn ,n = λ−1 j,j+1 γw1 . . . wn−1 λj,j+1 Bkn ,n B −1 kn ,n Since i < ks − 1, then j = i + n − s < kn − 1 and therefore λj,j+1 = λj,j+1 . Therefore we have −1 β1 = λj,j+1 γλj,j+1 w1 . . . wn−1 Bkn ,n , where the braid λ−1 j,j+1 γλj,j+1 does not involve the strand n and wr belongs to hλr,n , λn,r i for r = 1, . . . , wn−1 . Step 4. β2 = λ−1 j,j+1 γλj,j+1 w1 . . . wn−2 ρn−1 Bkn ,n−1 . Step 5. The braid %(β) has the following form. ρn−1 %(β) = λ−1 Bkn ,n−1 j,j+1 γλj,j+1 (w1 . . . wn−2 ) ρn−1 = λ−1 Bkn ,n−1 λj,j+1 = %(α)λj,j+1 j,j+1 γ(w1 . . . wn−2 ) Therefore %(α) and %(β) are conjugated and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.2.2. i = ks − 1. Let us find the braid %(β). Step 1. The maximal number which is not fixed by α is equal to s. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. Step 3. Similarly to the case 3.2.1 we conclude that β1 = λ−1 kn −1,kn α1 λkn −1,kn and therefore we have β1 = λ−1 kn −1,kn γw1 . . . wn−1 Bkn ,n λkn −1,kn B −1 kn ,n = λ−1 kn −1,kn γw1 . . . wn−1 λkn −1,kn Bkn ,n = λ−1 kn −1,kn γw1 . . . wn−1 λkn −1,n Bkn ,n = λ−1 kn −1,kn γw1 . . . wn−2 λkn −1,n wn−1 Bkn ,n Since kn < n, then the braid λ−1 kn −1,kn γ does not involve the strand n. 38 Step 4. β2 = λ−1 kn −1,kn γw1 . . . wn−2 λkn −1,n ρn−1 Bkn ,n−1 . Step 5. The braid %(β) has the following form. ρn−1 Bkn ,n−1 %(β) = λ−1 kn −1,kn γ(w1 . . . wn−2 λkn −1,n ) ρn−1 λkn −1,n−1 Bkn ,n−1 = λ−1 kn −1,kn γ(w1 . . . wn−2 ) B ρn−1 n ,n−1 Bkn ,n−1 λknk−1,n−1 = λ−1 kn −1,kn γ(w1 . . . wn−2 ) ρn−1 = λ−1 Bkn ,n−1 λkn −1,kn = %(α)λkn −1,kn . kn −1,kn γ(w1 . . . wn−2 ) Therefore the braids %(α) and %(β) are conjugated and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.2.3. i = ks . Case 3.2.3.1. ks ≤ s − 2. Let us count the braid %(β). Step 1. The maximal number which is not fixed by α is equal to s. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. Step 3. Similarly to the case 3.2.1 we have β1 = λ−1 kn ,kn +1 α1 λkn ,kn +1 and therefore β1 = λ−1 kn ,kn +1 γw1 . . . wn−1 Bkn ,n λkn ,kn +1 B −1 kn ,n = λ−1 kn ,kn +1 γw1 . . . wn−1 λkn ,kn +1 Bkn ,n = λ−1 kn ,kn +1 γw1 . . . wn−1 λn,kn Bkn ,n = λ−1 kn ,kn +1 γw1 . . . wn−2 λn,kn wn−1 Bkn ,n Since ks < s − 1, then kn , kn + 1 < n and the braid λ−1 kn ,kn +1 γ does not involve the strand n. Step 4. β2 = λ−1 kn ,kn +1 γw1 . . . wn−2 λn,kn ρn−1 Bkn ,n−1 . Step 5. The braid %(β) has the following form. ρn−1 %(β) = λ−1 Bkn ,n−1 kn ,kn +1 γ(w1 . . . wn−2 λn,kn ) ρn−1 λn−1,kn Bkn ,n−1 = λ−1 kn ,kn +1 γ(w1 . . . wn−2 ) B kn ,n−1 ρn−1 = λ−1 Bkn ,n−1 λn−1,k kn ,kn +1 γ(w1 . . . wn−2 ) n ρn−1 Bkn ,n−1 λkn ,kn +1 = %(α)λkn ,kn +1 = λ−1 kn ,kn +1 γ(w1 . . . wn−2 ) Therefore the braids %(α) and %(β) are conjugated and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.2.3.2 ks = s − 1. Case 3.2.3.2.1. ι(α)(s − 1) = s. Let us find the braid %(β) = %(λ−1 ks ,ks +1 αλks ,ks +1 ). 39 Step 1. The maximal number which is not fixed by α is equal to s. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. Step 3. Similarly to the case 3.2.1 we have β1 = λ−1 kn ,kn +1 α1 λkn ,kn +1 . Since ks = s − 1, −1 then kn = n − 1, Bkn ,n = ρn−1 and β1 = λn−1,n α1 λn−1,n . Then we have β1 = λ−1 n−1,n γw1 . . . wn−1 ρn−1 λn−1,n . Since ι(α)(s − 1) = s, then ι(α1 )(n − 1) = n, therefore the braid γ = α1 (w1 . . . wn−1 ρn−1 )−1 maps n − 1 to n − 1. Hence the braids γ and λ−1 n−1,n commute and we have β1 = γλ−1 n−1,n w1 . . . wn−1 ρn−1 λn−1,n = γw1 . . . wn−2 λ−1 n−1,n wn−1 ρn−1 λn−1,n = γw1 . . . wn−2 λ−1 n−1,n wn−1 λn,n−1 ρn−1 where the braid γ does not involve the strand n, the braid wr belongs to hλn,r , λr,n i for r = 1, . . . , n−2 and λ−1 n−1,n wn−1 λn,n−1 belongs to hλn,n−1 , λn−1,n i. Step 4. β2 = γw1 . . . wn−2 ρn−1 . Step 5. %(α) = %(β). Therefore the braids %(α) and %(β) are conjugated and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.2.3.2.2. ι(α)(s − 1) = ks−1 ≤ s − 2. As already founded in the case 3.1.3.2.2. for ks = s − 1 and ι(α)(s − 1) = ks−1 ≤ s − 2 we have α1 = ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 ρn−1 , %(α) = ηv1 . . . vn−2 Bkn−1 ,n−1 (w1 . . . wn−2 )ρn−1 , ρn−1 Bk−1 %2 (α) = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 (v1 . . . vn−3 )ρn−2 Bkn−1 ,n−2 , where the braid η does not involve the strands n − 1, n the braid vr belongs to hλr,n−1 , λn−1,r i for r = 1, . . . , n − 2 and the braid wr belongs to hλr,n , λn,r i for r = 1, . . . , n − 1. Let us count the braid %(β) = %(λs−1,s αλs−1,s ). Step 1. The maximal number which is not fixed by β is equal to s. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. 40 Step 3. Similarly to the case 3.2.3.2.1. β1 = λ−1 n−1,n α1 λn−1,n and we have β1 = λ−1 n−1,n ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 ρn−1 λn−1,n = η λn−1,n λ−1 n−1,n v1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 λn,n−1 ρn−1 Bkn−1 ,n−1 w1 . . . wn−1 λn,n−1 ρn−1 = η λn−1,n v1 . . . vn−2 Bkn−1 ,n−1 (λ−1 n−1,n ) = η λn−1,n v1 . . . vn−2 Bkn−1 ,n−1 λ−1 kn−1 ,n w1 . . . wn−1 λn,n−1 ρn−1 Since the braid η does not involve the strands n − 1, n, then η λn−1,n = η. Step 4. β2 = ηv1 . . . vn−2 Bkn−1 ,n−1 λ−1 kn−1 ,n w1 . . . wn−2 ρn−1 . ρn−1 Step 5. %(β) = ηv1 . . . vn−2 Bkn−1 ,n−1 (λ−1 . kn−1 ,n w1 . . . wn−2 ) Let us count the braid %2 (β). Step 1. Since ks−1 ≤ s−2, then kn−1 ≤ n−2, therefore Bkn−1 ,n−1 6= 1 and the maximal number which is not fixed by %(β) is equal to n − 1. Step 2. %(β)1 = %(β). Step 3. The braid %(β) can be rewritten ρn−1 %(β) = ηv1 . . . vn−2 Bkn−1 ,n−1 (λ−1 kn−1 ,n w1 . . . wn−2 ) ρn−1 Bk−1 = ηv1 . . . vn−2 (λ−1 kn−1 ,n w1 . . . wn−2 ) n−1 ,n−1 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 ,n−1 n−1 · vn−2 λ−1 n−1,n−2 wkn−1 ρn−1 Bk−1 n−1 ,n−1 ρn−1 Bk−1 Step 5. %2 (β) = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 v1 . . . vn−3 Bkn−1 ,n−1 ρn−1 Bk−1 Step 4. %(β)2 = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bkn−1 ,n−1 n−1 ,n−1 v1 . . . vn−3 ρn−2 Bkn−1 ,n−2 . (v1 . . . vn−3 )ρn−2 Bkn−1 ,n−2 . Therefore %2 (α) = %2 (β) and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.2.4. ks + 1 ≤ i ≤ s − 2. Let us find the braid %(β) = %(λ−1 i,i+1 αλi,i+1 ). Step 1. The maximal number which is not fixed by β is equal to s. n−s s−n Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. 41 n−s n−s Step 3. By Lemma 1 we have λi,i+1 B1,n = B1,n λj,j+1 , where j = i + n − s. Since ks + 1 ≤ i ≤ s − 2 then kn + 1 ≤ j ≤ n − 2 and the braid β can be rewritten in more details. s−n n−s s−n −1 n−s β1 = B1,n βB1,n = B1,n λi,i+1 αλi,i+1 B1,n = λ−1 j,j+1 α1 λj,j+1 = λ−1 j,j+1 γw1 . . . wn−1 Bkn ,n λj,j+1 B −1 kn ,n = λ−1 j,j+1 γw1 . . . wn−1 λj,j+1 Bkn ,n = λ−1 j,j+1 γw1 . . . wn−1 λj−1,j Bkn ,n = λ−1 j,j+1 γλj−1,j w1 . . . wn−1 Bkn ,n , Where the braid λ−1 j,j+1 γλj−1,j does not involve the strand n. Step 4. β2 = λ−1 j,j+1 γλj−1,j w1 . . . wn−2 ρn−1 Bkn ,n−1 . Step 5. The braid %(β) follows ρn−1 %(β) = λ−1 Bkn ,n−1 j,j+1 γλj−1,j (w1 . . . wn−2 ) ρn−1 = λ−1 λj−1,j Bkn ,n−1 j,j+1 γ(w1 . . . wn−2 ) B kn ,n−1 ρn−1 = λ−1 Bkn ,n−1 λj−1,j j,j+1 γ(w1 . . . wn−2 ) ρn−1 = λ−1 Bkn ,n−1 λj,j+1 = %(α)λj,j+1 j,j+1 γ(w1 . . . wn−2 ) Therefore the braids %(α) and %(β) are conjugated and by the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.2.5. i = s − 1. In this case we can consider that ks < s − 1 since the case when ks = s − 1 = i is already solved in the case 3.2.3.2. Case 3.2.5.1. ι(α)(s − 1) = s. From the case 3.1.5.1. we have α1 = ηv1 . . . vn−2 w1 . . . wn−1 ρn−1 Bkn ,n−1 , %(α) = ηv1 . . . vn−2 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 , %2 (α) = η(v1 . . . vn−3 )ρn−2 (w1 . . . wn−3 )ρn−1 ρn−2 Bkn ,n−2 , where the braid η does not involve the strands n − 1, n. Let us count %(β). Step 1. The maximal number which is not fixed by β is equal to s. n−s s−n Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. 42 n−s n−s Step 3. By Lemma 1 we have λs−1,s B1,n = B1,n λn−1,n , therefore s−n n−s s−n −1 n−s β1 = B1,n βB1,n = B1,n λs−1,s αλs−1,s B1,n = λ−1 n−1,n α1 λn−1,n = λ−1 n−1,n ηv1 . . . vn−2 w1 . . . wn−1 Bkn ,n λn−1,n B −1 kn ,n = ηv1 . . . vn−2 λ−1 n−1,n w1 . . . wn−1 λn−1,n Bkn ,n = ηv1 . . . vn−2 λ−1 n−1,n w1 . . . wn−1 λn−2,n−1 Bkn ,n = ηv1 . . . vn−2 λn−2,n−1 w1 . . . wn−2 λ−1 n−1,n wn−1 Bkn ,n , where the braid ηv1 . . . vn−2 λn−2,n−1 does not involve the strand n. Step 4. β2 = ηv1 . . . vn−2 λn−2,n−1 w1 . . . wn−2 ρn−1 Bkn ,n−1 . Step 5. %(β) = ηv1 . . . vn−2 λn−2,n−1 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 . Let us count %2 (β). Step 1. Since the braid η does not involve the strand n − 1, then the image of n − 1 under the permutation ι(%(β)) is equal to ι(Bkn ,n−1 )(n − 1) = kn 6= n − 1. Step 2. %(β)1 = %(β). Step 3. The braid %(α)1 has the following form. %(β)1 = %(β) = ηv1 . . . vn−2 λn−2,n−1 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 ρn−1 = ηv1 . . . vn−3 (w1 . . . wn−3 )ρn−1 vn−2 λn−2,n−1 wn−2 Bkn ,n−1 Step 4. %(β)2 = ηv1 . . . vn−3 (w1 . . . wn−3 )ρn−1 ρn−2 Bkn ,n−2 Step 5. %2 (β) = ηv1 . . . vn−3 (w1 . . . wn−3 )ρn−1 ρn−2 Bkn ,n−2 = %2 (α). By the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.2.5.2. ι(α)(s − 1) = s − 1. In this case we have α1 = ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 ρn−1 Bkn ,n−1 %(α) = ηv1 . . . vn−2 Bkn−1 ,n−1 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 , where the braid η does not involve the strands n − 1, n and kn−1 ≥ kn . Since ι(α)(s − 1) = s − 1, then ι(α1 )(n − 1) = n − 1, therefore kn−1 = n − 2 and Bkn−1 ,n−1 = ρn−2 . α1 = ηv1 . . . vn−2 ρn−2 w1 . . . wn−1 ρn−1 Bkn ,n−1 %(α) = ηv1 . . . vn−2 ρn−2 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 , Let us count the braid %(β). 43 Step 1. The maximal number which is not fixed by β is equal to s. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. Step 3. Similarly to the case 3.2.5.1. we have β1 = λ−1 n−1,n α1 λn−1,n and therefore β1 = λ−1 n−1,n ηv1 . . . vn−2 ρn−2 w1 . . . wn−1 Bkn ,n λn−1,n B −1 kn ,n = ηv1 . . . vn−2 λ−1 n−1,n ρn−2 w1 . . . wn−1 ρn−1 λn−1,n Bkn ,n ρn−2 w1 . . . wn−1 λn−2,n−1 Bkn ,n = ηv1 . . . vn−2 ρn−2 (λ−1 n−1,n ) = ηv1 . . . vn−2 ρn−2 λn−2,n−1 λ−1 n−2,n w1 . . . wn−1 Bkn ,n , where the braid = ηv1 . . . vn−2 ρn−2 λn−2,n−1 does not involve the strand n. Step 4. β1 = ηv1 . . . vn−2 ρn−2 λn−2,n−1 λ−1 n−2,n w1 . . . wn−2 ρn−1 Bkn ,n−1 . Step 5. The braid %(β) follows. ρn−1 %(β) = ηv1 . . . vn−2 ρn−2 λn−2,n−1 (λ−1 Bkn ,n−1 n−2,n w1 . . . wn−2 ) ρn−1 %(β) = ηv1 . . . vn−2 ρn−2 λn−2,n−1 λ−1 Bkn ,n−1 = %(α). n−2,n−1 (w1 . . . wn−2 ) By the induction hypothesis the braids %∗ (α) and %∗ (β) are conjugated by the element from Sn . Case 3.2.5.3. ι(α)(s − 1) ≤ s − 2. Case 3.2.5.3.1. ι(α)(s − 1) ≥ ι(α)(s) + 1. From the case 3.1.5.3.1. we have α1 = ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 ρn−1 Bkn ,n−1 %(α) = ηv1 . . . vn−2 Bkn−1 ,n−1 (w1 . . . wn−2 )ρn−1 Bkn ,n−1 %2 (α) = η(w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 n−1 ,n−1 Bkn ,n−2 ρn−1 Bk−1 ,n−1 Bkn ,n−2 ρn−2 n−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 wkn−1 Bkn−1 +1,n−2 Where the braid η does not involve the strands n − 1, n and kn−1 ≥ kn . Let us count the braid %(β) = %(λ−1 n−1,n βλn−1,n ). Step 1. The maximal number which is not fixed by β is equal to s. s−n n−s Step 2. We have β1 = B1,n βB1,n and ι(β1 )(n) = ks + n − s = kn 6= n. 44 Step 3. Similarly to the case 3.2.5.1. we have β1 = λ−1 n−1,n α1 λn−1,n and therefore β1 = λ−1 n−1,n ηv1 . . . vn−2 Bkn−1 ,n−1 w1 . . . wn−1 Bkn ,n λn−1,n B −1 kn ,n = ηv1 . . . vn−2 λ−1 n−1,n Bkn−1 ,n−1 w1 . . . wn−1 λn−1,n Bkn ,n Bkn−1 ,n−1 w1 . . . wn−1 λn−2,n−1 Bkn ,n = ηv1 . . . vn−2 Bkn−1 ,n−1 (λ−1 n−1,n ) = ηv1 . . . vn−2 Bkn−1 ,n−1 λ−1 kn−1 ,n w1 . . . wn−1 λn−2,n−1 Bkn ,n = ηv1 . . . vn−2 Bkn−1 ,n−1 λn−2,n−1 λ−1 kn−1 ,n w1 . . . wn−1 Bkn ,n where the braid ηv1 . . . vn−2 Bkn−1 ,n−1 λn−2,n−1 does not involve the strand n. Step 4. β2 = ηv1 . . . vn−2 Bkn−1 ,n−1 λn−2,n−1 λ−1 kn−1 ,n w1 . . . wn−2 ρn−1 Bkn ,n−1 . ρn−1 Step 5. %(β) = ηv1 . . . vn−2 Bkn−1 ,n−1 λn−2,n−1 (λ−1 Bkn ,n−1 . kn−1 ,n w1 . . . wn−2 ) Let us count %2 (β). Step 1 The maximal number which is not fixed by the braid %(β) is n − 1 and ι(%(β))(n − 1) = kn−1 + 1. Step 2 %(β)1 = %(β). Step 3 The braid %(β)1 can be rewritten ρn−1 %(α1 ) = ηv1 . . . vn−2 Bkn−1 ,n−1 λn−2,n−1 (λ−1 Bkn ,n−1 kn−1 ,n w1 . . . wn−2 ) Bk−1 ρn−1 Bk−1 n−1 (λ−1 = ηv1 . . . vn−2 λn−2,n−1 kn−1 ,n w1 . . . wn−2 ) ,n−1 n−1 ,n−1 ρn−1 Bk−1 ,n−1 n−1 = ηv1 . . . vn−2 λn−3,n−2 (λ−1 kn−1 ,n w1 . . . wn−2 ) Bkn−1 ,n−1 Bkn ,n−1 Bkn−1 ,n−1 Bkn ,n−1 Since kn−1 ≥ kn , then Bkn−1 ,n−1 Bkn ,n−1 = Bkn ,n−2 Bkn−1 +1,n−1 (13) and and therefore %(α1 ) = ηv1 . . . vn−2 λn−3,n−2 (λ−1 kn−1 ,n w1 . . . wn−2 ) ρn−1 Bk−1 n−1 ,n−1 Bkn ,n−2 Bkn−1 +1,n−1 ρn−1 Bk−1 ,n−1 n−1 = ηλn−3,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 · v1 . . . vn−2 (λ−1 kn−1 ,n wkn−1 ) n−1 ,n−1 Bkn ,n−2 Bkn−1 +1,n−1 ρn−1 Bk−1 = ηλn−3,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) · (v1 . . . vn−2 )Bkn ,n−2 (λ−1 kn−1 ,n wkn−1 ) n−1 ,n−1 ρn−1 Bk−1 ,n−1 Bkn ,n−2 n−1 Bkn−1 +1,n−1 ρn−1 Bk−1 ,n−1 n−1 = ηλn−3,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 (λ−1 kn−1 ,n wkn−1 ) 45 Bkn ,n−2 Bkn ,n−2 Bkn ,n−2 Bkn ,n−2 n−1 ,n−1 vn−3 Bkn−1 +1,n−1 , where the braid ηλn−3,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) does not involve the strand n − 1. ρn−1 Bk−1 n−1 ,n−1 Bkn ,n−2 Step 4 The braid %(β)2 has the following form ρn−1 Bk−1 %(β)2 = ηλn−3,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) · (v1 . . . vn−4 vn−2 )Bkn ,n−2 (λ−1 kn−1 ,n wkn−1 ) n−1 ,n−1 Bkn ,n−2 ρn−1 Bk−1 ,n−1 Bkn ,n−2 n−1 ρn−2 Bkn−1 +1,n−2 , Step 5 Finally, the braid %2 (α) follows ρn−1 Bk−1 %2 (β) = ηλn−3,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 Bkn ,n−2 ρn−1 Bk−1 ,n−1 Bkn ,n−2 ρn−2 n−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 (λ−1 kn−1 ,n wkn−1 ) ρn−1 Bk−1 B kn ,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) = ηBkn ,n−2 λn−3,n−2 ρn−1 Bk−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 (λ−1 kn−1 ,n wkn−1 ) n−1 ,n−1 = ηBkn ,n−2 λn−2,kn (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) ρn−1 Bk−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 λ−1 n−2,kn wkn−1 n−1 ,n−1 n−1 ,n−1 Bkn−1 +1,n−2 Bkn ,n−2 Bkn ,n−2 ρn−2 Bkn−1 +1,n−2 ρn−1 Bk−1 ,n−1 Bkn ,n−2 n−1 Bkn ,n−2 ρn−2 Bkn−1 +1,n−2 ρn−1 Bk−1 ,n−1 Bkn ,n−2 n−1 = ηBkn ,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) · (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 λn−2,kn ρn−1 Bk−1 · [λn−2,kn , (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) Bkn ,n−2 ρn−2 · (v1 . . . vn−4 vn−2 ) n−1 ,n−1 Bkn ,n−2 ρn−1 Bk−1 ,n−1 Bkn ,n−2 ρn−2 −1 ]λn−2,kn wkn−1 n−1 Bkn−1 +1,n−2 ρn−1 Bk−1 Bkn ,n−2 ρn−1 Bk−1 Bkn ,n−2 = ηBkn ,n−2 (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) n−1 ,n−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 · [λn−2,kn , (w1 . . . wkn−1 −1 wkn−1 +1 . . . wn−2 ) −1 n−1 ,n−1 ρn−1 Bk−1 · (v1 . . . vn−4 vn−2 )Bkn ,n−2 ρn−2 ]λn−2,kn wkn−1 n−1 ,n−1 Bkn ,n−2 ρn−2 Bkn−1 +1,n−2 0 Therefore the braids %2 (α) and %2 (β) are equal modulo U V Pn−2 and by the remark ∗ ∗ 0 2 the braids % (α) and % (β) are equal modulo U V Pn , therefore %∗ (α) = %∗ (β). Case 3.2.5.3.2. ι(α)(s − 1) ≤ ι(α)(s). This case literally repeats the case 3.2.5.3.1 using the fact that in this case kn−1 < kn and then using the equalities Bkn−1 ,n−1 Bkn ,n−1 = Bkn −1,n−2 Bkn−1 ,n−1 46 instead of equality (13). n−s n−s Case 3.2.6. i = s. By Lemma 1 we have λs,s+1 B1,n = B1,n λn,1 , therefore β1 = −1 −1 λn,1 α1 λn,1 . By the definition λ1,n = B2,n λ1,2 B2,n , therefore −1 −1 −1 −1 β1 = B2,n λ−1 1,2 B2,n α1 B2,n λ1,2 B2,n = B2,n λ1,2 δ1 λ1,2 B2,n , −1 where δ1 = B2,n α1 B2,n . By the case 3.1 the braids %∗ (α1 ) and %∗ (δ1 ) are conjugated by the element from Sn . Since α is not a pure braid, then α1 and δ1 are not pure braids. Therefore the maximal number which is not fixed by δ1 is greater then or equal to 2. Therefore, by the cases 3.2.1-3.2.5 the braids %∗ (δ1 ) and %∗ (λ−1 1,2 δ1 λ1,2 ) are conjugated by the element from Sn . Also by the case 3.1 the braids %∗ (λ−1 1,2 δ1 λ1,2 ) −1 ∗ and %∗ (B2,n λ−1 1,2 δ1 λ1,2 B2,n ) = % (β1 ) are conjugated by the element from Sn , therefore the braids %∗ (α1 ) = %∗ (α) and %∗ (β1 ) = %∗ (β) are conjugated by the element from Sn . Case 3.2.7. i ≥ s + 1. In this case β1 = λ−1 j,j+1 α1 λj,j+1 , where n−s j = ι(B1,n )(i) = i + n − s (mod n) < n. Since the maximal number which is not fixed by α1 is equal to n, then %∗ (α1 ) and %∗ (β1 ) are conjugated by the element from Sn by the cases 3.2.1-3.2.5. The proposition is proved. The following main result of the paper follows immediately from Corollary 1 and Proposition 2. Theorem 4. Let α and β be unrestricted virtual braids. Then their closures α b and ∗ ∗ b β are equivalent as fused links if and only if % (α) and % (β) are conjugated by the element from Sn < U V Bn . References [1] B. Audoux, P. Bellingeri, J.-B. Meilhan, E. Wagner, On forbidden moves and the Delta move, ArXiv: Math/1510.04237. [2] J. Baez, Link invariants of finite type and perturbation theory, Lett. Math. Phys., V. 26, N. 1, 1992, 43-51. [3] V. Bardakov, P. Bellingeri, C. Damiani, Unrestricted virtual braids, fused links and other quotients of virtual braid groups, accepted to J. Knot Theory Ramifications, V. 24, N. 12, 2015. [4] V. Bardakov, The virtual and universal braids, Fund. Math., V. 184, 2004, 1-18. [5] J. Birman, New points of view in knot theory, Bull. Am. Math. Soc., New Ser., V. 28, N. 2, 1993, 253-287. [6] J. Birman, Braids, links and mapping class group, Princeton–Tokyo: Univ. press, 1974. 47 [7] S. Chmutov, S. Duzhin, J. Mostovoy, Introduction to Vassiliev Knot Invariants, Cambridge Univ. Press, 2012. [8] R. Fenn, R. Rimanyi, C. Rourke, The braid–permutation group, Topology, V. 36, N. 1, 1997, 123-135. [9] A. Fish, E. Keyman, Classifying links under fused isotopy, ArXiv: math/0606198. [10] C. Gordon, J. Luecke, Knots are determined by their complements. J. Amer. Math. Soc., V. 2, N. 2, 1989, 371-415. [11] M. Goussarov, M. Polyak, O. Viro, Finite-type invariants of classical and virtual knots, Topology, V. 39, N. 5, 2000, 1045-1068. [12] D. Joyce, A classifying invariant of knots, the knot quandle, J. Pure and Appl. Alg., V. 23, 1982, 37-65. [13] Z. Kadar, P. Martin, E. Rowell, Z. Wang, Local representations of the loop braid group, ArXiv: Math/1411.3768. [14] S. Kamada, Braid presentation of virtual knots and welded knots, Osaka J. Math, V. 44, 2007, 441-458. [15] T. Kanenobu, Forbidden moves unknot a virtual knot, J. Knot Theory Ramifications, V. 10, N. 1, 2001, 89-96. [16] L. Kauffman, S. Lambropoulou, Virtual braids and the L-move, J. Knot Theory Ramifications, V. 15, N. 6, 2006, 1-39. [17] L. Kauffman, S. Lambropoulou, Virtual braids. Fund. Math., V. 184, 2004, 159-186. [18] L. Kauffman, Virtual knot theory, Eur. J. Comb., V. 20, N. 7, 1999, 663-690. [19] V. Manturov, Knot theory, A CRC Press Company, London, New York, Washington, 2014. [20] V. Vassiliev, Complements of discriminants of smooth maps, Topology and applications, Translations of Mathematical Monographs, V. 98, Amer. Math. Soc., Providence, RI, 1992. [21] V. Vershinin, On homology of virtual braids and Burau representation, J. Knot Theory Ramifications, V. 10, N. 5, 2001, 795-812. 48
4math.GR
arXiv:1802.10578v1 [math.AC] 28 Feb 2018 Rings of constants of linear derivations on Fermat rings Marcelo Veloso e-mail: [email protected] Ivan Shestakov e-mail: [email protected] Abstract In this paper we characterize all the linear C-derivations of the Fermat ring. We show that the Fermat ring has linear C-derivations with trivial ring of constants and construct some examples. Keywords: Derivations, Fermat ring, ring of constants. 2010 AMS MSC: 13N15, 13A50, 16W25. Introduction The present paper deals with C-derivations of the Fermat ring Bnm = C[X1 , . . . , Xn ] , (X1m1 + · · · + Xnmn ) where C[X1 , . . . , Xn ] is the polynomial ring in n variables over the complex numbers C, n ≥ 3, m = (m1 , . . . , mn ), mi ∈ Z and mi ≥ 2 for i = 1, . . . , n. It is well known the difficulty to describe the ring of constants of an arbitrary derivation (see [1, 3, 4, 5]). It is also difficult to decide if the ring of constants of a derivation is trivial (see [5, 6, 7]). In this work we study the ring of constants of linear derivations of Fermat rings and its locally nilpotent derivations. In [5], Andrzej Nowicki presents a description of all linear C-derivations of the polynomial ring C[X1 , . . . , Xn ] which do not admit any nontrivial rational constant. In a recent paper [1], P. Brumatti and M. Veloso show that for m = (2, . . . , 2) the ring Bnm has nonzero irreducible locally nilpotent derivations. Furthermore, whenever m1 = · · · = mn , They show that certain classes of derivations of C[X1 , . . . , Xn ] do not induce derivations of Bnm or are not locally nilpotent if they do. In this work we obtain some similar results to [1], considering more general Fermat rings. We present a description of all the linear C-derivations of Bnm 1 when m = (m1 , . . . , mn ) and mi ≥ 3 (Theorem 5) and m = (2, . . . , 2) (Theorem 6). We also provide examples of linear derivations of Bnm with trival ring constants. The text is organized as follows: Section 1 gathers the basic definitions and notations. Further, we discuss several properties of the ring Bnm are discussed and a set of generators for Der(Bnm ) is presented. Section 2 is dedicated to the study of the linear derivations of the Fermat ring. The set of all locally nilpotent C-derivations of Bnm is studied in Section 3. Finally, Sections 4 and 5 are devoted to the study of the rings of constants of linear derivations of Fermat rings. 1 Preliminaries and Some Results In this paper the word “ring" means a commutative ring with unit and characteristic zero. Furthermore, we denote the group of units of a ring R by R∗ and the polynomial ring in n variables over R by R[X1 , . . . , Xn ]. A “domain” is an integral domain. An additive mapping D : R → R is said to be a derivation of R if it satisfies the Leibniz rule: D(ab) = aD(b) + D(a)b, for all a, b ∈ R. If A is a subring of R and D is a derivation of R satisfying D(A) = 0 is called D an A-derivation. The set of all derivations of R is denoted by Der(R), the set of all A-derivations of R by DerA (R) and by ker(D), the ring of constants of D, that is ker(D) = {a ∈ R | D(r) = 0}. In this paper, the word "derivation" implicitly means a derivation which is C-derivation and therefore we will use the notation Der(Bnm ) to denote DerC (Bnm ). The residue classes of variables X, Y , Z, ... module an ideal are represented by x, y, z, respectively. The symbol C is reserved to indicate the field of complex numbers. A derivation D is locally nilpotent if for each r ∈ R there is an integer n ≥ 0 such that Dn (r) = 0. We denote by LN D(R) the set of all locally nilpotent derivations of R. We say that a element b ∈ R is a Darboux element of D ∈ Der(R) if b 6= 0, b is not invertible in R and D(b) = λb for some λ ∈ R. In other words, a nonzero element b of R is a Darboux element of D if, and only if, the principal ideal (b) = {rb | r ∈ R} is different from R and it is invariant with respect to D, that is D((b)) ⊂ (b). If b is a Darboux element of D, then every λ ∈ R, such that D(b) = λb, is said to be an eigenvalue of b. In particular, every element nonzero and noninvertible element belonging to the ring of constants, ker D, is a Darboux element of D. If R is a domain and D(b) = λb, then it is easy to see such the eigenvalue λ is unique. Lemma 1 Let Bnm where m = (m1 , . . . , mn ). Then, for each f ∈ Bnm , there is a unique F ∈ C[X1 , . . . , Xn ] such that degXn < mn and f = F (x1 , . . . , xn ). Proof. It follows directly from the Euclidean division algorithm by considering the polynomial X1m1 + · · · + Xnmn as a monic polynomial in Xn with coefficients 2 in C[X1 , . . . , Xn−1 ]. ♦ Theorem 2 ([3, Theorem 4]) If n ≥ 5 and mi ≥ 2 for all 1 ≤ i ≤ n, then Bnm is a unique factorization domain. ♦ mn 1 We also can write Bnm = C[x1 , . . . , xn ], where xm = 0. Here 1 + · · · + xn x1 , x2 , . . . , xn are the images of X1 , X2 , . . . , Xn under the canonical epimormn−1 1 phism C[X1 , . . . , Xn ] → Bnm . An element of form axm or 1 · · · xn−1 mn−1 j m1 bx1 · · · xn1 xn , for 1 ≤ j ≤ mn − 1, is called monomial . A nonzero element f ∈ C[x1 , . . . , xn ] is said to be homogeneous element of degree k if f is of the form X f= a(i1 ···in ) xi11 · · · xinn i1 +···+in =k where 1 ≤ in ≤ mn − 1 and a(i1 ···in ) ∈ C for all (i1 · · · in ). We assume that the zero element is a homogeneous element of any degree. Furthermore, we denote by Vk the set of all homogeneous elements of degree k. Clearly Vk is a subspace of Bnm . 1.1 A set of generators for Der(Bnm ) Now we will present a set of generators for the Bnm -module Der(Bnm ). First some notation will be established. Given H ∈ S = C[X1 , . . . , Xn ] and 1 ≤ i ≤ n, the partial derivative ∂(H) ∂Xi is denoted by HXi . For all pairs ∂ ∂ −HXj i, j ∈ {1, . . . , n} with i 6= j, we define the derivation DHij = HXi ∂Xj ∂Xi on S. Observe that DHij (H) = 0. [n] Let A = CI be a finitely generated C-algebra. Consider the C[n] -submodule DI = {D ∈ DerC (C[n] ) | D(I) ⊆ I} of the module DerC (C[n] ). It is well known that the C[n] -homomorfism ϕ : DI → DerC (A) given by ϕ(D)(g + I) = D(g) + I induces a C[n] -isomorfism of IDerDC I(C[n] ) in DerC (A). The Theorem 3 will be needed, its proof can be found in [2, P roposition 1]. Theorem 3 Let F ∈ C[n] = C[X1 , . . . , Xn ] (n ≥ 2) be such that {FX1 , ..., FXn } is a regular sequence in S. If there exists a derivation ∂ on S such that ∂(F ) = αF for some α ∈ C, then the C[n] -module DF := {D ∈ Der(S) | D(F ) ∈ F · C[n] } F is generated by the derivation ∂ and the derivations Dij = Dij for i < j. From now on, the derivations DFij , where F = X1m1 + · · · + Xnmn , will be denoted by Dij. Since  m −1 if k=i  −mj Xj j Dij (Xk ) = mi Ximi −1 if k=j  0 if k ∈ / {i, j} 3 so Dij (F ) = 0. Then Dij ∈ Der(S) induces dij = mi ximi −1 in Der(Bnm ). Consider the derivation E= ∂ m −1 ∂ − mj xj j ∂xj ∂xi ∂ ∂ 1 1 X1 + ··· + Xn . m1 ∂X1 mn ∂Xn Note that E satisfies E(F ) = F . Hence, E ∈ Der(S) induces ε= 1 ∂ ∂ 1 x1 + ··· + xn ∈ Der(Bnm ) m1 ∂x1 mn ∂xn As a consequence of Theorem 3 the following result is obtained: Proposition 4 If F = X1m1 + · · · + Xnmn then DF := {D ∈ Der(S) | D(F ) ∈ F · S} is generated by the derivation E and the derivations Dij , i < j. In particular the Bnm -module Der(Bnm ) is generated by the derivation ε and by the derivations dij , for i < j. Proof. Since {m1 X m1 −1 , . . . , mn X mn −1 } is a regular sequence and E(F ) = F the result following by Theorem 3. ♦ 2 Linear derivations This section is dedicated to the study of the linear derivations of the Fermat ring Bnm = C[x1 , . . . , xn ], mn 1 where xm 1 + · · · + xn = 0. A derivation d of the ring Bnm is called linear if d(xi ) = n X aij xj for i = 1, . . . , n, where aij ∈ C. j=1 The matrix [d] = [aij ] is called the associated matrix of the derivation d. Theorem 5 Let d ∈ Der(Bnm ) be linear. If m = (m1 , . . . , mn ) with mi ≥ 3 for all i = 1, . . . , n, then its associated matrix [d] is a diagonal matrix and has the following form   α m1 for some α ∈ C.     α m2 .. . α mn 4   .  Proof. Let [d] = [aij ] be the associated matrix of d. Then d(xi ) = n X aij xj , for j=1 mn 1 all i. Since xm 1 + · · · + xn = 0, m1 x1m1 −1 d(x1 ) + · · · + mn xnmi −1 d(xn ) = 0. Then, n n n X X X n −1 anj xj ) a2j xj ) + · · · + mn xm ( a1j xj ) + m2 x2m2 −1 ( 0 = m1 x1m1 −1 ( n j=1 j=1 j=1 (2.1) Now note that n n X X 1 a1j xj ) =m1 a11 (xm ) + m a1j xj x1m1 −1 m1 x1m1 −1 ( 1 1 j6=1 j=1 mn 2 =m1 a11 (−xm 2 − · · · − xn ) + m1 n X a1j xj x1m1 −1 j6=1 and n n X X 2 a2j xj ) = m2 a22 xm + m a2j xj x2m2 −1 m2 x2m2 −1 ( 2 2 j6=2 j=1 .. . n n X X mn n −1 n −1 + m a x ) = m a x anj xj xm mn xm ( n nj j n nn n n n j6=n j=1 replacing in the Equation (2.1) we obtain mn 2 0 = (m2 a22 − m1 a11 )xm 2 + · · · + (mn ann − m1 a11 )xn + m1 n X a1j xj x1m1 −1 + j6=1 m2 n X a2j xj x2m2 −1 + · · · + mn j6=2 n X n −1 anj xj xm . n j6=n (2.2) Observe that if mi ≥ 3, then mi −1 mn 1 {xm | 1 ≤ i < j ≤ n, } ∪ {xj ximi −1 | 1 ≤ j < i ≤ n} 2 , . . . , xn } ∪ {xj xi is a linearly independent set over C. Thus, we conclude that mn ann = · · · = m2 a22 = m1 a11 = α and aij = 0 if i 6= j, 5 i.e. aij =  if if 0 α mi i 6= j i=j ♦ This theorem shows that for m = (m1 , . . . , mn ) and mi ≥ 3 linear derivations of B2m are what is called diagonal derivations. The next result characterizes linear derivations of Bnm whenever m = (2, . . . , 2). Previously, remember that a square matrix with complex elements A is said to be skew-symmetric matrix if AT = −A (here AT stands, of course, for the transpose of the matrix A). Theorem 6 Let d ∈ Der(Bnm ) be linear. If m = (2, . . . , 2), then there exist a scalar derivation dα ([dα ] is a scalar matrix) and a skew-symmetric derivation ds ([ds ] a skew-symmetric matrix) such that d = dα + ds . This decomposition is unique. Proof. Let d ∈ Der(Bnm ) be a linear derivation and A = [aij ] its associated matrix. Using the same arguments used in Theorem 5 we obtain X (aij + aji )xi xj 0 = (a22 − a11 )x22 + · · · + (ann − a11 )x2n + i<j {x22 , . . . , x2n } Since the set C, it follows that ∪ {xi xj ; 1 ≤ i < j ≤ n} is linearly independent over a11 = a22 = · · · = ann = α and aij = −aji if i < j, then its associated matrix [d] has the following form   α a12 . . . a1n  −a12 α a2n     .. .. ..  . . .  . . . .  −a1n −a2n . . . α where α, aij ∈ C. Now define dα by dα (xi ) = αxi , i = 1, . . . , n and ds = d − dα . ♦ 3 Locally Nilpotent Derivations In this section we proof that the unique locally nilpotent derivation linear of Bnm for m = (m1 , . . . , mn ) and mi ≥ 3 is the zero derivation. Further, we show that a certain class of derivations of C[X1 , . . . , Xn ] do not induce nonzero locally nilpotent derivation of Bnm . [n] Let S = CI be a finitely generated C-algebra. Consider the C[n] -submodule DI = {D ∈ DerC (C[n] ) | D(I) ⊆ I} of the module DerC (C[n] ). It is well known 6 that the C[n] -homomorfism ϕ : DI → DerC (S) given by ϕ(D)(g + I) = D(g) + I induces a C[n] -isomorfism of IDerDC I(C[n] ) in DerC (S). From this fact the following result is obtained. Proposition 7 Let d be a derivation of the Bnm . If d(x1 ) = a ∈ C and for each i, 1 < i ≤ n, d(xi ) ∈ C[x1 , . . . , xi−1 ], then d is the zero derivation. Proof. Let F be the polynomial X1m1 + · · · + Xnmn . We know that exists D ∈ Der(C[n] ) such that D(F ) ∈ F C[n] and that d(xi ) = D(Xi ) + F C[n] , ∀i. Thus D(X1 ) − a ∈ F C[n] , and for each i > 1 there exists Gi = Gi (X1 , . . . , Xi−1 ) ∈ C[X1 , . . . , Xi−1 ] such that D(Xi ) − Gi ∈ F C[n] . Since n X mi Ximi −1 D(Xi ) ∈ F C[n] and D(F ) = i=1 D(F ) = n X mi Ximi −1 (D(Xi ) − Gi ) + mi Ximi −1 Gi , i=1 i=1 where G1 = a, we obtain n X n X mi Ximi −1 Gi ∈ F C[n] and then obviously Gi = 0 i=1 for all i. Thus d is the zero derivation. Lemma 8 Let d be a linear derivation of Bnm and [aij ] its associated matrix. Then d is locally nilpotent if and only if [aij ] is nilpotent. Proof. The following equality can be verified by induction over s.  ds (x1 )   ..   . s d (xn )   x1  s = [aij ]  ...  . xn  (3.3) We know that d is locally nilpotent if and only if there exists r ∈ N such that dr (xi ) = 0 for all i. As {x1 , . . . , xn } is linearly independent over C by the (3.3), the result follows. ♦ Theorem 9 If d ∈ LN D(Bnm ) is linear and m = (m1 , . . . , mn ) wich mi ≥ 3, then d is the zero derivation. Proof. Since d is locally nilpotent, [d] is nilpotent (by Lemma 8) and diagonal (by Theorem 5). Thus, the matrix [d] is null and d is the zero derivation. ♦ In the case m = (2, . . . , 2), linear locally nilpotent derivations of the ring Bnm were characterized as follows. Theorem 10 [1, Theorem 1] If d ∈ Der(Bnm ) is linear and m = (2, . . . , 2), then d ∈ LN D(Bn2 ) if, and only if, its associated matrix is nilpotent and skewsymmetric. ♦ 7 4 Ring of constants In this section we show that the ring of constants of all nonzero linear derivations of Bnm , where m = (m1 , . . . , mn ) and mi ≥ 3, is trivial, that is ker(d) = C. During all this section we always consider m = (m1 , . . . , mn ) with mi ≥ 3. The next result ensures the existence of Darboux elements for every nonzero linear derivation of Bnm . Proposition 11 Let d be a nonzero linear derivation of Bnm . If d(xi ) = mαi xi , i = 1, . . . , n, for some α ∈ C∗ , then f = bxi11 · · · xinn is a Darboux element of d, d(f ) = λf , and   i1 i2 in λ=α . + + ···+ m1 m2 mn Proof. Let f = bxi11 · · · xinn . Then d(f ) =d(bxi11 · · · xinn ) =bd(xi11 · · · xinn ) n X =b ik xi11 · · · xikk −1 · · · xinn d(xk ) =b k=1 n X ik xi11 k=1 n X =αb k=1 =bα =λf  · · · xikk −1 · · · xinn  α xk mk  ik i1 x · · · xinn mk 1 i1 i2 in + + ··· + m1 m2 mn  xi11 · · · xinn ♦ Corollary 12 Let d be a nonzero linear derivation of Bnm . If f is a homogeneous element of degree k, then f is a Darboux element of Bnm with eigenvalue k λ= m . Proof. Let f = X a(i1 ···in ) xi11 · · · xinn be a homogeneous element of degree i1 +···+in =k k, where 0 ≤ in < m and a(i1 ···in ) ∈ C. 8 X d(f ) =d a(i1 ···in ) xi11 · · · xinn i1 +···+in =k = X a(i1 ···in ) d(xi11 · · · xinn ) X a(i1 ···in )  X a(i1 ···in ) k i1 x · · · xinn m 1 ! i1 +···+in =k = i1 +···+in =k = i1 +···+in =k k = m X i1 i2 in + + ···+ m m m a(i1 ···in ) xi11 i1 +···+in =k =λf · · · xinn  xi11 · · · xinn ! ♦ The main result this section is: Theorem 13 Let d be a nonzero linear derivation of Bnm . Then ker(d) = C. Proof. By Theorem 5, d(xi ) = α 6= 0. Let 0 6= f ∈ Bnm α mi xi for i = 1, . . . , n and α ∈ C. Since d 6= 0, so X b(i1 ,...,in ) xi11 · · · xinn such that d(f ) = 0. Thus f = (i1 ,...,in )∈I where 0 6= b(i1 ,...,in ) ∈ C for all (i1 , . . . , in ) ∈ I. Then X b(i1 ···in ) d(xi11 · · · xinn )   X i2 in i1 xi11 · · · xinn + + ···+ = b(i1 ···in ) α m1 m2 mn 0 = d(f ) = i1 i2 It follows from Lemma 1 that b(i1 ···in ) α( m + m + · · · + minn ) 6= 0 for all 1 2 (i1 , . . . , in ) ∈ I, because b(i1 ···in ) α 6= 0 for all (i1 , . . . , in ) ∈ I. So mi11 + mi22 + · · · + minn = 0 for all (i1 , . . . , in ) ∈ I. This implies that (i1 , . . . , in ) = (0, . . . , 0) for all (i1 , . . . , in ) ∈ I. Therefore f ∈ C. ♦ Theorem 14 Let d ∈ Der(Bnm ) be given by d(xi ) = mαi , i = 1, . . . , n, for some α ∈ C. If X a(i1 ,...,in ) xi11 · · · xinn f= (i1 ,...,in )∈I is a darboux element of d, this is, d(f ) = λf for some λ ∈ Bnm , then i1 + mi22 + · · · + minn ) for all (i1 , . . . , in ) ∈ I. λ = α( m 1 9 X Proof. Let f = a(i1 ,...,in ) xi11 · · · xinn . It follows from Theorems 13 and 5 that X a(i1 ···in ) b(i1 ...in ) xi11 · · · xinn d(f ) = (i1 ,...,in )∈I where b(i1 ···in ) = So X α( mi11 + i2 m2 + ··· + in mn ) ∈ C. Then a(i1 ···in ) b(i1 ...in ) xi11 · · · xinn = d(f ) = λf = X λa(i1 ···in ) xi11 · · · xinn a(i1 ...in ) b(i1 ···in ) = λa(i1 ...in ) for all (i1 , . . . , in ) ∈ I, by Lemma 1. Therefore λ = b(i1 ...in ) = α( mi11 + · · · + minn ) for all (i1 , . . . , in ) ∈ I. 5 i2 m2 + ♦ The case m = (2, . . . , 2) In this section we focus on the Fermat rings Bnm = C[X1 , . . . , Xn ] , (X12 + · · · + Xn2 ) where m = (2, . . . , 2) and n ≥ 3. For simplicity we denote Bnm by Bn2 . We study linear derivations of Bn2 , their rings of constants, and we show how to construct examples of linear derivations with trivial ring of constants. The next result will be useful for this purpose. Proposition 15 Let d be a nonzero linear derivation of Bnm , with d = dα + ds , where dα is the scalar derivation and is skew-symmetric derivation. Let dα definid by dα (xi ) = αxi for i = 1, . . . , n and α ∈ C. If f ∈ Bn2 is homogeneous element of degree k then d(f ) = λf if, and only if, ds (f ) = (λ − kα)f . Proof. It is easy to see that dα (f ) = kaf . Suppose that d(f ) = λf . Then λf = d(f ) = dα (f ) + ds (f ) = −αkf + ds (f ). Hence, ds (f ) = (λ − kα)f. Now suppose d1 (f ) = (λ − ka)f . Then d(f ) = dα (f ) + ds (f ) = kαf + (λ − kα)f = λf. ♦ Corollary 16 Let d = dα + ds be a nonzero linear derivation of Bn2 , where dα is the scalar derivation and ds is skew-symmetric derivation. If f ∈ Bn2 is homogeneous element of degree k then d(f ) = 0 if, and only if, ds (f ) = −kαf . 10 Proof. Consider λ = 0 in Proposition 15. ♦ The next Theorem shows that every skew-symmetric derivation has a nontrivial ring of constants and every nonzero scalar derivation has trivial ring of constants. Theorem 17 Let d = dα + ds be a nonzero linear derivation of Bn2 , where dα is the scalar derivation and ds is skew-symmetric derivation. Then 1. If ds is zero the derivation, then ker(d) = ker(dα ) is trivial. 2. If dα is the zero derivation, then ker(d) = ker(ds ) is nontrivial. Proof. 1) Observe that dα (f ) = kaf for all homogeneous element of degree k and dα (Vk ) ⊂ Vk . 2) It suffices to prove that there is f ∈ Bn2 such that ds (f ) = 0 and f 6∈ C. Let f a homogeneous element of degree 2 of Bn2 , then f = XAX T where A = [aij ] is a symmetric matrix and X = (x1 , . . . , xn ). Observe that for B = [ds ] we have d(f ) = d(XAX T ) =(XB)AX T + XA(XB)T =XBAX T + XA(−BX T ) =XBAX T − XABX T =X(BA − AB)X T . If B 2 6= 0 consider the symmetric matrix B 2 . It follows from the above remark that for f = XB 2 X T we have ds (f ) = 0 and f 6∈ C, because A = B 2 6= 0. If B 2 = 0, then λ = 0 is eigenvalue of B and B T . In this case, choose a nonzero element f = a1 x1 + · · · + an xn such that the nonzero vector (a1 , . . . , an )T is an eigenvector of B T . So d(f ) = 0 and f 6∈ C. Therefore, ker(ds ) 6= C. ♦ We also show that there are linear derivations with dα 6= 0, ds 6= 0, and trivial ring of constants. Theorem 18 Let ds be a nonzero skew-symmetric derivation of Bn2 . Then exists a scalar derivation dα of Bn2 such that the derivation d = dα + ds satisfies ker(d) = C. Proof. First note that the vector space Vk (the set of homogeneous elements of degree k of Bn2 ) is invariant with respect to ds . Hence ds (f ) = 0 if only if ds (fk ) = 0 for all homogeneous components fk of f . As a consequence of this fact we assume that f is a homogeneous element of degree k. Let α be a nonzero complex number that satisfies the conditions 1. α ∈ / Spec(ds ), 2. for all positive integer k, −kα ∈ / Spec(ds | Vk ). 11 This number exists because C is uncountable and the set of the numbers that satisfies 1) and 2) are countable. Let α be a number that satisfies the conditions 1) and 2), then ds (f ) 6= αf and ds (f ) 6= −kαf , for all f ∈ / C and for all positive integer k . Let dα be a scalar derivation defined by dα (xi ) = αxi , i = 1, . . . , n. Finally, by considering the derivation d = dα + ds , we show that ker(d) = C. In order to do that, if g ∈ Bn2 is a nonzero homogeneous element of degree k, then d(g) = 0 if, and only if, ds (g) = −kαg, by Corollary 16, which implies k = 0. Therefore, g ∈ C∗ . ♦ We now provide and explicit example of such derivation: Example 19 Let d = d1 + ds be the linear derivation of B32 = C[x, y, z] given by       1 0 0 1 0 0 0 0 0 [d] = [d1 ] + [ds ] =  0 1 −1  =  0 1 0  +  0 0 −1  . 0 1 1 0 0 1 0 1 0 We claim that ker(d) = C. To be more precise, let Vk be the set of all homogeneous elements of degree k in C[y, z]. The set Sk = {y k , y k−1 z, . . . , yz k−1 , z k } is a basis for Vk . The matrix  k 1 0  −k k 2    0 −(k − 1) k   0 −(k − 2) [d | Vk ] =    . . . .  . . 0   ..  0 0 . 0 0 0 ... ... .. . ... ... 0 0 .. . .. . k−2 0 .. . k k−1 −2 0 k −1 ... 0 0 .. .        0    0    k  k is the matrix the linear derivation d restrict to subspace Vk in the basis Sk . It is easy check that Det([d | Vk ]) 6= 0 for all k ≥ 1, by the principle of induction. Then d(f ) 6= 0 for all homogeneous elements of degree k ≥ 1. Therefore, ker(d) = C. Theorem 20 Let d = dα + ds be a nonzero linear derivation of Bn2 , where dα is a scalar derivation and ds is a skew-symmetric derivation. If ds is a locally nilpotent derivation then ker(d) = C, for all nonzero scalar derivation dα . Proof. Let 0 6= f ∈ Bn2 such that d(f ) = 0. It suffices to show that f ∈ C. We may assume that f is a nonzero homogeneous element of degree k, because Vk is invariant by d. Let m be the smallest positive integer such that g = dm−1 (f ) 6= 0 s and dm (f ) = 0, this m exists because d is a locally nilpotent derivation. This s s 12 implies that g is a nonzero homogeneous element of degree k, because Vk is invariant by d. One easily verifies that dα ds = ds dα and dds = ds d. Note that d(g) = dα (g) + ds (g) = kαg, because g is an homogeneous element of degree k and dm s (f ) = 0. Now observe that d(g) = d(dm−1 (f )) = dm−1 (d(f )) = dm−1 (0) = 0. s s s We thus get kαg = 0. And so k = 0. Therefore, f ∈ C. ♦ To conclude this section we construct two families of examples which illustrate this theorem. Example 21 Let n ≥ 3 be an odd number defined by the skew-symmetric matrix n × n  0 0 ... 0  0 0 ... 0   .. .. . . .  . .. [ds ] =  . .  0 0 ... 0   0 0 ... 0 1 i ... 1 and ds a linear derivation of Bn2 0 0 .. . 0 0 i −1 −i .. .      . −1   −i  0 It is easy to check that [ds ]3 = 0, which implies that [ds ] is nilpotent. Then ds is a locally nilpotent linear derivation of Bn2 , by Theorem 10. Now consider the linear derivation d = d1 + ds , where d1 (xi ) = xi for i = 1, . . . , n. It follows from Theorem 20 that ker(ds ) = C. Example 22 Let n ≥ 4 be an even number and ε ∈ C a primitive (n − 1)-th root of unity. Set ds a linear derivation of Bn2 by the skew-symmetric matrix n × n   0 0 ... 0 ... 0 −1  0 0 0 ... 0 0 −ε     .. .. . .  .. . . .. ..  . .  . . . . .   k  0 0 . . . 0 . . . 0 −ε [ds ] =     . . .  . . . . . . .. .. .. ..  .. ..    n−2   0 0 ... 0 ... 0 −ε 1 ε . . . εk . . . εn−2 0 Again, [ds ] is nilpotent ([de ]3 = 0). Thus, ds is a locally nilpotent derivation of Bn2 , by Theorem 10. Now considering the linear derivation d = d1 + de , where d1 is the same as in the previous example, we conclude that ker(ds ) = C, by Theorem 20. Remark: In the Example 19 it easy see that [ds ] is not nilpotent and, consequently ds is not locally nilpotent (Theorem 10). This shows that ds locally nilpotent is not a necessary condition in Theorem 20 for ker(dα + ds ) = C. 13 References [1] P. Brumatti and M. Veloso, On locally nilpotent derivations of Fermat Rings, Algebra and Discrete Mathematics 16 (1), 33–41, (2013). [2] P. Brumatti and M. Veloso, A note on Nakai’s conjecture for the ring K[X1 ,...,Xn ] , Colloquium Mathematicum 123 (2), 277–283, (2011). m (a X 1 +···+a X mn ) 1 1 n n [3] D. Fiston and S. Maubach, Constructing (almost) rigid rings and a UFD having infinitely generated Derksen and Makar-Limanov invariant, Canadian Mathematical Bulletin 53 (1), 77-86, (2010). [4] G. Freudenberg, Algebraic Theory of Locally Nilpotent Derivations, Encyclopaedia of Mathematical Sciences 136, Springer-Verlag Berlin Heidelberg, (2006). [5] A. Nowicki, On the nonexistence of rational first integrals for systems of linear differential equations, Linear Algebra and Its Applications 235, 107120, (1996). [6] J. M. Ollagnie and A. Nowicki, Derivations of polynomial algebras without Darboux polynomials, Journal of Pure and Applied Algebra 212, 1626-1631, (2008). [7] J. Zielinski, Rational Constants of Generic LV Derivations and of Monomial Derivations, Bulletin of the Polish Academy of Sciences. Mathematics 61, Issue: 3, 201-208, (2013). 14
0math.AC
1 On the Feasibility of Generic Deep Disaggregation for Single-Load Extraction arXiv:1802.02139v1 [cs.LG] 5 Feb 2018 Karim Said Barsim and Bin Yang {karim.barsim,bin.yang}@iss.uni-stuttgart.de Institute of Signal Processing and System Theory, University of Stuttgart Abstract— Recently, and with the growing development of big energy datasets, data-driven learning techniques began to represent a potential solution to the energy disaggregation problem outperforming engineered and hand-crafted models. However, most proposed deep disaggregation models are load-dependent in the sense that either expert knowledge or a hyper-parameter optimization stage is required prior to training and deployment (normally for each load category) even upon acquisition and cleansing of aggregate and sub-metered data. In this paper, we present a feasibility study on the development of a generic disaggregation model based on data-driven learning. Specifically, we present a generic deep disaggregation model capable of achieving state-of-art performance in load monitoring for a variety of load categories. The developed model is evaluated on the publicly available UK-DALE dataset with a moderately low sampling frequency and various domestic loads. Index Terms— Energy/Load disaggregation, Non-Intrusive Load Monitoring (NILM), Convolutional Neural Networks (CNN), UNet, SegNet, UK-DALE I. I NTRODUCTION Energy disaggregation (or Non-Intrusive Load Monitoring NILM) is the process of inferring individual load profiles at the end-use level from a single or a limited number of sensing points. Promising applications of disaggregated data have motivated a growing research community to reach a widely acceptable and scalable solution. Energy disaggregation proved to be a challenging source separation problem in which a considerably large number of parameters are to be estimated from a limited set of measurements with little constraints. In the last decade, energy disaggregation has witnessed an unprecedented wide-spreading research which is easily observed from the wide variety of learning techniques applied to this problem alongside with the growing number of energy datasets developed specifically for this research field. More recently, and analogous to the current breakthrough in datadriven learning, deep neural networks have re-gained their interest in addressing the energy disaggregation problem, especially alongside with the recently developed large energy datasets required for training such complex models [1–8]. The progress in this trend, however, is relatively slow when compared to the development in either field separately. This is sometimes attributed to the high risk of over-fitting in neural network models [9], insufficiency or low diversity of publicly available energy datasets [4], or limited insights and understanding of the learning behavior of these models [5]. In this paper, we first present a feasibility study on the development of a generic data-driven model suitable for enduse load monitoring. The proposed disaggregation model exploits a fully convolutional neural network architecture and is generic in the sense that none of the model hyperparameters is dependent on the load category. We assess the feasibility of such a model through empirical evaluation of the monitoring performance across various load categories in a publicly available energy dataset. II. R ELATED WORK In this section, we briefly describe some of the most recent works on energy disaggregation and load monitoring that adopted data-driven learning techniques. Mauch and Yang [2] exploited a generic two-layer bidirectional Recurrent Neural Network (RNN) architecture featuring Long Short Term Memory (LSTM) [10] units in extracting single load profiles. They tested their models on the Refrence Energy Disaggregation Dataset (REDD) [11] in a de-noised scheme [12]. Additionally, they validated the generalization of their architecture to previously unseen loads in new buildings. In a later work, Mauch and Yang [3] used a combination of discriminative and generative models in a two-stage eventless extraction of load profiles. Kelly and Knottenbelt [4] evaluated and compared three neural network architectures on domestic loads from the UK-Domestic Appliance Level Energy (UKDALE) [7]. The first is a bidirectional RNN architecture with LSTM units similar to the one in [2], the second follows the architecture of a de-noising Auto-Encoder (dAE) [13], and the last is a regression-based disaggregator whose objective is to estimate the main key points of an activation cycle of the target load within a given window. Similarly, He and Chai [6] applied two architectures, namely a convolutional dAE and an RNN, to the same problem. In their architectures, they also applied parallel convolutional layers with different kernel sizes analogous to the Inception module in GoogLeNet [14]. Zhang et al. [5] simplified the objective of the dAE architecture in [4] to predict a single time instance of the target load profile for a given window of the aggregate signal. Likewise, Nascimento [15] applied three neural network architectures, namely basic convolutional dAE, an RNN, and a ResNet-based model [16] to the same problem but on three target loads in the REDD dataset. He introduced several improvements such as redefining the loss function, exploiting batch normalization [17], and applying residual connections [16]. Additionally, Lange et al. [18] adopted a deep neural network with constrained binary and linear activation units in the last two layers. Their first objective was to retrieve subcomponents of the input signal that sum up linearly to the aggregate active and reactive powers. Finally, they estimate the on-off activation vector of each load. Their approach, however, was applied on very high frequency current and voltage measurements (12 kHz) from the Building-Level fUlly labeled dataset for Electricity Disaggregation (BLUED) [19]. In many of these previous works [4–6, 15], each disaggregator is a neural network whose disaggregation window length (and consequently the width of subsequent layers) depends on the load being monitored. The disaggregation window of each load is manually adjusted in a per-load basis to fully capture a single activation cycle of the load. Moreover, the disaggregation performance widely differs amongst variant 2 load categories and a model that achieves remarkably well on one load might drastically fail for other load types. III. L OAD M ONITORING In this work, we focus essentially on single-load extraction of activation profiles, of which we give a detailed description in the following. A. Activation profiles: definition and estimation In the simplest case, a load is modeled as a two-state machine which is assumed to be in the on-state whenever the load is consuming energy from the main power source, and in the off -state otherwise. Accordingly, load monitoring becomes a binary classification task. Note that in contrast to previous works, the consumption profile of a load during its on-state need not be a defined [20] nor a piecewise-defined function in time. The desired signal (i.e. ground truth) of a load m in a window of N time instances is the binary-valued signal ω (m) ∈ {0, 1}N whose element ω (m) (n) is set (i.e. to indicate an on-state) whenever the load is operating in one of its activation states at time instance n and unset otherwise. In this work, we refer to this signal as the activation profile. Applications that benefit from activation profiles include mainly activity monitoring and occupancy detection in which timeof-use information dominates the value of energy consumed. We define the true activation profile of a load ω (m) via a threshold-based approach applied to the sub-metered real power signals and similar to the one used in [4] as follows. The sub-metered real-power x(m) of a load m is compared against predefined thresholds to detect the operation intervals of the load. In order to avoid anomalies and false activations or deactivations, the load is assumed to be in an activation state (i.e. on) if its power draw x(m) (n) exceeds a given threshold (m) (m) Pon for a minimum period of time Non . Similarly, if the (m) power draw drops below a predefined threshold Poff for a (m) given period Noff , the load is assumed to be disconnected. Otherwise, the load keeps its last observed state. Thus, the estimated activation profile is defined as  (m) (m) if x(m) (k) > Pon , for n 6 k < n + Non  1, (m) (m) (m) ω (n) = 0, if x(m) (k) 6 Poff , for n 6 k < n + Noff   (m) ω (n − 1), otherwise with the initial state assumed to be off (i.e. ω (m) (0) = 0) for (m) (m) (m) (m) all loads. Note that Pon , Non , Poff , and Noff are the only load-dependent parameters in this work, and they are used merely in estimating the ground truth signals. Values of these parameters are similar or close to those adopted in [4] and are listed in Table I for the sake of completeness. B. Single load extraction In single-load extraction, each disaggregator targets exclusively a single load in the monitored circuit and normally ignores dependencies amongst loads. While exploiting loads’ dependencies is expected to improve the performance of a disaggregation system in a given building [9, 21, 22], it is also likely to reduce the generalization capability of such a system to new, previously unseen buildings. This is because such dependencies originate not only from the physical architecture of the power line network and the assumed signal model but also from the usage behavior of end-consumers which varies widely from one building to another, especially within the residential sector [23]. TABLE I: Load-dependent parameters for estimating the activation profiles. Load Pon = Poff [W] Non [min.] Noff [min.] 5 10 10 20 20 5 25 1000 50 300 1 1 30 30 1 3 5 1/3 1/6 1/6 1 1 5 5 1 3 5 1/6 1/6 1/20 Fridge (FR) Lights (LC) Dishwasher (DW) Washing machine (WM) Solar pump (SP) TV Boiler (BL) Kettle (KT) Microwave (MC) Toaster (TS) The load monitoring problem is modeled as K-separate binary classification tasks. Given a window of K samples of the k=K−1 starting aggregate real power signal x(n) = [x(n + k)]k=0 (m) at the time instance n, the model g (x(n), θ) ∈ [0, 1]K estimates the posterior probabilities of the activation profile for the analogous K time instances of mth load where θ is the model parameters (e.g. weights and biases in a neural network)   p ω (m) (n) = 1 x(n) = g (m) (x(n); θ) (1)   g (m) (x(n); θ) = σ g̃ (m) (x(n); θ) (2) X = ( x(0), x(K), x(2K), . . . , x((NK − 1) · K)) (3) where the disaggregator’s output is bound to the valid range of a probability function via a logistic sigmoid activation in the output layer of the network where g̃ represents the sub-network from the input layer to activation signals of the output layer and σ is the logistic sigmoid function Eq. 5 applied element-wise to g̃. In the training phase, we refer to the pair (x(n), ω(n)) as a single training segment with K data samples. Training segments are extracted from the whole time series signals (x, ω) using non-overlappling windows which results in a training set whose inputs segments are and the corresponding activation segments Ω = ( ω(0), ω(K), ω(2K), . . . , ω((NK − 1) · K)) (4) where NK = ⌊N/K⌋ is number of training segments (with the ·(m) notation omitted for brevity). Assuming all segments (and the K outputs of each segment) are conditionally independent given the input vector x(n) and identically distributed (i.i.d), then the likelihood function becomes NK −1 K−1 p (Ω| X, θ) = Y Y n=0 p (ω(k + n · K) | x(n · K)) k=0 with ω being a Bernoulli distributed random variable NK −1 K−1 p (Ω| X, θ) = Y Y n=0 gk (x(n))ωk · (1 − gk (x(n)))1−ωk k=0 where gk (x(n)) is the k th output of the disaggregator. The negative log-likelihood -LL then becomes NK −1 K−1 -LL = − X X n=0 ωk · ln gk (x(n)) + (1 − ωk ) ln(1 − gk (x(n))) k=0 which is known as binary cross-entropy and it is the adopted loss function in all our experiments. The choice of a logistic sigmoid activation function in the output layer together with the binary cross-entropy as the objective function is a standard combination in binary classification problems [24]. Finally, the following decision rule is used to estimate the final class labels 3 ω̂(n) = ( 0 if p(ω(n) = 0 | x(n)) > p(ω(n) = 1 | x(n)) Aggregate signal x(n) 1 otherwise We point out that the concept of load activation cycles, a complete cycle of operation off → on→ off, is not considered. In other words, an activation cycle of a load can extend over several K-length segments (such as lighting circuits and dishwashers) or arise more than once within the same window segment (as in fridge and kettle activations). This is an important property since a disaggregator need not wait till the deactivation of a load (i.e. switch-off event) but rather can provide near real-time feedback from a partial segment of the activation, normally with some delay. + Encoder Sub-Net IV. M ODEL A RCHITECTURE Figure 1 shows the architecture of the proposed fully convolutional neural network model. The model consists of 46 layers in five parts (an input layer, 40 encoding and decoding layers, 4 representation layers, and an output layer) reaching 41M trainable parameters. Each layer includes a sequence of elementary operations shown in the figure and briefly introduced in the sequel. Dilated Convolutions CONV(d, k): The core operation of each layer is the cross-correlation defined as + + k=⌊k/2⌋ def CONV(d, k): f (x) = b(n)+ X + + x(n + d · k) · κ(k) where d is the dilation rate [25], k is the kernel size, b is the bias vector, and κ is the layer’s kernel. Batch Normalization BN [17]: is a composition of two affine transformations applied to the output of each layer based on mini-batch statistics def BN: f (x) = γ x̂ + β = γ Representation k=-⌊k/2⌋ x − µB +β σB + + 2 where x is the original output of a unit, µB and σB are the sample mean and variance of all outputs of this neuron over the mini-batch B, and γ and β are two learnable parameters. Leaky Rectified Linear Units LReLU [26]: is a non-linear activation function defined as + α≤1 Activation noise (noise injection) GN [27]: is a regularization technique applied during the training phase only and consists of injecting small additive Gaussian noise (with variance σ 2 ) to the output of the layer to avoid over-fitting def Decoder Sub-Net LReLU: f (x) = max(αx, x) + 2 GN: f (x) = x + z ∼ N(0, σ ) Sigmoidal activations LogSg: is a bounded activation function applied to the first hidden layer and the output layer of the model def LogSg: f (x) = (1 + exp(−x))−1 (5) Down- and up-sampling: take place only across blocks where down-sampling is performed using MaxPooling while up-sampling is applied using forward-filling. Parameter initialization and updates: model parameters are initialized from a zero-mean uniform distribution [28] and learned using a gradient-based stochastic optimization [29] with an update rule based on the ADAM Algorithm [30] with Nesterov momentum [31]. V. P ERFORMANCE M EASURES Early works on energy disaggregation tended to adopt the simple accuracy index in evaluating the performance of a + + 64x 10800 CONV(7, 1), BN, LogSg, GN 32x 10800 CONV(7, 3), LReLU, BN, GN 32x 10800 CONV(7, 3), LReLU, BN, GN 32x 10800 CONV(7, 3), LReLU, BN, GN 32x 10800 CONV(7, 3), LReLU, BN, GN 64x 3600 CONV(7, 3), LReLU, BN, GN 64x 3600 CONV(7, 3), LReLU, BN, GN 64x 3600 CONV(7, 3), LReLU, BN, GN 64x 3600 CONV(7, 3), LReLU, BN, GN 128x 1200 CONV(7, 3), LReLU, BN, GN 128x 1200 CONV(7, 3), LReLU, BN, GN 128x 1200 CONV(7, 3), LReLU, BN, GN 128x 1200 CONV(7, 3), LReLU, BN, GN 256x 400 CONV(7, 3), LReLU, BN, GN 256x 400 CONV(7, 3), LReLU, BN, GN 256x 400 CONV(7, 3), LReLU, BN, GN 256x 400 CONV(7, 3), LReLU, BN, GN 512x 80 CONV(7, 3), LReLU, BN, GN 512x 80 CONV(7, 3), LReLU, BN, GN 512x 80 CONV(7, 3), LReLU, BN, GN 512x 80 CONV(7, 3), LReLU, BN, GN 1024x 16 CONV(7, 3), LReLU, BN, GN 1024x 16 CONV(7, 3), LReLU, BN, GN 1024x 16 CONV(7, 3), LReLU, BN, GN 1024x 16 CONV(7, 3), LReLU, BN, GN 512x 80 CONV(7, 3), LReLU, BN, GN 512x 80 CONV(7, 3), LReLU, BN, GN 512x 80 CONV(7, 3), LReLU, BN, GN 512x 80 CONV(7, 3), LReLU, BN, GN 256x 400 CONV(7, 3), LReLU, BN, GN 256x 400 CONV(7, 3), LReLU, BN, GN 256x 400 CONV(7, 3), LReLU, BN, GN 256x 400 CONV(7, 3), LReLU, BN, GN 128x 1200 CONV(7, 3), LReLU, BN, GN 128x 1200 CONV(7, 3), LReLU, BN, GN 128x 1200 CONV(7, 3), LReLU, BN, GN 128x 1200 CONV(7, 3), LReLU, BN, GN 64x 3600 CONV(7, 3), LReLU, BN, GN 64x 3600 CONV(7, 3), LReLU, BN, GN 64x 3600 CONV(7, 3), LReLU, BN, GN 64x 3600 CONV(7, 3), LReLU, BN, GN 32x 10800 CONV(7, 3), LReLU, BN, GN 32x 10800 CONV(7, 3), LReLU, BN, GN 32x 10800 CONV(7, 3), LReLU, BN, GN 32x 10800 CONV(7, 3), LReLU, BN, GN 1x 10800 /3 /3 /3 /5 /5 x5 x5 x3 x3 x3 CONV(7, 3), BN, LogSg Activation profile g(x(n)) Fig. 1: Architecture of the proposed energy monitoring model. Dashed and dotted lines to the right represent outer and inner skip connections, respectively. Solid lines to the left represent residual connections [16]. Skip connections use channel aggregation while residual connections use elementwise addition. Green-shaded layers are followed by a pooling step, while the red-yellow shaded ones are preceded by an un-pooling operation. 4 disaggregation system [32–34]. Later works, however, realized the misleading interpretation of this measure (resulting from its bias towards the prevailing class) and proposed precision, recall, and f1 -score as alternative measures for assessing the disaggregation performance [12, 21, 35, 36]. We, however, believe that these measures represent a onesided rigorous solution to the biasness of the accuracy index. In fact, these metrics are fused to the assumption of scarce load usage and fail to provide valuable interpretation of performance if this assumption is violated. Given the raw-count contingency table Classes Predictions ω̂ + ω̂ ω+ TP FN RP - FP TN RN PP PN N ω TP: TN: FP: FN: RP: RN: PP: PN: N: True Positives True Negatives False Positive False Negatives Real Positives Real Negatives Positive Predictions Negative Predictions Num. of samples/events FR LC DW WM SP TV BL KT MC TS KL rn %-NM TPA TPR B M f1 -s MCC 0.55 0.69 0.98 0.94 0.78 0.90 0.91 0.99 0.99 0.99 0.87 0.87 0.92 0.95 0.91 0.97 0.97 0.95 0.95 0.97 0.98 0.94 0.92 0.52 0.85 0.97 0.46 0.74 0.34 0.87 0.62 0.67 0.46 0.88 0.67 0.49 0.99 0.24 0.69 0.75 0.87 0.46 0.72 0.55 0.81 0.39 0.49 0.99 0.16 0.67 0.60 0.87 0.45 0.72 0.46 0.82 0.35 0.84 0.96 0.27 0.71 0.31 0.87 0.62 0.67 0.39 0.896 0.589 0.623 0.979 0.312 0.716 0.468 0.870 0.526 0.698 0.502 0.815 0.373 0.641 0.978 0.204 0.686 0.431 0.869 0.529 0.697 0.422 TABLE III: Performance comparison between the proposed model AE and the rectangles architecture in [4] Regr on same load instances (left) and unseen instances from new buildings (right). All values represent the f -measure. the aforementioned measure are defined as accuracy = (TP + TN) / (TP + TN + FP + FN) precision = TPA = TP / (TP + FP) recall = TPR = TP / (TP + FN) f1 -s = (2 x TP) / (2 x TP + FN + FP) TABLE II: Performance comparison of 11 loads from the first building in UK-DALE [7]. rn is the probability of the negative class in the evaluation fold and %-NM is the percent-noisy measure [12]. (6) (7) In the case of scarce load usage, the probability of negative samples becomes relatively high and the accuracy index becomes a single-sided measure, namely the true negative rate. In this case, a trivial disaggregator (one that always predicts the prevailing class) ambiguously yields near optimal accuracy. The information retrieval approach to alleviate this bias is to simply ignore the prevailing term in Eq. 6, namely TN, which results in either the Jaccard index or the f -measure f1 -s Eq. 7. We find this to be an extreme and ill-argued solution, especially in assessing energy monitoring performance. First, the scarce load usage is not always valid and is usually violated in commercial buildings or some residential loads such as refrigerators, air conditioners, space heaters, or electric vehicles. Additionally, the class of always-on loads suffers from the exact opposite situation where the class imbalance is due to the prevailing positive class and a trivial system in this case yields misleading near-optimal score for both the accuracy and the f -measure. Second, when the scarce usage assumption is valid (e.g. for various miscellaneous appliances such as kettles, irons, vacuum cleaners ... etc), the extent of class imbalance varies widely amongst loads as well as users. These variations are not reflected by any means in either of the information retrieval measures. For these reasons, we claimed that precision and recall are inflexible measures since they are fused to a onesided assumption regardless of the real distribution of classes. Powers [37] introduced informedness B, markedness M, and their geometric mean Matthews Correlation Coefficient MCC as alternative, unbiased evaluation measures B = TPR + TNR - 1 (8) M = TPA + TNA - 1 (9) √ (10) MCC = B · M where TNA = TN / (TN + FN) is the inverse-precision and TNR = TN / (TN + FP) is the inverse recall. Similar to the information retrieval measures, these alternatives were proposed and adopted in similar application domains such as medical diagnostics [38, 39] and recommender system evaluations [40]. We believe that the requirements of performance Load FR DW MC WM KT Same instances Accross buildings Regr. [4] AE Regr. [4] AE 0.810 0.720 0.620 0.490 0.710 0.879 0.796 0.705 0.960 0.783 0.820 0.740 0.210 0.270 0.700 0.927 0.804 0.366 0.410 0.819 evaluation in these applications are more similar to those in energy disaggregation. VI. E XPERIMENTS AND R ESULTS The developed model is evaluated on the freely available UK-DALE dataset [7], an energy dataset acquired from five residential buildings. In this work, the 1 Hz real power measurements represent the input signals to disaggregate while the reference ones are the 1/6 Hz measurements up-sampled (using fill-forward) to 1 Hz. Table II shows the performance measures of the proposed model evaluated on 11 loads from the first building in the adopted dataset with a 3-hour monitoring window for all load categories. Data folds are real power measurements from January and February of 2015 for training and validation, respectively, while the remaining 10 months of the 2015 represents the evaluation fold. While we provide these results as benchmarking ones, assessment of feasibility is observed in the following experiment. In Table III, we compare the monitoring performance of our model AE with the previous work in [4], specifically the regression-based model Regr. (referred to as rectangles architecture). We use the exact data folds adopted in [4] for training and evaluation and define two test cases. The first trains and evaluates on the same load instances but future periods of operation while the second evaluates on new load instances (from new buildings). In both cases, the proposed model outperformed previous works in all load categories. VII. C ONCLUSION AND FUTURE WORK In this paper, we assessed the feasibility of a generic deep disaggregation model for end-use load monitoring using a fully convolutional neural network evaluated on a variety of load categories. The proposed model (with a fixed architecture and set of hyper-parameters) outperforms previous work and showed relatively acceptable performance across different loads. 5 R EFERENCES [1] K. K. Kaman, M. Faramarzi, S. Ibrahim, and M. A. M. Yunus, “Artificial Neural Network for Non-Intrusive Electrical Energy Monitoring System”. Indonesian Journal of Electrical Engineering and Computer Science 6 (1):124–131, Apr. 2017. [2] L. Mauch and B. Yang, “A new approach for supervised power disaggregation by using a deep recurrent LSTM network”. In proceedings of the 3rd IEEE Global Conference on Signal and Information Processing (GlobalSIP):63–67, Dec. 2015. [3] ——, “A novel DNN-HMM-based approach for extracting single loads from aggregate power signals”. In proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP):2384–2388, Mar. 2016. [4] J. Kelly and W. J. Knottenbelt, “Neural NILM: Deep Neural Networks Applied to Energy Disaggregation”. CoRR abs/1507.06594 , Aug. 2015. [5] C. Zhang, M. Zhong, Z. Wang, N. Goddard, and C. Sutton, “Sequence-to-point learning with neural networks for nonintrusive load monitoring”. arXiv, Dec. 2016. [6] W. He and Y. Chai, “An Empirical Study on Energy Disaggregation via Deep Learning”. The 2016 2nd International Conference on Artificial Intelligence and Industrial Engineering (AIIE2016), Beijing, ChinaNov. 2016. [7] J. Kelly and W. J. Knottenbelt, “The UK-DALE dataset, domestic appliance-level electricity demand and whole-house demand from five UK homes”. Scientific Data, Feb. 2015. [8] O. Parson, G. Fisher, A. Hersey, N. Batra, J. Kelly, A. Singh, W. Knottenbelt, and A. Rogers, “”Dataport and NILMTK: A Building Data Set Designed for Non-intrusive Load Monitoring””. In proceedings of the 3rd IEEE Global Conference on Signal and Information Processing (GlobalSIP), Orlando, Florida, USADec. 2015. [9] S. Makonin, , “Real-Time Embedded Low-Frequency Load Disaggregation”. .” [10] S. Hochreiter and J. Schmidhuber, “Long short-term memory”. Neural Comput. 9 (8):1735–1780, Nov. 1997. [11] J. Z. Kolter and M. J. Johnson, “REDD: A public data set for energy disaggregation research”. proceedings of the SustKDD Workshop on Data Mining Applications in Sustainability, San Diego, CA, USAApr. 2011. [12] S. Makonin and F. Popowich, “Nonintrusive Load Monitoring (NILM) Performance Evaluation: A unified approach for accuracy reporting”. Energy Efficiency 8 (4):809–8142015 [13] P. Vincent, H. Larochelle, I. Lajoie, Y. Bengio, and P.A. Manzagol, “Stacked Denoising Autoencoders: Learning Useful Representations in a Deep Network with a Local Denoising Criterion”. Journal of Machine Learning Research 11 :3371–3408, Dec. 2010. [14] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich, “Going deeper with convolutions”. 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR):1–9, Jun. 2015. [15] P. Nascimento, , “Applications of Deep Learning Technologies on NILM”. , Brazil, , Apr. 2016. [16] K. He, X. Zhang, S. Ren, and J. Sun, “Deep Residual Learning for Image Recognition”. , Dec. 2015. [17] S. Ioffe and C. Szegedy, “Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift”. , Mar. 2015. [18] H. Lange and M. Bergés, “BOLT: Energy Disaggregation by Online Binary Matrix Factorization of Current Waveforms”. Proceedings of the 3rd ACM International Conference on Systems for Energy-Efficient Built Environmentsser. BuildSys ’16:11–20New York, NY, USA, 2016. [19] K. Anderson, A. Ocneanu, D. Benitez, D. Carlson, A. Rowe, and M. Berges, “BLUED: a fully labeled public dataset for Event-Based Non-Intrusive load monitoring research”. Proceedings of the 2nd KDD Workshop on Data Mining Applications in Sustainability (SustKDD), Beijing, ChinaAug. 2012. [20] M. Zeifman and K. Roth, “Viterbi algorithm with sparse transitions (VAST) for nonintrusive load monitoring”. 2011 IEEE Symposium on Computational Intelligence Applications In Smart Grid (CIASG):1–8, Apr. 2011. [21] H. Kim, M. Marwah, M. F. Arlitt, G. Lyon, and J. Han, “Unsupervised Disaggregation of Low Frequency Power Mea- [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] surements”. proceedings of the 11th International Conference on Data Mining:747–758. Arizona: SIAM, 2010. J. Z. Kolter, S. Batra, and A. Y. Ng, “Energy Disaggregation via Discriminative Sparse Coding”. Proceedings of the 23rd International Conference on Neural Information Processing Systemsser. NIPS’10:1153–1161USA, 2010. N. Batra, O. Parson, M. Berges, A. Singh, and A. Rogers, “A Comparison of Non-Intrusive Load Monitoring Methods for Commercial and Residential Buildings”. arXiv preprint, arXiv:1408.6595 C. M. BishopPattern Recognition and Machine Learning (Information Science and Statistics). Secaucus, NJ, USA: SpringerVerlag New York, Inc., 2006. F. Yu, V. Koltun, and T. Funkhouser, “Multi-scale Context Aggregation by Dilated Convolutions”. arXiv:1511.07122v3, Apr. 2016. A. L. Maas, A. Y. Hannun, and A. Y. Ng, “Rectifier nonlinearities improve neural network acoustic models”. Proceedings of the 30th International Conference on Machine LearningAtlanta, Georgia, USA, 2013. V. Nair and G. E. Hinton, “Rectified Linear Units Improve Restricted Boltzmann Machines”. Proceedings of the 27th International Conference on Machine Learning (ICML10)J. Fürnkranz and T. Joachims, Eds.:807–814, 2010. X. Glorot and Y. Bengio, “Understanding the difficulty of training deep feedforward neural networks”. proceedings of the 13th International Conference on Artificial Intelligence and Statisticsser. Proceedings of Machine Learning ResearchY. W. Teh and M. Titterington, Eds. 9:249–256, Chia Laguna Resort, Sardinia, Italy13–15 May 2010. L. Bottou, Stochastic Gradient Descent Tricks. Berlin, Heidelberg: Springer, 2012., pp. 421–436. D. P. Kingma and J. L. Ba, “Adam: A Method for Stochastic Optimization”. , Jan. 2017. T. Dozat, , “Incorporating Nesterov Momentum into Adam”. , Standford University, Tech. Rep. 54, , May 2015. H.-H. Chang, C.-L. Lin, and J.-K. Lee, “Load Identification in Nonintrusive Load Monitoring using Steady-state and Turnon Transient Energy Algorithms”. In proceedings of the 14th International Conference on Computer Supported Cooperative Work in Design:27–32, Apr. 2010. , “Belkin Energy Disaggregation Competition”. , https://www.kaggle.com/c/belkin-energy-disaggregation-competition, accessed: 2017.06.16. S. Makonin, F. Popowich, L. Bartram, B. Gill, and I. V. Bajic, “AMPds: A Public Dataset for Load Disaggregation and Eco-Feedback Research”. Electrical Power and Energy Conference (EPEC), 2013 IEEE:1–6, Aug. 2013. B. Christian, W. Kleiminger, R. Cicchetti, T. Staake, and S. Santini, “The ECO Data Set and the Performance of Non-Intrusive Load Monitoring Algorithms”. proceedings of the 1st ACM International Conference on Embedded Systems for EnergyEfficient Buildings (BuildSys):80–89, Memphis, TN, USANov. 2014. E. Holmegaard and M. B. Kjaergaard, “NILM in an Industrial Setting: A Load Characterization and Algorithm Evaluation”. 2016 IEEE International Conference on Smart Computing (SMARTCOMP):1–8, May 2016. D. M. W. Powers, “Evaluation: From precision, recall and Fmeasure to ROC, informedness, markedness, and correlation”. Journal of Machine Learning Technologies 2 :37–632011 W. J. Youden, “Index for Rating Diagnostic Tests”. Cancer Vol. 3 (1):32–351950 C. E. Metz, “Basic principles of ROC analysis”. Seminars in Nuclear Medicine 8 (4):283–2981978 G. Schröder, M. Thiele, and W. Lehner, “Setting Goals and Choosing Metrics for Recommender System Evaluations”. UCERSTI2 Workshop at the 5th ACM Conference on Recommender Systems 23Chicago, USA, 2011.
1cs.CV
THE HILBERT SERIES OF SL2 -INVARIANTS arXiv:1710.02606v2 [math.RA] 16 Jan 2018 PEDRO DE CARVALHO CAYRES PINTO, HANS-CHRISTIAN HERBIG, DANIEL HERDEN, AND CHRISTOPHER SEATON Abstract. Let V be a finite dimensional representations of the group SL2 of 2×2 matrices with complex coefficients and determinant one. Let R = C[V ]SL2 be the algebra of SL2 -invariant polynomials on V . We present a calculation P of the Hilbert series HilbR (t) = n≥0 dim(Rn ) tn as well as formulas for the first two coefficients of the Laurent expansion of HilbR (t) at t = 1. Contents 1. Introduction Acknowledgements 2. Background and Definitions 3. Computation of the Hilbert Series 3.1. The Multivariate Hilbert Series 3.2. Analytic Continuation and the Univariate Hilbert Series 4. The Coefficients of the Laurent Expansion 4.1. Discussion of Cases 4.2. The Exceptions 4.3. The First Coefficient 4.4. The Second Coefficient 5. The Coefficients of the Laurent Expansion in Terms of Schur polynomials 6. An Algorithm to Compute the Hilbert Series 6.1. Partial Fraction Decomposition 6.2. Description of the Algorithm References 1 3 3 4 4 5 6 6 7 8 9 10 14 15 16 18 1. Introduction Let V be a finite Lr dimensional representation of SL2 . It is well-known that V is isomorphic to a sum of irreducible representations k=1 Vdk . Here, Vdk stands for the (dk + 1)-dimensional irreducible representation of SL2 which is Lr given by binary forms of degree dk ∈ N. In the decomposition k=1 Vdk it is not assumed that the dk are pairwise distinct. The algebra of polynomial SL2 -invariants R := C[V ]SL2 is a finitely generated C-algebra and carries a natural N-grading R = ⊕n≥0 Rn . In fact it is generated by a complete system of homogeneous invariants which obey some homogeneous relations. For a more detailed discussion, the reader may consult [12, 28]. In this paper we study the Hilbert series HilbR (t) of R, i.e. the generating function that counts the dimensions of the homogeneous components Rn : HilbR (t) = ∞ X dim(Rn ) tn . n=0 It is a classical result that HilbR (t) is rational. The degree of HilbR (t), i.e. the difference of the degree of the numerator and the degree of the denominator, is referred to as the a-invariant a(R) of R, see [10, Definitions 3.6.13 and 4.4.4] and [15, Section 3]. The a-invariant of invariant rings has been studied for example in [11, 24, 25, 27]; note that some references use q to denote the negative a-invariant. 2010 Mathematics Subject Classification. Primary 13A50; Secondary 13H10, 05E05. Key words and phrases. Hilbert series, special linear group, a-invariant, Schur polynomial. C.S., D.H., and H.-C.H. were supported by a Collaborate@ICERM grant from the Institute for Computational and Experimental Research in Mathematics (ICERM). C.S. was supported by the E.C. Ellett Professorship in Mathematics and the Instituto de Matemática Pura e Aplicada (IMPA); H.-C.H. was supported by CNPq through the Plataforma Integrada Carlos Chagas. 1 2 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON It is well-known that HilbR (t) has a pole at t = 1 of order equal the Krull dimension dim R. We use the notation γm , m ≥ 0, to denote the coefficients in the Laurent expansion (1.1) HilbR (t) = ∞ X γm . dim R−m (1 − t) m=0 Some authors systematically use the notation γ or deg(R) for γ0 and τ or ψ(R) for γ1 . The coefficients γ0 and γ1 have clear interpretations in the case of invariants of a finite group, see [32, Lemma 2.4.4] as well as [8, Section 3.13] or [9], and their meaning in more general contexts has been investigated, e.g. in [27, Chapter 3] and [1]. For the case of invariants of SL2 , David Hilbert [19] published in 1893 a formula for γ0 in the case that V = Vd is irreducible for d ≥ 5: d−3 ⌊d/2⌋    X d d −1 −n . (1.2) γ0 = (3 − (−1)d ) d! n=0 n 2 Since then, computations of HilbR (t) and γ0 have been taken up by numerous authors, e.g. [2, 3, 4, 5, 6, 7, 21, 22, 26, 30]. The main result of this paper is Theorem 1.1, presenting formulas for γ0 and γ1 that generalize Hilbert’s formula in Equation (1.2) to encompass all finite-dimensional representation of SL2 up to a few low dimensional exceptions that can easily be computed directly. As a corollary, we reproduce the computation of the a-invariant given by F. Knop and P. Littelmann [25]. On the way, we produce formulas in Proposition 3.1 and Theorem 3.2 for the multivariate and univariate Hilbert series of C[V ]SL2 , respectively, that in particular indicate an algorithm for computing the Hilbert series. This algorithm is described in Section 6. It has been implemented using Mathematica [33] and is available from the authors by request. This paper is the third in a series that uses the methods described in [12, Section 4.6.1 and 4.6.4] to systematically compute Hilbert series of rings of invariants. The techniques were first laid out in [18], where the Hilbert series of algebras of regular functions on linear symplectic circle quotients were investigated. As explained in that reference, that computation is equivalent to the computation corresponding to the invariant ring of a cotangent-lifted representation of the circle, and the extension of these techniques to arbitrary circle representations was recently presented in [11]. The key observation is related to weights of the Cartan torus that occur with multiplicity in the representation, which in the case considered here occurs whenever V contains two irreducible representations Vdk whose dimensions have the same parity (and hence must occur whenever r > 2). Though these degeneracies impose difficulties in the computation of the Hilbert series, they can be circumvented by taking advantage of certain analytic continuations, viewing some instances of the integer weights as real parameters and perturbing them to avoid degeneracies. This in particular can be used to show that the bare expressions for the γm in terms of the weights have removable singularities along the diagonals. After removing these singularities, the resulting expressions can be expressed in terms of Schur polynomials, yielding succinct expressions for the first two γm , see Equation (1.3). In principle, this method can be used to deduce similar (but clumsier) formulas for the higher coefficients such as γ2 and γ3 ; see [11, Theorems 6.4 and 6.5]. The potential usefulness of our technique to representations of reductive Lie groups of higher rank is currently being explored, in particular for the case of a torus of dimension ℓ > 1. We briefly describe the notation required toL state Theorem 1.1, which is adopted and explained in more detail r throughout the rest of the paper. For V = k=1 Vdk , let D = dim V . Let Λ = {(k, i) ∈ Z × Z : 1 ≤ k ≤  r, ⌊dk /2⌋ + 1 ≤ i ≤ dk } with C := |Λ|, and for each (k, i) ∈ Λ, let ak,i := 2i − dk . Let a := a(k,i) : (k, i) ∈ Λ , and let σV = 2 if each dk is even and 1 otherwise. Finally, for an integer partition ρ = (ρ1 , . . . , ρn ) ∈ Zn with ρ1 ≥ ρ2 ≥ · · · ρn ≥ 0, let sρ (a) denote the corresponding Schur polynomial in the variables ak,i ordered lexicographically in (k, i) ∈ Λ (details can be found at the beginning of Section 5). We then have the following. Lr Theorem 1.1. Let V = k=1 Vdk be an SL2 -representation with V SL2 = {0}, and assume V is not isomorphic to 2V1 , nor Vd for d ≤ 4. The degree 3 − D coefficient γ0 of the Laurent series of HilbV (t) is given by (1.3) γ0 = σV sC−3,C−3,C−3,C−4,...,1,0 (a) . sC−1,C−2,...,1,0 (a) The degree 4 − D coefficient γ1 of the Laurent series is given by 3γ0 /2. Hence the a-invariant −(D − 3) − 2γ1 /γ0 of C[V ]SL2 is equal to −D. After briefly discussing the relevant background in Section 2, we turn to the computation of the Hilbert series in Section 3. We first compute an expression for the multivariate Hilbert series, which in this case has no degeneracies, in Section 3.1, and then demonstrate in Section 3.2 the analytic continuation used to state the univariate Hilbert THE HILBERT SERIES OF SL2 -INVARIANTS 3 series. We then turn to the computation of the Laurent coefficients γ0 and γ1 . The naive formulas for these, which only apply in the cases without degeneracies, are computed in Section 4; the removal of the singularities using Schur polynomials is explained in Section 5. The proof of Theorem 1.1 is given in Section 5 as Theorems 5.4 and 5.5. The computation of the a-invariant is an immediate corollary. Specifically, note that C[V ]SL2 is Gorenstein by [20, Corollary 1.9], implying that −2γ1 /γ0 = a(C[V ]SL2 ) + dim(C[V ]SL2 ), see [28, Equation (3.32)]. All representations satisfying the hypotheses of Theorem 1.1 are 1-large by [17, Theorem 3.4] and hence dim(C[V ]SL2 ) = D − 3, see [29, Remark 9.2(3)]. This computation of the a-invariant agrees with that given in [25, Satz 1]. Acknowledgements We would like to thank Gerald Schwarz for bringing to our attention the work of Friedrich Knop on the ainvariant of invariant rings. Furthermore, we would like to thank Leonid Bedratyuk for pointing out references related to this project. Herbig, Herden, and Seaton express appreciation to the Institute for Computational and Experimental Research in Mathematics (ICERM), Herbig and Seaton express appreciation to Baylor University, and Herden and Seaton express appreciation to the Instituto de Matemática Pura e Aplicada (IMPA) for hospitality during the work contained in this manuscript. 2. Background and Definitions Let Vd denote the irreducible representation of SL2 of dimension d + 1 on binary forms of degree d. Let V be an arbitrary SL2 -representation such that V SL2 = {0}, and then V is of the form V = r M Vdk k=1 where each dk ≥ 1. Note that the dk need not be distinct, but throughout this paper, we will assume for convenience that they are ordered non-decreasingly, i.e. dk ≤ dk+1 . Let D denote the dimension of V , which is given by D := dim V = r + r X dk . k=1 Let C[V ]SL2 denote the algebra of SL2 -invariant polynomial functions on V with its usual N-grading by degree, and let HilbV (t) = Hilb(d1 ,...,dr ) (t) denote the univariate Hilbert series of C[V ]SL2 . In Section 3.1, we will also Lr consider C[V ]SL2 with the Nr -grading inherited from the decomposition V = k=1 Vdk . That is, a monomial of degree (p1 , . . . , pr ) is the product of monomials on Vdk , each of degree pk . We use HilbrV (t1 , . . . , tr ) = Hilbr(d1 ,...,dr ) (t1 , . . . , tr ) to denote the corresponding r-variate Hilbert series. Using the Molien-Weyl formula [12, Section 4.6.1] and Weyl’s Integration formula [14, Equation (26.19)], the Hilbert series of C[V ]SL2 can be expressed as an integral over the Cartan torus of SL2 . It will be helpful to define the constants ak,i := 2i − dk for k = 1, . . . , r and 0 ≤ i ≤ dk , and then the Hilbert series is given by the integral Z Z (1 − z 2 ) dz (1 − z 2 ) dz 1 1 √ √ (2.1) HilbV (t) = = . dk dk r Q r Q Q Q 2π −1 2π −1 −a d −2i k,i k 1 1 (1 − tz ) (1 − tz ) S z S z k=1 i=0 k=1 i=0 We will often use ck to denote a real parameter that is near dk , in the sense that we will consider the limit as the ck → dk . Similarly, we will use bk,i to denote a real parameter near ak,i . For the case of the multivariate Hilbert series HilbrV (t1 , . . . , tr ), a simple modification to the proof of the MolienWeyl formula yields Z (1 − z 2 ) dz 1 . (2.2) HilbrV (t1 , . . . , tr ) = √ dk r Q Q 2π −1 −a k,i (1 − tk z ) S1 z k=1 i=0 See [31, Equation (13)], where this extension is given for the case of finite groups, as well as [13, Section IV], where it is described for the special bigraded case of a real representation, where the bigrading considers the holomorphic and anti-holomorphic parts separately. It will be convenient for us to use a few different methods to index the factors in the denominator of the integral in Equation (2.1). First, let us define Θ := {(k, i) ∈ Z × Z : 1 ≤ k ≤ r, 0 ≤ i ≤ dk }, 4 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON and then the integral in Equation (2.1) can be expressed as Z 1 (1 − z 2 ) dz Q √ (2.3) . (1 − tz −ak,i ) z 2π −1 S1 (k,i)∈Θ Note that Θ has D elements. We will sometimes wish to take advantage of the grouping of the nonzero ak,i into positive and negative pairs. Hence, define Λ to be the subset of Θ consisting of pairs (k, i) such that ak,i > 0, i.e. Λ = {(k, i) ∈ Z × Z : 1 ≤ k ≤ r, ⌊dk /2⌋ + 1 ≤ i ≤ dk }. Let C denote the cardinality of Λ, C := r X i=1 ⌈dk /2⌉, and let e denote the number of ak,i = 0, corresponding to the number of k such that dk is even. Then we can express Equation (2.3) as Z 1 (1 − z 2 ) dz Q √ (2.4) . (1 − tz −ak,i )(1 − tz ak,i ) z(1 − t)e 2π −1 S1 (k,i)∈Λ 3. Computation of the Hilbert Series 3.1. The Multivariate Hilbert Series. We first consider the computation of the multivariate Hilbert series and prove the following; compare [6]. L Proposition 3.1. Let V = rk=1 Vdk be an SL2 -representation with V SL2 = {0}. The Nr -graded Hilbert series HilbrV (t1 , . . . , tr ) is given by 2/aK,I X (3.1) X (K,I)∈Λ ζ aK,I =1 aK,I (1 − t2K ) Q dk ∈2Z (1 − tk ) Q 1 − ζ 2 tK (k,i)∈Λ (k,i)6=(K,I) −ak,i /aK,I (1 − ζ −ak,i tk tK a )(1 − ζ ak,i tk tKk,i /aK,I ) . Proof. Using Equation (2.2), with the factors in the denominator indexed as in Equation (2.4), we have Z 1 (1 − z 2 ) dz Q Q √ Hilbr(d1 ,...,dr ) (t1 , . . . , tr ) = (1 − tk ) (1 − tk z −ak,i )(1 − tk z ak,i ) z 2π −1 S1 = 1 √ 2π −1 Z dk ∈2Z (k,i)∈Λ P −1+ (k,i)∈Λ ak,i 2 Q (1 − z )z dz Q . a k,i (1 − tk ) (z − tk )(1 − tk z ak,i ) S1 dk ∈2Z (k,i)∈Λ Assume that each |tk | < 1 for each k. Then the poles in z inside the unit disk occur at points such that z ak,i = tk , 1/a 1/a i.e. points of the form z = ζtk k,i where ζ is an ak,i th root of unity and the tk k,i are defined using a suitably chosen, fixed value of the logarithm. We assume that these poles are distinct, which is true for a generic choice of the tk . Fix a (K, I) ∈ Λ and an aK,I th root of unity ζ0 , and then we express z Q dk ∈2Z = = (1 − tk ) (z aK,I Q (1 − z 2 ) (1 − tk z −ak,i )(1 − tk z ak,i ) (k,i)∈Λ − tK )(1 − tK z aK,I ) z aK,I −1 (1 − z 2 ) Q Q (1 − tk ) dk ∈2Z 1/aK,I (1 − tK z aK,I )(z − ζ0 tK ) Q (k,i)∈Λ (k,i)6=(K,I) (1 − tk z −ak,i )(1 − tk z ak,i ) z aK,I −1 (1 − z 2 ) Q 1/a (1 − tk ) (z − ζtK K,I ) ζ aK,I =1 ζ6=ζ0 dk ∈2Z Q (k,i)∈Λ (k,i)6=(K,I) (1 − tk z −ak,i )(1 − tk z ak,i ) . THE HILBERT SERIES OF SL2 -INVARIANTS 1/aK,I Hence, we have a simple pole at z = τ := ζ0 tK (1 − tK τ aK,I ) Q ζ aK,I =1 ζ6=ζ0 = (1 − t2K )τ aK,I −1 , and the residue at z = τ is given by τ aK,I −1 (1 − τ 2 ) Q Q 1/a (1 − tk ) (τ − ζtK K,I ) dk ∈2Z Q (k,i)∈Λ (k,i)6=(K,I) τ aK,I −1 (1 − τ 2 ) Q Q (1 − tk ) (1 − ζ) ζ aK,I =1 ζ6=1 5 dk ∈2Z (k,i)∈Λ (k,i)6=(K,I) (1 − tk τ −ak,i )(1 − tk τ ak,i ) (1 − tk τ −ak,i )(1 − tk τ ak,i ) 2/aK,I = aK,I (1 − t2K ) Q (1 − tk ) dk ∈2Z Q 1 − ζ02 tK −ak,i (k,i)∈Λ (k,i)6=(K,I) (1 − ζ0 −ak,i /aK,I tk tK a a )(1 − ζ0 k,i tk tKk,i /aK,I ) . Summing over each choice of (K, I) and ζ0 completes the proof.  3.2. Analytic Continuation and the Univariate Hilbert Series. By the definition of the multivariate Hilbert series, it is clear that HilbrV (∆t ) = HilbV (t), where ∆t := (t, . . . , t) ∈ Cr . However, the expression for HilbrV (t1 , . . . , tr ) given by Proposition 3.1 is not defined after this substitution unless r = 1 or 2 and, when r = 2, one element of {d1 , d2 } is even and the other is odd. One checks that in all other cases, factors of the form (1 − tk t−1 K ) appear in the denominator, e.g. when dk and dK have the same parity so that for some choice of i and I, ak,i = aK,I and ζ −ak,i = ζ −aK,I = 1. While it is again clear from the definitions that lim(t1 ,...,tr )→∆t HilbrV (t1 , . . . , tr ) = HilbV (t), we demonstrate explicitly in this section that the corresponding singularities in Equation (3.1) are removable, yielding an expression for the univariate Hilbert series that is sufficiently explicit to compute the Laurent coefficients. Note that Equation (3.1) has singularities at tk = tK = t in the open unit disk only where ζ −ak,i t(aK,I −ak,i )/aK,I = 1, which only occur in factors where aK,I = ak,i . The argument in this section is similar to that of [18, Section 3.3] and [11, Theorem 3.3], the point here being that the same techniques extend to the case of G = SL2 with very little modification. To simplify the argument, we re-index as follows. Let a be a positive value of ai,j that occurs with multiplicity, set Λa := {(k, i) ∈ Λ : ak,i 6= a}, and let N be the cardinality of Λa . We consider the integral Z 1 (1 − z 2 ) dz √ , N Q Q 2π −1 −a a −a a e k,i k,i 1 (1 − xj z )(1 − xj z ) (1 − xk,i z )(1 − xk,i z ) S z(1 − t) j=1 (k,i)∈Λa where the xj and xk,i are assumed distinct of modulus less than 1 and contained in a fixed branch of the logarithm. Because the integrand is defined and continuous and hence bounded for the xj and xk,i sufficiently close to t, an application of the Dominated Convergence theorem demonstrates that the limit of this integral as the xj → t and xk,i → t, provided it exists, is equal to HilbV (t). 1/a At a pole of the form z = ζxJ where ζ is an ath root of unity, a computation identical to that in Proposition 3.1 yields that the residue is given by 2/a 1 − ζ 2 xJ . N Q Q −ak,i /a ak,i /a −1 2 −a a e k,i k,i (1 − ζ xk,i xJ )(1 − ζ xk,i xJ ) (1 − xj xJ )(1 − xj xJ ) a(1 − t) (1 − xJ ) j=1 j6=J (k,i)∈Λa Rewrite 2/a −1 xN (1 − ζ 2 xJ ) J , N Q Q −ak,i /a ak,i /a 2 −a a e k,i k,i (x − x )(1 − x x ) (1 − ζ x x )(1 − ζ x x ) a(1 − t) (1 − xJ ) J j j J k,i J k,i J j=1 j6=J (k,i)∈Λa 6 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON 1/a where J ranges from 1 to N and ζ remains fixed, i.e. and consider the sum of the residues at z = ζxJ N X 2/a −1 xN (1 − ζ 2 xJ ) J N Q Q −a /a a /a J=1 a(1 − t)e (1 − x2 ) (xJ − xj )(1 − xj xJ ) (1 − ζ −ak,i xk,i xJ k,i )(1 − ζ ak,i xk,i xJk,i ) J j=1 j6=J N P (k,i)∈Λa 2/a −1 (−1)J−1 xN (1 − ζ 2 xJ ) J J=1 = a(1 − t)e N Q p=1 (1 − x2p ) Q 1≤p<q≤N N Q p=1 p6=J (1 − x2p ) (xp − xq )(1 − xp xq ) Q (k,i)∈Λa Q 1≤p<q≤N p,q6=J (1 − (xp − xq )(1 − xp xq ) −a /a ζ −ak,i xk,i xJ k,i )(1 . − a /a ζ ak,i xk,i xJk,i ) The numerator is easily seen to be alternating in the xJ , implying that it is divisible by the Vandermonde deterQ minant 1≤p<q≤N (xp − xq ) in the denominator. That is, for each fixed ζ, the sum of residues at poles of the form 1/a z = ζxJ has removable singularities in the xJ at points where each xJ = t. Applying this argument to each value of ak,i that occurs in Λ with multiplicity, it follows that the limit of Equation (3.1) as each tj → t exists. Finally, by a series of simple substitutions identical to those used in [18, pages 52–53] and [11, proof of Theorem 3.3], we have the following.  Lr Theorem 3.2. Let V = k=1 Vdk be an SL2 -representation with V SL2 = {0}. Let a := ak,i : (k, i) ∈ Λ , and let b := bk,i : (k, i) ∈ Λ where the bk,i are real parameters. The N-graded Hilbert series HilbV (t) is given by (3.2) lim b→a X X (K,I)∈Λ ζ aK,I =1 bK,I (1 − t2 )(1 − t)e Q (k,i)∈Λ (k,i)6=(K,I) 1 − ζ 2 t2/bK,I . (1 − ζ −ak,i t(bK,I −bk,i )/bK,I )(1 − ζ ak,i t(bK,I +bk,i )/bK,I ) 4. The Coefficients of the Laurent Expansion In this section, we compute the first two coefficients of the Laurent expansion at t = 1 of the expression given in Equation (3.2). We will see in Section 5 that, after taking the limit b → a, these coefficients correspond to the first and second Laurent coefficients γ0 and γ1 of HilbV (t), see Equation (1.1). Throughout this section, it will be convenient to index the factors of the integral as in Equation (2.3). Hence, for (K, I) ∈ Λ and ζ an aK,I th root of unity, we define (4.1) HV,K,I,ζ (b, t) := 1 − ζ 2 t2/bK,I (1 − ζ −ak,i t(bK,I −bk,i )/bK,I ) Q bK,I (k,i)∈Θ (k,i)6=(K,I) so that by Theorem 3.2, (4.2) HilbV (t) = lim b→a X X HV,K,I,ζ (b, t). (K,I)∈Λ ζ aK,I =1 Our method will be to consider the Laurent expansions of each of the terms HV,K,I,ζ (b, t) separately. 4.1. Discussion of Cases. Assume V is 1-large, which is true unless V is isomorphic to V1 , 2V1 , or V2 by [17, Theorem 3.4]; we refer the reader to this reference for the definition of 1-large. Then C[V ]SL2 has Krull dimension D − 3, see [29, Remark 9.2(3)]. Hence, the first nontrivial Laurent coefficient occurs in degree 3 − D. Now, any term of the form HV,K,I,1 (b, t) for (K, I) ∈ Λ is of the form (4.3) HV,K,I,1 (b, t) = bK,I Q 1 − t2/bK,I ; (1 − t(bK,I −bk,i )/bK,I ) (k,i)∈Θ (k,i)6=(K,I) Each such term has a pole of order |Θ| − 2 = D − 2 at t = 1. If each dk is even, then each ak,i is even, and then for each (K, I) ∈ Λ, we have HV,K,I,1 (b, t) = HV,K,I,−1 (b, t). To simplify notation, we define ( 1, if any dk is odd, (4.4) σV := 2, if all dk are even. THE HILBERT SERIES OF SL2 -INVARIANTS 7 If d1 = 1 and all other dk are even, then for K > 1 and any I, (4.5) HV,K,I,−1 (b, t) = bK,I (1 + t(bK,I −b1,0 )/bK,I )(1 + 1 − t2/bK,I t(bK,I −b1,1 )/bK,I ) Q (k,i)∈Θ (k,i)6=(K,I) k6=1 (1 − t(bK,I −bk,i )/bK,I ) , which has a pole of order D − 4. In particular, in Equation (4.2) any term of the form HV,K,I,−1 would have a pole of order D − 4. In any other case, i.e. if two or more dk are odd or one dk > 1 is odd, then for all K the term HV,K,I,−1 (b, t) has a pole of order at most D − 5, and any HV,K,I,−1 appearing in Equation (4.2) has a pole of order at most D − 6. Now, if ζ 6= ±1 is an aK,I = (2I − dK )th root of unity, then it must be that |aK,I | ≥ 3, and hence dK ≥ 3. The numerator 1 − ζ 2 t2/bK,I of HV,K,I,ζ (b, t) no longer has a zero at t = 1. For each odd dk , we have ak,(dk ±1)/2 = ±1, while for each even dk , we have ak,(dk /2)±1 = ±2, and ζ ±1 , ζ ±2 6= 1. Hence, if r ≥ 2, then in Equation (4.2) each such term has a pole of order at most D − 5. If r = 1 and d1 = 3 or 4, i.e. V ∼ = V4 , then some terms = V3 or V ∼ HV,K,I,ζ (b, t) in Equation (4.2) corresponding to such a ζ may have pole order D − 3. If r = 1 and d1 ≥ 5, it is easy to see that at least four of the ak,i satisfy ζ ak,i 6= 1 so that the pole order of such a term is at most D − 5. Hence, in the computation of γ0 , the coefficient of the Laurent series at t = 1 of degree − dim C[V ]SL2 , and γ1 , the coefficient of degree 1 − dim C[V ]SL2 , we must consider V1 , 2V1 , V2 , V3 , and V4 separately. In all other cases, only terms corresponding to ζ = ±1 contribute to γ0 ; terms with ζ = −1 contribute to γ0 only if each dk is even, in which case they are identical to the corresponding terms with ζ = 1 and hence contribute to γ0 and γ1 in the same way. If there are at least two odd dk or one odd dk > 1, then only terms corresponding to ζ = 1 contribute to γ1 . If d1 = 1 and all other dk are even, then terms with ζ = −1 contribute to γ1 separately. It is of interest to note that the Laurent series of HV,K,I,1 (b, t) has a term of degree 2 − D with coefficient D−3 2bK,I Q (k,i)∈Θ (k,i)6=(K,I) (bK,I − bk,i ) . Hence, by the above observations, we have the following. Lr Corollary 4.1. Let V = k=1 Vdk be an SL2 -representation with V SL2 = {0}, and assume that V is not isomorphic to V1 , 2V1 , nor V2 . Then (4.6) lim b→a X (K,I)∈Λ D−3 2bK,I Q (k,i)∈Θ (k,i)6=(K,I) (bK,I − bk,i ) = 0. Note that the quantity on the left side of Equation (4.6) is equal to 1 when V ∼ = V1 , equal to −1/4 when V ∼ = V2 , 2V . and equal to −1 when V ∼ = 1 4.2. The Exceptions. For the sake of completeness, we give the Hilbert series and Laurent coefficients corresponding to the representations V1 , 2V1 , V2 , V3 , and V4 , to which the results in this section do not apply. The Hilbert series for these cases are known and can easily be computed directly using the above methods; similarly, generating invariants are classical and can easily be computed, e.g. using the algorithms described in [5] and [12, Sections 4.1–2]. V1 : For the representation V1 , only the constants are invariant. Therefore, HilbV1 (t) = 1, γ0 = 1, γ1 = 0, D = 2, and a(C[V ]SL2 ) = 2 − D = 0. V2 : For V2 , there is one quadratic invariant; in terms of the variables x0 , x1 , x2 given by coefficients of binary forms of degree 2, the generating invariant is x21 − 4x0 x2 . Hence, HilbV2 (t) = 1 , 1 − t2 γ0 = 1 , 2 γ1 = 1 , 4 D = 3, and a(C[V ]SL2 ) = 1 − D = −2. 2V1 : In the case of 2V1 , using coordinates (x0 , x1 ) for the first V1 and (x2 , x3 ) for the second, both with respect to the canonical representation of SL2 , there is again a single quadratic invariant x1 x2 − x0 x3 . We again have 1 1 1 Hilb2V1 (t) = , γ0 = , γ1 = , D = 4, and a(C[V ]SL2 ) = 2 − D = −2. 2 1−t 2 4 8 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON V3 : For the case of V3 , there is one quartic invariant; in terms of the variables x0 , x1 , x2 , x3 given by coefficients of binary forms of degree 3, the generating invariant is x21 x22 − 4x0 x32 − 4x31 x3 + 18x0 x1 x2 x3 − 27x20 x23 . Therefore, 1 3 1 , γ0 = , γ1 = , D = 4, and a(C[V ]SL2 ) = −D = −4. HilbV3 (t) = 1 − t4 4 8 V4 : Finally, for the case of V4 , there are two algebraically independent invariants. In the variables x0 , . . . , x4 as above, the generating invariants are x22 − 3x1 x3 + 12x0 x4 and 2x32 − 9x1 x2 x3 + 27x0 x23 + 27x21 x4 − 72x0 x2 x4 . Hence, 1 1 1 HilbV4 (t) = , γ0 = , γ1 = , D = 5, and a(C[V ]SL2 ) = −D = −5. (1 − t2 )(1 − t3 ) 6 4 4.3. First Coefficient. In this section, we compute the degree 3 − D coefficient of the Laurent series of P The P (K,I)∈Λ ζ aK,I =1 HV,K,I,ζ (b, t). In Section 5, we will use that γ0 is the limit of the expression computed here to as b → a. Lr V is not isomorphic Proposition 4.2. Let V = k=1 Vdk be an SL2 -representation with V SL2 = {0}, and assume   to 2V1 , nor Vd for d ≤ 4. Let a := ak,i : (k, i) ∈ Λ , and letP b := bk,iP: (k, i) ∈ Λ where the bk,i are real parameters. The degree 3 − D coefficient of the Laurent series of (K,I)∈Λ ζ aK,I =1 HV,K,I,ζ (b, t) is given by   D−3 P D−4 D−4 bK,I − 2bK,I − bK,I bκ,λ P bk,i 2bK,I − 2 − (κ,λ)∈Θ   X X   (k,i)∈Θ (κ,λ)6=(K,I) D−4   Q Q bK,I . (4.7) σV  = σV  (bK,I − bk,i ) (bK,I − bk,i )  (K,I)∈Λ (K,I)∈Λ  (k,i)∈Θ (k,i)6=(K,I) (k,i)∈Θ (k,i)6=(K,I) Proof. As explained in Section 4.1, the only terms that contribute to the degree 3 − D coefficient are of the form given in Equation (4.3) corresponding to HV,K,I,1 (b, t) in each case and HV,K,I,−1 (b, t) only if each dk is even, yielding the σV factor. The series expansion of the numerator 1 − t2/bK,I begins (4.8) 1 − t2/bK,I = 2 bK,I 2(b2K,I − 3bK,I + 2) bK,I − 2 2 (1 − t) + (1 − t)3 + · · · , b2K,I 3b3K,I (1 − t) + and each factor of the denominator has a series expansion beginning bk,i (2bK,I − bk,i )bk,i 1 bK,I (1 − t)−1 + (1 − t) + · · · . + (4.9) = bK,I − bk,i 2(bk,i − bK,I ) 12(bk,i − bK,I )bK,I 1 − t(bK,I −bk,i )/bK,I Hence, for fixed K and I, the term of degree 3 − D comes from the Cauchy product of these factors in two different ways. First, from the first term of the first (holomorphic) series, the first term in each of the Laurent series except for one value of (k, i) (say (κ, λ)), and the second term from the series corresponding to (k, i) = (κ, λ). Second, from the second term of the first (holomorphic) series and the first term in each of the Laurent series. The first of these combinations yields        D−4 Y   −bK,I bκ,λ 1 bK,I bκ,λ 2   Q , =   (bK,I − bk,i ) bK,I bK,I bK,I − bk,i 2(bκ,λ − bK,I ) (k,i)∈Θ (k,i)6=(K,I),(κ,λ) (k,i)∈Θ (k,i)6=(K,I) while the second yields  1 bK,I  bK,I − 2 b2K,I ! completing the proof. to     Y (k,i)∈Θ (k,i)6=(K,I)   bK,I = bK,I − bk,i  D−4 bD−3 − 2bK,I QK,I , (bK,I − bk,i ) (k,i)∈Θ (k,i)6=(K,I)  Note that if V = Vd is irreducible with d ≥ 5, setting each b1,i = 2i − d, the expression in Equation (4.7) reduces 2σV d X (2I − d)d−3 (2I − d − 1) . d Q I=⌊d/2⌋+1 (2I − 2i) i=0 i6=I THE HILBERT SERIES OF SL2 -INVARIANTS 9 A simple computation demonstrates that this is equal to the expression in Equation (1.2) given by Hilbert in [19]. 4.4. The Second Coefficient. We now turn to the computation of the second coefficient of the Laurent expansion of HV,K,I,ζ (b, t). Lr V is not isomorphic Proposition 4.3. Let V = k=1 Vdk be an SL2 -representation with V SL2 = {0}, and assume   to 2V1 nor Vk for k ≤ 4. Let a := ak,i : (k, i) ∈ Λ , and let b := bk,i : (k, i) ∈ Λ where the bk,i are real parameters. If all dk are even, P at least Ptwo dk are odd, or at least one odd dk > 1, then the degree 4 − D coefficient of the Laurent series of (K,I)∈Λ ζ aK,I =1 HV,K,I,ζ (b, t) is given by (4.10) σV X D−5 bK,I (K,I)∈Λ Q (k,i)∈Θ (k,i)6=(K,I)  2 2 (b − 3bK,I + 2) (bK,I − bk,i ) 3 K,I  bκ,λ  bκ,λ − 5bK,I + 6 + 3 6  X + (κ,λ)∈Θ (κ,λ)6=(K,I) X (κ′ ,λ′ )∈Θr {(K,I),(κ,λ)}    bκ′ ,λ′   . If d1 = 1 and all other dk are even, then the degree 4 − D coefficient of the Laurent series is given by X (K,I)∈Λ D−5 bK,I Q (k,i)∈Θ (k,i)6=(K,I) (4.11)  2 2 (b − 3bK,I + 2) (bK,I − bk,i ) 3 K,I X +  (κ,λ)∈Θ (κ,λ)6=(K,I) + X (K,I)∈Λ K6=1 bκ,λ  bκ,λ − 5bK,I + 6 + 3 6  D−7 bK,I Q 2 (k,i)∈Θ (k,i)6=(K,I) k6=1 bK,I − bk,i X  (κ′ ,λ′ )∈Θr {(K,I),(κ,λ)}   bκ′ ,λ′   . Proof. We first consider the case where at least two dk are odd or at least one dk > 1 is odd. Once again, it was explained in Section 4.1 that the only contributing terms are of the form given in Equation (4.3). To compute the degree 4 − D coefficient, we consider the factors of the term in Equation (4.3) and use the expansions given by Equations (4.8) and (4.9). A term of degree 4 − D can arise from the Cauchy product formula from these factors in one of four ways: (1) The degree 1 term from the numerator, the degree −1 term from each factor of the denominator except two, say (κ, λ), (κ′ , λ′ ) 6= (K, I), and the degree 0 term from the factors of the denominator corresponding to (κ, λ) and (κ′ , λ′ ); (2) The degree 1 term from the numerator, the degree −1 term from each factor of the denominator except one, say (κ, λ) 6= (K, I), and the degree 1 term from the of the denominator corresponding to (κ, λ); (3) The degree 2 term from the numerator, the degree −1 term from each factor of the denominator except one, say (κ, λ) 6= (K, I), and the degree 0 term from the factor of the denominator corresponding to (κ, λ); and (4) The degree 3 term from the numerator and the degree −1 term from each factor of the denominator. In the case of (1), we compute     Y  1 2   bK,I bK,I (k,i)∈Θr {(K,I),(κ,λ),(κ′ ,λ′ )}   bK,I  bK,I − bk,i   bκ,λ 2(bκ,λ − bK,I )  bκ′ ,λ′ 2(bκ′ ,λ′ − bK,I )  = 2 D−5 bK,I bκ,λ bκ′ ,λ′ Q . (bK,I − bk,i ) (k,i)∈Θ (k,i)6=(K,I) 10 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON In (2), we have  1 bK,I  2 bK,I       Y (k,i)∈Θr {(K,I),(κ,λ)}  bK,I  bK,I − bk,i   (2bK,I − bκ,λ )bκ,λ 12(bκ,λ − bK,I )bK,I  =  = D−5 −bK,I (2bK,I − bκ,λ )bκ,λ Q . 6 (bK,I − bk,i ) (k,i)∈Θ (k,i)6=(K,I) For (3),  1 bK,I  bK,I − 2 b2K,I !      Y (k,i)∈Θr {(K,I),(κ,λ)}  bK,I  bK,I − bk,i   bκ,λ 2(bκ,λ − bK,I ) D−5 −bK,I (bK,I − 2)bκ,λ Q , 2 (bK,I − bk,i ) (k,i)∈Θ (k,i)6=(K,I) and (4) yields  1 bK,I  2(b2K,I − 3bK,I + 2) 3b3K,I ! Y  (k,i)∈Θr{(K,I)}  2bD−5 (b2 − 3bK,I + 2) bK,I  = K,I Q K,I . bK,I − bk,i 3 (bK,I − bk,i ) (k,i)∈Θ (k,i)6=(K,I) Combining these and summing over (K, I) ∈ Λ completes the proof of Equation (4.10). We now assume d1 = 1 and each dk for k > 1 is even, and then σV = 1. The terms with ζ = 1 are identical to the previous case, while terms with K > 1 and ζ = −1 are of the form giving in Equation (4.5). The degree 4 − D coefficient of the Laurent series of such a latter term is given by    2 bK,I  1 4bK,I       Y (k,i)∈Θ (k,i)6=(K,I) k6=1   bK,I  = bK,I − bk,i  2  D−7 bK,I Q (k,i)∈Θ (k,i)6=(K,I) k6=1 bK,I − bk,i . Summing over all (K, I) with K > 1 yields Equation (4.11).  5. The Coefficients of the Laurent Expansion in Terms of Schur polynomials In this section, we use Propositions 4.2 and 4.3 to give explicit formulas for γ0 and γ1 in terms of Schur polynomials in the variables ak,i . First, let us briefly recall the definition of Schur polynomials for the convenience of the reader. Recall that if ρ = (ρ1 , . . . , ρn ) ∈ Zn is an integer partition, i.e. ρ1 ≥ ρ2 ≥ · · · ρn ≥ 0, then the alternant associated to ρ in the variables x = (x1 , . . . , xn ) is defined by ρ  Aρ (x) = det xi j . The alternant is an alternating polynomial in the xi and hence divisible by the Vandermonde determinant Y Aδ (x) = (xi − xj ), 1≤i<j≤n where δ = (n − 1, n − 2, . . . , 1, 0). The Schur polynomial associated to ρ in the variables xi is defined to be (5.1) sρ (x) := Aδ+ρ (x) . Aδ (x) Remark 5.1. For simplicity, we will sometimes refer to the Schur polynomial associated to ρ ∈ Zn that fail to be partitions in the sense that ρ1 < ρ2 . In these cases, we mean the polynomial (or Laurent polynomial if ρ1 < 0) defined in the same way by Equation (5.1). Note that the alternant Aδ+ρ (x) is still alternating so that sρ (x) is a symmetric (Laurent) polynomial; however, such a polynomial may be zero for nontrivial ρ. THE HILBERT SERIES OF SL2 -INVARIANTS 11 It is easy to see that the formulas for γ0 and γ1 can be broken down into linear combinations of sums of the form X X X bR bS bT′ ′ QK,I κ,λ κ ,λ ΦR,S,T (b) := (5.2) , (bK,I − bk,i ) ′ ′ (K,I)∈Λ (κ,λ)∈Θr (κ ,λ )∈Θr {(K,I)} {(K,I),(κ,λ)} X ΦR,S (b) := (5.3) X (K,I)∈Λ (κ,λ)∈Θr {(K,I)} (5.4) ΦR (b) := X (K,I)∈Λ Q (k,i)∈Θ (k,i)6=(K,I) S bR K,I bκ,λ , (bK,I − bk,i ) (k,i)∈Θ (k,i)6=(K,I) bR K,I , (bK,I − bk,i ) Q (k,i)∈Θ (k,i)6=(K,I) for integers R, S, and T , which may be equal to 0. Hence, we will first indicate how such sums can be expressed in terms of Schur polynomials. We give Θ the lexicographic ordering so that (k, i) ≤ (k ′ , i′ ) if k < k ′ or k = k ′ and i ≤ i′ . This gives a total ordering on Θ and hence Λ, and we use ι(k, i) to denote the position of (k, i) with respect to this ordering. That is, ι(k, i) = 1 for the first element of Λ, ι(k, i) = 2 for the second, etc. We define PS (bΘ ) to be the power sum of degree S in the variables bΘ = {bk,i : (k, i) ∈ Θ}, i.e. X bSk,i . PS (bΘ ) := (k,i)∈Θ Lr Lemma 5.2. Let V = k=1 Vdk be an SL2 -representation with V SL2 = {0}. Choose bk,i = 0 for each (k, i) ∈ Θ such that ak,i = 0, and assume bK,dK −I = −bK,I for each (K, I) ∈ Λ. For R, S, T ∈ Z, and ordering the variables bk,i as described above, we have 1  ΦR,S,T (b) = (5.5) PS (bΘ )PT (bΘ )sR−e−C,C−2,C−3,...,1,0 (b) − PT (bΘ )sR+S−e−C,C−2,C−3,...,1,0 (b) 2sδ (b)  − PS (bΘ )sR+T −e−C,C−2,C−3,...,1,0 (b) + sR+S+T −e−C,C−2,C−3,...,1,0 (b) , (5.6) (5.7) PS (bΘ )sR−e−C,C−2,C−3,...,1,0 (b) − sR+S−e−C,C−2,C−3,...,1,0 (b) , 2sδ (b) sR−e−C,C−2,C−3,...,1,0 (b) ΦR (b) = . 2sδ (b) ΦR,S (b) = and Note that aK,dK −I = −aK,I so that the required relation holds in the limit b → a. Depending on the values of R, S, T , and e, it may be that the partitions appearing in Equations (5.5), (5.6), and (5.7) are not non-increasing in the first two entries so that the Schur polynomials are non-standard in the sense described in Remark 5.1. Proof. Throughout the proof, we let PS and PT denote PS (bΘ ) and PT (bΘ ), respectively. We express P bSκ,λ bTκ′ ,λ′ bR K,I ΦR,S,T (b) = X (K,I)∈Λ = X (K,I)∈Λ = Q (k,i)∈ Θr{(K,I)} (bK,I − bk,i ) S T bR K,I (PS − bK,I )(PT − bK,I ) Q (bK,I − bk,i ) (k,i)∈ Θr{(K,I)} S T bR K,I (PS − bK,I )(PT − bK,I ) Q (bK,I − bk,i )(bK,I + bk,i ) − 0)e X 2bK,I (bK,I X bR−e−1 (PS − bSK,I )(PT − bTK,I ) K,I Q , (b2K,I − b2k,i ) 2 (K,I)∈Λ = (κ,λ),(κ′ ,λ′ )∈Θr{(K,I)} (κ,λ)6=(κ′ ,λ′ ) (K,I)∈Λ (k,i)∈ Λr{(K,I)} (k,i)∈ Λr{(K,I)} 12 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON where the fact that bK,dK −I = −bK,I implies that each factor bK,I − bk,dK −I = 2bK,I . Using the ordering of Θ described above, we can express X (K,I)∈Λ = bR−e−1 (PS − bSK,I )(PT − bTK,I ) K,I Q 2 (b2K,I − b2k,i ) (k,i)∈ Λr{(K,I)} X (−1)ι(K,I)−1 bR−e−1 (PS − bSK,I )(PT − bTK,I ) K,I Q Q 2 (b2k,i − b2K,I ) (b2K,I − b2k,i ) X (−1)ι(K,I)−1 bR−e−1 (PS − bSK,I )(PT − bTK,I ) K,I Q Q 2 (b2k,i − b2K,I ) (b2K,I − b2k,i ) (K,I)∈Λ = (k,i)∈Λ (k,i)<(K,I) (K,I)∈Λ (k,i)∈Λ (k,i)>(K,I) (k,i)∈Λ (k,i)<(K,I) (k,i)∈Λ (k,i)>(K,I) (−1)ι(K,I)−1 bR−e−1 (PS − bSK,I )(PT − bTK,I ) K,I = X P (k,i),(κ,λ)∈ Λr{(K,I)} (k,i)<(κ,λ) (b2k,i − b2κ,λ ) (b2k,i − b2κ,λ ) Q 2 (K,I)∈Λ Q (k,i),(κ,λ)∈Λ (k,i)<(κ,λ) −e −e (−1)ι(K,I)−1 (bR−e−1 PS PT − bR+S−e PT − bR+T PS + bR+S+T ) K,I K,I K,I K,I (K,I)∈Λ (5.8) = 2 (k,i),(κ,λ)∈ Λr{(K,I)} (k,i)<(κ,λ) (b2k,i − b2κ,λ ) Q Q (b2k,i − b2κ,λ ) . (k,i),(κ,λ)∈Λ (k,i)<(κ,λ) Expanding the numerator of this expression and factoring out the power sums, it can be written as a sum of similar expressions, which we consider simultaneously. Recall that C = |Λ|. For any integer M , we have P Q (−1)ι(K,I)−1 bM (b2k,i − b2κ,λ ) K,I (K,I)∈Λ (k,i),(κ,λ)∈Λr{(K,I)} (k,i)<(κ,λ) Q 2 (bk,i − b2κ,λ ) (k,i),(κ,λ)∈Λ (k,i)<(κ,λ) P (−1)ι(K,I)−1 bM K,I (K,I)∈Λ = Q (k,i),(κ,λ)∈Λ (k,i)<(κ,λ) = Q (k,i),(κ,λ)∈Λr{(K,I)} (k,i)<(κ,λ) (bk,i + bκ,λ )(bk,i − bκ,λ )   ρj +C−j det bk,i (k,i)∈Λ 1≤j≤C Q (k,i),(κ,λ)∈Λ (k,i)<(κ,λ) (b2k,i − b2κ,λ ) (bk,i + bκ,λ )(bk,i − bκ,λ ) ,   ρj +n−j where ρ = (M − C + 1, C − 2, C − 3, C − 4, . . . , 1, 0), and where the matrix bk,i is interpreted as indexing rows by (k, i) ∈ Λ (in terms of the order described above) and columns j = 1, . . . , C. To see this last step, notice that the numerator of the previous equation can be seen as the cofactor expansion of the determinant along the first row. Hence,   ρj +C−j det bk,i (k,i)∈Λ s (b) sρ (b) 1≤j≤C Q Q ρ . = = sδ (b) (bk,i + bκ,λ )(bk,i − bκ,λ ) (bk,i + bκ,λ ) (k,i),(κ,λ)∈Λ (k,i)<(κ,λ) (k,i),(κ,λ)∈Λ (k,i)<(κ,λ) Applying this observation for several values of M to Equation (5.8), we express ΦR,S,T (b) in the form given in Equation (5.5). THE HILBERT SERIES OF SL2 -INVARIANTS 13 The proofs of the remaining equations are identical but with one or both of the factors (PS −bSK,I ) and (PT −bTK,I ) removed.  Remark 5.3. Note that one may also consider the expressions in Equations (5.2), (5.3), and (5.7) as polynomials in the variables (bk,i : (k, i) ∈ Θ . The resulting expressions are partial Laurent-Schur polynomials as defined in [11, Section 5], where the two sets of variables correspond to the b(k,i) with (k, i) ∈ Λ and (k, i) ∈ / Λ. With this, we can now complete the computations of γ0 and γ1 and hence the proof of Theorem 1.1. We claim that as b → a, the expressions given by Propositions 4.2 and 4.3 tend to γ0 and γ1 , respectively. This can be seen by noting that the integrands in the definitions of the Laurent coefficients are continuous on the circle and hence can be bounded as b → a, so the Dominated Convergence Theorem allows one to exchange the limit with the integral. See [18, end of Section 5-2], where this argument is given in detail in a very similar case. We first consider γ0 . Lr Theorem 5.4. Let V = k=1 Vdk be an SL2 -representation with V SL2 = {0}, and assume V is not isomorphic  to 2V1 , nor Vd for d ≤ 4. Let a := a(k,i) : (k, i) ∈ Λ . The degree 3 − D coefficient γ0 of the Laurent series of HilbV (t) is given by (5.9) γ0 = σV sC−3,C−3,C−3,C−4,...,1,0 (a) . sC−1,C−2,...,1,0 (a) Note that if C = 2, e.g. if V = V1 ⊕V2 or V = 2V2 , then the partition (C−3, C−3, C−3, C−4, . . . , 1, 0) = (−1, −1) and hence corresponds to a Laurent-Schur polynomial; see Remark 5.1. In all other cases under consideration, the partition appearing in Equation (5.9) is a standard integer partition.  Proof. As in Theorem 3.2 and Section 4.3, we let b := b(k,i) : (k, i) ∈ Λ where the b(k,i) denote real parameters. Using Equations (5.6) and (5.7), we rewrite Equation (4.7) as   σV  σV ΦD−3 (b) − 2ΦD−4 (b) − ΦD−4,1 (b) = (5.10) sD−e−C−3,C−2,C−3,...,1,0 (b) 2sδ (b) − 2sD−e−C−4,C−2,C−3,...,1,0 (b) − P1 (bΘ )sD−e−C−4,C−2,C−3,...,1,0 (b)  + sD−e−C−3,C−2,C−3,...,1,0 (b) . Recall that sδ (b) = Y bk,i + bκ,λ , (k,i),(κ,λ)∈Λ (k,i)<(κ,λ) where the order < is that described before Lemma 5.2. As ak,i > 0 for each (k, i) ∈ Λ, sδ (a) 6= 0. Hence, the limit as b → a of the expression in Equation (5.10) is continuous at b = a. Moreover, as the elements of aΘ are either zero or come in positive and negative pairs, P1 (aΘ ) = 0. Noting that D − e − C is the number of negative elements of Θ, which is equal to C, the number of elements of Λ, yields  σV  γ0 = 2sC−3,C−2,C−3,...,1,0 (a) − 2sC−4,C−2,C−3,...,1,0 (a) . 2sδ (a) However, note that sC−3,C−2,C−3,...,1,0 (a) is defined in Equation (5.1) in terms of the alternant associated to δ + (C − 3, C − 2, C − 3, . . . , 1, 0) = (2C − 4, 2C − 4, 2C − 6, . . . , 2, 0). Provided C ≥ 2, which is true for all cases under consideration, the repetition of 2C − 4 implies that sC−3,C−2,C−3,...,1,0 (a) = 0. Now sC−4,C−2,C−3,...,1,0 (a) is defined in terms of the alternant associated to δ + (C − 4, C − 2, C − 3, . . . , 1, 0) = (2C − 5, 2C − 4, 2C − 6, . . . , 2, 0), which is not in standard form. Switching the first two entries, we have (2C − 4, 2C − 5, 2C − 6, . . . , 2, 0) = δ + (C − 3, C − 3, C − 3, C − 4, . . . , 1, 0). Hence, sC−4,C−2,C−3,...,1,0 (a) = −sC−3,C−3,C−3,C−4,...,1,0 (a), completing the proof.  We now turn to the computation of γ1 , which completes this section. Lr with V SL2 = {0}, and assume V is not isomorphic to Theorem 5.5. Let V = k=1 Vdk be an SL2 -representation   2V1 , nor Vd for d ≤ 4. Let a := a(k,i) : (k, i) ∈ Λ and a1 := a(k,i) : (k, i) ∈ Λ, k 6= 1 . Then (5.11) γ1 = 3γ0 3σV sC−3,C−3,C−3,C−4,...,1,0 (a) = . 2sC−1,C−2,...,1,0 (a) 2 14 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON  Proof. We continue to let b := b(k,i) : (k, i) ∈ Λ where the b(k,i) denote real parameters. We first assume all dk are even, at least two dk are odd, or at least one odd dk > 1. Using Equations (5.5), (5.6), and (5.7), and expressing the Schur polynomial sM,C−2,C−3,...,1,0 (b) as sM,...,0 (b) for brevity, Equation (4.10) is equal to h2 i 4 1 5 1 σV ΦD−3 (b) − 2ΦD−4 (b) + ΦD−5 (b) + ΦD−5,2 (b) − ΦD−4,1 (b) + ΦD−5,1 (b) + ΦD−5,1,1 (b) 3 3 6 6 2 σV h 2 4 = sD−e−C−3,...,0 (b) − 2sD−e−C−4,...,0 (b) + sD−e−C−5,...,0 (b) 2sδ (b) 3 3  5  1 + P2 (bΘ )sD−e−C−5,...,0 (b) − sD−e−C−3,...,0 (b) − P1 (bΘ )sD−e−C−4,...,0 (b) − sD−e−C−3,...,0 (b) 6 6  1 + P1 (bΘ )sD−e−C−5,...,0 (b) − sD−e−C−4,...,0 (b) + P1 (bΘ )2 sD−e−C−5,...,0 (b) 2 i − 2P1 (bΘ )sD−e−C−4,...,0 (b) + sD−e−C−3,...,0 (b) . Then using the fact that D − e − C = C noted in the proof of Theorem 5.4, this is equal to σV h 2 4 sC−3,...,0 (b) − 2sC−4,...,0 (b) + sC−5,...,0 (b) 2sδ (b) 3 3  5  1 + P2 (bΘ )sC−5,...,0 (b) − sC−3,...,0 (b) − P1 (bΘ )sC−4,...,0 (b) − sC−3,...,0 (b) 6 6  1 + P1 (bΘ )sC−5,...,0 (b) − sC−4,...,0 (b) + P1 (bΘ )2 sC−5,...,0 (b) − 2P1 (bΘ )sC−4,...,0 (b) 2 i + sC−3,...,0 (b) i   σV h 11sC−3,...,0 (b) − 11P1 (bΘ ) + 18 sC−4,...,0 (b) + P2 (bΘ ) + 3P1 (bΘ )2 + 6P1 (bΘ ) + 8 sC−5,...,0 (b) . = 12sδ (b) As in the proof of Theorem 5.4, sδ (a) 6= 0 so that this expression is continuous at b = a. Similarly, P1 (aΘ ) = 0, the non-standard Schur polynomial sC−3,...,0 (a) = 0, and sC−4,...,0 (a) = −sC−3,C−3,C−3,C−4,...,1,0 (a). The nonstandard Schur polynomial sC−5,...,0 (a) is defined in terms of the alternant δ + (C − 5, C − 2, C − 3, . . . , 1, 0) = (2C − 6, 2C − 4, 2C − 6, . . . , 2, 0) and hence vanishes. This completes the proof in this case. Now assume d1 = 1 and all other dk are even. We need only deal with the additional sum in Equation (4.11), X (5.12) D−7 bK,I (K,I)∈Λ K6=1 Q 2 (k,i)∈Θ (k,i)6=(K,I) k6=1 bK,I − bk,i .  Define Θ1 = {(k, i) ∈ Θ : k 6= 1}, Λ1 = {(k, i) ∈ Λ : k 6= 1}, and b1 := bk,i : (k, i) ∈ Λ1 ; then a1 := ak,i : (k, i) ∈  Lr Λ1 . Note that we can treat Θ1 and Λ1 as associated to the representation k=2 Vdk , which has dimension D − 2; the value of e is unchanged, and Λ1 has cardinality C − 1. Then we can rewrite Equation (5.12) as 1 2 X (K,I)∈Λ1 D−7 bK,I Q (k,i)∈Θ1 (k,i)6=(K,I) bK,I − bk,i = 1 ΦD−7 (b1 ). 2 Applying Equation (5.7) and recalling that D − e − C = C, this is equal to sC−6,C−3,C−4,...,1,0 (b1 ) . 4sδ (b1 ) We again note that sδ (a1 ) 6= 0 so that this function is continuous at b1 = a1 . The Schur polynomial associated to the non-standard partition (C −6, C −3, C −4, . . . , 1, 0) is defined by the alternant δC−1 +(C −6, C −3, C −4, . . . , 1, 0) = (2C − 8, 2C − 6, 2C − 8, . . . , 2, 0) and hence vanishes, completing the proof.  6. An Algorithm to Compute the Hilbert Series L In this section, we describe an algorithm to compute HilbV (t) for an arbitrary representation V = rk=1 Vdk of SL2 . This algorithm is similar to those given in [18, Section 4] and [11, Section 4] for circle actions. Note, however, that those algorithms consider only the generic cases with no degeneracies caused by repeated weights. In the case of SL2 -invariants, this hypothesis is very restrictive; as was explained in the introduction, it implies that r ≤ 2 and, when r = 2, the degrees d1 and d2 have opposite parities. Hence, we begin by presenting a partial fraction THE HILBERT SERIES OF SL2 -INVARIANTS 15 decomposition in Section 6.1 that allows us to extend to the general case. Note that this decomposition can be used to extend the algorithms of [11, 16] to the degenerate cases as well. 6.1. Partial Fraction Decomposition. The main partial fraction decomposition we consider is the following. Proposition 6.1. For t ∈ C, distinct values x1 , . . . , xn ∈ C, and positive integers m1 , . . . , mn , we have n m i −1 X X Gi,j (x1 , . . . , xn ) 1 , = m i (1 − txi ) (1 − txi )mi −j i=1 i=1 j=0 n Y (6.1) where j Gi,j (x1 , . . . , xn ) = 1 d j!(−xi )j dtj  n Y  k=1 k6=i  1   (1 − txk )mk . t= x1 i Proof. Consider f (t) := n Y i=1 1 (1 − txi )mi as a function of t. Clearly, a partial fraction decomposition f (t) = C(x1 , . . . , xn ) + n m i −1 X X Gi,j (x1 , . . . , xn ) i=1 j=0 (1 − txi )mi −j is possible. Observe that C(x1 , . . . , xn ) = limt→∞ f (t) = 0, so we need only evaluate the Gi,j (x1 , . . . , xn ). We have n Y k=1 k6=i 1 = (1 − txi )mi f (t) (1 − txk )mk = m i −1 X ℓ=0 (6.2) = j−1 X ℓ=0 (6.3) Gi,ℓ (x1 , . . . , xn )(1 − txi )ℓ + n mX k −1 X Gk,ℓ (x1 , . . . , xn )(1 − txi )mi k=1 ℓ=0 k6=i (1 − txk )mk −ℓ Gi,ℓ (x1 , . . . , xn )(1 − txi )ℓ + Gi,j (x1 , . . . , xn )(1 − txi )j + m i −1 X ℓ=j+1 Gi,ℓ (x1 , . . . , xn )(1 − txi )ℓ + n mX k −1 X Gk,ℓ (x1 , . . . , xn )(1 − txi )mi k=1 ℓ=0 k6=i (1 − txk )mk −ℓ . The first sum in (6.2) clearly has degree at most j − 1 as a polynomial in t, while, noting that j + 1 ≤ mi , the expression (6.3) evidently has a zero at t = 1/xi of multiplicity at least j + 1. Hence,   n j Y d  1  j  = j!(−xi ) Gi,j (x1 , . . . , xn )  dtj (1 − txk )mk k=1 k6=i j +  d   dtj m i −1 X ℓ=j+1  n mX k −1 mi X Gk,ℓ (x1 , . . . , xn )(1 − txi )  Gi,ℓ (x1 , . . . , xn )(1 − txi )ℓ + , (1 − txk )mk −ℓ k=1 ℓ=0 k6=i where t = 1/xi is a zero of the expression on the second line so that   n j Y d  1  = j!(−xi )j Gi,j (x1 , . . . , xn ).   dtj (1 − txk )mk k=1 k6=i t= x1 i We observe two interesting special cases, beginning with the case where each mi = 1.  16 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON Corollary 6.2. For t ∈ C and distinct x1 , . . . , xn ∈ C, we have n Y n X 1 = 1 − txi i=1 i=1 1 . n Q (1 − xk /xi ) (1 − txi ) k=1 k6=i Restricting to the case n = 2 yields the following pleasing formula that we have come to refer to as the Yin-Yang formula. Corollary 6.3. For t ∈ C, x, y ∈ C distinct, and positive integers α and β, we have   j+α−1 β−1 α−1 i+β−1 X X 1 (−y/x)i (−x/y)j 1 j i = + . (6.4) (1 − tx)α (1 − ty)β (1 − tx)α−i (1 − y/x)β+i j=0 (1 − ty)β−j (1 − x/y)α+j i=0 6.2. Description of the Algorithm. Let V be a reducible representation of SL2 . For simplicity we will assume that V has no trivial subrepresentations. The gist of the algorithm is formula (6.7) below. To describe the algorithm, it will be convenient to introduce a new notation for the decomposition of V into irreducible representations as follows. Decompose the representation into V = Veven ⊕ Vodd , where Veven consists of those representations whose irreducible components have even degree and Vodd consists of those representations whose irreducible components have odd degree. Let d1 > d2 > . . . > dr > 0 denote the (even) degrees of the irreducible components of Veven and e1 > e2 > . . . > es > 0 the (odd) degrees of the irreducible components of Vodd . Then we can write r M i Vdm , Veven = i i=1 where mi is the multiplicity of Vdi and Vodd = s M Venj j , j=1 where nj is the multiplicity of Vej . We now determine the weights of the Cartan torus P and their corresponding multiplicities. The even weights d1 − 2i for i = 0, 1, . . . , d1 occur with multiplicity µi := k: |d1 −2i|≤dk mk . Similarly, the odd weights that occur in P V are e1 − 2j for j = 0, 1, . . . , e1 and occur with multiplicity νj := ℓ: |e1 −2j|≤eℓ nℓ . With this notation we rewrite the Hilbert series in Equation (2.1) as follows: Z 1 (1 − z 2 ) dz √ HilbV (t) = . e1 d Q 2π −1 S1 Q1 ν e −2j d −2i µ j 1 1 i (1 − tz ) (1 − tz ) z j=0 i=0 We introduce variables x = (x0 , x1 , . . . , xd1 ) and y = (y0 , y1 , . . . , ye1 ) corresponding to the even and odd weights of the Cartan torus. Moreover, we introduce the function Φ(t, x, y) := 1 d1 Q (1 − txi )µi i=0 e1 Q (1 − tyj )νj j=0 and the exceptional set E of points z ∈ S1 such that z d1 , z d1 −2 , . . . , z −d1 , z e1 , z e1 −2 , . . . , z −e1 are not pairwise distinct. Noting that E ⊂ S1 is finite and defining g : C → Cd1 +e1 +2 , g(z) := (z d1 , z d1 −2 , . . . , z −d1 , z e1 , z e1 −2 , . . . , z −e1 ), we can write Z 1 dz (6.5) HilbV (t) = √ (1 − z 2 )Φ(t, g(z)) . z 1 2π −1 S \E At this point we make use of the results of Section 6.1. Namely, if x0 , x1 , . . . , xd1 , y0 , y1 , . . . , ye1 are pairwise distinct we use the partial fraction decomposition e1 νX d1 µX i −1 k −1 X X Gi,j (x, y) Hk,ℓ (x, y) + , Φ(t, x, y) = µi −j (1 − tx ) (1 − tyk )νk −ℓ i i=0 j=0 k=0 ℓ=0 THE HILBERT SERIES OF SL2 -INVARIANTS 17 where j Gi,j (x, y) = Hk,ℓ (x, y) = 1 d j j!(−xi ) dtj   e1 d1 Y Y   −µ (1 − tym )−νk   (1 − txl ) l , m=0 l=0 l6=i  t=1/xi  d1 e1 Y dℓ Y 1  −µl (1 − tym )−νk  (1 − tx )  l ℓ!(−yk )ℓ dtℓ m=0 l=0 m6=k . t=1/yk Substituting this into Equation (6.5) we find   Z e1 νX d1 µX i −1 k −1 X X 1 Gi,j (g(z)) Hk,ℓ (g(z))  dz . √ HilbV (t) = + (1 − z 2 )  d1 −2i )µi −j e1 −2k )νk −ℓ (1 − tz (1 − tz z 2π −1 S1 \E i=0 j=0 k=0 ℓ=0 Introducing Φi,j (z) := (1 − z 2 )Gi,j (g(z)) and Ψk,ℓ (z) := (1 − z 2 )Hk,ℓ (g(z)) and observing that the integrands have no singularities along E yields d1 µX e1 νX i −1 Z k −1 Z X X dz dz 1 1 Φi,j (z) Ψk,ℓ (z) (6.6) HilbV (t) = √ + √ . d1 −2i )µi −j z e1 −2k )νk −ℓ z (1 − tz (1 − tz 1 1 2π −1 i=0 j=0 S 2π −1 k=0 ℓ=0 S Now, for a non-negative P integer a, recall [30], [18, Section 4] the operation Ua : Q[[z]] → Q[[t]] that assigns to a ∞ formal power series F (z) = i=0 Fi z i the series (Ua F )(t) := ∞ X i=0 Fia ti ∈ Q[[t]]. By [18, Lemma 4.1], if F (t) is the power series of a rational function, then (Ua F )(t) is as well. Similarly, if a 6= 0 Ua can be described in terms of averaging over ath roots of unity: √ 1 X a (Ua F )(t) = F (ζ t). a a ζ =1 We have the following. n d n n followed Proposition 6.4. For n ≥ 0, define the differential operator Dn := dt n ◦ (t ·), i.e. multiplication by t P∞ i by n-fold differentiation with respect to t. If F (z) = i=0 Fi z is convergent near z = 0, then Z 1 F (z) dz 1 √ = (Dm−1 (Ua F )) (t). (m − 1)! 2π −1 S1 (1 − tz −a )m z  P∞ i Proof. It is easy to see that both sides are equal to i=0 m−1+i  m−1 Fia t . Applying Proposition 6.4 to Equation (6.6), we obtain d1 (6.7) HilbV (t) = i −1 2 µ X X (Dµ e1 −1 νX 2 k −1 X (Ud1 −2i Φi,j )) (t) (Dνk −ℓ−1 (Ue1 −2k Ψk,ℓ )) (t) + . (µi − j − 1)! (νk − ℓ − 1)! i −j−1 i=0 j=0 k=0 ℓ=0 To compute each (Ud1 −2i Φi,j )(t) and (Ue1 −2k Ψk,ℓ )(t), we follow the process described in [18, Section 4]. Specifically, when computing (Ua F )(t) for a rational function F (z) whose denominator consists of factors of the form (1 − z b ), each such factor transforms by the rule (1 − z b ) 7−→ (1 − tlcm(a,b)/a )gcd(a,b) to yield the denominator of (Ua F )(t). Then we can determine the numerator num((Ua F )(t)) of (Ua F )(t) via num((Ua F )(t)) = (Ua F )(t) denom((Ua F )(t)). Writing HilbV (t) = P (t)/Q(t), we have by Kempf’s bound [23, Theorem 4.3] that deg(P ) ≤ deg(Q). Hence for each F , as any terms in the numerator with degree larger than that of the denominator will cancel in the complete expression, we need only determine the Taylor expansion up to a deg(Q). This algorithm has been implemented on Mathematica and is available from the authors by request. We have been able to use it to compute the Hilbert series of large irreducible representations on a PC; as an example, 18 P. DE CARVALHO CAYRES PINTO, H.-C. HERBIG, D. HERDEN, AND C. SEATON Q49 HilbV50 (t) was computed in 52 hours. It has denominator (1 − t2 )2 i=3 (1 − ti ) and a numerator of degree 1175 with largest coefficient approximately 1.6996 × 1052 . For a simple reducible example with multiplicities, V2 ⊕ V3 ⊕ V3 is computed in a few seconds; the Hilbert series is given by −t21 − t18 − 3t17 − 4t16 − 5t15 − 8t14 − 7t13 − 3t12 − 2t11 + 2t10 + 3t9 + 7t8 + 8t7 + 5t6 + 4t5 + 3t4 + t3 + 1 . (1 − t2 )2 (1 − t3 )2 (1 − t4 )3 (1 − t5 )2 References 1. Luchezar L. Avramov, Ragnar-Olaf Buchweitz, and Judith D. Sally, Laurent coefficients and Ext of finite graded modules, Math. Ann. 307 (1997), no. 3, 401–415. 2. L. P. Bedratyuk, Poincaré series of the multigraded algebras of SL2 -invariants, Ukrainian Math. J. 63 (2011), no. 6, 880–890. 3. Leonid Bedratyuk, The Poincare series for the algebra of covariants of a binary form, Int. J. Algebra 4 (2010), no. 25-28, 1201–1207. 4. , Bivariate Poincaré series for the algebra of covariants of a binary form, ISRN Algebra (2011), Art. ID 312789, 11. 5. , The MAPLE package for SL2 -invariants and kernel of Weitzenböck derivations, (2011), arXiv:1101.0622 [math.AG]. 6. Leonid Bedratyuk and Lyubomyr Bedratyuk, Multivariate Poincaré series for algebras of SL2 -invariants, C. R. Acad. Bulgare Sci. 64 (2011), no. 6, 807–814. 7. Leonid Bedratyuk and Nadia Ilash, The degree of the algebra of covariants of a binary form, J. Commut. Algebra 7 (2015), no. 4, 459–472. 8. D. J. Benson, Polynomial invariants of finite groups, London Mathematical Society Lecture Note Series, vol. 190, Cambridge University Press, Cambridge, 1993. 9. D. J. Benson and W. W. Crawley-Boevey, A ramification formula for Poincaré series, and a hyperplane formula for modular invariants, Bull. London Math. Soc. 27 (1995), no. 5, 435–440. 10. Winfried Bruns and Jürgen Herzog, Cohen-Macaulay rings, Cambridge Studies in Advanced Mathematics, vol. 39, Cambridge University Press, Cambridge, 1993. 11. L. Emily Cowie, Hans-Christian Herbig, Daniel Herden, and Christopher Seaton, The Hilbert series and a-invariant of circle invariants, (2017), arXiv:1707.03128 [math.RA]. 12. Harm Derksen and Gregor Kemper, Computational invariant theory, Invariant Theory and Algebraic Transformation Groups, I, Springer-Verlag, Berlin, 2002, Encyclopaedia of Mathematical Sciences, 130. 13. Michael Forger, Invariant polynomials and Molien functions, J. Math. Phys. 39 (1998), no. 2, 1107–1141. 14. William Fulton and Joe Harris, Representation theory, Graduate Texts in Mathematics, vol. 129, Springer-Verlag, New York, 1991, A first course, Readings in Mathematics. 15. Shiro Goto and Keiichi Watanabe, On graded rings. I, J. Math. Soc. Japan 30 (1978), no. 2, 179–213. 16. Hans-Christian Herbig, Daniel Herden, and Christopher Seaton, On compositions with x2 /(1 − x), Proc. Amer. Math. Soc. 143 (2015), no. 11, 4583–4596. 17. Hans-Christian Herbig and Gerald W. Schwarz, The Koszul complex of a moment map, J. Symplectic Geom. 11 (2013), no. 3, 497–508. 18. Hans-Christian Herbig and Christopher Seaton, The Hilbert series of a linear symplectic circle quotient, Exp. Math. 23 (2014), no. 1, 46–65. 19. David Hilbert, Ueber die vollen Invariantensysteme, Math. Ann. 42 (1893), no. 3, 313–373. 20. Melvin Hochster and Joel L. Roberts, Rings of invariants of reductive groups acting on regular rings are Cohen-Macaulay, Advances in Math. 13 (1974), 115–175. 21. Nadia Ilash, The Poincaré series for the algebras of joint invariants and covariants of n linear forms, C. R. Acad. Bulgare Sci. 68 (2015), no. 6, 715–724. , Poincaré series for the algebras of joint invariants and covariants of n quadratic forms, Carpathian Math. Publ. 9 (2017), 22. no. 1, 57–62. 23. George Kempf, The Hochster-Roberts theorem of invariant theory, Michigan Math. J. 26 (1979), no. 1, 19–32. 24. Friedrich Knop, Der kanonische Modul eines Invariantenrings, J. Algebra 127 (1989), no. 1, 40–54. 25. Friedrich Knop and Peter Littelmann, Der Grad erzeugender Funktionen von Invariantenringen, Math. Z. 196 (1987), no. 2, 211–229. 26. P. Littelmann and C. Procesi, On the Poincaré series of the invariants of binary forms, J. Algebra 133 (1990), no. 2, 490–499. 27. V. L. Popov, Groups, generators, syzygies, and orbits in invariant theory, Translations of Mathematical Monographs, vol. 100, American Mathematical Society, Providence, RI, 1992, Translated from the Russian by A. Martsinkovsky. 28. V. L. Popov and È. B. Vinberg, Invariant theory, Algebraic geometry. IV, Encyclopaedia of Mathematical Sciences, vol. 55, Springer-Verlag, Berlin, 1994, Linear algebraic groups. Invariant theory, A translation of ıt Algebraic geometry. 4 (Russian), Akad. Nauk SSSR Vsesoyuz. Inst. Nauchn. i Tekhn. Inform., Moscow, 1989 [ MR1100483 (91k:14001)], Translation edited by A. N. Parshin and I. R. Shafarevich, pp. vi+284. 29. Gerald W. Schwarz, Lifting differential operators from orbit spaces, Ann. Sci. École Norm. Sup. (4) 28 (1995), no. 3, 253–305. 30. T. A. Springer, On the invariant theory of SU2 , Nederl. Akad. Wetensch. Indag. Math. 42 (1980), no. 3, 339–345. 31. Richard P. Stanley, Invariants of finite groups and their applications to combinatorics, Bull. Amer. Math. Soc. (N.S.) 1 (1979), no. 3, 475–511. 32. Bernd Sturmfels, Algorithms in invariant theory, Texts and Monographs in Symbolic Computation, Springer-Verlag, Vienna, 1993. 33. Wolfram Research, Mathematica edition: Version 7.0, (2008), http://www.wolfram.com/mathematica/. THE HILBERT SERIES OF SL2 -INVARIANTS 19 PEE/COPPE, Universidade Federal do Rio de Janeiro, Av. Athos da Silveira Ramos 149, Centro de Tecnologia Bloco H, Caixa postal 68504, CEP: 21941-972, Rio de Janeiro, Brazil E-mail address: [email protected] Departamento de Matemática Aplicada, Av. Athos da Silveira Ramos 149, Centro de Tecnologia - Bloco C, CEP: 21941-909 - Rio de Janeiro, Brazil E-mail address: [email protected] Department of Mathematics, Baylor University, One Bear Place #97328, Waco, TX 76798-7328, USA E-mail address: Daniel [email protected] Department of Mathematics and Computer Science, Rhodes College, 2000 N. Parkway, Memphis, TN 38112 E-mail address: [email protected]
0math.AC
Ontology-based Fuzzy Markup Language Agent for Student and Robot Co-Learning Chang-Shing Lee, Mei-Hui Wang, Tzong-Xiang Huang Li-Chung Chen, Yung-Ching Huang, Sheng-Chi Yang Dept. of Computer Science and Information Engineering National University of Tainan Tainan, Tawain [email protected] Chien-Hsun Tseng, Pi-Hsia Hung Dept. of Education National University of Tainan Tainan, Tawain [email protected] Abstract-An intelligent robot agent based on domain ontology, machine learning mechanism, and Fuzzy Markup Language (FML) for students and robot co-learning is presented in this paper. The machine-human co-learning model is established to help various students learn the mathematical concepts based on their learning ability and performance. Meanwhile, the robot acts as a teacher’s assistant to co-learn with children in the class. The FML-based knowledge base and rule base are embedded in the robot so that the teachers can get feedback from the robot on whether students make progress or not. Next, we inferred students’ learning performance based on learning content’s difficulty and students’ ability, concentration level, as well as teamwork sprit in the class. Experimental results show that learning with the robot is helpful for disadvantaged and below-basic children. Moreover, the accuracy of the intelligent FML-based agent for student learning is increased after machine learning mechanism. Keywords—Ontology, Fuzzy Markup Language, Intelligent Agent, Student Learning, Robot I. INTRODUCTION Ontology model can provide knowledge representation and reasoning capabilities for machines to solve a task as well as to allow semantic interoperability between systems or agents [1]. Owning to the rapid advance in artificial intelligence (AI), Sophia, a social humanoid robot, came to the world in 2015. She was programmed to give pre-written responses to specific questions and also became the first ever to be granted a full Saudi Arabian citizenship in 2017 [2]. Additionally, Liu et al. [3] proposed a fuzzy ontology representation model to express common fuzzy knowledge. Meditskos and Kompatsiaris [4] presented iKnow to capitalize on the use of OWL ontological knowledge to capture domain relationships between low-level observations and high-level activities. Lee et al. used the ontology to represent the knowledge of patent technology requirement evaluation and recommendation [5] as well as proposed a type-2 fuzzy ontology for personal diabetic-diet recommendation [6]. Fuzzy Markup Language (FML) is a specific purpose markup language based on XML to describe the structure and behavior of a fuzzy system independently of the hardware architecture [13-14]. Since May 2016, FML has become one of the IEEE standards [15-16] and has been applied to a lot of researches like game of Go [11, 17], diet assessment [14, 18, 22], and so on. Nowadays, human and machine co-learning is an important topic for current societies. One way to provide a robot The authors would like to thank the financially support sponsored by the Ministry of Science and Technology of Taiwan under the grants MOST 106-3114-E-024-001 and 1062221-E-024-019. XXX-X-XXXX-XXXX-X/XX/$XX.00 © 20XX IEEE Naoyuki Kubota Dept. of System Design Tokyo Metropolitan University Tokyo, Japan [email protected] with such learning capability is to use machine learning [8]. Learning explores and understands the learning process of humans, and machine learning studies how algorithms learn from data [9]. Jain et al. [10] proposed an artificial-based student learning evaluation tool to test with students from undergraduate courses. There exists some FML-based real-world applications to persons’ learning. For example, Lee et al. proposed a FMLbased intelligent adaptive assessment platform for learning materials recommendation [20], and an online self-learning platform construction based on genetic FML (GFML) and item response theory (IRT) agent [21]. They also proposed a FMLbased dynamic assessment agent for human-machine cooperative system on game of Go [11]. By combining particle swarm optimization (PSO) with FML, called PFML, Lee et al. applied to human and machine co-learning on game of Go [12] and student learning performance evaluation [19]. Advancement in technology is bringing robots into interpersonal aspects of student’s learning [7]; therefore, including the robot into the class to co-learn with humans has been a trend for recent years. This paper brings the robots Palro, developed by FUJISOFT Japan and Zenbo, developed by ASUS, Taiwan, into an elementary school to co-learn mathematics with four-grade children. The objective of this paper is to represent the knowledge of the robot for student and robot co-learning. We first construct the student learning performance ontology for the robot agent to predict their learning performance. Then, we construct the student and robot co-learning ontology to recommend students for suitable learning contents. After that, we use FML to describe the knowledge base and rule base for the constructed ontologies. Finally, we apply the developed robot agent to the four-grade students for learning mathematical concepts of number line and groups of numbers. We also use machine learning techniques to optimize the involved student learning performance using GFML [17-18] and PFML [19]. The experiments show that the proposed ontology-based fuzzy markup language agent is feasible for student and robot colearning. The remainder of this paper is organized as follows: Section II introduces the ontology model for student and robot colearning. Section III describes the fuzzy markup language agent, including the proposed system structure as well as knowledge base, rule base, and optimization model for the proposed student and robot co-learning. The experimental results are shown in Section IV and conclusions are given in Section V. II. ONTOLOGY MODEL FOR STUDENT AND ROBOT CO-LEARNING A. Student Learning Performance Ontology for Robot Agent The structure of student learning performance ontology based on Fuzzy Markup Language (FML) for robot agent reasoning is shown in Fig.1. The domain name is defined as FML output variable which connects to the FML linguistic concepts of the output fuzzy variable. There are some FML input variables, for example, FML input variable 1, FML input variable 2, FML input variable 3, …, and FML input variable M, to connect to the linguistic concepts of FML input variables. Each FML input variable contains some linguistic concepts. The linguistic concept of FML input variable contains some attributes, such as Area, Grade, Subject, and so on. In addition, some operations are also defined in the linguistic concept, for example, operation Recommend. Generalization FML Output Variable Aggregation … FML Linguistic Concept 1 FML Linguistic Concept 2 … Learning Content Difficulty (LCD) Association FML Linguistic Concept 3 … FML Input Variable 1 C. Student and Robot Co-Learning Ontology Fig. 3 shows student and robot co-learning ontology. The developed robot agent predicts the involved students’ learning performance in the class according to the constructed student learning performance ontology shown in Fig. 2. Next, according to the feedback of the students’ learning performance and students’ ability, the robot agent provides students with suitable learning contents for their next study. Fig. 3 also shows partial learning content ontology about the concepts of number line and groups of numbers. Categories Number and Calculation and Quantity and Measurement have concepts Number Line, Distance, Four fundamental operations of arithmetic, …, etc. For example, before knowing the concepts of Number Line, students should know the concepts of Positive Number which includes the concept of Positive Integer. … FML Input Variable 2 FML Input Variable 3 VeryEasy FML Linguistic Concept N … … … Easy Student Learning Performance (SLP) Student Ability (SA) FML Input Variable M Area: Countryside Grade: Fourth Subject: Math FML Linguistic Concept 1 Area: Grade: Subject: … Area: Grade: Subject: Rec omm end: Proficient Area: Countryside Grade: Fourth Subject: Math Area: Countryside Grade: Fourth Subject: Math ... ... ... ... ... ... Rec omm end: Rec omm end: Rec omm end: Rec omm end: Fig. 1. Structure of FML-based student learning performance ontology. B. An Instance of Student Learning Performance Ontology Fig. 2 shows an instance of FML-based student learning performance ontology. The domain name for FML output variable is Student Learning Performance (SLP), there are four FML input variables in the ontology, including: Student Ability (SA), Learning Content Difficult (LCD), Student Concentration Level (SCL), and Student Teamwork Spirit (STS). There are five linguistic concepts defined in FML output variable, including FallBehind, Insufficient, Basic, Good, and Excellent. Each FML input variable contains four linguistic concepts in this paper. For instance, LCD has an association relations with VeryEasy, Easy, Average, and Hard. Each linguistic concept contains some attributes like Area, Grade, and Subject, as well as operations like Recommend. (a) Fourth-Grade Mathematical Course Materials Ontology for Elementary School Number and Calculation Know Know Good … Know Know ... Positive Number Include Sense of Volume Positive Integer Student Concentration Level Student Teamwork Spirit (SA) (LCD) (SCL) (STS) Recommend = [VeryEasy, Easy, Average, Hard] Area: Countryside … Grade: form third to fourth Subject: Mathematics ... Recommend = [VeryEasy, Easy, Average, Hard] Area: Countryside … Grade: form third to fourth Subject: Mathematics ... ... ... Recommend = [VeryEasy, Easy, Average, Hard] ... ... ... ... Recommend = [VeryEasy, Easy, Average, Hard] Area: Countryside … Grade: form third to fourth Subject: Mathematics Positive Distracted VeryEasy calculation of Multiplication ... calculation of addition Mix calculation of addition and multiplication Conception of equalization Concepts of groups of numbers … Learning Content Difficulty Area: Countryside Grade: form third to fourth Subject: Mathematics ... Excellent Student Ability BelowBasic Four fundamental operations of aritgmetic ... Distance Algebra ... Basic … … Statistics and Probability Concepts of Number Line (SLP) Insufficient Quantity and Measurement ... Number Line Student Learning Performance FallBehind Rec omm end: BelowBasic Good Area: Countryside Grade: Fourth Subject: Math ... Recommend: Recommend: Rec omm end: Rec omm end: Insufficient Area: Countryside Grade: Fourth Subject: Math ... Recommend: Area: Grade: Subject: ... ... ... ... Recommend: … Advanced Area: Countryside Grade: Fourth Subject: Math ... … Basic Area: Countryside Grade: Fourth Subject: Math ... ... Rec omm end: Area: Grade: Subject: ... FML Linguistic Concept NM Exc ellent Area: Countryside Grade: Fourth Subject: Math Basic Area: Countryside Grade: Fourth Subject: Math ... FML Linguistic Concept N1 Hard … … FallBehind FML Linguistic Concept 1 Average … Fig. 2. An instance of FML-based student learning performance ontology. (b) Fig. 3. (a) Student and robot co-learning ontology and (b) an example of learning content ontology of the fourth-grade number line and groups of numbers. III. FML-BASED INTELLIGENT AGENTS FOR STUDENT AND ROBOT CO-LEARNING A. System Structure for Student and Robot Co-Learning We propose the FML-based intelligent agents, including an ontology agent, a teaching assistant agent, a co-learning learning, an assessment agent, and a recommendation agent, for student and robot co-learning in this section. Fig. 4 shows the structure of FML-based intelligent robot agents for student learning performance assessment and learning content recommendation. The publisher finds domain experts to write the textbook for teacher’s teaching and student’s learning after the government, for example, Ministry of Education, defines the learning outline for different grades of students. The ontology agent constructs the domain ontology based on the textbook for the teaching assistant agent. In addition, the colearning agent helps teacher teach students in the class and the assessment agent classifies the student learning performance into five categories, including FallBehind, Insufficient, Basic, Good, and Excellent. Finally, the recommendation agent helps teachers and students choose suitable learning contents for their further study and learning. Fig. 5 shows the communication structure among the developed learning contents, students, and the robot Palro which communicates with the server via the developed robot socket client. Nonfocused, Focused, Absorbed}; (4) Student Teamwork Spirit (STS) = {Passive, Normal, Initiative, Positive}. In addition, we define the knowledge base for FML output variable Student Learning Performance (SLP) = {FallBehind, Insufficient, Basic, Good, Excellent}. Figs. 6(a)-6(e) show the fuzzy sets for fuzzy variables SA, LCD, SCL, STS, and SLP, respectively. (a) (b) (c) Math ... Teaching Assistant Agent (d) Co-learning Agent ... Text book ... Ontology Agent Learning Outline Excellent Good Basic Insufficient Recommendation Agent Assessment Agent FML-based Intelligent Agents Fig. 4. Structure of FML-based intelligent robot agent for student learning performance assessment and learning content recommendation. Client Server RobotSocketClient NCHC WebSocket Database Mathematical Learning Contents Local Notebook Students (e) FallBehind Fig. 6. FML input variables (a) SA, (b) LCD, (c) SCL, (d) STS, and (e) FML output variable SLP. C. Rule Base for Human and Robot Co-Learning The FML robot agent first predicts students’ learning performance based on the knowledge base, and then provides suitable learning contents to students for next study according to the students’ learning performance. In 2017, we developed the mathematical learning contents using PHP and Java languages to construct the learning-content server which allows students to surf on it to learn in the class. Table I shows partial fuzzy rules and Table II shows partial knowledge base and rule base of FML that predicts students’ learning performance. TABLE I. Palro Fig. 5. Communication structure among the developed learning contents, students, and Palro. B. Knowledge Base for Human and Robot Co-Learning In this paper, we propose a FML Robot Agent for Student Learning Performance Prediction, the knowledge base for FML input variables are defined as follows: (1) Student Ability (SA) = {BelowBasic, Basic, Proficient, Advanced}; (2) Learning Content Difficulty (LCD) = {VeryEasy, Easy, Average, Hard}; (3) Student Concentration Level (SCL) = {Distracted, No 1 2 3 4 5 6 7 8 9 10 SA BelowBasic BelowBasic BelowBasic BelowBasic BelowBasic BelowBasic BelowBasic BelowBasic BelowBasic BelowBasic LCD VeryEasy VeryEasy VeryEasy VeryEasy VeryEasy VeryEasy VeryEasy VeryEasy VeryEasy VeryEasy PARTIAL FUZZY RULES SCL Distracted Distracted Distracted Distracted Nonfocused Nonfocused Nonfocused Nonfocused Focused Focused ⋮ STS Passive Normal Initiative Positive Passive Normal Initiative Positive Passive Normal SLP FallBehind FallBehind FallBehind FallBehind FallBehind FallBehind FallBehind Insufficient FallBehind FallBehind 250 251 252 253 254 255 256 Advanced Advanced Advanced Advanced Advanced Advanced Advanced TABLE II. Hard Hard Hard Hard Hard Hard Hard Focused Focused Focused Absorbed Absorbed Absorbed Absorbed Normal Initiative Positive Passive Normal Initiative Positive Excellent Excellent Excellent Excellent Excellent Excellent Excellent PARTIAL KNOWLEDGE BASE AND RULE BASE OF FML and one FML output variable represent the position of the particle in 5-dimensional space where are optimized by adjusting the moving velocity in order to reach convergence. The domain of the particle in each dimension is bounded in [domain left, domain right] of the FML variable [19]. In this paper, the domains of from the first to the fifth dimension are [−4, 4], [−4, 4], [0, 10], [0, 10], and [0, 1] to optimize the parameters of FML variables SA, LCD, SCL, STS, and SLP, respectively. IV. EXPERMENTAL RESULTS There are three parts in the experimental results: (1) Parts 1 and 2 are to test the behavior for FML-based intelligent agent, including an assessment agent and a recommendation agent for student learning performance assessment and learning content recommendation, respectively. (2) Part 3 is to deploy the FMLbased intelligent agent with different robots, Palro and Zenbo, to an elementary school for four-grade students that co-learned with the robots about mathematical concepts of number line and types of numbers in Nov. and Dec. 2017, respectively. ⋮ ⋮ ⋮ D. Machine Learning for knowledge base optimalization This subsection describes the machine learning methods, including GFML [17, 18, 22] and PFML [19] to optimize the knowledge base of Fuzzy Markup Language. The former is to combine genetic algorithm with FML and the latter is to combine PSO with FML. Fig. 7 shows the FML-based intelligent agents with a machine learning mechanism for students learning. For GFML, three types of genes are defined, including knowledge-based genes (composed of the FML variables’ names and the objects with the linguistic terms of their own fuzzy variables), rule-based genes (a collection of the weight of the fuzzy rules), and fuzzy-hedged genes (linguistic terms’ hedge of the fuzzy variables) [22]. In this paper, the encoded chromosome has 266 genes, including the knowledgebased genes (G1 to G5), the rule-based genes (G6 to G261), and the fuzzy-hedged genes (G262 to G266). FML KB / RB Learning Data Machine Learning Co-Learning Agent N Termination ? Y A. Part 1: Student Learning Performance Assessment In Part 1 of the experiments, we propose a FML robot agent for student learning performance assessment. The knowledge base for FML input variables are defined as follows: (1) Student Ability (SA) = {BelowBasic, Basic, Proficient, Advanced}={[4, -4, -1.11, -0.6], [-1.11, -0.6, 0.05, 0.4], [0.05, 0.4, 0.95, 1.5], [0.95, 1.5, 4, 4]}; (2) Learning Content Difficulty (LCD) = {VeryEasy, Easy, Average, Hard} ={[-4, -4, -1.11, -0.6], [1.11, -0.6, 0.05, 0.4], [0.05, 0.4, 0.95, 1.5], [0.95, 1.5, 4, 4]}; (3) Student Concentration Level (SCL) = {Distracted, Nonfocused, Focused, Absorbed} ={[0, 0, 2, 3], [2, 3, 4, 5], [4, 5, 6, 7], [6, 7, 10, 10]}; (4) Student Teamwork Spirit (STS) = {Passive, Normal, Initiative, Positive}={[0, 0, 2, 3], [2, 3, 4, 5], [4, 5, 6, 7], [6, 7, 10, 10]}. In addition, we define the knowledge base for FML output variable Student Learning Performance (SLP) = {FallBehind, Insufficient, Basic, Good, Excellent}={[0.0, 0.0, 0.2, 0.3], [0.2, 0.3, 0.4, 0.5], [0.4, 0.5, 0.6, 0.7], [0.6, 0.7, 0.8, 0.9], [0.8, 0.9, 1, 1]}. We first simulate 400 records and then use K-fold cross validation method to evaluate the performance. The fitness function is mean square error (MSE). In this paper, K = 5 which means that 80% of data for training and 20% for testing. Figs. 8 and 9 show the learned fuzzy sets for fuzzy variables SA, LCD, SCL, STS, and SLP, by applying GA (crossover rate / mutation rate = 0.9 / 0.1) and PSO with 84 particles learning mechanisms to learn 1000 and 3000 generations, respectively. Fig. 10 shows that learning 3000 generations performs better than the others for both GA and PSO. Additionally, the proposed PSO learning method has a better performance than GA learning. BelowBasic Teaching Field Basic Advanced Proficient 1 Teaching Assistant Agent After-Learning FML KB / RB SA -3.98 -3.95 Fig. 7. FML-based intelligent agents with a machine learing mechanism for students learning. -2.65 -1.11 -0.71 -0.15 0.05 0.61 0.4 2.23 0.95 3.58 4 (a) VeryEasy Easy Average Hard 1 LCD For PFML, the total number of parameters for each particle is 84 in this paper. The parameters of four FML input variables -4 -3.77 -1.16 -0.92 -1.08 -0.75 0.05 0.16 0.4 0.58 (b) 1.15 1.58 1.75 3.18 4 Distracted Focused Nonfocused Absorbed 1 SCL 0 2.87 2.99 3 3.03 0.8 5.63 5.8 5.45 4.35 6.61 7 7.52 10 (c) Passive Normal Initiative Positive 1 STS 0.6 0 3.65 2.85 1.81 5.5 5.68 4.04 4.53 4.33 6.23 7.51 6.94 10 (d) FallBehind Basic Insufficient Good 1 Excellent SLP 0 0.01 0.259 0.267 0.14 0.09 0.46 0.48 0.38 0.37 0.56 0.54 0.61 0.71 0.73 0.8 0.85 1 0.99 (e) Fig. 8. FML variables after GA learning (a) SA, (b) LCD, (c) SCL, (d) STS, and (e) SLP. 0 Basic BelowBasic 1 -4 -3.25 -2.36 -0.15 Proficient Advanced 1.37 1.46 -0.11 -0.01 4 SA 3.84 (a) Average Easy VeryEasy Hard 1 0 -4 -3.85 -1.38 0.31 4 2.43 0.8 LCD (b) Distracted Nonfocused 1 Focused Absorbed Performance (SLP) and the output fuzzy variable is Recommended Learning Content Rank (RLCR) with 8 linguistic terms including last-grade high intermediate level (LGHIL), last-grade advanced level (LGAL), current-grade elementary level (CGEL), current-grade intermediate level (CGIL), current-grade high intermediate level (CGHIL), current-grade advanced level (CGAL), next-grade elementary level (NGEL), and next-grade intermediate level (NGIL). The range of RLCR is between -4 and +4 and it is the same as student’s ability [20]. Table III shows partial knowledge base and rule base of learning content recommendation which is constructed according to the learned knowledge of PSO learning mechanism. The total number of fuzzy rules is 20 listed in Table IV. Table V lists partial input data that recommend the learning content rank and column RLCRDO is the desired output (DO). Columns RLCRBLKB and RLCRALKB show partial inferred results when we extracted the parameters of input fuzzy variables SA and SLP from the before-learning and afterlearning knowledge of PSO learning mechanism, respectively. Table V indicates that the robot agent with the learned knowledge recommends more suitable learning contents owing to an increase in accuracy from 78.75% to 87%. TABLE III. 0 2.96 1.09 0 3.76 5.52 KNOWLEDGE BASE OF PART-2 EXPERIMENT. 10 SCL 7.99 8.26 (c) 0 Normal Passive 1 1.62 0 2.05 Initiative 5.82 4.01 Positive 6.18 9.4 9.88 10 STS (d) FallBehind Insufficient Basic 1 0 0 0.28 0.08 0.1 0.33 0.48 Good 0.53 0.65 0.68 Excellent 0.94 0.72 1 SLP (e) Fig. 9. FML variables after PSO learning (a) SA, (b) LCD, (c) SCL, (d) STS, and (e) SLP. 0.008 Before Learning After GA Learning 0.007 After PSO Learning MSE 0.006 0.0055 0.0055 0.0055 0.005 0.004 0.003 0.003 0.0028 0.0028 0.0027 0.0024 0.0022 0.002 0.001 TABLE IV. 0 1000 Generations 2000 Generations FUZZY RULES OF RECOMMENDING LEARNING CONTENT. 3000 Generations Fig. 10. MSE values of before learning, after GA learning, and after PSO learning with evolving 1000, 2000, and 3000 generations. B. Part 2: Learning Content Recommendation The purpose of Part 2 of the experiments is to recommend learning contents for next students’ learning by feeding the learned knowledge from Part 1 into the robot. We categorize the learning contents into four levels, including elementary, intermediate, high intermediate, and advanced levels. The input fuzzy variables are Student Ability (SA) and Student Learning No. 1 2 3 4 5 6 7 8 9 10 SA Below Basic Below Basic Below Basic Below Basic Below Basic Basic Basic Basic Basic Basic SLP Fall Behind Insufficient Basic Good Excellent Fall Behind Insufficient Basic Good Excellent RLCR LGHIL LGAL LGAL CGEL CGIL LGAL CGEL CGIL CGHIL CGAL No. 11 12 13 14 15 16 17 18 19 20 SA Proficient Proficient Proficient Proficient Proficient Advanced Advanced Advanced Advanced Advanced SLP Fall Behind Insufficient Basic Good Excellent Fall Behind Insufficient Basic Good Excellent RLCR CGIL CGHIL CGAL CGAL NGEL CGAL CGAL NGEL NGIL NGIL SA -1.43 -1.03 -2.23 -1.88 -3.74 -2.87 -1.68 -0.97 -1.5 -2.65 SLP 0.111 0.167 0.098 0.11 0.113 0.116 0.153 0.117 0.105 0.112 396 397 398 399 400 Accuracy 2.87 3.71 1.43 1.61 1.57 0.903 0.902 0.803 0.85 0.907 PARTIAL INPUT DATA. RLCRDO -1.99067 -1.57467 -2.55867 -2.29333 -3.52533 -2.93733 -2.04533 -1.668 -2.05333 -2.80133 RLCLBLKB -3.611 -2.997 -2.985 -3.611 -3.611 -3.611 -2.791 -3.024 -3.48 -3.611 RLCRALKB -2.248 -2.073 -2.67 -2.472 -3.611 -3.599 -2.369 -2.049 -3.072 -2.75 2.988 3.545333 1.761333 2.006667 2.132 3.314 3.367 3.079 3.367 3.339 78.75% 2.439 2.735 1.25 1.441 1.5533 87% ⋮ Moreover, the students cannot do next item until they correctly answer the current item. Fig. 12 shows the average distance between two points (students’ response data and correct answer), on a number line from Item 1 to Item 22. If the average distance is small, then the students’ learning performance is good. We observe that Group B co-learns better with the robots than Group A. 4.83 5 4.5 Average Distance between response data and correct answer TABLE V. No 1 2 3 4 5 6 7 8 9 10 4.5 4 3.5 Group A 3.25 Group B 3 3 2.6 2.5 2 1.5 1.5 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 00 0 0 00 0 0 0 6 7 8 0 00 0 00 0 00 00 0 00 00 00 0 0 00 0 1 C. Part 3: FML-based Intelligent Agent for Student Learning In Part 3 of the experiments, we deployed two different robots, Palro and Zenbo, with the proposed FML-based intelligent agent to an elementary school for students and robot co-learning. The involved fourth-grade elementary students were divided into two groups. Each group contains four students with different levels of ability. The purpose of group learning is to hope that students can learn together with the robots by teamwork and that students with stronger learning ability can guide weaker students along with the robot’s assistance. Fig 11 shows the grouping learning diagram and actual teaching situation that the involved four-grade students and robot co-learning mathematics in the class in Kaohsiung, Taiwan on Nov. 25 and Dec. 23, 2017. Group A learns mathematics together with Palro and Zenbo but Group B does with Palro and iPads. Group B Group A 2 3 First deploy is to learn the concepts of the number line on Nov. 25, 2017 through play. The total number of the items is 22. The bigger the item number, the harder the item. The students input their response data to shoot the target of the number line shown on the screen of Zenbo (Group A) or iPad (Group B). Meanwhile, Palro provided students with some hints when they failed to hit the target but cheered for them when they made it. In addition, Palro will provide different levels of hints according to the number of incorrect answer. The more number of incorrect answer, the more detailed the hints. 5 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Item No. Fig. 12. Average distance between two points (students’ response data and correct answer) on a number line for Items 1−22 for the study on Nov. 25, 2017. The second study was about learning the concept of groups of numbers on Dec. 23, 2017 through play. Palro and Zenbo also play the similar role to the first study on Nov. 25, 2017. We used three monsters, including MonsterA, MonsterB, and MonsterC, to represent the scores 8, 12, and –4, respectively. The involved students hit the exact number of monsters to complete their mission. For example, if their mission is to get score 56 by hitting three kinds of monsters, they can hit three MonsterAs, one MonsterB, and one MonsterC to get score 3×8 + 3×12 – 1 × 4 = 56. Their challenged difficulty is divided into three levels, including Easy, Average, and Hard. Each challenge has different numbers of missions. However, there is an upper bound of the number of making a response to each mission. Table VI shows the obtained score for each level. The score is calculated according to how many times students make a response to the mission and whether they successfully complete the mission or not in the end. The total score is bounded in [0, 29]. TABLE VI. SCORE BASED ON HOW MANY TIMES STUDENTS TRY TO MAKE A RESPONSE. Times Fig. 11. Grouping learning diagram and actual teaching situation in the class. 4 1 2 3 4 Easy 2 1 0 0 Challenge Level Average 3 2 1 0 Hard 3 2 1 0 Fig. 13 shows the number of making a response of each mission for Groups A and B on Dec. 23, 2017. The first mission of each challenge is to test if students fully understand their mission for the current challenge. Observe Fig. 13 that understanding their mission of the Average and Hard challenges is the most difficult one for both Groups A and B when we compare to the other missions. The symbol “×” of Fig. 13 denotes that the involved students failed this mission in the end. The total acquired score of Groups A and B is 23 and 22, respectively, which means that two-group students perform equally and grouping learning with the robot is feasible for the involved students. [7] 4 Number of making a response 3.5 Mission 1 3 Mission 2 3 3 [8] 3 Mission 3 2.5 Mission 4 2 2 2 2 2 [9] 1.5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [10] 0.5 0 Easy (Group A) Easy (Group B) Average (Group A) Average (Group B) Hard (Group A) Hard (Group B) Fig. 13. Number of making a response of each mission for Groups A and B on Dec. 23, 2017. [11] V. CONCULSION AND FUTURE WORK This paper presents an FML-based intelligent agent for students and robot co-learning. The student learning performance ontology and the student with robot co-learning ontology are proposed for the intelligent agent. In addition, the machine learning mechanism, including GA and PSO, are also adopted for the knowledge base refinement. The machinehuman co-learning model is established to help various students learn the mathematical concepts based on their learning ability and performance. Experimental results show that learning with the robot is helpful for the involved students. In the future, the intelligent agent with different robots will be deployed in various learning environments to help more students’ learning. [12] [13] [14] [15] ACKNOWLEDGMENT The authors would like to thank Han-Ru Liu, Jou-Te Tsai, master students of Dept. of Education, National University of Tainan (NUTN), faculty of San Pi Elementary School in Kaohsiung for their help with introducing the developed learning contents into the teaching field. Finally, we also would like to thank the involved students of San Pi Elementary School. [16] [17] [18] REFERENCES [1] [2] [3] [4] [5] [6] E. Prestes, J. L. Carbonera, S. R. Fiorini, V. A. M. Jorge, M. Abel, R. Madhavan, A. Locoro, P. Goncalves, M. E. Barreto, M. Habib, A. Chibani, S. Gerard, Y. Amirat, and C. Schlenoff, “Towards a core ontology for robotics and automation,” Robotics and Autonomous Systems,” vol. 61, pp. 1193-1204, 2013. H. Taylor, “Could you fall in love with this robot?,” Mar. 2016, [Online] Available: https://www.cnbc.com/2016/03/16/could-you-fall-in-lovewith-this-robot.html. J. Liu, B. J. Zheng, L. M. Luo, J. S. Zhou, Y. Zhang, and Z. T. Yu, “Ontology representation and mapping of common fuzzy knowledge,” Neurocomputing, vol. 215, pp. 184-195, 2016. G. Meditskos and I. Kompatsiaris, “iKnow: Ontology-driven situational awareness for the recognition of activities of daily living,” Pervasive and Mobile Computing, vol. 40, pp. 17-41, 2017. C. S. Lee, M. H. Wang, Y. C. Hsiao, B. H. Tsai, “Ontology-based GFML agent for patent technology requirement evaluation and recommendation,” Soft-Computing, 2017. (DOI: 10.1007/s00500-017-2859-1) C. S. Lee, M. H. Wang, and H. Hagras, “A type-2 fuzzy ontology and its application to personal diabetic-diet recommendation,” IEEE Transactions on Fuzzy Systems, vol. 18, no. 2, pp. 374-395, Apr. 2010. [19] [20] [21] [22] A. Edwards, C. Edwards, P. R. Spence, C. Harris, and A. Gambino, “Robots in the classroom: differences in students’ perceptions of credibility and learning between teacher as robot and robot as teachers,” Compuers in Human Behavior, vol. 65, pp. 627-634, 2016. E. Senft, P. Baxter, J. Kennedy, S. Lemaignan, and T. Belpaeme, “Supervised autonomy for online learning in human-robot interaction,” Pattern Recognition Letters,” vol. 99, pp. 77-86, 2017. M. Vahdat, L. Oneto, D. Anguita, M. Funk, and M. Rauterberg, “Can machine learning explain human learning?” Neurocomputing, vol. 192, pp. 14-28, 2016 G. P. Jain, V. P. Gurupur, J. L. Schroeder, and E. D. Faulkenberry, “Artificial intelligence-based student learning evaluation: a concept mapbased approach for analyzing a student’s understanding of a topic,” IEEE Transactions on Learning Technologies, vol. 7, no. 3, pp. 267-279, 2014. C. S. Lee, M. H. Wang, S. C. Yang, P. H. Hung, S. W. Lin, N. Shuo, N. Kubota, C. H. Chou, P. C. Chou, and C. H. Kao, “FML-based dynamic assessment agent for human-machine cooperative system on game of Go,” International Journal of Uncertainty, Fuzziness and Knowledge-Based Systems, vol. 25, no. 5, pp. 677-705, 2017. C. S. Lee, M. H. Wang, S. C. Yang, and C. H. Kao, “From T2 FS-based MoGoTW system to DyNaDF for human and machine co-learning on Go,” in R. John, H. Hagras, and O. Castillo (editors), Type-2 Fuzzy Logic and Systems Dedicated to Professor Jerry Mendel for his Pioneering Contribution, Berlin, Springer, Mar. 2018, pp. 1-24. G. Acampora and V. Loia, Vincenzo, “Using FML and fuzzy technology in adaptive bmbient intelligence environments,” International Journal of Computational Intelligence Research, vol. 1, no. 2.. pp. 171-182, 2005. C. S. Lee, M. H. Wang, G. Acampora, C. Y. Hsu, and H. Hagras, “Diet assessment based on type-2 fuzzy ontology and fuzzy markup language,” International Journal of Intelligent System, vol. 25, no. 12, pp. 1187-1216, 2010. G. Acampora, B. D. Stefano, and A. Vitiello, IEEE 1855TM: The first IEEE standard sponsored by IEEE Computational Intelligence Society, IEEE Computational Intelligence Magazine vol. 11, no. 4, pp. 4-6, 2015. IEEE Computational Intelligence Society, 1855-2016-IEEE Standard for Fuzzy Markup Language, 2016 [Online]. Available: http://ieeexplore.ieee.org/servlet/opac?punumber=7479439. C. S. Lee, M. H. Wang, M. J. Wu, O. Teytaud, and S. J. Yen, “T2FSbased adaptive linguistic assessment system for semantic analysis and human performance evaluation on game of Go,” IEEE Transactions on Fuzzy Systems, vol. 23, no. 2, pp. 400-420, Apr. 2015. C. S. Lee, M. H. Wang, and S. T. Lan, “Adaptive personalized diet linguistic recommendation mechanism based on type-2 fuzzy sets and genetic fuzzy markup language,” IEEE Transactions on Fuzzy Systems, vol. 23, no. 5, pp. 1777-1802, Oct. 2015. S. Lee, M. H. Wang, C. S. Wang, O. Teytaud, J. L. Liu, S. W. Lin, and P. H. Hung, “PSO-based fuzzy markup language for student learning performance evaluation and educational application,” IEEE Transactions on Fuzzy Systems, 2017. (Revised) C. S. Lee, M. H. Wang, J. L. Yu, K. H. Lin, T. T. Lin, S. C. Yang, and S. L. Cho, “FML-based intelligent adaptive assessment platform for learning materials recommendation,” 2015 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE 2015), Istanbul, Turkey, Aug. 2-5, 2015. C. S. Lee, M. H. Wang, K. H. Lin, S. C. Yang, and T. T. Lin, “GFMLbased IRT agent for online self-learning platform construction,” 2016 World Congress on Computational Intelligence (IEEE WCCI 2016), Vancouver, Canada, Jul. 24-29, 2016. C. S. Lee, M. H. Wang, H. Hagas, Z. W. Chen, S. T. Lan, S. E. Kuo, H. C. Kuo, and H. H. Cheng, “A novel genetic fuzzy markup language and its application to healthy diet assessment,” International Journal of Uncertainty, Fuzziness, and Knowledge-Based Systems, vol. 20, no. 2, pp. 247-278, Oct. 2012.
2cs.AI
arXiv:1702.01345v1 [math.AC] 4 Feb 2017 Local dimension theory of tensor products of algebras over a ring Samir Bouchiba ∗ Department of Mathematics, Faculty of Sciences, University Moulay Ismail, Meknes, Morocco Abstract Our main goal in this paper is to set the general frame for studying the dimension theory of tensor products of algebras over an arbitrary ring R. Actually, we translate the theory initiated by A. Grothendieck and R. Sharp and subsequently developed by A. Wadsworth on Krull dimension of tensor products of algebras over a field k into the general setting of algebras over an arbitrary ring R. For this sake, we introduce and study the notion of a fibred AF-ring over a ring R. This concept extends naturally the notion of AF-ring over a field introduced by A. Wadsworth in [14] to algebras over arbitrary rings. We prove that Wadsworth theorems express local properties related to the fibre rings of tensor products of algebras over a ring. Also, given a triplet of rings (R, A, B) consisting of two R-algebras A and B such that A⊗R B 6= {0}, we introduce the inherent notion to (R, A, B) of a B-fibred AF-ring which allows to compute the Krull dimension of all fiber rings of the considered tensor product A ⊗R B. As an application, we provide a formula for the Krull dimension of A ⊗R B when A and B are R-algebras with A is zero-dimensional as well as for the Krull dimension of A ⊗Z B when A is a fibred AF-ring over the ring of integers Z with nonzero characteristic and B is an arbitrary ring. This enables us to answer a question of Jorge Matinez on evaluating the Krull dimension of A ⊗Z B when A is a Boolean ring. Actually, we prove that if A and B are rings such that B  . A ⊗Z B is not trivial and A is a Boolean ring, then dim(A ⊗Z B) = dim 2B MSC (2000): 13D02; 13D05; 13D07; 16E05; 16E10. ∗ Email: [email protected] 2010 Mathematics Subject Classification: 13C15; 13A15. Key words and phrases: Krull dimension; fibre ring; AF-ring; Fibred AF-ring; height; Boolean ring. 1 Local dimension theory of algebras 1 2 Introduction All rings considered in this paper are commutative with identity element and all ring homomorphisms are unital. Here and subsequently, R stands for an arbitrary ring and k stands for a field. Let A be a ring and p be a prime ideal of A. Then Spec(A) denotes the set of all prime ideals of A and kA (p) denotes the quotient field A of . Also, if n ≥ 0 is a positive integer, A[n] denotes the polynomial ring in n p indeterminates A[X1 , X2 , · · · , Xn ] and ht(p[n]) stands for the height of the extended ideal p[n] := p[X1 , X2 , · · · , Xn ] of p. Further, if A is an algebra over a field k, then t.d.(A : k) denotes the transcendence degree of A over k. Any unreferenced material is standard as in [11], [7] and [15]. It is a paper of R. Sharp on Krull dimension of tensor products of two field extensions of a field k which gave the initial impetus to study the Krull dimension of tensor products. Actually, in [12], Sharp proved that, for any two extension fields K and L of k, dim(K ⊗k L) = min(t.d.(K : k), t.d.(L : k)) (actually, this result appeared ten years earlier in Grothendieck’s EGA [9, Remarque 4.2.1.4, p. 349]). This formula is rather surprising since, as one may expect, the structure of the tensor product should reflect the way the two components interact and not only the structure of each component. This fact affords motivation to Wadsworth to work on this subject in [14]. He aimed at seeking geometric properties of primes of A ⊗k B and to widen the scope of k-algebras A and B whose tensor product Krull dimension, dim(A ⊗k B), shows exclusive dependence on individual characteristics of A and B. The algebras which proved to be tractable for Krull dimension computations turned out to be those rings A which satisfy the altitude formula over k (AF-rings for short), that is, A  : k = t.d.(Ap : k) ht(p) + t.d. p for all prime ideals p of A. The class of AF-rings contains the most basic rings of algebraic geometry, including finitely generated k-algebras. Wadsworth proved through [14, Theorem 3.7] that if A is an AF-domain and B is any k-algebra, then  n  B :k : dim(A ⊗k B) = max ht(q[t.d.(A : k)]) + min t.d.(A : k), ht(p) + t.d. q o p ∈ Spec(A) and q ∈ Spec(B) . As a consequence of this, [14, Theorem 3.8] states that if A1 and A2 are both AFdomains, then   dim(A1 ⊗k A2 ) = min dim(A1 ) + t.d.(A2 : k), t.d.(A1 : k) + dim(A2 ) . Local dimension theory of algebras 3 Further, he gave a result which yields a classification of the prime ideals of A ⊗k B according to their contractions to A and B (cf. [14, Proposition 2.3]). In [1], we continued the work of Wadsworth and transferred all his theorems in [14] on AFdomains to AF-rings. This passage from domains to rings with zero-divisors is well reflected in new formulas for the Krull dimension of tensor products involving AFrings. As it turns out from the present work, it is these formulas that are relevant in our treatment of the general setting of tensor products over a ring R. We refer the reader to [1, 2, 3, 4, 5, 6, 12, 13, 14] for basics and recent investigations on the dimension theory of tensor products of algebras over a field. The main goal of this paper is to set the general frame to study the dimension theory of tensor products of algebras over an arbitrary ring R. Actually, we translate the theory initiated by A. Grothendieck and R. Sharp and subsequently developed by A. Wadsworth on Krull dimension of tensor products of algebras over a field k into the general setting of algebras over an arbitrary ring R. It turns out that Wadsworth theorem express local properties related to the fibre rings of the tensor products over an arbitrary ring R. For this sake, we introduce and study the notion of a fibred AF-ring over a ring R. Actually, we say that an R-algebra A is a fibred AF-ring over R if the fibre ring kR (p) ⊗R A is an AF-ring over kR (p) for any prime ideal p of R such that kR (p) ⊗R A 6= {0}. When restricted to tensor products over a field the notion of a fibred AF-ring boils down to the classical one of an AF-ring. It is notable that all finitely generated algebras over R proved to be fibred AF-rings as well as all zero-dimensional rings which are R-algebras. We prove that the fibred AF-rings inherit all properties of Wadsworth introduced AF-rings. Moreover, given a triplet of rings (R, A, B) consisting of R-algebras A and B such that A ⊗R B 6= {0}, we introduce and study the notion of a B-fibred AF-ring over R which is a somewhat inherent concept to the given triplet (R, A, B). So, when A is a B-fibred AF-ring over R, we can explicit the Krull dimension of all fiber rings of A ⊗R B and in various cases this enables us to determine dim(A ⊗R B). As an application, we compute the Krull dimension of A ⊗R B when A and B are R-algebras with A is zero-dimensional. Also, we provide a formula for the Krull dimension of A ⊗R B when A and B are R-algebras with A is zero-dimensional as well as for the Krull dimension of A ⊗Z B when A is a fibred AF-ring over the ring of integers Z with nonzero characteristic and B is an arbitrary ring. This allows us to answer a question of Jorge Matinez on evaluating the Krull dimension of A ⊗Z B when A is a Boolean ring. Actually, we prove that if A and B are rings such that A ⊗Z B is B  . not trivial and A is a Boolean ring, then dim(A ⊗Z B) = dim 2B Acknowledgement I would like to thank Professor Jeorge Martinez for the discussion led with him on 4 Local dimension theory of algebras the possible connections between the dimension theory of tensor products of algebras and the dimension theory of frames. His questions on this issue were the source of motivation to write this paper. 2 Local spectrum and effective spectrum This section introduces the effective spectrum of a ring R with respect to an Ralgebra as well as local notions of well known concepts of dimension theory of rings such that the height of a prime ideal, the Krull dimension and the spectrum of a ring. Let R be an arbitrary ring and let A be an R-algebra. Denote by fA : R −→ A, with fA (r) = r.1A for any r ∈ R and where 1A is the unit element of A, the ring homomorphism defining the structure of algebra of A over R. Let K := Ker(fA ). It is easily seen that for each prime ideal P of A, K ⊆ p := fA−1 (P ) and that the induced R R A −→ A and ff −→ , defined by fA (r) = fA (r) and homomorphisms fA : A : K p P ^ e fA (r̃) = fA (r) for each r ∈ R, are injective. Let S be a multiplicative subset of R. Recall that the localization of A by S is the S −1 R-algebra S −1 A := S −1 R⊗R A. Our first result proves that S −1 A is isomorphic to a localization of A by a multiplicative subset S of A. By virtue of this lemma, we deduce that, for any multiplicative subset S of R, S −1 A enjoys all properties satisfied by the well known localization by a multiplicative subset of A. Lemma 2.1. Let R be a ring and A an R-algebra. Let S be a multiplicative subset of R. Let S := fA (S) denote the the correspondingmultiplicativesubset of A. Then X ri X r i ai −1 the natural map ϕ : S −1 A −→ S A such that ϕ ⊗ R ai = , for si fA (si ) i∈Λ i∈Λ any finite set Λ, any {ri : i ∈ Λ} ⊆ R, {si : i ∈ Λ} ⊆ S and {ai : i ∈ Λ} ⊆ A, is an isomorphism of R-algebras. −1 Proof. to see that the mapping f : S −1 R × A −→ S A such that  r It is easy ra is well defined and is R-biadditive. This yields the existence of f ,a = s fA (s) the assigned homomorphism ϕ of R-algebras. Also, to check that the  a  it isroutine a  1 −1 −1 map g : S A −→ S R ⊗R A defined by g := g = ⊗R a for each fA (s) s.1A s a ∈ A and each s ∈ S is an homomorphism of R-algebras. Then observe that ϕ ◦ g = idS −1 A and g ◦ ϕ = idS −1 A . Hence ϕ is an isomorphism of R-algebras. The above discussion allows us to announce the following lemma which collects certain properties and facts about fibre rings. These properties were stated in [10, 5 Local dimension theory of algebras page 84] in the Noetherian setting but in fact they hold in the general case. Lemma 2.2. Let R be a ring and let A be an R-algebra. Let p be a prime ideal of R R. Let Sp := \ {0}. Then p A A P 1) kR (p) ⊗R A ∼ := Sp−1 and kR (p) ⊗R P ∼ for each prime = Sp−1 = Sp−1 pA fA (p)A pA ideal P of A such that fA−1 (P ) = p. 2) Spec(kR (p) ⊗R A) = {kR (p) ⊗R P : P ∈ Spec(A) such that fA−1 (P ) = p}. 3) There exists an order-preserving bijective correspondence between the spectrum of kR (p) ⊗R A and the set of prime ideals of A which contract to p over R. 4) Let P be a prime ideal of A and let p := fA−1 (P ). Then (kR (p) ⊗R A)kR (p)⊗R P ∼ = kR (p) ⊗R AP . 5) Let P be a prime ideal of A and let p := fA−1 (P ). Then A kR (p) ⊗R A ∼ = kR (p) ⊗R . kR (p) ⊗R P P Proof. In view of [10, p. 84], it remains to give a proof of (4) and (5). 4) Let P be a prime ideal of A and p := fA−1 (P ). Consider the multiplicative subset T := R \ p of R. Then, by (1), (kR (p) ⊗R A)kR (p)⊗R P ∼ = ∼ = ∼ = ∼ =  A Sp−1 P pA Sp−1 pA A P pA pA AP pAP R ⊗R AP . p Also, notice that, on the one hand, T −1 R ⊗R R ⊗R AP p R ∼ = T −1 ⊗R AP p R = Sp−1 ⊗R AP p = kR (p) ⊗R AP 6 Local dimension theory of algebras and, on the other, T −1 R ⊗R R ⊗R AP p R ⊗R (T −1 R ⊗R AP ) p R ∼ ⊗R T −1 AP = p R = ⊗R AP as fA (T ) ⊆ A \ P and thus each element of p fA (T ) is invertible in AP . ∼ = It follows that (kR (p) ⊗R A)kR (p)⊗R P ∼ = kR (p) ⊗R AP , as desired. 5) Let P be a prime ideal of A and p := fA−1 (P ). Then, by (1), kR (p) ⊗R A kR (p) ⊗R P ∼ = ∼ = ∼ = Sp−1 (A/pA) Sp−1 (P/pA) A Sp−1 P A A kR (p) ⊗R as p = (0). P P This completes the proof. Given an R-algebra A, it is to be noted that not all the prime ideals of R are essential in capturing the prime ideal structure of A over R. Actually, there are prime ideals and chains of prime ideals of R that have no effect on the structure of the spectrum of A (see Example 2.5). That is the reason why we introduce in what follows the notion of effective spectrum of R with respect to A and effective Krull dimension of R with respect to A. Definition 2.3. Let A be an R-algebra. 1) A prime ideal p of R is said to be an effective prime ideal of R with respect to A if the fibre ring kR (p) ⊗R A 6= {0}. 2) We define the effective spectrum of R with respect to A to be the set denoted by SpecA e (R) consisting of all effective prime ideals p of R with respect to A, namely, SpecA e (R) = {p ∈ Spec(R) : kR (p) ⊗R A 6= {0}}. A Also, we denote by MaxA e (R) the subset of maximal elements of Spece (R), that is, the set of maximal effective prime ideals of R with respect to A. 3) Let p ∈ SpecA e (R). We define the effective height of p with respect to A, denoted A by hte (p), to be the supremum of lengths of chains of effective prime ideals p0 ⊂ p1 ⊂ · · · ⊂ pn = p of R terminating at p. 4) We define the effective Krull dimension of R with respect to A to be the invariant 7 Local dimension theory of algebras denoted by dimA e (R) which is the supremum of effective heights of effective prime ideals of R with respect to A, that is, A A dimA e (R) = sup{hte (p) : p ∈ Spece (R)}. . The following result determines the effective spectrum of a ring R with respect to various constructions. Its proof is easy and thus omitted. −1 Proposition 2.4. 1) Let A be an R-algebra. Then SpecA e (R) = fA (Spec(A)) R[X ,X ,··· ,Xn ] 2) Let X1 , X2 , · · · , Xn be indeterminates over R. Then Spece 1 2 (R) = Spec(R). 3) Let R ֒→ A be an integral extension of rings. Then SpecA e (R) = Spec(R). −1 R S (R) = {p ∈ Spec(R) : p∩S = 4) Let S be a multiplicative subset of R. Then Spece ∅}. 5) Let A be an R-algebra and S be a multiplicative subset of A. Then   −1 −1 SpeceS A (R) = fA−1 {P ∈ Spec(A) : P ∩S = ∅} = fA−1 (SpeceS A (A)) ⊆ SpecA e (R). R 6) Let I be an ideal of R. Then SpeceI (R) = {p ∈ Spec(R) : I ⊆ p}. Next, for any positive integer n ≥ 2, we exhibit an example of a ring R and an Ralgebra A such that there exists a chain of distinct prime ideals p0 ⊂ p1 ⊂ · · · ⊂ pn in R with both ends p0 , pn ∈ SpecA e (R) while the intermediate elements p2 , · · · , pn−1 6∈ SpecA (R). It would be interesting to afford a ring T issued from R and A such that e A Spec(T ) = Spece (R). This task is not easy and it turns out from the next example that T is neither a localization of R nor a factor ring of R. Example 2.5. Let k be a field and t be an indeterminate over k. It is known, by [10, Lemma 1], that there exists an infinite number of formal power series g1 (t), g2 (t), · · · , gm (t), · · · of k[[t]] which are algebraically independent over k. In fact, we can choose the gi in the maximal ideal tk[[t]]. Actually, assume that g1 (t) = 1 + a1 t + a2 t2 + · · · + am tm + · · · ∈ k[[t]] \ tk[[t]]. Then, observe that h1 (t) := g1 (t) − 1 ∈ tk[[t]] and, for each integer i ≥ 2, hi (t) := gi (t) − gi (0)g1 (t) ∈ tk[[t]], and the formal power series h1 (t), h2 (t), · · · , hm (t), · · · are algebraically independent over k as k[h1 (t), hi1 (t), hi2 (t), · · · , hin (t)] = k[g1 (t), gi1 (t), gi2 (t), · · · , gin (t)] is a polynomial ring in n + 1 indeterminates for any finite subset {i1 , i2 , · · · , in } of N \ {0}. Therefore let g1 (t), g2 (t), · · · , gm (t), · · · ∈ tk[[t]] be algebraically independent elements over k. Let n ≥ 2 be an integer and X1 , X2 , · · · , Xn be Local dimension theory of algebras 8 indeterminates over k. Let R := k[X1 , X2 , · · · , Xn ] and A := k[[t]] be the formal power series ring over k which is a rank one discrete valuation ring and thus Spec(A) = {(0), tk[[t]]}. We endow A with the R-algebra structure induced by the ring homomorphism fA : R −→ A such that fA (Xi ) = gi (t) for each i = 1, 2, · · · , n. Therefore fA−1 (tk[[t]]) = (X1 , X2 , · · · , Xn ) is a maximal ideal of R of height n. Also, as g1 , g2 , · · · , gn are algebraically independent over k, it is readily checked that fA is injective. Hence fA−1 ((0)) = (0). It follows that SpecA e (R) = {(0), (X1 , X2 , · · · , Xn )} and, in particular, any prime ideal of R properly between (0) and the maximal ideal (X1 , X2 , · · · , Xn ) is not effective with respect to A, as desired . Remark 2.6. 1) Let A be an R-algebra. Then, for any A-algebra B, the natural −1 B map fA−1 : SpecB e (A) −→ Spece (R) is surjective while, in general, fA : Spec(A) −→ Spec(R) is not so. 2) Let A be an R-algebra. Then dimA e (R) ≤ dim(R) and this inequality might be strict as proved by Example 2.5 which shows that for any positive integer n ≥ 2 there exists a ring R and an R-algebra A such that dim(R) = n while dimA e (R) = 1, as desired. To get prepared for the general setting of tensor products, we next introduce local notions of well known concepts of the dimension theory of rings, namely the height of a prime ideal of a ring A, the spectrum of A and the Krull dimension of A. Definition 2.7. Let R be a ring and A be an R-algebra. 1) Let p ∈ SpecA e (R). Then a) Specp (A) := {I ∈ Spec(A) : fA−1 (I) = p} denotes the set of all prime ideals of A which contract to p over R. b) If I ∈ Specp (A), then the height of I at p, denoted by htp (I), is the maximum of lengths of chains I0 ⊂ I1 ⊂ · · · ⊂ In = I of prime ideals of A which contract to p over R. c) The Krull dimension of A at p is the invariant dimp (A) := max{htp (I) : I ∈ Specp (A)}. 2) We define the fibre Krull dimension of A with respect to R to be the maximal length of chains of prime ideals of A lying over a common (effective) prime ideal of R (with respect to A), that is the invariant f-dimR (A) = sup{dimp (A) : p ∈ SpecA e (R)}. By virtue of Lemma 2.2, we get the following result which connects the above local data of A with those relative to fibre rings issued from A. Local dimension theory of algebras 9 Corollary 2.8. Let R be a ring and A be an R-algebra. Let p ∈ Spec(R). Then 1) There exists an order-preserving bijective correspondence between Spec(kR (p) ⊗R A) and Specp (A). 2) If I ∈ Specp (A), then htp (I) = ht(kR (p) ⊗R I). 3) dimp (A) = dim(kR (p) ⊗R A). 4) f-dimR (A) = sup{dim(kA (p) ⊗R A) : p ∈ SpecA e (R)}. Next, given an R-algebra A, we give lower and upper bounds of the Krull dimension of A in terms of the Krull dimension of its fibre rings and the effective Krull dimension of R with respect to A. Observe that the formulas given in the following theorem are reminiscent of Seidenberg’s inequalities for the Krull dimension of polynomial rings. Recall that a ring homomorphism f : A −→ B is said to satisfy the Going-Down property (GD for short) if for any prime ideals p ⊆ q of A such that there exists Q ∈ Spec(B) with Q ∩ A = q, then there exists P ∈ Spec(B) such that P ∩ A = p and P ⊆ Q. It is then easy to see that if a ring homomorphism f : R −→ A satisfies GD and if p ∈ SpecA e (R), then any prime ideal q of R such that q ⊆ p is an effective prime ideal of R with respect to A, and thus htA e (p) = ht(p). Theorem 2.9. Let R be a ring and let A be an R-algebra. Then 1) f-dimR (A) ≤ dim(A) ≤ f-dimR (A) + (1 + f-dimR (A))dimA e (R). 2) If the homomorphism fA : R −→ A satisfies the Going-down property, then, A sup{ht(p)+dimp (A) : p ∈ SpecA e (R)} ≤ dim(A) ≤ f-dimR (A)+(1+f-dimR (A))dime (R). Proof. 1) It suffices to prove the second inequality. If either dimA e (R) = +∞ or fdimR (A) = +∞, then we are done. Assume that dimA (R) < +∞ and f-dimR (A) < e +∞. Let P0 ⊂ P1 ⊂ · · · ⊂ Pn be a chain of distinct prime ideals of A. Then the corresponding chain of contractions p0 ⊂ p1 ⊂ · · · ⊂ pr is composed of effective prime ideals of R with respect to A. Observe that the number of the Pi ’s lying over a fixed prime pj is inferieur than or equal to the Krull dimension of the fibre ring kR (pj ) ⊗R A plus one, that is, dimpj (A) + 1, and dimpj (A) ≤ f-dimR (A). Further, as p0 ⊂ p1 ⊂ · · · ⊂ pr is a chain composed of 1 + r effective prime ideals of R with respect to A and as r ≤ dimA e (R), we get n ≤ r(f-dimR (A) + 1) + f-dimR (A) ≤ f-dimR (A) + (f-dimR (A) + 1)dimA e (R). This yields the desired inequality. 2) Assume that fA satisfies GD. Let n := htA e (p) and p0 ⊂ p1 ⊂ · · · ⊂ pn = p be a chain of distinct effective primes of R with respect to A. Fixing P ∈ Specp (A) and applying the Going-down property yields the existence of a chain P0 ⊂ P1 ⊂ 10 Local dimension theory of algebras · · · ⊂ Pn = P such that each Pi ∈ Specpi (A) for i = 0, 1, · · · , n − 1. Then htA e (p) = n ≤ ht(P ) for each P ∈ Specp (A). Let Q0 ⊂ Q1 ⊂ · · · ⊂ Qr be a chain of Specp (A) such that r := dim(kR (p) ⊗R A) = dimp (A). Therefore, as by the first step htA e (p) = n ≤ ht(Q0 ), we get htA e (p) + dimp (A) ≤ ht(Q0 ) + r ≤ ht(Qr ) ≤ dim(A) for each effective prime ideal p of R. Hence, by (1), as htA e (p) = ht(p), we get the desired inequalities completing the proof. Next, we list various applications and consequences of Theorem 2.9. The first result gives a condition for coincidence of the Krull dimension of A and its fiber Krull dimension with respect to R. Corollary 2.10. Let A be an R-algebra. If dimA e (R) = 0, then dim(A) = f-dimR (A). We aim via the following corollaries to recover Seidenberg’s inequalities for polynomial rings. The next result might be termed Seidenberg’s inequalities for algebras over an arbitrary ring. Corollary 2.11. Let A be an R-algebra such that fA satisfies GD. Assume that f-dimR (A) = dimm (A) for each m ∈ MaxA e (R). Then A f-dimR (A) + dimA e (R) ≤ dim(A) ≤ f-dimR (A) + (1 + f-dimR (A))dime (R). Proof. Observe, by Theorem 2.9, that, in particular, sup{htA e (m)+dimm (A) : m ∈ A Maxe (R)} ≤ dim(A). Then, as f-dimR (A) = dimm (A) for each m ∈ MaxA e (R), A (R)}+f-dim (A) ≤ dim(A). Therefore sup{htA (m) : m ∈ Max R e e dimA e (R)+f-dimR (A) ≤ dim(A) establishing the desired inequalities. Next, we recover Seidenberg’s inequalities for polynomial rings. Corollary 2.12. Let R be a ring and let X1 , X2 , · · · , Xn be indeterminates over R. Then n + dim(R) ≤ dim(R[X1 , X2 , · · · , Xn ]) ≤ n + (n + 1)dim(R). Proof. Observe that the homomorphism R −→ R[X1 , X2 , · · · , Xn ] satisfies GD and R[X ,··· ,Xn ] R[X ,··· ,Xn ] Spece 1 (R) = Spec(R), thus dime 1 (R) = dim(R). Also, dimp (R[X1 , X2 , · · · , Xn ]) = = dim(kR (p) ⊗R R[X1 , X2 , · · · , Xn ]) dim(kR (p)[X1 , X2 , · · · , Xn ]) = n for each prime ideal p of R. Then f-dimR (R[X1 , X2 , · · · , Xn ]) = dimp (R[X1 , X2 , · · · , Xn ]) = n for each prime ideal p of R. Now, Corollary 2.11 completes the proof. Local dimension theory of algebras 3 11 Local and global Transcendence degree over an arbitrary ring In this section we introduce the local and global transcendence degree of algebras over an arbitrary ring. Recall that if k is a field, then it is customary to denote by n A  o t.d.(A : k) := sup t.d. : k : p ∈ Spec(A) p = sup{t.d.(kA (p) : k) : p ∈ Spec(A)} the transcendence degree of a k-algebra A over k. This section aims at giving a definition of the notion of the transcendence degree of an R-algebra A over R in accordance with the field case. In the same spirit of Definition 2.7 and in order to prepare the ground for the general case of tensor products over an arbitrary ring, we next introduce a local notion of the transcendence degree of an R-algebra A over R as well as the “general” transcendence degree of A over R which turns out to be in total accordance with the well known notion of the transcendence degree over a field. Definition 3.1. Let R be a ring and A an R-algebra. 1) Let p ∈ SpecA e (R). We define the transcendence degree at p of A over R to be the the transcendence degree of the fibre ring kR (p) ⊗R A (over p) over the field kR (p), that is,   t.d.p (A : R) := t.d. kR (p) ⊗R A : kR (p) . 2) We define the transcendence degree of A over R to be the supremum of the transcendence degrees of A over R at effective prime ideals p of R with respect to A, that is, A t.d.(A : R) := sup{t.d. (R)} n p(A : R) : p ∈ Spece  o = sup t.d. kR (p) ⊗R A : kR (p) : p ∈ SpecA e (R) . We will next prove that the transcendence degree of an R-algebra A over R depends on the endowing structure of algebra of A over R, namely on the ring homomorphism fA . The following proposition shows that the transcendence degree over a ring R at an effective prime ideal of R shares all known properties of the transcendence degree over a field k. Notice that, when P is a prime ideal of an R-algebra A and A R and a subring of which p := fA−1 (P ), then fA induces an isomorphism between p P R A means that might be identified with a subring of . p P Local dimension theory of algebras Proposition 3.2. Let A be an R-algebra. 1) If P is a prime ideal of A and p := fA−1 (P ), then    A R A = t.d. kA (P ) : kR (p) . : R = t.d. : t.d.p P P p 2) Let p ∈ SpecA (R). Then, e A n  o t.d.p (A : R) = sup t.d.p : R : P ∈ Specp (A) . P 3) If P is a prime ideal of A with p := fA−1 (P ), then A n  o t.d.p (AP : R) = sup t.d.p : R : Q ∈ Specp (A) such that Q ⊆ P n Q  o = sup t.d. kA (Q) : kR (p) : Q ∈ Specp (A) with Q ⊆ P 4) t.d.(A : R) = = A n  o sup t.d.p : R : p ∈ Spec(R) and P ∈ Specp (A) o n  AP R  : p ∈ Spec(R) and P ∈ Specp (A) . : sup t.d. P p R \ {0} for each prime ideal p of R. p 1) Let P be a prime ideal of A and let p := fA−1 (P ). Then,    A A :R = t.d. kR (p) ⊗R : kR (p) t.d.p P P   A/P −1 = t.d. Sp : kR (p) (Lemma 2.2(1)) p(A/P )   A A A −1 : kR (p) as p = fA (p) = {0} = t.d. Sp P P A P R , : = t.d. P p Proof. Let Sp = as desired. 2) Let p ∈ SpecA e (R). Then, by (1) and Lemma 2.2((2) and (5)),   t.d.p (A : R) := t.d. kR (p) ⊗R A : kR (p) n  k (p) ⊗ A  o R R = sup t.d. : kR (p) : P ∈ Specp (A)  o n  kR (p) ⊗R P A : kR (p) : P ∈ Specp (A) = sup t.d. kR (p) ⊗R A n  P o = sup t.d.p : R : P ∈ Specp (A) n  AP R  o = sup t.d. : P ∈ Specp (A) . : P p 12 Local dimension theory of algebras 13 3) Let P be a prime ideal of A and p := fA−1 (P ). Then, by (1) and (2), n A o R P t.d.p (AP : R) = sup t.d. : Q ∈ Specp (A) such that Q ⊆ P : p P o n Q A R : Q ∈ Specp (A) such that Q ⊆ P : = sup t.d. QA p  n o = sup t.d.p : R : Q ∈ Specp (A) such that Q ⊆ P . Q 4) It follows easily from (1) and (2) completing the proof. It is notable that the introduced notion of transcendence degree of A over R depends on the structure of R-algebra over A, namely, on the ring homomorphism fA , as shown by the following simple example. Example 3.3. Let k be a field and X an indeterminate over k. Let R = k[X] × k and let A = k(X). Consider the following ring homomorphisms f1 , f2 : R −→ A such that f1 (g(X), α) = g(X) and f2 (g(X), α) = α. These two homomorphisms define two different R-algebra structures over A. Moreover, observe that f1−1 ((0)) = (0)×k (A,f ) (A,f ) and f2−1 ((0)) = k[X] × (0). Then Spece 1 (R) = {(0) × k} and Spece 2 (R) = {k[X] × (0)}. Hence, by Proposition 3.2(4),  k[X] × k  t.d.(A :f1 R) = t.d. k(X) : (0) × k = t.d.(k(X) : k[X]) = 0 while 4  k[X] × k  t.d.(A :f2 R) = t.d. k(X) : k[X] × (0) = t.d.(k(X) : k) = 1. Effective spectrum with respect to tensor products Let R be a ring and let A and B be R-algebras. First, it is worth to note that the tensor product A ⊗R B over R might be trivial even if A and B are not so. Of course, the interesting case is when A ⊗R B 6= {0} which makes it legitimate to introduce the notion of a triplet of rings (R, A, B) consisting of a given ring R and two R-algebras A and B such that A ⊗R B 6= {0}. Let A and B be R-algebras. We denote by µA : A −→ A ⊗R B and µB : B −→ A ⊗R B the canonical algebra homomorphisms over A and B, respectively, such that µA (a) = a ⊗R 1 and µB (b) = 1 ⊗R b for each a ∈ A and each b ∈ B. Observe that the following diagram (D) is commutative: 14 Local dimension theory of algebras A fA µA ր ց fA⊗R B −→ R fB A ⊗R B µB ց ր B From this section onward, given ideals I, J, H of A, B and A ⊗R B, respectively, we adopt the following notation for easiness: I ∩ R := fA−1 (I), J ∩ R := fB−1 (J) and −1 H ∩ A := µ−1 A (H), H ∩ B := µB (H). We begin by recording the following isomorphisms related to the fiber rings of the tensor products over an arbitrary ring R. Lemma 4.1. Let R be a ring. Let A and B be algebras over R. Then B  A ⊗kR (p) Sp−1 kR (p)⊗R (A⊗R B) ∼ = (kR (p)⊗R A)⊗kR (p) (kR (p)⊗R B) ∼ = Sp−1 pA pB where Sp := R \ {0}. p Proof. It is direct by Lemma 2.2(1). Remark. Let R be a ring and A, B be two R-algebras. Let I be a prime ideal of A. Notice that, by considering the ring homomorphism µA : A −→ A ⊗R B, kA (I) ⊗R B ∼ = kA (I) ⊗A (A ⊗R B) stands for the fibre ring of A ⊗R B over I. Thus f-dimA (A ⊗R B) = sup{dim(kA (I) ⊗R B) : I ∈ SpeceA⊗R B (A)}. The next theorem examines the effective spectrum of a ring with respect to tensor products. Theorem 4.2. Let R be a ring. Let A and B be two R-algebras. Let p ∈ Spec(R), I ∈ Spec(A) and J ∈ Spec(B). Then B 1) SpeceA⊗R B (R) = SpecA e (R)∩ Spece (R). 2) There exists a prime ideal P of A ⊗R B such that P ∩ A = I and P ∩ B = J if and only if I ∩ R = J ∩ R. 3) SpeceA⊗R B (A) = {I ∈ Spec(A) : I ∩ R ∈ SpecB e (R)} = {I ∈ Spec(A) : ∃J ∈ Spec(B) such that I ∩ R = J ∩ R}. Local dimension theory of algebras 15 Proof. 1) Let p ∈ SpeceA⊗R B (R). Then there exists a prime ideal P of A ⊗R B such that p = P ∩ R. Let I = P ∩ A and J = P ∩ B. Then, by the above commutative diagram (D), I and J are prime ideals of A and B, respectively, such B that I ∩ R = J ∩ R = P ∩ R = p, that is, p ∈ SpecA e (R)∩ Spece (R). Conversely, A B assume that p ∈ Spece (R)∩ Spece (R). Hence, by Lemma 4.1, the fibre ring kR (p) ⊗R (A ⊗R B) ∼ = (kR (p) ⊗R A) ⊗kR (p) (kR (p) ⊗R B) 6= {0} as the fibre rings kR (p) ⊗R A and kR (p) ⊗R B are not trivial. It follows that p ∈ SpeceA⊗R B (R), as desired. 2) See [8, Corollaire 3.2.7.1.(i)]. 3) First, let I ∈ Spec(A) such that I ∩ R ∈ SpecB e (R). Then, there exists J ∈ Spec(B) such that I ∩ R = J ∩ R so that by (2), there exists P ∈ Spec(A ⊗R B) R B (A). Conversely, let such that P ∩ A = I (and P ∩ B = J). Thus I ∈ SpecA⊗ e A⊗ B I ∈ Spece R (A). Then there exists P ∈ Spec(A ⊗R B) such that P ∩ A = I, so that, using the above commutative diagram (D), I ∩ R = P ∩ R = (P ∩ B) ∩ R ∈ SpecB e (R) completing the proof. The following corollary totally characterizes when two algebras A and B over a ring R constitute a triplet (R, A, B) of rings. Corollary 4.3. Let R be a ring and A, B be two R-algebras. Then the following assertions are equivalent: 1) (R, A, B) is a triplet of rings; B 2) SpecA e (R)∩ Spece (R) 6= ∅; 3) There exists a prime ideal I of A and a prime ideal J of B such that I ∩ R = J ∩ R. Proof. 1) ⇔ 2) It suffices to observe that, by Proposition 2.4(1) and Theorem 4.2, B −1 (Spec(A ⊗R B)) = SpeceA⊗R B (R) = SpecA fA⊗ e (R) ∩ Spece (R). RB 2) ⇔ 3) It is direct. It is easy to provide examples of nontrivial algebras over a ring R such that A ⊗R B = {0} is trivial. But Corollary 4.3 characterizes when this tensor product A ⊗R B is trivial by checking connections between the spectrum of the three components of this construction, namely Spec(R), Spec(A) and Spec(B). For instance, given a ring R and two distinct prime ideals p and q of R, applying Corollary 4.3, k (p) k (q) note that kR (p) ⊗R kR (q) = {0} since Spece R (R) = {p} while Spece R (R) = {q} k (p) k (q) and thus Spece R (R)∩ Spece R (R) = ∅. Local dimension theory of algebras 16 Corollary 4.4. Let (R, A, B) be a triplet of rings. Then B dimeA⊗R B (R) ≤ min(dimA e (R), dime (R)). A⊗R B (R) = 0. B In particular, if either dimA e (R) = 0 or dime (R) = 0, then dime R B (R) = SpecA (R)∩ SpecB (R). Proof. It is straightforward from Theorem 4.2 as SpecA⊗ e e e The next proposition allows us to give lower and upper bounds of the Krull dimension of tensor products of algebras over a ring R in terms of the Krull dimension of its fibre rings and the effective Krull dimension of its components. Proposition 4.5. Let (R, A, B) be a triplet of rings. Then 1) f-dimR (A⊗R B) ≤ dim(A⊗R B) ≤ f-dimR (A⊗R B)+(1+f-dimR (A⊗R B))dimeA⊗R B (R). 2) f-dimA (A⊗R B) ≤ dim(A⊗R B) ≤ f-dimA (A⊗R B)+(1+f-dimA (A⊗R B))dimeA⊗R B (A). Proof. It follows from Theorem 2.9(1). In light of Proposition 4.5, when the effective Krull dimension of a component of a tensor product with respect to this construction is zero, the Krull dimension of the tensor product turns out to be its own fibre Krull dimension. This result will allow us to explicit the Krull dimension of the tensor products involving the ahead introduced notion of fibred AF-rings. Corollary 4.6. Let (R, A, B) be a triplet of rings. 1) If dimeA⊗R B (R) = 0, then dim(A ⊗R B) = f-dimR (A ⊗R B). 2) If dimeA⊗R B (A) = 0, then dim(A ⊗R B) = f-dimA (A ⊗R B). Proof. It follows easily from Proposition 4.5. 5 Fibred AF-rings This section introduces and studies the notion of fibred AF-rings over an arbitrary ring R. This new concept extends that of AF-ring over a field introduced by A. Wadsworth in [14]. Local dimension theory of algebras 17 Definition 5.1. Let R be a ring. 1) Let A be an R-algebra and p ∈ SpecA e (R). A is said to be a fibred AF-ring at p if its fiber ring kR (p) ⊗R A is an AF-ring over kR (p). 2) An R-algebra A is said to be a fibred AF-ring over R if it is a fibred AF-ring at each effective prime ideal p of R with respect to A, that is, if each nontrivial fibre ring kR (p) ⊗R A is an AF-ring over kR (p). 3) Let (R, A, B) be a triplet of rings. B a) If p ∈ SpecA e (R)∩ Spece (R) and A is a fibred AF-ring at p, then A is said to be a B-fibred AF-ring at p. b) A is said to be a B-fibred AF-ring over R if A is a B-fibred AF-ring at each common effective prime ideal p of R with respect to A and B. Remark. 1) From this definition, it is clear that the notion of a fibred AF-ring extends that of an AF-ring introduced by Wadsworth as any algebra A over a field k possesses only one fiber ring over k which is A itself. 2) Note that the notion of B-fibred AF-ring is inherent to the considered triplet of rings (R, A, B) and it is easy to see that the following assertions are equivalent: a) A is a fibred AF-ring over R; c) A is a B-fibred AF-ring over R for any R-algebra B such that (R, A, B) is a triplet; c) A is an R-fibred AF-ring over R. Let k be a field and A be a k-algebra. Recall that, for each prime ideal P of A,  A : k ≤ t.d.(AP : k) and A is said to be an AF-ring if this inequality ht(P )+t.d. P  A : k = t.d.(AP : k) for each turns out to be an equality, that is, ht(P )+t.d. P prime ideal P of A. Next, we show that these properties translate into local data for algebras over an arbitrary ring R. Proposition 5.2. Let R be a ring and let p be a prime ideal of R. Let A be an R-algebra. 1) If P is a prime ideal of A such that P ∩ R = p, then  A : R ≤ t.d.p (AP : R). htp (P ) + t.d.p P 2) Let B be an R-algebra such that (R, A, B) is a triplet of rings. Assume that p ∈ A B SpecA e (R) (resp., p ∈ Spece (R)∩ Spece (R)). Then A is a fibred AF-ring (resp., B-fibred AF-ring) at p if and only if A  htp (P ) + t.d.p : R = t.d.p (AP : R) P for each prime ideal P of A such that p = P ∩ R. Local dimension theory of algebras 18 Proof. 1) Let P be a prime ideal of A such that P ∩ R = p. Then, by Lemma 2.2, htp (P ) + t.d.p A P :R    A = ht(kR (p) ⊗R P ) + t.d. kR (p) ⊗R : kR (p)   k (p) ⊗ P R RA : kR (p) = ht(kR (p) ⊗R P ) + t.d. kR (p) ⊗R P  ≤ t.d. (kR (p) ⊗R A)kR (p)⊗R P : kR (p)   = t.d. kR (p) ⊗R AP : kR (p) = t.d.p (AP : R), as desired. 2) It is direct from Definition 5.1 taking into account the following equalities which A   k (p) ⊗ A  R R figure in Lemma 2.2: t.d.p : R = t.d. : kR (p) and t.d.p (AP : P kR (p) ⊗R P   R) = t.d. kR (p) ⊗R A)kR (p)⊗R P : kR (p) for each prime ideal P of A with p := P ∩ R. The following result exhibits various classes of fibred AF-rings. Proposition 5.3. 1) If k is a field, then the fibred AF-rings over k are exactly the AF-rings over k. 2) Any finitely generated R-algebra R[x1 , x2 , ..., xn ] is a fibred AF-ring over R. 3) Let (R, A, B) be a triplet of rings. If dimeA⊗R B (A) = 0, then A is a B-fibred AF-ring over R. 4) Any zero-dimensional ring A which is an R-algebra is a fibred AF-ring over R. Proof. 1) It is straightforward. 2) Let A = R[X1 , X2 , · · · , Xn ] be a polynomial ring in n-variables over R. Let p ∈ Spec(R). Then kR (p) ⊗R A ∼ = kR (p)[X1 , X2 , ..., Xn ] is clearly an AF-ring over kR (p) [14, Corollary 3.2]. Hence A is a fibred AF-ring over R. Now, let A = R[x1 , x2 , · · · , xn ] be any finitely generated R-algebra and let p ∈ Spec(R). Then R[X1 , X2 , · · · , Xn ] for some ideal I of R[X1 , X2 , · · · , Xn ] and thus, by Lemma A∼ = I Local dimension theory of algebras 19 2.2, R[X1 , X2 , · · · , Xn ] kR (p) ⊗R A ∼ = kR (p) ⊗R I R[X1 , X2 , · · · , Xn ] ∼ = (kR (p) ⊗R R[X1 , X2 , · · · , Xn ]) ⊗R[X1 ,X2 ,··· ,Xn ] I ∼ = kR (p)[X1 , X2 , · · · , Xn ] := kR (p)[y1 , y2 , · · · , yn ], where yi := Xi IkR (p)[X1 , X2 , · · · , Xn ] for each i = 1, 2, · · · , n, is a finitely generated kR (p)-algebra which is an AF-ring over kR (p) by [14, page 395]. Hence A is a fibred AF-ring over R proving (2). R B (A) = 0. Let 3) Let (R, A, B) be a triplet of rings such that dimA⊗ e A⊗R B (R). Let P be a prime ideal of A such that B p ∈ SpecA e (R)∩ Spece (R) = Spece P ∩ R = p. Then, by Proposition 3.2, o n A R : Q ∈ Specp (A) with Q ⊆ P . : t.d.p (AP : R) = sup t.d. Q p R B (R), by Let Q ⊆ P be a prime ideal of A with Q ∩ R = p. Then, as p ∈ SpecA⊗ e A⊗ B A⊗ B Theorem 4.2(3), Q ∈ Spece R (A). Now, since dime R (A) = 0, we get Q = P . Therefore, by Proposition 3.2, A R A  t.d.p (AP : R) = t.d. = t.d.p : :R . P p P P  R B (A) = 0, ht Also, as dimA⊗ = 0 since any prime ideal Q such that pA ⊆ e pA Q ⊆ P is an effective prime ideal of A with respect to A ⊗R B (see Theorem 4.2(3)). P  Then, by Corollary 2.8 , htp (P ) = ht = 0. It follows that pA  A : R = t.d.p (AP : R). htp (P ) + t.d.p P Then, by Proposition 5.2, A is a B-fibred AF-ring over R, as desired. 4) Note that if dim(A) = 0, then, in particular, dimeA⊗R B (A) = 0 for any triplet (R, A, B) of rings. Hence, by (3), A is a B-fibred AF-ring over R for any R-algebra B such that (R, A, B) is a triplet of rings. In particular for B = R, A is an R-fibred AF-ring over R which means that A is a fibred AF-ring over R, as desired. We next establish the stability of the fibred AF-ring notion under various type of constructions. Local dimension theory of algebras 20 Proposition 5.4. Let R be a ring and let A be an R-algebra. Let p be a prime ideal of R. 1) If A is a fibred AF-ring at p and S is a multiplicative subset of A such that p ∈ −1 SpecSe A (R), then the localization S −1 A is a fibred AF-ring at p. 2) Let A1 , A2 , ..., An be fibred AF-rings at p. Then A1 ⊗R A2 ⊗R · · · ⊗R An is a fibred AF-ring at p. 3) If A is a fibred AF-ring at p, then the polynomial ring A[X1 , X2 , ..., Xn ] is a fibred AF-ring at p. Proof. 1) Let A be a fibred AF-ring at p and S be a multiplicative subset of A such that kR (p) ⊗R S −1 A 6= {0}. Then, by Proposition 2.4(5), there exists P ∈ Spec(A) such that P ∩ S = ∅ and p = P ∩ R. Let S be the image of S via the homomorphism P A . Observe that pA ∩ S = ∅ and ∩ S = ∅. Then, by Lemma 2.2, A −→ pA pA  S −1 A R    S −1 P   S −1 A + t.d. = ht : htp (S −1 P ) + t.d.p −1 : R −1 −1 P S P p  pS PA  S  A R −1 = ht S + t.d. : p A P   P pA R + t.d. : = ht pA P p A :R = htp (P ) + t.d.p P = t.d.p (AP : R) as A is a fibred AF-ring at p. Moreover, note that t.d.p ((S −1 A)S −1 P : R) = t.d.p (AP : R). It follows that  S −1 A  htp (S −1 P ) + t.d.p −1 : R = t.d.p ((S −1 A)S −1 P : R). S P Hence S −1 A is a fibred AF-ring at p. 2) Let p be a prime ideal of R. Then kR (p) ⊗R (A1 ⊗R · · · ⊗R An ) ∼ = (kR (p) ⊗R A1 ) ⊗kR (p) (kR (p) ⊗R (A2 ⊗R · · · ⊗R An )) ∼ = (kR (p) ⊗R A1 ) ⊗kR (p) · · · ⊗kR (p) (kR (p) ⊗R An ). First, as each kR (p) ⊗R Ai 6= {0}, kR (p) ⊗R (A1 ⊗R A2 ⊗R · · · ⊗R An ) 6= {0}. Hence, since each kR (p) ⊗R Ai is an AF-ring over kR (p), we get, by [14, Proposition 3.1], (kR (p) ⊗R A1 ) ⊗kR (p) · · · ⊗kR (p) (kR (p) ⊗R An ) is an AF-ring over kR (p) so that kR (p)⊗R (A1 ⊗R · · · ⊗R An ) is an AF-ring over kR (p). It follows that A1 ⊗R · · · ⊗R An is a fibred AF-ring at p. 3) It follows easily from (2) as A[X1 , X2 , ..., Xn ] ∼ = R[X1 , X2 , ..., Xn ] ⊗R A and, by Proposition 5.3(2), R[X1 , X2 , ..., Xn ] is a fibred AF-ring at p. Local dimension theory of algebras 21 Corollary 5.5. Let R be a ring. 1) If A is a fibred AF-ring over R and S is a multiplicative subset of A, then the localization S −1 A is a fibred AF-ring over R. 2) Let A1 , A2 , ..., An be fibred AF-rings over R. Then A1 ⊗R A2 ⊗R · · · ⊗R An is a fibred AF-ring over R. 3) If A is a fibred AF-ring over R, then the polynomial ring A[X1 , X2 , ..., Xn ] is a fibred AF-ring over R. The following two corollaries give the B-fibred AF-ring versions of the above Proposition 5.4 and Corollary 5.5. Their proofs are straightforward. Corollary 5.6. Let (R, A, B) be a triplet of rings. Let p be a prime ideal of R. 1) If A is a B-fibred AF-ring at p and S is a multiplicative subset of A such that −1 p ∈ SpecSe A (R), then the localization S −1 A is a B-fibred AF-ring at p. 2) Let A1 , A2 , ..., An be B-fibred AF-rings at p. Then A1 ⊗R A2 ⊗R · · · ⊗R An is a B-fibred AF-ring at p. 3) If A is a B-fibred AF-ring at p, then the polynomial ring A[X1 , X2 , ..., Xn ] is a B-fibred AF-ring at p. Corollary 5.7. Let (R, A, B) be a triplet of rings. 1) If A is a B-fibred AF-ring over R and S is a multiplicative subset of A, then the localization S −1 A is a B-fibred AF-ring over R. 2) Let A1 , A2 , ..., An be B-fibred AF-rings over R. Then A1 ⊗R A2 ⊗R · · · ⊗R An is a B-fibred AF-ring over R. 3) If A is a B-fibred AF-ring over R, then the polynomial ring A[X1 , X2 , ..., Xn ] is a B-fibred AF-ring over R. 6 Krull dimension of tensor products involving fibred AF-rings The goal of this section is to discuss and compute the Krull dimension of the tensor product of algebras over R involving fibred AF-rings in various settings. The following theorem allows to compute the Krull dimension of all fibre rings of the tensor product of algebras A and B over a ring R in the case when A is a fibred AF-ring over R. This result translates Wadsworth theorem [14, Theorem 3.7] into the general setting of tensor products over an arbitrary ring R. We give the next more general version of a triplet (R, A, B) of rings such that A is a B-fibred AF-ring over an effective prime ideal p of R. Local dimension theory of algebras 22 Notation. 1) Let A be a ring and P be a prime ideal of A. Let n ≥ 1 be a positive integer. Then, for easiness of notation, we denote by A[n] the polynomial ring in n indeterminates A[X1 , X2 , · · · , n] and by P [n] the extended prime ideal P [X1 , X2 , · · · , Xn ] of A[X1 , X2 , · · · , Xn ]. 2) Let A be an algebra over a field k. Let 0 ≤ d ≤ s be positive integers. Then, in [14], Wadsworth adopted the following notation:  o n  A :k : P ∈ Spec(A) . D(s, d, A) := sup ht(P [s]) + min s, d + t.d. P 3) Let A be an algebra over a ring R and p be a prime ideal of R. Let 0 ≤ d ≤ s be positive integers. Then, we adopt the following notation for a local invariant of the above D(s, d, A): Dp (s, d, A) := D(s, d, kR (p) ⊗R A). We begin by expliciting the local invariant Dp (s, d, A) in terms of the local invariants of the height and transcendence degree. Lemma 6.1. Let R be a ring. Let A be an algebra over R and p be a prime ideal of R. Let 0 ≤ d ≤ s be positive integers. Then  o A n  : R : P ∈ Specp (A) . Dp (s, d, A) = sup htp (P [s]) + min s, d + t.d.p P It is worth noting that if A and B are algebras over a ring R and X1 , X2 , · · · , Xn are indeterminates, then (A ⊗R B)[X1 , X2 , · · · , Xn ] ∼ = A ⊗R B ⊗R R[X1 , X2 , · · · , Xn ] ∼ = A[X1 , X2 , · · · , Xn ] ⊗R B ∼ = A ⊗R B[X1 , X2 , · · · , Xn ]. Proof. Observe that, using Lemma 2.2 and Corollary 2.8, Dp (s, d, A) = D(s, d, kR (p) ⊗R A) n   k (p) ⊗ A  R R = sup ht(kR (p) ⊗R P )[s] + min s, d + t.d. : kR (p) : kR (p) ⊗R P o P ∈ Specp (A)  n   A : kR (p) : = sup ht(kR (p) ⊗R (P [s])) + min s, d + t.d. kR (p) ⊗R P o P ∈ Specp (A) A n   o = sup htp (P [s]) + min s, d + t.d.p : R : P ∈ Specp (A) , P as desired. Local dimension theory of algebras 23 Recall that Wadsworth proved in [14] that, given a field k, if A is an AF-domain and B is any k-algebra, then dim(A ⊗k B) = D(t.d.(A), dim(A), B)[14, Theorem 3.7]. We generalized this result in [1] to AF-rings by proving that if A is an AF-ring and B is any k-algebra, then, n   o dim(A⊗k B) = sup D t.d.(AP : k), dim(AP ), B : P ∈ Spec(A) [1, Theorem 1.4]. Our first main result gives a new version of the above-cited Wadsworth theorem in the general setting of tensor products of algebras over an arbitrary ring R. B Theorem 6.2. Let (R, A, B) be a triplet of rings and let p ∈ SpecA e (R)∩ Spece (R). Assume that A is a B-fibred AF-ring at p. Then  o n  dimp (A ⊗R B) = sup Dp t.d.p (AI : R), htp (I), B : I ∈ Specp (A) . Proof. Observe that kR (p) ⊗R (A ⊗R B) ∼ = (kR (p) ⊗R A) ⊗kR (p) (kR (p) ⊗R B) and that kR (p) ⊗R A is an AF-ring over the field kR (p). Then, using [1, Theorem 1.4], we get, by Lemma 2.2(4),   dim(kR (p) ⊗R (A ⊗R B)) = dim (kR (p) ⊗R A) ⊗kR (p) (kR (p) ⊗R B) n    = sup D t.d. (kR (p) ⊗R A)kR (p)⊗R I : kR (p) ,  o ht(kR (p) ⊗R I), kR (p) ⊗R B : I ∈ Specp (A) n   = sup D t.d.p (AI : R), htp (I), kR (p) ⊗R B : o I ∈ Specp (A)  n  = sup Dp t.d.p (AI : R), htp (I), B : o I ∈ Specp (A) , as desired. The following corollaries compute the Krull dimension of tensor products involving algebras whose (effective) Krull dimension is zero. It is clear that if dim(A) = 0, then for any nontrivial A-algebra C, dimC e (A) = 0. Also, in Example 6.6, we record the existence of various cases of triplets of rings (R, A, B) such that either dimeA⊗R B (R) = 0 or dimeA⊗R B (A) = 0. Local dimension theory of algebras 24 Corollary 6.3. Let (R, A, B) be a triplet of rings such that A is a B-fibred AF-ring and dimeA⊗R B (R) = 0 (in particular, dim(R) = 0). Then,  n  B dim(A ⊗R B) = sup Dp t.d.p (AI : R), htp (I), B : p ∈ SpecA e (R) ∩ Spece (R) and o I ∈ Specp (A) . R B (R) = 0, by Corollary 4.6(1), Proof. As dimA⊗ e dim(A ⊗R B) = f-dimR (A ⊗R B) = sup{dimp (A ⊗R B) : p ∈ SpeceA⊗R B (R)}. Then, Theorem 6.2 completes the proof. Corollary 6.4. Let (R, A, B) be a triplet of rings such that A is a B-fibred AF-ring B and either dimA e (R) = 0 or dime (R) = 0. Then,  n  B dim(A ⊗R B) = sup Dp t.d.p (AI : R), htp (I), B : p ∈ SpecA e (R) ∩ Spece (R) and o I ∈ Specp (A) . Proof. It is straightforward by Corollary 4.4 and Corollary 6.3. We devote the following theorem to the case where one component of a tensor product is a zero-dimensional ring. Theorem 6.5. Let (R, A, B) be a triplet of rings such that dimeA⊗R B (A) = 0 (in particular, dim(A) = 0). Then  n  B dim(A ⊗R B) = sup Dp t.d.p (kA (I) : R), 0, B : p ∈ SpecA e (R) ∩ Spece (R) and o I ∈ Specp (A) . R B (A) = 0, by Corollary 4.6(2), Proof. As dimA⊗ e dim(A ⊗R B) = f-dimA (A ⊗R B) . = sup{dim(kA (I) ⊗R B) : I ∈ SpeceA⊗R B (A)} Let I ∈ SpeceA⊗R B (A) and p := I ∩ R. Note that, by Proposition 5.3, kA (I), being R B (A), then p ∈ zero-dimensional, is a fibred AF-ring over R. Also, as I ∈ SpecA⊗ e A⊗ B R Spece (R). Therefore, Theorem 6.2 yields dimp (kA (I) ⊗R B) = Dp (t.d.p (AI : R), htp (I), B). 25 Local dimension theory of algebras R B (R), by Theorem 4.2(3), any J ∈ Spec (A) is an effective Now, since p ∈ SpecA⊗ p e R B (A) = 0, we get prime ideal of A with respect to A ⊗R B. Therefore, since dimA⊗ e htp (I) = ht( k (p) I ) = 0. pA k (p)⊗ B R Furthermore, as dime A (R) = 0, we get, by Corollary 4.4, dime A (R) = 0. It follows, by Corollary 4.6(1) and as kA (I) ⊗R B possesses only one fibre ring which is kR (p) ⊗R (kA (I) ⊗R B), that dim(kA (I) ⊗R B) = f-dimR (kA (I) ⊗R B) = dimp (kA (I) ⊗R B) = Dp (t.d.p (AI : R), htp (I), B) = Dp (t.d.p (AI : R), 0, B). Consequently, dim(A⊗R B) = sup{Dp (t.d.p (AI : R), 0, B) : p ∈ SpeceA⊗R B (R) and I ∈ Specp (A)} R B (R) = SpecA (R)∩ SpecB (R). completing the proof as, by Theorem 3.3, SpecA⊗ e e e Example 6.6. 1) Let R := Z and A, B be rings such that (Z, A, B) is a triplet of rings. Let char(A) = n and char(B) = m such that n 6= 0 and m 6= 0. Then SpeceA⊗Z B (Z) = {pZ : p is a common prime divisor of n and m} and thus Z B (Z) = 0. dimA⊗ e 2) Let R := Z. Let n ≥ 1 be an integer. Let A = ZpZ +XQ[[X]] be a D+m construcZ tion issued from the local ring Q[[X]] = Q + XQ[[X]]. Let B be a -algebra and nZ let p be a prime divisor of n. Then, Spec(A) = {(0), XQ[[X]], pZpZ + XQ[[X]]} and A⊗Z B (Z) = {pZ} SpecB e (Z) = {qZ : q is a positive prime divisor of n}. Therefore Spece A⊗ B A⊗ Z and Spece (A) = {pZpZ + XQ[[X]]}. It follows that dime Z B (Z) = 0 and A⊗ B dime Z (A) = 0. Next, we deal with tensor products over the ring of integers Z. This allows us to answer a question rised by Jorge Martinez on evaluating the Krull dimension of the tensor product over Z of two rings one of which is a Boolean ring. Corollary 6.7. Let (Z, A, B) be a triplet of rings such that char(A) =: n 6= 0. Assume that A is a B-fibred AF-ring over Z. Let n = pα1 1 pα2 2 ...pαr r be the decomposition of n into prime factors. Then   o n dim(A⊗Z B) = sup Dpi t.d.pi (AI : Z), htpi (I), B : i = 1, 2, · · · , n and I ∈ Specpi (A) . Local dimension theory of algebras 26 Z is identified to a subring of A and that Proof. Observe that, as char(A) = n, nZ o  Z  np Z p Z pj Z pr Z 1 2 = . Then, for each j = 1, 2, · · · , r, , ,··· , is a minimal Spec nZ nZ nZ nZ nZ pj Z Z Z prime ideal of and thus there exists Ij ∈ Spec(A) such that Ij ∩ = . nZ nZ nZ Hence, for each j = 1, 2, · · · , r, there exists Ij ∈ Spec(A) such that Ij ∩ Z = pj Z. A Therefore SpecA e (Z) = {p1 Z, p2 Z, · · · , pr Z}). Thus dime (Z) = 0. Now, Corollary 6.4 completes the proof. We close with the following corollary which presents an answer to a question of Jorge Martinez on evaluating the Krull dimension of the tensor product over the ring of integers Z of two rings one of which is Boolean. First, we record the following well known characteristics of Boolean rings. Lemma 6.8. Let R be a Boolean ring. Then 1) R is commutative. 2) char(R) = 2. 3) dim(R) = 0. R∼ Z 4) for each prime ideal p of R. = p 2Z Z R is an algebraic field extension of for each prime ideal p of R. 5) p 2Z Corollary 6.9. Let (Z, A, B) be a triplet of rings such that A is a Boolean ring. Then B  . dim(A ⊗Z B) = dim 2B Proof. Using the proof of Corollary 6.7, we get SpecA e (Z) = {2Z}. Also, as dim(A) = 0, by Proposition 5.3, A is a fibred AF-ring over Z. Moreover, n A Z  o t.d.2Z (A : Z) = sup t.d. : I ∈ Spec(A) = 0 : I 2Z Z A is algebraic over , by Lemma 6.8(5). It follows, by Theorem 6.5, Lemma as I 2Z 6.1 and Lemma 6.8, that dim(A ⊗Z B) = = D2Z (0, 0, B) o n  J  : J ∈ Spec2Z (B) = sup ht 2B B  = dim 2B completing the proof. Local dimension theory of algebras 27 References [1] S. Bouchiba, F. Girolami, S. Kabbaj, The dimension of tensor products of AFrings, Commutative ring theory, 141-153, Lecture Notes in Pure and Appl. Math., 185, Dekker, New York, 1997. [2] S. Bouchiba, F. Girolami, and S. Kabbaj, The dimension of tensor products of k-algebras arising from pullbacks, J. Pure Appl. Algebra 137 (1999), 125-138. [3] S. Bouchiba, D.E. Dobbs and S. Kabbaj, On the prime ideal structure of tensor products of algebras. J. Pure Appl. Algebra 176 (2002), no. 2-3, 89-112 [4] S. Bouchiba and S. Kabbaj, Tensor products of Cohen-Macaulay rings: Solution to a problem of Grothendieck, J. Algebra 252 (2002) 65-73. [5] S. Bouchiba, On Krull dimension of tensor products of algebras arising from AF-domains, J. Pure Appl. Algebra 203 (2005) 237-251. [6] S. Bouchiba, Chains of prime ideals in tensor products of algebras, J. Pure Appl. Algebra 209 (2007), no. 3, 621-630. [7] N. Bourbaki, Algèbre, Chap 1 à 3, Diffusion C.C.L.S, Paris (1970). [8] A. Grothendieck; J. Dieudonné. Élements de géométrie algébrique, I. Grundlehren Math. Wiss., 166. Springer-Verlag, Berlin, 1971. [9] A. Grothendieck, Eléments de géométrie algébrique, Vol. IV, Institut des Hautes Etudes Sci. Publ. Math. No. 24, Bures-sur-yvette, 1965. [10] S. MacLane and O. F. G. Schilling, Zero-dimensional branches of rank one on algebraic varieties, Ann. of Math. vol. 40 (1939), 507-520. [11] H. Matsumura, Commutative Ring Theory, Cambridge University Press, 1986. [12] R.Y. Sharp, The dimension of the tensor product of two field extensions, Bull. London Math. Soc. 9 (1977), 42-48. [13] R.Y. Sharp, Simplifications in the theory of tensor products of field extensions, J. London Math. Soc. (2), 15(1) (1977), 48-50. [14] A.R. Wadsworth, The Krull dimension of tensor products of commutative algebras over a field, J. London Math. Soc. 19 (1979), 391-401. [15] O. Zariski and P. Samuel, Commutative Algebra Vol. I, Van Nostrand, Princeton, 1960.
0math.AC
arXiv:1712.08730v1 [cs.CV] 23 Dec 2017 Combining Weakly and Webly Supervised Learning for Classifying Food Images Parneet Kaur Rutgers University New Brunswick, NJ [email protected] Karan Sikka SRI International Princeton, NJ [email protected] Ajay Divakaran SRI International Princeton, NJ [email protected] Abstract Food classification from images is a fine-grained classification problem. Manual curation of food images is cost, time and scalability prohibitive. On the other hand, web data is available freely but contains noise. In this paper, we address the problem of classifying food images with minimal data curation. We also tackle a key problems with food images from the web where they often have multiple cooccuring food types but are weakly labeled with a single label. We first demonstrate that by sequentially adding a few manually curated samples to a larger uncurated dataset from two web sources, the top-1 classification accuracy increases from 50.3% to 72.8%. To tackle the issue of weak labels, we augment the deep model with Weakly Supervised learning (WSL) that results in an increase in performance to 76.2%. Finally, we show some qualitative results to provide insights into the performance improvements using the proposed ideas. 1 Introduction Increasing use of smartphones has generated interest in developing tools for monitoring food intake and trends [27, 34, 24]. Estimate of calorie intake can help users to modify their food habits to maintain a healthy diet. Current food journaling applications like Fitbit App [1], MyFitnessPal [3] and My Diet Coach [2] require users to enter their meal information manually. A study of 141 participants in [12] reports that 25% of the participants stopped food journaling because of the effort involved while 16% stopped because they found it to be time consuming. Capturing images of meals is easier, faster and convenient than manual data entry. An automated algorithm for measuring calories from images should be able to solve several sub-problems − classify, segment and estimate 3D volume of the given food items. In this paper we focus on the first task of classification of food items in still images. This is a challenging task due to a large number of food categories, high intra-class variation and low inter-class variation among different food classes. Further, in comparison to standard computer vision problems such as object detection [21] and scene classification [36], present datasets for food classification are limited in both quantity and quality to train deep networks (see section 2). Prior works try to resolve this issue by collecting training data using human annotators or crowd-sourcing platforms [14, 9, 17, 34, 24]. Such data curation is expensive and limits the scalability in terms of number of training categories as well as number of training samples per category. Moreover, it is challenging to label images for food classification tasks as they often have co-occurring food items, partially occluded food items, and large variability in scale and viewpoints. Accurate annotation of these images would require bounding boxes, making data curation even more time and cost prohibitive. Thus, it is important to build food datasets with minimal data curation so that they can be scaled for novel categories based on the final application. Unlike data obtained by human supervision, web data is freely available in abundance but contains different types of noise [10, 32, 29]. Web images collected via search engines may include images of processed and packaged food items as well as ingredients required to prepare the food items as Figure 1: Proposed pipeline for food image classification. We use inexpensive but noisy web data and sequentially add manually curated data to the weakly supervised uncurated data. We also propose to augment the deep model with Weakly Supervised learning (WSL) to tackle the cross-category noise present in web images, and to identify discriminative regions to disambiguate between fine-grained classes. Figure 2: Noise in web data. Cross-domain Noise: Along with the images of specific food class, web image search also include images of processed and packaged food items and their ingredients. Cross-category Noise: An image may have multiple food items but it has only one label as its ground truth, resulting in cross-domain noise. shown in Figure 2. We refer to this noise as cross-domain noise as it is introduced by the bias due to specific search engine and user tags. In addition, the web data may also include images with multiple food items while being labeled for a single food category (cross-category noise). For example, in images labeled as Guacamole, Nachos can be predominant (Figure 2). Further, the web results may also include images not belonging to any particular class. We address the problem of food image classification by combining webly and weakly supervised learning ( Figure 1). We first propose to overcome the issues associated with obtaining clean training data for food classification by using inexpensive but noisy web data. In particular we demonstrate that by sequentially adding manually curated data to the uncurated data from web search engines, the classification performance improves linearly. We show that by augmenting a smaller curated dataset with larger uncurated web data the classification accuracy increases from 50.3% to 72.8%, which is at par with the performance obtained with the manually curated dataset (63.3%). We also propose to augment the deep model with weakly supervised learning (WSL) for for two reasons (1) tackle the cross-category noise present in web images, and (2) identify discriminative regions to disambiguate between fine-grained classes. We are able to approximately localize food items using the activation maps provided by WSL. We show that by using WSL, the classification accuracy on test data further increases to 76.2%. We finally show qualitative results and provide useful insights into the two proposed strategies and discuss the reasons for performance improvements. 2 Related Work Traditional computer vision feature vectors such has HOG, SIFT, bag-of-features, Gabor filters and color histograms have been used for classifying food images in [34, 27, 8, 5, 16] Recent state-of-theart deep learning methods for food recognition and localization have led to significant improvement in performance [23, 24, 22, 33, 28, 7]. However, the proposed methods use training data with only one food item in the image [23] or have labels for multiple food items in images [17, 24]. The preparation of training data requires manual curation. The Food-101 dataset [8] is often used for food classification. It is collected from a food discovery website foodspotting.com and generally contains less cross-domain noise as compared to images obtained from search engines such as Google.com. However, this website relies on images sent by users and thus has limited images for 2 unique food categories, limiting expansion to new categories. In [31], food data is collected from the web but also relies on textual information along with the images. CNNs have also been used to classify food vs. non-food items in [28, 7]. In addition, [7] also provides food activation maps on the input image to generate bounding boxes for localization. We address the problem of classifying food items by using the noisy web data and incorporating weakly supervised learning for training CNNs. Recent approaches of webly supervised learning in computer vision leverage from the noisy web data, which is easy and inexpensive to collect. Prior work uses web data to train CNNs for classification and object detection. [19] use noisy data collected from web for fine-grained classification. They also use active learning-based approach for collecting data when only limited examples are available from web. They demonstrate that even if the classification task at hand has small number of categories, using a network trained with more categories gives better performance. Motivated by curriculum learning, [10], propose an algorithm to first train a model on simple images from Google and estimate a relationship graph between different classes. The confusion matrix is integrated with the model and is fine-tuned on harder Flickr images. The confusion matrix makes the network robust to noise and improves performance. Similarly, [26] modified the loss function by using the noise distribution from the noisy images. Food images often consist of multiple food items instead of a single food item and require bounding boxes for annotation. To avoid expensive curation, weakly supervised learning (WSL) utilizes imagelevel labels instead of pixel-level labels or bounding boxes. In [35, 25], the network architecture is modified to incorporate WSL by adding a global pooling layer. Along with image classification, these architectures are able to localize the discriminative image parts. In [13], the authors include top instances (most informative regions) and negative evidences(least informative regions) in the network architecture to identify discriminative image parts more accurately. To address object detection, the authors in [6] modify the deep network using a spatial pyramid pooling layer and use region proposals to simultaneously select discriminative regions and perform classification. In [11], the authors present a multi-fold multiple instance learning approach that detects object regions using CNN and fisher vector features while avoiding convergence to local optima. In this paper, we combine the webly and weakly supervised learning to address the problem of food classification. We sequentially add curated data to the weakly labeled uncurated web data and augment the deep model with WSL. We report improved performance as well as gain insights by visualizing the qualitative results. 3 Approach We first describe the datasets used to highlight the benefits of using uncurated data with manually curated data for the task of food classification. Thereafter, we briefly discuss weakly supervised learning to train the deep network. 3.1 Datasets We first collect food images from the web and augmented it with both curated and additional uncurated images, and test our method on a separate clean test set. The datasets are described below: 1. Food-101 [8]: This dataset consists of 101 food categories with 750 training and 250 test images per category. The test data was manually cleaned by the authors whereas the training data consists of cross-category noise i.e. images with multiple food items labeled with a single class. We use the manually cleaned test data as the curated dataset (25k images), Food-101-CUR, which is used to augment the web dataset. We use 10% of the uncurated training data for validation and 90% of uncurated data (referred to as Food-101-UNCUR) for data augmentation for training the deep model. 2. Food-Web-G: We collect the web data using Google image search for food categories from Food-101 dataset [8]. The restrictions on public search results limited the collected data to approximately 800 images per category. We removed images smaller than 256 pixels in height or width from the dataset. As previously described, the web data is weakly labeled and consists of both cross-domain and cross-category noise as shown in Figure 2. We refer to this dataset as Food-Web-G 3 3. UEC256 [17]: This dataset consists of 256 food categories, including Japanese and international dishes and each category has at least 100 images with bounding box indicating the location of its category label. Since this dataset provides the advantage of complete bounding box level annotations, we use this dataset for testing. We construct the test set by selecting 25 categories in common with the Food-101 dataset and extract cropped images using the given bounding boxes. 3.2 Weakly Supervised Learning (WSL) The data collected from web using food label tags is weakly labeled i.e. an image is labeled with a single label when it contains multiple food objects. We observe that most uncurated food images were unsegmented with images containing either items from co-occurring food classes or background objects such as kitchenware. We propose to tackle this problem by augmenting the deep network with WSL that explicitly grounds the discriminative parts of an image for the given training label [35], resulting in a better model for classification. As shown in Figure 1, we incorporate discriminative localization capabilities into the deep model by adding a 1 × 1 convolution layer and a spatial pooling layer to a pretrained CNN [25, 35]. The convolution layer generates N × N × K class-wise score maps from previous activations. The spatial pooling layer in our architecture is a global average pooling layer which has recently been shown to outperform the global max pooling step for localization in WSL [25, 35]. Max pooling only identifies the most discriminative region by ignoring lower activations, while average pooling finds the extent of the object by recognizing all discriminative regions and thus giving better localization. The spatial pooling layer returns class-wise score for each image which are then used to compute cross-entropy loss. During test phase, we visualize the heats maps for different classes by overlaying the predicted score maps on the original image. Additionally, food classification is a fine-grained classification problem [19] and we later show that discriminative localization also aids in correctly classifying visually similar classes. Compared to Krause et al. [19], who show the benefits of noisy data for fine-grained tasks such as bird classification, we also highlight the benefits of WSL for learning with noisy data for food classification. 3.3 Implementation Details We use Inception-Resnet [30] as the base architecture and fine-tune the weights of a pre-trained network (ImageNet). During training, we use Adam optimizer with a learning rate 10−3 for the last fully-connected (classification) layer and 10−4 for the pre-trained layers. We use batch size of 50. For WSL, we initialize the network with the weights obtained by training the base model and only fine-tune the layers added for weak localization with learning rate of 10−3 . For WSL we obtain localized score maps for different classes by adding a 1 × 1 convolutional layer to map the input feature maps into classification score maps [35]. For an input image of 299 × 299, we get a score map of 8 × 8 from the output of this convolutional layer, which gives approximate localization when resized to the size of input image. The average pooling layer is of size 8 × 8, stride 1 and padding 1. 4 4.1 Experiments Quantitative Results We report top-1 classification accuracy for different combinations of datasets (see section 3) and WSL in Table 1. We first discuss the performance without WSL, where the baseline performance using Google images (Food-Web-G) is 55.3%. We observe that augmenting Food-Web-G (66.9k samples) with a small proportion of curated data (25k samples) improves the performance to 69.7%, whereas augmentation with additional uncurated data (67.5k samples from foodspotting.com) results in 70.1%. The performance of both combinations is higher compared to the curated data alone (63.3%) clearly highlighting the performance benefits of using noisy web data. We also observe that different sources of web images i.e. Google versus Foodspotting results in different performance (55.3% versus 70.5% respectively) for similar number of training samples. As previously mentioned, Foodspotting is crowdsourced by food enthusiasts, who often compete for ratings, and thus has less cross-domain noise and better quality compared to Google images. By combining all the three 4 Dataset Food-Web-G Food-101-CUR Food-101-UNCUR Food-Web-G + Food-101-CUR Food-Web-G + Food-101-UNCUR Food-Web-UNCUR + Food-101-CUR All datasets No. of images 66.9k 25k 67.5k 92.5k 134.4k 92.5k 159.3k Type w/o WSL with WSL N C N N +C N N +C N +C 55.3% 63.3% 70.5% 69.7% 70.1% 71.4% 72.8% 61.6% 64.0% 73.2% 73.0% 74.0% 75.1% 76.2% Table 1: Classification accuracy for different combinations of datasets with and without Weakly Supervised training. The number of images for each combination (k = 1000) and type of dataset (N : noisy and C:clean) are also shown. (a) (b) Figure 3: Classification Accuracy using (a) Inception Resnet, (b) Inception Resnet with localization layer. As the curated data (Food-101 CUR) is added to the web data, the classification accuracy on the test data (UEC256-test) increases. Increasing the web data results in further improvement. The red line shows the baseline performance with individual datasets. datasets, we observe a classification accuracy of 72.8%, which outperforms the performance obtained by either curated and uncurated datasets alone. We also wanted to study the variation in performance on using different proportions of clean and unclean images. As shown in Figure 3, by sequentially adding manually curated data (Food-101 CUR) to the web data (Food-Web-G), the classification performance improves linearly from 50.3% to 69.0%. By adding the uncurated data from foodspotting, it further increases to 72.8%. We also observe significant improvements by adding discriminative localization to the deep model, where the classification accuracy further increases to 76.2%. In particular we observe a consistent improvement across all data splits by using WSL e.g. for the combination of both uncurated datasets from Google and foodspotting, the hike in performance by using WSL is 4% absolute points. This performance trend highlights the advantages of WSL in tackling the noise present in food images by implicitly performing foreground segmentation and also focusing on the correct food item in the case when multiple food items are present (cross-category noise). 4.2 Qualitative Results We show the heat maps indicating the approximate localization of the top-1 predicted label for few training images with multiple food items in Figure 4. We see that for some training images (Figure 4a) the network learns to correctly localize the correct food type among co-occurring food classes e.g. it is able to identify rice in “fried rice” example. This ability could explain the reasons for performance benefits especially when training data is not completely labeled. However, we also observe that for frequently co-occurring food items, sometimes the network learns to localize multiple food types together. As shown in Figure 4b), network learns “chicken” and “rice” as one category because they co-occur in many training examples. The network also learns wrong food item for some co-occurring food items. For example, Figure 4c shows some examples where the network learns 5 (a) (b) (c) Figure 4: Heat maps showing approximate pixel-wise predicted probabilities obtained by Weakly Supervised training for few training images. We show three cases where (a) the food items are localized correctly, (b) network localizes frequently co-occurring food items due to weak labels for training, and (c) network localizes a frequently co-occurring food item instead of the labeled food item due to incomplete and noisy training data. Figure 5: Test images that are misclassified without any localization but correctly classified with weak localization. We also show the heat map, predicted label with the two approaches, and the true label. to recognize “sauce” instead of Gyoza. This is a drawback with standard WSL methods where the algorithm generally tends to focus on the most discriminative part and overfits. We can overcome this aspect by either leveraging additional clean training data or using recent advances in WSL [20, 18]. We show the heat maps for test images that are misclassified without localization but are correctly classified with localization in Figure 5. Food classification is a fine-grained classification problem and we can see that WSL helps by identifying discriminative parts for different food items. For e.g., the model grounds the noodle pieces in “miso soup” image in Figure 5 that makes it possible to differentiate it from “chocolate cake” class, both of which are generally dark brown in color. We observe that the properties of training data and quality of labeling influences the test performance. There are unique ways of cooking a food item in different cuisines, resulting in variability in appearance. The UEC256 test data mainly contains Japanese cuisines that may not be seen by the network during training phase. We found that some test images are misclassified if their appearance varies from the training images. Figure 6a shows an example of the category “omelette” that has high variability for training and test data. We observe that the performance on test data is also influenced by the weak/incomplete labeling of training data. For example, as shown in Figure 6b, the training dataset contains these two categories: “french fries” and “fish and chips”. “Fish and chips” always contains french fries, however this information is not used during the training phase resulting in high confusion between these classes during testing. Misclassification on test images also occurs due to the presence of multiple food items. Localization heatmaps show that the network also focuses on the partially occluded food items in the images. Figure 7 shows some examples where the test images with true label “french fries” are misclassified because the network focuses on the other partial food items in the image. Even though the top-most 6 (a) (b) Figure 6: Misclassification in test data. (a) Examples for category ‘Omelette’ in training data (top row) and test data (bottom row). Data distribution in training and test data differs because they are collected from different sources, resulting in misclassification of some test images. (b) Examples from training data (top row) and test data (bottom row). Inter-class similarity in training data causes confusion and results in misclassification of test data. Figure 7: The test images are misclassified in presence of occluded food items because the network learns to localize co-occurring food items during training. For these images, the top-5 predicted labels includes the ground truth. predicted label corresponds to the partially occluded food item, the correct label is often found in the top-5 predictions (top-5 accuracy is 90.8%). We also generated bounding boxes from the heatmaps as shown in Figure 8 and will evaluate the localization performance in the future. 5 Conclusion In this paper, we leverage the freely available web data to address the problem of food classification. By augmenting the abundantly available uncurated web data with limited manually curated dataset and using weakly supervised learning, we achieve a classification accuracy of 76.2%. The performance improves linearly as the amount of curated data for training is increased. We examine the localization maps and observe that WSL aids the network by learning to approximately localize a food item even in presence of multiple food items. Additionally, we examine some cases where discriminative localization helps to disambiguate visually similar classes. Although we chose to focus on WSL in this work, additional performance improvement can also be obtained by other complementary approaches such as cost sensitive loss [10, 26] and domain adaptation [4]. 7 Figure 8: UEC256 test images. [Top row] Heatmaps for the top-1 predicted class. [Bottom row] Bounding boxes obtained using the heatmaps. 6 Acknowledgments We thank Carter Brown, Ankan Bansal, Kilho Son and Anirban Roy for many helpful discussions. References [1] Fitbit app. https://www.fitbit.com/app. Accessed: 2017-11-14. [2] My diet coach. https://play.google.com/store/apps/details?id=com. dietcoacher.sos. Accessed: 2017-11-14. [3] Myfitnesspal. https://www.myfitnesspal.com. Accessed: 2017-11-14. [4] Alessandro Bergamo and Lorenzo Torresani. Exploiting weakly-labeled web images to improve object classification: a domain adaptation approach. In Advances in neural information processing systems, pages 181–189, 2010. [5] Vinay Bettadapura, Edison Thomaz, Aman Parnami, Gregory D Abowd, and Irfan Essa. Leveraging context to support automated food recognition in restaurants. In Applications of Computer Vision (WACV), 2015 IEEE Winter Conference on, pages 580–587. IEEE, 2015. [6] Hakan Bilen and Andrea Vedaldi. Weakly supervised deep detection networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2846–2854, 2016. [7] M. Bolaños and P. Radeva. Simultaneous food localization and recognition. In 2016 23rd International Conference on Pattern Recognition (ICPR), pages 3140–3145, Dec 2016. [8] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101–mining discriminative components with random forests. In European Conference on Computer Vision, pages 446–461. Springer, 2014. [9] Mei-Yun Chen, Yung-Hsiang Yang, Chia-Ju Ho, Shih-Han Wang, Shane-Ming Liu, Eugene Chang, Che-Hua Yeh, and Ming Ouhyoung. Automatic chinese food identification and quantity estimation. In SIGGRAPH Asia 2012 Technical Briefs, page 29. ACM, 2012. [10] Xinlei Chen and Abhinav Gupta. Webly supervised learning of convolutional networks. In Proceedings of the IEEE International Conference on Computer Vision, pages 1431–1439, 2015. [11] Ramazan Gokberk Cinbis, Jakob Verbeek, and Cordelia Schmid. Weakly supervised object localization with multi-fold multiple instance learning. IEEE transactions on pattern analysis and machine intelligence, 39(1):189–203, 2017. [12] Felicia Cordeiro, Elizabeth Bales, Erin Cherry, and James Fogarty. Rethinking the mobile food journal: Exploring opportunities for lightweight photo-based capture. In Proceedings of the 33rd Annual ACM Conference on Human Factors in Computing Systems, pages 3207–3216. ACM, 2015. [13] Thibaut Durand, Nicolas Thome, and Matthieu Cord. Weldon: Weakly supervised learning of deep convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4743–4752, 2016. 8 [14] Giovanni Maria Farinella, Dario Allegra, Marco Moltisanti, Filippo Stanco, and Sebastiano Battiato. Retrieval and classification of food images. Computers in biology and medicine, 77:23–39, 2016. [15] Armand Joulin, Laurens van der Maaten, Allan Jabri, and Nicolas Vasilache. Learning visual features from large weakly supervised data. In European Conference on Computer Vision, pages 67–84. Springer, 2016. [16] Taichi Joutou and Keiji Yanai. A food image recognition system with multiple kernel learning. In Image Processing (ICIP), 2009 16th IEEE International Conference on, pages 285–288. IEEE, 2009. [17] Yoshiyuki Kawano and Keiji Yanai. Automatic expansion of a food image dataset leveraging existing categories with domain adaptation. In ECCV Workshops (3), pages 3–17, 2014. [18] Dahun Kim, Donghyeon Cho, Donggeun Yoo, and In So Kweon. Two-phase learning for weakly supervised object localization. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017. [19] Jonathan Krause, Benjamin Sapp, Andrew Howard, Howard Zhou, Alexander Toshev, Tom Duerig, James Philbin, and Li Fei-Fei. The unreasonable effectiveness of noisy data for finegrained recognition. In European Conference on Computer Vision, pages 301–320. Springer, 2016. [20] Krishna Kumar Singh and Yong Jae Lee. Hide-and-seek: Forcing a network to be meticulous for weakly-supervised object and action localization. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017. [21] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014. [22] Chang Liu, Yu Cao, Yan Luo, Guanling Chen, Vinod Vokkarane, and Yunsheng Ma. Deepfood: Deep learning-based food image recognition for computer-aided dietary assessment. In International Conference on Smart Homes and Health Telematics, pages 37–48. Springer, 2016. [23] Renfeng Liu. Food recognition and detection with minimum supervision. 2016. [24] Austin Meyers, Nick Johnston, Vivek Rathod, Anoop Korattikara, Alex Gorban, Nathan Silberman, Sergio Guadarrama, George Papandreou, Jonathan Huang, and Kevin P Murphy. Im2calories: towards an automated mobile vision food diary. In Proceedings of the IEEE International Conference on Computer Vision, pages 1233–1241, 2015. [25] Maxime Oquab, Léon Bottou, Ivan Laptev, and Josef Sivic. Is object localization for free?weakly-supervised learning with convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 685–694, 2015. [26] Giorgio Patrini, Alessandro Rozza, Aditya Menon, Richard Nock, and Lizhen Qu. Making neural networks robust to label noise: a loss correction approach. arXiv preprint arXiv:1609.03683, 2016. [27] Manika Puri, Zhiwei Zhu, Qian Yu, Ajay Divakaran, and Harpreet Sawhney. Recognition and volume estimation of food intake using a mobile device. In Applications of Computer Vision (WACV), 2009 Workshop on, pages 1–8. IEEE, 2009. [28] Ashutosh Singla, Lin Yuan, and Touradj Ebrahimi. Food/non-food image classification and food categorization using pre-trained googlenet model. In Proceedings of the 2nd International Workshop on Multimedia Assisted Dietary Management, pages 3–11. ACM, 2016. [29] Sainbayar Sukhbaatar and Rob Fergus. Learning from noisy labels with deep neural networks. arXiv preprint arXiv:1406.2080, 2(3):4, 2014. [30] Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In AAAI, pages 4278–4284, 2017. [31] Xin Wang, Devinder Kumar, Nicolas Thome, Matthieu Cord, and Frederic Precioso. Recipe recognition with large multimodal food dataset. In Multimedia & Expo Workshops (ICMEW), 2015 IEEE International Conference on, pages 1–6. IEEE, 2015. 9 [32] Xin-Jing Wang, Lei Zhang, Xirong Li, and Wei-Ying Ma. Annotating images by mining image search results. IEEE Transactions on Pattern Analysis and Machine Intelligence, 30(11):1919– 1932, 2008. [33] Keiji Yanai and Yoshiyuki Kawano. Food image recognition using deep convolutional network with pre-training and fine-tuning. In Multimedia & Expo Workshops (ICMEW), 2015 IEEE International Conference on, pages 1–6. IEEE, 2015. [34] Weiyu Zhang, Qian Yu, Behjat Siddiquie, Ajay Divakaran, and Harpreet Sawhney. “snap-n-eat” food recognition and nutrition estimation on a smartphone. Journal of diabetes science and technology, 9(3):525–533, 2015. [35] Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016. [36] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017. 10
1cs.CV
Submitted to Management Science manuscript MS-17-01173 arXiv:1607.07306v2 [cs.GT] 20 Jun 2017 Authors are encouraged to submit new papers to INFORMS journals by means of a style file template, which includes the journal title. However, use of a template does not certify that the paper has been accepted for publication in the named journal. INFORMS journal templates are for the exclusive purpose of submitting to an INFORMS journal and should not be used to distribute the papers in print or online or to submit the papers to another publication. The Costs and Benefits of Sharing: Sequential Individual Rationality and Fairness Ragavendran Gopalakrishnan Conduent Labs India (formerly Xerox Research Centre India), [email protected] Koyel Mukherjee IBM Research India, [email protected] Theja Tulabandhula University of Illinois Chicago, [email protected] In designing dynamic shared service systems that incentivize customers to opt for shared rather than exclusive service, the traditional notion of individual rationality may be insufficient, as a customer’s estimated utility could fluctuate arbitrarily during their time in the shared system, as long as their realized utility at service completion is not worse than that for exclusive service. In this work, within a model that explicitly considers the “inconvenience costs” incurred by customers due to sharing, we introduce the notion of sequential individual rationality (SIR) that requires that the disutility of existing customers is nonincreasing as the system state changes due to new customer arrivals. Next, under SIR, we observe that cost sharing can also be viewed as benefit sharing, which inspires a natural definition of sequential fairness (SF)—the total incremental benefit due to a new customer is shared among existing customers in proportion to the incremental inconvenience suffered. We demonstrate the effectiveness of these notions by applying them to a ridesharing system, where unexpected detours to pick up subsequent passengers inconvenience the existing passengers. Imposing SIR and SF reveals interesting and surprising results, including: (a) natural limits on the incremental detours permissible, (b) exact characterization of “SIR-feasible” routes, which boast sublinear upper and lower bounds on the fractional detours, (c) exact characterization of sequentially fair cost sharing schemes, which includes a strong requirement that passengers must compensate each other for the detour inconveniences that they cause, and (d) new algorithmic problems related to and motivated by SIR. Key words : shared service system; ridesharing; cost sharing; sequential individual rationality; sequential fairness; algorithmic mechanism design; graph algorithms 1 Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 2 1. Introduction Sharing of resources and services is ubiquitous in today’s economy, driven by increasing costs to the individual of enjoying exclusive access. For example, increased congestion on roads has pushed more commuters towards public transportation and ridesharing (McKenzie 2015, Sivak and Schoettle 2016). Funding shortages of governments and thin profit margins of businesses force more people to share a smaller set of customer-serving resources both physically (contact centers (Aksin et al. 2007), airport security checks (Cole 2015, Zou et al. 2015)) and virtually (online services (Armbrust et al. 2010)). The popularity of cloud computing services (e.g., Amazon Web Services, Microsoft Azure) has increased because they drastically bring down the computing infrastructure costs (Kondo et al. 2009, Ahn et al. 2012). Even more examples include spectrum sharing in wireless networks (Peha 2009), and shared logistics in supply chain distribution networks (Bowersox et al. 2000). Of particular interest are shared service systems where arriving customers spend a finite amount of time and money in the system getting served, and leave the system upon service completion. However, because the service is shared, the time taken for a customer to be served, as well as the monetary cost of service, can change depending upon the arrival/departure of other customers into/from the system. Usually, the more the customers that share the same amount of resources, the more time and less money each individual customer spends in the system. In ridesharing, picking up an additional passenger involves a detour which increases passengers’ commute times, but brings down their shares of the total cost. In a priority queue, there are multiple service levels; those with higher priority (and hence, shorter average waiting times) cost more (Katta and Sethuraman 2005). Due to resource pooling in cloud computing services, the response times for the same load can be higher if other tenants sharing the same set of resources place concurrent loads, and so, offerings with such performance variability are priced lower (Jackson 2011). When designing the pricing or cost sharing scheme for a shared service system, two major factors that influence a customer’s choice of shared service must be considered: (a) Individual Rationality (IR), where a customer compares her own utility between the shared and exclusive service options, and asks herself if the cheaper monetary cost of the shared service is worth the longer waiting/response time, and (b) Fairness, where a customer compares her utility with those of other customers in the system, and evaluates whether everyone is “equitably” better off in opting for the shared service. While traditional notions of IR and fairness capture the requirement that customers who opt for a shared service are “happier” than they would be had they availed an exclusive service, they fail to address a customer’s experience during the time they are in the system due to subsequent arrivals (which could be unexpected), e.g., a sudden burst of arrivals into a higher-priority queue could frustrate a customer waiting in a lower-priority queue at that Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 3 moment, even if she is later offered a discount for having waited longer. In ridesharing, a frequent source of frustration are the (often unexpected) detours taken to pick up and/or drop off additional passengers, which inconvenience existing passengers. Our goal in this paper is to address this concern by defining appropriate new notions of IR and fairness, and demonstrate their effectiveness by investigating their consequences (characteristic and algorithmic) within the context of a specific application, namely ridesharing. 1.1. Our Contributions First, in Section 2, we introduce the concepts of sequential IR (SIR) and sequential fairness (SF), that extend their traditional counterparts to be applicable at a finer granularity to a dynamic shared service system. This involves invoking appropriate IR and fairness constraints every time the state of the system changes due to a new customer arrival.1 We model the disutility of a customer as the sum of the monetary cost of service and an “inconvenience cost” due to the presence of other customers in the system. While IR simply requires the disutility when opting for the shared service to be not greater than that for an exclusive service, SIR additionally requires the disutility to be nonincreasing throughout the time spent in the shared system. The companion fairness concept, SF, requires that the marginal decrease in disutility (the benefit of sharing) every time the state of the system changes is “equitably” experienced by all the customers in the system. We also briefly discuss a concern that these strong concepts could be too restrictive to allow feasible practical policies in certain scenarios. Next, we apply these concepts to a ridesharing system (motivated by its impact on promoting sustainable behavior), where cost sharing among passengers is a major design component.2 SIR targets the oft-lamented pain points due to detours experienced by passengers during the ride, by ensuring that existing passengers are progressively better off every time an additional passenger is picked up. In addition, SIR also ensures a certain degree of robustness, e.g., in a dynamic/online setting, passengers would remain satisfied even if a future pickup is canceled. We show that imposing SIR and SF on the routing and cost sharing schemes of a ridesharing system is not restrictive; to the contrary, it brings out several interesting and surprising consequences: (a) In Section 3.1, we provide an exact characterization (Theorem 1) for any route to be “SIRfeasible”, that is, there exists some budget-balanced cost sharing scheme that is SIR on that route. These SIR-feasibility constraints, though fairly straightforward to derive, are necessarily 1 The concepts can be naturally extended to other situations which affect the customer experience, e.g., adding/removing service capacity, customer departures, etc. 2 Other elements are effective ride matching, routing, and, in the case of commercial ridesharing, profitability; we explain how our focus on the costs influences these other factors, e.g., by adding the SIR and SF constraints to a matching/routing algorithm that is already in use. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 4 complex, so in Section 4, we consider a simplified scenario where all the passengers are travelling to a common destination. For this “single dropoff” scenario, we show that the SIR-feasibility constraints simplify to natural upper bounds on the incremental detours, that keep shrinking as the ride progresses towards the destination and as more passengers are picked up. (b) In a series of theorems (Theorems 2-5) in Section 4.1, we show that the above bounds on incremental detours can be aggregated to establish upper and lower bounds on the total detour endured by a passenger as a fraction of their shortest distance to their destination. These bounds depend on how sensitive the passengers are to detours; in realistic scenarios, these bounds are sublinear in the number of passengers. (c) In Section 5, we present an exact characterization of sequentially fair cost sharing schemes for the single dropoff scenario (Theorem 6), which exposes several practical structural properties of such schemes, including a surprisingly strong requirement that passengers must compensate each other for the detour inconveniences that they cause. (d) Finally, in Section 6, we explore some important algorithmic questions motivated by SIR. In particular, it is unknown, even for the single dropoff scenario, whether there exists a polynomial time algorithm to check for the existence of SIR-feasible routes, when restricted to an arbitrary metric space (we show that it is NP-hard otherwise). Even if so, we show that optimizing for total distance traveled over SIR-feasible routes is NP-hard (through a reduction from a variant of Metric-TSP). We then consider a variant of the vehicle routing problem where passengers are allocated to vehicles such that the total vehicle-miles traveled is minimized. While this problem is known to be NP-hard in general, we show that it can be solved in polynomial time given a fixed ordering on the pickup points. 1.2. Related Work The cost sharing problem for ridesharing has garnered relatively little attention in literature (compared to the ride matching and route optimization problems)—in most existing schemes, individual passengers are asked to post what they are willing to pay in advance (Cao et al. 2015), share the total cost proportionately according to the distances travelled (Geisberger et al. 2010, Agatz et al. 2011), or negotiate their cost shares on their own during/after the ride. Such methods ignore the real-time costs and delays incurred during the ride (as in the first instance), are insensitive to the disproportionate delays encountered during the ride (as in the second instance), or lead to a complicated and often uncomfortable negotiation process between possible strangers (as in the third instance). Recent work has studied cost sharing when passengers have significant autonomy in choosing rides or forming ridesharing groups, e.g., cost sharing schemes based on the concept of kernel in Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 5 cooperative game theory (Bistaffa et al. 2015), second-price auction based solutions (Kleiner et al. 2011), and market based ride-matching models with deficit control (Zhao et al. 2014). Fair cost sharing in ridesharing has also been studied under a mechanism design framework by Kamar and Horvitz (2009), where an individually rational VCG-based payment scheme is modified to recover budget-balance at the cost of incentive compatibility, and by Nguyen (2013), where customers are offered an additive, detour-based discount, and the allocations and pricing are determined through an auction. Our work differs from all the above in that we do not make any assumptions about the mechanics of ride matching; our cost sharing model is independent of the routing framework (static or dynamic), and is applicable to community carpooling and commercial ridesharing alike. Moreover, we define a monotonic form of individual rationality for dynamic ridesharing. Our work is different from the problem of pricing in ridesharing (see, e.g., Banerjee et al. (2015), Bimpikis et al. (2016)); our focus is on sharing the resulting cost among the passengers. Previous works on ridesharing that address individual rationality and detour limits treat them as independent constraints, e.g., Kamar and Horvitz (2009), Santos and Xavier (2013), Pelzer et al. (2015). In contrast, in our model, requiring (sequential) individual rationality induces natural bounds on detours experienced by the ridesharing passengers. There is a plethora of work when it comes to optimization problems in ridesharing (Agatz et al. 2012, Furuhata et al. 2013, Pelzer et al. 2015, Ozkan and Ward 2016, Alonso-Mora et al. 2017). While the detour constraints that SIR induces can augment any routing optimization problem, in this paper, we focus on finding an allocation of passengers to vehicles that minimizes the total vehicle-miles, which is a variant of the vehicle routing problem (Cordeau et al. 2006), with the additional constraint of SIR. Variations of individual rationality involving temporal aspects are well studied in the economics literature, e.g., ex-ante, interim, and ex-post individual rationality in mechanism design (Narahari et al. 2009), and sequential individual rationality in bargaining and repeated games (Esteban 1991). However, we are the first to explore its applicability to dynamic shared service systems and fairness properties of the resulting outcomes. An extensive literature on cooperative game theory and fair division (Moulin 2004, Jain and Mahdian 2007) offers various cost sharing schemes that can be analyzed in our framework. Our view of fairness relies on how the total incremental benefit due to ridesharing is allocated among the passengers during each stage of the ride (sequential fairness). While we believe the two approaches are not independent, exploring the connections is beyond the scope of this work. We now outline some of the related work in cost sharing in a dynamic shared resource allocation setting, in which our contributions can potentially discover alternate solutions with different Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 6 desiderata. For instance, Elmachtoub and Levi (2014) study online allocation problems where customers arrive sequentially, and decisions regarding whether to accept or reject customers must be made upon their arrival, with the goal of minimizing the sum of production costs (for accepted customers) and rejection costs. Additionally, the trade-off of (general forms of) fairness with efficiency for allocation problems (in different domains, ranging from online advertisement portals (Bateni et al. 2016) to manufacturing and retail (Haitao Cui et al. 2007)) has been widely studied in the literature, and recently conceptualized and studied as the “price of fairness” (Bertsimas et al. 2011, Dickerson et al. 2014, Heydrich and van Stee 2015). We hope that the concepts of individual rationality and fairness that our work introduces would inspire similar studies (theoretical and empirical) on their trade-offs with different notions of efficiency such as social welfare maximization and profit optimization. 2. Sequential Individual Rationality and Sequential Fairness In this section, we formally define the notions of sequential individual rationality and sequential fairness for shared service systems. We introduce the necessary notation first. Let N = {1, 2, . . . , n} denote the set of customers, ordered according to their arrival times. Let ti > 0 denote the time at which customer i ∈ N arrives into the system, and let T = {t0 , t1 , t2 , . . .}, where t0 = 0. Let `(i) denote the last customer to arrive into the system before i leaves the system. Let su denote the system state at time u, which encodes the necessary information about all the customers that are in the system at time u. Let Sij = {su | u ∈ T and ti ≤ u ≤ tj } denote the information set of states from time ti to tj . For any j ∈ N , let S(j) = {1, 2, . . . , j } denote the set of customers who have arrived until tj , and let OC (S1j ) denote the operating cost of the system, conditional on there being no more arrivals after tj . f denotes the cost sharing scheme according to which the operating cost is shared among the customers. In particular, the monetary cost of service to customer i ∈ S(j), conditional on there being no more arrivals after tj , is f (i, Sij ). Definition 1. A cost sharing scheme f is budget balanced if X f (i, Sij ) = OC (S1j ) ∀ j ∈ N. (1) i∈S(j) For any j ∈ N , the inconvenience cost incurred by customer i ∈ S(j) due to all the other customers she encounters in the system, assuming no customers arrive after time tj , is denoted by IC i (Sij ). Several factors may affect the monetary and inconvenience costs, whose exact functional forms would depend on the mechanics of the system being modeled.3 3 For example, one way to model the inconvenience cost could be to measure the additional time the customer spends in the system compared to when she is the sole customer served, scaled by how much she values a unit of her time. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 2.1. 7 Disutility and Individual Rationality (IR) The disutility of a customer i, assuming no customers arrive after time tj , is defined as the the sum of their monetary and inconvenience costs, that is,  0  0≤j <i DU i , DU i (tj ) = f (i, Sij ) + IC i (Sij ), i ≤ j ≤ `(i)  DU (t ), j > `(i) i `(i) (2) where DU 0i denotes the disutility corresponding to the exclusive service to customer i. Definition 2. A cost sharing scheme f is Individually Rational (IR) if DU i (tn ) ≤ DU i (t0 ) 2.2. ∀ i ∈ N. (3) Sequential Individual Rationality (SIR) While IR ensures that a customer’s disutility at the time of service completion in a shared system is not greater than that of an exclusive service, it still allows for the disutility to fluctuate arbitrarily during the time spent in the system, which can negatively affect the customer experience. Definition 3. A cost sharing scheme f is Sequentially Individually Rational (SIR) if DU i (tj ) ≤ DU i (tj−1 ) 2.3. ∀ 1≤j≤n ∀ i ∈ N. (4) The Benefit of Sharing and Sequential Fairness Under a cost sharing scheme that is IR, the decrease in disutility to a customer due to her participation in a shared service system (the difference between the right and left hand sides of her IR constraint (3)) can be viewed as her benefit of sharing. Further, it can be seen that the total benefit of sharing, obtained by summing the individual benefits, is independent of the cost sharing scheme, as long as it is budget-balanced. This observation exposes an underlying “duality” – a cost sharing scheme can, in fact, be viewed as a benefit sharing scheme. Such a view invites defining cost sharing schemes based on traditional notions of fairness, e.g., a fair cost sharing scheme should distribute the total benefit among the service-sharing customers suitably proportionately. We extend this notion to budget balanced cost sharing schemes that are SIR by looking into how they distribute the total incremental benefit due to each subsequent customer arriving into the system, leading to a natural definition of sequential fairness. Definition 4. The incremental benefit to customer i ∈ N due to the arrival of an incoming customer j ∈ N is given by IB i (Sij ) = DU i (tj−1 ) − DU i (tj ). (5) Definition 5. The total incremental benefit due to the arrival of an incoming customer j ∈ N is given by T IB (Sij ) = X i∈S(j) IB i (Sij ). (6) Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 8 We take a very general, but minimal, approach to defining sequential fairness. All that is required of a cost sharing scheme to be sequentially fair is that, when an incoming customer j arrives into the system, the portion of the total incremental benefit that is enjoyed by a previous customer i (1 ≤ i ≤ j − 1), is proportional to the incremental inconvenience cost to i due to the incoming customer. This is formalized in the following definition. Definition 6. Given a vector β~ = (β2 , β3 , . . . , βn ), where 0 ≤ βj ≤ 1 for 2 ≤ j ≤ n, a budget ~ balanced, SIR cost sharing scheme f is β-sequentially fair if, for all 2 ≤ j ≤ n,  βj P IC i (Sij )−IC i (Si(j−1) ) , 1≤i≤j −1 IB i (Sij ) j−1 m=1 (IC m (Smj )−IC m (Sm(j−1) )) = T IB (Sij ) 1 − βj , i = j. (7) Here, 1 − βj is the fraction of the total incremental benefit enjoyed by the incoming customer j as a result of joining the service system, and βj , the remaining fraction, is split among the previous IC (S ) j jj corresponds to a special case where the ( ) incoming customer is treated just the same as everyone else. customers. Setting 1 − βj = 2.4. Pj m=1 IC m (Smj )−IC m (Sm(j−1) ) Weaker Notions of SIR There may be situations where SIR is so strong that no feasible practical policy can be expected to satisfy it. For example, in shared service systems where the cost of service is fixed, e.g., priority queues at airports, banks, and hospitals, SIR-compliant policies would require dynamically adding service capacity to counter the inconvenience to low-priority customers every time a high-priority customer arrives into the system. However, it may not be practical to do so each and every time such an arrival occurs. Therefore, weaker notions of SIR could be proposed, e.g., approximate SIR, where only a bounded increase in disutility is allowed (which would induce threshold staffing policies). In addition, when arrivals and service times are modeled probabilistically, as in a queueing system, appropriate probabilistic notions of SIR may be needed, since requiring SIR on every sample path could be too restrictive. Future work should explore such interesting extensions. 3. A Model for Cost Sharing in Ridesharing In this section, we instantiate the above general model for a ridesharing system, where N denotes the set of passengers. For each passenger i ∈ N , let Si and Di denote their pickup and dropoff points, which are assumed to belong to an underlying metric space. Additional Notation: We assume access to a routing algorithm that, given any subset S ⊆ N , computes a valid route rS (an ordered sequence of pickup/dropoff points) that serves all the passengers in S. Thus, we define the following distance functions for any subset S ⊆ N : (a) d(S; rS ) denotes the total distance traveled along route rS , and (b) di (S; rS ), for i ∈ S, denotes the total Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 9 distance traveled along route rS from Si to Di . For simplicity, we assume that the costs are completely determined by the traversed distances.4 Accordingly, the operational cost (or the “meter fare”), and the inconvenience cost are OC (S; rS ) = αop d(S; rS ), and (8)  IC i (S; rS ) = αi di (S; rS ) − di ({i}; r{i} ) , (9) where αop > 0 is the price (in commercial ridesharing) or operating cost (in community carpooling) per unit distance, and, for each i ∈ N , αi ≥ 0 is her inconvenience cost per unit distance, known as her “detour sensitivity”. For simplicity, we denote di ({i}; r{i} ) by Si Di . The cost sharing scheme f is such that, for any subset S ⊆ N , f (i, S; rS ) denotes the portion of OC (S; rS ) allocated to passenger i ∈ S. We set f (i, S; rS ) = 0 whenever i ∈ / S. Disutility, IR and SIR: The definitions of disutility, IR, and SIR from equations (2)-(4) carry over in a straightforward manner to the ridesharing scenario, with the dependence on the route emphasized. Thus, DU i (tj ) is the disutility of passenger i along a route rN (tj ) which is identical to rN up to time tj , but thereafter does not pick up any more passengers, proceeding only to drop off the remaining passengers at their respective destinations. Also, the disutility corresponding to exclusive service is DU 0i = f (i, {i}; r{i} ) = αop Si Di . Definition 7. A route rN is IR-feasible (respectively, SIR-feasible) if there exists a budgetbalanced cost sharing scheme f that is IR (respectively, SIR) on rN . From here on, whenever it is understood from context, we drop the explicit dependence on the route to simplify notation. Next, we present an illustrative example. Example 1. Consider n = 3 passengers, picked up from their sources S1 , S2 , S3 (in that order),and travelling to a common destination D. The progression of the route rN (t), as the passengers are picked up one by one, is depicted in Fig. 1. Given the final route rN , the total distances traveled by passengers 1, 2 and 3 are d1 (N ) = S1 S2 + S2 S3 + S3 D, d2 (N ) = S2 S3 + S3 D and d3 (N ) = S3 D. The total distance traveled is d(N ) = S1 S2 + S2 S3 + S3 D. The operational cost is thus OC (N ) = αop (S1 S2 + S2 S3 + S3 D). Therefore, if f is a budget balanced cost sharing scheme, f (1, N ) + f (2, N ) + f (3, N ) = αop (S1 S2 + S2 S3 + S3 D). The inconvenience costs incurred by each passenger due to other passengers are: IC 1 (N ) = α1 (S1 S2 + S2 S3 + S3 D − S1 D), IC 2 (N ) = α2 (S2 S3 + S3 D − S2 D), IC 3 (N ) = α3 (S3 D − S3 D) = 0. 4 It is straightforward to extend our model and results to costs that depend on a combination of distance and time. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 10 Figure 1 Route progress while picking up passengers traveling to a common destination. Thus, a budget-balanced cost sharing scheme f is IR on route rN if f (1, N ) + α1 (S1 S2 + S2 S3 + S3 D − S1 D) ≤ αop S1 D, f (2, N ) + α2 (S2 S3 + S3 D − S2 D) ≤ αop S2 D, f (3, N ) ≤ αop S3 D. The SIR constraints are stronger, since they require IR at every stage of the ride: f (1, N ) + α1 (S1 S2 + S2 S3 + S3 D − S1 D) ≤ f (1, N \ {3}) + α1 (S1 S2 + S2 D − S1 D) ≤ αop S1 D, f (2, N ) + α2 (S2 S3 + S3 D − S2 D) ≤ f (2, N \ {3}) ≤ αop S2 D, f (3, N ) ≤ αop S3 D. A necessary condition for the route to be SIR-feasible is therefore obtained by summing up these inequalities (at each stage), using budget-balance of f , and simplifying: S2 S3 + S3 D − S2 D ≤ αop S3 D αop + α1 + α2 and S1 S2 + S2 D − S1 D ≤ αop S2 D. αop + α1 These “triangle inequalities” can be interpreted as imposing upper bounds on the incremental detours at every stage of the ride. We discuss this in more detail in Section 4. 3.1. Characterizing SIR-Feasibile Routes The intuition gained from Example 1 suggests that routes with “large” detours are unlikely to be SIR-feasible, that is, no budget-balanced cost sharing scheme would be SIR on such routes. Theorem 1 provides a formal characterization of SIR-feasible routes.5 Theorem 1. A route rN is SIR-feasible if and only if αop  j−1  X   d(S(j)) − d(S(j − 1)) + αi di (S(j)) − di (S(j − 1)) (10) i=1   ≤ αop d({j }) − αj dj (S(j)) − d({j }) , 5 ∀ 2 ≤ j ≤ n. Such a characterization would be useful to augment a routing algorithm in suggesting SIR-feasible routes (when grouping ridesharing requests and assigning them to vehicles). Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 11 The proof is from expanding SIR constraints and algebraic manipulation (Appendix A.1). Note that the SIR-feasibility equation (10) only guarantees that there exists a budget balanced cost sharing scheme that is SIR on route rN . To check whether a specific cost sharing scheme is SIR, we would have to go back to the individual constraints (4). The recursive nature of the SIR-feasibility equation (10) makes it particularly easy to be incorporated into practical routing algorithms that involve sequential decision making, especially in dynamic ridesharing (see Section 6). 4. The Single Dropoff Scenario The previous section illustrates the complexity of the most general case, where the route rN consists of multiple pickup and dropoff points. Unfortunately, this complexity makes it difficult to infer a useful interpretation of the SIR-feasibility constraints (10). Thus, in this section, we consider the special case where all passengers 1 ≤ j ≤ n are traveling to a common destination Dj = D, which exposes an interesting property of SIR, namely, that SIR translates to “natural” bounds on the incremental detours. We begin this section by simplifying the general expressions introduced in Section 3 to the single dropoff scenario. We denote the distance between any two locations A and B in the underlying metric space by AB. Recall that S(j) = {1, 2, . . . , j }, and that we hide the explicit dependence on the routes to simplify notation. Thus, the distance functions become d(S(j)) = j−1 X Sk Sk+1 + Sj D, 1 ≤ j ≤ n, and di (S(j)) = k=1 j−1 X Sk Sk+1 + Sj D, 1 ≤ i ≤ j ≤ n. k=i (11) The cost functions then become OC (S(j)) = αop d(S(j)) = αop j−1 X ! Sk Sk+1 + Sj D , 1 ≤ j ≤ n. k=1 IC i (S(j)) = αi (di (S(j)) − di ({i})) = αi j−1 X ! Sk Sk+1 + Sj D − Si D , 1 ≤ i ≤ j ≤ n. k=i The disutilities are given by DU i (S(j)) = f (i, S(j)) + αi j−1 X ! Sk Sk+1 + Sj D − Si D , 1 ≤ i ≤ j ≤ n. k=i The IR constraints for any budget-balanced cost sharing scheme simplify to ! n−1 X f (i, N ) + αi Sk Sk+1 + Sn D − Si D ≤ f (i, {i}) = αop Si D, 1 ≤ i ≤ n. k=i (12) Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 12 The SIR constraints (18) and (19) for a budget-balanced cost sharing scheme simplify to   f (i, S(j)) − f (i, S(j − 1)) + αi (Sj−1 Sj + Sj D − Sj−1 D) ≤ 0, 1 ≤ i < j ≤ n. f (j, S(j)) ≤ αop Sj D, 2 ≤ j ≤ n. Finally, the SIR-feasibility constraints (10) from Theorem 1 simplify to Sj−1 Sj + Sj D − Sj−1 D ≤ 1+ Sj D Pj−1 1 αop k=1 αk , 2 ≤ j ≤ n. (13) Notice that when restricted to the single dropoff scenario, the SIR-feasibility constraints assume a much simpler form. For each j, the constraint has terms involving only j and j − 1. This “Markovian” nature could prove useful when studying algorithmic problems relating to SIR (see Section 6). Upon closer inspection, we note that the left hand side of the SIR-feasibility constraints (13) are nothing but the incremental detours due to picking up subsequent passengers j. Thus, (13) can be viewed as imposing an upper bound on the permissible incremental detour involved in picking up passenger j. This bound diminishes with increasing j and increasing proximity to the destination, which means that as more passengers are picked up, the permissible additional detour to pick up yet another passenger keeps shrinking, which is natural. For the passengers in Example 1, Fig. 2 shows the evolution of the “SIR-feasible region” (points from which the next passenger can be picked up so that the resultant route is SIR-feasible) in Euclidean space, when αj = αop for j = 1, 2, 3. The shape resembles that of a rotated teardrop. Figure 2 Evolution of the SIR-feasible region (dark shade) while picking up passengers that are traveling to a common destination. Note that the region diminishes rapidly with every subsequent pickup. 4.1. Bounds on Total Distance Traveled along SIR-Feasible Routes The bounds on incremental detours given by the SIR-feasibility constraints (13) can be combined to obtain bounds on the total distance traveled by a passenger i ∈ N along any SIR-feasible route, as a fraction of their direct travel distance Si D. We call this measure the “starvation factor” of passenger i. The starvation factor of a route is the maximum starvation factor among all the passengers. Intuitively, the starvation factor of a route is a decreasing function of the ratios αk , αop Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 13 since the permissible detours are, from (13). That is, passengers that are more sensitive to detours should suffer smaller starvation factors. Our goal in this section is to quantify this intuition. Let I (n) denote the space of all single dropoff instances of size n (consisting of n pickup points and a common dropoff point from an underlying metric space). Given an instance p ∈ I (n), let R(p) denote the set of all SIR-feasible routes for this instance. ;r) Given an SIR-feasible route r ∈ R(p), let γr (i) = diS(N denote the starvation factor of passenger iD Pn−1 i along route r, where di (N ; r) = k=i Sk Sk+1 + Sn D, from (11), and let γr = maxi∈N γr (i) denote the starvation factor of the route r. Definition 8. The SIR-starvation factor over all single dropoff instances of size n is γ(n) = max min γr . p∈I(n) r∈R(p) We show the following bounds for γ(n): 1. Upper Bounds: (Theorems 2-4) The worst starvation factor among SIR-feasible routes, √ maxp∈I(n) maxr∈R(p) γr , is (i) Θ(2n ) when ααopi → 0, (ii) Θ( n) when ααopi = 1, and (iii) 1 when αi αop → ∞, for all i ∈ N . As upper bounds for γ(n), these are not necessarily tight, since an instance for which an SIR-feasible route has the worst starvation factor may also admit other SIR-feasible routes with smaller starvation factors. 2. Lower Bounds: (Theorem 5) γ(n) is no smaller than (i) Θ(n) when when αi αop αi αop → 0, and (ii) Θ(log n) = 1, for all i ∈ N . These lower bounds are tight. It is interesting to note that the gap between the upper and lower bounds narrows down and vanishes as αi αop increases to ∞.6 The proofs are complex, and can be found in Appendix A. We begin by establishing an almost obvious result that when passengers are infinitely inconvenienced by even the smallest of detours,7 the only SIR-feasible routes (indeed, even IR-feasible routes) are those with zero detours, which implies a starvation factor of 1. Theorem 2. If αi αop → ∞ for all i ∈ N , then γr = 1 for any SIR-feasible route r. Next, we consider passengers who value their time more than αop , and show that the worst they √ would have to endure is a sublinear starvation factor, in particular, Θ( n). This is tight, that √ is, there exists an SIR-feasible route with Θ( n) starvation factor, when αi = αop for all i ∈ N . √ However, as the αi keep increasing beyond αop , this bound becomes looser, culminating in a Θ( n) gap when αi → ∞, as evidenced by Theorem 2. Theorem 3. If αi αop √ ≥ 1 for all i ∈ N , then γr ≤ 2 n for any SIR-feasible route r. 6 Note that, by definition, 1 is always a trivial lower bound for the starvation factor of any route, since the points are from an underlying metric space. 7 Frankly, why would such passengers even consider ridesharing? Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 14 Even though it may be unrealistic, as an academic exercise, we investigate an upper bound on γr when the passengers are completely unaffected by detours, that is, αi αop → 0 for all i ∈ N . Not surprisingly, it turns out that the starvation factor can be exponentially large in such a scenario, as the next theorem shows. Theorem 4. If αi αop → 0 for all i ∈ N , then γr ≤ 2n for any SIR-feasible route r. The upper bounds of Theorems 3-4 on γr are tight, as discussed next; however, by Definition 8, they also serve as upper bounds on γ(n), in which capacity, they may not necessarily be tight. This is because, an instance for which an SIR-feasible route has the worst starvation factor may also admit better SIR-feasible routes. For example, Fig. 3 depicts an instance in one-dimensional Euclidean space for which the route (S1 , S2 , . . . , Sn , D) is SIR-feasible (satisfying (21) with equality) and has a √ starvation factor of Θ( n). (The same instance with the distances appropriately modified illustrates the Θ(2n ) starvation factor of Theorem 4.) However, note that the reverse route (Sn , Sn−1 , . . . , S1 , D) is also SIR-feasible and has a starvation factor of 1. Figure 3 √ Single dropoff instance with a route (S1 , S2 , . . . , Sn , D) whose starvation factor is Θ( n). If the distances Si D, 1 ≤ i ≤ n, were 2i−1 ` instead, then the starvation factor of the same route would be Θ(2n ). Finally, we establish a tight lower bound on γ(n) for arbitrary αi > 0, by exhibiting an instance with a unique SIR-feasible route with the desired starvation factor. Pn  Pj−1 −1 Theorem 5. γ(n) ≥ j=1 1 + α1op k=1 αk . It is easy to observe that the lower bound of Theorem 5 simplifies to Θ(log n) when Θ(n) when 5. αi αop αi αop = 1, and → 0, for all i ∈ N . The Benefit of Ridesharing and Sequential Fairness In this section, we explore the consequences of sequential fairness (defined in Section 2.3) on the design of cost sharing schemes for ridesharing, in the single dropoff scenario. First, for 2 ≤ j ≤ n, 1 ≤ i ≤ j, the expression for incremental benefit to passenger i due to the addition of passenger j is ( f (i, S(j − 1)) − f (i, S(j)) − αi (Sj−1 Sj + Sj D − Sj−1 D) , 1 ≤ i < j IB i (S(j)) = αop Sj D − f (j, S(j)), i = j. (14) Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 15 Thus, for 2 ≤ j ≤ n, the total incremental benefit due to the addition of passenger j is given by ! j j−1 X X T IB (S(j)) = IB k (S(j)) = αop Sj D − αop + αk (Sj−1 Sj + Sj D − Sj−1 D) , (15) k=1 k=1 where the dependence on f vanishes due to budget-balance. For the single dropoff scenario, the incremental inconvenience cost to i due to the detour caused by j is given by IC i (Sij ) − IC i (Si(j−1) ) = αi (Sj−1 Sj + Sj D − Sj−1 D); hence, Definition 6 simplifies to the following equivalent definition. Definition 9. Given a vector β~ = (β2 , β3 , . . . , βn ), where 0 ≤ βj ≤ 1 for 2 ≤ j ≤ n, a budget ~ balanced cost sharing scheme f is β-sequentially fair if, on any SIR-feasible route, ( αi βj Pj−1 , 1≤i≤j −1 IB i (S(j)) αm m=1 = (∀ 2 ≤ j ≤ n) T IB (S(j)) 1 − βj , i = j. Note that 1 − βj denotes the fraction of the total incremental benefit enjoyed by the new passenger j as a result of having them join the ride, and βj denotes the remaining fraction, which is split among the existing passengers in proportion to their αi values. It turns out that the requirements imposed by Definition 9, while perhaps appearing to be quite lenient, are sufficient for a strong and meaningful characterization of sequentially fair cost sharing schemes, as we discuss next. 5.1. Characterizing Sequentially Fair Cost Sharing Schemes We begin this section with a theorem that provides an exact characterization of budget balanced sequentially fair cost sharing schemes for single dropoff scenarios. Theorem 6. Given a vector β~ = (β2 , β3 , . . . , βn ), where 0 ≤ βj ≤ 1 for 2 ≤ j ≤ n, a budget~ balanced cost sharing scheme f is β-sequentially fair if and only if, for 2 ≤ j ≤ n, • The cost to the incoming passenger j is given by "   f (j, S(j)) = βj αop Sj D + (1 − βj ) αop + j−1 X ! # αm (Sj−1 Sj + Sj D − Sj−1 D) . (16) m=1 • The incremental “discount” to each existing passenger 1 ≤ i ≤ j − 1 is given by " # αi f (i, S(j − 1)) − f (i, S(j)) = βj Pj−1 m=1 αm (αop Sj D − αop (Sj−1 Sj + Sj D − Sj−1 D)) (17)   + (1 − βj ) αi (Sj−1 Sj + Sj D − Sj−1 D) . We omit the proof, since it is simply a straightforward substitution of equations (14)-(15) in Definition 9 and rearrangement of the terms. The characterization of Theorem 6 reveals elegant structural properties of sequentially fair cost sharing schemes: 16 Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 (a) Online Implementability. When a passenger j is picked up, their estimated cost is given by f (j, S(j)), which is their final payment if there are no more pickups. At the same time, each existing passenger i is offered a “discount” in the amount of f (i, S(j − 1)) − f (i, S(j)) that brings down their earlier cost estimates. This suggests a novel “reverse-meter” design for a ridesharing application on each passenger’s smartphone that keeps track of their estimated final payment, as the ride progresses. Starting with f (i, S(i)) when passenger i begins their ride, it would keep decreasing every time a detour begins to pick up a new passenger. Such a visually compelling interface would encourage wider adoption of ridesharing. (b) Convex Combination of Extreme Schemes. For each j, 2 ≤ j ≤ n, the cost sharing scheme is a convex combination of the following two extreme schemes: • The total incremental benefit is fully enjoyed by the incoming passenger j, i.e., βj = 0. Here, from (16)-(17), the incoming passenger j (a) pays the service provider an amount αop (Sj−1 Sj + Sj D − Sj−1 D) that corresponds to the increase in the operational cost, and (b) pays each existing passenger 1 ≤ i ≤ j − 1 an amount αi (Sj−1 Sj + Sj D − Sj−1 D) that corresponds to the incremental inconvenience cost they suffered. • The total incremental benefit is fully enjoyed by the existing passengers 1 ≤ i ≤ j − 1, i.e., βj = 1. Here, from (16)-(17), the incoming passenger j pays αop Sj D, the same as they would have paid for a private ride. From this, the service provider recovers αop (Sj−1 Sj + Sj D − Sj−1 D) that corresponds to the increase in the operational cost, and what is left is split among the existing passengers proportional to their αi values. Note that the incoming passenger j pays the least in the former scheme (βj = 0) and the most in the latter scheme (βj = 1). (c) Transfers Between Passengers. From the previous observation, it follows that incoming passengers must, at minimum, fully compensate existing passengers for the incremental inconvenience costs that resulted from the detour to pick them up, which can be viewed as internal transfers between passengers. Even though it may be reasonable to expect this from a fair cost sharing scheme, it is remarkable that sequential fairness mandates this property. In designing a sequentially fair cost sharing scheme, β~ can be chosen strategically to incentivize commuters to rideshare. A commonly used incentive is to guarantee a minimum discount on the cost of a private ride. In our framework of sequentially fair cost sharing schemes, it corresponds to setting βj so that f (j, S(j)) is a desired fraction of αop Sj D.8 We end this section with an example. 8 The SIR-feasibility constraints would have to be appropriately tightened to guarantee such a discount. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 17 Example 2. Consider the single dropoff scenario, where we also assume that αi = αop = 1 for all i ∈ N . For 1 ≤ i ≤ j ≤ n, we define the cost sharing scheme f XC as: j X Sk−1 Sk Sj D f (i, S(j)) = + k−1 j k=i+1 XC ! + (i − 1) (Si−1 Si + Si D − Si−1 D) − j X ! (Sk−1 Sk + Sk D − Sk−1 D) , k=i+1 The first terms correspond to dividing the operational cost of each segment equally among the ridesharing passengers traveling along that segment. The second terms correspond to the passenger i compensating each of the i − 1 passengers that were picked up earlier, for the incremental detour they suffered. The last terms correspond to the net compensation received by passenger i from all passengers that were picked up later, for the incremental detours that i suffered. Intuitively, f XC is a “fair” cost sharing scheme. In fact, it can be shown that for β~ = ~ it is a β-sequentially fair cost sharing scheme: 1 1 , , . . . , n1 2 3  , From (16)-(17), we get IB j (S(j)) Sj D − f XC (j, S(j)) = T IB(S(j)) Sj D − j (Sj−1 Sj + Sj D − Sj−1 D)   S D Sj D − jj + (j − 1) (Sj−1 Si + Sj D − Sj−1 D) j −1 1 = = =1− , Sj D − j (Sj−1 Sj + Sj D − Sj−1 D) j j as desired. Also, for 1 ≤ i ≤ j − 1, we get IB i (S(j)) f XC (i, S(j − 1)) − f XC (i, S(j)) − (Sj−1 Sj + Sj D − Sj−1 D) = T IB(S(j)) S D − j (Sj−1 Sj + Sj D − Sj−1 D)  j  Sj−1 Sj Sj−1 D S D − j−1 + jj + (Sj−1 Sj + Sj D − Sj−1 D) − (Sj−1 Sj + Sj D − Sj−1 D) j−1 = Sj D − j (Sj−1 Sj + Sj D − Sj−1 D) = 6. Sj D j (j−1) − j−1 1 (Sj−1 Sj + Sj D − Sj−1 D) Sj D − j (Sj−1 Sj + Sj D − Sj−1 D) = 1 1 . j j −1 New Algorithmic Problems As discussed in Section 3.1, the SIR-feasibility constraints (10) or (13), can be considered as additional constraints to the routing optimization problem. For instance, vehicle routing problems with various operational objectives, ridesharing with multiple pickups and dropoff points, online routing problems can all benefit from incorporating SIR-feasibility constraints while performing route optimization. As a concrete example, consider the following single dropoff ride matching and routing problem: Given n pickup points and a common dropoff point in a metric space, (a) does there exist an n allocation of pickup points to 1 ≤ m ≤ n vehicles, each with capacity d m e ≤ c ≤ n, such that there exists an SIR-feasible route for each vehicle? And (b) if so, what is the allocation and corresponding routes that minimize the total “vehicle-miles” traveled? Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 18 We do not know whether the feasibility problem (a) can be solved in polynomial time, even when m = 1 and αi = αj for all 1 ≤ i, j ≤ n, where it reduces to finding a sequence of the pickup points that satisfies the inequalities (13). The “Markovian” nature of these inequalities (each inequality only depends on adjacent pickup points in the route) suggests that it may be worth trying to come up with a polynomial time algorithm for the feasibility problem. In Section 6.1, we show that this problem is NP-hard when not restricted to a metric space, which implies that any poly-time algorithm, if one exists, must necessarily exploit the properties of a metric space. However, even if one succeeds in this endeavor, we show in Section 6.2 that the optimization (b) over all SIR-feasible routes is NP-hard. Like SIR-feasibility, there might be other constraints on the ordering of the pickup points (for instance, due to hard requirements on pickup times). Studying such variants might help understand how to tackle SIR-feasibility constraints. For example, it is known that finding the optimal allocation (minimizing the total vehicle-miles traveled) of passengers to vehicles without any restriction on the order of pickups is NP-hard Cordeau et al. (2006). On the other hand, as we show in Section 6.3, the problem is polynomial time solvable if a strict total ordering is imposed and the capacity of each vehicle is unrestricted. It then becomes an interesting future direction to investigate what kinds of order constraints retain polynomial time solvability of the problem. 6.1. Determining Existence of SIR-Feasible Routes is Hard In this section, we present Theorem 7, which shows that, for the single-dropoff scenario, determining whether an SIR-feasible route exists is NP-hard in general, by a reduction from the undirected Hamiltonian path problem.9 The proof is deferred to Appendix B. Definition 10. Given a set N of n pickup points, and a common dropoff point in an underlying (possibly non-metric) space, and positive coefficients αop , α1 , α2 , . . . , αn , SIR-Feasibility is the problem of determining whether an SIR-feasible route of length n exists, that is, whether there exists a sequence of the pickup points that satisfies the SIR-feasibility constraints (13). Theorem 7. SIR-Feasibility is NP-hard. However, it can be easily seen that SIR-Feasibility is not hard in certain special cases and in certain metric spaces. Consider an input graph, where the pickup points and the dropoff point are embedded on a line, and αi = αop for all i ∈ N . Without loss of generality, we assume that the pickup points {S1 , . . . , Sn } appear in the same order on the line, so that S1 and Sn are the two end points. Clearly, if the destination D occurs before S1 (respectively, after Sn ), the instance is 9 Given an undirected graph, a Hamiltonian path is a path in the graph that visits each vertex exactly once. The undirected Hamiltonian path problem is to determine, given an undirected graph, whether a Hamiltonian path exists. It is known to be NP-hard. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 19 SIR-feasible. This is because the route starting from Sn (respectively, S1 ) and ending at D, visiting all the pickup points along the way incurs zero detour for everyone, and is thus SIR-feasible. In fact, such a route also traverses the minimum distance among all feasible routes. However, consider the case where D is located at some intermediate location. Such an instance will never be SIR-feasible. To see this, first consider an instance where n = 2, and S1 < D < S2 . Let S1 D = x, S2 D = y; hence S1 S2 = x + y. We analyze the SIR-feasiblity constraints (13) for each of two cases. If S1 is visited before S2 , then SIR-feasibility requires that x + y + y − x ≤ y2 , which is impossible. Similarly, if S2 is visited before S1 , then SIR-feasibility requires that x + y + x − y ≤ x2 , which is also impossible. Now, when n > 2 and D is located at an intermediate point, any feasible route must, at some point, “jump over” D from some Si to another Sj , at which stage the analysis would be the same as that for n = 2, and is therefore not SIR-feasible. A similar phenomenon can be observed when the underlying metric is a tree rooted at D and the pickup points are located at the leaves, and αi = αop for all i ∈ N . It can be shown that instances where the pickup points are spread across more than one subtree rooted at D cannot be SIR-feasible, and when the pickup points are all part of a single subtree rooted at D, SIR-feasibility can be checked in polynomial time. We leave open the problem of determining whether SIR-Feasibility is hard in general metric spaces. 6.2. Optimizing over SIR-Feasible Routes is Hard Given an undirected weighted graph, the problem of determining an optimal Hamiltonian cycle10 (one that minimizes the sum of the weights of its edges) is a well known problem called the Traveling Salesperson Problem, abbreviated as TSP. A slight variant of this problem, known as Path-TSP, is when the traveling salesperson is not necessarily required to return to the starting point or depot, in which case we only seek an optimal Hamiltonian path. These problems are NP-hard (Papadimitriou 1994). Special cases of the above problems arise when the graph is complete and the edge weights correspond to distances between vertices from a metric space. These variants, which we call MetricTSP and Metric-Path-TSP, respectively, are also NP-hard, e.g., Papadimitriou (1977) showed the hardness for the Euclidean metric. Definition 11. Given a set N of n pickup points, a common dropoff point in an underlying metric space, and positive coefficients αop , α1 , α2 , . . . , αn , Opt-SIR-Route is the problem of finding an SIR-feasible route of length n of minimum total distance. Theorem 8. Opt-SIR-Route is NP-hard. The proof is via a reduction from Metric-Path-TSP ; see Appendix B. 10 A Hamiltonian cycle is a Hamiltonian path that is a cycle. In other words, it is a cycle in the graph that visits each vertex exactly once. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 20 6.3. Optimal Allocation of Totally Ordered Passengers to Uncapacitated Vehicles In this section, we present a polynomial time algorithm for optimal allocation of passengers to vehicles (minimizing the total vehicle-miles traveled), given a total order on the pickups, and when the capacity of any vehicle is unrestricted. To the best of our knowledge, this result is new; see Prins et al. (2014) for a survey on related problem variants. Our result relies on reducing the allocation problem to a minimum cost flow problem on a flow network with integral capacities. We are given the set N of passengers (that is, the set of n ordered pickup locations) traveling to a single dropoff location D. Without loss of generality, we let the indices in N reflect the position in the pickup order, that is, u ∈ N is the u-th pick up from location Su . For convenience, we index the destination D as n + 1. Let the unknown optimal assignment use 1 ≤ m0 ≤ n vehicles (we address how to find it later). A directed acyclic flow network (see Figure 4) is then constructed as follows: (1) s and t denote the source and sink vertices, respectively. (2) For each passenger/pickup location u ∈ N , we create two vertices and an edge: an entry vertex uin , an exit vertex uout , and an edge of cost 0 and capacity 1 directed from uin to uout . We also create a vertex n + 1 corresponding to the dropoff location. (3) We create n edges, one each of cost 0 and capacity 1 from the source vertex s to each of the entry vertices uin , u ∈ N . (4) We create n edges, one each of cost Su D and capacity 1 from each of the exit vertices uout , u ∈ N , to the dropoff vertex n + 1. (5) To encode the pickup order, for each 1 ≤ u < v ≤ n we create an edge of cost (Su Sv − L) and capacity 1 directed from uout to vin , where L is a sufficiently large number satisfying L > 2 maxu,v∈N ∪{n+1} Su Sv . (6) We add a final edge of cost 0 and capacity m0 from the dropoff vertex n + 1 to the sink vertex t, thereby limiting the maximum flow in the network to m0 units. Since all the edge capacities are integral, the integrality theorem guarantees an integral minimum cost maximum flow, and we assume access to a poly-time algorithm to compute it in a network with possibly negative costs on edges. Notice that we do have negative edge costs (step (5) of the above construction); however, our network is a directed acyclic graph, owing to the fact that there is a total ordering on the pickup locations. Hence, there are no negative cost cycles. We defer the full proof to Appendix B.3; however, we briefly outline the steps involved: • Any integral maximum flow from s to t must be comprised of m0 vertex-disjoint paths between the source vertex s and the dropoff vertex n + 1. • Any integral minimum cost flow must cover all the 2n pickup vertices, that is, a unit of flow enters every entry vertex uin , and a unit of flow exits each exit vertex uout , u ∈ N . Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 Figure 4 21 Illustration of the directed acyclic flow network, a minimum cost maximum flow on which corresponds to an assignment of n totally ordered passengers to m0 uncapacitated vehicles. Each of the edge labels correspond to a tuple consisting of edge cost and edge capacity. • The partition of N according to the m0 vertex-disjoint paths between s and n + 1 in an integral minimum cost maximum flow corresponds to the optimal allocation of the n totally ordered passengers among m0 uncapacitated vehicles. Finally, we argue that the overall optimal assignment can be obtained by computing the optimal assignments using the above reduction for each 1 ≤ m0 ≤ n and choosing the one with the overall minimum cost, which completes the reduction. 7. Concluding Remarks In addition to the discussion in Section 2.4, and the open algorithmic questions raised in the previous section, there are a few other important aspects that we believe future work should address. We conclude the paper with brief discussions of these issues. Throughout, we have assumed knowledge of the passengers’ αi values; but in reality, they are most likely private information, especially in commercial ridesharing. One can either attempt to learn these values over time from passenger feedback, or, one can ask the passenger for this information. In the latter case, truthful reporting is a concern. Since our framework explicitly takes into account the inconvenience costs of passengers while considering SIR-feasibility as well as sequential fairness, no sequentially fair cost sharing scheme can be dominant strategy incentive compatible. It would be interesting to study the trade-offs between efficiency, fairness, budget-balance, and incentive compatibility. The best framework in which to study these questions (including in more general Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 22 settings where there is uncertainty about future pickup requests) is perhaps online mechanism design (Parkes 2007, Zhao et al. 2015, Shen et al. 2016). The duality between cost sharing and benefit sharing in our framework is worth a deeper analysis. While the space of cost sharing schemes that the two views accommodate are no different from each other, there is a crucial difference in approaching their design. In particular, notice that a budget balanced cost sharing scheme need only recover the operational costs; see (1). The inconvenience costs experienced by the passengers are a separate artifact of our framework, which only explicitly affect the design of cost sharing schemes when viewed through the lens of benefit sharing and sequential fairness. What “traditional” fairness properties does a sequentially fair cost sharing scheme possess? Under what conditions, if any, is it a (generalized) Shapley value, or is in the core? Appendix A: A.1. Proofs from Section 4 Proof of Theorem 1 The proof follows from expanding the SIR constraints (4). First, for any 2 ≤ j ≤ n, and 1 ≤ i ≤ j − 1, the SIR constraint can be expanded as f (i, S(j)) + IC i (S(j)) ≤ f (i, S(j − 1)) + IC i (S(j − 1))     =⇒ f (i, S(j)) − f (i, S(j − 1)) + IC i (S(j)) − IC i (S(j − 1)) ≤ 0. (18) For i = j, the SIR constraint can be expanded as f (j, S(j)) + IC j (S(j)) ≤ f (j, {j}) (19) =⇒ f (j, S(j)) ≤ αop d({j}) − IC j (S(j)), where, it follows from budget-balance that f (j, {j}) = αop d({j}). The “only if” direction can be seen to hold by adding all the j inequalities given by (18) and (19), for all 2 ≤ j ≤ n. j X i=1 f (i, S(j)) − j−1 X j−1   X  f (i, S(j − 1)) + IC i (S(j)) − IC i (S(j − 1)) ≤ αop d({j}) − IC j (S(j)). i=1 i=1 Using the budget-balance property (1) to simplify the first two terms, we get  j−1   X  OC(S(j)) − OC(S(j − 1)) + IC i (S(j)) − IC i (S(j − 1)) ≤ αop d({j}) − IC j (S(j)). (20) i=1 Equation (10) then follows by substituting for OC(·) and IC i (·) from (8) and (9) respectively, and simplifying. Next, we prove the “if” direction. Assuming that (10) holds, or, alternatively, assuming that (20) holds, it suffices to exhibit a budget-balanced cost sharing scheme f , under which all the SIR constraints given by (18) and (19) are satisfied. For 1 ≤ j ≤ n, and 1 ≤ i ≤ j, we construct f (i, S(j)) recursively, so that (18) and (19) are satisfied. The base case follows from budget-balance, that is, f (i, {i}) = αop d({i}) for all i ∈ N . Assume that for some 2 ≤ j ≤ n, we have defined f (i, S(j − 1)) for all 1 ≤ i ≤ j − 1. Then, we set   f (i, S(j)) = f (i, S(j − 1)) − IC i (S(j)) − IC i (S(j − 1)) , 1 ≤ i ≤ j − 1 f (j, S(j)) = OC(S(j)) − j−1 X i=1 f (i, S(j)). Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 23 By construction, it follows that (18) is satisfied, and f is budget-balanced. It remains to be shown that (19) is also satisfied. By budget balance, f (j, S(j)) = OC(S(j)) − j−1 X f (i, S(j)) i=1 = OC(S(j)) − j−1  X   f (i, S(j − 1)) − IC i (S(j)) − IC i (S(j − 1)) i=1 j−1   X  = OC(S(j)) − OC(S(j − 1)) + IC i (S(j)) − IC i (S(j − 1))  i=1 ≤ αop d({j}) − IC j (S(j)), where, the last step follows from the assumption that (20) holds, and the previous step follows from the budget-balance property. This completes the proof. A.2.  Proof of Theorem 2 First, we note that in the limit, when αi αop → ∞ for all i ∈ N , the SIR-feasibility constraints (13) reduce to Sj−1 Sj + Sj D − Sj−1 D ≤ 0, 2 ≤ j ≤ n. Since the points are from an underlying metric space, distances satisfy the triangle inequality, which means Sj−1 Sj + Sj D − Sj−1 D ≥ 0, 2 ≤ j ≤ n. Sj−1 Sj + Sj D − Sj−1 D = 0, 2 ≤ j ≤ n. Therefore, it must be that By summing up the last n − i equations, i.e., i + 1 ≤ j ≤ n, we get n−1 X Sj Sj +1 + Sn D − Si D = 0, j =i from which we obtain Pn−1 γr = max i∈N j =i Sj Sj +1 + Sn D Si D ! = 1. This completes the proof. A.3.  Proof of Theorem 3 First, we note that under the constraint αi αop ≥ 1 for all i ∈ N , the SIR-feasibility constraints (13) imply Sj−1 Sj + Sj D − Sj−1 D ≤ Sj D , j 2 ≤ j ≤ n. (21) We begin by deriving an upper bound on the starvation factor of the i-th passenger, 1 ≤ i < n, along any SIR-feasible route. (Note that, in any single dropoff instance, the starvation factor of the last passenger to be picked up is always 1.) First, we sum up the last n − i inequalities of (21), i.e., i + 1 ≤ j ≤ n, to obtain n−1 X j =i Sj Sj +1 + Sn D − Si D ≤ n X Sj D j =i j . (22) Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 24 Next, we derive upper bounds for each Sj D, i < j ≤ n, in terms of Si D. The j-th SIR-feasibility constraint from (21) can be rewritten as Sj D − Sj D ≤ Sj−1 D − Sj−1 Sj . j We know that Sj−1 Sj + Sj−1 D ≥ Sj D, since all points are from an underlying metric space and therefore, distances are symmetric and satisfy the triangle inequality. Using this inequality above, we get Sj D ≤ Sj−1 D − (Sj D − Sj−1 D) j =⇒ (2j − 1)Sj D ≤ 2jSj−1 D 2j =⇒ Sj D ≤ Sj−1 D. 2j − 1 Sj D − Unraveling the recursion yields j Y 2k Sj D ≤ 2k −1 k=i+1 where, for m ≥ 1, Cm = Qm 2k k=1 2k−1 Cj = ! Si D = Cj Si D, Ci . We can evaluate Cj as follows: j Y j Y (2k)2 22j (j!)2 22j 2k = = = 2j  . 2k − 1 k=1 2k(2k − 1) (2j)! j k=1 We then use a known lower bound for the central binomial coefficient, 2j j  ≥ 22j−1 √ j √ , to obtain Cj ≤ 2 j. This √ yields Sj D ≤ 2 j Ci Si D. Substituting in (22), we get √ n n X 2 j 2 X 1 √ Sj Sj +1 + Sn D − Si D ≤ Si D = Ci j Ci j =i j j =i j =i !! n−1 n X 2 X 1 √ =⇒ Sj Sj +1 + Sn D ≤ 1 + Si D. Ci j =i j j =i n−1 X ! Si D This results in the desired upper bound for the starvation factor of the i-th passenger along any SIR-feasible route: 2 γr (i) ≤ 1 + Ci n X 1 √ j j =i ! . The starvation factor of a route is the maximum starvation factor of all its passengers: !! ! n n n X 2 X 1 2 X 1 1 √ √ √ , γr = max γr (i) ≤ max 1 + =1+ =1+ i∈N 1≤i<n Ci j =i j C1 j =1 j j j =1 since Ci is increasing in i and C1 = 2. The final step is to show that for all n ≥ 1, Pn j =1 1 √ j √ ≤ 2 n − 1. The proof is by induction. The base case (for n = 1) is satisfied with equality. Assume that the statement is true √ √ √ Pk+1 4k(k+1)+1 4k(k+1)+1+1 √ √ for some k ≥ 1. Then, for k + 1, we have, j =1 √1j ≤ 2 k − 1 + √k1+1 = − 1 ≤ −1 = k+1 k+1 √ √ (2k+1)+1 √ − 1 = 2 k + 1 − 1, which completes the inductive step. Using this bound, we get γr ≤ 2 n, as k+1 desired. This completes the proof.  Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 A.4. 25 Proof of Theorem 4 First, we note that in the limit, when αi αop → 0 for all i ∈ N , the SIR-feasibility constraints (13) reduce to Sj−1 Sj + Sj D − Sj−1 D ≤ Sj D, 2 ≤ j ≤ n. (23) Our proof technique is exactly the same as that for Theorem 3. We begin by deriving an upper bound on the starvation factor of the i-th passenger, 1 ≤ i < n, along any SIR-feasible route, by summing up the last n − i inequalities of (23) to obtain n−1 X Sj Sj +1 + Sn D − Si D ≤ j =i n X Sj D. (24) j =i Next, we derive upper bounds for each Sj D, i < j ≤ n, in terms of Si D. The j-th SIR-feasibility constraint from (23) can be rewritten as Sj−1 Sj ≤ Sj−1 D. Using this in the triangle inequality Sj D ≤ Sj−1 Sj + Sj−1 D, we get Sj D ≤ 2Sj−1 D. Unraveling this recursion then yields Sj D ≤ 2j−i Si D. Substituting this in (24), n−1 X Sj Sj +1 + Sn D − Si D ≤ j =i =⇒ n−1 X n X 2n−i Si D = j =i n−i X  2j Si D = 2n−i+1 − 1 Si D j =0 Sj Sj +1 + Sn D ≤ 2n−i+1 Si D. j =i Thus, the starvation factor of the i-th passenger along any SIR-feasible route is upper bounded as γr (i) ≤ 2n−i+1 . Finally, γr = max γr (i) ≤ max 2n−i+1 = 2n . i∈N 1≤i<n This completes the proof. A.5.  Proof of Theorem 5  Pj−1 −1 To reduce notational clutter, we let zj = 1 + α1op k=1 αk , for 1 ≤ j ≤ n. We exhibit a single dropoff Pn instance of size n for which there is a unique SIR-feasible path whose starvation factor is exactly j =1 zj . This instance is depicted in Fig. 5. Here, Sj D = ` for 1 ≤ j ≤ n, and Sj−1 Sk > Sj−1 Sj = zj ` for 2 ≤ j < k ≤ n. It is straightforward to see that the route (S1 , S2 , . . . , Sn , D) is SIR-feasible from (13), since for 2 ≤ j ≤ n, we have Sj−1 Sj + Sj D − Sj−1 D = zj ` + ` − ` = zj Sj D, by construction. Thus, the starvation factor for this Pn Pn route is given by j =2 zj + 1 = j =1 zj , as desired. It remains to be shown that no other route is SIR-feasible. First, we note that the SIR-feasibility constraints (13) for this example simplify to Sj−1 Sj ≤ zj `, 2 ≤ j ≤ n, (25) where z2 > z3 > . . . > zn , and Sj refers to the j-th pickup point along the route. The proof is by induction. First, consider the pickup point S1 , whose distance from S2 is z2 `, and from any other pickup point is strictly greater than z2 `, by construction. From (25), it can be seen that no two pickup points that are more than z2 ` apart can be visited in succession, and that the only way to visit two pickup points that are exactly z2 ` apart is to visit them first and second. Thus, any SIR-feasible route must begin by visiting S1 and S2 first. This logic can be extended to build the unique SIR-feasible route that we analyzed above. This completes the proof.  Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 26 Figure 5 Appendix B: B.1. Single dropoff instance to establish lower bound on the SIR-starvation factor. Proofs from Section 6 Proof of Theorem 7 Given an instance of the Hamiltonian path problem in the form of a simple, undirected graph G = (V, E), where V = {v1 , v2 , . . . , vn }, we construct an instance of SIR-Feasibility as follows. Let Pj denote a pickup point corresponding to vertex vj ∈ V . Let N = {P1 , P2 , . . . , Pn } denote the set of pickup points, and D denote the common dropoff point. Then, we set the pairwise distances to ( ` , (vi , vj ) ∈ E Pi Pj = n `, otherwise, where ` > 0 is any constant. We also set Pi D = ` for all i, and αop = α1 = α2 = . . . = αn , so that the SIR-feasibility constraints are given by (21). Then, there is a one-to-one correspondence between the set of Hamiltonian paths in G and the set of SIR-feasible routes in the corresponding instance of SIR-Feasibility, as follows: 1. Given a Hamiltonian path through a sequence of vertices (u1 , u2 , . . . , un ) in G, let the corresponding sequence of pickup points be (S1 , S2 , . . . , Sn ). Then, the route (S1 , S2 , . . . , Sn , D) is SIR-feasible, since the SIR-feasibility constraints (21) reduce to Sj−1 Sj ≤ ` j for 2 ≤ j ≤ n, which are true, by construction. 2. Given an SIR-feasible route (S1 , S2 , . . . , Sn , D), let the corresponding sequence of vertices in G be (u1 , u2 , . . . , un ). Since the route is SIR-feasible, it must be that Sj−1 Sj ≤ ` j for 2 ≤ j ≤ n. By construction, ` n this means that Sj−1 Sj = , implying that (uj−1 , uj ) ∈ E for 2 ≤ j ≤ n. Thus, the corresponding path is Hamiltonian. Hence, any algorithm for SIR-Feasibility can be used to solve the undirected Hamiltonian path problem with a polynomial overhead in running time. Since the latter is NP-hard, so is the former. This completes the proof.  Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 B.2. 27 Proof of Theorem 8 Given an instance of Metric-Path-TSP in the form of a complete undirected graph G = (V, E) and distances d(vi , vj ) for each vi , vj ∈ V from a metric space, we construct an instance of Opt-SIR-Route as follows. Let Pj denote a pickup point corresponding to vertex vj ∈ V . Let N = {P1 , P2 , . . . , Pn } denote the set of pickup points, and D denote the common dropoff point. We set the pairwise distances Pi Pj to be equal to d(vi , vj ) for all vi , vj ∈ V . We also set Pi D = L for all i, where  L>n  max Pi Pj 1≤i<j≤n is any constant. We also set αop = α1 = α2 = . . . = αn , so that the SIR-feasibility constraints are given by (21). It is easy to see that for any route (S1 , S2 , . . . , Sn , D), these SIR-feasibility constraints reduce to Sj−1 Sj ≤ ` j for 2 ≤ j ≤ n, which are true, by construction and our choice of L. Thus, all n! routes in our constructed instance of Opt-SIR-Route are SIR-feasible. Moreover, by construction, the distance traveled along any route is exactly L more than the weight of the path determined by the corresponding sequence of vertices in G. This implies that any optimal SIR-feasible route is given by a sequence of pickup points corresponding to an optimal Hamiltonian path in G, followed by a visit to D. Hence, any algorithm for Opt-SIR-Route can be used to solve Metric-Path-TSP with a polynomial overhead in running time. Since the latter is NP-hard, so is the former. This completes the proof. B.3.  Proof of Reduction from Section 6.3 Lemma 1. Any integral maximum flow from s to t must be comprised of m0 vertex-disjoint paths between the source vertex s and the dropoff vertex n + 1. Proof. First, we observe that any integral feasible flow from s to t in the network is comprised of vertex- disjoint paths between the source vertex s and the dropoff vertex n + 1, each carrying one unit of flow. This is because, every entry vertex uin has only one outgoing edge, namely, the one directed to its corresponding exit vertex uout , which has unit capacity. (Similarly, every exit vertex only has one incoming edge, of unit capacity.) Thus, once a unit of flow is routed through uin and uout by some path, another path cannot route any additional flow through these vertices. Since the maximum flow on the network is m0 units, any integral feasible maximum flow would have to have m0 such vertex-disjoint paths between s and n + 1, each carrying one unit of flow. This completes the proof.  Lemma 2. In any integral minimum cost flow, for every u ∈ N , there is exactly one unit of flow entering uin and exactly one unit of flow leaving uout . Proof. From the proof of Lemma 1, any integral feasible flow from s to t in the network is comprised of vertex-disjoint paths between the source vertex s and the dropoff vertex n + 1. Suppose by way of contradiction, an integral minimum cost flow does not route any flow through vin for some v ∈ N . Let Gv denote the set of passengers z ∈ N such that z < v and a unit of flow is routed via (zin , zout ). Consider two cases: Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 28 1. Case 1: Gv 6= ∅. Let u = max Gv , and let Pu be the path that carries a unit of flow from s to n + 1 through uin and uout . The first vertex in Pu after uout is either an entry vertex win for some w ∈ N (with w > v), or the dropoff vertex n + 1. Then, we construct a new flow where Pu is modified to route its unit of flow from uout first to vin to vout and then to win or n + 1, as the case may be. (Note that this new flow is feasible, since u < v < w < n + 1.) If M and M 0 denote the costs of the original flow and the new flow, then, we show that M 0 < M , contradicting the optimality of M : • If the original flow took the route uout → win , and consequently, the new flow takes the route uout → vin → vout → win , then, M 0 = M + Su Sv − L + Sv Sw − L − (Su Sw − L) < M by our choice of L. • If the original flow took the route uout → n + 1, and consequently, the new flow takes the route uout → vin → vout → n + 1, then, M 0 = M + Su Sv − L + Sv Sn+1 − Su Sn+1 < M by our choice of L. 2. Case 2: Gv = ∅. Let w ∈ N be such that a unit of flow is routed from s to win , Pw denoting the corresponding path. There may be more than one choice for win as defined, but all of them satisfy v < w, since Gv = ∅, so it does not matter which one is picked. As before, we construct a new flow where Pw is modified to route its unit of flow from s first to vin to vout and then to win . (Note that this new flow is feasible, since v < w.) If M and M 0 denote the costs of the original flow and the new flow, M 0 = M + Sv Sw − L < M by our choice of L, contradicting the optimality of M . This completes the proof.  Lemma 3. The partition of N according to the m0 vertex-disjoint paths between s and n + 1 in an integral minimum cost maximum flow corresponds to the optimal allocation of the n totally ordered passengers among m0 uncapacitated vehicles in the single dropoff scenario. Proof. From Lemma 1 and Lemma 2, we know that any integral minimum cost maximum flow F is comprised of m0 vertex-disjoint paths between s and n + 1 that cover all n pickup points between them, by routing a unit of flow along (uin , uout ) for all u ∈ N . We adopt a simplified representation of a path by removing the edges from the source vertex s, as well as the edges between uin and uout , the entry and exit vertices corresponding to pickup points u ∈ N . For example, a path s → uin → uout → vin → vout → n + 1 would be contracted to u → v → n + 1. Note that this does not affect the cost computation, since only zero cost edges are removed. For any u, v ∈ N , the cost of any edge (u, v) in the new representation is simply the cost of the edge (uout , vin ) in the old representation. Similarly, for any u ∈ N , the cost of any edge (u, n + 1) in the new representation is simply the cost of the edge (uout , n + 1) in the old representation. Let the set of these m0 paths be denoted as PF . Thus, we have established a one-to-one correspondence between (a) the set of all integral flows F comprised of m0 vertex-disjoint paths PF that collectively cover all n pickup locations, and (b) the set of all allocations of n totally ordered passengers (traveling to a single dropoff location n + 1) to m0 uncapacitated vehicles. For any path P ∈ PF , let |P | denote the length of the path, that is, the number of edges in the path. The cost of path P is then given by c(P ) = XX 1≤u<v≤n (u,v )∈P (Su Sv − L) + X 1≤u≤n (u,n+1)∈P Su Sn+1 . Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 29 Since all paths end with vertex n + 1, there are |P | − 1 terms in the first sum and 1 term in the last sum. Thus, c(P ) can be equivalently written as c(P ) = XX Su Sv − (|P | − 1)L. 1≤u<v≤n+1 (u,v )∈P The cost of flow F is simply the sum of the costs of the paths in PF , given by X c(F) = c(P ) = P ∈PF XX Su Sv − 1≤u<v≤n S +1 (u,v )∈ PF X (|P | − 1)L. P ∈PF Since |P |, the length of path P , also denotes the number of pickup points covered by P , and all the m0 paths are vertex-disjoint (except for n + 1), the summation in the second term is simply n − m0 , independent of the flow F. Thus, c(F) = XX Su Sv − (n − m0 )L = c(AF ) − (n − m0 )L, (26) 1≤u<v≤n S +1 (u,v )∈ PF where c(AF ) denotes the cost (total vehicle-miles traveled) of the corresponding allocation of n totally ordered passengers (traveling to a single dropoff location n + 1) to m0 uncapacitated vehicles. From (26), it is clear that the set of integral minimum cost maximum flows arg minF c(F) also corresponds to the set of optimal allocations of n totally ordered passengers among m0 uncapacitated vehicles in the single dropoff scenario. This completes the proof.  Theorem 9. There exists a poly-time algorithm to find an optimal allocation of totally ordered passengers to uncapacitated vehicles in the single dropoff scenario. Proof. Using the one-to-one correspondence established in Lemma 3, for each “guess” 1 ≤ m0 ≤ n, we find the corresponding optimal allocation by solving a minimum cost maximum flow problem in poly-time, finally choosing a guess with the overall least cost allocation.  References Agatz N, Erera A, Savelsbergh M, Wang X (2012) Optimization for dynamic ride-sharing: A review. European Journal of Operational Research 223(2):295–303. Agatz NA, Erera AL, Savelsbergh MW, Wang X (2011) Dynamic ride-sharing: A simulation study in metro atlanta. Transportation Research Part B: Methodological 45(9):1450–1464. Ahn J, Kim C, Han J, Choi Yr, Huh J (2012) Dynamic virtual machine scheduling in clouds for architectural shared resources. Proceedings of the 4th USENIX conference on Hot Topics in Cloud Computing, HotCloud’12. Aksin Z, Armony M, Mehrotra V (2007) The modern call center: A multi-disciplinary perspective on operations management research. Production and Operations Management 16(6):665–688. Alonso-Mora J, Samaranayake S, Wallar A, Frazzoli E, Rus D (2017) On-demand high-capacity ride-sharing via dynamic trip-vehicle assignment. Proceedings of the National Academy of Sciences 462467. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 30 Armbrust M, Fox A, Griffith R, Joseph AD, Katz R, Konwinski A, Lee G, Patterson D, Rabkin A, Stoica I, et al. (2010) A view of cloud computing. Communications of the ACM 53(4):50–58. Banerjee S, Johari R, Riquelme C (2015) Pricing in ride-sharing platforms: A queueing-theoretic approach. Proceedings of the Sixteenth ACM Conference on Economics and Computation, 639–639. Bateni MH, Chen Y, Ciocan DF, Mirrokni V (2016) Fair Resource Allocation in a Volatile Marketplace . Bertsimas D, Farias VF, Trichakis N (2011) The price of fairness. Operations research 59(1):17–31. Bimpikis K, Candogan O, Daniela S (2016) Spatial pricing in ride-sharing networks. SSRN . Bistaffa F, Farinelli A, Chalkiadakis G, Ramchurn S (2015) Recommending fair payments for large-scale social ridesharing. Proceedings of the 9th ACM Recommender Systems Conference (RecSys), 139–146. Bowersox DJ, Closs DJ, Stank TP (2000) Ten mega-trends that will revolutionize supply chain logistics. Journal of Business Logistics 21(2):1. Cao B, Alarabi L, Mokbel MF, Basalamah A (2015) SHAREK: A scalable dynamic ride sharing system. Proceedings of the 16th IEEE International Conference on Mobile Data Management (MDM), 4–13. Cole A (2015) Improving Airport Funding to Meet the Needs of Passengers. Tax Foundation Fiscal Fact (466). Cordeau JF, Laporte G, Savelsbergh MW, Vigo D (2006) Vehicle routing. Handbooks in operations research and management science: Transportation, volume 14, chapter 6, 367–428 (Elsevier). Dickerson JP, Procaccia AD, Sandholm T (2014) Price of fairness in kidney exchange. Proceedings of the 2014 international conference on Autonomous agents and multi-agent systems, 1013–1020 (International Foundation for Autonomous Agents and Multiagent Systems). Elmachtoub AN, Levi R (2014) From cost sharing mechanisms to online selection problems. Mathematics of Operations Research 40(3):542–557. Esteban J (1991) The social viability of money (competitive equilibria and the core of overlapping generations economies), volume 372 (Springer-Verlag). Furuhata M, Dessouky M, Ordóñez F, Brunet ME, Wang X, Koenig S (2013) Ridesharing: The state-of-theart and future directions. Transportation Research Part B: Methodological 57:28–46. Geisberger R, Luxen D, Neubauer S, Sanders P, Volker L (2010) Fast detour computation for ride sharing. Proceedings of the 10th Workshop on Algorithmic Approaches for Transportation Modelling, Optimization, and Systems, OASIcs-OpenAccess Series in Informatics, volume 14, 88–99 (Schloss DagstuhlLeibniz-Zentrum fuer Informatik). Haitao Cui T, Raju JS, Zhang ZJ (2007) Fairness and channel coordination. Management Science 53(8):1303– 1314. Heydrich S, van Stee R (2015) Dividing connected chores fairly. Theoretical Computer Science 593:51–61. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 31 Jackson KL (2011) The economic benefit of cloud computing. Technical report, NJVC. Jain K, Mahdian M (2007) Cost sharing. Nisan N, Roughgarden T, Tardos É, Vazirani VV, eds., Algorithmic Game Theory, chapter 15, 385–410 (Cambridge University Press). Kamar E, Horvitz E (2009) Collaboration and shared plans in the open world: Studies of ridesharing. IJCAI, 187–194. Katta A, Sethuraman J (2005) Pricing strategies and service differentiation in queues—A profit maximization perspective. Working paper, Columbia University. Kleiner A, Nebel B, Ziparo VA (2011) A mechanism for dynamic ride sharing based on parallel auctions. Proceedings of the Twenty-Second International Joint Conference on Artificial Intelligence (IJCAI), 266–272. Kondo D, Javadi B, Malecot P, Cappello F, Anderson DP (2009) Cost-benefit analysis of cloud computing versus desktop grids. IEEE International Symposium on Parallel & Distributed Processing, 1–12 (IEEE). McKenzie B (2015) Who drives to work? Commuting by automobile in the United States: 2013. American Community Survey Reports . Moulin H (2004) Fair division and collective welfare (MIT press). Narahari Y, Narayanam R, Garg D, Prakash H (2009) Foundations of mechanism design. Game Theoretic Problems in Network Economics and Mechanism Design Solutions, Part of the Series on Advanced Information and Knowledge Processing, 1–131 (Springer). Nguyen DT (2013) Fair cost sharing auction mechanisms in last mile ridesharing. Ph.D. thesis, Singapore Management University. Ozkan E, Ward AR (2016) Dynamic matching for real-time ridesharing. SSRN . Papadimitriou CH (1977) The euclidean travelling salesman problem is NP-complete. Theoretical Computer Science 4(3):237–244. Papadimitriou CH (1994) Computational Complexity (Addison-Wesley). Parkes DC (2007) Online mechanisms. Nisan N, Roughgarden T, Tardos É, Vazirani VV, eds., Algorithmic Game Theory, chapter 15, 411–439 (Cambridge University Press). Peha JM (2009) Sharing spectrum through spectrum policy reform and cognitive radio. Proceedings of the IEEE 97(4):708–719. Pelzer D, Xiao J, Zehe D, Lees MH, Knoll AC, Aydt H (2015) A partition-based match making algorithm for dynamic ridesharing. IEEE Transactions on Intelligent Transportation Systems 16(5):2587–2598. Prins C, Lacomme P, Prodhon C (2014) Order-first split-second methods for vehicle routing problems: A review. Transportation Research Part C: Emerging Technologies 40:179–200. Gopalakrishnan, Mukherjee, and Tulabandhula: The Costs and Benefits of Sharing Article submitted to Management Science; manuscript no. MS-17-01173 32 Santos DO, Xavier EC (2013) Dynamic taxi and ridesharing: A framework and heuristics for the optimization problem. Proceedings of the Twenty-Third International Joint Conference on Artificial Intelligence (IJCAI), volume 13, 2885–2891. Shen W, Lopes CV, Crandall JW (2016) An online mechanism for ridesharing in autonomous mobility-ondemand systems. Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, 475–481. Sivak M, Schoettle B (2016) Recent decreases in the proportion of persons with a driver’s license across all age groups. Transportation Research Institute Report, UMTRI-2016-4, University of Michigan, Ann Arbor . Zhao D, Ramchurn SD, Jennings NR (2015) Incentive design for ridesharing with uncertainty. CoRR abs/1505.01617. Zhao D, Zhang D, Gerding EH, Sakurai Y, Yokoo M (2014) Incentives in ridesharing with deficit control. Proceedings of the 2014 International Conference on Autonomous Agents and Multi-Agent Systems, 1021–1028. Zou B, Kafle N, Chang YT, Park K (2015) US airport financial reform and its implications for airport efficiency: An exploratory investigation. Journal of Air Transport Management 47:66–78.
8cs.DS
Coordinated Motion Planning: Reconfiguring a Swarm of Labeled Robots with Bounded Stretch∗ Erik D. Demaine1 , Sándor P. Fekete2 , Phillip Keldenich2 , Henk Meijer3 , and Christian Scheffer2 arXiv:1801.01689v1 [cs.CG] 5 Jan 2018 1 MIT Computer Science and Artificial Intelligence Laboratory, Cambridge, MA, USA, [email protected] 2 Department of Computer Science, TU Braunschweig Braunschweig, Germany, {s.fekete,p.keldenich,c.scheffer}@tu-bs.de 3 Science Department, University College Roosevelt Middelburg, The Netherlands, [email protected] Abstract We present a number of breakthroughs for coordinated motion planning, in which the objective is to reconfigure a swarm of labeled convex objects by a combination of parallel, continuous, collision-free translations into a given target arrangement. Problems of this type can be traced back to the classic work of Schwartz and Sharir (1983), who gave a method for deciding the existence of a coordinated motion for a set of disks between obstacles; their approach is polynomial in the complexity of the obstacles, but exponential in the number of disks. Other previous work has largely focused on sequential schedules, in which one robot moves at a time. We provide constant-factor approximation algorithms for minimizing the execution time of a coordinated, parallel motion plan for a swarm of robots in the absence of obstacles, provided some amount of separability. Our algorithm achieves constant stretch factor: If all robots are at most d units from their respective starting positions, the total duration of the overall schedule is O(d). Extensions include unlabeled robots and different classes of robots. We also prove that finding a plan with minimal execution time is NP-hard, even for a grid arrangement without any stationary obstacles. On the other hand, we show that for densely packed disks that cannot be well separated, a stretch factor Ω(N 1/4 ) may be required. On the positive side, we establish a stretch factor of O(N 1/2 ) even in this case. 1 Introduction Since the beginning of computational geometry, robot motion planning has been at the focus of algorithmic research. Planning the relocation of a geometric object among geometric obstacles leads to intricate scientific challenges, requiring the combination of deep geometric and mathematical insights with algorithmic techniques. With the broad and ongoing progress in robotics, the increasing importance of intelligent global planning with performance guarantees requires more sophisticated algorithmic reasoning, in particular when it comes to the higher-level task of coordinating the motion of many robots. From the early days, multi-robot coordination has received attention from the algorithmic side. Even in the groundbreaking work by Schwartz and Sharir [52] from the 1980s, one of the challenges was coordinating ∗ This work was partially supported by the DFG Research Unit Controlling Concurrent Change, funding number FOR 1800, project FE407/17-2, Conflict Resolution and Optimization. 1 the motion of several disk-shaped objects among obstacles. Their algorithms run in time polynomial in the complexity of the obstacles, but exponential in the number of disks. This illustrates the significant challenge of coordinating many individual robots. In addition, a growing number of applications focus primarily on robot interaction in the absence of obstacles, such as air traffic control or swarm robotics, where the goal is overall efficiency, rather than individual navigation. With the challenges of multi-robot coordination being well known, there is still a huge demand for positive results with provable performance guarantees. In this paper, we provide significant progress in this direction, with a broad spectrum of results. 1.1 Our Results • For the problem of minimizing the total time for reconfiguring a system of labeled circular robots in a grid environment, we show that it is strongly NP-complete to compute an optimal solution; see Theorem 1. • We give an O(1)-approximation for the long-standing open problems of parallel motion-planning with minimum makespan in a grid setting. This result is based on establishing an absolute performance guarantee: We prove that for any labeled arrangement of robots, there is always an overall schedule that gets each robot to its target destination with bounded stretch, i.e., within a constant factor of the largest individual distance. See Theorem 3 for the base case of grid-based configurations, which is extended later on. • For our approach, we make use of a technique to separate planar (cyclic) flows into so-called subflows whose thickness can be controlled by the number of subflows, see Definition 7 and Lemma 8. This is of independent interest for the area of packet routing with bounded memory: Our Theorem 4 implies that O(D) steps are sufficient to route any permutation of dilation D on the grid, even with a buffer size of 1, resolving an open question by Scheideler [51] dating back to 1998. • We extend our approach to establish constant stretch for the generalization of colored robot classes, for which unlabeled robots are another special case; see Theorem 13. • We extend our results to the scenario with continuous motion and arbitrary coordinates, provided the distance between a robot’s start and target positions is at least one diameter; see Theorem 15. This implies that efficient multi-robot coordination is always possible under relatively mild separability conditions; this includes non-convex robots. 1/4 • For the continuous case of N √ unit disks and weaker separability, we establish a lower bound of Ω(N ) and an upper bound of O( N ) on the achievable stretch, see Theorem 14 and Theorem 15. We also highlight the geometric difficulty of computing optimal trajectories even in seemingly simple cases; due to limited space, this can be found in Appendix E. 1.2 Related Work Different variants of multiple-object motion planning problems have received a large amount of attention from researchers in various areas of computer science and engineering; see [18] for a survey. Their practical relevance is reflected by the fact that there are industrial solutions used in automated warehouses for certain restricted forms of these problems [73]. There are different orthogonal criteria by which these problems can be characterized. A very important distinction is between discrete and continuous scenarios. In the discrete case, the input is a graph in which no two objects may use a vertex or edge at the same time; depending on the scenario, it may be allowed to rotate fully populated cycles. In the continuous or geometric setting, the objects are shapes in some geometric space which must be moved to a given target position in such a way that their interiors do not intersect at any time. Depending on the scenario, the shapes may or may not touch. Moreover, the objects may be confined to a certain region and there may be stationary obstacles. 2 Under these restrictions, it is unclear whether the target configuration is reachable at all. Aronov et al. [4] demonstrate that, for up to three robots of constant complexity, a path can be constructed efficiently if one exists. Ramanathan and Alagar [45] as well as Schwartz and Sharir [52] consider the case of several disk-shaped objects moving amongst polygonal obstacles. They both find algorithms deciding whether a given target configuration is reachable. Their algorithms run in time polynomial in the complexity of the obstacles, but exponential in the number of disks. Hopcroft et al. [32] and Hopcroft and Wilfong [33] demonstrate the reachability of a given target configuration is PSPACE-complete to decide; this already holds when restricted to rectangular objects moving in a rectangular region. Their proof was later generalized by Hearn and Demaine [29, 30], who proved that rectangles of size 1 × 2 and 2 × 1 are sufficient and introduced a more general framework to prove PSPACE-hardness of certain block sliding games. Moreover, this problem is similar to the well-known Rush Hour Problem, which was shown to be PSPACE-complete by Flake and Baum [23]. For moving disks, Spirakis and Yap [62] have proven strong NP-hardness of the same problem; however, their proof makes use of disks of varying size. Bereg et al. [6] as well as Abellanas et al. [1] consider minimizing the number of moves of a set of disks into a target arrangement without obstacles. They provide simple algorithms and establish upper and lower bounds on the number of moves, where a move consists of sliding one disk along some curve without intersecting other disks. These bounds were later improved on by Dumitrescu and Jiang [19], who also prove that the problem remains NP-hard for congruent disks even when the motion is restricted to sliding. Kirkpatrick and Liu [37] consider the case of moving two disks of arbitrary radius from a start into a target configuration in an otherwise obstacle-free plane, minimizing the sum of distances travelled by the disks. They provide optimal solutions for two disks moving from an arbitrary initial configuration into an arbitrary goal configuration. Their arguments do not seem to generalize to the makespan. Dı́az-Báñez et al. [17] considered the task of extracting a single object from a group of convex objects, moving a minimal number of objects out of the way. They present an algorithm that finds the optimal direction for extracting the object in polynomial time. On the practical side, there are several approaches to solving multi-object motion planning problems, both optimally and heuristically. For discrete instances with a moderate number of objects, optimal solutions can be found using standard search strategies like A∗ [28] in the high-dimensional search space of possible configurations. Numerous techniques can be used to improve the efficiency of these strategies [22, 26, 63]. Moreover, there is some work employing SAT solvers [34, 36] to solve multi-object motion planning problems to optimality. More recently, Yu and LaValle [74] present an IP-based exact algorithm for minimizing the makespan that works for hundreds of robots, even for challenging configurations with densities of up to 100%. For larger instances, one has to resort to heuristic solutions. In priority planning [9,16,21,25,47,67,69], the paths are planned one-by-one by assigning priorities to the objects and planning the movement in decreasing order of priority, treating all objects with higher priority as moving obstacles. Kant and Zucker [35] decompose the problem into planning the paths for all objects and avoiding collisions by adapting the velocity of the objects appropriately, an approach which several papers are based on [11, 41, 42, 44, 56]. Another approach is to compute paths for the objects individually and resolve collisions locally [24]. Between these simple decoupled heuristics which only consider individual objects at a time and highdimensional coupled search algorithms lie dynamically-coupled algorithms [3, 5, 53–55, 57, 68] which aim for better solutions at the price of higher computational costs. These algorithms typically consider individual objects and only increase the dimension of the search space once a non-trivial interaction between objects is discovered. Recently, Wagner and Choset [71] provided a complete algorithm based on a similar principle. With the advent of robot swarms, practical solutions to these problems became more important and the robotics community started to develop practical sampling-based algorithms [31, 49, 50, 59, 60, 64, 70] which, while working well in practice, are not guaranteed to find an (optimal) solution. In another recent work, Yu and Rus [75] present a practical algorithm based on a fine-grained discretization combined with an IP for the resulting discrete problem to provide near-optimal solutions even for densely populated environments. Other related work includes Rubenstein et al. [48], who demonstrated how to reconfigure a large swarm of simple, disk-shaped Kilobots; however, their method is sequential, relocating one robot at a time, so a full reconfiguration of 1000 robots takes about a day, highlighting the relevance of truly parallel motion planning. 3 Further extensions to higher-dimensional problems (with a wide range of additional motion constraints) are swarms of drones (e.g., the work by Kumar [66]) and even air traffic control (see Delahaye et al. [12] for a recent survey). In both discrete and geometric variants of the problem, the objects can be labeled, colored or unlabeled. In the labeled case, the objects are all distinguishable and each object has its own, uniquely defined target position. This is the most extensively studied scenario among the three. In the colored case, the objects are partitioned into k groups and each target position can only be covered by an object with the right color. This case was recently considered by Solovey and Halperin [57], who present and evaluate a practical sampling-based algorithm. In the unlabeled case, the objects are indistinguishable and each target position can be covered by any object. This scenario was first considered by Kloder and Hutchinson [38], who presented a practical sampling-based algorithm. In this situation, Turpin et al. [65] prove that it is possible to find a solution in polynomial time, if one exists. This solution is optimal with respect to the longest distance traveled by any one robot. However, their results only hold for disk-shaped robots under additional restrictive assumptions on the free space. For unit disks and simple polygons, Adler et al. [2] provide a polynomial-time algorithm under the additional assumption that the start and target positions have some minimal distance from each other. Under similar separability assumptions, Solovey et al. [61] provide a polynomial time-algorithm that produces a set of paths that is no longer than OPT + 4m, where m is the number of robots. However, they do not consider the makespan, but only the total path length. On the negative side, Solovey and Halperin [58] prove that the unlabeled multiple-object motion planning problem is PSPACE-hard, even when restricted to unit square objects in a polygonal environment. Regarding discrete multiple-object motion planning, Cǎlinescu et al. [8] consider the non-parallel motion planning problem on graphs, where each object can be moved along an unoccupied path in one move. They prove that both in the unlabeled and in the labeled case, minimizing the number of moves required is APX-hard. They provide 3-approximation algorithms for the unlabeled case on general graphs. Moreover, they prove that the problem remains NP-complete on the infinite rectangular grid. Their results are different from our results because the objective they consider is not closely related to the makespan. For other work, see [7, 14, 15, 27] for particular examples. On grid graphs, the problem can be cast as a very restrictive variant of mesh-connected routing, where each processor can only hold one packet at any time. However, approaches developed for this problem (see Kunde [40] and Cheung and Lau [10]) typically assume that at least a constant number of packets can be held at any processor. On the other hand, on grid graphs, the problem resembles the generalization of the 15-puzzle, for which Wagner [72] and Kornhauser et al. [39] have given an efficient algorithm that decides reachability of a target configuration and provided both lower and upper bounds on the number of moves required. However, Ratner and Warmuth [46] proved finding a shortest solution for this puzzle remains NP-hard. Demaine et al. [13] also consider various grids. For the triangular grid, they give efficiently verifiable conditions for checking whether a solution exists. 2 Preliminaries In the grid setting of Section 3 we consider an n1 × n2 -grid G = (V, E), which is dual to an n1 × n2 -rectangle P in which the considered robots are arranged. A configuration of P is a mapping C : V → {1, . . . , N, ⊥}, which is injective w.r.t. the labels {1, . . . , N } of the N ≤ |P | robots to be moved, where ⊥ denotes the empty square. The inverse image of a robot’s label ` is C −1 (`). In the following, we consider a start configuration Cs and target configuration Ct ; for i ∈ {1, . . . , N }, we call Cs−1 (i) and Ct−1 (i) the start and target position of the robot i. Given the (minimum) Manhattan distance between each robot’s start/target positions for each robot, we denote by d the maximum such distance over all robots. A configuration C1 : V → {1, . . . , N, ⊥} can be transformed within one single transformation step into another configuration C2 : V → {1, . . . , N, ⊥}, denoted C1 → C2 , if C1−1 (`) = C2−1 (`) or (C1−1 (`), C2−1 (`)) ∈ E holds for all ` ∈ {1, . . . , N }, i.e., if each robot does not move or moves to one of the at most four adjacent squares. Furthermore, two robots cannot exchange their squares in one transformation step, i.e., for all occupied squares v 6= w ∈ V , we require that C2 (v) = C1 (w) implies C2 (w) 6= C1 (v). For M ∈ N, a schedule 4 is a sequence C1 → · · · → CM of transformations. The number of steps in a schedule is called its makespan. Given a start configuration Cs and a target configuration Ct , the optimal makespan is the minimum number of steps in a schedule starting with Cs and ending with Ct . Let n > 1. Note that for the 2 × 2-, 1 × n- and n × 1-rectangles, there are pairs of start and target configurations where no such sequence exists. For all other rectangles, such configurations do not exist; we provide an O(1)-approximation of the makespan in Section 3. For the continuous setting of Section 5, we consider N robots R := {1, . . . , N } ⊆ N. The Euclidean distance between two points p, q ∈ R2 is |pq| := ||p − q||2 . Every robot r has a start and target position sr , tr ∈ R2 with |si sj |, |ti tj | ≥ 2 for all i 6= j. In the following, d := maxr∈R |sr tr | is the maximum distance a robot has to cover. A trajectory of a robot r is a curve mr : [0, Tr ] → R2 , where Tr ∈ R+ denotes the travel time of r. This curve mr does not have to be totally differentiable, but must be totally left- and right-differentiable. Intuitively, at any point in time, a robot has a unique past and future direction that are not necessarily identical. This allows the robot to make sharp turns, but does not allow jumps. We bound the speed of the robot by 1, i.e., for each point in time, both left and right derivative of mr have Euclidean length at most 1. Let mi : [0, Ti ] → R2 and mj : [0, Tj ] → R2 be two trajectories; w.l.o.g., all travel times are equal to the maximum travel time Tmax by extending mr with mr (t) = mr (Tr ) for all Tr < t ≤ Tmax . The trajectories mi and mj are compatible if the corresponding robots do not intersect at any time, i.e., if |mi (t)mj (t)| ≥ 2 holds for all t ∈ [0, Ti ]. A trajectory set of R is a set of compatible trajectories {m1 , . . . , mN }, one for each robot. The (continuous) makespan of a trajectory set {m1 , . . . , mN } is defined as maxr∈R Tr . A trajectory set {m1 , . . . , mN } realizes a pair of start and target configurations S := ({s1 , . . . , sN }, {t1 , . . . , tN }) if mr (0) = sr and mr (Tr ) = tr hold for all r ∈ R. We are searching for a trajectory set {m1 , . . . , mN } realizing S with minimal makespan. 3 Labeled Grid Permutation Let n1 ≥ n2 ≥ 2, n1 ≥ 3 and let P be an n1 × n2 -rectangle. In this section, we show that computing the optimal makespan of arbitrarily chosen start and target configurations Cs and Ct of k robots in P is strongly NP-complete. This is followed by a O(1)-approximation for the makespan. Theorem 1. The minimum makespan parallel motion planning problem on a grid is strongly NP-hard. We prove hardness using a reduction from Monotone 3-Sat. Intuitively speaking, given a formula, we construct a parallel motion planning instance with a variable robot for each variable in the formula. To encode a truth assignment, each variable robot is forced to move on one of two paths. This is done by employing two groups of auxiliary robots that have to move towards their goal in a straight line in order to realize the given makespan. These auxiliary robots form moving obstacles whose position is known at any point in time. The variable robots cross paths with checker robots, one for each literal of the formula, forcing the checker to wait for one time step if the assignment does not satisfy the literal. The checker robots then cross paths with clause robots; each clause robot has to move to its goal without delay and can only do so if at least one of the checkers did not wait. In order to ensure that the checkers meet with the clauses at the right time, further auxiliary robots force the checkers to perform a sequence of side steps in the beginning. Figure 1 gives a rough overview of the construction; full details of the proof are given in Section 6. In the proof of NP-completeness, we use a pair of start and target configurations in which the corresponding grids are not fully occupied. However, for our constant-factor approximation, we assume in Theorem 3 that the grid is fully occupied. This assumption is without loss of generality; our approximation algorithm works for any grid population, see Theorem 4. Our constant-factor approximation is based on an algorithm that computes a schedule with a makespan upper-bounded by O(n1 + n2 ) described by Lemma 2. Based on Lemma 2, we give a constant factor approximation of the makespan, see Theorem 3. Finally, we embed the algorithm of Theorem 3 into a more general approach to ensure simultaneously a polynomial running time w.r.t. the number N of input robots and a constant approximation factor, see Theorem 4. Lemma 2. For a pair of start and target configurations Cs and Ct of an n1 × n2 -rectangle, we can compute in polynomial time w.r.t. n1 and n2 a sequence of O(n1 + n2 ) steps transforming Cs into Ct . 5 clauses aux. variables aux. side steps checkers Figure 1: A sketch of the parallel motion planning instance resulting from the reduction. The high-level idea of the algorithm of Lemma 2 is the following. We apply a sorting algorithm called RotateSort [43] that computes a corresponding permutation of an n1 × n2 (orthogonal) grid within O(n1 + n2 ) parallel steps. Each parallel step is made up of a set of pairwise disjoint swaps, each of which causes two neighbouring robots to exchange their positions. Because in our model direct swaps are not allowed, we simulate one parallel step by a sequence of O(1) transformation steps. This still results in a sequence of O(n1 + n2 ) transformation steps. A detailed description of the algorithm used in the proof of Lemma 2 is given in Section 6.2. Based on the algorithm of Lemma 2, we can give a constant-factor approximation algorithm. Theorem 3. There is an algorithm with running time O(dn1 n2 ) that, given an arbitrary pair of start and target configurations of an n1 × n2 -rectangle with maximum distance d between any start and target position, computes a schedule of makespan O(d), i.e., an approximation algorithm with constant stretch. For the algorithm of Theorem 3, Lemma 2 is repeatedly applied to rectangles of side length O(d), resulting in O(d) transformation steps in total. Because d is a lower bound on the makespan, this yields an O(1)-approximation of the makespan. At a high level, the algorithm of Theorem 3 first computes the maximal Manhattan distance d between a robot’s start and target position. Then we partition P into a set T of pairwise disjoint rectangular tiles, where each tile t ∈ T is an n01 × n02 -rectangle for n01 , n02 ≤ 24d. We then use an algorithm based on flows to compute a sequence of O(d) transformation steps, ensuring that all robots are in their target tile. Once all robots are in the correct tile, we use Lemma 2 simultaneously on all tiles to move each robot to the correct position within its target tile. The details of the algorithm of Theorem 3 are given further down in this section. The above mentioned tiling construction ensures that each square of P belongs to one unambiguously defined tile and each robot has a start and target tile. Based on the approach of Theorem 3 we give a O(1)-approximation algorithm for the makespan with a running time polynomial w.r.t. the number N of robots to be moved. Theorem 4. There is an algorithm with running time O(N 5 ) that, given an arbitrary pair of start and target configurations of a rectangle P with N robots to be moved and maximum distance d between any start and target position, computes a schedule of makespan O(d), i.e., an approximation algorithm with constant stretch. Intuitively speaking, the approach of Theorem 4 distinguishes two cases. (1) Both b n41 c and the maximum distance d between the robots’ start and target positions, are lowerbounded by the number N of input robots. 6 (2) N > b n41 c or N > d. In case (1), the grid is populated sparsely enough such that the robots’ trajectories in northern, eastern, southern, and western direction can be done sequentially by four individual transformation sequences, see Figure 12. In order to ensure that each robot has locally enough space, we consider a preprocessed start configuration Co in which the robots have odd coordinates. We ensure that Cs can be transformed into Co within O(d) steps. Analogously, we ensure that the outcome of the northern, eastern, southern, and western trajectories is a configuration Ce with even coordinates, such that Ce can be transformed into Ct within O(d) transformation steps. In the second case, we apply the approach of Theorem 3 as a subroutine to a union of smallest rectangles that contain the robots’ start and target configurations, see Figure 13. The full detailed version of the proof of Theorem 4 can be found in Section 6.3. In the rest of Section 3, we give the proof of Theorem 3, i.e. we give an algorithm that computes a schedule with makespan linear in the maximum distance between robots’ start and target positions. The remainder of the proof of Theorem 3 is structured as follows. In Section 3.1 we give an outline of our flow algorithm that ensures that each robot reaches its target tile in O(d) transformation steps. Section 3.2 gives the full intuition of this algorithm and its subroutines. (For full details, we refer to Section 6). 3.1 Outline of the Approximation Algorithm of Theorem 3 We model the trajectories of robots between tiles as a flow fT , using the weighted directed graph GT = (T, ET , fT ), which is dual to the tiling T defined in the previous section. In GT , we have an edge (v, w) ∈ ET if there is at least one robot that has to move from v into w. Furthermore, we define the weight fT ((v, w)) of an edge as the integer number of robots that move from v to w. As P is fully occupied, fT is a circulation, i.e., a flow with no sources or sinks, in which flow conservation has to hold at all vertices. Because the side lengths of the tiles are greater than d, GT is a grid graph with additional diagonal edges and thus has degree at most 8. The maximum edge value of fT is Θ(d2 ), but only O(d) robots can possibly leave a tile within a single transformation step. Therefore, we decompose the flow fT of robots into a partition consisting of O(d) subflows, where each individual robot’s motion is modeled by exactly one subflow and each edge in the subflow has value at most d. Thus we are able to realize each subflow in a single transformation step by placing the corresponding robots adjacent to the boundaries of its corresponding tiles before we realize the subflow. To facilitate the decomposition into subflows, we first preprocess GT . In total, the algorithm consists of the following subroutines, elaborated in detail in Section 3.2. • Step 1: Compute d, the tiling T and the corresponding flow GT . • Step 2: Preprocess GT in order to remove intersecting and bidirectional edges. • Step 3: Compute a partition into O(d) d-subflows. • Step 4: Realize the O(d) subflows using O(d) transformation steps. • Step 5: Simultaneously apply Lemma 2 to all tiles, moving each robot to its target position. 3.2 Details of the Approximation Algorithm of Theorem 3 In this section we only give more detailed descriptions of Steps 1-4 because Step 5 is a trivial application of Lemma 2 to all tiles in parallel. 7 3.2.1 Step 1: Compute d, the Tiling T , and the corresponding Flow GT The maximal distance between robots’ start and target positions can be computed in a straightforward manner. For the tiling, we assume that the rectangle P is axis aligned and that its bottom-left corner is (0, 0). n1 c vertical lines `v1 , . . . , `vkv with x-coordinate modulo 12d equal to 0. Analogously, we We consider kv := b 12d n2 consider kh := b 12d c horizontal lines `h1 , . . . , `hkh with y-coordinate modulo 12d to 0. Finally, we consider the tiling of P that is induced by the arrangement induced by `v1 , . . . , `vkv −1 , `h1 , . . . , `hhv −1 and the boundary of P , see Figure 11. This implies that the side length of a tile is upper-bounded by 24d − 1. Finally, computing the flow GT is straightforward by considering the tiling T and the robots’ start and target positions. 3.2.2 Step 2: Ensuring Planarity and Unidirectionality After initialization, we preprocess GT , removing edge intersections and bidirectional edges by transforming the start configuration Cs into an intermediate start configuration Cs0 , obtaining a planar flow without bidirectional edges. This transformation consists of two steps: (1) ensuring planarity and (2) ensuring unidirectionality. 1 v1 w2 v1 1 2 3 v2 w2 1 w1 v2 (a) 1 w1 (b) 3 2 (c) (d) Figure 2: Illustration of the preprocessing (step (1): before and after removing crossing edges (a)+(b) and step (2): before and after removing bidirectional edges (c)+(d)). The red arrows indicate how robots change their positions during the preprocessing steps. Step (1): We observe that edge crossings only occur between two diagonal edges with adjacent source tiles, as illustrated in Figure 2(a)+(b). To remove a crossing, it suffices to eliminate one of the diagonal edges by exchange robots between the source tiles. To eliminate all crossings, each robot is moved at most once, because after moving, the robot does no longer participate in a diagonal edge. Thus, all necessary exchanges can be done in O(d) steps by Lemma 2, covering the tiling T by constantly many layers, similar to the proof of Lemma 2. Step (2): We delete a bidirectional edge (v, w), (w, v) by moving min{fT ((v, w)), fT ((w, v))} robots with target tile w from v to w and vice versa which achieves that min{fT ((v, w)), fT ((w, v))} robots achieve their target tile w and min{fT ((v, w)), fT ((w, v))} robots achieve their target tile v, thus eliminating the edge with lower flow value. This process is depicted in Figure 2(c)+(d). Like step (1), this can be done in O(d) parallel steps by Lemma 2. As we do not add any edges, we maintain planarity during step (2). Observe that during the preprocessing, we do not destroy the grid structure of GT . Step (1) and step (2) maintain the flow property of fT without any other manipulations to the flow fT , because both preprocessing steps can be represented by local circulations. 3.2.3 Step 3: Computing a Flow Partition After preprocessing, we partition the flow GT into d-subflows. Definition 5. A subflow of GT is a circulation G0T = (T, E 0 , fT0 ), such that E 0 ⊆ ET , and 0 ≤ fT0 (e) ≤ fT (e) for all e ∈ E 0 . If fT0 (e) ≤ z for all e ∈ E 0 and some z ∈ N, we call G0T a z-flow. 8 The flow partition relies on an upper bound on the maximal edge weight in GT . By construction, tiles have side length at most 24d; therefore, each tile consists of at most 576d2 unit squares. This yields the following upper bound; a tighter constant factor can be achieved using a more sophisticated argument. Observation 6. We have fT (e) ≤ 576d2 for all e ∈ ET . Definition 7. A (z, `)-partition of GT is a set of ` z-subflows {G1 = (V1 , E1 , f1 ), . . . , G` = (V` , E` , f` )} of GT , such that G1 , . . . , G` sum up to GT . Lemma 8. We can compute a (d, O(d))-partition of GT in polynomial time. Proof sketch. In a slight abuse of notation, throughout this proof, the elements in sets of cycles are not necessarily unique. A (d, O(d))-partition can be constructed using the following steps. • We start by computing a (1, h)-partition C of GT consisting of h ≤ n1 n2 cycles. This is possible because GT is a circulation. If a cycle C intersects itself, we subdivide C into smaller cycles that are intersection-free. Furthermore, h is clearly upper bounded by the number of robots n1 n2 , because every robot can contribute only 1 to the sum of all edges in GT . As the cycles do not self-intersect, we can partition the cycles C by their orientation, obtaining the set C of clockwise and the set C of counterclockwise cycles. • We use C and C to compute a (1, h0 )-partition C1 ∪ C2 ∪ C1 ∪ C2 with h0 ≤ n1 n2 , such that two cycles from the same subset C1 , C2 , C1 , or C2 share a common orientation. Furthermore, we guarantee that two cycles from the same subset are either edge-disjoint or one lies nested in the other. A partition such as this can be constructed by applying a recursive peeling algorithm to C and C as depicted in Figure 3, yielding a decomposition of the flow induced by C into two cycle sets C1 and C2 , where C1 consists of clockwise cycles and C2 consists of counterclockwise cycles, and a similar partition of C , see the appendix for details. Figure 3: Recursive peeling of the area bounded by the cycles from C , resulting in clockwise cycles (thick black cycles). Cycles constituting the boundary of holes are counterclockwise (thick red cycles). Note that an edge e vanishes when fT (e) cycles containing that edge are removed by the peeling algorithm described above. • Afterwards, we partition each set C1 , C2 , C1 , and C2 into O(d) subsets, each inducing a d-subflow of GT , see the appendix for details. 3.2.4 A Subroutine of Step 4: Realizing a Single Subflow In this section, we present a procedure for realizing a single d-subflow G0T of GT . Definition 9. A schedule t := C1 → · · · → Ck+1 realizes a subflow G0T = (T, E 0 , fT0 ) if, for each pair v, w of tiles, the number of robots moved by t from their start tile v to their target tile w is fT0 ((v, w)), where we let fT0 ((v, w)) = 0 if (v, w) ∈ / E0. 9 Lemma 10. Let G0T = (T, ET0 , fT0 ) be a planar unidirectional d-subflow. There is a polynomial-time algorithm that computes a schedule C1 → · · · → Ck+1 realizing G0T for a constant k ∈ O(1). Proof sketch. We give a high-level description of the proof and refer to Section 6.5 for details. 54 321 u w 2 2 1 2 3 v 2 3 5 4 4 2 3 678 3 3 (a) Preprocessing of diagonal edges. (b) Configuration and flow after preprocessing. (c) A crossing-free matching of incoming and outgoing robots and the connecting paths inside the corresponding tile, for d = 3. Figure 4: Procedure for computing transformation steps that realize a d-subflow. Figures (a) and (b) illustrate how we preprocess G0T such that ET0 consists of horizontal and vertical edges only. Figure (c) illustrates the main approach. White disks illustrate start positions and black disks illustrate target positions. Our algorithm uses k = O(d) preprocessing steps C1 → · · · → Ck , as depicted in Figure 4(a)+(b), and one final realization step Ck → Ck+1 , shown in Figure 4(c), pushing the robots from their start tiles into their target tiles. The preprocessing eliminates diagonal edges and places the moving robots next to the border of their target tiles. For the final realization step we compute a pairwise disjoint matching between incoming and outgoing robots, such that each pair is connected by a tunnel inside the corresponding tile in which these tunnels do not intersect, see Figure 4(a). The final realization step is given via the robots’ motion induced by pushing each robot into the interior of the tile and by pushing this one-step motion through the corresponding tunnel into the direction of the corresponding outgoing robot. 3.2.5 Step 4: Realizing All Subflows Next we extend the idea of Lemma 10 to ` ≤ d subflows instead of one and demonstrate how this can be leveraged to move all robots to their target tile using O(d) transformation steps. Lemma 11. Let S := hG1 = (V1 , E1 , f1 ), . . . , G` = (V` , E` , f` )i be a sequence of ` ≤ d unidirectional planar d-subflows of GT . There is a polynomial-time algorithm computing O(d) + ` transformation steps C1 → · · · → Ck+` realizing S. Proof sketch. We give a high level description of the proof and refer for details to Section 6.6. Let t be an arbitrary tile. Similar to the approach of Lemma 10, we first apply a preprocessing step guaranteeing that the robots to be moved into or out of t are in the right position close to the boundary of t, see Figure 5. Thereafter we move the robots into their target tiles, using ` applications of the algorithm from Lemma 10 without the preprocessing phase. In particular, we realize a sequence of ` d-subflows by applying ` times the single realization step of Lemma 10. 10 (a) (b) (c) (d) (e) Figure 5: Stacking robots in lines induced by flows of the edges of the subflows to be realized. Lemma 12. There is a polynomial-time algorithm computing O(d) transformation steps moving all robots into their target tiles. Proof. By Lemma 8, we can compute a (d, cd)-partition of GT for c ∈ O(1). We group the corresponding d-subflows into cd d = c sequences, each consisting of at most d d-subflows. We realize each sequence by applying Lemma 11, using O(d) transformation steps for each sequence. This leads to O(cd) = O(d) steps for realizing all sequences of d-subflows. For the proof of Theorem 3, we still need to analyze the time complexity of our approach, for which we refer to Section 6.7. 4 Variants on Labeling A different version is the unlabeled variant, in which all robots are the same. A generalization of both this and the labeled version arises when robots belong to one of k color classes, with robots from the same color class being identical. We formalize this problem variant by using a coloring c : {1, . . . , n1 n2 } → {1, . . . , k} for grouping the robots. By populating unoccupied cells with robots carrying color k + 1, we may assume that each unit square in the environment P is occupied. The robots draw an image I = I 1 , . . . , I k , where I i is the set of cells occupied by a robot with color i. We say that two images Is and It are compatible if in Is and It the number of cells colored with color i are equal for each color i = 1, . . . , k. By moving the robots, we want to transform a start image Is into a compatible target image It , minimizing the makespan. Theorem 13. There is an algorithm with running time O(k(N )1.5 log(N ) + N 5 ) for computing, given start and target images Is , It with maximum distance d between start and target positions, an O(1)-approximation of the optimal makespan M and a corresponding schedule. The basic idea is to transform the given unlabeled problem setting into a labeled problem setting by solving a geometric bottleneck matching problem, see the appendix for details. 5 Continuous Motion The continuous case considers N unit disks that have to move into a target configuration; the velocity of each robot is bounded by 1, and we want to minimize the makespan. For arrangements of disks that are not well separated, we show that constant stretch is impossible. Theorem 14. There is an instance with optimal makespan M ∈ Ω(N 1/4 ), see Figure 16. The basic proof idea is as follows. Let {m1 , . . . , mN } be an arbitrary trajectory set with makespan M . We show that there must be a point in time t ∈ [0, M ] where the area of Conv(m1 (t), . . . , mN (t)) is lower-bounded by cN + Ω(N 3/4 ), where  cN is the area of the convex hull Conv(m1 (0), . . . , mN (0)) of m1 (0), . . . , mN (0). Assume M ∈ o N 1/4 and consider the area of Conv(m1 (t0 ), . . . , mN (t0 )) at some point t0 ∈ [0, M ]. This √  area is at most cN + O( N ) · o N 1/4 which is a contradiction. Proof details are given in Section 8.1. Conversely, we give a non-trivial upper bound on the stretch, as follows. 11 right auxilliaries xn−1 false true ... ... ... ... ... ... clauses ... left auxilliaries xn−1 false x1 : (0, 6) true aux. variables false x0 : (0, 0) ... x0 : (M − 2, 0) (1, −M + 1) ... true ... aux. side steps x1 : (M − 2, 6) ... (M − 3, −M + 1) checkers Figure 6: Left: The structure of the resulting parallel motion planning problem instance. Right: Start configuration (disks) and target configuration (crosses) of variable robots and their auxiliaries. The left auxiliary robot for xj starts at position (1, 6j + 1) and has to move down towards its target position (1, 6j + 1 − M ) in each time step. The right auxiliary robot for xj starts at (M − 3, −M + 6j + 1) and has to move up towards its target position (M − 3, 6j + 1). √ Theorem 15. There is an algorithm that computes a trajectory set with continuous makespan of O(d + N ). √ If d ∈ Ω(1), this implies a O( N )-approximation algorithm. √ The approach of Theorem 15 applies an underlying grid with mesh size 2 2. Our algorithm (1) moves the robots to vertices of the grid, (2) applies our O(1)-approximation for the discrete case, and (3) moves the robots from the vertices of the grid to their targets. For a detailed description of the Algorithm of Theorem 15 see Section 8.2. 6 Details for Labeled Grid Permutation In this section, we give the details omitted in the high-level description of our results for the problem variant of labeled grid permutations that we considered in Section 3. 6.1 Details for the NP-Completeness of the Grid Case Theorem 1. The minimum makespan parallel motion planning problem on a grid is strongly NP-hard. Proof. The proof is based on a reduction from the NP-hard problem Monotone 3-Sat, which asks to decide whether a Boolean 3-CNF formula ϕ is satisfiable, where in each clause the literals are either all positive or all negative. All coordinates and the makespan are constructed to be polynomial in the input size, implying strong NP-hardness. Thus, there is no FPTAS for the problem, unless P = NP. For the remainder of the proof, let ϕ have n variables {x0 , . . . , xn−1 } and m clauses {C1 , . . . , Cm }. From ϕ, we construct an instance of the minimum makespan parallel motion planning problem that has optimum makespan M if ϕ is satisfiable and M + 1 otherwise. During the description of the construction, we keep M variable, fixing its value once the construction is complete. The structure of the resulting instance is sketched in Figure 6. Each variable xj is represented by a variable robot. Additionally, for each variable there are two auxiliary robots that force the variable robot to take one of two different paths to its goal in any solution with makespan M , see Figure 6. The left auxiliary robots start at positions (1, 6j + 1) and move down towards their target positions (1, 6j + 1 − M ) in each time step. The right auxiliary robots start at positions (M − 3, −M + 6j + 1) 12 and have to move up towards their target positions (M − 3, 6j + 1). The variable robot for variable xj starts at position (0, 6j) and has to travel M − 2 units to the right towards its goal position (M − 2, 6j). In the first time step, each variable robot can either wait or move upwards. Afterwards, it must move to the right in every time step until passing the right group of auxiliary robots at x = M − 3. It cannot wait or move down before this point, as this would lead to a collision with the corresponding right auxiliary robot. Therefore in any schedule with makespan M , after the kth time step, each variable robot has x-coordinate k − 1 for any 1 ≤ k ≤ M − 3. For each clause Ci = {xj1 , xj2 , xj3 } with j1 < j2 < j3 , we have three checker robots c1i , c2i , c3i checking whether their corresponding literal satisfies the clause. The  checkers for clause Ci start at positions αi1 := 6(ni + j1 ), −6ni − fi , . . . , αi3 := 6(ni + j3 ), −6ni − fi , where fi = 1 iff Ci is negative and fi = 0 otherwise. As depicted in Figure 7, a checker has to wait one time step for the corresponding variable iff the checked literal is not true. } true {z } 6(ni + j) ... {z 6(ni + j) false ... 6(ni + j) + 1 ... c`i (a) | ... c`i ... } xj | true ... {z {z } 6(ni + j) | ... xj | false ... (b) Figure 7: (a): A checker c`i for variable xj in a positive clause Ci . (b): A checker c`i for variable xj in a negative clause Ci . Checkers must wait iff the variable assignment does not match. Checker c3i has to move M − 1 units up to its target position t3i := αi3 + (0, M − 1). Let d1 := 6(j3 − j1 ) be the horizontal distance between the initial positions of c1i and c3i , and let d2 := 6(j3 − j2 ) analogously. Both d1 and d2 are always even and at least six; therefore s1 := d21 + 2 < d1 and s2 := d22 + 1 < d2 are integer. We force c1i to take s1 steps to the right towards its target position t1i := αi1 + (s1 , M − 1 − s1 ). Analogously, c2i has target position t2i := αi2 + (s2 , M − 1 − s2 ). Each checker travels a total distance of M − 1; thus they are allowed to wait for one time step, but have to move on an xy-monotone path towards their target position. Because moves to the right do not change the position of a checker relative to the variables, we may assume the checkers to move to the right from their initial position before moving up. In fact, we enforce this behavior using auxiliary robots as depicted in Figure 8. Moreover, each clause Ci also has a clause robot ensuring that there is at least one satisfied literal. The clause robots start to the right of the checkers and above the variables and have to move M − 2 units to the left and two units downwards, and therefore have to move towards their target in every round without waiting for the checkers. The clause robot of each clause is placed such that checkers for other clauses cannot interfere with its path, see Figure 6. To be more precise, as shown in Figure 8, the clause robot stops at position t1i − (3, 3) and starts at position t1i + (−1, M − 5). The vertical offset between the checkers introduced by the side steps that c1i and c2i perform is chosen such that the clause robot can pass through the checkers without waiting iff one of the checkers did not wait. This is the case iff at least one literal of the clause is satisfied. It remains to determine the critical makespan M . This critical makespan M must be large enough to allow the checkers of the last clause Cm to pass through the variable robots and their clause robot. Moreover, it must also allow the variable robots to cross paths with all checkers. The checkers of the last variable travel left of the line x = 6n(m + 1) − 6. Therefore, a makespan M ≥ 6n(m + 1) suffices for the variable robots. Regarding the clauses, if the last clause is negative, the starting points of its checkers are located on the line y = −6nm − 1. The topmost variable robot travels below the line y = 6(n − 1) + 1. To keep our argument 13 d1 − 2 }| z z s1 − 1 }| t1i { d2 2 −1 }| { z z 3rd literal true 2nd literal true }| d1 2 +2 d2 2 +1 1st literal true { xj3 }| xj2 { z s −1 z 2}| { xj1 2 { Figure 8: Left: A group of auxiliary robots is used to force the first two checkers of each clause to perform their side steps before moving up. Each auxiliary robot has to move downwards M units. Right: A clause robot (orange) meeting the corresponding checkers (black for satisfied checkers, red for non-satisfied checkers). simple, we want to make sure that the clauses stay strictly above all variables. Due to the position of the clauses, this means that we have to ensure that the checker for the first literal of the last clause has target position above the line y = 6(n − 1) + 5. Therefore, not accounting for the side steps of the checkers, we have to set M ≥ (6nm + 1) + (6(n − 1) + 5) = 6n(m + 1). Clearly, the number of side steps performed by each checker is less than 6n. Therefore, in total, a critical makespan of M := 6n(m + 2) is sufficient. In our construction, a makespan of M is feasible iff for every clause robot there is one checker that does not wait, which implies that each clause has a satisfied literal under the assignment induced by the variable robots. Therefore, a makespan of M is feasible iff ϕ is satisfiable. Finally, observe that even though our reduction uses individually labeled robots, three colors are already sufficient. One can use color 1 for variables, color 2 for checkers and color 3 for clauses and all auxiliaries. 6.2 Details on Computing a Schedule With a Makespan of O(n1 + n2 ) Next, we give the details of an algorithm that computes a sequence of O(n1 + n2 ) steps transforming an arbitrary start configuration Cs into an arbitrary target configuration Ct of an n1 × n2 rectangle, see Lemma 2. This algorithm is based on a sorting algorithm, called RotateSort that uses swap operations, in which two robots exchanging their positions within one single step, as elementary operations. As our model does not allow swap operations, we first have to show how to simulate swap operations at the expense of increasing the makespan by a factor upper-bounded by some constant. In order to simulate swap operations, we first observe that LaValle and Yu [74] proved that for a 3 × 3square, each start configuration can be transformed into an arbitrary target configuration. This result is easily established for 2 × 3-rectangles; see Figure 9 for how to realize a transposition. 14 1 4 2 5 3 6 2 1 5 4 3 6 2 1 3 6 5 4 1 5 2 3 4 6 Figure 9: Using three moves for swapping two positions in a 2 × 3-arrangement. Lemma 16. For a pair of start and target configurations Cs and Ct of a 2 × 3-rectangle, we can compute a sequence of at most seven steps transforming Cs into Ct . Lemma 16 is the building block for permuting n1 × n2 rectangles within makespan O(n1 + n2 ). Lemma 2. For a pair of start and target configuration Cs and Ct of an n1 × n2 -rectangle, we can compute in polynomial time a sequence of O(n1 + n2 ) steps transforming Cs into Ct . Proof. The straightforward proof relies on covering the rectangle by a set of disjoint 2 × 3- and 3 × 2-rectangles, on which swap operations are performed in parallel, with each swap operation exchanging the position of two adjacent robots. We say that two swap operations are disjoint if all four positions of the two swaps are distinct. Although direct swap operations of adjacent robots are not possible, Lemma 16 allows us to perform an arbitrary number of pairwise disjoint swap operations within each 2 × 3-rectangle with O(1) transformation steps. As illustrated in Figure 10, we cover P by twelve different layers of rectangles, such that each pair of adjacent unit squares from P lies in one of the 2 × 3-rectangles or in one of the 3 × 2-rectangles. In particular, we distinguish between 2 × 3- and 3 × 2-rectangles inside the n1 × n2 -rectangle. Furthermore, we distinguish between different positions of 2 × 3-rectangles w.r.t. line numbers modulo 2 and w.r.t. column numbers modulo 3; see Figures 10a)-f). Analogously, we distinguish between different positions of 3 × 2rectangles w.r.t. line numbers modulo 3 and w.r.t. column numbers modulo 2; see the Figures 10g)-l). This results in twelve different classes of rectangles. a) b) c) d) e) f) g) h) i) j) k) l) Figure 10: Covering of P by pairwise disjoint 2 × 3- and 3 × 2-rectangles in twelve layers. Given a set S of pairwise disjoint swap operations, we subdivide S into these twelve layers, such that the two robots of each swap operation lie in the same small rectangle of the corresponding layer. Lemma 16 implies that all swap operations of one layer can be done in parallel with O(1) transformation steps. Therefore, all swap operations in S can be done in O(1) transformation steps. This allows us to apply a sorting algorithm for n1 × n2 -meshes, called Rotatesort [43], whose only elementary steps are swap operations of adjacent cells. We employ Rotatesort by labeling the robots in the target configuration based on the snake-like ordering guaranteed by Rotatesort. Applying Rotatesort to the start configuration with the robots labeled in this way, we obtain the required target configuration. Marberg and Gafni [43] show that Rotatesort needs O(n1 + n2 ) phases, where each phase consists of pairwise disjoint swap operations. This leads to O(n1 + n2 ) transformation steps in our model. Figure 11, shows an example of a pair of start and target configuration and the resulting flow. 6.3 Details on the Approach of Theorem 4 15 1 1 1 1 1 1 2 2 1 Figure 11: A tiling of an 26 × 32-rectangle by four tiles with d = 1. Robots not in their target tile are illustrated by small dots. Their target positions are depicted as white disks. The dual graph of the tiling is illustrated by large dots and directed edges between them. The edges of the dual graph are annotated with the value of the flow on the corresponding edge. In general, it is not guaranteed that robots that have to change the tile lie adjacent to the border between their start and target tile. However, this is the case for d = 1, as illustrated in this figure. Theorem 4. There is an algorithm with running time O(N 5 ) that, given an arbitrary pair of start and target configurations of a rectangle P with N robots to be moved and maximum distance d between any start and target position, computes a schedule of makespan O(d), i.e., an approximation algorithm with constant stretch. Proof. Our algorithm considers the two cases (1) N ≤ d n41 e, d and (2) N > d n41 e or N > d separately as follows: In case (1), we apply the following approach whose steps, described next, are all realizable because N ≤ d n41 e, d. We assume w.l.o.g. that n1 and n2 are even. Otherwise, starting from the start configuration, we move all robots from the last line into the second-to-last line and all robots from the last column into the second-to-last column within O(d) transformation steps. The reversed argument implies that there is a sequence of O(d) transformation steps leading from an even-sized configuration to the target configuration. Thus, from now on, we restrict our considerations to even-sized rectangles. For each pair of start and target configurations Cs and Ct of P , there are two configurations Co and Ce , such that the two following conditions are fulfilled: (1) The coordinates of the robots in Co are odd and the coordinates of the robots in Ce are even and (2) Cs and Ce can be transformed into Co and Ct within O(d) transformation steps. Thus, we still have to give an approach for how Co can be transformed into Ce within O(d) transformation steps. First of all, we ensure in parallel for all robots that they achieve the position that is induced by the x-coordinate of their position in Ce and the y-coordinate of their position in Co . We call the corresponding configuration intermediate configuration Ci with intermediate positions and coordinates. In order to obtain the intermediate configuration, starting from Co , we first push in parallel all robots, that have to move to the right, one position upwards, then move them simultaneously to the right until they achieve their intermediate x-coordinate, and, push a robot immediately one position downwards when it reaches its intermediate x-coordinate, see Figure 12. After that, we apply the analogous approach for robots that have to move to the left, resulting in the intermediate configuration. Secondly, starting from the intermediate configuration, we apply the above described two-stepped approach for horizontal movements in an analogous version in order to ensure that the y-coordinate of each robot r is equal to the y-coordinate of r in the configuration Ce , while guaranteeing that the x-coordinate of r stays the same. This results in the configuration Ce . 16 The start and and target configuration Cs and Ct 6 5 4 Cs → . . . → Ct 3 2 1 1 Preprocessing to ensure odd coordinates 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 6 5 4 Cs → . . . → Co 3 2 1 Moving robots in eastern direction 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 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 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 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 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 6 5 4 3 2 1 Moving robots in western direction 6 Co → . . . → Ci 5 4 3 2 1 Moving robots in northern direction 6 5 4 3 2 1 Moving robots in southern direction 6 C i → . . . Ce 5 4 3 2 1 Postprocessing to generate target configuration from even coordinates 6 5 4 Ce → . . . → Ct 3 2 1 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 Figure 12: A stepwise illustration of the approach for case (1) of Theorem 4. The transformation steps leading from Cs to Co and leading from Ce to Ct can be computed in O(N · N ) time by making use of the fact that the robots’ positions are explicitly given via their coordinates. The same reasoning implies that the sequences of transformation steps leading from Co to the intermediate configuration and leading from the intermediate configuration to Ce can be computed in O(N · N ) time. In case (2), we apply the approach of Theorem 3 as a subroutine in the following approach: For each robot we consider the smallest rectangle that contains the robot’s start and target positions. If the rectangle has a height or width of 1, we extend the height or width to 2. Now we iteratively replace two rectangles R1 and R2 intersecting each other by the smallest rectangle that contains R1 and R2 . This results in a set of rectangles that are pairwise intersection free, allowing us to apply the approach of Theorem 3 to each resulting rectangle in parallel, while ensuring that each robot is involved in at most one application of the approach of Theorem 3. As the side lengths of the initial rectangles are upper-bounded by d, we conclude that the sum of the lengths of the finally computed rectangles is upper bounded by N · d, which in turn is upper bounded by N 2 in that case. This implies a running time of O(d · N 2 ) ≤ O(N 3 ). 17 Figure 13: An illustration how the approach for case (2) of Theorem 4 clusters the pairs of robots’ start and target positions. 6.4 Details on Step 3: Computing a Flow Partition Lemma 8. We can compute a (d, O(d))-partition of GT in polynomial time. Proof. In a slight abuse of notation, throughout this proof, the elements in sets of cycles are not necessarily unique. A (d, O(d))-partition can be constructed using the following steps. • We start by computing a (1, h)-partition C of GT consisting of h ≤ n1 n2 cycles. This is possible because GT is a circulation. If a cycle C intersects itself, we subdivide C into smaller cycles that are intersection-free. Furthermore, h is clearly upper bounded by the number of robots n1 n2 , because every robot can contribute only 1 to the sum of all edges in GT . As the cycles do not self-intersect, we can partition the cycles C by their orientation, obtaining the set C of clockwise and the set C of counterclockwise cycles. • We use C and C to compute a (1, h0 )-partition C1 ∪ C2 ∪ C1 ∪ C2 with h0 ≤ n1 n2 , such that two cycles from the same subset C1 , C2 , C1 , or C2 share a common orientation. Furthermore, we guarantee that two cycles from the same subset are either edge-disjoint or one lies nested in the other. A partition such as this can be constructed by applying a recursive peeling algorithm to C and C as depicted in Figure 3, yielding a decomposition of the flow induced by C into two cycle sets C1 and C2 , where C1 consists of clockwise cycles and C2 consists of counterclockwise cycles, and a similar partition of C . In particular, we apply the following approach iteratively to C : We consider the union A of the area bounded by the cycles from C . We remove a flow value of 1 from all edges of the outer boundary component of A. In particular, we add the corresponding 1-subflow G1 to C1 and remove G1 from C . Analogously, we remove 1-subflows from C that are induced by inner boundary components and add these 1-subflows to C2 . • Afterwards, we partition each set C1 , C2 , C1 , and C2 into O(d) subsets, each inducing a d-subflow of GT . This can be done as follows. Let C ∈ {C1 , C2 , C1 , C2 }. Recall that every pair of cycles from C either consists of one cycle nested inside the other or of edge-disjoint cycles. The cycles induce a dual forest D = (C, ED ), where a cycle v has a child w iff w lies inside v and there is no other cycle lying in v that w lies in. We label the cycles by their depth in D modulo 576d and let Gi be the flow induced by all cycles carrying label i, thus obtaining O(d) subflows Gi . Finally, we show that each subflow Gi obtained in this way is a d-subflow of GT . To this end, we observe the following. Let e ∈ ET be an arbitrarily chosen edge and let v, w ∈ C be two cycles sharing e. This implies 18 Figure 14: Recursive peeling of the area bounded by the cycles from C , resulting in clockwise cycles (thick black cycles). Cycles constituting the boundary of holes are counterclockwise (thick red cycles). Note that an edge e vanishes when fT (e) cycles containing that edge are removed by the peeling algorithm described above. that v and w lie nested inside of each other; w.l.o.g., assume that w lies inside v. Thus, in D, v lies on the path from w to its root, and e is contained in all cycles on the path between v and w. On the other hand, due to Observation 6, all cycles containing e lie on a path of length at most 576d2 in D. Therefore, e has a 2 weight of at most 576d 576d = d in each Gi , and Gi is a d-subflow. 6.5 Details on a Subroutine of Step 4: Realizing a Single Subflow By Lemma 10, we give an approach that computes a schedule of constant length for a given d-subflow. Lemma 10. Let G0T = (T, ET0 , fT0 ) be a planar unidirectional d-subflow. There is a polynomial-time algorithm that computes a schedule C1 → · · · → Ck+1 realizing G0T for a constant k ∈ O(1). Proof. Our algorithm uses k = O(d) preprocessing steps C1 → · · · → Ck , as depicted in Figure 4(a)+(b), and one final realization step Ck → Ck+1 , shown in Figure 4(c), moving the robots from their start tiles into their target tiles. The preprocessing replaces diagonal edges by pairs of orthogonal edges, see the red arrows in Figure 4(a), and places the moving robots next to the border of their target tiles. Note that the replacements of the diagonal edges cannot be done as part of the preprocessing of Step 2. This is because the replaced diagonal edges may be part of circular flows that cannot be realized locally, as it is done for crossing or bidirectional edges in Step 2 of our algorithm. For the final realization step we compute a pairwise disjoint matching between incoming and outgoing robots, such that each pair is connected by a tunnel inside the corresponding tile in which these tunnels do not intersect each other, see Figure 4(a). The final realization step is given via the robots’ motion induced by moving each robot into the interior of the tile and by moving this one-step motion through the corresponding tunnel into the direction of the corresponding outgoing robot. The preprocessing steps C1 → · · · → Ck : Let v be an arbitrary tile. We place all robots corresponding to horizontal and vertical edges (v, w) of G0T in a row adjacent to the side shared by v and w. We can do this for all tiles using O(d) parallel steps by applying Lemma 2. Next, we eliminate diagonal edges (w, v) ∈ ET0 as follows. There are two tiles sharing a side with both w and v; let u be one of them. First we place the fT0 ((w, v)) robots with start tile w and target tile v in a row next to the side between w and u. Then, we move them to u by exchanging them with fT0 ((w, v)) robots with start and target tile u that lie next to the side between u and v, as shown in Figure 4(a). In the resulting flow, the diagonal edge (w, v) with weight fT0 ((w, v)) is replaced by adding a flow of value fT0 ((w, v)) on the edges (w, u), (u, v). We process all tiles as described above in two parallel phases by applying Lemma 2 twice: first on all rows with even index and then on all rows with odd index, thus ensuring that parallel applications of Lemma 2 do not interfere with each other. 19 The realization step Ck → Ck+1 : Let t be an arbitrary tile. For the transformation step Ck → Ck+1 , we need a matching between incoming and outgoing robots of t, such that there is a set of non-intersecting paths in t connecting each incoming robot with its corresponding outgoing robot. As illustrated in Figure 4(c), these paths induce the required transformation Ck → Ck+1 . We compute this matching by selecting an incoming robot rin and matching it to a robot rout , such that there is a path p ⊆ ∂t between rin and rout that does not touch another incoming or outgoing robot. We remove the matched robots from consideration and repeat the matching procedure until no further unmatched robots exist. The non-intersecting paths between the positions of the matched robots are constructed as follows. For i ≥ 1, the ith hull of t is the union of all squares on the boundary of the rectangle remaining after the hulls 1, . . . , i − 1 are removed. The path between rin and rout consists of three pieces, as shown in Figure 4(c). For the ith matched pair of robots, the initial and the last part of the path are straight line segments orthogonal to ∂t, from the position of rin to the d + ith hull and from the d + ith hull towards the position of rout . The main part of the path lies on the d + ith hull, connecting the end of the initial part to the beginning of the last part. 6.6 Details on Step 4: Realizing All Subflows Lemma 11. Let S := hG1 = (V1 , E1 , f1 ), . . . , G` = (V` , E` , f` )i be a sequence of ` ≤ d unidirectional planar d-subflows of GT . There is a polynomial-time algorithm computing O(d) + ` transformation steps C1 → · · · → Ck+` realizing S. Proof. Let t be an arbitrary tile. Similar to the approach of Lemma 10, we first apply a preprocessing step guaranteeing that the robots to be moved into or out of t are in the right position close to the boundary of t. Thereafter we move the robots into their target tiles, using ` applications of the algorithm from Lemma 10 without the preprocessing phase. In particular, we realize a sequence of ` d-subflows by applying ` times the single realization step of the algorithm from Lemma 10. In order to ensure that a sequence of ` realization steps from Lemma 10 without intermediate preprocessing steps realizes a sequence of ` d-subflows, we apply the following O(d) preprocessing steps for all ` realization steps in advance: For each side of the tile t, we place all leaving or entering robots that belong to the same subflow in a common row and stack these rows in the order which is induced by the sequence of the subflows to be realized, see Figure 15(a). Finally, pushing all stacked robots downwards into the direction of the boundary ∂t of the tile ensures, that processing one realization step implies that all robots involved in the following realization step lie in a row adjacent to ∂t, see Figure 15. In the following we describe how we place the robots in their start tiles as a preprocessing step. First, we use the same preprocessing step as in Lemma 10 to eliminate diagonal edges. For a simplified illustration, we describe the remainder of the preprocessing in two steps that can be realized by just one application of Lemma 2. After elimination of diagonal edges, we proceed by stacking the rows of robots moving out of t in the order in which the subflows are to be processed, see Figure 15(a). Then we push the robots towards the boundary ∂t of their start tile until they meet either ∂t or another moving robot. See Figure 15(a), image 2 for an example. This preprocessing ensures that, after each application of the algorithm of Lemma 10, all robots moving out of t in the next transformation step lie in a row adjacent to ∂t. Therefore this preprocessing can be used to replace the preprocessing done in Lemma 10. For an example, see Figure 15(a), images 3–9. As ` ≤ d, the stacked rows have a height of at most d. Thus, they are contained in hulls 1 to d. Therefore, and because the flows are unidirectional and diagonals are eliminated, the structure of the stacks is not damaged by the applications of Lemma 10, allowing us to realize ` ≤ d subflows in O(d) transformation steps instead of one. 20 45 321 678 (b) Our preprocessing step applied to the example (a) Stacking the rows of robots corresponding to the flow values of Figure 4 and the path matching (red) of the first on the edges of the subflows to be realized. step. Figure 15: Realizing a sequence of subflows by stacking the rows of robots to be moved onto each other in the order the subflows are realized in. 6.7 Runtime Analysis of the Algorithm of Theorem 3 Theorem 3. There is an algorithm with running time O(dn1 n2 ) that, given an arbitrary pair of start and target configurations of an n1 × n2 -rectangle with maximum distance d between any start and target position, computes a schedule of makespan O(d), i.e., an approximation algorithm with constant stretch. Proof of Theorem 3. The steps of our algorithm have the following time complexity: Initialization step 1: Computing d, T and GT is possible in O(n1 n2 ) time. Step 2 & 5: The application of Lemma 2 requires O(d3 ) time for each tile, so these steps can be done in O(dn1 n2 ) time. Step 3: All subroutines of Step P 3 can be done in an overall time of O(n1 n2 ). In particular, the (1, h)-partition C of GT can be computed in e∈ET fT (e) ∈ O(n1 n2 ) time by a simple greedy algorithm. The number of edges in all cycles from C combined is at most n1 n2 , which is the number of robots in P . Thus, resolving self-intersections of cycles in C can be done in O(n1 n2 ) time. As |C | ∈ O(n1 n2 ), the partition of C into C1 , C2 , C1 , and C2 takes time O(n1 n2 ). Furthermore, the partitioning of C1 , C2 , C1 , and C2 into O(d) d-subflows can be done in time O(n1 n2 ). Step 4: The parallel applications of Lemma 2 to disjoint rectangles can be computed in O(dn1 n2 ). Furthermore, the construction of all connecting paths between incoming and outgoing robots for all tiles needs O(dn1 n2 ) time per application of the algorithm of Lemma 11. By applying Lemma 11 constantly many times, Step 4 needs O(dn1 n2 ) time. 21 7 Details for Variants on Labeling In this section we show how to extend our approach of Section 3 to the unlabeled and, more generally, the colored variant of the parallel robot motion-planning problem. Theorem 13. There is an algorithm with running time O(k(N )1.5 log(N ) + N 5 ) for computing, given start and target images Is , It with maximum distance d between start and target positions, an O(1)-approximation of the optimal makespan M and a corresponding schedule. Proof. We transform the input into an instance of the labeled variant, such that an O(1)-approximation for the labeled instance provides an O(1)-approximation for the colored instance. For each color i, we consider the two point sets Ai , B i ⊂ R2 , where Ai contains the center points aiv of all unit squares v ∈ Isi and B i contains the center points biv of all v ∈ Iti . A bottleneck matching between Ai and B i is a perfect matching between Ai and B i that minimizes the maximal distance. The cost of an optimal bottleneck matching between Ai and B i is in O(M ), because a transformation sequence induces a bottleneck matching on all color classes. Efrat et al. [20] show that the geometric bottleneck matching problem can be solved in O(|A + B|1.5 log |A + B|) time. A set of k bottleneck matchings between the sets Ai and B i induces labeled start and target configurations Cs , Ct . Applying the algorithm from Section 3 to these yields a sequence of transformation steps of length O(M ). 8 Details for Continuous Motion In this section, we consider the continuous geometric case in which the robots are identical geometric objects that have to move into a target configuration in the plane without overlapping at any point in time. We want to minimize the makespan under these conditions, where the velocity of each robot is bounded by 1. 8.1 A Lower Bound for Unbounded Environments In this section we give a worst-case lower bound of Ω(N 1/4 d) for the continuous makespan where N is the number of robots. To be more precise, we construct a pair of start and target configurations of N robots as illustrated in Figure 16(a). In this instance, we have d = 2. In Theorem 14, we show that the optimal continuous makespan of this instance is in Ω(N 1/4 ), yielding the worst-case lower bound stated above. (a) Start and target positions of the robots. (b) Voronoi diagram in the start and target configuration. (c) Bounding polygon for the moving robots. Figure 16: The start and target configurations of our lower-bound construction where an arrow points from a start position to the corresponding target position. 22 More formally, let {m1 , . . . , mN } be an arbitrary trajectory set with makespan M , realizing the start and target configurations as illustrated in Figure 16(a). By applying a simple continuity argument, we show that there must be a point in time t ∈ [0, M ] such that the area of the convex hull Conv(m1 (t), . . . , mN (t)) of 3/4 m1 (t), . . . , mN (t) is lower is the area of the of Conv(m1 (0), . . . , mN (0)).  bounded by cN + Ω(N ), where cN 1/4 Assume M ∈ o N and consider the area of Conv(m1 (t0 ), . . . , mN (t0 )) at some point t0 ∈ [0, M ]. This √  area is at most cN + O( N ) · o N 1/4 , because asymptotically, the area gained during the movement is bounded by the product of makespan and circumference. This contradicts the lower bound stated above. A key ingredient for the construction of the time point t ∈ [0, M ] is the fact that the distance between the centers of two robots change continuously. In fact, we know that the Euclidean distance between two centers is 2-Lipschitz, because the velocity of the robots is bounded by 1. Definition 17. A function f : R → R is λ-Lipschitz (continuous) if |f (x) − f (y)| ≤ λ|x − y| holds for all x, y ∈ R. Observation 18. For all i, j ∈ R, the distance between the centers mi (·) and mj (·) of robots i and j is 2-Lipschitz. Let V be the Voronoi diagram of the centers {m1 (M ), . . . , mN (M )} restricted to Conv(m1 (M ), . . . , mN (M )) in the target configuration, as illustrated in Figure 16(b). For m ∈ {m1 , . . . , mN } and t ∈ [0, M ], we denote the Voronoi region of m(t) w.r.t. {m1 (t), . . . , mN (t)} by V (m(t)). Let p be the trajectory of an arbitrary robot not on the convex hull in the target configuration. Furthermore, let p1 , . . . , p6 ∈ {m1 , . . . , mN } be the trajectories of the six robots 1, . . . , 6 adjacent to p in the target configuration. 1 In the following, we show that there is a time interval I = [t0 , t0 + 20 ] such that the area of V (p(t00 )) 00 is lower bounded by 3.479 for all t ∈ I, see Lemma 21. This is larger than the area of V (p(0)) and V (p(M )) by a constant factor. Based on that, we construct the time point t ∈ [0, M ] such that the area of Conv(m1 (t), . . . , mN (t)) is lower bounded by cN + Ω(N 3/4 ), see Lemma 22. To this end, we need to relate the area of a Voronoi region to the length of the corresponding Delaunay edges. 0 0 0 0 Lemma 19. Let t0 ∈ [0, M  ] and p(t◦) ∈ {m1 (t ), . . . , mN (t0 )}. If the maximal distance between p(t ) and its Voronoi neighbors is λ ∈ 2, 4 cos(50 ) , the area of V (p(t )) is at least        λ λ λ λ 4 3 sin arccos − tan 90◦ − arccos +√ , 4 4 4 4 3 which is√at least 3.479 for λ ∈ [2.1, 2.2]. Furthermore, the area of V (p(M )) in the target configuration is √6 = 2 3 ≤ 3.465. 3 Proof. Let p1 (t0 ) ∈ {m1 (t0 ), . . . , mN (t0 )} be the center of a robot with |p(t0 )p1 (t0 )| = λ. Because all Voronoi neighbors of p(t0 ) have distance less than 4 cos(50◦ ), the angle between two Voronoi neighbors of p(t0 ) in p(t0 ) is greater than 50◦ . Thus, p := p(t0 ) has at most six Voronoi neighbors and the area of V (p(t0 )) is minimized if p(t0 ) has five further Voronoi neighbors p2 (t0 ), . . . , p6 (t0 ). We can assume |p(t0 )p2 (t0 )| = · · · = |p(t0 )p6 (t0 )| = 2 because this does not increase the area of V (p(t0 )). W.l.o.g., let p1 := p1 (t0 ), . . . , p6 := p6 (t0 ) be in counterclockwise order around p. This situation is depicted in Figure 17. We find a lower bound on V (p) by lower bounding the intersections of V (p) with the Delaunay triangles that are adjacent to p, i.e., with the triangles built by the edges p1 p2 , . . . , p5 p6 and p6 p1 with p, see Figure 17. The area of the two triangles 41 and 46 built by p1 p2 and p6 p1 with p are minimized by assuming the configuration of Figure 17(a)+(b), i.e., for |p1 p2 | = |p1 p6 | = 2. In the configuration of Figure 17(a)+(b), we lower bound the area of 46 ∩ V (p) as follows: We subdivide the area of 46 ∩ V (p) into three subsets A, B, and C, and lower bound the area of 46 ∩ V (p) by the sum of lower bounds for |A|, |B|, and |C|. Let u, v, and c be the mid points of pp6 , pp1 , and 46 , see Figure 17(b). Furthermore, let h be the vertical side length of A and ` be the vertical side length of B. The interior angle   of 46 at p is arccos( λ4 ). Thus, we obtain h = sin arccos λ4 , which implies |A| = 12 · λ4 sin arccos λ4 . The interior 23 p3 43 p2 42 41 p1 p p1 p2 p4 44 46 p6 46 v c C B p h ` A p1 p3 43 p 44 46 p6 45 p5 p6 (b) Lower bound on the area of 46 ∩ V (p). p2 42 p3 p4 V (p) u (a) Configuration with minimal area of 41 ∩ V (p) and 46 ∩ V (p). 41 42 45 p5 (c) Configuration with minimal area of 4i ∩ V (p) for i ∈ {2, . . . , 5}. V (p) p (d) Lower bound on the area of 4i ∩ V (p) for i ∈ {2, . . . , 5}. Figure 17: Lower bounding the area of V (p) by lower bounding the sum of the areas of the intersections of V (p) with the Delaunay triangles 4i for i ∈ {1, . . . , 6} for a maximal distance of 2.5 between p1 and p.   angle of B at c is 90◦ − arccos λ4 . Hence, we get ` = λ4 tan 90◦ − arccos λ4 because the length of B’s  horizontal side is λ4 . Therefore, |B| = 12 · λ4 · λ4 tan 90◦ − arccos λ4 . Finally, we have |C| = λ4 (h − `) =   λ λ − λ4 tan 90◦ − arccos λ4 . As 46 ∩ V (p) and 41 ∩ V (p) are symmetric, this gives us a 4 sin arccos 4 lower bound of 2(|A| + |B| + |C|) on |(41 ∪ 46 ) ∩ V (p)|. Furthermore, the area of (42 ∪ · · · ∪ 45 ) ∩ V (p) is minimized by the configuration, implying the highest possible packing density, illustrated in Figure 17(c)+(d) for |p2 p| = · · · = |p6 p| = |p2 p3 | = · · · = |p5 p6 | = 2. √ Therefore, this area is at least 4· 13 ·|4i | = 4· 31 · 12 ·2· 3 = √43 . All in all, we obtain |V (p)| ≥ 2(|A|+|B|+|C|)+ √43 . For λ ∈ [2.1, 2.2], this is at least 1.17046 + √43 ≥ 3.479. In the target configuration, we have |p(M )pi (M )| = 2 √ for i ∈ {1, . . . , 6}. Therefore the area of V (p(M )) is √63 = 2 3 ≤ 3.465. 1 Next, we prove that there is a time t0 with an interval I := [t0 , t0 + 20 ] during which the area of Conv(p, p1 , . . . , p6 ) is greater by a constant factor than the area of Conv(p, p1 , . . . , p6 ) in the target configuration. To this end, we use the following observation that is an immediate consequence of the intermediate value theorem. Observation 20. There is a time t0 ∈ [0, M ] for which the maximal distance between p(t0 ) and p1 (t0 ), . . . , p6 (t0 ) is 2.2. Lemma 21. There is a time t0 ∈ [0, M ] such that for all t00 ∈ [t0 , t0 + 3.479 ≥ 1.004 · |V (p(M ))|. 1 20 ], the area of V (p(t00 )) is at least Proof. Let λ(t) be the maximal distance between p(t) and p1 (t), . . . , p6 (t). √ By Observation 20, there is a maximal time t0 with λ(t0 ) = 2.2. Therefore, and because 2.2 < 4 cos(50◦ ) < 2 2, the points p1 (t0 ), . . . , p6 (t0 ) are the Voronoi neighbors of p(t0 ). By Observation 18, λ(t) is 2-Lipschitz. This, together with the maximality 1 of t0 , implies 2.1 ≤ λ(t00 ) ≤ 2.2 for t00 ∈ [t0 , t0 + 20 ]. Thus, Lemma 19 applies and yields |V (p(t00 ))| ≥ 3.479 ≥ 1 00 0 0 1.004 · |V (p(M ))| for all t ∈ [t , t + 20 ]. Lemma is a time t ∈ [0, M ] for which the area of Conv(m1 (t), . . . , mN (t)) is lower-bounded by  22. There √  √ √  N  N 3.479 20M − 2π 2 N + M + 2 3 N − 20M . Proof. By Lemma 21, for each robot i that does not lie on the boundary of the start configuration, there 1 is a point in time t00 ∈ [0, M ] such that the area of V (p(t00 )) is at least 3.479 for all t00 ∈ [t0 , t0 + 20 ]. The  N  N continuous pigeonhole principle yields a time point t ∈ [0, M ] such that the area of k := 20M ∈ Θ( M ) Voronoi regions V (q (t)), . . . , V (q (t)) is at least 3.479. For all the remaining Voronoi regions, the area 1 k √ is at least 2 3 corresponding to the largest possible packing density as achieved in the start and target configurations. 24 √ √ We give an upper bound N ≤ 2π(2 N + M ) on the number of robots whose Voronoi regions are not contained in Conv(m1 (t), . . . , mN (t)). W.l.o.g., we assume that all these regions are Voronoi regions whose area we lower bounded by 3.479. Moreover, we can assume all of these regions have zero area, i.e., ignoring when lower bounding the area of Conv(m1 (t), . . . , mN (t)). Thus, the area of Conv(m1 (t), . . . , mN (t)) is at least   √ √  √  √  N  N 3.479(k − N ) + 2 3(N − k) = 3.479 20M − 2π 2 N + M + 2 3 N − 20M . Figure 18: An upper-bound construction for the number of robots whose Voronoi regions may intersect the boundary of smallest enclosing ball for {m1 (t), . . . , mN (t)}. The radius of the smallest enclosing ball is upper bounded by the distance from the center to the boundary in the start configuration plus the considered makespan illustrated by the dashed circles. √ √ It still remains to prove the upper bound N ≤ 2π(2 N + M ) on the number of robots whose Voronoi regions are not contained in Conv(m1 (t), . . . , mN√(t)). First, we observe √ that the length of the boundary of Conv(m1 (t), . . . , mN (t)) is at most B := 2π(2 N + M ), because 2 N + M is an upper bound on the radius of the smallest ball containing m1 (t), . . . , mN (t). In order to estimate N , we consider the maximal number of points from [0, B] × R≥0 whose Voronoi regions intersect √ the x-axis. This number is achieved √ for the configuration as illustrated in Figure 18, implying N ≤ √B2 = 2π(2 N + M ), thus concluding the proof. √ √ Lemma 23. For each t ∈ [0, M ], |Conv(m1 (t), . . . , mN (t))| ≤ 2 3N + 2π( N + M )M . Proof. In the√start configuration, the intersection of each Voronoi cell with Conv(m1 (0), . . . , m√N (0)) has an area of 2 3. Thus, the convex hull of the start configuration has an area of at most 2 3N . We give an upper bound on the area A gained during the motion, i.e., the area of Conv(m1 (t), . . . , mN (t)) \ Conv(m1 (0), . . . , mN (0)), corresponding √ to the gray region in Figure √ 18. The length of the boundary ∂Conv(m1 (t), . . . , mN (t)) is at most 2π( N + M ), implying A ≤ 2π( N + M )M , thus concluding the proof. Theorem 14. There is an instance with optimal makespan M ∈ Ω(N 1/4 ), see Figure 16. 25 Proof. Combining the bounds from Lemma 22 and Lemma 23 yields black the following       √ √  √ N N +2 3 N − 3.479 − 2π 2 N + M 20M 20M √ √ ≤ 2 3N + 2π( N + M )M.    √ √  √ N − 3, 479 2π 2 N + M ≤ 2π( N + M )M. ⇔ 0, 014 20M √ √ √ N If M ∈ Ω( N ) holds, we are done. Otherwise we obtain M ∈ O(M N ) ⇔ N ∈ O(M 2 ), and thus M ∈ Ω(N 1/4 ), concluding the proof. 8.2 An Upper Bound for Unbounded Environments Next we give upper bounds on the stretch and makespan for moving disks in unbounded environments. First, we show that we can achieve constant stretch for well-separated robots. Theorem 24. If the distance between the centers of two robots of radius 1 is at least 4 in the start and target configurations, we can achieve a makespan in O(d), i.e., constant stretch. 4 1 2 √ 2 2 √ Figure 19: A mesh size of 2 2 avoids robot collisions, and the cell diagonals have length 4. Note that robots may have arbitrary shape, as the separation argument applies to their circumcircles. √ Proof. We consider a grid D with mesh size 2 2. In this way, as shown in Figure 19, two robots starting simultaneously from different cells and traveling along two incident edges can touch when they reach the midpoints, but do not collide. Moreover, the diagonals have length 4. By choosing a grid that has no robot center on a grid line, every cell of D contains at most one start and one target position of a robot. Additionally, we can move each robot in the start and target configuration to the center of its own cell, allowing us to to use our algorithm from Section 3. Overall, we achieve a set of trajectories with makespan in O(d). √ In the remainder of this section we give an O( N )-approximation algorithm for the continuous makespan for these kind of well-separated arrangements, by extending the √ approach for discrete grids. Again, we make use of an underlying grid with mesh size 2 2. Our algorithm proceeds in three phases. (1) Moving the robots to vertices of the grid, (2) applying our O(1)-approximation for the discrete case, and (3) √ moving the robots from the vertices of the grid to their target positions. To ensure a O( N )-approximation, √ we move each robot center to a grid vertex within a distance of O( N ). Phases (1) and (3) are symmetric in the following sense. By applying the steps of phase (1) to the target configuration in reverse, we compute a grid configuration that serves as target configuration for phase (2). 26 Phase (1) works as follows. (1.1) We (x, y)-lexicographical m by sorting the N robots according to thel√ m l√begin order. Then we subdivide them into N vertical slices, each containing at most N robots. To the √ √ right of every slice, we add a vertical buffer slice of width 4 2 by moving all robots not yet considered by√4 2 units to the right. These trajectories are used in parallel, the distance covered by each robot is in O( N ). The buffer slices guarantee that in all following steps, the robots in each vertical slice are independent of each other. For (1.2), we continue by sorting the robots within the vertical slices√according to the (y, x)-lexicographical order. We separate the robots by ensuring vertical distance at least 4 2 between every pair of robots. This can be done by moving the robots upwards, starting from the second-to-lowest one. These trajectories can be √ done in parallel and the distance covered by each robot is in O( N ). For (1.3), we finally move each robot to the bottom-left vertex of the grid cell containing its center. computes a trajectory plan with continuous makespan in Theorem √ 15. The algorithm described above √ O(d + N ). If d ∈ Ω(1), this implies a O( N )-approximation algorithm. Proof. Phase √ (1) guarantees that either the horizontal or the vertical distance between each pair of robots is at least 4 2. Therefore, in each grid cell, there is at most one robot and each robot is moved to its own grid vertex. In phase (2), each robot is moved by O(d0 ) units, where d0 is the maximal distance between√ a robot’s start and target position in the grid. As the distance each robot covers in phases (1) and (3) is O( N ), the √ distance traveled in phase (2) is√in O(d + N ). Therefore, the trajectory set computed by the algorithm has continuous makespan in O(d + N ). The running time as described above is pseudopolynomial; it becomes polynomial by using standard compression techniques, e.g., by compressing large empty rectangles. 8.3 Colored and Unlabeled Disks We can combine the positive results of the previous section with the technique of Theorem 24 to achieve the same result for colored (and in particular, unlabeled) disks. Corollary 25. There is an algorithm with running time O(k(mn)1.5 log(mn) + dmn) that computes, given start and target images Is , It , an O(1)-approximation of the optimal makespan M and a corresponding set of trajectories. Proof. The proof proceeds analogous to Theorem 13: After computing an optimal bottleneck matching, apply Theorem 3 in the setting of Theorem 24. 9 Geometric Difficulties From a practical point of view, it is also desirable to compute provably optimal trajectories for specific instances of moderate size, instead of solutions for large instances that are within a provable constant factor of the optimum. This also plays a role as a building block for other purposes, e.g., providing a formal proof of NP-hardness for parallel geometric motion planning for disks: We need to be able to establish the shape of optimal trajectories when building gadgets for a hardness construction. However, the geometry involved in this goal is far from easy, even for an example as small as the one shown in Figure 20. This is closely related to recent work by Kirkpatrick and Liu [37], who devote a whole paper to computing optimal trajectories for two disks in an arbitrary initial and target configuration, with the objective of minimizing the total distance travelled instead of the makespan. A key insight is that optimal trajectories consist of a limited number of circular arcs. This is not necessarily the case for trajectories that minimize the makespan. Even for the seeming simplicity of our example, we do not have a proof of optimality of the trajectory T3 shown on the right. This illustrates the difficulty of characterizing and establishing optimal trajectories that minimize the total duration of a parallel schedule, highlighting the special role of geometry for the problem. 27 A B T1 T2 a b=b’ m1 a’ m2 b" Figure 20: Moving the left unit disk A from position a to position a0 at distance 4, with disk B starting and ending at b = b0 . (Left) Trajectory T1 rotates disk A around the stationary disk B resulting in makespan 2π √ = 6.28 . . .. Trajectories T2 rotate both disks around the centers m1 and m2 , resulting in makespan 2π = 4.44 . . .. (Right) Choosing a circular arc through (−2, 0), (2, 0) and the (numerically optimized) point (0, 0.493 . . .) for disk A (with B moving accordingly at distance 2) yields the trajectory T3 with makespan 4.16 . . .. 10 Conclusion We have presented progress on a number of algorithmic problems of parallel motion planning, also shedding light on a wide range of interesting open problems described in the following. The first set of problems consider complexity. The labeled problem of Section 3 is known to be NP-complete for planar graphs. It is natural to conjecture that the geometric version is also hard. It seems tougher to characterize the family of optimal trajectories: As shown above, their nature is unclear, so membership in NP is doubtful. A second set of questions considers the relationship between stretch factor and disk separability in the √ continuous setting. We believe that the upper bound of O( N ) on the worst-case stretch factor for dense arrangements is tight. What is the critical separability of disks for which constant stretch can be achieved? How does the stretch factor increase as a function of N below this threshold? For sparse arrangements of disks, simple greedy, straight-line trajectories between the origins and destinations of disks encounter only isolated conflicts, resulting in small stretch factors close to 1, i.e., 1 + o(1). What is the relationship between (local) density and the achievable stretch factor along the whole density spectrum? Finally, practical motion planning requires a better handle on characterizing and computing optimal solutions for specific instances, along with lower bounds, possibly based on numerical methods and tools. Moreover, there is a wide range of additional objectives and requirements, such as accounting for acceleration or deceleration of disks, turn cost, or multi-stop tour planning. All these are left for future work. Acknowledgements. We thank anonymous reviewers of a preliminary version of the paper for helping to improve the overall presentation. References [1] M. Abellanas, S. Bereg, F. Hurtado, A. G. Olaverri, D. Rappaport, and J. Tejel. Moving coins. Computational Geometry: Theory and Applications, 34(1):35–48, 2006. [2] A. Adler, M. de Berg, D. Halperin, and K. Solovey. Efficient multi-robot motion planning for unlabeled discs in simple polygons. IEEE Transactions on Automation Science and Engineering, 12(4):1309–1317, 2015. 28 [3] K. M. Al-Wahedi. A hybrid local-global motion planner for multi-agent coordination. Master’s thesis, Case Western Reserve University, 2000. [4] B. Aronov, M. de Berg, A. F. van der Stappen, P. Švestka, and J. Vleugels. Motion planning for multiple robots. Discrete & Computational Geometry, 22(4):505–525, 1999. [5] M. Barer, G. Sharon, R. Stern, and A. Felner. Suboptimal variants of the conflict-based search algorithm for the multi-agent pathfinding problem. In Proc. 7th Ann. Symp. Combinatorial Search, pages 19–27, 2014. [6] S. Bereg, A. Dumitrescu, and J. Pach. Sliding disks in the plane. International Journal of Computational Geometry & Applications, 18(5):373–387, 2008. [7] P. Berman, E. D. Demaine, and M. Zadimoghaddam. O(1)-approximations for maximum movement problems. In Proc. 14th Int. W. Approximation Algorithms for Combinatorial Optimization Problems (APPROX 2011), pages 62–74, Princeton, New Jersey, August 17–19 2011. [8] G. Calinescu, A. Dumitrescu, and J. Pach. Reconfigurations in graphs and grids. SIAM Journal on Discrete Mathematics, 22(1):124–138, 2008. [9] C. E. Campbell and J. Y. S. Luh. A preliminary study on path planning of collision avoidance for mechanical manipulators. Technical report, Purdue University, School of Electrical Engineering, 1980. [10] S. Cheung and F. C. M. Lau. Mesh permutation routing with locality. Information Processing Letters, 43(2):101–105, 1992. [11] R. Cui, B. Gao, and J. Guo. Pareto-optimal coordination of multiple robots with safety guarantees. Autonomous Robots, 32(3):189–205, 2012. [12] D. Delahaye, S. Puechmorel, P. Tsiotras, and E. Féron. Mathematical models for aircraft trajectory design: A survey. In Air Traffic Management and Systems, pages 205–247. Springer, 2014. [13] E. D. Demaine, M. L. Demaine, and H. Verrill. Coin-moving puzzles. In R. Nowakowski, editor, More Games of No Chance, Mathematical Sciences Research Institute Publications, pages 405–431. Cambridge University Press, 2011. [14] E. D. Demaine, M. T. Hajiaghayi, H. Mahini, A. S. Sayedi-Roshkhar, S. Oveisgharan, and M. Zadimoghaddam. Minimizing movement. ACM Transactions on Algorithms, 5(3):Article 30, July 2009. [15] E. D. Demaine, M. T. Hajiaghayi, and D. Marx. Minimizing movement: Fixed-parameter tractability. ACM Transactions on Algorithms, 11(2):Paper 14, November 2014. [16] V. R. Desaraju and J. P. How. Decentralized path planning for multi-agent teams with complex constraints. Autonomous Robots, 32(4):385–403, 2012. [17] J. M. Dı́az-Báñez, M. A. Heredia, C. Peláez, J. A. Sellarès, J. Urrutia, and I. Ventura. Convex blocking and partial orders on the plane. Computational Geometry: Theory and Applications, 51:55–66, 2016. [18] A. Dumitrescu. Motion planning and reconfiguration for systems of multiple objects. In S. Kolski, editor, Mobile Robots: Perception & Navigation, pages 1–20. InTech, 2007. [19] A. Dumitrescu and M. Jiang. On reconfiguration of disks in the plane and related problems. Computational Geometry: Theory and Applications, 46:191–202, 2013. [20] A. Efrat, A. Itai, and M. J. Katz. Geometry helps in bottleneck matching and related problems. Algorithmica, 31(1):1–28, 2001. [21] M. Erdmann and T. Lozano-Pérez. On multiple moving objects. Algorithmica, 2(1):477–521, 1987. 29 [22] A. Felner, M. Goldenberg, G. Sharon, R. Stern, T. Beja, N. R. Sturtevant, J. Schaeffer, and R. Holte. Partial-expansion A∗ with selective node generation. In Proc. AAAI Conf. Artificial Intelligence, pages 471–477, 2012. [23] G. W. Flake and E. B. Baum. Rush Hour is PSPACE-complete, or “Why you should generously tip parking lot attendants”. Theoretical Computer Science, 270(1):895–911, 2002. [24] E. Freund and H. Hoyer. On the on-line solution of the findpath problem in multi-robot systems. In O. Faugeras and G. Giralt, editors, 3rd Int. Symp. Robotics Research, pages 253–262, 1985. [25] A. Geramifard, P. Chubak, and V. Bulitko. Biased cost pathfinding. In Proc. 2nd Conf. Artificial Intelligence and Interactive Digital Entertainment, pages 112–114, 2006. [26] M. Goldenberg, A. Felner, R. Stern, G. Sharon, N. R. Sturtevant, R. C. Holte, and J. Schaeffer. Enhanced partial expansion A∗ . J. Artificial Intelligence Research, 50:141–187, 2014. [27] M. T. Hajiaghayi, R. Khandekar, M. R. Khani, and G. Kortsarz. Approximation algorithms for movement repairmen. ACM Transactions on Algorithms, 12(4):54:1–54:38, Sept. 2016. [28] P. E. Hart, N. J. Nilsson, and B. Raphael. A formal basis for the heuristic determination of minimum cost paths. IEEE Trans. Systems Science and Cybernetics, 4(2):100–107, 1968. [29] R. A. Hearn and E. D. Demaine. PSPACE-completeness of sliding-block puzzles and other problems through the nondeterministic constraint logic model of computation. Theoretical Computer Science, 343(1):72–96, 2005. [30] R. A. Hearn and E. D. Demaine. Games, puzzles, and computation. CRC Press, 2009. [31] S. Hirsch and D. Halperin. Hybrid motion planning: Coordinating two discs moving among polygonal obstacles in the plane. In Algorithmic Foundations of Robotics V, pages 239–255. Springer, 2004. [32] J. E. Hopcroft, J. T. Schwartz, and M. Sharir. On the complexity of motion planning for multiple independent objects; PSPACE-hardness of the warehouseman’s problem. Int. J. Robotics Research, 3(4):76–88, 1984. [33] J. E. Hopcroft and G. T. Wilfong. Reducing multiple object motion planning to graph searching. SIAM J. Comput., 15(3):768–785, 1986. [34] R. Huang, Y. Chen, and W. Zhang. A novel transition based encoding scheme for planning as satisfiability. In Proc. AAAI Conf. Artificial Intelligence, pages 89–94, 2010. [35] K. Kant and S. W. Zucker. Toward efficient trajectory planning: The path-velocity decomposition. Int. J. Robotics Research, 5(3):72–89, 1986. [36] H. Kautz and B. Selman. Unifying SAT-based and graph-based planning. In Int. J. Conf. Artificial Intelligence, volume 99, pages 318–325, 1999. [37] D. Kirkpatrick and P. Liu. Characterizing minimum-length coordinated motions for two discs. In Proc. 28th Canadian Conf. Computational Geometry (CCCG 2016), pages 252–259, August 3–5 2016. Full version at https://arxiv.org/abs/1607.04005. [38] S. Kloder and S. Hutchinson. Path planning for permutation-invariant multi-robot formations. In IEEE Trans. Robotics, volume 22, pages 650–665. IEEE, 2006. [39] D. Kornhauser, G. Miller, and P. Spirakis. Coordinating pebble motion on graphs, the diameter of permutation groups, and applications. In Annual Symposium on Foundations of Computer Science, 1984, SFCS ’84, pages 241–250, 1984. 30 [40] M. Kunde. Routing and sorting on mesh-connected arrays. In VLSI Algorithms and Architectures: 3rd Aegean Workshop on Computation (AWOC 88), pages 423–433. Springer, 1988. [41] S. LaValle and S. A. Hutchinson. Optimal motion planning for multiple robots having independent goals. In IEEE Trans. Robotics and Automation, volume 14, pages 912–925, 1998. [42] S. Leroy, J.-P. Laumond, and T. Siméon. Multiple path coordination for mobile robots: A geometric algorithm. In Proc. 16th Int. Joint Conf. Artificial Intelligence, pages 1118–1123. Morgan Kaufmann Publishers Inc., 1999. [43] J. M. Marberg and E. Gafni. Sorting in constant number of row and column phases on a mesh. Algorithmica, 3:561–572, 1988. [44] J. Peng and S. Akella. Coordinating multiple robots with kinodynamic constraints along specified paths. Int. J. Robotics Research, 24(4):295–310, 2005. [45] G. Ramanathan and V. Alagar. Algorithmic motion planning in robotics: Coordinated motion of several disks amidst polygonal obstacles. In Proc. 1985 IEEE Int. Conf. Robotics and Automation, volume 2, pages 514–522, 1985. [46] D. Ratner and M. K. Warmuth. Finding a shortest solution for the N × N extension of the 15-puzzle is intractable. In Proc. AAAI Conf. Artificial Intelligence, pages 168–172, 1986. [47] R. Regele and P. Levi. Cooperative multi-robot path planning by heuristic priority adjustment. In 2006 IEEE/RSJ Int. Conf. Intelligent Robots and Systems, pages 5954–5959. IEEE, 2006. [48] M. Rubenstein, A. Cornejo, and R. Nagpal. Programmable self-assembly in a thousand-robot swarm. Science, 345(6198):795–799, 2014. [49] O. Salzman, M. Hemmer, and D. Halperin. On the power of manifold samples in exploring configuration spaces and the dimensionality of narrow passages. IEEE Trans. Automation Science and Engineering, 12(2):529–538, 2015. [50] G. Sanchez and J.-C. Latombe. Using a PRM planner to compare centralized and decoupled planning for multi-robot systems. In Proc. IEEE Int. Conf. Robotics and Automation, pages 2112–2119, 2002. [51] C. Scheideler. Universal routing strategies for interconnection networks, volume 1390 of Lecture Notes in Computer Science. Springer, 1998. [52] J. T. Schwartz and M. Sharir. On the piano movers’ problem: III. Coordinating the motion of several independent bodies: the special case of circular bodies moving amidst polygonal barriers. Int. J. Robotics Research, 2(3):46–75, 1983. [53] G. Sharon, R. Stern, A. Felner, and N. R. Sturtevant. Meta-agent conflict-based search for optimal multi-agent path finding. In Proc. Symp. Combinatorial Search, pages 97–104, 2012. [54] G. Sharon, R. Stern, A. Felner, and N. R. Sturtevant. Conflict-based search for optimal multi-agent pathfinding. Artificial Intelligence, 219:40–66, 2015. [55] G. Sharon, R. Stern, M. Goldenberg, and A. Felner. The increasing cost tree search for optimal multi-agent pathfinding. Artificial Intelligence, 195:470–495, 2013. [56] T. Siméon, S. Leroy, and J.-P. Laumond. Path coordination for multiple mobile robots: A resolutioncomplete algorithm. IEEE Trans. Robotics and Automation, 18(1):42–49, 2002. [57] K. Solovey and D. Halperin. k-color multi-robot motion planning. Int. J. Robotics Research, 33(1):82–97, 2014. 31 [58] K. Solovey and D. Halperin. On the hardness of unlabeled multi-robot motion planning. The International Journal of Robotics Research, 35(14):1750–1759, 2016. [59] K. Solovey and D. Halperin. Sampling-Based Bottleneck Pathfinding with Applications to Fréchet Matching. In P. Sankowski and C. Zaroliagis, editors, 24th Annual European Symposium on Algorithms (ESA 2016), volume 57 of Leibniz International Proceedings in Informatics (LIPIcs), pages 76:1–76:16, Dagstuhl, Germany, 2016. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik. [60] K. Solovey, O. Salzman, and D. Halperin. Finding a needle in an exponential haystack: Discrete RRT for exploration of implicit roadmaps in multi-robot motion planning. The International Journal of Robotics Research, 35(5):501–513, 2016. [61] K. Solovey, J. Yu, O. Zamir, and D. Halperin. Motion planning for unlabeled discs with optimality guarantees. In Robotics: Science and Systems (RSS), 2015. [62] P. Spirakis and C. K. Yap. Strong NP-hardness of moving many discs. Information processing letters, 19(1):55–59, 1984. [63] T. Standley. Finding optimal solutions to cooperative pathfinding problems. In Proc. 24th AAAI Conf. Artificial Intelligence, pages 173–178, 2010. [64] P. Švestka and M. H. Overmars. Coordinated path planning for multiple robots. Robotics and autonomous systems, 23(3):125–152, 1998. [65] M. Turpin, N. Michael, and V. Kumar. Trajectory planning and assignment in multirobot systems. In Algorithmic foundations of robotics X, pages 175–190. Springer, 2013. [66] M. Turpin, K. Mohta, N. Michael, and V. Kumar. Goal assignment and trajectory planning for large teams of interchangeable robots. Autonomous Robots, 37(4):401–415, December 2014. [67] J. P. van den Berg and M. H. Overmars. Prioritized motion planning for multiple robots. In 2005 IEEE/RSJ Int. Conf. Intelligent Robots and Systems, pages 430–435. IEEE, 2005. [68] J. P. van den Berg, J. Snoeyink, M. C. Lin, and D. Manocha. Centralized path planning for multiple robots: Optimal decoupling into sequential plans. In Robotics: Science and systems, volume 2, pages 2–3, 2009. [69] M. Čáp, P. Novák, M. Seleckỳ, J. Faigl, and J. Vokřı̀nek. Asynchronous decentralized prioritized planning for coordination in multi-robot system. In 2013 IEEE/RSJ Int. Conf. Intelligent Robots and Systems, pages 3822–3829. IEEE, 2013. [70] G. Wagner and H. Choset. M ∗ : A complete multirobot path planning algorithm with performance bounds. In 2011 IEEE/RSJ Int. Conf. Intelligent Robots and Systems, pages 3260–3267. IEEE, 2011. [71] G. Wagner and H. Choset. Subdimensional expansion for multirobot path planning. Artificial Intelligence, 219:1–24, 2015. [72] R. M. Wilson. Graph puzzles, homotopy, and the alternating group. Journal of Combinatorial Theory, Series B, 16(1):86–96, 1974. [73] P. R. Wurman, R. D’Andrea, and M. Mountz. Coordinating hundreds of cooperative, autonomous vehicles in warehouses. AI magazine, 29(1):9, 2008. [74] J. Yu and S. M. LaValle. Optimal multirobot path planning on graphs: Complete algorithms and effective heuristics. IEEE Trans. Robotics, 32(5):1163–1177, 2016. [75] J. Yu and D. Rus. An effective algorithmic framework for near optimal multi-robot path planning. In Proc. Int. Symp. Robot. Res., 2015. 32
8cs.DS
arXiv:1802.04205v2 [cs.RO] 15 Feb 2018 Efficient Hierarchical Robot Motion Planning Under Uncertainty and Hybrid Dynamics Ajinkya Jain Scott Niekum Department of Mechanical Engineering, University of Texas at Austin, Austin, TX 78712, USA Email: [email protected] Department of Computer Science, University of Texas at Austin, Austin, TX 78712, USA Email: [email protected] Abstract—Noisy observations coupled with nonlinear dynamics pose one of the biggest challenges in robot motion planning. By decomposing the nonlinear dynamics into a discrete set of local dynamics models, hybrid dynamics provide a natural way to model nonlinear dynamics, especially in systems with sudden “jumps” in the dynamics, due to factors such as contacts. We propose a hierarchical POMDP planner that develops locally optimal motion plans for hybrid dynamics models [1]. The hierarchical planner first develops a high-level motion plan to sequence the local dynamics models to be visited. The high-level plan is then converted into a detailed cost-optimized continuous state plan. This hierarchical planning approach results in a decomposition of the POMDP planning problem into smaller sub-parts that can be solved with significantly lower computational costs. The ability to sequence the visitation of local dynamics models also provides a powerful way to leverage the hybrid dynamics to reduce state uncertainty. We evaluate the proposed planner for two navigation and localization tasks in simulated domains, as well as an assembly task with a real robotic manipulator. I. I NTRODUCTION One of the biggest challenges in robot motion planning is to develop feasible motion plans for systems having highly nonlinear dynamics in the presence of partial or noisy observations. Often, these nonlinearities are caused by sudden transitions or “jumps” in the dynamics (for example, due to contacts in a robot manipulation task). When the dynamics of a task can change suddenly in state space, even small state estimation errors can lead to large deviations and plan failure. Therefore, reasoning about the uncertainty over states becomes crucial in order to develop robust motion plans. Planning problems under uncertainty are often represented as a partially observable Markov decision process (POMDP) [2]. POMDP problems have been shown in literature to be PSPACE-complete [3], making exact planning intractable. To make planning tractable, POMDP planners typically leverage various types of approximations [4, 5, 6, 7, 8] or structural assumptions [7, 9, 10, 11, 12] that simplify the problem. In this work, we propose to leverage a natural, simplifying assumption that the nonlinear dynamics of robot motion planning tasks can be decomposed into a discrete set of simpler local dynamics models, of which only one is active at any given time (e.g. a change in dynamics due to contact). Note that these local dynamics models may be approximate, especially when they are learned from data or are a simplification of a complex underlying model. A complete dynamics model can then be defined as a hybrid dynamics model having hybrid states comprised of the continuous states of the system along with a discrete state denoting the active local dynamics model. The primary contribution of this work is a novel POMDP planner that plans in a hybrid belief space, allowing for efficient information gathering and planning under uncertainty with hybrid dynamics. We define the hybrid belief to be composed of a mixture of Gaussians and a discrete distribution, which represent the uncertainty over the state of the robot and the active dynamics model respectively. Using the hybrid belief representation, a hierarchical POMDP motion planner is presented that solves the POMDP problem by dividing it into two levels: at the higher level, discrete state plans are generated to find a sequence of local models that should be visited during the task, and at the lower level, these discrete state plans are converted into cost-optimized continuous state belief-space plans. The biggest advantage of dividing the planning problem into two levels is that it breaks long-horizon planning problems into multiple smaller segments that can be sequenced to find a complete solution. Since POMDP planning becomes exponentially more difficult with longer horizons ([3]), a hierarchical approach breaks problem into chunks that can be solved with significantly less effort. Another major benefit of discrete state planning is that the planner can chose to leverage a specific local dynamics model in order to improve the effectiveness of the generated plans. For example, if it is known a priori that in the k-th local dynamics model, motion is allowed only along a particular vector (e.g. due to presence of a wall), it can be used to reduce the state uncertainty along the dimensions orthogonal to the allowed motion vector. This indirect feedback for uncertainty reduction is critical for tasks in which the observations are either extremely noisy or not available at all. The proposed POMDP motion planner is evaluated on two simulated domains: autonomous robot navigation under uncertainty with spatially varying dynamics and planar navigation while localizing using walls. Finally, our algorithm is evaluated with a physical robotic manipulator that is tasked with partially assembling a toy airplane from the YCB dataset [13]. II. R ELATED W ORKS A. POMDP Planning Broadly, POMDP solving approaches can be divided into two categories based on whether their state, action and observation spaces are discrete or continuous. Discrete space POMDP solvers, in general, either approximate the value function using point-based methods [5, 6] or use Monte-Carlo sampling in the belief space [14, 15] to make the POMDP problem tractable. Continuous space POMDP solvers often approximate the belief over states as a distribution having finite parameters (typically Gaussian) and either solve the problem analytically using gradients [10, 11, 12] or use random sampling in the belief space [7, 8]. Other approaches have also extended point-based methods to continuous domains [6]. Discrete space POMDP solvers have been shown to be able to successfully plan for large discrete space domains, however, continuous space domains are infinite-dimensional, and discrete space solvers often fail to find feasible solutions for planning horizons longer than a few steps [15]. Among continuous space POMDP solvers, Agha-Mohammadi et al. [7] and Hollinger and Sukhatme [8] have proposed sampling based methods that can find effective solutions even in complex domains. However, they suffer from the problem of obtaining sub-optimal solutions which can only be probabilistically optimal at best [16]. Gradient-based POMDP solvers [10, 11, 12] form another class of very powerful POMDP solvers which can find locally optimal solutions, but in the context of manipulation planning, sudden changes in dynamics due to contacts result in non-finite gradients at the transition points and restrict the applicability of such methods. POMDP solvers for hybrid domains, such as the one discussed in this work, have been previously discussed by Brunskill et al. [4], Sreenath et al. [9] and Agha-mohammadi et al. [17]. Brunskill et al. [4] proposed a point-based POMDP planning algorithm, SM-POMDP planner, for solving continuousstate POMDPs based on the hybrid system dynamics. They approximated the complex nonlinear system dynamics using a hybrid multi-modal dynamics model with continuous statedependent discrete mode switching conditions. However, unlike our POMDP planner, SM-POMDP planner plans only in the continuous domain and the discrete states are obtained “passively” using the switching conditions. While this approach can be used to find feasible motion plans, it is not leveraging some of the major natural advantages of the hybrid dynamics representation such as shorter planning horizons and a structured way to leverage dynamics for state uncertainty reduction. Sreenath et al. [9] discussed the problem of bipedal walking on a varying terrain by formulating it as a POMDP problem defined on a continuous-time hybrid system. They proposed a bi-level POMDP controller to track the transitions in the terrain as a set of discrete states and were able to show stable bipedal walking in simulated domains. However, this is a passive approach as well, as it uses hybrid dynamics only to capture the transitions in the terrain and not to simplify the POMDP problem. Agha-mohammadi et al. [17] discussed a POMDP solver with hybrid states to solve health-aware stochastic motion planning problem for quadrotors, however, the proposed solution is restricted only to the domains in which the discrete and continuous states evolve independently. B. Manipulation Planning and Control As hybrid dynamics models are very effective in modeling nonlinearities that are due to sudden transitions in the dynamics, a natural application domain for the proposed POMDP solver is contact-rich robot manipulation. One of the current approaches for solving the robot manipulation planning problem is to search for an optimal sequence of parameterized manipulation actions or primitives to perform the task [18, 19]. Kroemer et al. [19] have proposed to represent primitives for different phases (modes) of a multi-phase manipulation task using dynamic movement primitives (DMPs) and learn a library of such manipulation skills which can be optimally sequenced to perform a task. Unfortunately, a lack of a task dynamics model prevents these methods from generalizing to novel manipulation tasks, e.g. having different cost functions, even if it involves the same objects. In more recent works by Levine et al. [20] and Fu et al. [21], authors have used deep learning techniques to develop endto-end control policies directly from vision; however, under sparse availability of training data (especially in robotics), these approaches tend to fail to develop generalized control policies for all system states or initial conditions. III. P RELIMINARIES AND D EFINITIONS A. POMDPs Partially Observable Markov Decision Processes (POMDPs) provide a mathematical framework for the problem of sequential decision making under uncertainty [2]. Let X ⊂ Rn be the space of all possible states x of the robot, U ⊂ Rm be the space of all possible control inputs u and Z ⊂ Rk be the space of all possible sensor measurements z the robot may receive. To account for state uncertainty, a distribution of the state xt of the robot given all past control inputs and sensor measurements is defined as the belief b[xt ], given as b[xt ] = p[xt |u0 , ..., ut−1 , z1 , ..., zt ] (1) where xt ∈ X , ut ∈ U and zt ∈ Z are the robot’s state, control input and received measurement at time step t, respectively and B ⊂ {X → − R} represent the space of all possible beliefs. In a general case, considering a stochastic dynamics and observation model for the process given as xt+1 ∼ p[xt+1 |xt , ut ], zt ∼ p[zt |xt ] (2) for a given control input ut and a measurement zt+1 , the belief can be propagated using Bayesian filtering as Z b[xt+1 ] = ηp[zt+1 |xt+1 ] p[xt+1 |xt , ut ]b[xt ]dxt (3) where η is a normalizing constant independent of xt+1 . In this work, we consider hybrid beliefs to represent the distribution of hybrid states, with the beliefs over continuous states represented as a mixture of Gaussians and a discrete distribution that represents confidence over the active local dynamics model. Further details on belief propagation are discussed in the section IV. B. Trajectory Optimization using Direct Transcription Direct Transcription is a trajectory optimization method in which a constrained nonlinear optimization problem is set up with the user-defined objective function over a set of knot-points {xi , ui }) chosen to discretize the continuous space trajectory into a set of decision variables. The system dynamics are imposed as the constraints on the optimization problem. For discrete-time systems, these knot-points can be taken as the system state xt and the control input ut at each time step t. However, planning for longer horizons will then require specifying a high number of knot-points (xi , ui ) which can result in very high computational costs. This can be resolved by approximately parameterizing the space of possible trajectories by a series of M segments and solving the optimization problem for a knot points only at the start and end points of segments. The intermediate points on the trajectory can be obtained via numerical integration. Let x01:M and u01:M −1 be sets of state and action variables that parameterize the trajectory in terms of segments. The ith segment can be assumed to start at time iδ and ends at time T for a time horizon T . iδ + δ − 1, where δ = M A general objective function for trajectory optimization can be given as ˆ 0 1 : M , u01:M ) J(x1:T , u1:T ) ≈ J(x = M X 0 0T 0 x̃0T i Qx̃i + ũi Rũi j=1 where Q and R represent the cost matrices associated with the state and the input respectively. The system dynamics incorporated as constraints can be defined as: x02 =φ(x01 , u01 ) .. . x0k =φ(x0k−1 , u0k−1 ) where the function φ(x0i , u0i ) can be seen as performing numerical integration of the current state variable x0i till the next state variable x0i+1 . The function φ is given as + [F (xt+1 , ui ) − F (xt , ui )] where x ∈ Rn , u ∈ Rm and z ∈ Rl are the continuous state, control input and observation variables, respectively and q ∈ Q represents the active discrete state of the system. Evolution of the discrete state of the system can be modeled by a finite state Markov chain as µt+1 = Πµt (6) where Π = {πij } is the discrete state transition matrix and µ ∈ RQ is the probability distribution over discrete states at time t. IV. A PPROACH We propose to solve the problem of motion planning under uncertainty for tasks governed by highly nonlinear dynamics as a POMDP problem defined on a hybrid dynamics model. Different local dynamics models constituting the task dynamics are represented as distinct discrete states of the hybrid model. Under uncertainty over the robot state, a separate discrete distribution needs to be maintained to represent our confidence over the active local dynamics model at each time step. Jointly, a hybrid belief over the hybrid state of the system can be defined with a continuous part representing uncertainty over the robot state and a discrete part representing uncertainty in the active local dynamics model. In this work, we assume that the continuous part of hybrid belief is represented by a mixture of L Gaussian distributions given as L X bxt = αl N (µl , Σl ) (7) l=1 x0i+1 = φ(x0i ) =F (x0i , ui ) iδ+δ−1 X states q ∈ Q ⊂ W [1]. Each discrete state of the system corresponds to a separate dynamics model that governs the evolution of continuous states. These types of dynamical models are sometimes referred to as switched dynamical systems in the literature [22]. In a hybrid model, discrete state transitions of the system can be represented as a directed graph with each possible discrete state q corresponding to a node and edges (e ∈ E ⊆ Q × Q) marking possible transitions between the nodes. These transitions are conditioned on the continuous states. A transition from the discrete state q to another state q 0 happens if the continuous states x are in the guard set G(q, q 0 ) of the 0 0 edge eqq where eqq = {q, q 0 }, G(·) : E → P (X) and P (X) is the power set of X. Thus, a hybrid dynamics model H can be defined as xt+1 = fq (xt , ut ) (5) zt = hq (xt ) where αl represents the mixing weight of l-th Gaussian. (4) t=iδ where F (xt , ut ) represents the system dynamics. C. Hybrid Dynamics A hybrid dynamics model of a system is a dynamics model in which the states of the system evolve with time over both continuous space x ∈ X = RN and a finite set of discrete A. Belief Propagation under Hybrid Dynamics A hybrid belief can be defined as B = {bx , bq }, where bx and bq correspond to the belief over the continuous robot state x and the discrete states (local dynamics models) q respectively. Propagation of hybrid belief using Bayesian filtering can be separated into two steps: prediction based on the dynamics model to obtain a belief prior and an update step using the received observation to find belief posterior. 1) Belief Prior: At each time step t, we can propagate the current belief bxt through the system dynamics of each discrete 0 state, F q (xt , ut ), individually and then take a weighted sum of the propagated belief set to obtain a belief prior for the next time step b̂xt+1 X 0 q 0 b̂xt+1 = F q (bxt , ut ) bt q (8) q0 q 0 bt q 0 bqt+1 = γMt+1 ◦ b̂qt+1 0 (12) 0 T where Mt+1 = [P (zt+1 |qt+1 = q )] ∀q ∈ Q, ◦ is the element-wise multiplication operator, γ is a normalization constant and 0 0 bqt , where = p(qt = q |xt ) is q -th component of and xt , qt and ut represent the continuous states, discrete state and continuous control input to the system at time t and b̂[x(t+1)] is denoted as b̂xt+1 . Under stochastic continuous state dynamics, the definition of the discrete state transition matrix as given in Equation 6 needs to be extended. Assuming the transitions of discrete states are given by a directed graph with self-loops, we can define the extended discrete state transition matrix Π at time j t as Πt = {πt (i, j) = p(qt+1 |qti , b̂xt+1 ) ∀q i , q j ∈ Q} as Z j i πt (i, j) = η 1qqi (x)b̂xt+1 (x)dx, if ∃ eqqj , N (9) R = , otherwise j where 1qqi (x) is an indicator function defined as ( 1, if x ∈ G(q i , q j ) qj 1qi (x) = 0, otherwise (10) P|Q| η is a normalization constant, given as η = k=1 π(i, k) and  is a small probability to handle scenarios in which the received observations do not correspond to any legal discrete transition based on the current belief. Calculating the extended discrete state transition matrix Πt at each time step using Eq. 9 can be computationally expensive. An approximation of Πt can be obtained by sampling n random points from the belief over continuous states bxt+1 and calculating ratio of points lying in the guard set G(q i , q j ) to the total number of sampled points for each discrete state q j . 2) Belief Posterior: We use a hybrid estimation algorithm based on Bayesian filtering to reduce the uncertainty over states using noisy continuous state observations. The proposed algorithm consists of two layers of filters: first to estimate the continuous states of the system and second to estimate the discrete states of the system. Upon receiving observation zt+1 , the continuous state prior is updated by taking a weighted sum of a bank of extended Kalman filters running independently, with each discrete mode having an individual filter. The weights for the sum is determined using the prior for the discrete mode b̂qt+1 . The complete update step for continuous states can be written as  q X  q0 q0 q0 bxt+1 = b̂xt+1 + Kt+1 (zt+1 − Ht+1 (b̂xt+1 )) b̂t+1 (11) q0 0 the discrete state can be obtained by using a Bayesian filter update given as where Kqt+1 is the Kalman Gain for discrete state q 0 at time qq0 t + 1 and b̂t+1 is q 0 -th component of b̂qt+1 . The update for q P (zt+1 |qt+1 = q 0 ) = zt+1 ∼ Ht+1 (bxt+1 ) 0 q where Ht+1 (.) is the observation function for state q 0 . Mixing weights for the mixture of Gaussians are also updated based on the received observations as l αt+1 = N (ν|0, Σlt+1 ) (13) l where innovation ν is given as ν = zt+1 − ẑt+1 and X q0 qq0 l Ht+1 µlt+1 × b̂t+1 ẑt+1 = q0 A new mixture of L Gaussians is then chosen to represent the continuous belief bxt+1 at time step t + 1. B. Direct Planning With the hybrid belief propagation equations defined, we can now use the trajectory optimization technique to solve the POMDP problem. We assume maximum likely observations (MLO) obtained by propagating the current belief over continuous states through the system dynamics (Eqn. 8) as true observations for developing locally optimal motion plans. This is a standard assumption to make while solving POMDP problems and has been discussed previously by Platt et al. [23]. In this work, the nonlinear optimization problem set up for trajectory optimization is posed as a sequential least squares programming (SLSQP) problem and solved using the SNOPT software package [24, 25]. We denote this approach as the direct planning approach. C. Hierarchical Planner Although the direct planning approach can be used to solve the POMDP problem, planning for longer horizons in complex tasks, such as contact-rich manipulation tasks, can result in infeasible computational costs [3]. To tackle this challenge, we propose a hierarchical planner that decomposes the POMDP problem into smaller subproblems which can be solved with significantly less effort. The proposed hierarchical planner has two levels: a higher level to find the best sequence of local dynamics models that should be visited along the path (by visiting the region in the continuous state space corresponding to its guard set, G(q 0 , ·)) and a lower level that is similar to the direct planning approach discussed above. The higher level planner starts by generating a set of high-level plans consisting of all possible permutations of the discrete states of the task. A high-level plan is then converted into a sequence of continuous state goals which represent the most likely points in the continuous state space for activating the corresponding set of discrete states (see Algorithm [1]). The lower level planner is then called for each of these continuous state goals and a complete continuous state path for the highlevel plan is generated by combining the outputs of lower level planner. An additional discrete state is added to each high-level plan which represents the desired goal of the task and is considered to be active within an −neighbourhood of the actual task goal. High-level plans are then ranked by calculating a divergence cost on the distribution of planner’s confidence on the active discrete state at the final point of the plan and the desired confidence distribution (all the probability mass within the −neighbourhood of the goal). Continuous state plan corresponding to the high-level plan with the minimum cost is chosen as the best path for the task. In this work, we have used Hellinger distance to calculate the divergence cost [26] between the discrete distributions as it forms a symmetric bounded metric with a value between 0 and 1, and was found to be more numerically stable than the Bhattacharya distance, KL-divergence, and its symmetric form on the tested application domains. Radial basis functions were used to interpolate the divergence costs throughout the domain and the differential evolution method was used to find the approximately globally optimal solutions of the generated cost map [27]. Algorithm 1: High-Level Plan − → Continuous State Goals 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Function ds plan to cs goals (high-level plan) k for each qgoal in high-level plan do Find equivalent ( confidence distribution Wgoal : k 1, if q = qgoal Wgoal (q) = 0, else Sample n random points: Xsample = {x1 , ..., xn } ∼ X ; for each xi ∈ Xsample do Find confidence distributions on discrete states wi ∈ Wsample : Sample a random set X 0 ∼ X ; for each q 0 ∈ Q do |x0 ∈ X 0 ∩ G(q 0 , q 00 ) ∀q 00 | wi (q 0 ) = ; |X 0 | Find cost of divergence ci ∈ C 0 ⊂ R: ci (xi ) = Hellinger(wi , Wgoal ); Define cost map on complete domain X : Ccomplete (x) = Interpolate(C 0 ); Find best representative point in continuous state: xkbest = global optimization(x, Ccomplete ); Append xkbest to Xcs goals ; return Xcs goals ; D. Trajectory Stabilization With the MLO assumption, it is very likely that during execution the belief over robot state will diverge from the nominal trajectory planned. To ensure that the execution phase belief follows the plan, a belief space LQR (B-LQR) controller can be defined around the nominal trajectory. B-LQR controllers were introduced by Platt et al[23] and can be seen as belief-space extension of Linear-Quadratic Regulators (LQR). For systems with linear-Gaussian process and observation dynamics, a BLQR controller is optimal and equivalent to a linear-Quadratic Gaussian (LQG) controller. In B-LQR, each point in the nominal trajectory is defined as a set point and quadratic costs are defined for distance from the set point and the control effort required to converge to the set point. Closed form solutions exist to ensure convergence to the set point within a finite time horizon. While stabilizing the trajectory, the most likely active discrete state is taken to define the governing dynamics of the system. However, it may happen that B-LQR controller is unable to stabilize the execution phase (actual) belief around the nominal trajectory. If the planned belief for the next step deviates more than a δ-threshold from the actual belief after the observation update, a replanning call to the planner is triggered. V. E XPERIMENTS The proposed POMDP solver for hybrid dynamics was tested on three tasks: autonomous navigation for informationgathering in a benchmark light-dark domain with spatially varying dynamics, navigation and localization in a walleddomain with extremely poor observations, and a real manipulation task of partially assembling a toy airplane [13] under noisy observations by leveraging contacts to reduce uncertainty. A. Domain-I: Light-Dark Domain The first task aims to test the capability of the lower-level planner to develop effective motion plans under spatiallyvarying dynamics. A 2D light-dark domain [23] was considered for the task in which observation quality is proportional to the degree of light at a given state. The task objective was to reach the pre-specified goal with minimum state uncertainty. The 2D domain ({x, y} ∈ [−10, 10]) was considered to contain three different local dynamics functions, given as   if x < −1 xt + 0.5u, f (xt , u) = xt + u, if x ∈ [−1, 4]   T xt + [2u1 , u2 ] , if x > 4 where xt = {xt , yt }T . Belief over continuous states was considered to be a Gaussian distribution bx = {µ, σ}. The observation function was taken as h(xt ) = xt + w with zero-mean Gaussian observation noise w ∼ N (·|0, W (x)) where W (x) = 21 (5 − xx )2 + const. Matrices defining the cost function over error in states, control input and additional cost for final state error and covariance were taken as Q = diag(0.5, 0.5), R = diag(0.5, 0.5), Qlarge = 30 and Λ = 400 respectively. We compare the performance of the direct-planning approach with a baseline approach which, instead of having a probabilistic belief over the active dynamics model, determines the active dynamics model based on the maximum likelihood state of the continuous belief. Trajectories planned and the actual executions are shown in Figure 1. Figure 1 shows that the direct planning approach was able to develop effective belief space plans that move into the light to reduce uncertainty before heading to the goal even under changing local dynamics, while the baseline approach fails to do so. It can be seen from Figure 1 that if the uncertainty over continuous states is high, having a completely deterministic approach over active discrete states while planning can cause the belief to diverge completely from the actual robot state. Hence, it is critical to maintain a belief over the discrete states as well in order to develop meaningful belief space plans. Fig. 1: Plots showing planned and actual robot trajectories for the baseline and the direct planning approach. Initial belief mean µ = {2, 2}, cov = diag(5.0, 5.0) (yellow cross on red trajectory), True start position:={2.5,0, 0} (yellow cross on white trajectory), goal position:={0,0} (shown by green square). Brightness reflects quality of observation. Dashed lines separate different dynamics modes B. Domain-II: Walled Domain In the second domain, we compared the performance of the hierarchical planner with the direct planning approach. Note that the direct planning approach is similar in principle to the SM-POMDP planner proposed by Brunskill et al. [4] and hence, provides a comparison of the proposed hierarchical planner with a similarly passive planning approach. The 2D domain ({x, y} ∈ [−2, 15]) consisted of two perpendicular walls parallel to the x and y axis respectively. Observations were considered to be extremely noisy and had zero-mean Gaussian observation noise w given as w ∼ N (·|0, 15). As the motion along the wall is constrained to be only parallel to the wall, the robot can use it to efficiently localize itself in a direction orthogonal to the wall. The hybrid dynamics model of the domain can be given as  xt + " u, if x > −2, y > −2   #     x + 0 0 u, if x < −2 t 0 1 f (xt , u) = " #    1 0    u, if x > −2, y < −2, xt + 0 0 where xt = {xt , yt }T . Beliefs over continuous states were considered to be a Gaussian distribution bx = {µ, σ}. Observation function was taken as h(xt ) = xt + w. Matrices defining the cost function over error in states, control input, additional cost for final state error and covariance were taken as Q = diag(0.5, 0.5), R = diag(10.0, 10.0), Qlarge = 1e4 and Λ = 1e7 respectively. Sample trajectories planned by the direct planning and the hierarchical planner are shown in Figure 2. It is evident from the figures that the hierarchical planner plans to selectively visit the two discrete states representing the walls, in contrast to the direct method. Also, the hierarchical planner is able to converge to the goal faster and with a much lower uncertainty than the direct planning approach. As the direct planner does not leverage the knowledge of local dynamics models in a structured way, it needs to plan longer trajectories to gather more information. However, due to high noise in the observations, it still fails to converge to the goal with high accuracy. Additional statistical analysis to compare the two approaches in terms of total planning time, final error and final belief uncertainty are presented in Table I. It can be seen from the table I that, for comparable final error and final belief uncertainty, the hierarchical planner is able to find a solution approximately 5 times faster than the direct planning approach. The planning horizon was set to 20 time steps. Optimized planning parameters for both approaches were first obtained by conducting multiple test runs in the preparation phase. Belief and actual robot start conditions were taken as [5, 5]T and [3.5, 2.0]T respectively. The termination condition was triggered when the maximum likelihood point of the belief converged within a ball of 0.2 unit radius around the set goal ([0, 0]T ) with a maximum covariance of 1 unit. Metric Total time (in seconds) Final Error Final Max. Belief Uncertainty Direct 51.908 [−0.168, 0.172]T 0.696 Hierarchical 10.695 [0.086, 0.198]T 0.625 TABLE I: Comparison of direct and hierarchical planning. Values are averaged over 5 runs for both methods. C. Domain-III: Airplane assembly Finally, we experimentally demonstrate that the hierarchical POMDP planner can be used to tractably solve a real world manipulation task—the partial assembly of a toy airplane from the YCB dataset [13] (shown in Figure 3). We considered the first step of inserting the landing gear into the wing as a test case for our planner. The task requires high precision, as the maximum final state error margin for a successful execution is ±0.2 cm. As an added challenge, no direct feedback on the location of the hole on the wing was made available to the planner. Only noisy feedback on the location of the airplane in the world frame was provided (average estimation error ±2.0 cm; obtained by doing an online object cluster extraction, using multi-plane segmentation from the Point Cloud Library (PCL) on the point cloud data of a Microsoft Kinect v2 sensor). This experiment demonstrates two important features of the proposed planner: first, the planner can be scaled to solve real-world manipulation planning (a) Direct Planning (b) Hierarchical Planning Fig. 2: A comparison of planned and actual trajectories using the direct planning and hierarchical planning approaches on the walled domain. For both cases, Initial belief mean µ = {5, 5}, cov = diag(11.5, 11.5) , True start position:={3.5, 2.0}. Gray circles represent belief covariance under uncertainty problems and second, due to the hierarchical planning approach, the planner essentially enables the robot to plan and “feel around” to localize itself even when the direct visual observations aren’t available, similar to what a human might do. In a robot manipulation task involving contacts, based on the type of contact between the bodies, the number of state-dependent local dynamics models can be large, or even infinite. We simplify the problem by assuming an approximate hybrid dynamics model, in which the local dynamics models correspond to possible motion constraints that the robot can encounter while executing the task. For example, the task of placing a cup on a table can be considered to be approximately made of two local dynamics models: one when the two objects are not in contact and the other when the cup is in contact with the table plane. The second dynamics model represents the motion constraint placed on the cup by the table by restricting its motion to be only along its plane and not penetrating it. This approximation helps in having a succinct and effective representation of the task dynamics; as under this Fig. 3: Toy airplane: assembled (left) and unassembled (right) approximation, for a specific set of inputs, the relative motion between the two objects in contact will always be the same independent of the type of contact between them. In this case, the specific set of inputs would be the set of all inputs which do not result in moving the cup away from the table plane, resulting in breaking the contact between them. In this experiment, we consider the domain to be made up of four distinct local dynamics models: two corresponding to the linear motions along the wing plane edges, one corresponding to the corner of the plane and one to represent free-body motion elsewhere in the domain. At the highest level, the planning problem can be broken down into two steps: first, to localize the gear at a point in a plane parallel to the wing and second, to insert the gear into the hole. A hybrid dynamics model in a plane parallel to the wing can be given as " #  0 0    xt + u, if x ∈ [4, 4.5], y > −13.5   0 1   " #   1 0 f (xt , u) = xt + u, if x < 4, y ∈ [−14, −13]  0 0      xt + 0 ∗ u, if x ∈ [4, 4.5], y ∈ [−14, −13.5]    xt + u, otherwise (14) where 1 unit in continuous space = 1 cm. The observation function was given as h(xt ) = xt + w with zero-mean Gaussian observation noise w ∼ N (·|0, 2I2 )) Experiments were conducted using a bi-manual manipulator robot with two Kinova Jaco2 7-dof arms. The planner took 14.682 seconds to plan the path. Figure 5 shows the trajectory planned by the hierarchical planner and the actual trajectory taken by the robot in a plane parallel to the wing. Figure 4 Fig. 4: Snapshots of the robot assembling the toy airplane Fig. 5: Planned and Actual trajectories for the airplane assembly task. Bold black lines represents the edges of the airplane wing shows snapshots of the trajectory executed by the robot during the task from two perpendicular angles. It can be see from the second panel of the Fig. 4 that planner plans to activate the motion constraint parallel to the wing in order to reduce its uncertainty. Once localized in the plane parallel to the wing, the robot changes planes to move to a point directly above the hole and then proceeds to insert the landing gear into the airplane. VI. C ONCLUSION Nonlinear task dynamics, especially due to sudden changes in the dynamics, can be effectively modelled using a hybrid dynamics model. A hybrid dynamics model consists of a set of local dynamics models with only one of them being active at a time. In this work, we propose a hierarchical POMDP planner for hybrid dynamics which can develop locally optimal motion plans for tasks involving nonlinear dynamics under noisy observations. The proposed planner generates hierarchical motion plans at two levels: first, a high-level motion plan that sequences the local dynamics models to be visited and second, based on the best high-level plan, a detailed continuous state motion plan to be followed by the robot. The hierarchical planning approach breaks the large POMDP problem into multiple smaller segments with shorter planning horizons, which significantly increases the computational efficiency of the planner. High-level planning also enables the robot to leverage task dynamics to improve its performance—for example, reducing uncertainty using the task motion constraints in order to develop motion plans which are more robust to state uncertainty. In the present work, a hybrid model of the task dynamics needs to be provided to the planner by an expert. Hence, a natural extension of this work is to autonomously learn the hybrid dynamics model of the task. For example, Niekum et al. have proposed methods [28, 29] to learn the articulation motion models encountered while manipulating an object. In the future, the proposed POMDP planner may be combined with these methods to develop an end-to-end approach for learning hybrid dynamics models for the manipulation tasks and use them to generate motions plans that are robust to state uncertainty. R EFERENCES [1] John Lygeros, Shankar Sastry, and Claire Tomlin. Hybrid systems: Foundations, advanced topics and applications. under copyright to be published by Springer Verlag, 2012. [2] Sebastian Thrun. Probabilistic robotics. Communications of the ACM, 45(3):52–57, 2002. [3] Christos H Papadimitriou and John N Tsitsiklis. The complexity of markov decision processes. Mathematics of operations research, 12(3):441–450, 1987. [4] Emma Brunskill, Leslie Kaelbling, Tomas Lozano-Perez, and Nicholas Roy. Continuous-State POMDPs with Hybrid Dynamics. Symposium on Artificial Intelligence and Mathematics, pages 13–18, 2008. [5] Hanna Kurniawati, David Hsu, and Wee Sun Lee. Sarsop: Efficient point-based pomdp planning by approximating optimally reachable belief spaces. In Robotics: Science and Systems, volume 2008. Zurich, Switzerland, 2008. [6] Guy Shani, Joelle Pineau, and Robert Kaplow. A survey of point-based pomdp solvers. Autonomous Agents and Multi-Agent Systems, 27(1):1–51, 2013. [7] Ali-Akbar Agha-Mohammadi, Suman Chakravorty, and Nancy M Amato. Firm: Sampling-based feedback motion-planning under motion uncertainty and imperfect measurements. The International Journal of Robotics Research, 33(2):268–304, 2014. [8] Geoffrey A Hollinger and Gaurav S Sukhatme. Sampling-based robotic information gathering algorithms. The International Journal of Robotics Research, 33(9):1271–1287, 2014. [9] Koushil Sreenath, Connie R Hill Jr, and Vijay Kumar. A partially observable hybrid system model for bipedal locomotion for adapting to terrain variations. In Proceedings of the 16th international conference on Hybrid systems: computation and control, pages 137–142. ACM, 2013. [10] Jur Van Den Berg, Sachin Patil, and Ron Alterovitz. Motion planning under uncertainty using iterative local optimization in belief space. The International Journal of Robotics Research, 31(11):1263–1278, 2012. [11] Vadim Indelman, Luca Carlone, and Frank Dellaert. Planning in the continuous domain: A generalized belief space approach for autonomous navigation in unknown environments. The International Journal of Robotics Research, 34(7):849–882, 2015. [12] Anirudha Majumdar and Russ Tedrake. Funnel libraries for real-time robust feedback motion planning. The International Journal of Robotics Research, 36(8):947– 982, 2017. [13] Berk Calli, Arjun Singh, James Bruce, Aaron Walsman, Kurt Konolige, Siddhartha Srinivasa, Pieter Abbeel, and Aaron M Dollar. Yale-cmu-berkeley dataset for robotic manipulation research. The International Journal of Robotics Research, 36(3):261–268, 2017. [14] David Silver and Joel Veness. Monte-carlo planning in large pomdps. In Advances in neural information processing systems, pages 2164–2172, 2010. [15] Hanna Kurniawati and Vinay Yadav. An online pomdp solver for uncertainty planning in dynamic environment. In Robotics Research, pages 611–629. Springer, 2016. [16] Mohamed Elbanhawi and Milan Simic. Sampling-based robot motion planning: A review. IEEE Access, 2:56–77, 2014. [17] Ali-akbar Agha-mohammadi, N Kemal Ure, Jonathan P How, and John Vian. Health aware stochastic planning for persistent package delivery missions using quadrotors. In Intelligent Robots and Systems (IROS 2014), 2014 IEEE/RSJ International Conference on, pages 3389–3396. IEEE, 2014. [18] Mehmet R Dogar and Siddhartha S Srinivasa. A planning framework for non-prehensile manipulation under clutter and uncertainty. Autonomous Robots, 33(3):217–236, 2012. [19] Oliver Kroemer, Christian Daniel, Gerhard Neumann, [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] Herke Van Hoof, and Jan Peters. Towards learning hierarchical skills for multi-phase manipulation tasks. In Robotics and Automation (ICRA), 2015 IEEE International Conference on, pages 1503–1510. IEEE, 2015. Sergey Levine, Nolan Wagener, and Pieter Abbeel. Learning contact-rich manipulation skills with guided policy search. In 2015 IEEE international conference on robotics and automation (ICRA), pages 156–163. IEEE, 2015. Justin Fu, Sergey Levine, and Pieter Abbeel. One-shot learning of manipulation skills with online dynamics adaptation and neural network priors. In Intelligent Robots and Systems (IROS), 2016 IEEE/RSJ International Conference on, pages 4019–4026. IEEE, 2016. Zoubin Ghahramani and Geoffrey E Hinton. Variational learning for switching state-space models. Neural computation, 12(4):831–864, 2000. R Platt Jr, Russ Tedrake, Leslie Kaelbling, and Tomas Lozano-Perez. Belief space planning assuming maximum likelihood observations. Robotics: Science and Systems, 2010. ISSN 2330765X. Philip E. Gill, Walter Murray, and Michael A. Saunders. SNOPT: An SQP algorithm for large-scale constrained optimization. SIAM Rev., 47:99–131, 2005. Philip E. Gill, Walter Murray, Michael A. Saunders, and Elizabeth Wong. User’s guide for SNOPT 7.6: Software for large-scale nonlinear programming. Center for Computational Mathematics Report CCoM 17-1, Department of Mathematics, University of California, San Diego, La Jolla, CA, 2017. Sung-Hyuk Cha. Comprehensive survey on distance/similarity measures between probability density functions. City, 1(2):1, 2007. Rainer Storn and Kenneth Price. Differential evolution– a simple and efficient heuristic for global optimization over continuous spaces. Journal of global optimization, 11(4):341–359, 1997. Scott Niekum, Sarah Osentoski, Christopher G Atkeson, and Andrew G Barto. Online bayesian changepoint detection for articulated motion models. In 2015 IEEE International Conference on Robotics and Automation (ICRA), pages 1468–1475. IEEE, 2015. Karol Hausman, Scott Niekum, Sarah Osentoski, and Gaurav Sukhatme. Active articulation model estimation through interactive perception. In IEEE International Conference on Robotics and Automation, 2015.
2cs.AI
Some results on generalized local cohomology modules arXiv:1107.5079v4 [math.AC] 11 Sep 2013 Alireza Vahidi Department of Mathematics, Payame Noor University, I. R of IRAN E-mail: [email protected] Moharram Aghapournahr Department of Mathematics, Faculty of Science, Arak University, Arak, 38156-8-8349, IRAN E-mail: [email protected] Abstract Let R be a commutative Noetherian ring with non-zero identity, a an ideal of R, M a finite R–module and X an arbitrary R–module. Here, we show that, in the Serre subcategories of the category of R–modules, how the generalized local cohomology modules, the ordinary local cohomology modules and the extension modules behave similarly at the initial points. We conclude some Artinianness and cofiniteness results for Hna (M, X), and some finiteness results for SuppR (Hna (M, X)) and AssR (Hna (M, X)). Keywords: Generalized local cohomology modules; Serre subcategories. 2010 Mathematics Subject Classification: 13D07; 13D45. 1 Introduction Let R be a commutative Noetherian ring with non-zero identity. We use symbols a, M , and X as an ideal of R, a finite (i.e. finitely generated) R–module, and an arbitrary R–module which is not necessarily finite. For basic results, notations and terminologies not given in this paper, the reader is referred to [4] and [5]. The ith generalized local cohomology module Hia (M, X) ∼ ExtiR (M/an M, X), = lim −→ n∈N which is a generalization of the ith ordinary local cohomology module Hia (X) ∼ ExtiR (R/an , X), = lim −→ n∈N was introduced by Herzog in his habilitation [12] and then continued by Suzuki [21], Bijan-Zadeh [3], Yassemi [22] and some other authors. They studied some basic duality theorems, vanishing and other properties of generalized local cohomology modules which also generalize several known facts about extension modules and ordinary local cohomology modules. In Section 2, we present the main results of this paper which determine that, for non-negative n integers m and n, when R–modules Hna (M, X), HomR (R/a, Hna (M, X)) and Extm R (M, Ha (X)) are in 1 2 A. Vahidi and M. Aghapournahr a Serre subcategory of the category of R–modules (i.e. the class of R–modules which is closed under n taking submodules, quotients and extensions), and when Hm+n (M, X) ∼ = Extm a R (M, Ha (X)) holds (Theorems 2.6, 2.10, 2.13 and 2.21). We use these theorems to show that, in the Serre subcategories of the category of R–modules, how the generalized local cohomology modules and the ordinary local cohomology modules behave similarly at the initial points (Corollaries 2.9, 2.14 and 2.15). We also find, in Corollaries 2.17 and 2.18, the relation of regular sequences with respect to Serre classes, introduced in [1, Definition 2.6], and the membership of generalized local cohomology modules, extension modules and Koszul cohomology modules in Serre subcategories. Note that, one can apply our results to the Serre subcategories of Examples 2.2 and 2.8 to deduce more properties of generalized local cohomology modules. Section 3 consists of applications. We first, in Corollaries 3.1 and 3.2, study Artinian generalized local cohomology modules and show that if dimR (R/a) = 0, then the generalized local cohomology modules Hna (M, X) are Artinian and (a+AnnR M )–cofinite (i.e. SuppR (Hna (M, X)) ⊆ V(a+AnnR M ) and ExtiR (R/a + AnnR M, Hna (M, X)) is finite for all i). Then we present the relation between length, annihilator and support of generalized local cohomology modules, and those of ordinary local cohomology modules (Corollaries 3.3, 3.4 and 3.5). We also prove that S S S SuppR (ExtiR (M/aM, X)), SuppR (Hia+AnnR M (X)) = SuppR (Hia (M, X)) = i<n i<n i<n and if Hia (M, X) = 0 for all i < n, then AssR (Hna (M, X)) = AssR (ExtnR (M/aM, X)) (Corollaries 3.6 and 3.8). This implies that if SuppR (Hia (M, X)) is finite for all i < n, then the finiteness of AssR (Hna (M, X)) is equivalent to the finiteness of AssR (ExtnR (M/aM, X)). Finally, in the study of finiteness of the set of associated prime ideals of generalized local cohomology modules, we point out the proof of [14, Theorem 2.3] contains a flaw, but we show that the statements of [14, Corollaries 2.4 trough 2.7] are true (Remark 3.7 and Corollaries 3.11 trough 3.14). Even though we can show some of our results by using spectral sequences, we are avoiding the use of this technique completely in this work and we provide more elementary proofs for the results. 2 Main Results Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative integer. We first present sufficient conditions which convince us the R–modules Hna (M, X) and HomR (R/a, Hna (M, X)) are in a Serre subcategory of the category of R–modules. Definition 2.1. Recall that a Serre subcategory S of the category of R–modules is a subclass of R–modules such that for any short exact sequence 0 −→ X 0 −→ X −→ X 00 −→ 0, the module X is in S if and only if X 0 and X 00 are in S. Example 2.2. The following classes are Serre subcategories of the category of R–modules. (a) The class of zero R–modules. (b) The class of finite length R–modules. (c) The class of finite R–modules. Some results on generalized local cohomology 3 (d) The class of Artinian R–modules. (e) The class of R–modules with finite support. (f) The class of R–modules with Krull dimension less than n, where n is a non-negative integer. (g) The class of R–modules with finite Krull dimension. (h) The class of minimax R–modules (An R–module X is said to be minimax if there is a finite submodule X 0 of X such that X/X 0 is Artinian [23]). Definition 2.3. Let λ : S −→ T be a function from a Serre subcategory of the category of R–modules S to a partially ordered Abelian monoid (T , F, ). We say that λ is a subadditive function if λ(0) = 0 and for any short exact sequence 0 −→ X 0 −→ X −→ X 00 −→ 0, in which all the terms belong to S, λ(X 0 )  λ(X), λ(X 00 )  λ(X) and λ(X)  λ(X 0 )Fλ(X 00 ). Example 2.4. The following functions are subadditive. (a) The function λ(X) = lR (X), length of X, from the class of finite length R–modules to the partially ordered Abelian monoid (Z, +, ≤). (b) The function λ(X) = (0 :R X), annihilator of X, from the category of R–modules to the partially ordered Abelian monoid (Ideals(R), ., ⊇). (c) The function λ(X) = SuppR (X), support of X, from the category of R–modules to the partially ordered Abelian monoid (P(Spec R), ∪, ⊆). In this paper, S is a Serre subcategory of the category of R–modules, (T , F, ) is a partially ordered Abelian monoid and λ : S −→ T is a subadditive function. Our method to prove the main results of the paper is based on the induction argument and we need the following useful lemmas for the base cases and inductive steps. Note that, for all i, we have the isomorphism Hia (M, X) ∼ = Hi (Γa (HomR (M, E • ))), where E • is an injective resolution of X. Lemma 2.5. Let M be a finite R–module, X be an arbitrary R–module and p be a prime ideal of R. Then the following statements hold true. (a) Γa (M, X) ∼ = HomR (M, Γa (X)). (b) Hia (M, X)p ∼ = HiaRp (Mp , Xp ) for all i. (c) If SuppR (M ) ∩ SuppR (X) ⊆ V(a), then Hia (M, X) ∼ = ExtiR (M, X) for all i. Proof. This is easy and left to the reader. Theorem 2.6. Let M be a finite R–module, X be an arbitrary R–module, and n be a non-negative r n integer such that Extn−r R (M, Ha (X)) is in S for all r, 0 6 r 6 n. Then Ha (M, X) ∈ S, and n r λ(Hna (M, X))  F λ(Extn−r R (M, Ha (X))). r=0 4 A. Vahidi and M. Aghapournahr Proof. We prove by using induction on n. The case n = 0 is clear from Lemma 2.5 (a). Suppose that n > 0 and that n − 1 is settled. Let X = X/Γa (X) and L = E(X)/X where E(X) is an injective hull of X. Since Γa (X) = 0 = Γa (E(X)), Γa (M, X) = 0 = Γa (M, E(X)) by Lemma 2.5 (a). Applying the derived functors of Γa (−) and Γa (M, −) to the short exact sequence 0 → X → E(X) → L → 0, we obtain, for all i > 0, the isomorphisms i−1 ∼ i ∼ i ∼ i Hi−1 a (L) = Ha (X) (= Ha (X)) and Ha (M, L) = Ha (M, X). From the above isomorphisms, for all r, 0 6 r 6 n − 1, we have (n−1)−r n−(r+1) ExtR (M, Hra (L)) ∼ (M, Hr+1 = ExtR a (X)) which is in S by assumptions. Thus, from the induction hypothesis on L, Hn−1 (M, L) ∈ S a n−1 (n−1)−r and λ(Hn−1 (M, L))  F λ(ExtR a Therefore Hna (M, X) ∈ S r=0 (M, Hra (L))). n n−r (M, Hra (X))). and λ(Hna (M, X))  F λ(ExtR r=1 Now, by the short exact sequence 0 → Γa (X) → X → X → 0 and Lemma 2.5 (c), we get the long exact sequence · · · −→ ExtnR (M, Γa (X)) −→ Hna (M, X) −→ Hna (M, X) −→ · · · which shows that n n−r (M, Hra (X))) Hna (M, X) ∈ S and λ(Hna (M, X))  F λ(ExtR r=0 as we desired. Definition 2.7. ([1, Definition 2.1] and [2, Definition 3.1]) Recall that, a Serre subcategory of the category of R–modules M is said to be Melkersson subcategory with respect to the ideal a if for any a– torsion R–module X, 0 :X a is in M implies that X is in M. Also, M is called Melkersson subcategory when it is Melkersson with respect to all ideals of R. Example 2.8. The following classes of modules are Melkersson subcategories by Example 2.2 and [1, Lemma 2.2]. (a) (b) (c) (d) (e) The The The The The class class class class class of of of of of zero R–modules. Artinian R–modules. R–modules with finite support. R–modules with Krull dimension less than n, where n is a non-negative integer. R–modules with finite Krull dimension. In this paper, Ma stands as a Melkersson subcategory with respect to the ideal a, Ma+AnnR M as a Melkersson subcategory with respect to the ideal a + AnnR M and M as a Melkersson subcategory. The second author and Melkersson in [1, Theorem 2.9 (i) ↔ (vi)] proved the following corollary for Melkersson subcategories, while it was a simple conclusion of Theorem 2.6 for any arbitrary Serre subcategories. This also generalizes [19, Theorem 2.2 and Corollary 2.3] for an arbitrary R–module X when we consider S as the class of minimax R–modules and the class of Artinian R–modules, respectively. Some results on generalized local cohomology 5 Corollary 2.9. Suppose that X is an arbitrary R–module and that n is a non-negative integer. Then the following statements are equivalent. (i) Hia (X) is in S for all i 6 n (for all i). (ii) Hia (M, X) is in S for any finite R–module M and for all i 6 n (for all i). Proof. (i) ⇒ (ii). Assume that i is an integer such that i 6 n. Since Hra (X) is in S for all r, 0 6 r 6 i, i−r ExtR (M, Hra (X)) is in S for all r, 0 6 r 6 i. Thus, by Theorem 2.6, Hia (M, X) is in S. Theorem 2.10. Let M be a finite R–module, X be an arbitrary R–module, and n be a non-negative integer. Then the following statements hold true. (a) If Hra (X) ∈ S for all r, 0 6 r < n, then HomR (R/a, Hna (M, X)) ∈ S whenever ExtnR (M/aM, X) ∈ S. (b) If Hra (X) = 0 for all r, 0 6 r < n, then HomR (R/a, Hna (M, X)) ∼ = ExtnR (M/aM, X). Proof. We prove by using induction on n. From HomR (R/a, Γa (M, X)) ∼ = ∼ = ∼ = ∼ = Lemma 2.5 (a), we get HomR (R/a, HomR (M, Γa (X))) HomR (R/a ⊗R M, Γa (X)) HomR (M/aM, Γa (X)) HomR (M/aM, X) because HomR (M/aM, X/Γa (X)) = 0. Thus the assertion follows in the case that n = 0. Suppose that n > 0 and that n − 1 is settled. To complete the induction argument, one can use the short exact sequence 0 → X → E(X) → L → 0 and employ the induction hypothesis with a similar method as in the proof of Theorem 2.6. Remark 2.11. Theorem 2.6, Corollary 2.9 and Theorem 2.10 can be applied to each Serre subcategory mentioned in Example 2.2 resulting in each case in a number of facts about generalized local cohomology modules. One can also use the Serre subcategories and Melkersson subcategories of Examples 2.2 and 2.8 in the results that follow to deduce more properties of generalized local cohomology modules. As an application of the above theorem, we can state the following corollary. Corollary 2.12. Let M be a finite R–module, X be an arbitrary R–module, and n be a non-negative integer such that Hia (X) ∈ Ma for all i < n. Then Hna (M, X) ∈ Ma whenever ExtnR (M/aM, X) ∈ Ma . Proof. Since Hna (M, X) is an a–torsion R–module, the assertion follows from Theorem 2.10 (a). Now, for non-negative integers m and n, we present sufficient conditions which ensure us the n R–module Extm R (M, Ha (X)) is in a Serre subcategory of the category of R–modules. Theorem 2.13. Let M be a finite R–module, X be an arbitrary R–module, and m, n be non-negative integers. Assume also that (i) Hm+n (M, X) is in S, a 6 A. Vahidi and M. Aghapournahr (ii) Extm+1+r (M, Hn−r (X)) is in S for all r, 1 ≤ r ≤ n, and a R m−1−r n+r (iii) ExtR (M, Ha (X)) is in S for all r, 1 ≤ r ≤ m − 1. n Then Extm R (M, Ha (X)) ∈ S, and n λ(Extm R (M, Ha (X)))  n m−1 r=1 r=1 m+1+r m−1−r λ(Ham+n (M, X))F( F λ(ExtR (M, Han−r (X))))F( F λ(ExtR (M, Hn+r (X)))). a Proof. We prove by induction on n. Let n = 0 and set X = X/ Γa (X). By hypothesis (iii), (m−1)−r ExtR (M, Hra (X)) is in S for all r, 0 6 r 6 m − 1. Thus, from Theorem 2.6, Hm−1 (M, X) ∈ S a m−1 (m−1)−r and λ(Hm−1 (M, X))  F λ(ExtR a r=1 (M, Hra (X))). By considering Lemma 2.5 (c) and applying the derived functors of Γa (M, −) to the short exact sequence 0 → Γa (X) → X → X → 0, we obtain the long exact sequence m · · · −→ Hm−1 (M, X) −→ Extm a R (M, Γa (X)) −→ Ha (M, X) −→ · · · which shows that, by hypothesis (i), Extm R (M, Γa (X)) ∈ S and m−1 m−1−r m (M, Hra (X)))). λ(Extm R (M, Γa (X)))  λ(Ha (M, X))F( F λ(ExtR r=1 Thus the assertion follows in this case. Now, assume that n > 0 and that n − 1 is settled. Let X = X/Γa (X) and L = E(X)/X where E(X) is an injective hull of X. By the short exact sequence 0 → X → E(X) → L → 0, the proof is sufficiently similar to that of Theorem 2.6 to be omitted. We leave the proof to the reader. The next corollary shows that, in Melkersson subcategories, the generalized local cohomology modules Hia (M, X) and the ordinary local cohomology modules Hia+AnnR M (X) behave similarly at the initial points. Corollary 2.14. Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative integer. Then the following statements are equivalent. (i) Hia+AnnR M (X) is in Ma+AnnR M for all i 6 n (for all i). (ii) Hia (M, X) is in Ma+AnnR M for all i 6 n (for all i). Proof. (i) ⇒ (ii). Since Hia (M, X) ∼ = Hia+AnnR M (M, X) for all i, the assertion holds from Corollary 2.9. (ii) ⇒ (i). We use induction on n. Let n = 0. By considering the exact sequence 0 −→ HomR (M/aM, Γa (X)) −→ HomR (M, Γa (X)), HomR (M/aM, Γa (X)) is in Ma+AnnR M from Lemma 2.5 (a). Thus, by [1, Theorem 2.9 (iv) → (i)], Γa+AnnR M (Γa (X)) is in Ma+AnnR M . Therefore Γa+AnnR M (X) is in Ma+AnnR M . Assume that n > 0 and that n − 1 is settled. By the induction hypothesis, Hia+AnnR M (X) is in Ma+AnnR M for all i 6 n − 1. Apply Theorem 2.13 with m = 0 to see that HomR (M, Hna+AnnR M (X)) Some results on generalized local cohomology 7 is in Ma+AnnR M . Thus HomR (M/aM, Hna+AnnR M (X)) is in Ma+AnnR M by the exact sequence 0 −→ HomR (M/aM, Hna+AnnR M (X)) −→ HomR (M, Hna+AnnR M (X)). Again from [1, Theorem 2.9 (iv) → (i)], we have Γa+AnnR M (Hna+AnnR M (X)) ∈ Ma+AnnR M which shows that Hna+AnnR M (X) ∈ Ma+AnnR M . Corollary 2.15. Let M be a finite R–module and X be an arbitrary R–module. Then we have (a) (b) (c) (d) inf{i : Hia (M, X) ∈ / S} ≥ inf{i : Hia (X) ∈ / S}. i inf{i : Ha (M, X) ∈ / Ma+AnnR M } = inf{i : Hia+AnnR M (X) ∈ / Ma+AnnR M }. i i inf{i : Ha (M, X) ∈ / Ma+AnnR M } = inf{i : Ha (X) ∈ / Ma+AnnR M } whenever ΓAnnR M (X) = X. i i inf{i : Ha (M, X) ∈ / Ma } = inf{i : Ha (X) ∈ / Ma } whenever AnnR M ⊆ a (e.g. M is faithful). Proof. Follows from Corollaries 2.9 and 2.14. In the next corollary, we state the membership of the generalized local cohomology modules with respect to different ideals in Melkersson subcategories of the category of R–modules. Corollary 2.16. Suppose that M is a finite R–module and X is an arbitrary R–module. Assume also that n is a non-negative integer and b is an ideal of R such that a ⊆ b. Then Hib (M, X) is in M for all i ≤ n (for all i) whenever Hia (M, X) is in M for all i ≤ n (for all i). Proof. Follows from Corollary 2.14 and [2, Proposition 3.4]. In [1, Definition 2.6 and Example 2.8], the second author and Melkersson introduced the concept of S–regular sequences on a module that recovered poor sequences, filter-regular sequences, generalized regular sequences and sequences in dimension> n, where n is a non-negative integer, on a module. They also found, in [1, Theorem 2.9 (i) ↔ (vii)], the relation of this notion on a finite module and the membership of local cohomology modules in Melkersson subcategories. In the next corollary, we state a similar characterization for generalized local cohomology modules. Coung and Hoang in [8, Theorem 3.1] proved part [(i) ↔ (iv)] of the following corollary for the class of Artinian R–modules in the case that R was a local ring. Corollary 2.17. Suppose that M is a finite R–module such that a + AnnR M = (x1 , . . . , xr ). Assume also that X is an arbitrary R–module and that n is a non-negative integer. Then the following statements are equivalent. (i) Hia (M, X) is in Ma+AnnR M for all i 6 n (for all i). (ii) ExtiR (M/aM, X) is in Ma+AnnR M for all i 6 n (for all i). (iii) Hi (x1 , . . . , xr ; X) is in Ma+AnnR M for all i 6 n (for all i). When X is finite, these conditions are also equivalent to: (iv) There is a sequence of length n + 1 in a + AnnR M that is Ma+AnnR M –regular on X. Proof. This follows from Corollary 2.14 and [1, Theorem 2.9]. 8 A. Vahidi and M. Aghapournahr Suppose that X is a finite R–module such that X/aX is not in Ma . The second author and Melkersson, in [1, Lemma 2.14], proved that every sequence in a which is Ma –regular on X can be extended to a maximal one and all maximal Ma –regular sequences on X in a have the same length. They denoted this common length by Ma –deptha (X), in [1, Definition 2.15], and proved, in [1, Theorem 2.18], that it is the least integer such that Hia (X), ExtiR (R/a, X) or Koszul cohomology modules with respect to a are not in Ma . Using the Melkersson subcategories of Example 2.8, this notion gives ordinary depth, filter-depth, generalized depth and n-depth, where n is a non-negative integer. In the following, we prove that Ma+AnnR M − deptha+AnnR M (X) is the least integer such that Hia (M, X), ExtiR (M/aM, X) or Koszul cohomology modules with respect to a + AnnR M are not in Ma+AnnR M . This generalizes the result of Bijan-Zadeh [3, Proposition 5.5] when we consider Ma+AnnR M as the class of zero R–modules. It also recovers [6, Theorem 2.2], [8, Theorem 3.1], [7, Theorem 4.1] and [16, Theorem 2.8] if we put Ma+AnnR M the class of Artinian R–modules or the class of R–modules with finite support. Note that, all of these theorems are in the local case while our corollary is in general. Corollary 2.18. Suppose that M is a finite R–module with a + AnnR M = (x1 , . . . , xr ) and X is a finite R–module with X/(a + AnnR M )X ∈ / Ma+AnnR M . Then (a) Ma+AnnR M − deptha+AnnR M (X) = inf{i : Hia (M, X) ∈ / Ma+AnnR M }. i (b) Ma+AnnR M − deptha+AnnR M (X) = inf{i : ExtR (M/aM, X) ∈ / Ma+AnnR M }. i (c) Ma+AnnR M − deptha+AnnR M (X) = inf{i : H (x1 , . . . , xr ; X) ∈ / Ma+AnnR M }. Proof. Follows from [1, Lemma 2.14] and Corollary 2.17. As applications of Theorems 2.6 and 2.13, we can state the following corollaries. Corollary 2.19. Let M be a finite R–module, X be an arbitrary R–module, and n be a non-negative i integer such that Extj−i R (M, Ha (X)) is in S for all i, j with 0 ≤ i ≤ n − 1 and j = n, n + 1. Then Hna (M, X) is in S if and only if HomR (M, Hna (X)) is in S. Corollary 2.20. Let X be an R–module and m, n be non-negative integers such that Hia (X) is in S n for all i, 0 6 i 6 n−1 or n+1 6 i 6 m+n. Then Hm+n (M, X) is in S if and only if Extm a R (M, Ha (X)) is in S. In the following theorem, for non-negative integers m and n, we find some sufficient conditions for n validity of the isomorphism Hm+n (M, X) ∼ = Extm a R (M, Ha (X)). Theorem 2.21. Let M be a finite R–module, X be an arbitrary R–module, and m, n be non-negative integers. Assume also that (i) Extm+n−r (M, Hra (X)) = 0 for all r, 0 ≤ r ≤ n − 1 or n + 1 ≤ r ≤ m + n, R (ii) Extm+1+r (M, Hn−r (X)) = 0 for all r, 1 ≤ r ≤ n, and a R m−1−r n+r (iii) ExtR (M, Ha (X)) = 0 for all r, 1 ≤ r ≤ m − 1. n Then we have Hm+n (M, X) ∼ = Extm a R (M, Ha (X)). Some results on generalized local cohomology 9 Proof. We prove by using induction on n. Let n = 0. We have Hm−1 (M, X/Γa (X)) = 0 = a m Ha (M, X/Γa (X)) from hypothesis (iii) and (i), and Theorem 2.6 with S = 0. Now, the assertion follows by the exact sequence m m Hm−1 (M, X/Γa (X)) −→ Extm a R (M, Γa (X)) −→ Ha (M, X) −→ Ha (M, X/Γa (X)) obtained from the short exact sequence 0 −→ Γa (X) −→ X −→ X/Γa (X) −→ 0 and Lemma 2.5 (c). Assume that n > 0 and that n − 1 is settled. By considering the short exact sequence 0 → X → E(X) → L → 0, the proof is similar to that of Theorem 2.6. Yassemi, in [22, Example 3.6], has given an example to show that the R–modules Hna (M, X) and HomR (M, Hna (X)) are not always equal. We show that, with some conditions, they are isomorph. Corollary 2.22. (cf. [13, Proposition 2.3 (ii)]) Let M be a finite R–module, X be an arbitrary R– i module and n be a non-negative integer such that Extj−i R (M, Ha (X)) = 0 for all i, j with 0 6 i 6 n − 1 and j = n, n + 1. Then we have Hna (M, X) ∼ = HomR (M, Hna (X)). Proof. Apply Theorem 2.21 with m = 0. In consistence with Corollary 2.20, one can state the following corollary which shows that if X is a finite module and a is an ideal generated by an X-regular sequence of length n, then the generalized local cohomology modules are exactly extension modules of ordinary local cohomology modules. Corollary 2.23. Suppose that M is a finite R–module, X is an arbitrary R–module, and n, m are nonnegative integers such that n ≤ m. Assume also that Hia (X) = 0 for all i, i 6= n (resp. 0 ≤ i ≤ n − 1 or i n ∼ n + 1 ≤ i ≤ m). Then we have Hi+n a (M, X) = ExtR (M, Ha (X)) for all i, i ≥ 0 (resp. 0 ≤ i ≤ m − n). Proof. For all i, i ≥ 0 (resp. 0 ≤ i ≤ m − n), apply Theorem 2.21 with m = i. 3 Applications Recall that, an R–module X is said to be a–cofinite if SuppR (X) ⊆ V (a) and ExtiR (R/a, X) is finite for all i. Note that, by [18, Proposition 4.1], the class of Artinian a–cofinite modules is a Melkersson subcategory with respect to the ideal a. Corollary 3.1. Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative integer. Then the following statements are equivalent. (i) Hia (M, X) is Artinian and (a + AnnR M )–cofinite for all i 6 n (for all i). (ii) ExtiR (M/aM, X) has finite length for all i 6 n (for all i). Proof. (i) ⇒ (ii). From Corollary 2.14, Hia+AnnR M (X) is Artinian and (a + AnnR M )–cofinite for all i 6 n. Thus ExtiR (R/a + AnnR M , X) has finite length for all i 6 n by [2, Corollary 4.12]. Therefore, from [13, Proposition 3.4], ExtiR (M/aM, X) has finite length for all i 6 n. 10 A. Vahidi and M. Aghapournahr (ii) ⇒ (i). Since every finite length (a + AnnR M )–torsion module is Artinian and (a + AnnR M )– cofinite, the assertion follows from Corollary 2.17. Chu and Tang in [6, Proposition 2.4] proved the part [(i) ↔ (ii)] of the following corollary in the local case (see also [8, Corrollary 3.2], [9, Corollary 3.3] and [11, Theorem 2.2]). Corollary 3.2. Suppose that M, X are finite R–modules and that n is a non-negative integer. Then the following statements are equivalent. (i) dimR (Hia (M, X)) ≤ 0 for all i 6 n (for all i). (ii) Hia (M, X) is Artinian for all i 6 n (for all i). (iii) Hia (M, X) is Artinian and (a + AnnR M )–cofinite for all i 6 n (for all i). In particular, if dimR (R/a) = 0, then Hia (M, X) is Artinian and (a + AnnR M )–cofinite for all i. Proof. (i) ⇒ (iii). Since every finite module with zero dimension is of finite length, the assertion follows from Corollary 2.17 [(i) → (ii)] (where Ma+AnnR M is taken the class of R–modules with Krull dimension less than 1) and Corollary 3.1 [(ii) → (i)]. In [20, Theorem 3.2] and for a non-negative integer n, Schenzel proved that • ExtnR (M, X) is of finite length, and n X i • lR (ExtnR (M, X)) ≤ lR (Extn−i R (M, Hm (X))) i=0 when (R, m) is a local ring and M, X are finite R–modules such that M ⊗R X is of finite length. As an application of Theorem 2.6, by considering Lemma 2.5 (c) and [20, Lemma 3.1], the following corollary extends [20, Theorem 3.2]. Corollary 3.3. Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative i integer such that Extn−i R (M, Ha (X)) is of finite length for all i 6 n. Then (a) Hna (M, X) is of finite length, and n X i n (b) lR (Ha (M, X)) ≤ lR (Extn−i R (M, Ha (X))). i=0 Proof. Since the class of finite length R–modules is a Serre subcategory of the category of R–modules and λ(X) = lR (X) is a subadditive function from the class of finite length R–modules to the partially ordered Abelian monoid (Z, +, ≤), the assertion follows form Theorem 2.6. As another application of Theorem 2.6, we find the relation between annihilator of generalized local cohomology modules and annihilator of ordinary local cohomology modules. Corollary 3.4. Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative integer. Then we have n Y i n (a) (0 :R Extn−i R (M, Ha (X))) ⊆ (0 :R Ha (M, X)). i=0 Some results on generalized local cohomology (b) n Y (0 i=0 :R Hia (X)) ⊆ n \ 11 (0 :R Hia (M, X)). i=0 Proof. (a) Since λ(X) = (0 :R X) is a subadditive function from the category of R–modules to the partially ordered Abelian monoid (Ideals(R), ., ⊇), the assertion follows form Theorem 2.6. i (b) For all i 6 j 6 n, we have (0 :R Hia (X)) ⊆ (0 :R Extj−i R (M, Ha (X))). Thus the assertion follows from part (a). In the course of the remaining parts of the paper for an ideal a of R and for an arbitrary R–module X, by cdR (a, X) (cohomological dimension of X with respect to a), we mean the largest integer i in which Hia (X) is non-zero. The next result presents the relation between support of generalized local cohomology modules and support of ordinary local cohomology modules. Corollary 3.5. Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative integer. Then we have [ n−i (M, Hia (X))). SuppR (ExtR (a) SuppR (Hna (M, X)) ⊆ (b) i≤n [ [ SuppR (Hia (M, X)) ⊆ i≤n SuppR (Hia (X)). i≤n In particular, SuppR (Hna (M, X)) ⊆ [ SuppR (Hia (X)). i≤cdR (a,X) Proof. (a) Since λ(X) = SuppR (X) is a subadditive function from the category of R–modules to the partially ordered Abelian monoid (P(Spec R), ∪, ⊆), the assertion follows form Theorem 2.6. (b) Follows from the first part. The vanishing of generalized local cohomology modules from upper bounds needs special conditions and in all of them M must have finite projective dimension (see [22, Theorems 2.5 and 3.7], [7, Theorem 3.1] and [13, Proposition 2.8]). However, in the following corollary, we show that there is a union of finitely many supports of generalized local cohomology modules such that the other supports can be viewed as its subset even if M has infinite projective dimension. Parts (a) and (b) of the following corollary in the local case has been proven in [7, Lemma 2.8 and Corollary 2.9] by Coung and Hoang when X is a finite R–module but we prove it without assuming that X is finite and with no restrictions on R. Corollary 3.6. Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative integer. Then the following statements hold true. [ [ (a) SuppR (Hia (M, X)) = SuppR (Hia+AnnR M (X)). (b) (c) (d) i≤n [ i≤n [ i≤n [ SuppR (Hia (M, X)) = i≤n [ SuppR (ExtiR (M/aM, X)). i≤n SuppR (Hia (M, X)) is a closed set when X is a finite R–module. SuppR (Hia (M, X)) is a closed set when X is a finite R–module. i 12 A. Vahidi and M. Aghapournahr [ In particular, SuppR (Hna (M, X)) ⊆ SuppR (Hia (M, X)). i≤cdR (a+AnnR M,X) Proof. (a) By Lemma 2.5 (b) and Corollary 2.14, we have S p∈ / SuppR (Hia (M, X)) ⇔ ∀i ≤ n; Hia (M, X)p = 0 i≤n ⇔ ∀i ≤ n; HiaRp (Mp , Xp ) = 0 ⇔ ∀i ≤ n; HiaRp +AnnRp Mp (Xp ) = 0 ⇔ ∀i ≤ n; Hi (X)p = 0 S a+AnnR M i ⇔ p∈ / SuppR (Ha+AnnR M (X)) i≤n as we desired. (b) From Lemma 2.5 (b) and Corollary 2.17 [(i) ↔ (ii)], we get S p∈ / SuppR (Hia (M, X)) ⇔ ∀i ≤ n; Hia (M, X)p = 0 i≤n ⇔ ∀i ≤ n; HiaRp (Mp , Xp ) = 0 ⇔ ∀i ≤ n; ExtiRp (Mp /(aRp )Mp , Xp ) = 0 ⇔ ∀i ≤ n; ExtiR (M/aM, X)p = 0 S SuppR (ExtiR (M/aM, X)) ⇔ p∈ / i≤n as desired. (c) This is clear from the second part. (d) By the first part, we have [ SuppR (Hia (M, X)) = i [ SuppR (Hia (M, X)). i≤cdR (a+AnnR M,X) Thus the assertion follows from part (c). Remark 3.7. Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative integer. In [14, Theorem 2.3], Mafi proved S n−i (M, Hia (X))) AssR (Hna (M, X)) ⊆ ni=0 AssR (ExtR and, in [14, Corollaries 2.4 through 2.7], used it to deduce some results about finiteness of the set of associated prime ideals of generalized local cohomology modules. Although Corollaries 2.4 through 2.7 in i,t−i [14] are true, the proof of [14, Theorem 2.3] holds a flaw. In its proof, even though (E∞ =) ker di,t−i t+2 i,t−i is a subquotient of ker di,t−i (⊆ E ), 2 2 i,t−i i,t−i (E∞ =) ker di,t−i (⊆ E2i,t−i ) t+2 ⊆ ker d2 is not necessarily true and so dose not assert that i,t−i AssR (E∞ ) ⊆ AssR (E2i,t−i ). In the followings, we state some results about finiteness of the set of associated prime ideals of generalized local cohomology modules which, among other things, establish the statements of [14, Corollaries 2.4 through 2.7]. Coung and Hoang in [8, Theorem 2.4] proved the following corollary when X is a finite module. Corollary 3.8. Let M be a finite R–module, X be an arbitrary R–module and n be a non-negative integer such that Hia (M, X) = 0 for all i < n. Then we have AssR (Hna (M, X)) = AssR (ExtnR (M/aM, X)). Some results on generalized local cohomology 13 Proof. Since, by Corollary 2.14, Hia+AnnR M (X) = 0 for all i < n, HomR (R/a + AnnR M, Hna (M, X)) ∼ = ExtnR (M/(a + AnnR M )M, X) from Theorem 2.10 (b). Thus we have AssR (Hna (M, X)) = AssR (Hna+AnnR M (M, X)) T = V (a + AnnR M ) AssR (Hna+AnnR M (M, X)) = AssR (HomR (R/a + AnnR M, Hna (M, X))) = AssR (ExtnR (M/(a + AnnR M )M, X)) = AssR (ExtnR (M/aM, X)), as desired. In [7, Theorem 4.5], part (a) of the following corollary has been proven when X is a finite module and R is a local ring. Corollary 3.9. Suppose that M is a finite R–module, X is an arbitrary R–module and n is a nonnegative integer. Assume also that [ [ Pn = SuppR (Hia (M, X)) (= SuppR (ExtiR (M/aM, X))). i<n i<n Then the following statements hold true. (a) (b) (c) (d) AssR (Hna (M, X)) ∪ Pn = AssR (ExtnR (M/aM, X)) ∪ Pn . AssR (Hna (M, X)) ⊆ AssR (ExtnR (M/aM, X)) ∪ Pn . AssR (ExtnR (M/aM, X)) ⊆ AssR (Hna (M, X)) ∪ Pn . If Hia (M, X) has finite support for all i < n, then AssR (Hna (M, X)) is a finite set if and only if AssR (ExtnR (M/aM, X)) is a finite set. Proof. (a) If p ∈ / S SuppR (Hia (M, X)), then i<n AssRp (HnaRp (Mp , Xp )) = AssRp (ExtnRp (Mp /(aRp )Mp , Xp )) from Lemma 2.5 (b) and Corollary 3.8. Thus, p is not in the left side if and only if it is not in the right side. Recall that, an R–module X is said to be weakly Laskerian if the set of associated prime ideals of any quotient module of X is finite ([10, Definition 2.1]). The category of weakly Laskerian R–modules is a Serre subcategory of the category of R–modules ([10, Lemma 2.3 (i)]) and is denoted by Cw.l (R). Corollary 3.10. (cf. [15, Lemma 3.1]) Let M be a finite R–module, X be an arbitrary R–module, i and n be a non-negative integer such that Extn−i R (M, Ha (X)) is weakly Laskerian for all i 6 n. Then (a) Hna (M, X) is weakly Laskerian. (b) AssR (Hna (M, X)) is finite. Proof. (a) Apply Theorem 2.6 with S = Cw.l (R). (b) This is clear from part (a). In the following corollary, we generalize [14, Corollary 2.4] and [15, Theorem 3.3]. Note that, for a finite R–modules M and a non-negative integer n, X ∈ S implies that ExtnR (M/aM, X) ∈ S and, by [13, Proposition 3.4], we have ExtnR (M/aM, X) ∈ S when ExtiR (R/a, X) ∈ S for all i ≤ n. 14 A. Vahidi and M. Aghapournahr Corollary 3.11. (cf. [14, Corollary 2.4] and [15, Theorem 3.3]) Let M be a finite R–module, X be an arbitrary R–module, and n be a non-negative integer such that ExtnR (M/aM, X) and Hia (X), for all i < n, are weakly Laskerian. Then (a) HomR (R/a, Hna (M, X)) is weakly Laskerian. (b) AssR (Hna (M, X)) is finite. Proof. (a) Apply Theorem 2.10 (a) with S = Cw.l (R). T (b) Since AssR (HomR (R/a, Hna (M, X))) = V (a) AssR (Hna (M, X)) = AssR (Hna (M, X)), the assertion follows from part (a). Corollary 3.12. (cf. [14, Corollary 2.5]) Suppose that R is a local ring with maximal ideal m and dim R ≤ 2. Assume also that M is a finite R–module and X is an arbitrary R–module such that Γa (X) is weakly Laskerian. Then AssR (Hia (M, X)) is finite for all i. Proof. This follows from Corollary 3.10 and [17, Corollaries 2.4 and 2.5]. Corollary 3.13. (cf. [14, Corollary 2.6]) Suppose that R is a local ring with maximal ideal m and dim R = n. Assume also that M is a finite R–module and X is an arbitrary R–module such that Hja (X) = 0 for all j 6= n − 1, n. Then AssR (Hia (M, X)) is finite for all i. Proof. Follows from Corollary 3.10 and [17, Corollaries 2.4 and 2.5]. Corollary 3.14. (cf. [14, Corollary 2.7]) Suppose that R is a local ring with maximal ideal m and dimR R/a = 1. Assume also that M is a finite R–module and X is an arbitrary R–module. Then AssR (Hia (M, X)) is finite for all i. Proof. It follows from Corollary 3.10 or Corollary 3.11. References [1] Aghapournahr, M., Melkersson, L. (2008). Local cohomology and Serre subcategories. J. Algebra 320:1275–1287. [2] Aghapournahr, M., Taherizadeh, A. J., Vahidi, A. (2011). Extension functors of local cohomology modules. Bull. Iran. Math. Soc. 37:117–134. [3] Bijan-Zadeh, M. H. (1980). A commen generalization of local cohomology theories. Glasgow Math. J. 21:173–181. [4] Brodmann, M. P., Sharp, R. Y. (1998). Local cohomology: an algebraic introduction with geometric applications. Cambridge, Cambridge University Press. [5] Bruns, W., Herzog, J. (1998). Cohen-Macaulay rings. Cambridge, Cambridge University Press. [6] Chu, L., Tang, Z. (2007). On the artinianness of generalized local cohomology. Commun. Algebra 35:3821–3827. Some results on generalized local cohomology 15 [7] Coung, N. T., Hoang, N. V. (2001). On the vanishing and the finiteness of supports of generalized local cohomology modules. Manuscripta Math. 104:519–525. [8] Coung, N. T., Hoang, N. V. (2005). Some finite properties of generalized local cohomology modules. East-West J. Math. 2:107–115. [9] Dibaei, M. T., Vahidi, A. (2011). Artinian and non-Artinian local cohomology modules. Can. Math. Bull. 54:619–629. [10] Divaani-Aazar, K., Mafi, A. (2005). Associated primes of local cohomology modules. P. Am. Math. Soc. 133:655–660. [11] Divaani-Aazar, K., Sazeedeh, R., Tousi, M. (2005). On vanishing of generalized local cohomology modules. Algebr. Colloq. 2:213–218. [12] Herzog, J. (1970). Komplexe, auflösungen und dualität in der lokalen algebra. Invent. Math. 9:145–164. [13] Hasanzadeh, S. H., Vahidi, A. (2009). On vanishing and cofinitness of generalized local cohomology modules. Commun. Algebra 37:2290–2299. [14] Mafi, A. (2006). On the associated primes of generalized local cohomology modules. Commun. Algebra 34:2489–2494. [15] Mafi, A. (2009). A generalization of the finiteness problem in local cohomology modules. P. Indian A. S. (Math. Sci.) 119:159–164. [16] Mafi, A. (2009). On the finiteness results of the generalized local cohomology modules. Algebr. Colloq. 16:325–332. [17] Marley, T. (2001). The associoated primes of local cohomology modules of small dimension. Manuscripta Math. 104:519–525. [18] Melkersson, L. (2005). Modules cofinite with respect to an ideal. J. Algebra 285:649–668. [19] Saremi, H. (2009). On minimax and generalized local cohomology modules. Acta. Math. Vietnamica 34:269–273. [20] Schenzel, P. (1998). On the use of local cohomology in algebra and geometry. Prog. Math. 166:241– 292. [21] Suzuki, N. (1978). On the generalized local cohomology and its duality. J. Math. Kyoto U. 18:71– 85. [22] Yassemi, S. (1994). Generalized section functors. J. Pure Appl. Algebra 95:103–119. [23] Zöschinger, H. (1986). Minimax moduln. J. Algebra 102:1–32.
0math.AC
arXiv:1410.3735v1 [cs.PL] 14 Oct 2014 The Foundational Cryptography Framework Adam Petcher Greg Morrisett Harvard University and MIT Lincoln Laboratory [email protected] Harvard University [email protected] Abstract We present the Foundational Cryptography Framework (FCF) for developing and checking complete proofs of security for cryptographic schemes within a proof assistant. This is a general-purpose framework that is capable of modeling and reasoning about a wide range of cryptographic schemes, security definitions, and assumptions. Security is proven in the computational model, and the proof provides concrete bounds as well as asymptotic conclusions. FCF provides a language for probabilistic programs, a theory that is used to reason about programs, and a library of tactics and definitions that are useful in proofs about cryptography. The framework is designed to leverage fully the existing theory and capabilities of the Coq proof assistant in order to reduce the effort required to develop proofs. Categories and Subject Descriptors F.3.1 [LOGICS AND MEANINGS OF PROGRAMS]: Specifying and Verifying and Reasoning about Programs; D.3.1 [PROGRAMMING LANGUAGES]: Formal Definitions and Theory Keywords Coq Cryptography, Proof Assistant, Mechanized Proof, 1. Introduction Cryptographic algorithms and protocols are becoming more numerous, specialized, and complicated. As a result, it is likely that security vulnerabilities will slip by peer review. To address this problem, some cryptographers [6, 16] have proposed an increased level of rigor and formality for cryptographic proofs. It is our hope that eventually, cryptographers will be able to describe cryptographic schemes and security proofs using a formal language, and the proofs can be checked automatically by a highly trustworthy mechanized proof checker. To enable such mechanically-verified proofs, we have developed The Foundational Cryptography Framework (FCF). This framework embeds into the Coq proof assistant [18] a simple probabilistic programming language to allow the specification of cryptographic schemes, security definitions, and assumptions. The framework also includes useful theory, tactics, and definitions that assist with the construction of proofs of security. Once complete, the proof can be checked by the Coq proof checker. Facts proven in FCF include the security of El Gamal encryption [14], and of the encryption scheme described in Section 4 of this paper. We have also proven the security of the “tuple-set” construction of [10], which is a significant portion of a practical searchable symmetric encryption scheme. This is a complex and sophisticated construction, and the proof requires over 7000 lines of Coq code and includes a core argument involving more than 30 intermediate games. FCF is heavily influenced by CertiCrypt [4], which was later followed by EasyCrypt [5]. CertiCrypt is a framework that is built on Coq, and allows the development of mechanized proofs of security in the computational model for arbitrary cryptographic constructions. Unfortunately, proof development in CertiCrypt is time-consuming, and the developer must spend a disproportionate amount of time on simple, uninteresting goals. To address these limitations, the group behind CertiCrypt developed EasyCrypt, which has a similar semantics and logic, and uses the Why3 framework and SMT solvers to improve proof automation. EasyCrypt takes a huge step forward in terms of usability and automation, but it sacrifices some trustworthiness due to that fact that the trusted computing base is larger and the basis of the mechanization is a set of axiomatic rules. Following the release of EasyCrypt, a team of cryptographers and programming language experts (including one of the authors of this paper) attempted [17] to prove the security of a private information retrieval system [13]. This effort did not produce a complete proof because certain required facts could not be proven in EasyCrypt. Specifically, it was impossible to prove particular equivalences involving loop fusion and order permutation within a loop. In order to allow these equivalences in EasyCrypt, it would be necessary to prove them correct on paper and then modify the EasyCrypt code to include appropriate rules. EasyCrypt has seen significant improvements since its release, and it is possible that these sorts of equivalence are now supported, but a developer may encounter some other goal that EasyCrypt does not support. FCF is a foundational framework like CertiCrypt, in which the rules used to prove equivalence of programs (or any fact) are mechanized proofs derived from the semantics or other core definitions. In such a framework, the problem of the previous paragraph can be addressed by proving the appropriate theorem within the framework, and then by using that theorem to obatain the desired equivalence. An important difference between CertiCrypt and FCF is that CertiCrypt uses a deep embedding of a probabilistic programming language whereas FCF uses a shallow embedding (similar to [20]). The shallow embedding allows us to easily extend the language, and to make better use of Coq’s tactic language and existing automated tactics to reduce the effort required to develop proofs. The result is a framework that is foundational and easily extensible, but in which proof development effort is greatly reduced. 2. Design Goals Based on our experience working with EasyCrypt, we formulated a set of idealized design goals that a practical mechanized cryptography framework should satisfy. We believe that FCF achieves many of these goals, though there is still some room for improvement, as discussed in Section 5. Familiarity Security definitions and descriptions of cryptographic schemes should look similar to how they would appear in cryptography literature, and a cryptographer with no knowledge of programming language theory or proof assistants should be able to understand them. Furthermore, a cryptographer should be able to inspect and understand the foundations of the framework itself. Proof Automation The system should use automation to reduce the effort required to develop a proof. Ideally, this automation is extensible, so that the developer can produce tactics for solving new kinds of goals. Trustworthiness Proofs should be checked by a trustworthy procedure, and the core definitions (e.g., programming language semantics) that must be trusted in order to trust a proof should be relatively simple and easy to understand. Extensibility It should be possible to directly incorporate any existing theory that has been developed for the proof assistant. For example, it should be possible to directly incorporate an existing theory of lattices in order to support cryptography that is based on lattices and their related assumptions. Concrete Security The security proof should provide concrete bounds on the probability that an adversary is able to defeat the scheme. Concrete bounds provide more information than asymptotic statements, and they inform the selection of values for system parameters in order to achieve the desired level of security in practice. Abstraction The system should support abstraction over types, procedures, proofs, and modules containing any of these items. Abstraction over procedures and primitive types is necessary for writing security definitions, and for reasoning about adversaries in a natural way. The inclusion of abstraction over proofs and structures adds a powerful mechanism for developing sophisticated abstract arguments that can be reused in future proofs. Code Generation The system should be able to generate code containing the procedures of the cryptographic scheme that was proven secure. This code can then be used for basic testing, prototyping, or as an executable model to which future implementations will be compared during testing. the semantics of the language, and using them to complete a proof does not reduce the trustworthiness of the proof. By combining all of the components described above, a developer can produce a proof relating the probability that some adversary defeats the scheme to the probability that some other adversary is able to solve a problem that is assumed to be hard. This is a result in the concrete setting, in which probability values are given as expressions, and certain problems are assumed to be hard for particular constructed adversaries. In such a result, it may be necessary to inspect an expression describing a probability value to ensure it is sufficiently “small,” or to inspect a procedure to ensure it is in the correct complexity class. FCF provides additional facilities to obtain more traditional asymptotic results, in which these procedures and expressions do not require inspection. A set of asymptotic definitions (Section 3.6) allows conclusions like “this probability is negligible” or “this procedure executes a polynomial number of queries.” In order to apply an assumption about a hard problem, it may be necessary to prove that some procedure is efficient in some sense. So FCF provides an extensible notion of efficiency (Section 3.7) and a characterization of non-uniform polynomial time Turing machines.1 3.1 Probabilistic Programs We describe probabilistic programs using Gallina, the purely functional programming language of Coq, extended with a computational monad in the spirit of Ramsey and Pfeffer [21], that supports drawing random bit vectors from an input tape. Listing 1 contains an example of a valid FCF program that implements a one-time pad using bit vectors. This program accepts a bit vector argument x, samples a random bit vector of length c (where c is a constant declared outside of this function) and assigns the result to variable p, then returns p ⊕ x. Definition OTP (x : Bvector c) : Comp (Bvector c) := p <-$ {0, 1}ˆc; ret (p xor x) 3. Framework Components In a typical cryptographic proof, we specify cryptographic schemes, security definitions, and (assumed) hard problems, and then we prove a reduction from a properly-instantiated security definition to one or more problems that are assumed to be hard. In other words, we assume the existence of an effective adversary against the scheme in question, and then prove that we can construct a procedure that can effectively solve a problem that is assumed to be hard. This reduction results in a contradiction that allows us to conclude that an effective adversary against the scheme cannot exist. The cryptographic schemes, security definitions, and hard problems are probabilistic, and FCF provides a common probabilistic programming language (Section 3.1) for describing all three. Then we provide a denotational semantics (Section 3.1) that allows reasoning about the probability distributions that correspond to programs in this language. This semantics assigns a numeric value to an event in a probability distribution, and it also allows us to conclude that two distributions are equivalent and we can replace one with the other (which supports the game-hopping style of [6]). It can be cumbersome to work directly in the semantics, so we provide an equational theory (Section 3.2) of distributions that can be used to prove that distributions are related by equality, inequality or “closeness.” A program logic (Section 3.3) is also provided to ease the development of proofs involving state or looping behavior. To reduce the effort required to develop a proof, the framework provides a library of tactics (Section 3.4) and a library of common program elements with associated theory (Section 3.5). The equational theory, program logic, tactics, and programming library greatly simplify proof development, yet they are all derived from Listing 1. An Example of a Probabilistic Program The syntax of the language is defined by an inductive type called Comp and is shown in Listing 2. At a high-level, Comp is an embedded domain-specific language that inherits the host language Gallina, and extends it with operations for generating and working with random bits. Inductive Comp : Set -> Type := | Ret : forall {A : Set}{H: EqDec A}, A -> Comp A | Bind : forall {A B : Set}, Comp B -> (B -> Comp A) -> Comp A | Rnd : forall n, Comp (Bvector n) | Repeat : forall {A : Set}, Comp A -> (A -> bool) -> Comp A. Listing 2. Probabilistic Computation Syntax The most notable primitive operation is Rnd, which produces n uniformly random bits. The Repeat operation repeats a computation until some decidable predicate holds on the value returned. This operation allows a restricted form of non-termination that is sometimes useful (e.g., for sampling natural numbers in a specified range). The operations Bind and Ret are the standard monadic constructors, and allow the construction of sequences of computations, and computations from arbitrary Gallina terms and functions, respectively. However, note that the Ret constructor requires 1 The current release of the FCF code for version 8.4 of Coq is included as auxiliary material. a proof of decidable equality for the underlying return type, which is necessary to provide a computational semantics as seen later in this section. In the remainder of this paper, we will use a more natural notation for these constructors: {0, 1}n is equivalent to (Rnd $ n), x ← c; f is the same as (Bind c (fun x ⇒ f), and e). The framework includes an ASCII form of ret e is (Ret this notation as seen in Listing 1. In the case of Ret, the notation serves to hide the proof of decidable equality, which is irrelevant to the programmer and is usually constructed automatically by proof search. FCF uses a shallow embedding, in which functions in the object language are realized using functions in the metalanguage. In contrast, CertiCrypt uses a deep embedding, in which the data type describing the object language includes constructs for specifying and calling functions, as well as all of the primitives such as bitvectors and xor. We have found that there are key benefits to shallow embedding. The primary benefit is that we immediately gain all of the capability of the metalanguage, including (in the case of Coq) dependent types, higher-order functions, modules, etc. Another benefit is that it is very simple to include any necessary theory in a security proof, and all of the theory that has been developed in the proof assistant can be directly utilized. One benefit that is specific to Coq (and other proof assistants with this property) is that Gallina functions are necessarily terminating, and Coq provides some fairly complex mechanisms for proving that a function terminates. By combining this restriction on functions with additional restrictions on Repeat, we can ensure that a computation (eventually) terminates, and that this computation corresponds with a distribution in which the total probability mass is 1. On the other hand, the shallow embedding approach does have some drawbacks. The main drawback is that a Gallina function is opaque; we can only reason about a Gallina function based on its input/output behavior. The most significant effect of this limitation is that we cannot directly reason about the computational complexity of a Gallina function. We address this issue in Section 3.7. that any n-bit value is equal to a randomly chosen n-bit value. The probability that Repeat c P produces x is the conditional probability of x given P in c—which is equivalent to the function shown in Figure 1. It is important to note that this language is purely functional, but the monadic style gives programs an imperative appearance. This appearance supports the Familiarity design goal since cryptographic definitions and games are typically written in an imperative style. It is sometimes necessary to include some state in a cryptographic definition or proof. This can be easily accomplished by layering a state monad on top of Comp. However, this simple approach does not allow the development of definitions in which an adversary has access to an oracle that must maintain some hidden state across multiple interactions with the adversary. The definition could not simply pass the state to the adversary, because then the adversary could inspect or modify it. So FCF provides an extension to Comp for probabilistic procedures with access to a stateful oracle. The syntax of this extended language (Listing 3) is defined in another inductive type called OracleComp, where OracleComp A B C is a procedure that returns a value of type C, and has access to an oracle that takes a value of type A and returns a value of type B. Inductive OracleComp : Set -> Set -> Set -> Type := | OC_Query : forall (A B : Set), A -> OracleComp A B B | OC_Run : forall (A B C A’ B’ S : Set), EqDec S -> EqDec B -> EqDec A -> OracleComp A B C -> S -> (S -> A -> OracleComp A’ B’ (B * S)) -> OracleComp A’ B’ (C * S) | OC_Ret : forall A B C, Comp C -> OracleComp A B C | OC_Bind : forall A B C C’, OracleComp A B C -> (C -> OracleComp A B C’) -> OracleComp A B C’. Listing 3. Computation with Oracle Access Syntax Jret aK = 1{a} $ Jx ← c; f xK = λx. X (Jf bK x) ∗ (JcK b) b∈supp(JcK) J{0, 1}n K = λx. 2−n JRepeat c P K = λx.(1P x) ∗ (JcK x) ∗ X b∈P (JcK b) !−1 Figure 1. Semantics of Probabilistic Computations The denotational semantics of a probabilistic computation is shown in Figure 1. The denotation of a term of type Comp A is a function in A → Q which should be interpreted as the probability mass function of a distribution on A. In Figure 1, 1S is the indicator function for set S. So the denotation of ret a is a function that returns 1 when the argument is definitionally equal to a, and 0 $ otherwise. We can view the denotation of x ← c; f c as a marginal probability of the joint distribution formed by c and f . We know the probability of all events in c, but we only know the probability of events in f conditioned on events in c, so we can compute the probability of any event in this marginal distribution using the law of total probability. The fact that random bits are uniform and independent is encoded in the denotation of {0, 1}n , which is a function that ignores the argument and returns the probability The OC Query constructor is used to query the oracle, and OC Run is used to run some program under a different oracle that is allowed to access the current oracle. The OC Bind and OC Ret constructors are used for sequencing and for promoting terms into the language, as usual. In the rest of this paper, we overload the sequencing and ret notation in order to use them for OracleComp as well as Comp. We use query and run, omitting the additional types and decidable equality proofs, as notation for the corresponding constructors of OracleComp. Jquery aK = λo s.(o s a) Jrun c′ o′ s′ K = λo s.Jc′ (λx y.J(o′ (f st x) y) o (snd x)K) (s′ , s)K $ Jret cK = λo s.x ← c; ret (x, s) $ $ Jx ← c; f xK = λo s.[x, s′ ] ← Jc o sK; J(f x) o s′ K Figure 2. Semantics of Computations with Oracle Access The denotation of an OracleComp is a function from an oracle and an oracle state to a Comp that returns a pair containing the value provided by the OracleComp and the final state of the oracle. The type of an oracle that takes an A and returns a B is (S -> A -> Comp(B * S)) for some type S which holds the state of the oracle. The denotational semantics is shown in Figure 2. 3.2 (In)Equational Theory of Distributions A common goal in a security proof is to compare two distributions with respect to some particular value (or pair of values) in the distributions. To assist with such goals, we have provided an (in)equational theory for distributions. This theory contains facts that can be used to show that two probability values are equal, that one is less than another, or that the distance between them is bounded by some value. For simplicity of notation, equality is overloaded in the statements below in order to apply to both numeric values and distributions. When we say that two distributions (represented by probability mass functions) are equal, as in D1 = D2 , we mean that the functions are extensionally equal, that is ∀x, (D1 x) = (D2 x). Theorem 1 (Monad Laws). $ Ja ← ret b; f aK = J(f b)K $ Ja ← c; ret aK = JcK $ $ $ $ Ja ← (b ← c1 ; c2 b); c3 aK = Jb ← c1 ; a ← c2 b; c3 aK Theorem 2 (Commutativity). $ $ $ $ Ja ← c1 ; b ← c2 ; c3 a bK = Jb ← c2 ; a ← c1 ; c3 a bK Theorem 3 (Distribution Irrelevance). For any well-formed computation c, $ (∀x ∈ supp(JcK), Jf xKy = v) ⇒ Ja ← c; f aKy = v Theorem 4 (Distribution Isomorphism). For any f which is a bijection from supp(Jc2 K) to supp(Jc1 K), ∀x ∈ supp(Jc2 K), Jc1 K(f x) = Jc2 Kx ∧ ∀x ∈ supp(Jc2 K), Jf1 (f x)K v1 = Jf2 xKv2 $ $ ⇒ Ja ← c1 ; f1 aK v1 = Ja ← c2 ; f2 aK v2 Theorem 5 (Identical Until Bad). $ $ Ja ← c1 ; ret (B a)K = Ja ← c2 ; ret (B a)K ∧ $ Ja ← c1 ; ret (P a, B a)K(x, false) = $ Ja ← c2 ; ret (P a, B a)K(x, false) ⇒ $ $ | Ja ← c1 ; ret (P a)K x − Ja ← c2 ; ret (P a)K x | ≤ $ Ja ← c1 ; ret (B a)K true The meaning and utility of many of the above theorems is direct (such as the standard monad properties in Theorem 1), but others require some explanation. Theorem 3 considers a situation in which the probability of some event y in Jf xK is the same for all x produced by computation c. Then the distribution JcK is irrelevant, and it can be ignored. This theorem only applies to well-formed computations: A well-formed computation is one that terminates with probability 1, and therefore corresponds to a valid probability distribution. Theorem 4 is a powerful theorem that corresponds to the common informal argument that two random variables “have the same distribution.” More formally, assume distributions Jc1 K and Jc2 K assign equal probability to any pair of events (f x) and x for some bijection f . Then a pair of sequences beginning with c1 and c2 are denotationally equivalent as long as the second computations in the sequences are equivalent when conditioned on (f x) and x. A special case of this theorem is when f is the identity function, which allows us to simply “skip” over two semantically equivalent computations at the beginning of a sequence. Theorem 5, also known as the “Fundamental Lemma” from [6], is typically used to bound the distance between two games by the probability of some unlikely event. Computations c1 and c2 produce both a value of interest and an indication of whether some “bad” event happened. We use (decidable) predicate B to extract whether the bad event occurred, and projection P to extract the value of interest. If the probability of the “bad” event occurring in c1 and c2 is the same, and if the distribution of the value of interest is the same in c1 and c2 when the bad event does not happen, then the distance between the probability of the value of interest in c1 and and c2 is at most the probability of the “bad” event occurring. 3.3 Program Logic The final goal of a cryptographic proof is always some relation on probability distributions, and in some cases it is possible to complete the proof entirely within the equational theory described in 3.2. However, when the proof requires reasoning about loops or state, a more expressive theory may be needed in order to discharge some intermediate goals. For this reason, FCF includes a program logic that can be used to reason about changes to program state as the program executes. Importantly, the program logic is related to the theory of probability distributions through completeness and soundness theorems which allow the developer to derive facts about distributions from program logic facts, and vice-versa. The core logic is a Probabilistic Relational Postcondition Logic (PRPL), that behaves like a Hoare logic, except there are no preconditions. The definition of a PRPL specification is given in Definition 1. In less formal terms, we say that computations p and q are related by the predicate Φ if both p and q are marginals of the same joint probability distribution, and Φ holds on all values in the support of that joint distribution. Definition 1 (PRPL Specification). Given p : Comp A and q : Comp B, p ∼ q{Φ} iff, ∃ (d : Comp (A * B)), ∀(x, y) ∈ supp(JdK), Φ x y ∧ $ $ JpK = Jx ← d; ret (f st x)K ∧ JqK = Jx ← d; ret (snd x)K Using the PRPL, we can construct a Probabilistic Relational Hoare Logic (PRHL) which includes a notion of precondition for functions that return computations as shown in Definition 2. The resulting program logic is very similar to the Probabilistic Relational Hoare Logic of EasyCrypt [5], and it has many of the same properties. Definition 2 (PRHL Specification). Given p : A -> Comp B and q : C -> Comp D, {Ψ}p ∼ q{Φ} iff, ∀a b, Ψ a b ⇒ (p a) ∼ (q b){Φ}. Several theorems are provided along with the program logic definitions to simplify reasoning about programs. In order to use the program logic, one only needs to apply the appropriate theorem, so it is not necessary to produce the joint distribution described in the definition of a PRPL specification unless a suitable theorem is not provided. Theorems are provided for reasoning about the basic programming language constructs, interactions between programs and oracles, specifications describing equivalence, and the relationship between the program logic and the theory of probability distributions. Some of the more interesting program logic theorems are described below. Theorem 6 (Soundness/Completeness w.r.t. Equality). p ∼ q{λ a b.a = x ⇔ b = y} ⇔ JpK x = JqK y Theorem 7 (Soundness/Completeness w.r.t. Inequality). p ∼ q{λ a b.a = x ⇒ b = y} ⇔ JpK x ≤ JqK y Theorem 8 (Sequence Rule). p ∼ q{Φ′ } ⇒ {Φ′ }r ∼ s{Φ} ⇒ $ $ (x ← p; r x) ∼ (x ← q; s x){Φ} Theorem 9 (Oracle Equivalence). Given an OracleComp c, and a pair of oracles, o and p with initial states s and t, Φ = λ x y.(f st x) = (f st y) ∧ P (snd x)(snd y) ⇒  ∀a s′ t′ , P s′ t′ ⇒ (o s′ a) ∼ (p t′ a){Φ} ⇒ P s t ⇒ (JcK o s) ∼ (JcK p t){Φ} Theorems 6 and 7 relate judgments in the program logic to relations on probability distributions. The forward direction (soundness) is typically used in a proof to transform the goal into the program logic in order to accurately reason about loops and/or state. Once the goal is in the program logic, the backward direction (completeness) can be used to return to a goal about distributions, or to apply an existing theorem that describes relations on probability distributions. Theorem 8 is the relational form of the standard Hoare logic sequence rule, and it supports the decomposition of program logic judgments. Theorem 9 allows the developer to replace some oracle with an observationally equivalent oracle. This theorem takes a relational invariant P on the states of the oracles, and requires the developer to prove that if P holds on the states of the oracles and they are given identical input, then P holds on the resulting states and the outputs are identical. As long as P holds on the initial state of the oracle, this theorem concludes that the values returned by the program interacting with the oracles are equal, and that P holds on the final state. There is also a more general form of this theorem (omitted for brevity) in which the state of the oracle is allowed to go bad, and the interaction only produces equivalent results if the state does not go bad. This more general theorem can be combined with Theorem 5 to get “identical until bad” results for program/oracle interactions. 3.5 Programming Library The framework includes a library containing useful programming structures and their related theory. For example, the library includes several sampling routines, such as drawing a natural number from a specified range; drawing an element from a finite list, set, or group; or sampling an arbitrary Bernoulli distribution. These sampling routines are all computations based on the Rnd statement provided by the language, and each routine is accompanied by a theory establishing that the resulting distribution is correct and has the desired properties. The CompFold package contains higher-order functions for folding and mapping a computation over a list. This package uses the program logic extensively, and many of the theorems take a specification on a pair of computations as an argument, and produce a specification on the result of folding/mapping those computations over a list. The package also contains theorems about typical list and loop manipulations such as appending, flattening, fusion/fission and order permutation. 3.6 Asymptotic Theory The bulk of the effort in a security proof will be spent obtaining some result in the concrete setting. From there, a little more effort is required to produce a proof of some asymptotic fact that one would typically encounter in cryptography literature. To enable such asymptotic definitions and proofs, FCF includes a library of standard asymptotic definitions such as Definitions 3 and 4. The library also includes theorems that can be used to prove that functions are polynomial or negligible based on their composition(e.g., the sum of polynomials is polynomial, the quotient of polynomial and exponential is negligible). Definition 3 (At Most Polynomial). A function f : N → N is at most polynomial iff ∃x c1 c2 , ∀n, f (n) ≤ c1 ∗ nx + c2 Definition 4 (Negligible Function). A function f : N → Q is negligible iff ∀c, ∃n, ∀x > n, f (x) < 1/xc 3.7 Efficient Procedures 3.4 Tactics The framework includes several tactics that can be used to transform goals using the facts in Sections 3.2 and 3.3. For example, the comp swap l tactic applies commutativity (Theorem 2) to swap two independent statements at the beginning of the program on the left (of the equality, inequality, or program logic specification) in the current goal. There are similar tactics for manipulating games based on Left Identity (comp ret), Associativity (comp inline), Distribution Irrelevance (comp irr), and the special case of Distribution Isomorphism in which the bijection is the identity function (comp skip). Many of these tactics can be applied to goals related to probability distributions as well as goals in the program logic. A tactic called dist compute is provided to automatically discharge goals involving simple computations for which the corresponding distribution obviously has some desired property— typically that the probability of some event equals some specific value. A common proof technique is to develop a program in which the probability value of a particular event is obvious, and then relate other programs to this one by equivalence proofs. Then dist compute can be used to automatically compute the desired probability value for this program. The tactic works by producing an arithmetic expression from the computation(s) and then performing case splits in appropriate ways in order to get goals that can be solved automatically by existing Coq decision procedures (such as intuition and omega). A typical asymptotic security property states that a family of cryptographic schemes has some desirable property for all efficient adversaries. So in order to prove and apply these properties, we require some notion of “efficient” (families of) procedures. The language of computations used in FCF does not imply any particular model of computation—it is just a mechanism to specify probability distributions in a computational manner. Any notion of “efficiency” must first fix a model of computation, and then a complexity class on that model. We want this notion of efficiency to be flexible and extensible, so we can support several different models of computation and complexity classes. To accomplish this flexibility, we parameterize asymptotic security definitions by an “admissibility predicate” indicating the class of adversaries against which a problem is assumed to be hard, or a scheme is proven to be secure. In this setting, the adversary is a family of procedures indexed by a natural number which indicates the value of the security parameter. The admissibility predicate can describe the efficiency of the adversary as well as other properties such as well-formedness or the number of allowed oracle queries as a function of the security parameter. FCF includes a simple cost model and an associated admissibility predicate describing non-uniform worst-case polynomial time Turing machines that perform a (worst case) polynomial number of oracle queries. This admissibility predicate is constructed using a concrete cost model that assigns numeric costs to particular Coq functions, Comp values, and OracleComp values. In this cost model, the cost of executing a function is in N, indicating the worst-case (over all arguments) execution time. The cost of running a Comp is in N, indicating the worst-case execution time over all outcomes. The cost of executing an OracleComp is in N → N, and is a function from the cost of executing the oracle to the cost of executing the computation, including the cost of executing all oracle queries. The cost model for Gallina functions is axiomatic, as there is no direct way to capture such an intensional property for these terms. Our cost model includes axioms for primitive operations as well as a set of combinators for building more complicated functions. For example, the model includes an axiom stating that the xor operation for bit vectors of length c has a cost of c. As other examples, the model includes axioms stating that the cost of f composed with g is the sum of the costs of f and g, and the cost of if e1 then e2 else e3 is the cost of e1 plus the maximum of the costs of e2 and e3 . Obviously, our cost axioms are incomplete, but in practice, the number required is relatively small since it is only necessary to reason about the functions used by a constructed adversary in a proof. Of course, the axioms need to be carefully inspected to ensure they accurately describe the desired complexity class.2 But of course, a similar kind of inspection is needed to ensure the faithfullness of a cost model for a deeply-embedded language. to unrolling Repeat statements are trivial to prove under the operational semantics. Another benefit of the operational semantics and proof of equivalence is that this semantics can be considered to be the basic semantics for computations, and the denotational semantics no longer needs to be trusted. Some may prefer this arrangement, since the operational semantics more closely resembles a typical model of computation, and may be easier to understand and inspect. The operational semantics can also be used as a basis for a model of computation used to determine whether programs are efficient. Now that we have an operational semantics, we can simply use the standard Coq extraction mechanism to extract it along with the model of interest and all supporting types and functions. Of course, the trustworthiness of the extracted code depends on the correctness of Coq’s extraction mechanism. Gallina does not allow infinite recursion, so the framework includes OCaml code that runs a computation under the operational semantics until a value is obtained. The final step is instantiating any abstract types and functions with appropriate OCaml code. This extraction mechanism does not produce production-quality code, but the code could be used for purposes related to prototyping and testing. 4. Security Proof Construction 3.8 Code Extraction FCF provides a code extraction mechanism that includes a strong guarantee of equivalence between a model of a probabilistic program and the code extracted from that model. The denotational semantics of probabilistic computations relates a computation to a probability distribution, but it does not contain sufficient information to allow us to reason about the behavior of such computations on a traditional computer. So we developed a small-step operational semantics that describes the behavior of these computations on a machine in which the memory contains values rather than probability distributions. The operational semantics (omitted for brevity) is an oracle machine that is given a finite list of bits representing the “random” input, and it describes how a computation takes a single step to produce a new computation, a final value, or fails due to insufficient input bits. To show that this semantics is correct, we consider [c]n , the multiset of results obtained by running a program c under this semantics on the set of all input lists of length n. We can view [c]n as a distribution, where the mass of some value a in the distribution is the proportion of input strings that cause the program to terminate with value a. In order to compare the operational semantics with the denotational semantics, we want to view the operational semantics as a relation between computations and distributions. So the distribution related to computation c by the operational semantics is limn→∞ [c]n . The statement of equivalence between the semantics is shown in Theorem 10. Theorem 10. If c is well-formed, then lim [c]n = JcK n→∞ FCF contains a proof of Theorem 10 as a validation of the operational semantics used for extraction, but this theorem also provides other benefits. Because limits are unique, if two programs are equivalent under the operational semantics, then they are also equivalent under the denotational semantics. This allows us to prove equivalence of two programs using the operational semantics when it is more convenient to do so. For example, theorems related 2 Furthermore, a proof that a Gallina term has a cost described by these axioms does not mean that the extracted OCaml code will have this complexity, but rather, there exists some (propositionally) equivalent term which has the described cost. Since we are only trying to show the existence of an effective procedure, this is sufficient for our purposes. This section uses an example to describe the process of constructing a proof of security using the general process described at the beginning of Section 3. We consider a simple encryption scheme constructed from a pseudorandom function (PRF), and we prove that ciphertexts produced by this scheme are indistinguishable under chosen plaintext attack (IND-CPA). These security definitions, and the formal description of the construction, are provided in later sub-sections. This example proof is relatively simple, yet it contains many elements that one would find in a typical cryptographic argument, and so it allows us to exercise all of the key functionality of the framework. A more complex mechanized proof (e.g., the proof of [10]) may have more intermediate games and a different set of arguments to justify game transformations, but the structure is similar to the proof that follows. 4.1 Concrete Security Definitions In FCF, security definitions are used to describe properties that some construction is proven to have, as well as problems that are assumed to be hard. In the PRF encryption proof, we use the definition of a PRF to assume that such a PRF exists, and we use that assumption to prove that the construction in question has the IND-CPA property. A concrete security definition typically contains some game and an expression that describes the advantage of some adversary – i.e., the probability that the adversary will “win” the game. The game used to define the concrete security of a PRF is shown in Listing 4. Less formally, we say that f is a PRF for some adversary A, if A cannot effectively distinguish f from a random function. So this means that we expect that PRF Advantage is “small” as long as A is an admissible adversary. The function f oracle simply puts the function f in the form of an oracle, though a very simple one with no state and with deterministic behavior. The procedure RndR func is an oracle implementing a random function constructed using the provided computation RndR. The expressions involving A use a coercion in Coq to invoke the denotational semantics for OracleComp, and therefore ensure that A can query the oracle but has no access to the state of the oracle. At a high level, this definition involves two games describing two different “worlds” in which the adversary may find himself. In one world (PRF G A) the adversary interacts with the PRF, Variable Variable Variable Variable Variable Key D R : Set. RndKey : Comp Key. RndR : Comp R. A : OracleComp D R bool. f : Key -> D -> R. Definition f_oracle(k : Key) (x : unit)(d : D) : Comp (R * unit) := ret (f k d, tt). Definition PRF_G_A : Comp bool := k <-$ RndKey; [b, _] <-$2 A (f_oracle k) tt; ret b. Definition PRF_G_B : Comp bool := [b, _] <-$2 A (RndR_func) nil; ret b. Definition PRF_Advantage := | Pr[PRF_G_A] - Pr[PRF_G_B] |. Listing 4. PRF Concrete Security Definition and in the other (PRF G B) the adversary interacts with a random function. In each game, the adversary interacts with the oracle and then outputs a bit. The advantage of the adversary is the difference between the probability that he outputs 1 in world PRF G A and the probability that he outputs 1 in world PRF G B. If f is a PRF, then this advantage should be small. The concrete security definition for IND-CPA encryption is shown in Listing 5. In this definition, KeyGen and Encrypt are the key generation and encryption procedures. The adversary comprises two procedures, A1 and A2 with different signatures, and the adversary is allowed to share arbitrary state information between these two procedures. This definition uses a slightly different style than the PRF definition—there is one game and the “world” is chosen at random within that game. Then the adversary attempts to determine which world was chosen. In Listing 5, the game produces an encryption oracle from the Encrypt function and a randomly-generated encryption key. Then the remainder of the game, including the calls to A1 and A2, may interact with that oracle. The code for this definition includes some additional notation (different arrows and extra $ symbols) that is only used to provide hints to the Coq parser and does not change the behavior of the program. 4.2 Construction The construction, like the security definitions, can be modeled in a very natural way. Of course, one must take care to ensure that the construction has the correct signature as specified in the desired security property. The PRF encryption construction is shown in Listing 6. In the PRF Encryption construction, we assume a nat called eta (η) which will serve as the security parameter. The encryption scheme is based on a function f, and the scheme will only be secure if f is a PRF. The type of keys and plaintexts is bit vectors of length eta, and the type of ciphertexts is pairs of these bit vectors. The decryption function is included for completeness, but it is not needed for this security proof. 4.3 Sequence of Games The sequence of games represents the overall strategy for completing the proof. In the case of PRF Encryption, we want to show that the probability that the adversary will correctly guess the randomly chosen “world” is close to 1/2. We accomplish this by instantiating the IND-CPA security definition with the construction, and then transforming this game, little by little, until we have a game in Variable Plaintext Ciphertext Key State : Set. Variable KeyGen : Comp Key. Variable Encrypt : Key -> Ciphertext -> Comp Plaintext. Variable A1 : OracleComp Plaintext Ciphertext (Plaintext * Plaintext * State). Variable A2 : State -> Ciphertext -> OracleComp Plaintext Ciphertext bool. Definition EncryptOracle (k : Key)(x : unit)(p : Plaintext) := c <-$ Encrypt k p; ret (c, tt). Definition IND_CPA_SecretKey_G := key <-$ KeyGen ; [b, _] <-$2 ( [p0, p1, s_A] <--$3 A1; b <--$$ {0, 1}; pb <- if b then p1 else p0; c <--$$ Encrypt key pb; b’ <--$ A2 s_A c; $ ret eqb b b’ ) (EncryptOracle key) tt; ret b. Definition IND_CPA_SecretKey_Advantage := | Pr[IND_CPA_SecretKey_G] - 1 / 2 |. Listing 5. IND-CPA Concrete Security Definition Variable eta : nat. Variable f : Bvector eta -> Bvector eta -> Bvector eta. Definition PRFE_KeyGen := {0, 1} ˆ eta. Definition PRFE_Encrypt (k : Key )(p : Plaintext) := r <-$ {0, 1} ˆ eta; ret (r, p xor (f k r)). Definition PRFE_Decrypt (k : Key)(c : Ciphertext) := (snd c) xor (f k (fst c)). Listing 6. Encryption using a PRF which this probability is exactly 1/2. Each transformation may add some concrete value to the bounds, and we want to ensure that the sum of these values is small. The diagram in Figure 3 shows the entire sequence of games, as well as the relationship between each pair of games in the sequence. In this diagram, two games are related by = if they are identical, and by ≈ if they are close. When the equivalence is non-trivial, the diagram gives an argument for the equivalence, which implies a bound on the distance between the games when they are not equal. A detailed description of each game transformation follows: 1. Instantiate the IND-CPA definition with the construction. Unfold definitions and simplify. (Listing 7) 2. Apply the PRF definition to replace the PRF with a random function. (Listing 8) 3. Replace the random function output used to encrypt the challenge ciphertext with a bit vector selected completely at random. With overwhelming probability, the adversary does not notice this change. (Listing 9) IND GPA G = G1 ≈PRF Advantage G2 ≈Random List Collision G3 Definition G3 := [a, o] <-$2 A1 (RF_Encrypt) nil; [p0, p1, s_A] <-3 a; b <-$ {0, 1}; pb <- if b then p1 else p0; r <-$ {0, 1}ˆeta; pad <-$ {0, 1}ˆeta; c <- (r, pb xor pad); [b’, o] <-$2 (A2 s_A c) RF_Encrypt o; ret (eqb b b’). Listing 9. Game 3 =One Time Pad G4 = G5 = 1/2 Figure 3. Sequence of Games Diagram 4. We have modified the game to the point that encryption of the challenge plaintext is by one-time pad. So we can replace the ciphertext with a randomly-chosen value. (Listing 10) 5. Now the ciphertext is independent from the plaintext, and thus independent from the random bit that was used to select the “world.” This means we can move this coin flip to after the adversary guesses which world he is in. In this game, it is obvious that the probability that the adversary guesses the correct outcome of the coin flip is exactly one half. (Listing 11) Definition G1 := key <-$ PRFE_KeyGen; [b, _] <-$2 ( [p0, p1, s_A] <--$3 A1; b <--$$ {0, 1}; pb <- if b then p1 else p0; c <--$$ PRFE_Encrypt key pb; b’ <--$ (A2 s_A c); $ ret (eqb b b’) ) (PRFE_EncryptOracle key) tt; ret b. Listing 7. Game 1 Definition PRFE_RandomFunc := @randomFunc (Bvector eta) (Bvector eta) ({0,1}ˆeta) _. Definition RF_Encrypt s p := r <-$ {0, 1} ˆ eta; [pad, s] <-$2 PRFE_RandomFunc s r; ret (r, p xor pad, s). Definition G2 := [a, o] <-$2 A1 (RF_Encrypt) nil; [p0, p1, s_A] <-3 a; b <-$ {0, 1}; pb <- if b then p1 else p0; [c, o] <-$2 RF_Encrypt o pb; [b’, o] <-$2 (A2 s_A c) RF_Encrypt o; ret (eqb b b’). Listing 8. Game 2 4.4 Equivalence Proofs The next step is to prove the appropriate sort of equivalence between each pair of games in the sequence. In the case of PRF Encryption, the goal is to show that the distance between the IND-CPA Definition G4 := [a, o] <-$2 A1 (RF_Encrypt) nil; [p0, p1, s_A] <-3 a; b <-$ {0, 1}; pb <- if b then p1 else p0; r <-$ {0, 1}ˆeta; pad <-$ {0, 1}ˆeta; c <- (r, pad); [b’, o] <-$2 (A2 s_A c) RF_Encrypt o; ret (eqb b b’). Listing 10. Game 4 Definition G5 := [a, o] <-$2 A1 (RF_Encrypt) nil; [p0, p1, s_A] <-3 a; r <-$ {0, 1}ˆeta; pad <-$ {0, 1}ˆeta; c <- (r, pad); [b’, o] <-$2 (A2 s_A c) RF_Encrypt o; b <-$ {0, 1}; ret (eqb b b’). Listing 11. Game 5 game and 1/2 is very small, and we accomplish this by showing that each pair of games in the sequence is either identical or “close.” The first step is to show that Game 1 (Listing 7) really is the IND-CPA game instantiated with this encryption scheme. This fact (Listing 12) is obvious, and the proof can be completed using Coq’s reflexivity tactic. A1 and A2 are parameters representing the procedures of the adversary against the encryption scheme. In the statement of this theorem, == is equality for rational numbers. This equality is registered with Coq’s setoid system to enable tactics such as reflexivity and rewriting. Theorem G1_equiv : Pr[IND_CPA_SecretKey_G PRFE_KeyGen PRFE_Encrypt A1 A2] == Pr[G1]. Listing 12. Equivalence of the Security Definition and Game 1 Next we show that the distance between Games 1 and 2 is exactly the advantage of some adversary against a PRF. The adversary against the PRF (Listing 13) is constructed from A1 and A2. PRFE Encrypt OC is an encryption oracle that interacts with the PRF as an oracle. PRF A provides this encryption oracle to A1 and A2 using the OC Run operation. To prove the “closeness” of Games 1 and 2, first we prove that the interaction between PRF A and the PRF oracle is equivalent to Game 1 (Theorem 14). Then we prove that the interaction between PRF A and the random function oracle is equivalent to Game 2 (Theorem 15). Finally we apply the results of parts 1 and 2 and unify with the definition of a PRF (Theorem 16). To prove Theorems 14 and 15, we mostly perform simple manipulations such as applying the denotational semantics of OracleComp, inlining, and removing identical statements at the beginning of the game. In both of these proofs, the adversary is Definition PRFE_Encrypt_OC (x : unit) (p : Plaintext) : OracleComp (Bvector eta) (Bvector eta) (Ciphertext * unit) := r <--$$ {0, 1} ˆ eta; pad <--$ OC_Query r; $ (ret (r, p xor pad, tt)). Definition PRF_A : OracleComp (Bvector eta) (Bvector eta) bool := [a, n] <--$2 OC_Run A1 PRFE_Encrypt_OC tt; [p0, p1, s_A] <-3 a; b <--$$ {0, 1}; pb <- if b then p1 else p0; r <--$$ {0, 1} ˆ eta; pad <--$ OC_Query r; c <- (r, pb xor pad); z <--$ OC_Run (A2 s_A c) PRFE_Encrypt_OC n; [b’, _] <-2 z; $ ret (eqb b b’). Listing 13. The Constructed Adversary Against the PRF Theorem G1_PRF_A_equiv : Pr[k <-$ {0, 1}ˆ eta; [b, _] <-$2 PRF_A (f_oracle k) tt; ret b] == Pr[G1]. Listing 14. Equivalence PRF A and G1 Theorem G2_PRF_A_equiv : Pr[[b, _] <-$2 PRF_A PRFE_RandomFunc nil; ret b] == Pr[G2]. Listing 15. Equivalence PRF A and G2 Theorem G1_G2_close : | Pr[G1] - Pr[G2] | == PRF_Advantage ({0, 1}ˆeta) ({0, 1}ˆeta) f PRF_A. Listing 16. Closeness of Game 1 and Game 2 interacting with two different, but observationally equivalent, oracles. So we use the program logic and Theorem 9 to prove that these interactions produce equivalent results. Next we show that Games 2 and 3 are “close” by demonstrating that these games are “identical until bad” in the sense of Theorem 5. The “bad” event of interest is the event that the randomlygenerated PRF input used to encrypt the challenge plaintext (r in Game 2) is also used to encrypt some other value during the interaction between the adversary and the encryption oracle. There are two separate adversary procedures, and each one is capable of encountering r during its interaction with the oracle. So we divide this proof into two parts, one for each adversary procedure, where each part includes an “identical until bad” argument. In the first step, we produce the pad value randomly (without using the random function), but then add an entry for r and pad to the state of the random function. In the second step, we produce pad randomly, and do not add an entry to the random function. To get an expression for the probability of the “bad”event, we assume natural numbers q1 and q2 , and that A1 performs at most q1 queries and A2 performs at most q2 queries. FCF includes a library module called RndInList that includes general-purpose arguments related to the probability of encountering a randomly selected value in a list of a certain length, and the probability of encountering a certain value in a list of randomly-generated elements of a certain length. By combining the “identical until bad” proofs with these arguments to get expressions bounding the probabilities of the bad events, we obtain the result of Listing 17. The next step is to use a one-time-pad argument to replace the challenge ciphertext with a randomly-chosen value. The library contains a generic one-time-pad argument that we can apply here. Theorem G2_G3_close : | Pr[G2] - Pr[G3] | <= q1 / (2 ˆ eta) + q2 / (2 ˆ eta). Listing 17. Closenes of Game 2 and Game 3 We transform this game into an equivalent game that unifies with the one-time-pad argument, then we apply the argument to get the result shown in Listing 18. Theorem G3_G4_equiv : Pr[G3] == Pr[G4]. Listing 18. Equivalence of Game 3 and Game 4 Now that the ciphertext is independent of the challenge bit, we produce a new game by moving the sampling of the challenge bit to the end of the game. To prove this fact (Listing 19), we simply unfold the required definitions, skip over all of the identical pairs of statements at the beginning of the proof, then swap the order of independent statements in the game on the left in order to make these statements align with the identical statements in the game on the right. Theorem G4_G5_equiv : Pr[G4] == Pr[G5]. unfold G4, G5. do 3 (comp_skip; comp_simp; comp_swap_l). comp_skip; comp_simp. reflexivity. Qed. Listing 19. Equivalence of Game 4 and Game 5 Finally, we develop the proof that the adversary wins Game 5 with probability exactly 1/2. This proof (Listing 20) proceeds by discarding all of the initial statements in the game using the comp irr l tactic. Note that this tactic produces an obligation to prove that the statement being discarded is a well-formed computation, which can be discharged with the tactic wftac. Then what remains is a very simple game, and dist compute can automatically compute the probability that this game returns true. Theorem G5_one_half : Pr[G5] == 1/2. do 4 comp_irr_l; wftac. dist_compute. Qed. Listing 20. Probability of Winning Game 5 By combining the equivalences of each pair of intermediate games, we get the final concrete security result shown in Listing 21. It is important to note that the statement of this theorem does not reference any of the intermediate games. The sequence of games was only a tool that we used to get the final result, and this sequence does not need to be inspected in order to trust the result. The concrete security result in Listing 21 may be sufficient for many purposes. We have an expression describing the advantage of the adversary, and we can inspect this expression to see whether this advantage is sufficiently small. We also must inspect the definition of the adversary PRF A, which appears in this result, and ensure that this adversary is “efficient” according to the desired complexity class. Next we will show how to derive an asymptotic security result based on this concrete result. A benefit of proving asymptotic security is that this proof removes the requirement to inspect the constructed adversary and the expression describing the adversary’s advantage. Theorem PRFE_IND_CPA_concrete : IND_CPA_SecretKey_Advantage PRFE_KeyGen PRFE_Encrypt A1 A2 <= PRF_Advantage ({0, 1}ˆeta) ({0, 1}ˆeta) f PRF_A + (q1 / 2ˆeta + q2 / 2ˆeta). Listing 21. Concrete Security Result 4.5 Asymptotic Security Definitions Now we give the asymptotic security definitions for PRFs and INDCPA encryption. These definitions are parameterized by an admissibility predicate as described in Section 3.7. The IND-CPA definition accepts two admissibility predicates – one for each adversary procedure. The asymptotic security definition for a PRF is given in Listing 22. In this definition, RndKey, RndR, and f are nat-indexed families of procedures. Similarly in the IND-CPA definition (Listing 23), KeyGen and Encrypt are nat-indexed families of procedures. Both of these definitions are claims over all admissible nat-indexed adversary families. Note that both definitions reuse the expressions provided in the concrete security definitions. This style provides a convenient method for developing an asymptotic security proof from a concrete security proof. Variable Variable Variable Variable D R Key : nat -> Set. RndKey : forall n, Comp (Key n). RndR : forall n, Comp (R n). f : forall n, Key n -> D n-> R n. We begin by assuming costs for A1 and A2. A1 cost is a function describing the cost of A 1. A2 cost 1 is a number describing how much it costs for A2 to compute an OracleComp that is closed over a state and a ciphertext. Then A2 cost 2 is a function describing the cost of executing this OracleComp. Given these assumptions, we can give a cost to PRF A as shown in Listing 24. In the statement of this theorem, oc cost, comp cost, and cost are the cost models for OracleComp, Comp, and Coq functions, respectively. Note that this cost model is overly conservative and some costs are counted multiple times. Theorem PRF_A_cost : oc_cost cost (comp_cost cost) PRF_A (fun x => (A1_cost (x + (5 * eta))) + (A2_cost_2 (x + (5 * eta))) + x + 5 * A2_cost_1 + 6 + 7 * eta). Listing 24. Cost of Constructed Procedure PRF A This proof is completed by repeatedly applying the rule of the cost model that is relevant to the term in the goal, which is a highly syntax-directed operation that can be mostly automated. Once all these syntax-directed rules are applied, the developer is obligated to prove that the expression obtained in this process is equal to (or less than) the expression in the statement of the theorem. In this last step of the proof, automated tactics such as omega are very useful. 4.7 Asymptotic Security Proof Definition PRF := forall (A : \forall n, OracleComp (D n) (R n) bool), admissible_A A -> negligible (fun n => PRF_Advantage (RndKey n) (RndR n) (@f n) (A n)). Listing 22. Definition of a PRF Variable Plaintext Ciphertext Key State : nat -> Set. Variable KeyGen : forall n, Comp (Key n). Variable Encrypt : forall n, Key n -> Ciphertext n -> Comp (Plaintext n). Definition IND_CPA_SecretKey := forall (State : nat -> Set) (A1 : forall n, OracleComp (Plaintext n) (Ciphertext n) (Plaintext n * Plaintext n * State n)) (A2 : forall n, State n -> Ciphertext n -> OracleComp (Plaintext n) (Ciphertext n) bool), admissible_A1 A1 -> admissible_A2 A2 -> negligible (fun n => IND_CPA_SecretKey_Advantage (KeyGen n) (@Encrypt n) (A1 n) (A2 n) ). Listing 23. Definition of IND-CPA Encryption 4.6 Efficiency of Constructed Adversaries The first step in proving an asymptotic security result is to view each constructed adversary in the concrete proof as a nat-indexed family of adversaries, and prove that this family is “efficient” as defined by some complexity class. In the PRF Encryption proof, we use the non-uniform polynomial time complexity class described in Section 3.7. Because this class includes a concrete cost model, we begin with a proof of the concrete cost of each constructed adversary procedure. The final step in the proof is to show that the security definition shown in Listing 23 holds on this construction as long as f is a PRF as defined in Listing 22. The statement of this fact is shown in Listing 25. Note that admissible oc and admissible oc func 2 are the admissibility predicates for OracleComp and for functions with two arguments that produce an OracleComp defined in the simple complexity class described in Section 3.7. Theorem PRFE_IND_CPA : PRF Rnd Rnd f (admissible_oc cost) -> IND_CPA_SecretKey PRFE_KeyGen (fun n => PRFE_Encrypt (@f n)) (admissible_oc cost) (admissible_oc_func_2 cost). Listing 25. Asymptotic Security of PRF Encryption The primary obligation of this proof is to show that the function defining the advantage of any admissible family of adversaries against this encryption scheme is a negligible function. The fact that this adversary family is admissible allows us to use the result of Listing 24, along with other facts, to conclude that the constructed adversary family against the PRF is admissible. In the course of this proof, we must show that the expression implied by Figure 24 is at most polynomial in η if x is at most polynomial in η and all the costs related to PRF A1 and PRF A2 are at most polynomial in η. This fact is proven using the provided theory of polynomial functions (Section 3.6). From the admissibility of the constructed adversary, and from the fact the f is a PRF against all admissible adversaries, we can conclude that the constructed adversary’s advantage against the PRF is negligible. The advantage of this adversary against the PRF is one of the terms that appears in the bounds of the concrete result (Listing 21). The other term is q1 /2η + q2 /2η , where q1 and q2 are the number of oracle queries performed by the two adversary procedures. The admissibility predicates ensure that each adversary only performs a polynomial number of queries, so q1 and q2 must be polynomial in η, and this expression is negligible in η. So the advantage of the adversary against this encryption scheme is the sum of two negligible functions, and is therefore negligible. The entire proof of security for this encryption scheme requries approximately 1500 lines of Coq code, of which about 700 lines are specification (including 100 lines of cryptographic definitions and intermediate games) and 800 lines are proof. The proof incorporates another 500 lines of code for the reusable arguments (e.g., the one-time pad argument). We expect that a skilled Coq developer could complete such a proof in a matter of days (though he may require the help of a cryptographer to develop the sequence of games and high-level arguments). 5. Evaluation This section attempts to evaluate FCF against the design goals listed in Section 2, and to contrast with both CertiCrypt and EasyCrypt. All three of these frameworks provide concrete bounds, so this criterion is not discussed further. And, all three frameworks use a relatively familiar syntax for security definitions and constructions. We believe that, based on our experience working with cryptographers, they can easily understand these definitions (e.g., Listing 4) after spending a few minutes familiarizing themselves with the notation. Regarding proof automation, FCF lies somewhere between CertiCrypt and EasyCrypt. EasyCrypt achieves a significant level of automation by using SMT solvers to discharge simple logical goals, but higher-level goals still need to be addressed manually by applying tactics. FCF achieves a similarly high level of automation through the use of existing and custom Coq tactics. These tactics are not as powerful as modern SMT solvers, so the developer may need to manually address some goals in FCF that would be discharged automatically in EasyCrypt. However, the semantics of programs in FCF is computational, so Coq is able to immediately compute an expression describing the probability distribution for any program. This allows some simple equivalences to be discharged immediately using this computation and FCF’s dist compute tactic. Regarding trust in extensional properties, FCF and CertiCrypt are foundational, meaning that the program logic is constructed definitionally from the semantics. In contrast, EasyCrypt relies upon a set of axioms for its program logic. EasyCrypt also relies on the correctness of the EasyCrypt front end and the Why3 verification generator, whereas FCF and CertiCrypt only depend on the Coq type checker. EasyCrypt provides no support for reasoning about intensional properties like execution time, whereas CertiCrypt and FCF do, though FCF provides this suport using a trusted set of axioms. EasyCrypt and CertiCrypt are based on simply-typed, first-order languages. This design makes it difficult to directly support abstraction, extension, and reuse, though these frameworks include elements which support these goals to some extent. In contrast, FCF uses a shallow embedding and the advanced features of Coq, such as dependent types, modules, notation, and higher-order functions, to support abstraction, extensiblity, and reuse. We believe that having such a rich language for describing games and assumptions is critical for scaling to larger protocols. FCF supports code generation with a semantics that is proven to be equivalent to the semantics used to reason about the probabilistic behavior of programs. That is, a program extracted from an FCF model is guaranteed to produce the correct probability distribution when the input bits provided to it are uniformly distributed, assuming the extraction mechanism of Coq preserves meaning. There has been some initial work in producing implementations that correspond to EasyCrypt models, but there is no formal relationship be- tween the semantics of the implementation and the semantics used to reason about the model. 6. Related Work There has been a large amount of work in the area of verifying cryptographic schemes in recent years. In this section we will describe some of this related work, focusing on systems that attempt to establish security in the computational model. CertiCrypt [4] and EasyCrypt [5] have been thoroughly discussed previously in this paper. There are several other examples of frameworks for cryptographic security proofs implemented within proof assistants. The most similar work is that of Nowak [20], who was the first to develop proofs of cryptography in Coq using a shallow embedding in which programs have probability distributions as their denotations. FCF builds on this work by adding more tools for modeling and reasoning such as procedures with oracle access (Section 3.1), a program logic (Section 3.3), and asymptotic reasoning (Section 3.6). The work of [2] is a Coq library utilizing a deeply-embedded imperative programming language. This library is a predecessor to CertiCrypt, and it includes some important elements that were later adopted by CertiCrypt. Notably, the probabilistic programming language in this work is given a semantics in which program states are distributions, and the semantics describes how these distributions are transformed by each command in the language. CertiCrypt and EasyCrypt extended this work by adding language constructs such as oracles and unrestricted loops, and well as reasoning tools such as the Probabilistic Relational Hoare Logic. Verypto [8] is a fully-featured framework built on Isabelle [19] that includes a deep embedding of a functional programming language. To allow state information to remain hidden from adversaries, Verypto provides ML-style references, in contrast to the oracle system provided by FCF. To date, Verypto has only been used to prove the security of simple constructions, but this work uses an interesting approach that deserves more exploration. CryptoVerif [9] is a tool based on a concurrent, probabilistic process calculus that is only able to prove properties related to secrecy and authenticity. CryptoVerif is highly automated to the extent that it will even attempt to locate intermediate games, and so proof development in CryptoVerif requires far less effort compared to FCF or EasyCrypt. However, there are a large number of proofs that could be completed in FCF or EasyCrypt that are impossible in CryptoVerif due to its specialized nature. Refinement types [7] have been used by Fournet et al [15] to develop proofs of security for cryptographic schemes in the computational model. In this system, a security property is specified as an ideal functionality (in the sense of the real/ideal paradigm), and proofs are completed using the “sequence of games” style in the asymptotic setting. This approach allows the proofs of security to be fairly simple, but no concrete security claims are proved, so it may be difficult to make practical claims based on such a proof. Computational soundness [1] provides another mechanism for verifying cryptographic schemes. This approach attempts to derive security in the computational model from security in the symbolic model by showing that any likely execution trace in the computational model also exists in the symbolic model. It is possible to mechanize such a proof as described in [3]. This approach is limited to classes of schemes for which computational soundness results have been discovered. Another limitation with this approach is that it can only produce proofs in the asymptotic setting—there is no way to prove concrete security claims. Protocol Composition Logic (PCL) [12] provides a logic and proof system for verifying cryptographic schemes in the symbolic model. The system is based on a process calculus and allows rea- soning about the results of individual protocol steps. More recent work [11] has extended this logic to allow for proofs in the computational model. In computational PCL, formulas are interpreted against probability distributions on traces and a formula is true if it holds with overwhelming probability. This approach is similar to computational soundness in that low-probability traces are ignored, and proofs of concrete security claims are impossible. [9] B. Blanchet. Computationally sound mechanized proofs of correspondence assertions. In 20th IEEE Computer Security Foundations Symposium (CSF’07), pages 97–111, Venice, Italy, July 2007. IEEE. [10] D. Cash, S. Jarecki, C. Jutla, H. Krawczyk, M.-C. Rou, and M. Steiner. Highly-scalable searchable symmetric encryption with support for boolean queries. In R. Canetti and J. Garay, editors, Advances in Cryptology CRYPTO 2013, volume 8042 of Lecture Notes in Computer Science, pages 353–373. Springer Berlin Heidelberg, 2013. ISBN 9783-642-40040-7. . 7. Conclusion and Future Work [11] A. Datta, A. Derek, J. C. Mitchell, V. Shmatikov, and M. Turuani. Probabilistic polynomial-time semantics for a protocol security logic. In Proceedings of the 32nd international conference on Automata, Languages and Programming, ICALP’05, pages 16–29, Berlin, Heidelberg, 2005. Springer-Verlag. ISBN 3-540-27580-0, 978-3-54027580-0. . Our contribution is a complete mechanized framework for specifying and checking cryptographic proofs within a proof assistant. Our framework compares favorably to the current state of the art, and provides many new benefits, such as extensibility through a foundational approach, a powerful language for describing schemes, and the ability to extract excutable code. Of course, whether these benefits apply at scale is still an open question, and thus a key direction for us is to prove security for an even wider range of standard constructions, as well as novel cryptographic schemes. In particular, we have proven the security of the “tuple set” construction of [10], and we intend to continue developing this work into a proof of a searchable symmetric encryption scheme. The biggest limitation of FCF is that it currently lacks definitions for many cost models and complexity classes that are commonly used in cryptography. We hope to develop more cost models and complexity classes, including a complexity class describing (uniform) probabilistic polynomial time Turing machines. References [1] M. Abadi and P. Rogaway. Reconciling two views of cryptography (the computational soundness of formal encryption). In Proceedings of the International Conference IFIP on Theoretical Computer Science, Exploring New Frontiers of Theoretical Informatics, TCS ’00, pages 3–22, London, UK, UK, 2000. Springer-Verlag. ISBN 3-540-67823-9. URL http://dl.acm.org/citation.cfm?id=647318.723498. [2] R. Affeldt, M. Tanaka, and N. Marti. Formal proof of provable security by game-playing in a proof assistant. In Proceedings of the 1st International Conference on Provable Security, ProvSec’07, pages 151–168, Berlin, Heidelberg, 2007. Springer-Verlag. ISBN 3-540-75669-8, 978-3-540-75669-9. URL http://dl.acm.org/citation.cfm?id=1779394.1779408. [3] M. Backes and D. Unruh. Computational soundness of symbolic zeroknowledge proofs against active attackers. In 21st IEEE Computer Security Foundations Symposium, CSF 2008, pages 255–269, June 2008. Preprint on IACR ePrint 2008/152. [4] G. Barthe, B. Grégoire, and S. Zanella Béguelin. Formal certification of code-based cryptographic proofs. In 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, pages 90–101. ACM, 2009. URL http://dx.doi.org/10.1145/1480881.1480894. [12] A. Datta, A. Derek, J. C. Mitchell, and A. Roy. Protocol composition logic (pcl). Electronic Notes in Theoretical Computer Science, 172: 311–358, 2007. [13] E. De Cristofaro, S. Jarecki, X. Liu, Y. Lu, and G. Tsudik. Privacy-protecting information retrieval, University of Irvine team: Protocol and proofs. Appendix E of SPAR Program BAA: https://www.fbo.gov/utils/view?id=32750071e5cf4afc3b7e973d6 2010. [14] T. Elgamal. A public key cryptosystem and a signature scheme based on discrete logarithms. Information Theory, IEEE Transactions on, 31 (4):469–472, 1985. ISSN 0018-9448. . [15] C. Fournet, M. Kohlweiss, and P.-Y. Strub. Modular code-based cryptographic verification. In Y. Chen, G. Danezis, and V. Shmatikov, editors, ACM Conference on Computer and Communications Security, pages 341–350. ACM, 2011. ISBN 978-1-4503-0948-6. [16] S. Halevi. A plausible approach to computer-aided cryptographic proofs. Cryptology ePrint Archive, Report 2005/181, 2005. http://eprint.iacr.org/. [17] J. Herzog, C. Meadows, A. Jaggard, A. Stoughton, and J. Katz. MITLL-NRL panel: Easycrypt 0.2 feedback and opinions. http://web.archive.org/web/20140703170052/https://easycrypt 2013. Accessed: 201407-03. [18] The Coq development team. The Coq proof assistant reference manual. LogiCal Project, 2004. URL http://coq.inria.fr. Version 8.0. [19] T. Nipkow, L. C. Paulson, and M. Wenzel. Isabelle/HOL — A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, 2002. [20] D. Nowak. A framework for game-based security proofs. Cryptology ePrint Archive, Report 2007/199, 2007. http://eprint.iacr.org/. [21] N. Ramsey and A. Pfeffer. Stochastic lambda calculus and monads of probability distributions. In Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’02, pages 154–165, New York, NY, USA, 2002. ACM. ISBN 1-58113-450-9. . URL http://doi.acm.org/10.1145/503272.503288. [5] G. Barthe, B. Grégoire, S. Heraud, and S. Zanella Béguelin. Computer-aided security proofs for the working cryptographer. In Advances in Cryptology – CRYPTO 2011, volume 6841 of Lecture Notes in Computer Science, pages 71–90. Springer, 2011. [6] M. Bellare and P. Rogaway. Code-based game-playing proofs and the security of triple encryption. Cryptology ePrint Archive, Report 2004/331, 2004. http://eprint.iacr.org/. [7] J. Bengtson, K. Bhargavan, C. Fournet, S. Maffeis, and A. D. Gordon. Refinement types for secure implementations. In In 21st IEEE Computer Security Foundations Symposium (CSF08, pages 17–32. IEEE, 2008. [8] M. Berg. Formal Verification of Cryptographic Security Proofs. PhD thesis, Saarland University, 2013. URL http://www.infsec.cs.uni-saarland.de/˜berg/publications/thesis-berg.pdf.
6cs.PL
1 Pulling back error to the hidden-node parameter technology: Single-hidden-layer feedforward network without output weight arXiv:1405.1445v1 [cs.NE] 6 May 2014 Yimin Yang, Q. M. Jonathan Wu, Guangbin Huang, and Yaonan Wang Abstract—According to conventional neural network theories, the feature of single-hidden-layer feedforward neural networks(SLFNs) resorts to parameters of the weighted connections and hidden nodes. SLFNs are universal approximators when at least the parameters of the networks including hidden-node parameter and output weight are exist. Unlike above neural network theories, this paper indicates that in order to let SLFNs work as universal approximators, one may simply calculate the hidden node parameter only and the output weight is not needed at all. In other words, this proposed neural network architecture can be considered as a standard SLFNs with fixing output weight equal to an unit vector. Further more, this paper presents experiments which show that the proposed learning method tends to extremely reduce network output error to a very small number with only 1 hidden node. Simulation results demonstrate that the proposed method can provide several to thousands of times faster than other learning algorithm including BP, SVM/SVR and other ELM methods. including the hidden-node parameters (a,b) and output weight β are allowed adjustable[4][5]. Unlike above neural network theories that all the parameters in networks are allowed adjustable, other researches proposed some semi-random network theories[6][7][8]. For example, Lowe [8] focus on a specific RBF network: The centers a in [8] can be randomly selected from the training data instead of tuning, but the impact factor b of RBF hidden node is not randomly selected and usually determined by users. Unlike above semi-random network theories, in 2006, Huang et al[9] illustrated that iterative techniques are not required in adjusting all the parameters of SLFNs at all. Based on this idea, Huang et al proposed simple and efficient learning steps referred to as extreme learning machine(ELM). In [10][11][12], Huang et al have proved that SLFNs with randomly generated hidden node parameter can work as universal approximators by only calculating the output weights linking the hidden layer to the output nodes. Recently ELM development [13] shows that ELM unifies FNNs and SVM/LS-SVM. Compared to ELM, LS-SVM and PSVM achieve suboptimal solutions and have a higher computational cost. Index Terms—Bidirectional Extreme Learning Machine, Feedforward neural network, universal approximation, number of hidden nodes, learning effectiveness Above neural network theories indicate that SLFNs can work as universal approximation at least hidden-node parameters1 and output weight should be exist, however, in this paper we indicate that output weight do not need exist in SLFNs at all. I. I NTRODUCTION In [14] we proposed a learning algorithm, called bidirectional extreme learning machine (B-ELM) in which half of hiddennode parameters are not randomly selected and are calculated by pulling back the network residual error to input weight. The experimental results in [14] indicated that B-ELM tends to reduce network output error to a very small value at an extremely early learning stage. Further more, our recent experimental results indicate that in B-ELM[14], output weight play a very minion role in the network learning effectiveness. Inspired by these experimental results, in this paper, we show that SLFNs without output weight can approximate any target continuous function and classify any disjoint regions if one using pulling back error to hidden-node parameters. In particular, the following contributions have been made in this paper. The widespread popularity of neural networks in many fields is mainly due to their ability to approximate complex nonlinear mappings directly from the input samples. In the past two decades, due to their universal approximation capability, feedforward neural networks (FNNs) have been extensively used in classification and regression problem[1]. According to Jaeger’s estimation[2], 95% literatures are mainly on FNNs. As a specific type of FNNs, the single-hidden-layer feedforward network (SLFNs) plays an important role in practical applications[3]. For N arbitrary distinct samples (xi ,ti ), where xi = [xi1 , xi2 ,· · · , xin ]T ∈ Rn and ti ∈ Rm , an SLFNs with L hidden nodes and activation function h(x) are mathematically modeled as f L (x) = L X βi h(ai · x j + bi ), j = 1,· · · , N (1) i=1 where h(ai ,bi ,x) denotes the output of the i th hidden node with the hidden-node parameters (ai ,bi ) ∈ Rn × R and βi ∈ R is the output weight between the i th hidden node and the output node. ai · x denotes the inner product of vector ai and x in Rn . An active topic on the universal approximation capability of SLFNs is then how to determine the parameters ai ,bi , and βi (i = 1,· · · ,L) such that the network output f L (x) can approximate a given target T,T = [t1 ,· · · ,tN ]. The feature of SLFNs resorts to parameters of the output weight and hidden nodes parameters. According to conventional neural network theories, SLFNs are universal approximators when all the parameters of the networks This work was supported by National Natural Science Foundation of China (61175075,61301254,61304007), and and Hunan Provincial Innovation Foundation For Postgraduate (CX2012B147). Y. M. Yang is with the College of Electric Engineering, Guangxi University, Nanning 530004, China, and also with the Department of Electrical and Computer Engineering, University of Windsor N9B 3P4, Canada. Q. M. Jonathan Wu is with the Department of Electrical and Computer Engineering, University of Windsor N9B 3P4, Canada. G. B. Huang is with the School of Electrical and Electronic Engineering, Nanyang Technological University, Singapore 639798, Singapore. Y. N. Wang are with the College of Electrical and Information Engineering, Hunan University, Changsha 410082, China. 1) The learning speed of proposed learning method can be several to thousands of times faster than other learning methods including SVM, BP and other ELMs. Further more, it can provide good generalization performance and can be applied in regression and classification applications directly. 2) Different from conventional SLFNs in which the hidden node parameter and output weight should be needed, in the proposed method, we proved that SLFNs without output weight can still approximate any target continuous function and classify any disjoint regions. Thus the architecture of this single parameter neural network is extremely simpler than traditional SLFNs. 3) Different from other neural networks requiring large number of hidden nodes2 , experimental study shows that the proposed learning method with only one hidden node can give significant improvements on accuracy instead of maintaining a large hiddennode-numbers hidden layer. 1 hidden-node parameters can be generated randomly 2 In [13], Huang et al indicate "The generalization performance of ELM is not sensitive to the dimensionality L of the feature space (the number of hidden nodes) as long as L is set large enough (e.g., L > 1000 for all the real-world cases tested in our simulations)." 2 II. P RELIMINARIES AND N OTATION IV. SLFN S WITHOUT OUTPUT WEIGHT A. Notations and Definitions The sets of real, integer, positive real and positive integer numbers are denoted by R,Z,R+ and Z+ , respectively. Similar to [1], let ̥2 (X ) be a space of functions f on a compact subset X in the n-dimensional Euclidean space Rn such that | f |2 are R integrable, that is, X | f (x)|2 d x < ∞. Let ̥2 (Rn ) be denoted by ̥2 . For u, v ∈ ̥2 (X ), the inner product < u, v > is defined by Z < u, v >= u(x)v (x)dx (2) X The norm in ̥2 (X ) space will be denoted as || · ||. L denotes the number of hidden nodes. For N training samples, x,x ∈ RN×n denotes the input matrix of network, T ∈ RN×m denotes the desire output matrix of network. H ∈ RN×m is called the hidden layer output matrix of the SLFNs; the i th column of H (Hi ) is the i th hidden node output with respect to inputs. The hidden layer output matrix Hi is said to be randomly generated function sequence Hri if the corresponding hidden-node parameters (ai ,bi ) are randomly generated. . en ,en ∈ RN×m denotes the residual error function for the current network f n with n hidden nodes. I is unit matrix and I ∈ Rm×m . III. B IDIRECTIONAL ELM FOR REGRESSION PROBLEM N ∈ Rn ×R Theorem 1: [14] Given N training samples {(xi , ti )}i=1 come from the same continuous function, given the sigmoid or sine activation function h : R → R; Given a error feedback function sequence He2n (x,a,b) by He2n = e 2n−1 · (β2n−1 )−1 (3) If activation function h is sin/cos, given a normalized function u : R → [0,1]; If activation function h is sigmoid, given a normalized function u : R → (0,1]. Then for any continuous target function f , randomly generated function sequence Hr2n+1 , limn→∞ kf − (Hr1 · e e β1 + Ĥ2 (â2 , b̂2 )·β2 +· · ·+Hr2n−1 ·β2n−1 + Ĥ2n (â2n , b̂2n )·β2n k = 0 hold with probability one if â2n = h −1 (u(He2n )) · x−1 , â2n ∈ Rn q b̂2n = mse(h −1 (u(He2n )) − â2n · x), b̂2n ∈ R e Ĥ2n = u −1 (h(â2n · x + b̂2n )) e 2n−1 · He2n , β2n ∈ R β2n = e H2n · (He2n )T e 2n · Hr2n+1 β2n+1 = r , β2n+1 ∈ R H2n+1 · (Hr2n+1 )T (4) Basic idea 1: our recent experimental results indicate that in B-ELM[14], output weight play a very minion role in the network learning effectiveness. Inspired by these experimental results, in this proposed method, we directly set output weight equal to unit matrix. N ∈ Rn × Rm Theorem 2: Given N training samples {(xi ,ti )}i=1 come from the same continuous function, given an SLFNs with any bounded nonconstant piecewise continuous function H : R → R for additive nodes or sine nodes, for any continues target function f , obtained error feedback function sequence Hen ,n ∈ Z , βn−1 )k = 0 holds with probability one if l i m n→∞ kf − ( f n−1 + Hen ·β βn−1 )−1 Hen = en−1 · (β (8) βn ∈ Rm×m β n = β n−1 = I,β (9) Proof: The validity of this theorem is obvious because β n−1 = I βn−1 )−1 = I, Hen equal to en−1 . And we can get ken k = 0. and (β Remark 2: When Hen = en−1 = T, it is easy to notice that the proposed method can reduce the network output error to 0. Thus the learning problem has been converted into finding optimal hidden node parameter (a,b) which lead to H(a,b,x) −→ T. Basic idea 2: For fixed output weight β equal to unit matrix or vector (β ∈ Rm×m ), seen from equation (8)-(9), to train an SLFN is simply equivalent to finding a least-square solution a−1 of the linear system H(a,x) = T. If activation function can be invertible, to train an SLFN is simply equivalent to pulling back residual error to input weight. For example, for N arbitrary distinct samples {x,T}, x ∈ RN×n ,T ∈ RN×m ,T ∈ [0,1], If activation function is sine function, to train an SLFN is simply equivalent to finding a leastsquare solution â of the linear system a · x = arcsin(T): kH(â1 ,· · · , ân ,x) − Tk = min kH(a1 ,· · · ,an ,x) − Tk a According to [16], the smallest norm least-squares solution of the above linear system is aˆn = arcsin(en−1 ) · x−1 . Based on this idea, we give the following theorem. Lemma 1: [1] Given a bounded nonconstant piecewise continuous function H : R → R, we have lim (5) (6) (7) where h −1 and u −1 represent its reverse function, respectively. if h is sine activation function, h −1 (·) = ar csi n(·); if h is sigmoid 1 activation function, h −1 (·) = −log( (·) − 1). Remark 1: Compared with B-ELM, In the proposed method, we only make two changes. The first one is we set β 1 = · · · = β n−1 = · · · = I. The second one is the pseudoinverse of input data x−1 has been changed as x−1 = xT (I+xxT )−1 based on the ridge regression theory. Although very small changes are made, the experimental results show that by using this proposed learning method, one hidden-node SLFNs without output weight (output weight β equal to unit matrix) can achieve similar generalization performance as other standard SLFNs with hundreds of hidden nodes. Further more, different from B-ELM [14] which only work for regression problem, the proposed method can be applied in regression and multi-classification applications. (10) (a,b)→(a 0 ,b0 ) kH(a · x + b) − H(a0 · x + b0 )k = 0 (11) Theorem 3: Given N arbitrary distinct samples {x,T},x ∈ RN×n ,T ∈ RN×m , given the sigmoid or sine activation function h, for any continuous desire output T, there exist limn→∞ kT − β1 +· · ·+Ĥn (ân , b̂n ,x)β βn k = 0 hold with probability one (Ĥ1 (â1 , b̂1 ,x)β if Hen = en−1 ân = h −1 (u(Hen )) · x−1 , ân ∈ Rn×m q b̂n = mse(h −1 (u(Hen )) − ân · x) , b̂n ∈ Rm (12) β1 = β 2 = · · · = βn = I Ĥn = u −1 (h(ân · x + b̂n )) (13) where if activation function h is sin/cos, given a normalized function u : R → [0,1]; If activation function h is sigmoid, given a normalized function u : R → (0,1]. h −1 and u −1 represent its reverse function, respectively. If h is sine activation function, h −1 (·) = arcsin(u(·); if h is sigmoid activation function, h −1 (·) = 1 − 1), x−1 = xT (I + xxT )−1 . −log( u(·) Proof: For an activation function h(x) : R → R, Hen is given by Hen = h(λn ) (14) 3 In order to let λ2n ∈ Rm , here we give a normalized function u(·): u(H) ∈ [0,1] if activation function is sin/cos; u(H) ∈ (0,1) if activation function is sigmoid. Then for sine hidden node λ2n = h −1 (u(Hen )) = (ar csi n(u(H en )) (15) For sigmoid hidden node λn = h −1 (u(Hen )) = −log( 1 − 1) u(Hen ) (16) let λn = an · x, for sine activation function, we have ân = h −1 (u(Hen )) · x−1 = ar csi n(u(H en )) · x−1 1 − 1) · x −1 u(Hen ) (17) (18) where x−1 is the Moore-Penrose generalized inverse of the given set of training examples[15]. Similar to [16], we have 1: ân = ar csi n(u(H en )) · x−1 is one of the least-squares solutions of a general linear system an · x = λn , meaning that the smallest error can be reached by this solution: kân · x − λn k = kân x−1 x − λn k = min kan · x − ar csi n(u(H en ))k (19) an 2: the special solution ân = h −1 (u(Hen ))·x−1 has the smallest norm among all the least-squares solutions of an · x = λn , which is guarantee that an ∈ [−1,1]. Although the smallest error can be reached by equation (17)-(18), we still can reduce its error by adding bias bn . For sine activation function: q b̂n = mse(h −1 (u(Hen )) − aˆn · x) q (20) = mse(ar csi n(u(H en )) − aˆn · x) For sigmoid activation function q b̂n = mse(h −1 (u(Hen )) − aˆn · x) q = mse((−log(1/u(Hen ) − 1)) − ân · x) (21) According to 19 and Lemma 1, we have min ku −1 (h(an · x)) − u −1 (h(λn ))k an = ku −1 (h(ân · x)) − u −1 (h(λn ))k > ku −1 (h(ân · x + b̂n )) − u −1 (22) (h(λn ))k = kσk We consider the residual error as =kHen k2 ( 2βn 〈e n−1 ,Hen 〉 kHen k2 (23) − β2n ) e Ĥn = u −1 (h(ân · x + b̂n )) en−1 − σ (24) βn ên−1 = β n−1 Because β n = β n−1 = I, we have equation (23) ≥ 0 is still valid for e △ = kĤn k2 ( βn k〈ên−1 , βên−1 〉 2kβ n−1 ê k βn−1 k2 βn k2 ) − kβ e 2kên−1 k2 kên−1 k2 βn−1 k2 kβ e = kĤn k2 β 2n ≥ 0 β2n ) −β where u is a normalized function, ai ∈ Rn×m ,bi ∈ Rm . Here, the proposed the proposed method for SLFN can be summarized in Algorithm 1. Algorithm 1 the proposed method algorithm N ⊂ Rn × Rm ,the Initialization: Given a training set {(xi ,ti )}i=1 hidden-node output function H(a,b,x), continuous target function f , set number of hidden nodes L = 1, e = T. Learning step: while L < L max do Increase by one the number of hidden nodes L;L = L + 1; Step 1) set HeL = e; Step 2) calculate the input weight aL , bias bL based on equation 12; Step 3) calculate e after adding the new hidden node L: e = e − u −1 (h(a · x + b)) end while Remark 4: Different from other neural network learning methods in which output weight parameter should be adjusted, in the proposed method, the output weight of SLFNs can be equal to unit matrix and thus the proposed neural network does not need output weight at all. Thus the architecture and computational cost of this proposed method are much smaller than other traditional SLFNs. Remark 5: Subsection V.C presents experiments which show that the proposed method with only one hidden node can give better generalization performance than the proposed network with L(L > 1) hidden node. Based on this experimental results, for N arbitrary distinct samples (xi ,ti ) where xi = [xi1 , xi2 ,· · · , xi N ]T ∈ Rn and ti ∈ Rm , the proposed network is mathematically modeled as (27) where u is a normalized function, a1 ∈ Rn×m ,b1 ∈ Rm . Thus algorithm 1 can be modified as algorithm 2. N ⊂ Rn × Rm ,the Initialization: Given a training set {(xi ,ti )}i=1 hidden-node output function H(a,b,x), continues target function f , set number of hidden nodes L = 1. Learning step: Step 1) set He1 = T; Step 2) calculate the input weight a1 , bias b1 based on equation 12; V. E XPERIMENTAL V ERIFICATION n−1 = kĤn k2 ( (26) i=1 Algorithm 2 the proposed method algorithm Let = L X u −1 (h(ai · x j + bi )), j = 1,· · · , N f L (x) = u −1 (h(a1 · x j + b1 )), j = 1,· · · , N △ =ke n−1 k2 − ke n−1 − Hen · βn k2 =2βn 〈e n−1 ,Hen 〉 − kHen k2 · β2n Remark 3: According to Theorem 2-3, for N arbitrary distinct samples (xi ,ti ) where xi = [xi1 , xi2 ,· · · , xi N ]T ∈ Rn and ti ∈ Rm , the proposed network with L hidden nodes and activation function h(x) are mathematically modeled as f L (x) = For sigmoid activation function, we have ân = h −1 (u(Hen )) · x−1 = −log( Now based on equation 25, we have ken−1 k ≥ ken k, so the sequence ken k is decreasing and bounded below by zero and the sequence ken k converges. (25) To examine the performance of our proposed algorithm (BELM), in this section, we test them on some benchmark regression and classification problems. Neural networks are tested in SVR, SVM, BP, EM-ELM,I-ELM, EI-ELM, B-ELM, ELM and proposed the proposed method. 4 TABLE I S PECIFICATION OF REGRESSION PROBLEMS Datasets #Attri #Train # Test Auto MPG Machine CPU Fried Wine Quality Puma California Housing House 8L Parkinsons motor Parkinsons total Puma Delta elevators Abalone 8 6 11 12 9 8 9 26 26 9 6 9 200 100 20768 2898 4500 16000 16000 4000 4000 6000 6000 3000 192 109 20000 2000 3692 4000 6784 1875 1875 2192 3000 1477 SPECIFICATION OF TABLE II S MALL /M EDIUM - SIZED CL ASSIFICATION PROBLEMS Datasets #Feature #Train # Test A9a colon-cancer USPS Sonar Hill Valley Protein 123 2000 256 60 101 357 32561 40 7291 150 606 17766 16281 22 2007 58 606 6621 TABLE III SPECIFICATION OF L ARGE - SIZED CL ASSIFICATION PROBLEMS Datasets #Feature #Train # Test Covtype.binary Mushrooms Gisette Leukemia Duke Connect-4 Mnist DNA w3a 54 112 5000 7129 7129 126 780 180 300 300000 4000 6000 38 29 50000 40000 1046 4912 280000 4122 1000 34 15 17557 30000 1186 44837 A. Benchmark Data Sets In order to extensively verify the performance of different algorithms, wide type of data sets have been tested in our simulations, which are of small size, medium dimensions, large size, and/or high dimensions. These data sets include 12 regression problems and 15 classification problems. Most of the data sets are taken from UCI Machine Learning Repository3 and LIBSVM DATA SETS 4 . Regression Data Sets: The 12 regression data sets(cf.Table I)can be classified into two groups of data: 1) data sets with relatively small size and low dimensions, e.g., Auto MPG, Machine CPU, Puma, Wine, Abalone; 2) data sets with relatively medium size and low dimensions, e.g., Delta, Fried, California Housing, Parkinsons; Classification Data Sets: The 15 classification data sets(cf.Table II and Table III) can be classified into three groups of data: 1) data sets with relative medium size and medium dimensions, e.g., Sonar, Hill Valley, Wa3, DNA, Mushrooms, A9a, USPS; 2) data sets with relative small size and high dimensions, e.g., Colon-cancer, Leukemia, Duke; 3) data sets with relative large size and high dimensions, e.g., Protein, Covtype.binary, Gisette, Mnist, Connect-4; In these data sets, the input data are normalized into [−1,1] while the output data for regression are normalized into the range [0,1]. All data sets have been preprocessed in the same way (heldout method). Ten different random permutations of the whole data set are taken without replacement, and some(see in tables) are used to create the training set and the remaining is used for the test set. The average results are obtained over 50 trials for all problems. B. Simulation Environment Settings The simulations of different algorithms on the data sets which are shown in Table I and Table II are carried out in Matlab 2009a environment running on the same Windows 7 machine with at 2 GB of memory and an i5-430 (2.33G) processor. The codes used for SVM and SVR are downloaded from LIBSVM5 , The codes used for B-ELM, ELM and I-ELM are downloaded from ELM6 . For SVM and SVR, in order to achieve good generalization performance, the cost parameter C and kernel parameter γ of SVM and SVR need to be chosen appropriately. We have tried a wide range of C and γ. For each data set, similar to [17], we have used 30 different value of C and γ, resulting in a total of 900 pairs of (C ,γ). The 30 different value of C and γ are {2−15 ,2−14 ,· · · ,214 ,215 }. Average results of 50 trials of simulations with each combination of (C ,γ) are obtained and the best performance obtained by SVM/SVR are shown in this paper. For BP, the number of hidden nodes are gradually increased by an interval of 5 and the nearly optimal number of nodes for BP are then selected based on cross-validation method. Average results of 50 trails of simulations for each fixed size of SLFN are obtained and finally the best performance obtained by BP are shown in this paper as well. Simulations on large data sets(cf.Table III) are carried out in a high-performance computer with Intel Xeon E3-1230 v2 processor (3.2G) and 16-GB memory. C. Generalization performance comparison of ELM methods with different hidden nodes The aim of this subsection is to show that the proposed method with only one hidden node generally achieves better generalization performance than other learning methods. And it is also to show that the proposed method with one hidden node achieves the best performance than the proposed method with L,L > 1 one hidden node. In this subsection, I-ELM, ELM, EI-ELM and the proposed method are compared in one regression problem and three classification problems: Fried, DNA, USPS and Mushroom. In these cases, all the algorithms increase the hidden nodes one by one. More importantly, we find that the testing accuracy obtained by proposed method is reduced to a very high value when only one hidden node is used. And the testing accuracy obtained by proposed method is not increased but is reduced when hidden node added one by one. This means the proposed method only need to calculates one-hidden-node parameter(a1 ,b1 ) once and then SLFNs without output weight can achieve similar generalization performance as other learning method with hundreds of hidden nodes. Thus in the following experiments, the number of hidden node equal to one in the proposed method. 3 http://archive.ics.uci.edu/ml/datasets.html 5 http://www.csie.ntu.edu.tw/ cjlin/libsvmtools/datasets/ 4 http://www.csie.ntu.edu.tw/ cjlin/libsvmtools/datasets/ 6 http://www.ntu.edu.sg/home/egbhuang/elm_codes.html 5 TABLE IV P ERFORMANCE COMPARISON ( MEAN - MEAN TESTING RMSE; TIME - TRAINING TIME ) Datasets House 8L Auto MPG Machine CPU Fried Delta ailerons PD motor PD total Puma Delta ele Abalone Wine California house I-ELM (200 nodes) B-ELM (200 nodes) EI-ELM (200 nodes, p = 50) the proposed method (1 nodes) Mean time(s) Mean time(s) Mean time(s) Mean time(s) 0.0946 0.1000 0.0591 0.1135 0.0538 0.2318 0.2178 0.1860 0.1223 0.0938 0.1360 0.1801 1.1872 0.2025 0.1909 0.8327 0.4680 0.4639 0.4678 0.5070 0.5313 0.3398 0.3516 1.1482 0.0818 0.0920 0.0554 0.0857 0.0431 0.2241 0.2137 0.1832 0.1156 0.0808 0.1264 0.1450 3.8821 0.3732 0.3469 5.5063 1.3946 4.7680 4.9278 2.1846 1.6206 1.2549 1.7098 7.2625 0.0850 0.0918 0.0551 0.0856 0.0417 0.2251 0.2124 0.1830 0.1155 0.0848 0.1266 0.1505 10.7691 1.3004 1.2633 7.4016 3.5478 3.9016 3.7854 4.2161 4.0240 2.6676 2.7126 12.0832 0.0819 0.0996 0.0489 0.0834 0.0453 0.2210 0.2136 0.1808 0.1174 0.0828 0.1250 0.1420 0.0020 <0.0001 <0.0001 0.0051 <0.0001 0.0037 0.0023 0.0012 <0.0001 0.0017 0.0031 0.0078 TABLE V P ERFORMANCE COMPARISON ( MEAN - MEAN TESTING RMSE; TIME - TRAINING TIME ) Datasets EM-ELM (200 nodes) House 8L Auto MPG Machine CPU Fried Delta ailerons PD motor PD total Puma Abalone Wine California house ELM (200 nodes) the proposed method (1 nodes) Mean time(s) Mean time(s) Mean time(s) 0.0663 0.0968 0.0521 0.0618 0.0421 0.2196 0.2094 0.1478 0.0817 0.1216 0.1302 7.0388 0.0075 0.1385 18.0290 0.1342 0.7394 0.5944 4.8392 0.1638 0.3806 3.5574 0.0718 0.0976 0.0513 0.0619 0.0431 0.2190 0.2076 0.1602 0.0824 0.1229 0.1354 0.8369 0.0156 0.0069 1.3135 0.0616 0.2730 0.2838 0.3728 0.0761 0.1950 0.9753 0.0819 0.0996 0.0489 0.0834 0.0453 0.2203 0.2136 0.1808 0.0828 0.1250 0.1420 0.0020 <0.0001 <0.0001 0.0051 <0.0001 0.0037 0.0023 0.0012 0.0017 0.0031 0.0078 TABLE VII P ERFORMANCE COMPARISON ( MEAN - MEAN TESTING RMSE; TIME - TRAINING TIME ) Datasets Eplison-SVR House 8L Auto MPG Machine CPU Fried Delta ailerons California house PD total BP the proposed method (1 nodes) Mean time(s) Mean time(s) Mean time(s) 0.0799 0.0985 0.0727 0.0829 0.0402 0.1529 0.2082 53.6531 0.0234 0.0187 197.9534 6.8718 35.2250 7.2540 0.0790 0.0953 0.0843 0.0591 0.0415 0.1435 0.2120 27.8462 1.6034 0.7129 81.8774 12.6735 54.3081 12.6438 0.0819 0.0996 0.0489 0.0834 0.0453 0.1420 0.2136 0.0020 <0.0001 <0.0001 0.0051 <0.0001 0.0078 0.0023 TABLE VIII P ERFORMANCE COMPARISON ( MEAN - MEAN TESTING RMSE; TIME - TRAINING TIME ) Datasets Covtype.binary Mushrooms Gisette Leukemia W3a Duke Connect-4 Mnist DNA SVM ELM the proposed method (1 nodes) Mean time(s) Mean time(s) #node Mean time(s) 74.84% 86.90% 77.68% 82.58% 97.18% 86.36% 66.01% 70.85% 93.70% 413.5275 38.6247 309.3968 2.3914 4.5552 0.0156 569.6221 478.4707 0.4680 77.27% 46.97% 88.69% 76.47% 97.25% 79.27% 76.55% 91.60% 84.94% 36.5947 0.9126 6.4093 9.0340 0.9095 7.8437 7.3757 8.1651 0.2122 500 500 500 5000 500 5000 500 500 500 76.55% 88.84% 94.10% 85.29% 98.17% 92.67% 75.40% 84.20% 92.41% 1.2043 0.0047 48.2027 20.9915 0.1872 20.0352 0.7597 8.8858 0.0187 D. Real-world regression problems The experimental results between proposed the proposed method and some other incremental ELMs (B-ELM, I-ELM, and EI-ELM) are given in Table IV-Table V. In these tables, the close results obtained by different algorithms are underlined and the apparent better results are shown in boldface. All the incremental ELMs (I-ELM, B-ELM, EI-ELM) increase the hidden nodes one by one till nodes-numbers equal to 200, while for fixed ELMs (ELM, EM-ELM), 200-hidden-nodes are used. It can be seen that the 6 TABLE IX P ERFORMANCE COMPARISON ( MEAN - MEAN TESTING RMSE; TIME - TRAINING TIME ) Datasets A9a Colon USPS Sonar Hill Valley Protein SVM ELM the proposed method (1 nodes) Mean time(s) Mean time(s) #node Mean time(s) 77.39% 76.67% 94.65% 86.29% 58.67% 51.18% 295.0603 10.0156 146.4942 0.0172 0.1295 253.5796 85.10% 80.67% 93.54% 80.86% 64.31 67.09% 4.5871 11.6283 2.0639 0.0686 0.1647 5.0919 500 5000 500 500 500 500 85.57% 85.06% 88.86% 75.69% 67.61% 68.76% 0.5714 0.9719 0.4898 <0.0001 0.0047 1.9953 TABLE VI P ERFORMANCE COMPARISON ( MEAN - MEAN TESTING RMSE; TIME - TRAINING TIME ) better results are shown in boldface. As seen from those simulation results given in these tables, the proposed method can always achieve comparable performance as SVM and ELM with much Datasets ELM (1 nodes) the proposed method (1 nodes) faster learning speed. Take Covtype.binary (large number of training samples with medium input dimensions) and Gisette (medium Mean time(s) Mean time(s) number of training samples with high input dimensions). House 8L 0.1083 0.0009 0.0819 0.0020 1) For Covtype.binary data set, the proposed method runs 1403 Auto MPG 0.2126 < 0.0001 0.0996 <0.0001 times and 35 times faster than ELM and SVM, respectively. Machine CPU 0.1331 <0.0001 0.0489 <0.0001 2) For Gisette data set, the proposed method runs 341 times Fried 0.2207 0.0031 0.0834 0.0051 Delta ailerons 0.0864 <0.0001 0.0453 <0.0001 and 1.7 times faster than ELM and SVM, respectively. PD motor 0.2620 0.0020 0.2210 0.0037 Huang et al.[1][18][16][13] have systematically investigated the PD total 0.2548 0.0007 0.2136 0.0023 performance of ELM, SVM/SVR and BP for most data sets tested 0.1808 0.0012 Puma 0.2856 0.0012 in this work. It is found that ELM obtain similar generalization Delta ele 0.1454 <0.0001 0.1174 <0.0001 Abalone 0.1363 0.0007 0.0828 0.0017 performance as SVM/SVR but in much simpler and faster way. Wine 0.1750 0.0006 0.1250 0.0031 Similar to those above works, our testing results(cf. Table VII-IX) California house 0.2496 0.0027 0.1420 0.0078 shows that the proposed the proposed method always provide comparable performance as SVM/SVR and BP with much faster learning speed. proposed method can always achieve similar performance as other On the other hand, the proposed method requires none human ELMs with much higher learning speed. In Table IV, for Machine intervention than SVM, BP and other ELM methods. Different CPU problem, the the proposed method runs 1900 times, 3400 from SVM which is sensitive to the combinations of parameters times, 12000 times faster than the I-ELM, B-ELM and EI-ELM, (C ,γ), or from other ELM methods in which parameter C needs to respectively. For Abalone problem, the proposed method runs 200 be specified by users, the proposed method have none specified times, 700 times, 1600 times faster than I-ELM, B-ELM and EI- parameter and is ease of use in the respective implementations. ELM, respectively. In Table V, for Wine problem, the the proposed VI. C ONCLUSION method runs 120 times and 60 times faster than EM-ELM and ELM, respectively. and the testing RMSE of EI-ELM is 2 times larger Unlike other SLFN learning methods, in our new approach, than the testing RMSE of B-ELM. The B-ELM runs 1.5 times faster one may simply calculate the hidden node parameter once and than the I-ELM and the testing RMSE for the obained I-ELM is 5 the output weight is not need at all. And it has been rigorously times larger than the testing RMSE for B-ELM. proved that the proposed method can greatly enhance the learning If only 1-hidden-node being used, those ELM methods such effectiveness, reduce the computation cost, and eventually further as I-ELM, ELM, EM-ELM and B-ELM can be considered as the increase the learning speed. The simulation results on sigmoid same learning method (ELM[13]). Thus in Table VI, we carried out type of hidden nodes show that compared to other learning performance comparisons between the proposed method and 1- methods including SVM/SVR, BP and ELMs, the new approach hidden-node ELM. As observed from Table VI, the average testing can significantly reduce the NN training time several to thousands RMSE obtained by the proposed method are much better than of times and can applied in regression and classification problems. the ELM. For California house and Delta ailerons problem, the Thus this method can be used efficiently in many applications. testing RMSE obtained by ELM runs 2 times larger than that of However, we find an interesting phenomenon which we are not the proposed method. In real applications, SLFNs with only 1 able to prove in this method, which should be worth pointing out. hidden nodes is extremely small network structure, meaning that Experimental results show that this proposed learning method after trained this small size network may response to new external with one hidden node can achieve better generalization perforunknown stimuli much faster and much more accurate than other mance than the same method with L,L > 1 hidden nodes. This ELM algorithms in real deployment. phenomenon of this proposed method bring about many advantages, but if researchers can find the nature of this phenomenon, it can have far reaching consequences on the generalization ability E. Real-world classification problems In order to indicate the advantage of the B-ELM on classification of neural network. performance, the testing accuracy between the proposed the proposed method and other algorithms has also been conducted. Table VIII and IX display the performance comparison of SVM, ELM and the proposed method. In these tables, the close results obtained by different algorithms are underlined and the apparent R EFERENCES [1] Guang-Bin Huang, Lei Chen, and Chee-Kheong Siew. Universal approximation using incremental constructive feedforward networks with random hidden nodes. IEEE Transactions on Neural Networks, 17(4):879–892, 2006. [1, 2, 6] 7 [2] Herbert Jaeger. A tutorial on training recurrent neural networks , covering BPPT , RTRL , EKF and the " echo state network " approach. 2002:1–46, 2005. [1] [3] G. B. Huang, P. Saratchandran, and N. Sundararajan. An efficient sequential learning algorithm for growing and pruning rbf (gap-rbf) networks. IEEE Transactions on Systems Man and Cybernetics Part B-cybernetics, 34(6):2284–2292, December 2004. [1] [4] Guang-Bin Huang. Learning capability and storage capacity of twohidden-layer feedforward networks. IEEE Transactions on Neural Networks, 14(2):274–281, 2003. [1] [5] Rui Zhang, Yuan Lan, Guang-Bin Huang, and Zong-Ben Xu. Universal approximation of extreme learning machine with adaptive growth of hidden nodes. IEEE Transactions on Neural Networks and Learning Systems, 23(2):365–371, February 2012. [1] [6] B. Igelnik and Y. H. Pao. Stochastic choice of basis functions in adaptive function approximation and the functional-link net. IEEE transactions on neural networks / a publication of the IEEE Neural Networks Council, 6(6):1320–9, 1995. [1] [7] Y. H. PAO, G. H. PARK, and D. J. SOBAJIC. Learning and generalization characteristics of the random vector functional-link net. Neurocomputing, 6(2):163–180, April 1994. [1] [8] D.S.Broomhead and D.Lowe. Multivariable functional interpolation and adaptive networks. Complex Systems, 2:321–355, 1988. [1] [9] Guang-Bin Huang, Qin-Yu Zhu, and Chee-Kheong Siew. Extreme learning machine. In Technical Report ICIS/03/2004 (also in http://www.ntu.edu.sg/eee/icis/cv/egbhuang.htm), School of Electrical and Electronic Engineering, Nanyang Technological University, Singapore, January 2004. [1] [10] Ming-Bin Li, Guang-Bin Huang, P. Saratchandran, and Narasimhan Sundararajan. Fully complex extreme learning machine. Neurocomputing, 68:306–314, 2005. [1] [11] Guang-Bin Huang and Chee-Kheong Siew. Extreme learning machine with randomly assigned RBF kernels. International Journal of Information Technology, 11(1):16–24, 2005. [1] [12] Guang-Bin Huang, Qin-Yu Zhu, and Chee-Kheong Siew. Realtime learning capability of neural networks. In Technical Report ICIS/45/2003, School of Electrical and Electronic Engineering, Nanyang Technological University, Singapore, April 2003. [1] [13] G. B. Huang, H. M. Zhou, X. J. Ding, and R. Zhang. Extreme learning machine for regression and multiclass classification. IEEE Transactions on Systems Man and Cybernetics Part B-cybernetics, 42(2):513–529, April 2012. [1, 6] [14] Y. M. Yang, Y. N. Wang, and X. F. Yuan. Parallel chaos search based incremental extreme learning machine. Neural Processing Letters, 37(3):277–301, June 2013. [1, 2] [15] A. E. Hoerl and R. W. Kennard. Ridge regression: Biased estimation for nonorthogonal problems. Technometrics, 42(1):80–86, February 2000. [3] [16] Guang-Bin Huang, Qin-Yu Zhu, and Chee-Kheong Siew. Extreme learning machine: Theory and applications. Neurocomputing, 70:489– 501, 2006. [3, 6] [17] C. W. Hsu and C. J. Lin. A comparison of methods for multiclass support vector machines. IEEE Transactions on Neural Networks, 13(2):415–425, March 2002. [4] [18] Guorui Feng, Guang-Bin Huang, Qingping Lin, and Robert Gay. Error minimized extreme learning machine with growth of hidden nodes and incremental learning. IEEE Transactions on Neural Networks, 20(8):1352–1357, 2009. [6]
9cs.NE
Overcoming Catastrophic Forgetting with Hard Attention to the Task Joan Serrà 1 Dı́dac Surı́s 1 2 Marius Miron 1 3 Alexandros Karatzoglou 1 arXiv:1801.01423v2 [cs.LG] 14 Feb 2018 Abstract Catastrophic forgetting occurs when a neural network loses the information learned in a previous task after training on subsequent tasks. This problem remains a hurdle for artificial intelligence systems with sequential learning capabilities. In this paper, we propose a task-based hard attention mechanism that preserves previous tasks’ information without affecting the current task’s learning. A hard attention mask is learned concurrently to every task, through stochastic gradient descent, and previous masks are exploited to condition such learning. We show that the proposed mechanism is effective for reducing catastrophic forgetting, cutting current rates by 45 to 80%. We also show that it is robust to different hyperparameter choices, and that it offers a number of monitoring capabilities. The approach features the possibility to control both the stability and compactness of the learned knowledge, which we believe makes it also attractive for online learning or network compression applications. 1. Introduction With the renewed interest in neural networks, old problems re-emerge, specially if the solution is still open. That is the case with the so-called catastrophic forgetting or catastrophic interference problem (McCloskey & Cohen, 1989; Ratcliff, 1990). In essence, catastrophic forgetting corresponds to the tendency of a neural network to forget what it learned upon learning from new or different information. For instance, when a network is first trained to convergence on one task, and then trained on a second task, it forgets how to perform the first task. Overcoming catastrophic forgetting is an important step in the advancement towards more general artificial intelligence systems (Legg & Hutter, 2007). Such systems 1 Telefónica Research, Barcelona, Spain 2 Universitat Politècnica de Catalunya, Barcelona, Spain 3 Universitat Pompeu Fabra, Barcelona, Spain. Correspondence to: Joan Serrà <[email protected]>. Ongoing work. Preprint. should be able to seamlessly remember different tasks, and to learn them sequentially, following a lifelong learning paradigm (Thrun & Mitchell, 1995). Apart from being more biologically plausible (Clegg et al., 1998), there are many practical situations which require a sequential learning system (cf. Thrun & Mitchell, 1995). For instance, it may be unattainable for a robot to retrain from scratch its underlying model upon encountering a new object/task. After accumulating a large number of objects/tasks and their corresponding information, performing concurrent or multitask learning at scale may be too costly. Storing previous information and using it to retrain the model was among the earliest attempts to overcome catastrophic forgetting; a strategy named “rehearsal” (Robins, 1995). The use of memory modules in this context has been a subject of research until today (Rebuffi et al., 2017; Lopez-Paz & Ranzato, 2017). However, due to efficiency and capacity constrains, memory-free approaches were also introduced, starting with what was termed as “pseudorehearsal” (Robins, 1995). This approach has found some success in transfer learning situations where one needs to maintain a certain accuracy on the source task after learning the target task (Jung et al., 2016; Li & Hoiem, 2017). Within the pseudo-rehearsal category, we could also consider recent approaches that substitute the memory module by a generative network (Venkatesan et al., 2017; Shin et al., 2017; Nguyen et al., 2017). Besides the difficulty of training a generative network for a sequence of tasks or certain types of data, both rehearsal and pseudo-rehearsal approaches imply some form of concurrent learning, that is, having to re-process ‘old’ instances for learning a new task. The other popular strategy to overcome catastrophic forgetting is to reduce representational overlap (French, 1991). This can be done at the output, intermediate, and also input levels (Gutsein & Stump, 2015; He & Jaeger, 2018). A clean way of doing that in a soft manner is through so-called “structural regularization” (Zenke et al., 2017), either present in the loss function (Kirkpatrick et al., 2017; Zenke et al., 2017) or at a separate merging step (Lee et al., 2017). With these strategies, one seeks to prevent major changes in the weights that were important for previous tasks. Dedicating specific sub-parts of the network for each task is another way of reducing representational overlap (Rusu et al., 2016; Fernando et al., 2017; Yoon et al., 2018). The main trade- Overcoming Catastrophic Forgetting with Hard Attention to the Task off in representational overlap is to effectively distribute the capacity of the network across tasks while maintaining important weights and reusing previous knowledge. In this paper, we propose a task-based hard attention mechanism that maintains the information from previous tasks without affecting the learning of a new task. Concurrently to learning a task, we also learn almost-binary attention vectors through gated task embeddings, using backpropagation and minibatch stochastic gradient descent (SGD). The attention vectors of previous tasks are used to define a mask and constrain the updates of the network’s weights on current tasks. Since masks are almost binary, a portion of the weights remains static while the rest adapt to the new task. We call our approach hard attention to the task (HAT). We evaluate HAT in the context of image classification, using what we believe is a high-standard evaluation protocol: we consider random sequences of 8 publicly-available data sets representing different tasks, and compare with a dozen of recent competitive approaches. We show favorable results in 4 different experimental setups, cutting current rates by 45 to 80%. We also show robustness with respect to hyperparameters and illustrate a number of monitoring capabilities. We make the code for all experiments publicly-available1 . 2. Putting Hard Attention to the Task 2.1. Motivation The primary observation that drives the proposed approach is that the task definition or, more pragmatically, its identifier, is crucial for the operation of the network. Consider the task of discriminating between bird and dog images. When training the network to do so, it may learn some set of intermediate features. If the second task is to discriminate between brown and black animals using the same data (assuming it only contained birds and dogs that were either brown or black), the network may learn a new set of features, some of them with not much overlap with the first ones. Thus, if training data is the same in both tasks, one important difference should be the task description or identifier. Our intention is to learn to use the task identifier to condition every layer, and to later exploit this learned conditioning to prevent forgetting previous tasks. 2.2. Architecture To condition to the current task t, we employ a layer-wise attention mechanism (Fig. 1, top). Given the output of the units2 of layer l, hl , we element-wise multiply h0l = atl hl . However, an important difference with common attention 1 Code is attached in a ZIP file as Supplementary Material. In the remaining of the paper, we will use ‘units’ to refer to both linear units (or fully-connected neurons) and convolutional filters. HAT can be extended to any parametric layer. 2 Figure 1. Schematic diagram of the proposed approach: forward (top) and backward (bottom) passes. mechanisms is that, instead of forming a probability distribution, atl is a gated version of a task embedding vector etl ,  atl = σ setl , (1) where σ(x) ∈ [0, 1] is a gate function and s is a positive scaling parameter. We use a sigmoid gate in our experiments, but note that other gating mechanisms could be used. All layers l = 1, . . . L − 1 operate equally except the last one, layer L, where atL is binary hard-coded. The operation of layer L is equivalent to a multi-head output (Bakker & Heskes, 2003), which is routinely employed in the context of catastrophic forgetting (for example Rusu et al., 2016; Li & Hoiem, 2017; Nguyen et al., 2017). The idea behind the gating mechanism of Eq. 1 is to form hard, possibly binary attention masks which, act as “inhibitory synapses” (McCulloch & Pitts, 1943), and can thus activate or deactivate the output of the units of every layer. In this way, and similar to PathNet (Fernando et al., 2017), we dynamically create and destroy paths across layers that can be later preserved when learning a new task. However, unlike PathNet, the paths in HAT are not based on modules, but on single units. Therefore, we do not need to pre-assign a module size nor to set a maximum number of modules per task. Given some network architecture, HAT learns and automatically dimensions individual-unit paths, which ultimately affect individual layer weights. Furthermore, instead of learning paths in a separate stage using genetic algorithms, HAT learns them together with the rest of the network, using backpropagation and SGD. Overcoming Catastrophic Forgetting with Hard Attention to the Task 2.3. Network Training To preserve the information learned in previous tasks upon learning a new task, we condition the gradients according to the cumulative attention from all the previous tasks. To obtain a cumulative attention vector, after learning task t and obtaining atl , we recursively compute   t ≤t−1 a≤t , l = max al , al using element-wise maximum and the all-zero vector for a≤0 l . This preserves the attention values for units that were important for previous tasks, allowing them to condition the training of future tasks. To condition the training of task t + 1, we modify the gradient gl,ij at layer l with the reverse of the minimum of the cumulative attention in the current and previous layers: h  i ≤t 0 gl,ij = 1 − min a≤t , a gl,ij , (2) l,i l−1,j where the unit indices i and j correspond to the output (l) and input (l − 1) layers, respectively. In other words, ≤t we expand the vectors a≤t l and al−1 to match the dimensions of the gradient tensor of layer l, and then perform a element-wise minimum, subtraction, and multiplication (Fig. 1, bottom). We do not compute any attention over the input data if this consists of complex signals like images or audio. However, in the case such data consisted of separate or independent features, one could also consider them as the output of some layer and apply the same methodology. Note that, with Eq. 2, we create masks to prevent large updates to the weights that were important for previous tasks. This is similar to the approach of PackNet (Mallya & Lazebnik, 2017), which was made public during the development of HAT. In PackNet, after an heuristic selection and retraining, a binary mask is found and later applied to freeze the corresponding network weights. In this regard, HAT differs from PackNet in three important aspects. Firstly, our mask is unit-based, with weight-based masks automatically derived from those. Therefore, HAT also stores and maintains a lightweight structure. Secondly, our mask is learned, instead of heuristically- or rule-driven. Therefore, HAT does not need to pre-assign compression ratios nor to determine parameter importance through a post-training step. Thirdly, our mask is not necessarily binary, allowing intermediate values between 0 and 1. This can be useful if we want to reuse weights for learning other tasks, at the expense of some forgetting, or we want to work in a more online mode, forgetting the oldest tasks to remember new ones. 2.4. Hard Attention Training To obtain a totally binary attention vector atl , one could use a unit step function as gate. However, since we want to train the embeddings etl with backpropagation (Fig. 1), we prefer a differentiable function. To construct a pseudo-step function that allows the gradient to flow, we use a sigmoid with a positive scaling parameter s (Eq. 1). This scaling is introduced to control the polarization, or ‘hardness’, of the pseudo-step function and the resulting output atl . Our strategy is to anneal s during training, inducing a gradient flow, and set s = smax during testing, using smax  1 such that Eq. 1 approximates a unit step function. Notice that when s → ∞ we get atl,i → {0, 1}, and that when s → 0 we get atl,i → 1/2. We will use the latter to start a training epoch with all network units being equally active, and progressively polarize them within the epoch. During a training epoch, we incrementally linearly anneal the value of s by   1 1 b−1 s= + smax − , (3) smax smax B − 1 where b = 1, . . . B is the batch index and B is the total number of batches in an epoch. The hyperparameter smax ≥ 1 controls the stability of the learned tasks or, in other words the plasticity of the network’s units. If smax is close to 1, the gating mechanism operates like a regular sigmoid function, without particularly enforcing the binarization of atl . This provides plasticity to the units, with the model being able to forget previous tasks at the backpropagation stage (Sec. 2.3). If, alternatively, smax is a larger number, the gating mechanism starts operating as a unit step function. This provides stability with regard to previously learned tasks, preventing changes in the corresponding weights at the backpropagation stage. 2.5. Embedding Gradient Compensation In preliminary analysis, we empirically observed that embeddings etl were not changing much, and that the magnitude of the gradient was weak on those weights. After some investigation, we realized that the major part of the problem was due to the introduced annealing scheme (Eq. 3). To illustrate the effect of the annealing scheme on the gradients of etl , consider a uniformly distributed embedding etl,i across the active range of a standard sigmoid, etl,i ∈ [−6, 6]. If we do not perform any annealing and set s = 1, we obtain a cumulative gradient after one epoch that has a bell-like shape and spans the whole sigmoid range (Fig. 2). Contrastingly, if we set s = smax , we obtain a much larger magnitude, but in a much lower range (etl,i ∈ [−1, 1] in Fig. 2). The annealed version of s yields a distribution in-between, with a lower range than s = 1 and a lower magnitude than s = smax . A desirable situation would be to have a wide range, ideally spanning the range of s = 1, and a large cumulative magnitude, ideally proportional to the one in the active region when s = smax . To achieve that, we apply a gradient compensation before updating etl . Overcoming Catastrophic Forgetting with Hard Attention to the Task Cumulative ql, i Constant s = 1 Constant s = smax Annealed s Compensated −6 −4 −2 0 el,t i 2 4 6 Figure 2. Illustration of the effect that annealing s has on the gradient q of et . In essence, the idea of the embedding gradient compensation is to remove the effects of the annealed sigmoid and to artificially impose the desired range and magnitude motivated in the previous paragraph. To do so, we divide the gradient ql,i by the derivative of the annealed sigmoid, and multiply by the desired compensation,  h  i smax σ etl,i 1 − σ etl,i 0  h  i ql,i , ql,i = sσ setl,i 1 − σ setl,i which, after operating, yields h   i smax cosh setl,i + 1 0 h   i ql,i . ql,i = s cosh etl,i + 1 The use of L1 regularization to promote network sparsity in the context of catastrophic forgetting has also been considered by Yoon et al. (2018) with dynamically expandable networks (DEN), which were introduced while developing HAT. In DEN, plain L1 regularization is combined with a considerable set of heuristics such as L2-transfer, thresholding, and a measure of “semantic drift”, and is applied to all network weights in the so-called “selective retraining” phase. In HAT, we use an attention-weighted L1 regularization over attention values, which is an independent part of the single training phase of the approach. Instead of considering network weights, HAT focuses on unit attention. 3. Related Work |setl,i | For numerical stability, we clamp ≤ 50 and constrain etl,i to remain within the active range of the standard sigmoid, etl,i ∈ [−6, 6]. In any case, however, ql,i → 0 when we hit those limits. That is, we are in the constant regions of the pseudo-step function. Notice also that, by Eq. 3, the minimum s is never equal to 0. 2.6. Promoting Low Capacity Usage It is important to realize that the hard attention values atl,i that are ‘active’, that is, atl,i → 1, directly determine the units that will be dedicated to task t. Therefore, in order to have some model capacity reserved for future tasks, we promote sparsity on the set of attention vectors At = {at1 , . . . atL−1 }. To do so, we add a regularization term to the loss function L that takes into account the set of cumulative attention vectors up to task t − 1, <t A<t = {a<t 1 , . . . aL−1 }:   L0 y, ŷ, At , A<t = L (y, ŷ) + cR At , A<t , (4) where c is the regularization constant,  PL−1 PNl t  al,i 1 − a<t  l=1 i=1 l,i R At , A<t = PL−1 PNl <t l=1 i=1 1 − al,i is the regularization term, and Nl corresponds to the number of units in layer l. Notice that Eq. 5 corresponds to a weighted and normalized L1 regularization over At . Cumulative attentions over the past tasks A<t define a weight for t the current task, such that if a<t l,i → 1 then al,i receives a weight close to 0 and vice versa. This excludes the units that were attended in previous tasks from regularization, unconstraining their reuse in the current task. The hyperparameter c ≥ 0 controls the capacity spent on each task (Eq. 4). In a sense, it can be thought of as a compressibility constant, affecting the compactness of the learned models: the higher the c, the lower the number of active attention values atl,i and the more sparse the resulting network is. We set c globally for all tasks and let HAT adapt to the best compression for each individual task. (5) We compare the proposed approach with the conceptually closest works, some of which appeared concurrently to the development of HAT. A more general overview of related work has been done in Sec. 1. A qualitative comparison with three of the most related strategies has been done along Sec. 2. A quantitative comparison with these and other approaches is done in Sec. 4 and Appendix C. Both elastic weight consolidation (EWC; Kirkpatrick et al., 2017) and synaptic intelligence (SI; Zenke et al., 2017) approaches add a ‘soft’ structural regularization term to the loss function in order to discourage changes to weights that are important for previous tasks. HAT uses a ‘hard’ structural regularization, and does it both at the loss function and gradient magnitudes explicitly. EWC measures weights’ importance after network training, while SI and HAT compute weights’ importance concurrently to network training. EWC and SI use specific formulation while HAT learns attention masks. Incremental moment matching (IMM; Lee et al., 2017) is an evolution of EWC, performing a separate model-merging step after learning a new task. Progressive neural networks (PNNs; Rusu et al., 2016) distribute the network weights in a column-wise fashion, pre- Overcoming Catastrophic Forgetting with Hard Attention to the Task assigning a column width per task. They employ so-called adapters to reuse knowledge from previous columns/tasks, leading to a progressive increase of the number of weights assigned to future tasks. Instead of blindly pre-assigning column widths, HAT learns such ‘widths’ per layer, together with the network weights, and adapts them to the difficulty of the current task. PathNet (Fernando et al., 2017) also pre-assigns some amount of network capacity per task but, in contrast to PNNs, avoids network columns and adapters. It uses an evolutionary approach to learn paths between a constant number of so-called modules (layer subsets) that interconnect between themselves. HAT does not maintain a population of solutions, entirely trains with backpropagation and SGD, and does not rely on a constant set of modules. Together with PNNs and PathNet, PackNet (Mallya & Lazebnik, 2017) also employs a binary mask to constrain the network. However, such constrain is not based on columns nor layer modules, but on network weights. Therefore, it allows for a potentially better use of the network’s capacity. PackNet is based on heuristic weight pruning, with pre-assigned pruning ratios. HAT also focuses on network weights, but uses unit-based masks to constrain those, which also results in a lightweight structure. It avoids any absolute or pre-assigned pruning ratio, although it uses the compressibility parameter c to influence the compactness of the learned models. Another difference between HAT and the previous three approaches is that it does not use purely binary masks. Instead, the stability parameter smax controls the degree of binarization. Dynamically expandable networks (DEN; Yoon et al., 2018) also assign network capacity depending on the task at hand. However, they do so in a separate stage called “selective retraining”. A complex mixture of heuristics and hyperparameters is used to identify “drifting” units, which are duplicated and retrained in another stage. L1 regularization and L2-transfer are employed to condition learning, together with the corresponding regularization constants and an additional set of thresholds. HAT strives for simplicity, restricting the number of hyperparameters to two that have a straightforward conceptual interpretation. Instead of plain L1 regularization over network weights, HAT employs an attention-weighted L1 regularization over attention masks. Attention masks are a lightweight structure that can be plugged in without the need of introducing important changes to a pre-existing network. 4. Experiments Setups — Common setups to evaluate catastrophic forgetting in a classification context are based on permutations of the MNIST data (Srivastava et al., 2013), label splits of the MNIST data (Lee et al., 2017), incrementally learning classes of the CIFAR data sets (Lopez-Paz & Ranzato, 2017), or two-task transfer learning setups where accuracy is measured on both source and target tasks (Li & Hoiem, 2017). However, there are some limitations with these setups. Firstly, performing permutations of the MNIST data has been suggested to favor certain approaches, yielding misleading results3 in the context of catastrophic forgetting (Lee et al., 2017). Secondly, using only the MNIST data may not be very representative of modern computer vision tasks, nor particularly challenging (Xiao et al., 2017). Thirdly, incrementally adding classes or groups of classes implies the assumption that all data comes from the same joint distribution, which is unrealistic for a real-world setting. Finally, evaluating catastrophic forgetting with only two tasks biases the conclusions towards transfer learning setups, and prevents the analysis of truly sequential learning with more than two tasks. In this paper, we consider the aforementioned MNIST and CIFAR setups (Sec. 4.2). Nonetheless, we primarily evaluate on a sequence of multiple tasks formed by different classification data sets (Sec. 4.1). To obtain a generic estimate, we weigh a number of tasks and uniformly randomize their order. After training task t, we compute the accuracies on all testing sets of tasks τ ≤ t. We repeat 10 times this sequential train/test procedure with 10 different seed numbers, which are also used in the rest of randomizations and initializations (see below). To compare between different task accuracies, and in order to obtain a general measurement of the amount of forgetting, we introduce the forgetting ratio ρτ ≤t = Aτ ≤t − AτR AτJ ≤t − AτR − 1, (6) where Aτ ≤t is the accuracy measured on task τ after sequentially learning task t, AτR is the accuracy of a random, frequency-based classifier solely trained on task τ , and AτJ ≤t is the accuracy measured on task τ after jointly learning t tasks in a multitask fashion. Note that ρ ≈ −1 and ρ ≈ 0 correspond to performances close to the ones of the random and multitask classifiers, respectively. To report a single number after learning t tasks, we take the average t ρ≤t = 1 X τ ≤t ρ . t τ =1 Data — We consider 8 common image classification data sets and adapt them, if necessary, to an input size of 32 × 32 × 3 pixels. The number of classes goes from 10 to 100, training set sizes from 16,853 to 73,257, and test set sizes from 1,873 to 26,032. For each task, we ran3 Essentially, the MNIST data contains many values close to 0 that allow for an easier identification of the important units or weights which, if permuted, can then be easily frozen without overlapping with the ones of the other tasks (see Lee et al., 2017). Overcoming Catastrophic Forgetting with Hard Attention to the Task Baselines — We consider 2 reference approaches plus 9 recent and competitive ones: standard SGD with dropout (Goodfellow et al., 2014), SGD freezing all layers except the last one (SGD-F), EWC, IMM (Mean and Mode variants), learning without forgetting (LWF; Li & Hoiem, 2017), less-forgetting learning (LFL; Jung et al., 2016), PathNet, and PNNs. To find the best hyperparameter combination for each approach, we perform a grid search using a task sequence determined by a single seed. To compute the forgetting ratio ρ (Eq. 6), we also run the aforementioned random and multitask classifiers. Network — Unless stated otherwise, we employ an AlexNet-like architecture (Krizhevsky et al., 2012) with 3 convolutional layers of 64, 128, and 256 filters with 4 × 4, 3 × 3, and 2 × 2 kernel sizes, respectively, plus two fullyconnected layers of 2048 units each. We use rectified linear units as activations, and 2 × 2 max-pooling after the convolutional layers. We also use a dropout of 0.2 for the first two layers and of 0.5 for the rest. A fully-connected layer with a softmax output is used as a final layer, together with categorical cross entropy loss. All layers are randomly initialized with Xavier uniform initialization (Glorot & Bengio, 2010) except the embedding layers, for which we use a Gaussian distribution N (0, 1). Unless stated otherwise, our code uses PyTorch’s defaults for version 0.2.0 (Paszke et al., 2017). We adapt the same base architecture to all baseline approaches and match their number of parameters to 7.1 M. 0.0 −0.1 −0.2 ρ ≤t domly split 15% of the training set and keep it for validation purposes. The considered data sets are: CIFAR10 and CIFAR100 (Krizhevsky, 2009), FaceScrub (Ng & Winkler, 2014), FashionMNIST (Xiao et al., 2017), NotMNIST (Bulatov, 2011), MNIST (LeCun et al., 1998), SVHN (Netzer et al., 2011), and TrafficSigns (Stallkamp et al., 2011). For further details on data we refer to Appendix A. −0.3 −0.4 −0.5 −0.6 1 2 Multitask SGD SGD-F 3 4 t EWC IMM-Mode IMM-Mean 5 6 7 LWF LFL PathNet 8 PNN HAT Figure 3. Average forgetting ratio ρ≤t for the considered approaches (10 runs). Table 1. Average forgetting ratio after the second (ρ≤2 ) and the last (ρ≤8 ) task for the considered approaches (10 runs, standard deviation into parenthesis). A PPROACH LFL LWF SGD IMM-M ODE SGD-F IMM-M EAN EWC PATH N ET PNN HAT ρ≤2 ρ≤8 -0.73 (0.29) -0.14 (0.13) -0.20 (0.08) -0.11 (0.08) -0.20 (0.15) -0.12 (0.10) -0.08 (0.06) -0.09 (0.16) -0.11 (0.10) -0.02 (0.03) -0.92 (0.08) -0.80 (0.06) -0.66 (0.03) -0.49 (0.05) -0.44 (0.06) -0.42 (0.04) -0.25 (0.03) -0.17 (0.23) -0.11 (0.01) -0.06 (0.01) 4.1. Results beyond a transfer learning setup. We find LFL extremely sensitive to the configuration of its hyperparameter, to the point that what is a good value for one seed, turns out to be a bad choice for another seed. Hence the poor average performance for 10 seeds. The highest standard deviations are obtained by LFL and PathNet (Table 1), which suggests a high sensitivity with respect to hyperparameters, initializations, or data sets. Another thing to note is that the IMM approaches only perform similarly or slightly better than the SGD-F reference. We believe this is due to both the different nature of the tasks’ data and the consideration of more than two tasks, which complicates the choice of the mixing hyperparameter. We first look at the average forgetting ratio ρ≤t after learning task t (Fig. 3). A first thing to note is that not all the considered baselines perform better than the SGD references. That is the case of LWF and LFL. For LWF, we observe it is still competitive in the two-task setup for which it was designed, t = 2. However, its performance rapidly degrades for t > 2, indicating that the approach has difficulties in extending The best performing baselines are EWC, PathNet, and PNN. PathNet and PNN present contrasting behaviors. Both, by construction, never forget; therefore, the important difference is in their learning capability. PathNet starts by correctly learning the first task and progressively exhibits difficulties to do so for t ≥ 2. Contrastingly, PNNs exhibits difficulty in the first tasks and becomes better as t increases. Training — We train all models with backpropagation and plain SGD, using a learning rate of 0.05, and decaying it by a factor of 3 if there is no improvement in the validation loss for 5 consecutive epochs. We stop training when we reach a learning rate lower than 10−4 or we have iterated over 200 epochs (we made sure that all considered approaches reached a stable solution before 200 epochs). Batch size is set to 64. All methods use the same task sequence, data split, batch shuffle, and weight initialization for a given seed. Overcoming Catastrophic Forgetting with Hard Attention to the Task We now move to the HAT results. First of all, we observe that HAT consistently performs better than all considered baselines for all t ≥ 2 (Fig. 3). For the case of t = 2, it obtains an average forgetting ratio ρ≤2 = −0.02, while the best baseline is EWC with ρ≤2 = −0.08 (Table 1). For the case of t = 8, HAT obtains ρ≤8 = −0.06, while the best baseline is PNN with ρ≤8 = −0.11. This implies a reduction in forgetting of 75% for t = 2 and 45% for t = 8. Notice that the standard deviation of HAT is lower than the ones obtained by the big majority of the baselines (Table 1). This denotes a certain stability of HAT with respect to different task sequences, data sets, data splits, and network initializations. Given the slightly increasing tendency of PNN with t (Fig. 3), one could speculate that PNN would score above HAT for t > 8. However, our empirical analyzes suggest that that is not the case (presumably due to the capacity pre-assignment and parameter increase problems underlined in Sec. 3 and above). In particular, we observe a gradual lowering of PathNet and PNN curves with increasing sequences from t = 2 to 8. In addition, we observe PathNet and PNN obtaining worse performances than EWC in the case of t = 10 for the incremental class setup (see below and Appendix C.1). In general, none of the baseline methods consistently outperforms the rest across setups and for all t, a situation that we do observe with HAT. 4.2. Additional Results To broaden the strength of our results, we additionally experiment with three common alternative setups. First, we consider an incremental class learning scenario, similar to Lopez-Paz & Ranzato (2017), using class subsets of both CIFAR10 and CIFAR100 data. In this setup, the best baseline after t ≥ 3 is EWC, with ρ≤10 = −0.18. HAT scores ρ≤10 = −0.09 (55% forgetting reduction). Next, we consider the permuted MNIST sequence of tasks (Srivastava et al., 2013). In this setup, the best result we could find in the literature was from SI, with A≤10 = 97.1%. HAT scores A≤10 = 98.6% (52% error rate reduction). Finally, we also consider the split MNIST task of Lee et al. (2017). In this setup, the best result from the literature corresponds to the conceptor-aided backpropagation approach (He & Jaeger, 2018), with A≤2 = 94.9%. HAT scores A≤2 = 99.0% (80% error rate reduction). The detail for all these setups and results can be found in Appendix C. 0.00 −0.05 ρ ≤8 These contrasting behaviors are due to the way the two approaches allocate the network capacity. As mentioned, they cannot do it dynamically, and therefore need to pre-assign a number of network weights per task. When having more tasks but the same network capacity, this pre-assignment increasingly harms the performance of these baselines, lowering the corresponding curves in Fig. 3. −0.10 −0.15 −0.20 0 1 smax = 25 smax = 50 2 c smax = 100 smax = 200 3 4 smax = 400 smax = 800 Figure 4. Effect of hyperparameters smax and c on average forgetting ratio ρ≤8 . Results for seed 0. 4.3. Hyperparameters In any machine learning algorithm, it is important to assess the sensitivity with respect to the hyperparameters. HAT has two: the stability parameter smax and the compressibility parameter c (Secs. 2.4 and 2.6). A low smax provides plasticity to the units and capacity of adaptation, but the network may easily forget what it learned. A high smax prevents forgetting, but the network may have difficulties in adapting to new tasks. A low c allows to use almost all of the network’s capacity for a given task, potentially spending too much in the current task. A high c forces it to learn a very compact model, at the expense of not reaching the accuracy that the original network could have reached. We empirically found good operation ranges smax ∈ [25, 800] and c ∈ [0.1, 2.5]. As we can see, any variation within these ranges results in reasonable performance (Fig. 4). Unless stated otherwise, we use smax = 400 and c = 0.75. 4.4. Monitoring and Network Pruning It is interesting to note that the hard attention mechanism introduced in Sec. 2 offers a number of possibilities to monitor the behavior of our models. For instance, by computing the conditioning mask in Eq. 2 from the hard attention vectors a≤t l , we can assess which weights obtain a high attention value, binarize it, and compute an estimate of the instantaneous network capacity usage (Fig. 5). We may also inform ourselves of the amount of active weights per layer and task (Appendix B.2). Another facet we can monitor is the weight reuse across tasks. By a similar procedure, comparing the conditioning masks between tasks ti and tj , j > i, we can asses the percentage of weights of task ti that are later reused in task tj (Fig. 6). Another by-product of hard attention masks is that we can Overcoming Catastrophic Forgetting with Hard Attention to the Task 80 80 60 60 A 1 [%] 100 Used capacity [%] 100 40 20 0 20 0 200 400 Epochs FaceScrub MNIST CIFAR100 0 600 NotMNIST SVHN CIFAR10 TrafficSigns FashionMNIST Figure 5. Network capacity usage with sequential task learning (seed 0). Dashed vertical lines correspond to a task switch. 1 5 2 6 5 5 5 5 5 4 3 3 4 4 3 9 8 11 10 9 8 10 9 9 11 11 10 13 12 3 Task 40 4 5 6 0 20 CIFAR10 CIFAR100 FaceScrub 40 60 Compression [%] FashionMNIST MNIST NotMNIST 80 100 SVHN TrafficSigns Figure 7. Validation accuracy A1 as a function of compression percentage. Every dot corresponds to an epoch and triangles match the accuracy of the SGD approach (no compression). the task (Appendix B.3). Comparing these numbers with the compression rates used by PackNet (25 or 50%), we see that HAT generally uses a much more compact model. Comparing with DEN on the specific MNIST and CIFAR100 tasks (18 and 52%), we observe that HAT compresses to 1 and 21%, respectively. Interestingly, and in contrast to these and the majority of network pruning approaches, HAT learns to prune network weights through backpropagation and SGD, and at the same time as the network weights themselves. 13 7 2 3 4 5 Task 6 7 8 Figure 6. Percentage of weight reuse across tasks. Seed 0 sequence: (1) FaceScrub, (2) MNIST, (3) CIFAR100, (4) NotMNIST, (5) SVHN, (6) CIFAR10, (7) TrafficSigns, and (8) FashionMNIST. use them to assess which of the network’s weights are important, and then prune the most irrelevant ones (LeCun et al., 1990). This way, we can compress the network for further deployment in low-resource devices or time-constrained environments (cf. Han et al., 2016). If we want to focus on such compression task, we can set c to a higher value than the one used for catastrophic forgetting and start with a positive random initialization of the embeddings el . The former will promote more compression while the latter will ensure we start learning the model by putting attention to all weights in the first epochs (full capacity). We empirically found that using c = 1.5 and U(0, 2) yields a reasonable trade-off between accuracy and compression for a single task (Fig. 7). With that, we can compress the network to sizes between 1 and 21% of its original size, depending on 5. Conclusion We introduce HAT, a hard attention mechanism that, by focusing on a task embedding, is able to protect the information of previous tasks while learning new tasks. This hard attention mechanism is lightweight, in the sense that it adds a small fraction of weights to the base network, and is trained together with the main model, with negligible overhead using backpropagation and vanilla SGD. We demonstrate the effectiveness of the approach to control catastrophic forgetting in the image classification context by running a series of experiments with multiple data sets and state-of-the-art approaches. HAT has only two hyperparameters, which intuitively refer to the stability and compactness of the learned knowledge, and whose tuning we demonstrate is not crucial for obtaining good performance. In addition, HAT offers the possibility to monitor the used network capacity across tasks and layers, the unit reuse across tasks, and the compressibility of a model trained for a given task. We hope that our approach may be also useful in online learning or network compression contexts, and that the hard attention mechanism presented here may also find some applicability beyond the catastrophic forgetting problem. Overcoming Catastrophic Forgetting with Hard Attention to the Task References Bakker, B. and Heskes, T. Task clustering and gating for bayesian multitask learning. Journal of Machine Learning Research, 4:83–99, 2003. Bulatov, Y. NotMNIST dataset. Technical report, 2011. URL http://yaroslavvb.blogspot.it/ 2011/09/notmnist-dataset.html. Clegg, B. A., DiGirolamo, G. J., and Keele, S. W. Sequence learning. Trends in Cognitive Sciences, 2(8):275–281, 1998. Duchi, J., Hazan, E., and Singer, Y. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12:2121–2159, 2011. Evgeniou, T. and Pontil, M. Regularized multi-task learning. In Proc. of the ACM SIGKDD Int. Conf. on Knowledge Discovery and Data Mining (KDD), pp. 109–117, 2004. Kemelmacher-Shlizerman, I., Seitz, S. M., Miller, D., and Brossard, E. The megaface benchmark: 1 million faces for recognition at scale. In Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), pp. 4873–4882, 2016. Kingma, D. P. and Ba, J. L. Adam: a method for stochastic optimization. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2015. Kirkpatrick, J., Pascanu, R., Rabinowitz, N., Veness, J., Desjardins, G., Rusu, A. A., Milan, K., Quan, J., Ramalho, T., Grabska-Barwinska, A., Hassabis, D., Clopath, C., Kumaran, D., and Hadsell, R. Overcoming catastrophic forgetting in neural networks. Proc. of the National Academy of Sciences of the USA, 114(13):3521–3526, 2017. Krizhevsky, A. Learning multiple layers of features from tiny images. Msc thesis, University of Toronto, Toronto, Canada, 2009. Fernando, C., Banarse, D., Blundell, C., Zwols, Y., Ha, D., Rusu, A. A., Pritzel, A., and Wierstra, D. PathNet: evolution channels gradient descent in super neural networks. ArXiv, 1701.08734, 2017. Krizhevsky, A., Sutskever, I., and Hinton, G. ImageNet classification with deep convolutional neural networks. In Pereira, F., Burges, C. J. C., Bottou, L., and Weinberger, K. Q. (eds.), Advances in Neural Information Processing Systems (NIPS), volume 25, pp. 1097–1105. 2012. French, R. M. Using semi-distributed representations to overcome catastrophic forgetting in connectionist networks. In Proc. of the Annual Conf. of the Cognitive Science Society (CogSci), pp. 173–178, 1991. LeCun, Y., Denker, J. S., and Solla, S. A. Optimal brain damage. In Touretzky, D. S. (ed.), Advances in Neural Information Processing Systems (NIPS), volume 2, pp. 598–605. Morgan Kaufmann, 1990. Glorot, X. and Bengio, Y. Understanding the difficulty of training deep feedforward neural networks. In Proc. of the Int. Conf. on Artificial Intelligence and Statistics (AISTATS), pp. 249–256, 2010. LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. Gradientbased learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. Goodfellow, I., Mizra, M., Da, X., Courville, A., and Bengio, Y. An empirical investigation of catastrophic forgetting in gradient-based neural networks. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2014. Gutsein, S. and Stump, E. Reduction of catastrophic forgetting with transfer learning and ternary output codes. In Proc. of the Int. Joint Conf. on Neural Networks (IJCNN), pp. 1–8, 2015. Han, S., Mao, H., and Dally, W. J. Deep compression: compressing deep neural networks with pruning, trained quantization and Huffman coding. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2016. He, X. and Jaeger, H. Overcoming catastrophic interference using conceptor-aided backpropagation. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2018. Jung, H., Ju, J., Jung, M., and Kim, J. Less-forgetting learning in deep neural networks. ArXiv, 1607.00122, 2016. Lee, S.-W., Kim, J.-H., Jun, J., Ha, J.-W., and Zhang, B.-T. Overcoming catastrophic forgetting by incremental moment matching. In Guyon, I., Luxburg, U. V., Bengio, S., Wallach, H., Fergus, R., Vishwanathan, S., and Garnett, R. (eds.), Advances in Neural Information Processing Systems (NIPS), volume 30, pp. 4655–4665. Curran Associates Inc., 2017. Legg, S. and Hutter, M. Universal intelligence: a definition of machine intelligence. Minds and Machines, 17(4): 391–444, 2007. Li, Z. and Hoiem, D. Learning without forgetting. IEEE Trans. on Pattern Analysis and Machine Intelligence, PP (99):1–1, 2017. Lopez-Paz, D. and Ranzato, M. A. Gradient episodic memory for continuum learning. In Guyon, I., Luxburg, U. V., Bengio, S., Wallach, H., Fergus, R., Vishwanathan, S., and Garnett, R. (eds.), Advances in Neural Information Processing Systems (NIPS), volume 30, pp. 6449–6458. Curran Associates Inc., 2017. Overcoming Catastrophic Forgetting with Hard Attention to the Task Mallya, A. and Lazebnik, S. PackNet: adding multiple tasks to a single network by iterative pruning. ArXiv, 1711.05769, 2017. McCloskey, M. and Cohen, N. Catastrophic interference in connectionist networks: the sequential learning problem. Psychology of Learning and Motivation, 24:109– 165, 1989. McCulloch, W. S. and Pitts, W. A logical calculus of the ideas immanent in nervous activity. The Bulletin of Mathematical Biophysics, 5(4):115–133, 1943. Netzer, Y., Wang, T., Coates, A., Bissacco, A., Wu, B., and Ng, A. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning (NIPSDeepLearning), 2011. Ng, H.-W. and Winkler, S. A data-driven approach to cleaning large face datasets. In Proc. of the IEEE Int. Conf. on Image Processing (ICIP), pp. 343–347, 2014. Nguyen, C., Li, Y., Bui, T. D., and Turner, R. E. Variational continual learning. ArXiv, 1710.10628, 2017. Paszke, A., Gross, S., Chintala, S., Chanan, G., Yang, E., DeVito, Z., Lin, Z., Desmaison, A., Antiga, L., and Lerer, A. Automatic differentiation in PyTorch. In NIPS Workshop on The Future of Gradient-based Machine Learning Software & Techniques (NIPS-Autodiff), 2017. Ratcliff, R. Connectionist models of recognition memory: constraints imposed by learning and forgetting functions. Psychological Review, 97:285–308, 1990. Rebuffi, S., Kolesnikov, A., Sperl, G., and Lampert, C. iCaRL: incremental classifier and representation learning. In Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), pp. 2001–2010, 2017. Shin, H., Lee, J. K., Kim, J., and Kim, J. Continual learning with deep generative replay. In Guyon, I., Luxburg, U. V., Bengio, S., Wallach, H., Fergus, R., Vishwanathan, S., and Garnett, R. (eds.), Advances in Neural Information Processing Systems (NIPS), volume 30, pp. 2993–3002. Curran Associates Inc., 2017. Sprechmann, P., Jayakumar, S., Rae, J., Pritzel, A., Puigdomènech, A., Uria, B., Vinyals, O., Hassabis, D., Pascanu, R., and Blundell, C. Memory-based parameter adaptation. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2018. Srivastava, R. K., Masci, J., Kazerounian, S., Gomez, F., and Schmidhuber, J. Compete to compute. In Burges, C. J. C., Bottou, L., Welling, M., Ghahramani, Z., and Weinberger, K. (eds.), Advances in Neural Information Processing Systems (NIPS), volume 26, pp. 2310–2318. Curran Associates Inc., 2013. Stallkamp, J., Schlipsing, M., Salmen, J., and Igel, C. The German traffic sign recognition benchmark: a multi-class classification competition. In Proc. of the Int. Joint Conf. on Neural Networks (IJCNN), pp. 1453–1460, 2011. Thrun, S. and Mitchell, T. Lifelong robot learning. Robotics and Autonomous Systems, 15:25–46, 1995. Venkatesan, R., Venkateswara, H., Panchanathan, S., and Li, B. A strategy for an uncompromising incremental learner. ArXiv, 1705.00744, 2017. Wang, H. and Raj, B. On the origin of deep learning. ArXiv, 1702.07800, 2017. Xiao, H., Rasul, K., and Vollgraf, R. Fashion-MNIST: a novel image dataset for benchmarking machine learning algorithms. ArXiv, 1708.07747, 2017. Robins, A. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7:123–146, 1995. Yoon, J., Yang, E., Lee, J., and Hwang, S. J. Lifelong learning with dynamically expandable networks. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2018. Rusu, A. A., Rabinowitz, N. C., Desjardins, G., Soyer, H., Kirkpatrick, J., Kavukcuoglu, K., Pascanu, R., and Hadsell, R. Progressive neural networks. ArXiv, 1606.04671, 2016. Zenke, F., Poole, B., and Ganguli, S. Improved multitask learning through synaptic intelligence. In Proc. of the Int. Conf. on Machine Learning (ICML), pp. 3987–3995, 2017. Overcoming Catastrophic Forgetting with Hard Attention to the Task APPENDIX A. Data The data sets used in our experiments are summarized in Table 2. The MNIST data set (LeCun et al., 1998) comprises 28 × 28 monochromatic images of handwritten digits. Fashion-MNIST (Xiao et al., 2017) comprises gray-scale images of the same size from Zalando’s articles4 . The German traffic sign data set (TrafficSigns; Stallkamp et al., 2011) contains traffic sign images. We used the version of the data set from the Udacity self-driving car github repository5 . The NotMNIST data set (Bulatov, 2011) comprises glyphs extracted from publicly available fonts, making a similar data set to MNIST; we just need to resize the images6 . The SVHN data set (Netzer et al., 2011) comprises digits cropped from house numbers in Google Street View images. The FaceScrub data set (Ng & Winkler, 2014) is widely used in face recognition tasks (KemelmacherShlizerman et al., 2016). Because some of the images listed in the original data set were not hosted anymore on the corresponding Internet domains, we use a version of the data set stored on the MegaFace challenge website7 (KemelmacherShlizerman et al., 2016), from which we select the first 100 people with the most appearances8 . The CIFAR10 and CIFAR100 data sets contain 32 × 32 color images (Krizhevsky, 2009). To match the image input shape required in our experiments, some of the images in the corresponding data sets need to be resized (FaceScrub, TrafficSigns, and NotMNIST) or padded with zeros (MNIST and FashionMNIST). In addition, for the data sets comprising monochromatic images, we replicate the image across all RGB channels. Note that we do not perform any sort of data augmentation; we just adapt the inputs. We provide the necessary code to perform such adaptations in the links listed above. Table 2. Data sets used in the study: name, reference, number of classes, and number of train and test instances. DATA SET CIFAR10 (K RIZHEVSKY , 2009) CIFAR100 (K RIZHEVSKY , 2009) FACE S CRUB (N G & W INKLER , 2014) FASHION MNIST (X IAO ET AL ., 2017) N OT MNIST (B ULATOV , 2011) MNIST (L E C UN ET AL ., 1998) SVHN (N ETZER ET AL ., 2011) T RAFFIC S IGNS (S TALLKAMP ET AL ., 2011) C LASSES T RAIN T EST 10 100 100 10 10 10 100 43 50,000 50,000 20,600 60,000 16,853 60,000 73,257 39,209 10,000 10,000 2,289 10,000 1,873 10,000 26,032 12,630 B. Raw Results B.1. Task Mixture We report all forgetting ratios ρ≤t for t = 1 to 8 in Table 3. A total of 10 runs with 10 different seeds are performed and the averages and standard deviations are taken. B.2. Layer Use In Fig. 8 we show an example of layer capacity monitoring as the sequence of tasks evolves. As mentioned in the main paper, we can compute a percent of active weights for a given layer and task. B.3. Network Compression The final results of the network compression experiment reported in the main paper (after reaching convergence) are available in Table 4. We run HAT on isolated tasks with c = 1.5 and uniform embedding initialization U(0, 2). 4 https://github.com/zalandoresearch/fashion-mnist https://github.com/georgesung/traffic_sign_classification_german 6 Code is attached in a ZIP file. 7 http://megaface.cs.washington.edu/participate/challenge.html 8 Code is attached in a ZIP file. 5 Overcoming Catastrophic Forgetting with Hard Attention to the Task Table 3. Average forgetting ratio ρ≤t for the considered approaches (10 runs, standard deviation into parenthesis). A PPROACH LFL LWF SGD IMM-M ODE SGD-F IMM-M EAN EWC PATH N ET PNN HAT ρ≤1 ρ≤2 ρ≤3 ρ≤4 ρ≤5 ρ≤6 ρ≤7 ρ≤8 -0.00 (0.01) -0.00 (0.01) -0.00 (0.00) -0.00 (0.01) -0.00 (0.00) -0.00 (0.00) -0.00 (0.00) -0.02 (0.03) -0.10 (0.12) -0.01 (0.02) -0.73 (0.29) -0.14 (0.13) -0.20 (0.08) -0.11 (0.08) -0.20 (0.15) -0.12 (0.10) -0.08 (0.06) -0.09 (0.16) -0.11 (0.10) -0.02 (0.03) -0.88 (0.18) -0.38 (0.17) -0.41 (0.09) -0.27 (0.12) -0.30 (0.15) -0.24 (0.11) -0.15 (0.11) -0.11 (0.19) -0.13 (0.09) -0.03 (0.03) -0.89 (0.13) -0.63 (0.11) -0.49 (0.07) -0.37 (0.10) -0.38 (0.11) -0.32 (0.06) -0.18 (0.07) -0.12 (0.21) -0.14 (0.04) -0.03 (0.02) -0.91 (0.11) -0.68 (0.08) -0.54 (0.07) -0.39 (0.07) -0.42 (0.09) -0.37 (0.06) -0.21 (0.07) -0.14 (0.22) -0.13 (0.03) -0.04 (0.02) -0.90 (0.09) -0.70 (0.03) -0.57 (0.06) -0.45 (0.05) -0.44 (0.08) -0.40 (0.06) -0.23 (0.04) -0.15 (0.23) -0.13 (0.02) -0.05 (0.02) -0.92 (0.08) -0.76 (0.06) -0.62 (0.06) -0.49 (0.06) -0.45 (0.07) -0.42 (0.07) -0.25 (0.05) -0.17 (0.23) -0.12 (0.01) -0.06 (0.02) -0.92 (0.08) -0.80 (0.06) -0.66 (0.03) -0.49 (0.05) -0.44 (0.06) -0.42 (0.04) -0.25 (0.03) -0.17 (0.23) -0.11 (0.01) -0.06 (0.01) Used weights [%] 100 80 60 40 20 0 Conv1 Conv2 Conv3 FC1 Layer Cumulative FaceScrub MNIST CIFAR100 NotMNIST SVHN FC2 FC3 CIFAR10 TrafficSigns FashionMNIST Figure 8. Layer-wise weight usage with sequential task learning, including (lines) and excluding (bars) the cumulative attention of past tasks. Task sequence corresponds to seed 0. Table 4. Results for the compression experiment reported in the main paper: test accuracy A1 with SGD, test accuracy A1 after compressing with HAT, and percentage of network weights used after compression. DATA SET CIFAR10 CIFAR100 FACE S CRUB FASHION MNIST MNIST N OT MNIST SVHN T RAFFIC S IGNS R AW A1 C OMPRESSED A1 79.9% 52.7% 82.7% 92.4% 99.5% 90.9% 94.2% 97.5% 80.8% 49.1% 82.3% 91.9% 99.4% 91.5% 93.8% 98.1% S IZE 13.9% 21.4% 21.0% 2.3% 1.2% 5.7% 3.1% 2.9% B.4. Training Time To have an idea of the training time for each of the considered approaches, we report some reference values in Table 5. We see that HAT is also quite competitive in this aspect. Overcoming Catastrophic Forgetting with Hard Attention to the Task Table 5. Wall-clock training time measured on a single NVIDIA Pascal Titan X GPU: total (after learning the 8 tasks), per epoch, and per batch (batches of 64). Batch processing time is measured for a forward pass (Batch-F), and for both a forward and a backward pass (Batch-FB). A PPROACH T OTAL [ H ] PNN PATH N ET EWC M ULTITASK IMM-M EAN IMM-M ODE LWF HAT SGD LFL SGD-F T RAINING TIME E POCH [ S ] BATCH -F [ MS ] 6.0 4.5 3.9 3.4 3.2 3.1 2.2 2.2 1.4 1.3 0.5 4.1 3.6 3.1 94.8 2.6 2.5 2.2 1.6 0.9 0.9 0.9 BATCH -FB [ MS ] 10.2 10.6 7.9 3.1 6.9 6.7 5.7 4.0 2.5 4.4 2.5 27.5 23.9 19.7 15.7 17.1 16.0 14.2 11.7 6.6 9.2 6.8 C. Additional Results C.1. Incremental CIFAR As an additional experiment to complement our evaluation, we consider the incremental CIFAR setup, following a similar approach as Lopez-Paz & Ranzato (2017). We divide both CIFAR10 and CIFAR100 data sets into consecutive-class subsets and use them as tasks, presented in random order according to the seed. We take groups of 2 classes for CIFAR10 and 20 classes for CIFAR100, yielding a total of 10 tasks. We decide to take groups of 2 and 20 classes in order to have a similar number of training instances per task. The rest of the procedure is as in the main paper. The most important results are summarized there. The complete numbers are depicted in Fig. 9 and reported in Table 6. 0.0 −0.1 ρ ≤t −0.2 −0.3 −0.4 −0.5 −0.6 1 2 Multitask SGD SGD-F 3 4 5 EWC IMM-Mode IMM-Mean t 6 7 8 LWF LFL PathNet 9 10 PNN HAT Figure 9. Average forgetting ratio ρ≤t for the incremental CIFAR task (average after 10 runs). C.2. Permuted MNIST A common experiment is the one proposed by Srivastava et al. (2013), and later employed to evaluate catastrophic forgetting by Goodfellow et al. (2014). It consists of taking random permutations of the pixels in the MNIST data set as tasks. Typically, the average accuracy after sequentially training on 10 MNIST permutations is reported. To match the different number of Overcoming Catastrophic Forgetting with Hard Attention to the Task Table 6. Average forgetting ratio ρ≤t for the incremental CIFAR task (10 runs, standard deviation into parenthesis). A PPROACH LFL LWF SGD-F PATH N ET SGD IMM-M EAN IMM-M ODE PNN EWC HAT ρ≤1 ρ≤2 ρ≤3 ρ≤4 ρ≤5 ρ≤6 ρ≤7 ρ≤8 ρ≤9 ρ≤10 -0.00 (0.01) -0.00 (0.02) -0.00 (0.01) -0.15 (0.31) -0.00 (0.01) -0.00 (0.02) -0.00 (0.01) -0.26 (0.16) -0.00 (0.01) -0.03 (0.04) -0.53 (0.31) -0.10 (0.03) -0.25 (0.14) -0.18 (0.20) -0.19 (0.09) -0.14 (0.08) -0.14 (0.10) -0.26 (0.08) -0.13 (0.09) -0.05 (0.02) -0.63 (0.25) -0.27 (0.05) -0.33 (0.16) -0.21 (0.26) -0.27 (0.09) -0.21 (0.10) -0.21 (0.11) -0.25 (0.05) -0.15 (0.08) -0.05 (0.02) -0.67 (0.21) -0.42 (0.05) -0.35 (0.18) -0.22 (0.28) -0.30 (0.04) -0.22 (0.10) -0.23 (0.06) -0.23 (0.04) -0.16 (0.07) -0.06 (0.01) -0.70 (0.20) -0.50 (0.06) -0.37 (0.16) -0.24 (0.29) -0.30 (0.06) -0.25 (0.10) -0.25 (0.09) -0.22 (0.03) -0.17 (0.06) -0.06 (0.01) -0.74 (0.17) -0.53 (0.04) -0.40 (0.18) -0.27 (0.29) -0.28 (0.04) -0.26 (0.08) -0.23 (0.07) -0.23 (0.03) -0.18 (0.06) -0.07 (0.01) -0.77 (0.15) -0.59 (0.06) -0.41 (0.18) -0.28 (0.30) -0.31 (0.03) -0.27 (0.08) -0.26 (0.05) -0.22 (0.03) -0.19 (0.08) -0.07 (0.01) -0.79 (0.14) -0.64 (0.06) -0.41 (0.19) -0.30 (0.30) -0.32 (0.04) -0.28 (0.08) -0.27 (0.04) -0.21 (0.02) -0.18 (0.07) -0.08 (0.01) -0.79 (0.14) -0.68 (0.05) -0.42 (0.19) -0.32 (0.29) -0.30 (0.05) -0.29 (0.07) -0.25 (0.04) -0.21 (0.02) -0.18 (0.06) -0.08 (0.01) -0.78 (0.14) -0.70 (0.05) -0.43 (0.20) -0.35 (0.28) -0.30 (0.04) -0.30 (0.07) -0.25 (0.04) -0.21 (0.02) -0.18 (0.06) -0.09 (0.01) Table 7. Accuracy on the permuted MNIST task (Srivastava et al., 2013), taking the average after training 10 tasks. The only exception is the generative replay approach, whose performance was assessed after 5 tasks. Superscripts indicate results reported by (1) Nguyen et al. (2017) and (2) He & Jaeger (2018). An asterisk after parameter count indicates that the approach presents some additional structure not included in such parameter count (for instance, some memory module or an additional generative network). A PPROACH GEM (L OPEZ -PAZ & R ANZATO , 2017) SI (Z ENKE ET AL ., 2017)1 EWC (K IRKPATRICK ET AL ., 2017)2 M B PA + EWC – 1000 EX . (S PRECHMANN ET AL ., 2018) VCL (N GUYEN ET AL ., 2017) HAT – S MALL G ENERATIVE R EPLAY (S HIN ET AL ., 2017) CAB (H E & JAEGER , 2018) EWC (K IRKPATRICK ET AL ., 2017) SI (Z ENKE ET AL ., 2017) HAT – M EDIUM HAT – L ARGE PARAMETERS A≤10 0.1 M* 0.1 M 0.1 M 82.8% 86.0% 88.2% 89.7% 90.0% 91.6% 94.9% 95.2% 96.9% 97.1% 97.4% 98.6% U NKNOWN * 0.1 M* 0.1 M U NKNOWN * 0.7 M 5.8 M 5.8 M 0.7 M 5.8 M parameters used in the literature, we consider a small, medium, and a large network based on a two-layer fully-connected architecture as Zenke et al. (2017), with 100, 500, and 2000 hidden units, respectively. For the large network we set dropout probabilities as Kirkpatrick et al. (2017). We use smax = 200 and c = 0.5 for the small network, and smax = 400 and c = 0.5 for the medium and large networks. The results are available in Table 7. C.3. Split MNIST Another popular experiment is to split the MNIST data set into tasks and report the average accuracy after learning them one after the other. We follow Lee et al. (2017) by splitting the data set using labels 0–4 and 5–9 as tasks and running the experiment 10 times. We also match the base network architecture to the one used by Lee et al. (2017). We train HAT for 50 epochs with c = 0.1. Results are reported in Table 8. In preliminary experiments we observed that dropout could increase accuracy by some percentage. However, to keep the same configuration as in the cited reference, we finally did not use it. Table 8. Average accuracy on the split MNIST task, following the setup of Lee et al. (2017) using 10 runs (standard deviation into parenthesis). Superscript (1) indicates results reported by Lee et al. (2017). A PPROACH SGD (G OODFELLOW ET AL ., 2014)1 L2-T RANSFER (E VGENIOU & P ONTIL , 2004)1 IMM-M EAN (L EE ET AL ., 2017) IMM-M ODE (L EE ET AL ., 2017) CAB (H E & JAEGER , 2018) HAT PARAMETERS A≤2 1.9 M 1.9 M 1.9 M 1.9 M 1.9 M 1.9 M 71.3% (1.5) 85.8% (0.5) 94.0% (0.2) 94.1% (0.3) 94.9% (0.3) 99.0% (0.0) Overcoming Catastrophic Forgetting with Hard Attention to the Task D. Variations to the Proposed Approach In this section, we want to mention a number of alternatives we experimented with during the development of HAT. The purpose of the section is not the report a formal set of results, but to inform the reader about potential different choices when implementing HAT, or variations of it, and to give an intuition on the outcome of some of such choices. D.1. Embedding Learning When we realized that the embedding weights etl were not changing much and that their gradients were small compared to the rest of the network due to the introduced annealing of s, we initially tackled the issue by using a different learning rate for the embeddings. With that, we empirically found that factors of 10–50 times the original learning rate were able to tackle the issue, leading to performances that were almost as good as the final ones reported in the main paper. However, the use of a different learning rate introduced an additional parameter that we could not conceptually relate to catastrophic forgetting and that could have been tricky to tune for a generic setting. We also studied the use of an adaptive optimizer such as Adagrad (Duchi et al., 2011) or Adam (Kingma & Ba, 2015) for the embedding weights. The idea was that an adaptive optimizer would be able to automatically introduce an appropriate scaling factor. We found that this option was effectively learning suitable values for etl . However, its performance was worse than the constant-factor SGD boost explained above. Noticeably, introducing an adaptive optimizer also introduces a number of new hyperparameters: type of optimizer, another learning rate, weight decays, etc. D.2. Annealing In our effort to further reduce the number of hyperparameters, we experimented for quite some time with the annealing    b−1 π 1+ s = tan 4 B−1 or using variants of  s = α + β tan π b−1 2 B−1  . The rationale for the first expression is that one starts with a sigmoid σ(sx) that is equivalent to a straight line of 45 degrees for b = 1 and x ≈ 0. Then, with b increasing, it linearly increases the angle towards 90 degrees at x = 0. The second expression is a parametric evolution of the first one. These annealing schedules have the (sometimes desirable) feature that the maximum s is infinite, yielding a true step function in inference time. Therefore, we obtain truly binary attention vectors atl and no forgetting. In addition, if we use the first expression, we are able to remove the smax hyperparameter. Nonetheless, we found the first expression to perform worse than the solution proposed in the main paper. The introduction of the second expression with α = 1 and β < 1 improved the situation, but results were still not as good as the ones in the main paper and the tuning of β was a bit tricky. To conclude this subsection, note that if smax is large, for instance smax > 100, one can use s = smax b−1 , B−1 which is a much simpler annealing formula that closely approximates the one in the main paper. However, one needs then to be careful with the denominator of the embedding gradient compensation when s = 0. D.3. Gate We also studied the use of alternatives to the sigmoid gate. Apart from the rescaled tanh, an interesting alternative we thought of was a clamped version of the linear function,    setl 1 t al = max 0, min 1, + , r 2 where r defines the ‘valid’ range for the input of the gate. This gate yields a much simpler formulation for the gradient compensation described in the main paper. However, it implies that we need to set r, which could be considered a Overcoming Catastrophic Forgetting with Hard Attention to the Task further hyperparameter. It also implies that embedding values that are far away from 0, the step transition point, receive a proportionally similar gradient to the ones that are close to it. That is, values of etl that yield atl that are very close to 0 or 1 (in the constant region of the pseudo-step function) are treated equal to the ones that are still undecided (in the transition region of the pseudo-step function). We did not test this alternative gate quantitatively. D.4. Cumulative Attention In the most preliminary stages we used a≤t l =1− h 1 − atl   1 − al≤t−1 i for accumulating attention across tasks, but it was soon dismissed for the final max-based formula. The previous equation could be interesting for online learning scenarios with limited model capacity, together with   ≤t−1 t a≤t , l = max al , κ al where κ is a constant slightly lower than 1 (for instance κ = 0.9 or κ = 0.99). D.5. Embedding Initialization We ran a set of experiments using uniform initialization U(0, k1 ) for the embeddings etl instead of Gaussian N (0, 1). We also experimented with N (k2 , 1). The idea behind these alternative initializations was that, for sufficiently large smax , all or almost all atl start with a value of 1, which has the effect of distributing the attention over all units for more time at the beginning of training. Using values of k1 ∈ [1, 6] and k2 ∈ [0.5, 2] yielded competitive results, yet worse than the ones using N (0, 1). Our intuition is that a uniform initialization like U(0, 2) is better for a purely compressive approach, as used in the last experiment of the main paper. D.6. Attention Regularization We initially experimented with a normalized L1 regularization PL−1 PNl t  l=1 i=1 al,i t R A = . PL−1 l=1 Nl Results were a small percentage lower than the ones with the attention-weighted regularization of the main paper. We also exchanged the previous L1 regularization with the L2-based regularization PL−1 PNl t 2  l=1 i=1 (al,i ) t R A = . PL−1 l=1 Nl With that, we observed similar accuracies as the L1 regularization, but under different values for the hyperparameter c. D.7. Hard Attention to the Input As mentioned in the main paper, no attention mask is used for the input (that is, there is no at0 ). We find this is a good strategy for a general image classification problem and for first-layer convolutional filters in particular. However, if the input consists of independent, isolated features, one may think of putting hard attention to the input as a kind of supervised feature selection process. We performed a number of experiments using only fully-connected layers and the MNIST data as above, and introduced additional hard attention vectors at0 that directly multiplied the input of the network. The results suggested that it could potentially be a viable option for feature selection and data compression (Fig. 10). E. A Note on Binary Masks After writing a first version of the paper, we realized that the idea of a binary mask that affects a given unit could be potentially traced back to the “inhibitory synapses” of McCulloch & Pitts (1943). This idea of inhibitory synapses is quite unconventional and rarely seen today (Wang & Raj, 2017) and, to the best of our knowledge, no specific way for learning Overcoming Catastrophic Forgetting with Hard Attention to the Task Figure 10. Example of an input mask for MNIST data after training to convergence. such inputs nor a specific function for them have been proposed. Weight-based binary masks are implicitly or explicitly used by many catastrophic forgetting approaches, at least by Rusu et al. (2016); Fernando et al. (2017); Mallya & Lazebnik (2017); Nguyen et al. (2017); Yoon et al. (2018). HAT is a bit different, as it learns unit-based hard attention vectors, with possible (but not necessarily) binary values.
2cs.AI
Modeling and Control of Inverted Flight of a Variable-Pitch Quadrotor Namrata Gupta, Mangal Kothari∗, and Abhishek† Abstract arXiv:1709.06407v1 [cs.SY] 19 Sep 2017 This paper carries out the mathematical modeling, simulation, and control law design for a quadrotor with variable-pitch propellers. The use of variable-pitch propeller for thrust variation instead of RPM regulation facilitates generation of negative thrust, thereby augmenting the rate of change of thrust generation amenable for aggressive maneuvering. Blade element theory along with momentum theory is used to estimate propeller thrust and torque essential for formulating equation of motion of the vehicle. The proposed flight dynamics model is used for non-linear control design using dynamic inversion technique, which is then used to stabilize, track reference trajectory, and simulate flip maneuver. The rotor torque is an irrational function of the control input which makes the control design challenging. To address this problem, the control design employs three loops. The outer loop solves the translational dynamics to generate the thrust, pitch angle, and roll angle commands required to track the prescribed trajectory. Using the command generated in the outer loop, the inner loop simplifies the rotational dynamics to provide the desired rate of angular velocities. A control allocation loop is added to address the problem of nonlinearity associated with rotor torque. This is done by introducing the derivative of thrust coefficient as a virtual control input. These virtual inputs determine the derivatives of thrust and body moments, which in turn is used to generate the required thrust and body moments. The concept is validated by showing attitude stabilization in real flight for a variable pitch quadrotor. The performance of the proposed design is shown through simulated results for attitude stabilization and trajectory following. Reverse thrust capability of variable-pitch quadrotor is also shown by performing flip maneuver in which quadrotor roll angle changes from 0 to 180 degrees. 1 Introduction Last decade saw the development of various configurations of Unmanned Aerial Vehicles (UAVs) capable of hovering flight. UAV configurations ranging from flapping wing, rotary wing to cycloidal rotor concept have been developed and studied in recent years (see Refs. [1, 2, 3, 4, 5, 6, 7]). Some of these designs have seen greater success than others. Researchers around the world have been working on different rotary wing configurations such as the Micro Coaxial ∗ Department † Department of Aerospace Engineering, Indian Institute of Technology, Kanpur, Uttar Pradesh, India, email: [email protected] of Aerospace Engineering, Indian Institute of Technology, Kanpur, Uttar Pradesh, India, email: [email protected] 1 Rotorcraft (MICOR) [3], muFly [4], RoboFly or the Samara Micro Air Vehicle (MAV) – a prop assisted mono blade [5], Coanda UAV [6], and Cycloidal rotor MAV [7]. Among these the most successful configuration which caught the eyes of researchers and amateurs alike in the early 2000s is the quadrotor configuration. Since then, the quadrotors have been extensively studied and several papers have been authored studying their dynamics, stabilization, and control. Some of the notable pioneering works include that by Bouabdallah et al. [8, 9] on ETH Zürich’s ‘OS4’ (a belt-driven indoor quadrotor vehicle) and Castillo et al. [10]. The commercial success for this configuration can be gauged from the fact that quadrotors with all up weights ranging from 50 grams to 15–20 kg can be bought off-the-shelf and can be used for a variety of missions. The conventional quadrotor with fixed pitch propellers is controlled by varying the RPM of the individual motors and suffers from a few limitations: i) the rotational inertia of the motors limits the control bandwidth of the system [11]; and ii) the stabilization of larger quadrotors through RPM control alone becomes challenging as a point can be reached where the torque required to change the RPM of the motor exceeds the capacity of the motor. Due to these limitations, the current flight control strategy of quadrotors is not suitable for larger full scale vehicles meant for lifting heavy payload. These limitations can be overcome by employing a quadrotor design with variable-pitch control [12]. It would appear that the use of variable-pitch propellers add complexity to a simple and robust quadrotor design. But, the advantages of increased controller bandwidth due to the availability of reverse thrust from propellers and scalability to full scale size justify the design. The idea of variable-pitch propeller based quadrotor is an old one. It has somehow not attracted enough attention from researchers, until recently. In 1922, Georges de Bothezat and Ivan Jerome built and flew the “Flying Octopus” a quadrotor with rotors located at each end of a truss structure of intersecting beams, placed in the shape of a cross. Control of the machine was achieved by changing the pitch of each of the propellers [13]. The Hoverbot, developed at University of Michigan by Johann Borenstein [14] is the first documented effort at designing and flying a small scale quadrotor with variable pitch control. However, the Hoverbot never achieved flight beyond tethered hovering. In recent past, while, several hobbyists have demonstrated the construction and flight of remote controlled variablepitch quadrotors, a serious and organized effort of studying the flight mechanics and control of a variable-pitch quadrotor was demonstrated by Cutler et al. [11, 15]. To keep the design simple, the four motor based design of fixed pitch quadrotor was retained and a mechanism similar to tail rotor swashplate was used to change the blade pitch angle for each of the propellers. The flight performance of variable-pitch quadrotor with fixed pitch ones was systematically studied and the following conclusions were made: (i) the variable-pitch propeller quadrotor could generate significantly large rate of change of thrust when compared to a fixed-pitch design, thereby improving the capability to perform 2 aggressive maneuvers; and (ii) the ability to generate negative thrust by variable-pitch propellers can be utilized to perform aerobatics and allow for inverted flight. However, the dynamics of variable-pitch quadrotor UAV has not been studied in detail and therefore model based control has not been applied for control and navigation of such quadrotors until recently. It should be noted that the thrust for variable pitch propellers not only depend on RPM but also on the blade pitch angle. Unlike RPM controlled quadrotors, designing a controller for these vehicles is challenging as the function representing the relation between thrust and torque with blade pitch angle is not rational. Therefore, the control design methods available for RPM controlled quadrotors cannot be applied as it is for variable-pitch quadrotors. Previously, approaches like backstepping [16, 17], sliding mode [18], nonlinear dynamic inversion (NDI) [19], [20], adaptive control [21, 22, 23, 24], have been applied to design controller for quadrotors. A comparison study was carried out in [25] using visual feedback for stabilization and tracking. Cutler et al. [26] carried out the analysis and control design for the variable-pitch quadrotor. However, the analytical model developed for the variable-pitch quadrotor in this paper suffers from some serious errors. First, in the paper the angle of attack used for computing the blade lift and drag forces has erroneously been replaced with geometric blade pitch angle ignoring the contribution of the blade induced velocity (inflow) component which has significant effect on angle of attack. The inflow angle is a function of thrust being generated by the rotor which in turn is a function of blade pitch angle itself. Therefore, ignoring the induced inflow angle would result in significant overestimation of the lift and drag forces. Further, this mistake simplifies the control design. Second, the paper assumes that the multiplication of a constant “drag coefficient” with thrust force would result in yawing moment. This is only valid for a fixed-pitch propeller which has constant thrust and torque coefficients. The torque responsible for yawing motion of a variable pitch quadrotor is a function of blade pitch angle itself and therefore cannot be obtained by merely multiplying the thrust with a constant factor for entire range of pitch angles. While the theoretical model was incorrect, authors in [26] were able to demonstrate the flight of variable pitch quadrotor using PID control design. The flight dynamics model of variable-pitch quadrotor aerial vehicle was first proposed in [27] in which the controller was used to perform attitude stabilization and trajectory tracking. The detailed control design and ability to perform flip maneuver has not been studied for a variable-pitch quadrotor using a model based controller and this is the focus of the present paper. The present paper focuses on development of flight dynamics model based on Blade Element Theory (BET) and uniform inflow for variable pitch quadrotor is presented. Next, the control design based on dynamic inversion technique is developed for aggressive maneuvering of variable-pitch quadrotors. The challenge associated with the control allocation in variable-pitch quadrotors is addressed by use of an additional loop that dynamically allocates control to generate the desired thrust and moments. Finally, the nonlinear controller is used to simulate the stabilization, flip 3 and upright/inverted trajectory following of the variable pitch quadrotor. The contributions of this paper are two folds: (i) establish the detailed dynamics model of variable-pitch quadrotor aerial vehicle; and (ii) develop and apply a nonlinear controller for stabilization, trajectory tracking and inverted flight. In addition to this, the new design is validated by showing attitude stabilization in real flight. 2 Quadrotor Modeling The strategy for controlling a variable-pitch quadrotor is significantly different from that of conventional fixed-pitch propeller based quadrotor and is discussed in this section. After establishing the control strategy, the six degrees of freedom (six-DOF) Newton-Euler equations representing the dynamics of variable-pitch quadrotor vehicle are derived. 2.1 Strategy for Control Like the conventional quadrotor, the primary control of various motions (three translational, roll, and pitch motions) for variable-pitch quadrotor is achieved by changing the thrust of different rotors in various combinations. However, the mechanism of thrust variation is different. The change in thrust is achieved by simultaneously changing the pitch angle (collective angle) of all the blades. The control of yawing motion and the mechanism involved is significantly different as discussed below. It should be noted that any point of time all the rotors are operated at the same nominal RPM which may be regulated about the specified value for setting the baseline value of thrust. Figure 1: Translational flight and roll motion control of variable pitch quadrotor The up/down motion is easily controlled by collectively increasing or decreasing the collective pitch angles for all the 4 rotors / propellers simultaneously. Side-wards flight can be achieved as explained in Fig. 1. For example, increasing the collective input and thereby increasing the thrust of the two left rotors lifts the left side up and generates a net thrust component to the right. Consequently, the quadrotor would move to the right. The change in torque/power of the two left rotors is equal and opposite, therefore, the moment remains balanced and pure translational motion can be achieved. By the same principle, increasing the collective of the two rear rotors would result in forward flight. The yaw control is less intuitive. Figure 2: Yaw motion control of variable pitch quadrotor The method of generating yawing moment is identical to that used for coaxial and tandem helicopters and is known as “differential collective”. In this, the collective pitch of the two diagonal rotors rotating in the same direction is increased and the collective pitch of the other diagonal pair is reduced. The increased collective pitch results in increasing the lift and drag forces experienced by both these rotors, while the other two rotors would experience an identical reduction in lift. The rotors with increased lift and drag would experience an increase in profile and induced torque components compared to the other two rotors which would experience a decrease in the total torque. This net increase in the combined torque of all the rotors would result in yawing motion of the quadrotor as explained in Fig. 2. It should be noted that this operation has no effect on translational motion, as the combined thrust of all four rotors remain unchanged. 2.2 Kinematics For describing the rigid body dynamics of the quadrotor two coordinate systems, as shown in Fig. 3, are employed: the inertial and body fixed coordinates. All the physical quantities are transformed between the two coordinate systems using the classical Euler angles (φ-roll, θ-pitch, ψ-yaw). For modeling using quaternions, refer [28]. The following 5 Figure 3: Coordinate systems used for development of equation of motion expression relates the velocity of quadrotor in these two frames:      x   u         d   y  = Ri  v  b    dt         z w where   CθCψ   i Rb =   CθSψ   −Sθ SφSθCψ − CφSψ SφSθSψ + CφCψ SφCθ (1)  CφSθCψ + SφSψ    CφSθSψ − SφCψ  ,   CφCθ Cβ , cos β and Sβ , sin β. [x,y,z] are the position in the inertial frame and [u,v,w] are the velocity components in the body frame. Similarly, the following expression relates the body rates to Euler angle rates:     φ̇   1        θ̇  =  0          0 ψ̇ SφSθ Cθ Cφ Sφ Cθ CφSθ Cθ    p        −Sφ   q       Cφ r Cθ where [p,q,r] are the angular velocity components (roll, pitch, and yaw) in the body frame. 6 (2) 2.3 Dynamics The rigid body equation of motion of the quadrotor can be derived by applying the linear momentum and angular momentum conservation laws. In present work, propulsive forces (thrust and torque from the motors) and the gravitational forces are assumed to be the dominant forces. The aerodynamic forces (such as lift and drag) acting on the fuselage are neglected assuming them to be very small. Transforming the gravitational force to the body coordinate axes, the translation dynamics of the quadrotor is given as follows:     u̇          v̇  =           ẇ  0 0 T ∗f lag M     + [Rbi ]T        0   rv − qw        0  +  pw − ur          g qu − pv         (3) f lag = −sgn(cosφ) where T is the total thrust from all the rotors, M is the mass of the quadrotor, and g represents gravitational acceleration. Eq. (3) expresses quadrotor’s translational dynamics in the body fixed coordinate system. The variable f lag decides the direction of thrust vector in the body coordinate system and is negative for roll angle (φ) less than 90◦ and becomes positive causing reversal of thrust direction for φ greater than 90◦ and less than or equal to 180◦. The translational dynamics can also be be expressed in the inertial frame as:     ẍ   0        ÿ  = Ri  0 b         T z̈ −M      0        + 0           g (4) Note that the translation dynamics is presented in both the body and inertial frames for its application in the control design. It is safe to assume that the quadrotor is symmetric about x and y axes, which allows for the rotational dynamics to be represented as:     ṗ          q̇  =           ṙ Iyy −Izz Ixx qr         + Izz −Ixx pr   Iyy     Ixx −Iyy pq Izz l Ixx m Iyy n Izz         (5) where Ixx , Iyy , and Izz are moments of inertia about x-axis, y-axis, and, z-axis, respectively. By the virtue of symmetry, the product of inertia terms are assumed to be zero. Here, l, m, and n are the components of the externally applied moments known as rolling, pitching, and yawing moments, respectively. Eqs. (1)-(5) together represent the complete equation representing the full six degrees of freedom for the quadrotor. 7 2.4 Rotor Dynamics Unlike the conventional fixed-pitch quadrotors, the thrust from individual rotors, Ti , is varied by changing their collective pitch input. The thrust and moment equilibrium equations for the “H” configuration (similar to “X” configuration) of the quadrotor is derived about hover condition as shown below. Blade element theory along with momentum theory [13] is used to calculate thrust and torque of each rotor as a function of thrust coefficient. With the assumption of the blades being rigid, the aerodynamic forces and moments generated by each rotor can be calculated using blade element theory in which each blade is divided in to a number of elements such that each element is a 2D airfoil. In this, the contribution of each blade element to the total airload (lift, drag, and pitching moment) is calculated and then integrated over the blade radius to calculate the net thrust and torque contribution of each blade, which is then multiplied with number of blades of calculate the total thrust and torque from each rotor. Using the approach given in [13], the non-dimensional thrust coefficient, CTi , and torque coefficient, CQi , for the ith rotor are given by CTi = CQi =   λi θ0i 1 σClα − 2 3 2   Cdoi 1 λ2 Cl λi Clα θ0i σ − i α + 2 3 2 4 (6) (7) where Clα is the lift curve slope, θ0i is the blade collective pitch angle of the ith rotor, λi is the induced inflow of the ith rotor, Cdoi is the zero lift drag coefficient of the airfoil of the ith rotor, σ = Nb c πR . Here, Nb is number of blades, c is the chord length of the rotor, R is the rotor blade radius. These non-dimensional quantities can be converted to corresponding dimensional parameters by using Ti = CTi ρAVtip 2 and Qi = CQi ρARVtip 2 , where ρ is the density of air, A is the rotor disk area, Vtip = ΩR is the tip speed of rotor blade rotating with angular speed of Ω. The only unknown parameter in Eqs. (6) and (7) is the inflow ratio λi which can be evaluated using momentum theory for the hovering flight condition and is given by Eq. (8) λi = r CTi 2 (8) Substituting the value of λi in Eq. (6) gives CTi 1 = σClα 2 θ0i 1 − 3 2 r CTi 2 ! (9) which upon rearrangement yields θ0i 6CTi 3 = + σClα 2 8 r CTi 2 (10) Using the above pitch angle and inflow ratio in Eq. (7) gives CQi 1 = σ 2 ! √ 3 Cdoi 2CTi 2 + σ 4 (11) From the above definitions of thrust and torque it can be seen that Ti = KCTi (12) Qi = KRCQi (13) where K = ρAVtip 2 . K is typically constant for the variable pitch quadrotor as the rotor speed is regulated about a prescribed constant value. The total thrust generated by the vehicle is then given as: T = f lag × (T1 + T2 + T3 + T4 ) (14) T = f lag × K(CT1 + CT2 + CT3 + CT4 ) (15) Rolling and pitching moments are obtained by cross multiplying thrust from each rotor with its respective moment arm. Yawing moment is obtained from Eq. (11). Due to the relative sense of rotation, Rotors 1 and 3 produce torque in positive z direction, while Rotors 2 and 4 produce torque in opposite direction. The contribution of blade drag to total torque (shown in Eq. (11)) is independent of thrust and hence remains constant at all times and cancels out for four rotors. The final expressions for total forces and moments acting on the quadrotor are shown in Eq. (16). T = f lag × K(CT1 + CT2 + CT3 + CT4 ) l = d × K(CT1 − CT2 − CT3 + CT4 ) (16) m = −f lag × Kd(CT1 + CT2 − CT3 − CT4 ) 3 3 3 3 KR n = −f lag × √ (|CT1 | 2 − |CT2 | 2 + |CT3 | 2 − |CT4 | 2 ) 2 where d is the moment arm of rotors from the center of gravity. 3 Control Design This section develops a controller for variable-pitch quadrotor for stabilization, tracking, and aggressive maneuvers using nonlinear dynamic inversion approach [29], [20]. The variable-pitch quadrotor is an under actuated system like 9 the conventional RPM regulated quadrotor. However, the dynamics of variable-pitch quadrotor is relatively more complex than the conventional quadrotors as the rotor thrust, roll, and pitch moment equations are linear functions of control input whereas the roll moment is a nonlinear function of control input. Therefore, a closed form solution to these equations is not possible and iterative online solution of the system of equations is tedious and impractical. To address this problem, the control design incorporates three loops: outer loop, inner loop, and control allocation loop. Note that the outer and inner loops are similar to the conventional design. This means that the outer loop is responsible for trajectory tracking whereas the inner loop provides stability. An extra loop is added to dynamically allocate control to determine blade pitch angles of individual rotors. Let the state of variable-pitch quadrotor be X , [x y z φ θ ψ u v w p q r]T . For tracking and stabilization, the output of quadrotor is chosen as Y , [x y z φ θ ψ]T . The control objective is to drive Y to some desired output, Yd . In order to achieve this, the proposed design use a two loop structure by exploiting the time scale separation principle. The outer loop operates on position yout = [x roll angle, φd , and pitch angle, θd . The inner loop drives yin = [φ Uin = [ld md y θ z]T and generates the desired thrust, Td , ψ]T to yind = [φd θd ψd ]T by generating nd ]T . As the relation between torque and blade pitch angle is nonlinear, a control allocation loop is included to solve the problem of nonlinearities. For this loop, the derivatives of thrust coefficients act as virtual inputs, the value of which needs to be determined to generate the desired thrust and moments. The thrust coefficients are computed by integrating the derivatives of thrust coefficients. The required blade pitch angle for individual rotors is then calculated. The control allocation loop computes the required blade pitch angles to generate the desired thrust and moments. To differentiate whether the quadrotor is upright or inverted, while tracking the given trajectory, a command variable σd is introduced, where σd = sgn(cosφd ). σd is negative when quadrotor is in the inverted flight, i.e, φd is greater than 90o . Another variable f lip, which is set to zero to begin with, is used to check if the quadrotor has achieved required φd . The variable f lip becomes 1, once desired φd is achieved. 3.0.1 Outer Loop Design ∆ The tracking error in position can be defined as e = yout − youtd , where yout and youtd are the current and desired outputs of a quadrotor in the inertial frame. As the relative degree is two, we choose second order stable error dynamics to synthesize the control as follows ë + 2ζωn ė + ωn2 e = 0 10 (17) From Eq. 4 and Eq. 17, we get     i  Rb    0 0 T −M          +    0       0        g =   ẍd       ÿ   d      z̈d 2ζout ωnout T +   ẋd − ẋ    ẏ − ẏ  d   żd − ż         + ωnout ωnout T   xd − x    y −y  d   zd − z         (18) ζout and ωnout are 3 × 1 matrices. The required thrust and desired roll and pitch angles are given as: Td = M f lag p ẍ2 + ÿ 2 + (g − z̈)2 φd = sin−1 (ux sin ψd − uy cos ψd ) θd = sin−1 (19) ux cos ψd + uy sin ψd cos φd where ux = M ẍ/Td uy = M ÿ/Td The quadrotor is commanded to perform flip maneuver by setting σd negative, which commands the quadrotor to flip itself, before tracking the trajectory (this means f lip = 0). At this stage, controller only tracks the altitude and attitude and hence first and second terms of ωnout are zero, as a result ẍ and ÿ are zero. The variables φd and θd remain the same. After substituting ẍ and ÿ in Eq. 19, the desired thrust is given by Td = M ∗ f lag ∗ abs(z̈ − g). Once the quadrotor is flipped (f lip = 1), it is commanded to follow the given trajectory and generate acceleration along x and y directions, hence the first and second terms of ωnout become non-zero. The expressions for Td and θd remain the same as in Eq. (19) whereas φd can be expressed as: φd = π − sin−1 (ux sin ψd − uy cos ψd ) 3.0.2 (20) Inner Loop Design For designing the inner loop, we again choose the second order stable error dynamics on attitude as:      φ̈   φ̈d           θ̈  =  θ̈  + 2ζin ωnin T    d          ψ̈d ψ̈   φ̇d − φ̇    θ̇ − θ̇  d   ψ̇d − ψ̇ 11      + ωnin ωnin T      φd − φ    θ −θ  d   ψd − ψ         (21) The Eulerian angular rates in Eq. 21 is obtained by transforming the body rates to Eulerian rates using Eq. 2. The onboard sensors measure the rate of rotation of a quadrotor in the body frame. The Eulerian angular acceleration computed using the error dynamics is transformed to obtain desired body angular acceleration as follows     ṗ       q̇        ṙ 0 −Sθ  1    0 Cφ SφCθ    0 −Sφ CφCθ =     φ̈        θ̈        ψ̈   0    0    0 + 0 Sφφ̇ Cφφ̇     φ̇        −SφSθθ̇ − CφCθφ̇   θ̇       ψ̇ −SθCφθ̇ + SφCθφ̇ Cθθ̇ (22) This desired body angular acceleration relation in Eq. 22 is obtained by first inverting the Eq. 2 and then differentiating it with respect to time. In order to generate the desired body rates in Eq. 22, the quadrotor needs to generate the following moments:   ld    m  d   nd     Ixx ṗ + (Izz − Iyy )qr      =  I q̇ + (I − I )pr   yy xx zz     Izz ṙ + (Iyy − Ixx )pq         (23) Next, the task is to determine the required thrust coefficient (blade pitch angle) to generate the thrust and moments calculated from the outer and inner loops. 3.0.3 Control Allocation Loop For the given Td , ld , md , and nd , the task is to find CTi , ∀ i, i=1, 2, 3, 4 by solving Eq. 16. It can be seen that Eq. 16 is not rational (the yawing moment equation), therefore it is difficult to explicitly obtain the values of CTi . To overcome this challenge, an additional loop that computes the desired rate of change in blade pitch angles for the given Td , ld , md , and nd is used. The objective of control allocation location loop is to determine U = [ĊT1 that drives [T l m n] to [Td ld md ĊT2 ĊT3 ĊT4 ]T nd ]. For achieving this, the following second order stable error dynamics is chosen to synthesize the virtual control:      p̈   p̈d           q̈  =  q̈  + 2ζCA ωnCA T    d          r̈d r̈   ṗd − ṗ    q̇ − q̇  d   ṙd − ṙ      + ωnCA ωnCA T      pd − p    q −q  d   rd − r         (24) As the error dynamics are chosen on body rates, the desired body angular accelerations are obtained from Eq. 22. The actual body angular acceleration is obtained from Eq. 5. By solving the above error dynamics, we get moment 12 rates as:       ˙  l  Ixx p̈ (Iyy − Ixx )(q ṙ + rq̇)             ṁ =  I q̈  − (I − I )(pṙ + rṗ)    yy   zz  xx             ṅ Izz r̈ (Ixx − Iyy )(pq̇ + q ṗ) (25) Next, a first order error dynamics is applied on thrust to calculate its rate. The error dynamics is as follows Ṫ = kp (Td − T ) (26) where kp > 0 is some proportionality constant. Using Eqs. 25 and 26, ĊTi are computed as follows    Kf lag ĊT1         Ċ   Kl  T2    =    Ċ   −f lagKl  T3      q    |cT 1 | 3KR Ċt4 −f lag 2 2 Once virtual control input U = [ĊT1 ĊT2 Kf lag Kf lag Kf lag −Kl −Kl Kl −f lagKl q |ct2 | 3KR f lag 2 2 f lagKl q |ct3 | 3KR −f lag 2 2 f lagKl q |ct4 | 3KR f lag 2 2 ĊT3 −1               Ṫ       l˙        ṁ       ṅ (27) ĊT4 ]T is obtained, it is integrated with the system dynamics to obtain the thrust coefficients. For the given thrust coefficients, the desired pitch angle can be obtained by solving Eq. 10. The control architecture block describing the control flow is shown in Fig. 4. Figure 4: A control architecture block 13 4 Numerical Results In this section, the performance of the controller for a variable-pitch quadrotor is demonstrated through four examples. First, the stability of the inner loop is shown by stabilizing the perturbations given in the attitude from the hover state. Next, the overall performance is demonstrated by tracking a given trajectory. Next, the controller performs a flip maneuver on the quadrotor to enable inverted flight while maintaining altitude. Finally, the quadrotor tracks a sinusoidal trajectory in inverted state. The parameters used for numerical simulation of the variable pitch quadrotor are given in Table 1. Table 2 lists the control design parameters used for outer, inner and control allocation loops. Table 1: Parameters for variable pitch quadrotor used for numerical results Mass of quadrotor, M 1.34 kg Radius of rotor blades, R 0.18 m Chord of rotor blades, c 0.03 m Distance of rotor axis from cg, d 0.3 m 5.23 Airfoil lift curve slope, Clα 0.01 Airfoil drag coefficient, Cd0 Number of blades, Nb 2 Rotational speed, Ω 282.7 rad/sec Moment of Inertia, Ixx 1 × 10−3 kg-m/sec2 Moment of Inertia, Iyy 1 × 10−3 kg-m/sec2 Table 2: Parameters used for control design ζout [0.95 0.95 0.95]T [4.7 4.7 4.7]T ωnout ζin [0.92 0.92 0.92]T [30.5 30.5 20.5]T ωnin ζCA [0.91 0.91 0.91]T [50 50 25]T ωnCA kp 10 4.1 Attitude Stabilization The variable-pitch quadrotor is a fairly new concept and therefore it is necessary to validate that vehicle attitude can be stabilized changing blade pitch angle before we give simulation results. Toward this, a proof-of-concept single power plant electric powered variable pitch quadrotor UAV is designed. A PID controller based autopilot is developed and implemented on open source Pixhawk autopilot board to demonstrate attitude stabilization. The attitude controller designed on inner loop generates the desired roll, pitch, and yaw moments. The desired thrust is computed from the altitude stabilization. For control allocation, we assume that thrust and the moments are linear functions of blade pitch angle. This assumption makes CTi calculation simple and enables the computation of the desired blade pitch angle using (9). Figure 4.1 shows the attitude tracking performance for roll (Fig. 5(a)), pitch (Fig. 5(b)) and yaw (Fig. 5(c)) attitudes during closed-loop flight test of the proof-of-concept UAV. It can be observed that the controller 14 40 30 Roll attitude setpoint Roll attitude achieved 30 Pitch attitude (deg) Roll attitude (deg) 20 10 0 −10 −20 10 0 −10 −20 −30 −40 0 Pitch attitude setpoint Pitch attitude achieved 20 2 4 6 Time (sec) 8 −30 0 10 2 (a) Roll attitude 4 6 Time (sec) 8 10 (b) Pitch attitude 90 Yaw attitude (deg) 60 Yaw attitude setpoint Yaw attitude achieved 30 0 −30 −60 −90 0 2 4 6 Time (sec) 8 10 (c) Yaw attitude is able to accurately track the commanded setpoints for each of the vehicle attitudes. The setpoints during the flight test are being provided by human pilot through a joy-stick. 4.2 Position Stabilization To demonstrate the ability of the controller to stabilize and maintain vehicle position in the event of disturbance, the initial values of roll (φ), pitch (θ), and yaw (ψ) angles are perturbed by 45◦ , 30◦ and 10◦ , respectively. The controller brings back the vehicle to hover attitude by reducing the given perturbations quickly. The time history of attitude variation during this process is shown in Fig. 5(d). The act of stabilizing the quadrotor against large disturbance results in rapid changes in individual rotor thrust resulting in change in position of the quadrotor. But, once the attitude disturbance is controlled back to the desired state, the deviation in position is also reduced to zero. The time history of variation in x, y, and z position coordinates during the stabilization is shown in Fig. 5(e). It is observed that the attitude is stabilized in less than one sec and the position is restored in less than 1.5 sec. The overall variation in position in three-dimensions is shown in Fig. 6 and is observed to be small. The time history of variation of coefficient of thrust CT for individual rotors required for stabilizing the quadrotor is shown in Fig. 7. The corresponding collective pitch input required to achieve this thrust coefficient is shown in Fig. 8. Even though the vehicle is released from an attitude which is significantly disturbed from the desired hover attitude, the stabilization 15 Current Angle Desired Angle 0 X (m) φ (deg) 50 0 -50 0 0.5 1 Time (s) 1.5 -0.02 -0.04 -0.06 2 40 Y (m) θ (deg) 0 0.5 1 Time (s) 1.5 2 0 0.5 1 Time (s) 1.5 2 0 0.5 1 Time (s) 1.5 2 0.1 20 0 0.05 -20 0 0.5 1 Time (s) 1.5 0 2 10 0.04 Z (m) ψ (deg) Current state Desired trajectory 5 0 0 0.5 1 Time (s) 1.5 0.02 0 -0.02 2 (d) Attitude (e) Position Figure 5: Position and attitude variation during quadrotor stabilization Initial position Initial desired position Current state 0.03 Z (m) 0.02 0.01 0 −0.01 0.1 0 0.05 Y (m) −0.02 0 −0.06 −0.04 X (m) Figure 6: Variation in position shown in three-dimensions during quadrotor stabilization 16 0.02 CT 2 CT 1 0.02 0.01 0.01 0 0 0 2 0 1 Time (s) 2 0 1 Time (s) 2 0.02 CT CT 3 4 0.02 1 Time (s) 0.01 0.01 0 0 0 1 Time (s) 2 Figure 7: Time history of required thrust coefficients for stabilizing the quadrotor of the quadrotor is achieved with moderate control actuation (less than 16◦ ). Next, the performance of the controller in trajectory tracking is demonstrated. 4.3 Trajectory Tracking The trajectory tracking capability of the controller is evaluated by commanding it to follow a sinusoidal path. The initial position of the quadrotor is set as the origin (0,0,0), the attitude angles (φ, θ, ψ) are (0◦ , 0◦ , 0◦ ). The quadrotor is commanded from this position to follow a sinusoidal input of sin( π2 t) meters in X, Y , and Z directions. The controller is able to track the trajectory accurately as observed from the time history of variation of attitude and position during the trajectory tracking shown in Figs. 9(a) and 9(b). In order to follow the given trajectory, the outer loop generates required roll (φ) and pitch (θ) commands which are shown by dashed line in Fig. 9(a). The red line shows the tracking of desired command. The trajectory traced by the quadrotor in three-dimensions is shown in Fig. 10, which is a slanted circle. The given command is shown by dashed line and the accurately tracked trajectory is shown using solid lines. Since, the x, y, and z coordinates depicting the location of the vehicle are varying sinusoidally, it is expected that the controller input would also vary sinusoidally as shown in Figs. 11 and 12. Again, it can observed from these figures that the controller is able to regulate the blade pitch angles and thereby generate required thrust to track the prescribed trajectory. 17 20 (deg) (deg) 20 10 θ θ 0 0 1 2 10 0 0 0 2 0 1 Time (s) 2 0 1 Time (s) 2 20 θ 0 (deg) (deg) 20 1 Time (s) θ 0 4 10 3 10 0 0 0 1 Time (s) 2 Figure 8: Time history of required collective pitch inputs for stabilizing the quadrotor X (m) φ (deg) 10 0 0 2 4 6 Time (s) 8 10 50 2 0 1 Y (m) θ (deg) 0 -1 -10 -50 0 2 4 6 Time (s) 8 10 0 2 4 6 Time (s) 8 10 0 2 4 6 Time (s) 8 10 0 -1 -100 0 2 4 6 Time (s) 8 10 2 2 0 1 Z (m) ψ (deg) Current state Desired trajectory 1 Current Angle Desired Angle 20 -2 0 -1 -4 0 2 4 6 Time (s) 8 10 (a) Attitude (b) Position Figure 9: Position and attitude variation during tracking of prescribed trajectory by quadrotor 18 Initial position Current state Initial desired position Desired trajectory 1.5 Z (m) 1 0.5 0 -0.5 2 1 1 0 0 Y (m) -1 -1 X (m) Figure 10: Variation in position of quadrotor shown in three-dimensions during tracking of prescribed trajectory 0.02 CT CT 1 2 0.02 0.01 0 0 5 Time (s) 0 0 10 5 Time (s) 10 5 Time (s) 10 4 0.02 CT 3 0.02 CT 0.01 0.01 0 0 5 Time (s) 0.01 0 0 10 Figure 11: Time history of required thrust coefficients for tracking prescribed trajectory 19 (deg) 15 10 10 θ 0 2 1 θ0 (deg) 15 5 0 5 Time (s) 5 0 10 10 5 Time (s) 10 (deg) 15 10 4 10 θ 0 3 θ0 (deg) 15 5 Time (s) 5 0 5 Time (s) 5 0 10 Figure 12: Time history of required collective pitch inputs for tracking prescribed trajectory 0.01 100 X (m) φ (deg) 200 Current angle Desired angle 0.5 1 Time (s) 1.5 0 -0.01 0 0 2 0 0.5 1 Time (s) 1.5 2 0 0.5 1 Time (s) 1.5 2 0 0.5 1 Time (s) 1.5 2 1 Y (m) 0.01 θ (deg) Current position Initial position 0 0 -1 -2 -0.01 0 0.5 1 Time (s) 1.5 2 0.2 Z (m) ψ (deg) 0.01 0 0.1 0 -0.1 -0.01 0 0.5 1 Time (s) 1.5 2 (a) Attitude (b) Position Figure 13: Position and attitude variation during flip maneuver performed by quadrotor 20 0.02 0 0 2 T 0.01 C C T 1 0.02 1 Time (s) 0 0 2 0.02 CT 3 T 1 Time (s) 2 1 Time (s) 2 4 0.02 C 0.01 0.01 0 0 1 Time (s) 0.01 0 0 2 Figure 14: Time history of required thrust coefficients for performing flip maneuver 4.4 Flip Maneuver In this section, the capability of the variable pitch quadrotor and the developed controller is demonstrated by performing a complicated flip maneuver. In this maneuver, the quadrotor is simulated to fly upside down starting from the stable hover position with roll, pitch and yaw attitude angles maintained at 0◦ . The controller then commands the quadrotor to change the roll angle to 180◦ while maintaining the pitch and yaw angles. The time history of commanded and achieved attitude angles of the vehicle is shown in Fig. 13(a). The time history of position of the quadrotor during the flip maneuver is shown in Fig. 13(b). During this maneuver no attempt is made to control the position of the quadrotor and only attitude is targeted. As a consequence, it can be observed that during the transition from 0◦ roll attitude to 180◦ roll attitude, the quadrotor generates some acceleration which results in a small velocity along lateral (Y ) direction which makes the Y coordinate position to increase with time. After the execution of the flip maneuver, all the four rotors of the quadrotor produce thrust of equal magnitude and has same value as that of thrust in hover mode (see Fig. 14). As expected, the rotors of the quadrotor, when in inverted flight, operate at negative collective pitch angles to generate thrust in upward direction as shown in Fig. 15. The trajectory of the quadrotor during the flip maneuver in Y − Z plane is shown in Fig. 16. The upright attitude of the quadrotor at its original location is marked by number ‘1’ and is depicted using a square with dark shade in the top half and light shade in the bottom half portion. The snapshots of the simulated flip maneuver are marked by numbers ‘1’ through ‘7’. It is observed that the flipping of the quadrotor is completed by the time the quadrotor reaches location ‘6’ as it attains upside down attitude marked by a square with bottom half in dark and top half in 21 (deg) 20 0 0 θ 0 2 1 θ0 (deg) 20 −20 0 1 Time (s) −20 0 2 2 1 Time (s) 2 θ0 (deg) 20 0 0 4 3 θ0 (deg) 20 1 Time (s) −20 0 1 Time (s) −20 0 2 Figure 15: Time history of required collective pitch input for performing flip maneuver light shade. The centre of mass of the quadrotor is observed to move by only 0.14 m in lateral direction and 0.07 m in vertical direction during the execution of the flip maneuver. The quadrotor maintains its altitude but drifts in Y-direction due to the reason explained above. 4.5 Inverted Flight For final demonstration of the performance of the controller, a sinusoidal trajectory is tracked by the quadrotor in inverted orientation. Starting with hover, the quadrotor is commanded to perform a flip maneuver followed by tracking of a sinusoidal trajectory of sin( π2 t) meters in X, Y , and Z directions. Similar to trajectory following, the attitude required to track the trajectory is shown by dashed line in Fig. 17(a) and actual attitude attained is shown using solid line. Fig. 17(a) shows that quadrotor flips within 1 sec attaining a roll angle of 180◦, and then starts following the desired attitude to track the prescribed trajectory. The time history of desired and tracked positions are shown in Fig. 17(b). After the initial deviation of X and Y location during the flipping motion, the inverted quadrotor is able to track the desired trajectory with great precision. The corresponding flight path in three-dimensions is shown in Fig. 10. The rapid changes in the commanded thrust from the individual rotors is shown in Fig. 19. Figure 20 shows that all the rotors operate at negative collective input after the quadrotor is inverted to produce thrust in upward direction for tracking the trajectory in upside down attitude. 22 0.1 0.08 6 5 Z (m) 0.06 0.04 4 0.02 -0 7 3 1 2 -0.02 -0.6 -0.5 -0.4 -0.3 Y (m) -0.2 -0.1 0 Figure 16: Trajectory in Y-Z plane during flipping X (m) φ (deg) 400 200 0 2 4 6 Time (s) 8 10 0 2 4 6 Time (s) 8 10 0 2 4 6 Time (s) 8 10 0 2 4 6 Time (s) 8 10 2 Y (m) 50 θ (deg) 0 -1 0 0 1 0 -1 -50 0 2 4 6 Time (s) 5 8 10 2 Current Angle Desired Angle Z (m) ψ (deg) Current state Desired trajectory 1 0 1 0 -1 -5 0 2 4 6 Time (s) 8 10 (a) Attitude (b) Position Figure 17: Position and attitude variation during trajectory tracking with inverted quadrotor 23 Initial position Current state Initial desired position Desired trajectory 1.5 Z (m) 1 0.5 0 −0.5 2 1 1 0 0 Y (m) −1 −1 X (m) Figure 18: Three Dimensional Variation in Position in tracking trajectory during inverted flight T 0.01 0 0 C CT 2 0.02 1 0.02 5 Time (s) 0 0 10 5 Time (s) 10 5 Time (s) 10 T 4 0.02 0.01 0 0 C 3 0.02 CT 0.01 5 Time (s) 0.01 0 0 10 Figure 19: Required values of thrust coefficients variation for tracking trajectory during inverted flight 5 Conclusions This paper discusses the development of the flight dynamics model of a variable-pitch quadrotor which is suitable for model based controller design. The thrust and moment for each rotor is calculated using Blade Element Theory and momentum theory. Due to its ability to generate negative thrust, the variable-pitch quadrotor is known to offer higher controller bandwidth, which is suitable for aggressive maneuvering and inverted flight. A novel nonlinear controller is developed using dynamic inversion approach and demonstrated for stabilization, tracking, flipping and inverted flying of the variable pitch quadrotor. The challenge associated with control allocation, due to non-rational relation between blade pitch angle and rotor propulsive forces, is solved using an additional loop in the control design. The strategy of controlling the quadrotor by changing the blade pitch angle is validated by showing attitude stabilization in real flight 24 20 (deg) (deg) 20 0 θ θ 0 0 2 1 0 −20 0 5 Time (s) −20 0 10 10 5 Time (s) 10 20 (deg) (deg) 20 5 Time (s) 0 θ θ 0 0 3 4 0 −20 0 5 Time (s) −20 0 10 Figure 20: Required values of Collective inputs variation for tracking trajectory during inverted flight for a variable pitch quadrotor. The change in coordinate system due to flipping is taken care by introducing suitable variable for booking keeping of the orientation. The performance of controller is demonstrated through numerical simulations. As the controller is derived using six-DOF model, it is generic and can be employed for the whole flight regime. References [1] Singh B, Chopra I. Insect-based hover-capable flapping wings for micro air vehicles: experiments and analysis. AIAA journal. 2008;46(9):2115–2135. [2] Seshadri P, Benedict M, Chopra I. Understanding micro air vehicle flapping-wing aerodynamics using force and flowfield measurements. Journal of Aircraft. 2013;50(4):1070–1087. [3] Bohorquez F, Samuel P, Sirohi J, Pines D, Rudd L, Perel R. Design, analysis and hover performance of a rotary wing micro air vehicle. Journal of the American Helicopter Society. 2003;48(2):80–90. [4] Schafroth D, Bouabdallah S, Bermes C, Siegwart R. From the test benches to the first prototype of the muFly micro helicopter. In: Unmanned Aircraft Systems. Springer; 2008. p. 245–260. [5] Ulrich ER, Humbert JS, Pines DJ. Pitch and heave control of robotic samara micro air vehicles. Journal of Aircraft. 2010;47(4):1290–1299. [6] Naudin JL. The GFS UAV Project. Retrieved on. 2006;25:2010. 25 [7] Benedict M, Jarugumilli T, Chopra I. Experimental Optimization of MAV-Scale Cycloidal Rotor Performance. Journal of the American Helicopter Society. 2011;56(2):22005–22005. [8] Bouabdallah S, Noth A, Siegwart R. PID vs LQ control techniques applied to an indoor micro quadrotor. In: Intelligent Robots and Systems, 2004.(IROS 2004). Proceedings. 2004 IEEE/RSJ International Conference on. vol. 3. IEEE; 2004. p. 2451–2456. [9] Bouabdallah S, Murrieri P, Siegwart R. Design and control of an indoor micro quadrotor. In: Robotics and Automation, 2004. Proceedings. ICRA’04. 2004 IEEE International Conference on. vol. 5. IEEE; 2004. p. 4393– 4398. [10] Castillo P, Dzul A, Lozano R. Real-time stabilization and tracking of a four-rotor mini rotorcraft. IEEE Transactions on control systems technology. 2004;12(4):510–516. [11] Cutler M, Ure NK, Michini B, How JP. Comparison of fixed and variable pitch actuators for agile quadrotors. AIAA Paper. 2011;(2011-6406). [12] Abhishek A, Gadekar R, Duhoon A, Kothari M, Kadukar S, Rane L, et al. Design, development, and closed-loop flight testing of a single power plant variable pitch quadrotor unmanned air vehicle. In: the 73rd American Helicopter Society Annual Forum. AHS; 2017. . [13] Leishman JG. 2. In: Principles of Helicopter Aerodynamics. 2nd ed. Cambridge University Press; 2006. p. 115–170. [14] Borenstein J. The hoverbot, an electrically powered flying robot. Ann Arbor. 1992;1001:48109–2110. [15] Cutler M, How JP. Actuator constrained trajectory generation and control for variable-pitch quadrotors. In: AIAA Guidance, Navigation, and Control Conference; 2012. p. 1–15. [16] Madani T, Benallegue A. Backstepping control for a quadrotor helicopter. In: 2006 IEEE/RSJ International Conference on Intelligent Robots and Systems. IEEE; 2006. p. 3255–3260. [17] Nagaty A, Saeedi S, Thibault C, Seto M, Li H. Control and navigation framework for quadrotor helicopters. Journal of intelligent & robotic systems. 2013;p. 1–12. [18] Bouabdallah S, Siegwart R. Backstepping and sliding-mode techniques applied to an indoor micro quadrotor. In: Proceedings of the 2005 IEEE international conference on robotics and automation. IEEE; 2005. p. 2247–2252. 26 [19] Das A, Subbarao K, Lewis F. Dynamic inversion with zero-dynamics stabilisation for quadrotor control. IET control theory & applications. 2009;3(3):303–314. [20] Prabhakaran B, Kothari M, Abhishek. Nonlinear control design for quadrotors. In: 2015 IEEE Workshop on Computational Intelligence: Theories, Applications and Future Directions (WCI); 2015. p. 1–6. [21] Dydek ZT, Annaswamy AM, Lavretsky E. Combined/composite adaptive control of a quadrotor UAV in the presence of actuator uncertainty. In: AIAA Guidance, Navigation, and Control Conference; 2010. p. 2–5. [22] Lee D, Kim HJ, Sastry S. Feedback linearization vs. adaptive sliding mode control for a quadrotor helicopter. International Journal of control, Automation and systems. 2009;7(3):419–428. [23] Mohammadi M, Shahri AM. Adaptive nonlinear stabilization control for a quadrotor UAV: theory, simulation and experimentation. Journal of Intelligent & Robotic Systems. 2013;72(1):105–122. [24] Shastry AK, Pattanaik A, Kothari M. Neuro-adaptive Augmented Dynamic Inversion Controller for Quadrotors. IFAC-PapersOnLine. 2016;49(1):302–307. [25] Carrillo LG, Dzul A, Lozano R. Hovering quad-rotor control: A comparison of nonlinear controllers using visual feedback. IEEE Transactions on Aerospace and Electronic Systems. 2012;48(4):3159–3170. [26] Cutler M, How JP. Analysis and control of a variable-pitch quadrotor for agile flight. Journal of Dynamic Systems, Measurement, and Control. 2015;137(10):101002. [27] Gupta N, Kothari M, Abhishek A. Flight dynamics and nonlinear control design for variable-pitch quadrotors. In: 2016 American Control Conference (ACC). IEEE; 2016. p. 3150–3155. [28] Parwana H, Kothari M. Quaternions and Attitude Representation. arXiv preprint arXiv:170808680. 2017;. [29] Enns D, Bugajski D, Hendrick R, Stein G. Dynamic inversion: an evolving methodology for flight control design. International Journal of control. 1994;59(1):71–91. 27
3cs.SY
arXiv:1711.05797v2 [math.GR] 27 Feb 2018 THE RESIDUAL FINITENESS OF (HYPERBOLIC) AUTOMORPHISM-INDUCED HNN-EXTENSIONS ALAN D. LOGAN Abstract. We classify finitely generated, residually finite automorphisminduced HNN-extensions in terms of the residual separability of a single associated subgroup. This classification provides a method to construct automorphism-induced HNN-extensions which are not residually finite. We prove that this method can never yield a “new” counter-example to Gromov’s conjecture on the residual finiteness of hyperbolic groups. 1. Introduction A group H∗(K,φ) is called an automorphism-induced HNN-extension if it has a relative presentation of the form H∗(K,φ) = hH, t; tkt−1 = φ(k), k ∈ Ki where φ ∈ Aut(H) and K H. The main result of this note is a classification of finitely generated, residually finite automorphism-induced HNN-extensions. A subgroup K of H is residually separable in H if for all x ∈ H \ K there exists a finite index, normal subgroup N of H, written N ⊳f H, such that x 6∈ KN (hence if ϕx : H → H/N is the natural map then ϕx (x) 6∈ ϕx (K)). Theorem A. Suppose that H is finitely generated. Then G = H∗(K,φ) is residually finite if and only if H is residually finite and K is residually separable in H. We prove two corollaries of Theorem A. These corollaries can be easily applied to construct automorphism-induced HNN-extensions which are not residually finite. Both corollaries relate to the subgroup-quotient NH (K)/K. This subgroup-quotient plays a central role in a framework for the construction of groups possessing certain properties and with specified outer automorphism group [Log15] (see also [Log16] [Log17]). Date: February 28, 2018. 2010 Mathematics Subject Classification. 20E06, 20E26, 20F67. Key words and phrases. HNN-extensions, Residual finiteness, Hyperbolic groups. 1 2 ALAN D. LOGAN Corollary 1.1. Suppose that H is finitely generated. If NH (K)/K is not residually finite then G = H∗(K,φ) is not residually finite. Corollary 1.2. Suppose that H is finitely generated and that NH (K) has finite index in H. Then G = H∗(K,φ) is residually finite if and only if both H and NH (K)/K are residually finite. Hyperbolicity. It is a famous conjecture of Gromov that all hyperbolic groups are residually finite [nib93] [KW00] [Ol’00]. One might hope to apply Corollary 1.1 to obtain a counter-example to this conjecture. However, Theorem B proves that Corollary 1.1 can produce no “new” counter-examples to Gromov’s conjecture, in the sense that if G = H∗(K,φ) is a counter-example where the subgroup-quotient NH (K)/K is used to force G to be non-residually finite then the conditions of Theorem B hold, and so H is also a counter-example. Theorem B. Suppose that G = H∗(K,φ) is hyperbolic and non-residually finite, and that K NH (K). Then K is finite, and H is hyperbolic and non-residually finite. Theorem B leaves the following question: Question 1.3. Suppose that G = H∗(K,φ) is hyperbolic and non-residually finite. Then is H is hyperbolic and non-residually finite? We also have the following result: Theorem C. Suppose that K NH (K) and that K contains an element of infinite order. Then Z × Z embeds into G = H∗(K,φ). Automorphism-induced HNN-extensions can be thought of as “partial” mapping tori H ⋊φ Z. Theorem C proves that automorphisminduced HNN-extensions of free groups Fn ∗(K,φ) are not hyperbolic if K NH (K), even if the “full” mapping torus Fn ⋊φ Z is hyperbolic. Acknowledgments. I would like to thank the anonymous referee for their extremely helpful comments. 2. Residual finiteness We first prove Theorem A. Note that for G some group, if P ⊳f G and H ≤ G then P ∩H ⊳f H. Also note that if H is a finitely generated group, Q ⊳f H and φ ∈ Aut(H) then ∩i∈Z φi (Q) ⊳f H. Proof of Theorem A. Suppose H is residually finite and K is residually separable in H. Then H∗(K,φ) is residually finite [BT78, Lemma 4.4]. RESIDUAL FINITENESS OF CERTAIN HNN-EXTENSIONS 3 Suppose H∗(K,φ) is residually finite. Then H is residually finite, as subgroups of residually finite groups are residually finite. Now, suppose that K is not residually separable in H, and let x ∈ H \ K be such that x ∈ KN for all finite index subgroups N of H. Let N ⊳f H∗(K,φ) be arbitrary. It is sufficient to prove that txt−1 φ(x)−1 ∈ N . To see this  ini clusion, first note that N ∩H ⊳f H. Consider L := ∩i∈Z φ N ∩ H , and note that L ⊳f H. Then there exists k ∈ K such that xk −1 , φ(xk −1 ) ∈ L. Thus, xk −1 , φ(xk −1 ) ∈ N , and so xN = kN and φ(x)N = φ(k)N. Then: txt−1 φ(x)−1 N = tkt−1 φ(k)−1 N = N  Hence, txt−1 φ(x)−1 ∈ N as required. We now prove Corollary 1.1. Proof of Corollary 1.1. Suppose that NH (K)/K is not residually finite. Then there exists some x ∈ NH (K) such that x ∈ NK for all N ⊳f NH (K). Hence, for all N ⊳f H we have that x ∈ N ∩ NH (K) K, and so x ∈ NK. Therefore, K is not residually separable in H, and so H∗(K,φ) is not residually finite by Theorem A.  We now prove Corollary 1.2. We previously proved the analogous result for the groups H∗(K,1), so where the inducing automorphism φ is trivial [Log16, Proposition 2.2 ]. Proof of Corollary 1.2. By Theorem A and Corollary 1.1, it is sufficient to prove that if H and NH (K)/K are residually finite then K is residually separable. So, suppose that H and NH (K)/K are residually finite. Additionally, suppose that x 6∈ NH (K). Clearly x 6∈ NH (K)K as K ≤ NH (K). Then the subgroup N := ∩h∈H h−1 NH (K)h is a finite index, normal subgroup of H such that x 6∈ NK, as required. Suppose that x ∈ NH (K) \ K. Now, as NH (K)/K is residually finite, there exists a map ϕx : NH (K)/K → Ax with Ax finite and xK 6∈ ker(ϕx ). Therefore, there exists a map ϕ fx : NH (K) → Ax ϕx which factors as NH (K) → NH (K)/K −→ Ax such that x 6∈ ker (f ϕx ). Then K ≤ ker (f ϕx ) so x 6∈ ker (f ϕx ) K. As ker (f ϕx ) ⊳f NH (K) ⊳f H, there exists N ⊳f H such that N ≤ ker (f ϕx ). As x 6∈ ker (f ϕx ) K and NK ≤ ker (f ϕx ) K we have that x 6∈ NK as required.  3. Hyperbolicity We first prove Theorem C, as it is applied in the proof of Theorem B. Recall that Theorem C gives a necessary condition for Z × Z to embed into G = H∗(K,φ). As Z × Z does not embed into any hyperbolic 4 ALAN D. LOGAN group, Theorem C gives a necessary condition for the hyperbolicity of automorphism-induced HNN-extensions. Proof of Theorem C. Consider an element k ∈ K of infinite order, and consider a ∈ NH (K) \ K. Then the word W = a−1 t−1 φ(a)t has infinite order in G, and indeed no power of W is contained in K. Now, as aka−1 ∈ K we have that t−1 φ(aka−1 ) = aka−1 t−1 . Then W and k commute as follows: a−1 t−1 φ(a)t · k = a−1 t−1 φ(ak)t = a−1 t−1 φ(aka−1 )φ(a)t = k · a−1 t−1 φ(a)t Therefore, hW, ki ∼ = Z × Z as required.  We now prove Theorem B. Proof of Theorem B. By assumption, G = H∗(K,φ) is hyperbolic and non-residually finite, and K NH (K). Suppose that K is infinite. Then K is an infinite torsion group by Theorem C. Now, as K ≤ G with G hyperbolic, this is a contradiction [Gro87]. Hence, K is finite. Suppose that H is residually finite. As K is finite we have that G is residually finite [BT78, Theorem 3.1], a contradiction. Hence, H is non-residually finite. Finally, note that H is a quasi-convex subgroup of G as K and φ(K) are finite. Hence, H is hyperbolic [BH99, Proposition III.Γ.3.7].  References [ALP17] F. Ateş, A. D. Logan, and S.J. Pride, Automata and Zappa-Szèp products of groups, in preparation (2017). [Bau63] G. Baumslag, Automorphism groups of residually finite groups, J. London Math. Soc. 38 (1963), 117–118. MR 0146271 [BH99] M. R. Bridson and A. Haefliger, Metric spaces of non-positive curvature, Grundlehren der Mathematischen Wissenschaften [Fundamental Principles of Mathematical Sciences], vol. 319, Springer-Verlag, Berlin, 1999. MR 1744486 [BT78] B. Baumslag and M. Tretkoff, Residually finite HNN extensions, Comm. Algebra 6 (1978), no. 2, 179–194. MR 484178 [Gro87] M. Gromov, Hyperbolic groups, Math. Sci. Res. Inst. Publ., vol. 8, Springer, New York, 1987. MR 919829 [KM98] O. Kharlampovich and A. Myasnikov, Hyperbolic groups and free constructions, Trans. Amer. Math. Soc. 350 (1998), no. 2, 571–613. MR 1390041 [KW00] I. Kapovich and D.T. Wise, The equivalence of some residual properties of word-hyperbolic groups, J. Algebra 223 (2000), no. 2, 562–583. MR 1735163 RESIDUAL FINITENESS OF CERTAIN HNN-EXTENSIONS 5 [Log15] A. D. Logan, The Bass-Jiang group for automorphism-induced HNNextensions, arXiv:1509.01847 (2015). , On a question of Bumagin and Wise, New York J. Math. 22 [Log16] (2016), 865–873. MR 3548127 [Log17] , Every group is the outer automorphism group of an HNNextension of a fixed triangle group, arXiv:1709.06441 (2017). [nib93] Geometric group theory 1991 problem list, Geometric group theory, Vol. 1 (Sussex, 1991) (Graham A. Niblo, ed.), London Math. Soc. Lecture Note Ser., vol. 181, Cambridge Univ. Press, Cambridge, 1993, pp. 208–212. MR 1238528 [Ol’00] A. Yu. Ol’shanskiı̆, On the Bass-Lubotzky question about quotients of hyperbolic groups, J. Algebra 226 (2000), no. 2, 807–817. MR 1752761 School of Mathematics and Statistics, University of Glasgow, Glasgow, G12 8QW, UK. E-mail address: [email protected]
4math.GR
SEMIPROJECTIVITY AND SEMIINJECTIVITY IN DIFFERENT CATEGORIES arXiv:1802.05037v1 [math.CT] 14 Feb 2018 HANNES THIEL Abstract. Projectivity and injectivity are fundamental notions in category theory. We consider natural weakenings termed semiprojectivity and semiinjectivity, and study these concepts in different categories. For example, in the category of metric spaces, (semi)injective objects are precisely the absolute (neighborhood) retracts. We show that the trivial group is the only semiinjective group, while every free product of a finitely presented group and a free group is semiprojective. To a compact, metric space X we associate the commutative C ∗ -algebra C(X). This association is contravariant, whence semiinjectivity of X is related to semiprojectivity of C(X). Together with Adam Sørensen, we showed that C(X) is semiprojective in the category of all C ∗ -algebras if and only if X is an absolute neighborhood retract with dim(X) ≤ 1. 1. Introduction While being fundamental in category theory, the concepts of projectivity and injectivity are often very restrictive. It is therefore natural to consider weaker versions of these notions. For example, injective objects in the category of metric spaces and continuous maps are precisely the absolute retracts introduced by Borsuk in 1931. He also defined a generalization, called absolute neighborhood retracts; see Definition 3.10. Therefore, being an absolute neighborhood retract is a weak form of injectivity in the category of metric spaces. While not many spaces are absolute retracts, numerous naturally occurring spaces are absolute neighborhood retracts, including topological manifolds, polyhedra and CW-complexes. Given a compact, metric space X, we associate the algebra C(X) of continuous complex-valued functions on X. This is a C ∗ -algebra with the supremum norm and pointwise operations. The category CMetr of compact, metric spaces, and the category AbSC∗1 of abelian, unital, separable C ∗ -algebras are (contravariantly) equivalent. We therefore think of C ∗ -algebras as ‘noncommutative topological spaces’. Using the contravariant correspondence between CMetr and AbSC∗1 , injectivity of a compact, metric space X corresponds precisely to projectivity of C(X) in the category AbSC∗1 . However, projectivity within the category C∗1 of unital C ∗ algebras and unital ∗ -homomorphisms is more restrictive - since there are more lifting problems to be solved. Date: February 15, 2018. 2010 Mathematics Subject Classification. Primary 18A05; Secondary 06B35, 06F05, 18A20, 20E05, 46L05, 54C55, 55M15. Key words and phrases. projectivity, injectivity, semiprojectivity, semiinjectivity, free groups, absolute retracts, absolute neighborhood retracts, C*-algebras. The author was partially supported by the Deutsche Forschungsgemeinschaft (SFB 878). 1 2 HANNES THIEL In 1985, Blackadar used the contravariant correspondence between CMetr and AbSC∗1 to translate the concept of an absolute neighborhood retract to (noncommutative) C ∗ -algebras. He hence introduced a weak form of projectivity in the category of C ∗ -algebras, called semiprojectivity; see [Bla85a, Definition 2.1], [Bla85b, Definition 2.10]. It is straightforward to generalize Blackadar’s definition of semiprojectivity to general categories; see Definition 3.4. The dual notion is called semiinjectivity. Semiinjective objects in the category of metric spaces are precisely the absolute neighborhood retracts. We characterize semiprojectivity and semiinjectivity in the category of groups: A group is semiprojective if and only if it is a retract of a free product of a finitely presented group and a free group; see Proposition 3.7. On the other hand, only the trivial group is semiinjective; see Proposition 3.9. One motivation to consider semiprojectivity and semiinjectivity is shape theory, which is a machinery to study an object by approximating it by better-behaved ones. Absolute neighborhood retracts are the building blocks of shape theory of topological spaces. Analogously, semiprojective C ∗ -algebras are the building blocks of noncommutative shape theory. In this context, it is of general interest to study semiprojective C ∗ -algebras. More specifically, semiprojectivity is a concept that is used at many different places in the theory of C ∗ -algebras. For instance, it is often used that a C ∗ -algebra that is ‘locally approximated’ by a certain class of semiprojective C ∗ -algebras is already isomorphic to an inductive limit of such C ∗ -algebras; see [Thi11, Section 3]. Further, semiprojective C ∗ -algebras are used to study and classify C ∗ -algebras given as inductive limits or as crossed products of dynamical systems. For example, Elliott’s seminal classification of AF-algebras (inductive limits of finite-dimensional C ∗ -algebras) by K-theory relies on the semiprojectivity of finite-dimensional C ∗ algebras. Semiprojectivity also plays a crucial role in the analysis of the structure of crossed products by actions with the Rokhlin property in [OP12] and [Gar17]. Blackadar asked to determine, in terms of X, when C(X) is semiprojective among all C ∗ -algebras. It is easy to see that X must be an absolute neighborhood retract, but is that sufficient? Surprisingly, a dimensional restriction appears. Together with Adam Sørensen we showed in [ST12] that C(X) is semiprojective if and only if X is an absolute neighborhood retract with dim(X) ≤ 1; see Theorem 4.8. This article is based on a talk presented at the conference ‘VI Coloquio Uruguayo de Matemática’, held during December 20 to 22, 2017, in Montevideo, Uruguay. Acknowledgements I am thankful to Eusebio Gardella for his feedback on the first draft of this paper. 2. Concrete categories, Monomorphisms, Epimorphisms Let C be a category. Given objects X and Y in C, we use HomC (X, Y ) to denote the morphisms in C from X to Y . Let ϕ : X → Y be a morphism in C. Then ϕ is an epimorphism (for short, ϕ is epi), denoted ϕ : X ։ Y , if for every object Z and morphisms ψ1 , ψ2 : Y → Z with ψ1 ◦ ϕ = ψ2 ◦ ϕ, we have ψ1 = ψ2 . Dually, ϕ is a monomorphism (for short, ϕ is mono), denoted ϕ : X ֒→ Y , if for every object Z and morphisms ψ1 , ψ2 : Z → X with ϕ ◦ ψ1 = ϕ ◦ ψ2 , we have ψ1 = ψ2 . Example 2.1. Let Set denote the category of sets and (ordinary) mappings. A morphism in Set is epi (mono) if and only if it is surjective (injective). SEMIPROJECTIVITY AND SEMIINJECTIVITY IN DIFFERENT CATEGORIES 3 Recall that C is said to be locally small if HomC (X, Y ) is a set for any objects X and Y . In this case, for each object X we obtain a covariant hom functor HomC (X, ) : C → Set and a contravariant hom functor HomC ( , X) : C → Set. A concrete category is a category C together with faithful functor U : C → Set. In this case, we think of an object X in C as a set (namely U (X)) with additional structure, and a morphism ϕ : X → Y is a mapping (namely U (ϕ) : U (X) → U (Y )) that preserves the structure of the objects. In a concrete category, we usually identify an object with its underlying set, and we identify a morphism with its underlying set mapping. A faithful functor reflects epimorphisms and monomorphisms. It follows that in a concrete category, every surjective (injective) morphism is epi (mono). The converse need not hold; see Examples 2.3 and 2.4. Of particular interest is the case that C is locally small and that there exists an object G in C (called a generator ) such that HomC (G, ) : C → Set is faithful; see [Bor94, Corollary 4.5.9, p.155]. In that case, a morphism is mono if and only if it is injective. As noted above, the backward implication holds in every concrete category. To show the forward implication, let ϕ : X → Y be a monomorphism. To show that ϕ is injective, let x and y be elements in the set underlying X such that ϕ(x) = ϕ(y). Note that x is an element of HomC (G, X) and that ϕ(x) is just the composition of morphisms ϕ ◦ x in C. Thus, the equality ϕ(x) = ϕ(y) really means ϕ ◦ x = ϕ ◦ y. Now it follows directly from the definition of monomorphism that x = y, as desired. Dually, if a category has a cogenerator (an object K such that HomC ( , K) is faithful), then a morphism is epi if and only if it is surjective. Example 2.2. Let Gp denote the category of discrete groups and group homomorphisms, with the usual concretization that sends a group to its underlying set. Then the group Z is a generator for Gp. Indeed, given a group G, there is a natural bijection between elements in G and group homomorphisms Z → G. See also [Bor94, Example 4.5.17.c, p.160]. It follows that a morphism in Gp is mono if and only if it is injective. The category Gp has no cogenerator; see [Bor94, Proposition 4.7.3, p.169]. Nevertheless, a morphism in Gp is epi if and only if it is surjective. The forward implication is not obvious; see [Lin70]. Example 2.3. Let Mon denote the category of monoids and monoid homomorphisms. The inclusion map ϕ : N → Z is a non-surjective epimorphism. To show that ϕ is epi, let M be a monoid, and let ψ1 , ψ2 : Z → M be morphisms with ψ1 ◦ ϕ = ψ2 ◦ ϕ. Then ψ1 (k) = ψ2 (k) for all k ≥ 0. We have 1M = ψ1 (0) = ψ1 (−k)ψ1 (k) and 1M = ψ2 (k)ψ2 (−k) for all k ≥ 0. We deduce that ψ1 (−k) = ψ1 (−k)ψ2 (k)ψ2 (−k) = ψ1 (−k)ψ1 (k)ψ2 (−k) = ψ2 (−k), for all k ≥ 0. Thus, ψ1 = ψ2 , as desired. Example 2.4. Consider the category of pointed, path connected spaces with pointed, continuous maps. We let T = {z ∈ C : |z| = 1} be the circle with base point 1. Let π : (R, 0) → (S 1 , 1) be given by π(t) := exp(2πit), for t ∈ R. Then π is a non-injective monomorphism. To show that π is a monomorphism, let (X, x0 ) be a path connected space, and let f1 , f2 : (X, x0 ) → (R, 0) be two pointed, continuous maps satisfying π ◦ f1 = π ◦ f2 . Then f1 (x0 ) = 0 = f2 (x0 ). Given x ∈ X, choose a path from x0 to x, that is, a continuous map p : [0, 1] → X with p(0) = x0 and p(1) = x. Then f1 ◦ p and f2 ◦ p are two paths in R starting at 0. We further have π ◦ f1 ◦ p = π ◦ f2 ◦ p. Since π is a covering, it has the unique path 4 HANNES THIEL lifting property. It follows that f1 ◦ p = f2 ◦ p and hence f1 (x) = (f1 ◦ p)(1) = (f2 ◦ p)(1) = f2 (x). Thus, f1 = f2 , as desired. Example 2.5. Let CMetr be the category of compact, metric spaces and continuous mappings, with the usual concretization sending a topological space to its underlying set. The one-point space is a generator for CMetr. The interval [0, 1] with its usual Hausdorff topology is a cogenerator for CMetr; see [Bor94, Proposition 4.7.8, p.173]. Thus, epimorphisms (monomorphisms) in CMetr are precisely surjective (injective) continuous mappings. 3. Semiprojective and semiinjective objects The following definition is standard in category theory. Definition 3.1. Let C be a category, and let X be an object in C. Then X is said to be projective if for every epimorphism π : Y → Z and every morphism ϕ : X → Z there exists a morphism ϕ̃ : X → Y such that π ◦ ϕ̃ = ϕ. The morphism ϕ̃ is called a lift of ϕ. Dually, X is said to be injective if for every monomorphism ι : Z → Y and every morphisms ϕ : Z → X there exists a morphism ϕ̃ : Y → X such that ϕ̃ ◦ ι = ϕ. The morphism ϕ̃ is called an extension of ϕ. Thus, X is projective (injective), if in the left (right) diagram below, for given solid arrows, the dashed arrow exists making the diagram commutative: >Y ϕ̃ X π ϕ YO ϕ̃  /Z ι ~ Xo ϕ ? Z. Examples 3.2. (1) A group G is projective (in Gp) if and only if G is free. The backward implication is easy to prove. To show the forward implication, choose a free group F and a surjective group homomorphism π : F → G. Using that G is projective, we obtain a morphism ϕ̃ : G → F that lifts the identity on G, that is, such that π ◦ ϕ̃ = idG . This is shown in the following commutative diagram: ϕ̃ G idG >F π  / G. It follows that ϕ̃ is injective, and thus G is (isomorphic to) a subgroup of F . By the Nielsen-Schreier theorem, every subgroup of a free group is again free. It follows that G is free, as desired. (2) Eilenberg and Moore showed that the trivial group is the only injective object in Gp. We include a short proof, which is a variation of the proof in [Nog07]. Let G be an injective group, and let g ∈ G. Let F2 denote the free group of rank two, with generators x and y. Let ϕ : F2 → G be the morphism satisfying ϕ(x) = 1 and ϕ(y) = g. Let σ : F2 → F2 be the automorphism of F2 satisfying σ(x) = y and σ(y) = x. We consider the semidirect product F2 ⋊σ Z2 . Let ι : F2 → F2 ⋊σ Z2 denote the natural inclusion morphism. Use that G is injective to SEMIPROJECTIVITY AND SEMIINJECTIVITY IN DIFFERENT CATEGORIES 5 obtain an extension ϕ̃ of ϕ. This is shown in the following commutative diagram. GO d ϕ F2 ϕ̃  ι / F2 ⋊σ Z2 . To simplify, we consider F2 as a subgroup of F2 ⋊σ Z2 . Let u ∈ F2 ⋊σ Z2 be the element implementing σ. Then uxu−1 = y. We have ϕ̃(x) = ϕ(x) = 1 and hence g = ϕ(y) = ϕ̃(uxu−1 ) = ϕ̃(u)ϕ̃(x)ϕ̃(u)−1 = ϕ̃(u)ϕ̃(u)−1 = 1. Thus, G = {1}, as desired. Recall that a partially ordered set I is said to be upward directed (downward directed ) if for all i, j ∈ I there exists k ∈ I with i, j ≤ k (with k ≤ i, j). The following definition is standard. Definition 3.3. A direct system (an inverse system) in a category C is an upward directed (downward directed) set I, together with objects Xi for i ∈ I and morphisms πi,j : Xi → Xj for i, j ∈ I with i ≤ j, satisfying πi,i = idXi for every i ∈ I and satisfying πi,k = πj,k ◦ πi,j for all i, j, k ∈ I with i ≤ j ≤ k. The morphisms πi,j are called the connecting morphisms of the system. Given a direct system (I, Xi , πi,j ), a direct limit (also called inductive limit ) is an object X together with a family π = (πi,∞ )i∈I of morphisms πi,∞ : Xi → X satisfying πj,∞ ◦ πi,j = πi,∞ for all i, j ∈ I with i ≤ j, and such that (X, π) is universal with these properties. Dually, given an an inverse system (I, Xi , πi,j ), an inverse limit is an object X together with a family π = (π∞,i )i∈I of morphisms π∞,i : X → Xi satisfying πi,j ◦ π∞,i = π∞,j for all i, j ∈ I with i ≤ j, and such that (X, π) is universal with these properties. The following definition of semiprojectivity was introduced by Blackadar in the sequential setting for the category of C ∗ -algebras; see [Bla85a, Definition 2.1]. See also [Bla85b, Definition 2.10]. The general (nonsequential) definition has also been considered in [CLT18]. Definition 3.4. Let C be a category, and let X be an object in C. Then X is said to be semiprojective if for every inductive system (I, Yi , πi,j ) in C with connecting epimorphisms and for which the direct limit lim Yi exists, and for every morphism −→ ϕ : X → lim Yi , there exist i ∈ I and a morphism ϕ̃ : X → Yi such that πi,∞ ◦ ϕ̃ = ϕ. −→ The morphism ϕ̃ is called a partial lift of ϕ. Dually, X is said to be semiinjective if for every inverse system (I, Yi , ιi,j ) in C with connecting monomorphisms and for which the inverse limit lim Yi exists, and ←− for every morphisms ϕ : lim Yi → X, there exist i ∈ I and a morphism ϕ̃ : Yi → X ←− such that ϕ̃ ◦ ι∞,i = ϕ. The morphism ϕ̃ is called an partial extension of ϕ. Given objects X and Y in a category, we say that X is a retract of Y if there exist morphisms α : X → Y and β : Y → X with β ◦ α = idX . The proof of the following result is straightforward. Lemma 3.5. Let C be a category, and let X and Y be objects in C. Then: (1) If X is a retract of Y , and if Y is (semi)projective, then so`is X. (2) If X and Y are (semi)projective, then so is the coproduct X Y (assuming it exists). Remarks 3.6. (1) Under suitable countability assumptions, it is usually enough to consider sequential direct limits in Definition 3.4. For example, a countable group G is semiprojective if and only if for every sequential direct system (N, Dk ) of 6 HANNES THIEL countable groups and with connecting epimorphisms, every morphism G → limk Dk −→ has a partial lift. To show the backward implication, let (I, Hi , πi,j ) be an arbitrary direct system with connecting epimorphisms in Gp, and let ϕ : G → limi Hi be a morphism. Then −→ there exist an increasing sequence of indices i(0) ≤ i(1) ≤ . . . in I, and countable subgroups Dk ⊆ Hi(k) for all k ∈ N, such that the restriction of πi(k),i(k+1) to Dk maps onto Dk+1 , and such that ϕ factors through limk Dk . This means that there −→ exists a morphism ψ : G → limk Dk such that ϕ = γ◦ψ, where γ : limk Dk → limi Hi −→ −→ −→ is the morphism obtained by the universal property of limk Dk applied for the −→ morphisms (πi(k),∞ )|Dk : Dk → limi Hi . Given a partial lift ψ̃ : G → Dk for ψ, we −→ obtain a partial lift for ϕ by composing ψ̃ with the inclusion Dk ⊆ Hi(k) . The situation is shown in the following commutative diagram:  / Hi(k) : Dk ψ̃ G ψ  / lim D −→k∈N k γ  πi(k),∞ / lim H . 3 −→i∈I i ϕ (2) Similarly, a separable C ∗ -algebra A is semiprojective if and only if every ∗ homomorphism from A to the direct limit of a sequential direct system of separable C ∗ -algebras with surjective connecting maps has a partial lift. (3) The concept of direct and inverse limits in a category can be generalized to filtered (co)limits; see [Bor94, Section 2.13, p.75ff]. In some categories, it may be appropriate to modify Definition 3.4 and consider filtered (co)limits instead of direct and inverse limits. Proposition 3.7. A group is semiprojective if and only if it is the retract of the free product of a finitely presented group and a free group. Proof. Let us show the backward implication. Using Lemma 3.5, it remains to prove that every finitely presented group H is semiprojective. Choose a finitely generated free group F and a finitely generated normal subgroup N ⊳ F such that H is isomorphic to F/N . We identify H with F/N . Let r1 , . . . , rn ∈ N be a set of elements that generate N as a normal subgroup of F . To show that H is semiprojective, let (I, Hi , πi,j ) be a direct system in Gp with connecting epimorphisms, and let ϕ : H → lim Hi be a morphism. Let γ : F → H −→ be the quotient map. Since F is free, and hence projective, we can choose i0 ∈ I and a lift ψ : F → Hi of ϕ ◦ γ. Given k ∈ {1, . . . , n}, we have  πi,∞ ψ(rk ) = (πi,∞ ◦ ψ)(rk ) = (ϕ ◦ γ)(rk ) = 1,  which allows us to choose ik ≥ i0 such that πi,ik ψ(rk ) = 1. Choose i′ ∈ I with i1 , . . . , in ≤ i′ . Then πi,i′ maps ψ(r1 ), . . . , ψ(rn ) to 1. It follows that ψ(N ) ⊆ ker(πi,i′ ). Thus, πi,i′ ◦ γ factors through H, which provides the desired partial lift. To show the forward implication, assume that G is a semiprojective group. Choose a set X and a surjective group homomorphism γ : F (X) → G, where F (X) denotes the free group on the set of generators X. Set N := ker(γ). Given a subset A ⊆ X, we identify F (A) in the obvious way with a subgroup of F (X). Set  I := (A, B) : A ⊆ X finite, B ⊆ N finite, B ⊆ F (A) . For (A, B) ∈ I set G(A,B) := F (A)/hBi, where hBi denotes the normal subgroup of F (A) generated by B. Let γ(A,B) : F (A) → G(A,B) denote the quotient map. SEMIPROJECTIVITY AND SEMIINJECTIVITY IN DIFFERENT CATEGORIES 7 We define a partial order on I by setting (A′ , B ′ ) ≤ (A, B) if A′ ⊆ A and B ′ ⊆ B. Then I is an upward directed set. For (A, B) ∈ I we set  I(A,B) := (Ã, B̃) ∈ I : (Ã, B̃) ≥ (A, B) , and H(A,B) := G(A,B) ⋆ F (X × I(A,B) ). ′ (A,B) ′ Given (A , B ) ≤ (A, B), let us define a surjective morphism π(A′ ,B ′ ) from H(A′ ,B ′ ) to H(A,B) . The inclusion F (A′ ) → F (A) induces a morphism G(A′ ,B ′ ) → G(A,B) . We let R be the subset of X × I(A′ ,B ′ ) such that X × I(A′ ,B ′ ) is the disjoint union of A × {(A′ , B ′ )}, X × I(A,B) , and R. The first coordinate projection A × {(A′ , B ′ )} → A induces a morphism F (A × {(A′ , B ′ )}) → F (A) that we postcompose with γ(A,B) to obtain a surjective morphism F (A × {(A′ , B ′ )}) → (A,B) G(A,B) . We define π(A′ ,B ′ ) as the free product of the morphisms G(A′ ,B ′ ) → G(A,B) , F (A × {(A′ , B ′ )}) → G(A,B) , the identity on F (X × I(A,B) ) and the trivial map F (R) → {1}. This is shown in the following diagram: H(A′ ,B ′ ) := (A,B) π(A′ ,B ′ )  H(A,B) := F (A × {(A′ , B ′ )}) ⋆ F (X × I(A,B) ) ♣♣ ♠♠ ∼ =♠♠♠♠ ♣♣♣ ♣ ♠ ♣ ♠ ♣ ♠ v♠♠♠  x♣x ♣♣ G(A,B) ⋆ F (X × I(A,B) ) G(A′ ,B ′ ) ⋆ ⋆ F (R) (A,B) It is straightforward to verify that the maps π(A′ ,B ′ ) are surjective and define an inductive system (over the index set I). Moreover, there is a natural isomorphism ϕ : G → lim(A,B)∈I G(A,B) . −→ Using that G is semiprojective, we find (A, B) ∈ I and a partial lift ϕ̃ : G → G(A,B) of ϕ. This shows that G is a retract of G(A,B) , which is the free product of the finitely presented group H(A,B) and a free group.  Corollary 3.8. Every finitely presented group is semiprojective. Moreover, every group is a direct limit of semiprojective groups (and one may also assume that the connecting morphisms are surjective). Proposition 3.9. The trivial group is the only semiinjective object of Gp. Proof. Let G be a semiinjective group. We show that G is injective, whence it is trivial as noted in Examples 3.2. To show that G is injective, let H ⊆ K be an inclusion of groups, and let ϕ : H → G be a morphism. We let ⋆n∈N K denote the free product of countably many copies of K, and for each m ∈ N we let ιm : K → ⋆n∈N K be the natural inclusion. The amalgamated free product ⋆n∈N,H K is defined as the quotient of ⋆n∈N K by the normal subgroup generated by ιn (h)ιm (h)−1 , for n, m ∈ N and h ∈ H. For each m ∈ N we let ⋆n≥m,H K denote the subgroup of ⋆n∈N,H K generated by all except the first m copies of K. This defines a decreasing sequence of subgroups whose intersection is isomorphic to H. Since G is semiinjective, there exist m and a partial extension ϕ̃ : ⋆n≥m,H K → G. Composing with the morphism ιm : K → ⋆n≥m,H K, we obtain a morphism K → G that extends ϕ, showing that G is injective.  The following definition is due to Borsuk. For more details we refer to the books [Bor67] and [Hu65]. Recall that a retract from a topological space Y to a subspace X is a continuous map r : Y → X that satisfies r(x) = x for all x ∈ X. Definition 3.10. Let X be a metric space. Then: 8 HANNES THIEL (1) X is called an absolute retract if whenever X is embedded as a closed subset of another metric space Y , there exists a retract Y → X. (2) X is called an absolute neighborhood retract if whenever X is embedded as a closed subset of another metric space Y , there exist a neighborhood U of X in Y and a retract U → X. The equivalence between (1) and (2) in the following result is a standard fact about absolute neighborhood retracts; see for example [Hu65, Theorem III.3.1, III.3.2, p.83f]. The equivalence between (2) and (3) follows using that compact, metric spaces are normal. Proposition 3.11. Let X be a compact, metric space. Then the following are equivalent: (1) X is an absolute (neighborhood) retract. (2) Given a compact, metric space Y and a closed subset Z ⊆ Y , and given a continuous map ϕ : Y → X, there exists an extension of ϕ to a continuous map ϕ̃ : Y → X (there exists a closed neighborhood C of Z in Y and an extension ϕ̃ : C → X). (3) X is a (semi)injective object in the category CMetr. 4. C ∗ -algebras A C ∗ -algebra is a Banach algebra A with an involution such that ka∗ ak = kak2 for all a ∈ A. A ∗ -homomorphism between C ∗ -algebras is a multiplicative, ∗ -preserving, linear map. We let C∗ denote the category of C ∗ -algebras and ∗ homomorphisms. The naive concretization of C∗1 associates to every C ∗ -algebra its (usual) underlying set. However, this functor C∗ → Set is not representable. Nevertheless, C∗ has a generator. Indeed, let G := C ∗ (x : kxk ≤ 1) be the universal C ∗ -algebra generated by a contraction. Given a C ∗ -algebra A, there is a natural bijection between HomC∗ (G, A) and the elements in the unit ball of A. To see that G is a generator, we note that two ∗ -homomorphisms A → B are equal if and only if they agree on the unit ball of A. Hence, a morphism in C∗ is mono if and only if it is injective. The category C∗ has no cogenerator. (The proof is analogous to that for Gp.) Nevertheless, a morphism in C∗ is epi if and only if it is surjective. As for Gp, the forward implication is not obvious; see [Rei70, Proposition 2] and [HN95]. It follows that isomorphisms in C∗ are exactly the bijective ∗ -homomorphism, also called ∗ -isomorphisms, and such maps are automatically isometric. For simplicity, we will restrict attention to the subcategory SC∗1 of unital, separable C ∗ -algebras and unital ∗ -homomorphisms. We let AbSC∗1 denote the full subcategory of SC∗1 of abelian, unital, separable C ∗ -algebras. Examples 4.1. (1) Given a Hilbert space H, the algebra B(H) of bounded linear operators on H, equipped with the operator norm and the natural involution, is a unital C ∗ -algebra. By the Gelfand-Naimark theorem, every C ∗ -algebra is ∗ isomorphic to norm-closed ∗ -subalgebra of B(H) for some Hilbert space H; see [Bla06, Corollary II.6.4.10, p.109]. (2) For the Hilbert space H = ℓ2 ({1, 2, . . . , n}), we obtain that B(H) ∼ = Mn (C), the algebra of complex n × n-matrices, has the structure of a C ∗ -algebra. By the Artin-Weddenburn theorem, a C ∗ -algebra is finite-dimensional (as a complex vector space) if and only if it is isomorphic to a finite direct sum of matrix algebras. (3) Let X be a compact, metric space. Set  C(X) := f : X → C : f is continuous , SEMIPROJECTIVITY AND SEMIINJECTIVITY IN DIFFERENT CATEGORIES 9 equipped with pointwise addition, multiplication and involution, and with the norm  kf k := sup |f (x)| : x ∈ X , for f ∈ C(X). Then C(X) is a unital, commutative, separable C ∗ -algebra. If Y is another compact, metric space, and if ϕ : X → Y is a continuous map, then ϕ∗ : C(Y ) → C(X) given by ϕ∗ (f ) := f ◦ ϕ is a unital ∗ -homomorphism. This defines a contravariant functor C( ) : CMetr → AbSC∗1 . Proposition 4.2 (Gelfand; [Bla06, Theorem II.2.2.6, p.61]). Every abelian, unital, separable C ∗ -algebra is isomorphic to C(X) for some compact, metric space X. Moreover, the functor C( ) : CMetr → AbSC∗1 defines a (contravariant) equivalence of categories. Remark 4.3. Projectivity and semiprojectivity of C ∗ -algebras is defined with respect to the category C∗ of all C ∗ -algebras. When considering the category C∗1 , the notion of projectivity changes. On the other hand, a unital C ∗ -algebra is semiprojective (in C∗ ) if and only if it is semiprojective in C∗1 . Remark 4.4. Let X be a compact, metric space. If C(X) is (semi)projective in C∗1 , then it is also (semi)projective in AbSC∗1 - since there are fewer lifting problems to solve. Using the (contravariant) equivalence between AbSC∗1 and CMetr from Proposition 4.2, we deduce that C(X) is (semi)projective in AbSC∗1 if and only if X is (semi)injective in CMetr. Thus, if C(X) is (semi)projective in C∗1 , then X is an absolute (neighborhood) retract. Examples 4.5. (1) C = C(pt) and C([0, 1]) are projective in C∗1 . (2) Set S 1 := {z ∈ C : |z| = 1}, the unit circle. The C ∗ -algebra C(S 1 ) is semiprojective, but not projective in C∗1 . (2) Set D2 := {z ∈ C : |z| ≤ 1}, the two-disc. Then D2 is an absolute retract. However, the C ∗ -algebra C(D2 ) is not even semiprojective. (3) If X is a compact, metric space with S 1 ⊆ X, then C(X) is not projective in C∗1 . Indeed, assume that ι : S 1 ֒→ X is an embedding. Let ϕ : S 1 → D2 be the inclusion map. Since D2 is an absolute retract, there exists an extension of ϕ to a continuous map ϕ̃ : X → D2 . This is shown in the left commutative diagram below. DO 2 b❉ ϕ S T f˜ ❉ π ❉  1 ι ❉ /X  / C(S 1 ) C(D2 ) ▲▲▲ ∗ s9 ι∗ sss ▲▲ϕ̃▲ s ▲▲ s % ss C(X). ϕ∗ We let T denote the Toeplitz algebra, that is, the sub-C ∗ -algebra of B(ℓ2 (N)) generated by the unilateral shift on ℓ2 (N). Sending this shift to the identity map id ∈ C(S 1 ) induces a surjective ∗ -homomorphism π : T → C(S 1 ). The situation is shown in the right commutative diagram above. If C(X) were projective in C∗1 , then there would exist a lift ψ : C(X) → T for ι∗ . Then ψ ◦ ϕ̃∗ is a lift for ϕ∗ . The image of the identity map id ∈ C(D2 ) under ψ ◦ ϕ̃∗ is a normal element in T that lifts the unitary id ∈ C(S 1 ). Using the Fredholm index one can show that no such lift exists, showing that C(X) is not projective in C∗1 . (4) If X is a compact, metric space with D2 ⊆ X, then C(X) is not semiprojective in C∗1 . This is shown similarly as in (3); see [ST12, Remark 3.3]. 10 HANNES THIEL Let X be a compact, metric space such that C(X) is (semi)projective in C∗1 . As observed in Remark 4.4, it follows that X is an absolute (neighborhood) retract. The above examples show that the converse does not hold. Conjecture 4.6 (Blackadar, [Bla06, II.8.3.8, p.163]). Let X be a compact, metric space. Then C(X) is semiprojective if and only if X is an absolute neighborhood retract with dim(X) ≤ 1. The analog of this conjecture for projectivity was solved by Chigogidze and Dranishnikov: Theorem 4.7 ([CD10, Theorem 4.3]). Let X be a compact, metric space. Then C(X) is projective in C∗1 if and only if X is an absolute retract with dim(X) ≤ 1. Let us sketch the proof of the forward implication of Theorem 4.7. Assume that C(X) is projective in C∗1 . Then X is an absolute retract; see Remark 4.4. To show that dim(X) ≤ 1, assume that dim(X) ≥ 2. By [CD10, Proposition 3.2], it follows that S 1 ⊆ X. As sketched in Examples 4.5(3), this implies that C(X) is not projective. We remark that the topological result that S 1 embeds into X uses both that X is an absolute (neighborhood) retract and that dim(X) ≥ 2. Indeed, the space [0, 1] is an example of an absolute retract that does not admit an embedding of the circle. On the other hand, there exist compact metric spaces with dim(X) = ∞ such that every closed subset of X satisfies either dim(X) = 0 or dim(X) = ∞. In particular, such a space does not admit an embedding of the circle. The point is that such a behaviour is not possible for ‘well-behaved’ spaces such as absolute (neighborhood) retracts. Together with Adam Sørensen, we confirmed Blackadar’s conjecture. Theorem 4.8 ([ST12, Theorem 1.2]). Let X be a compact, metric space. Then C(X) is semiprojective if and only if X is an absolute neighborhood retract with dim(X) ≤ 1. Let us sketch the proof of the forward implication of Theorem 4.8. Assume that C(X) is semiprojective in C∗1 . Then X is an absolute neighborhood retract; see Remark 4.4. To show that dim(X) ≤ 1, assume that dim(X) ≥ 2. If we could deduce that D2 embeds into X, then we would conclude that C(X) is not semiprojective as mentioned in Examples 4.5(3). The problem is that dim(X) ≥ 2 does not imply D2 ⊆ X. Indeed, Bing and Borsuk constructed an absolute retract Y such that dim(Y ) = 3, but such that D2 does not embed into Y ; see [BB64]. Thus, we cannot assume that a disc embeds into X. Instead, we use the following topological result: Lemma 4.9 ([ST12, Remark 3.4]). Let X be a compact, metric space that is an absolute neighborhood retract. Assume that dim(X) ≥ 2. Then X contains either the space C1 of disjoint ‘smaller and smaller circles’, the Hawaiian earrings space C2 , or the space C3 that is a variant of the Hawaiian earrings, each given as subsets of R2 : (S(x, r) denotes the circle of radius r around x.) [ [  C1 = (0, 0) ∪ S((1/2k , 0), 1/(4 · 2k )), C2 = S((1/2k , 0), 1/2k ), k≥1 k≥1 [  C3 = (x, x), (x, −x) : x ∈ [0, 1] ∪ {1/k} × [−1/k, 1/k]. k≥1 A boosted version of the argument in Examples 4.5(3) shows the following result, which together with Lemma 4.9 shows the forward implication of Theorem 4.8. SEMIPROJECTIVITY AND SEMIINJECTIVITY IN DIFFERENT CATEGORIES (a) Space C1 (b) Space C2 11 (c) Space C3 Lemma 4.10 ([ST12]). Let X be a compact, metric space. If X contains any of the spaces C1 , C2 , or C3 from Lemma 4.9, then C(X) is not semiprojective. References [BB64] [Bla85a] [Bla85b] [Bla06] [Bor94] [Bor67] [CD10] [CLT18] [Gar17] [HN95] [Hu65] [Lin70] [Nog07] [OP12] [Rei70] [ST12] [Thi11] R. H. Bing and K. Borsuk, A 3-dimensional absolute retract which does not contain any disk, Fund. Math. 54 (1964), 159–175. MR 0161312. Zbl 0118.18002. B. Blackadar, Noncommutative shape theory, in Operator algebras and their connections with topology and ergodic theory (Buşteni, 1983), Lecture Notes in Math. 1132, Springer, Berlin, 1985, pp. 38–45. MR 799562. Zbl 0618.46058. B. Blackadar, Shape theory for C ∗ -algebras, Math. Scand. 56 (1985), 249–275. MR 813640 (87b:46074). Zbl 0615.46066. B. Blackadar, Operator algebras, Encyclopaedia of Mathematical Sciences 122, Springer-Verlag, Berlin, 2006, Theory of C ∗ -algebras and von Neumann algebras, Operator Algebras and Non-commutative Geometry, III. MR 2188261 (2006k:46082). Zbl 1092.46003. F. Borceux, Handbook of categorical algebra. 1, Encyclopedia of Mathematics and its Applications 50, Cambridge University Press, Cambridge, 1994, Basic category theory. MR 1291599 (96g:18001a). K. Borsuk, Theory of retracts, Monografie Matematyczne, Tom 44, Państwowe Wydawnictwo Naukowe, Warsaw, 1967. MR 0216473. Zbl 0153.52905. A. Chigogidze and A. Dranishnikov, Which compacta are noncommutative ARs?, Topology Appl. 157 (2010), 774–778. MR 2585410 (2011a:54017). Zbl 1187.54017. A. Chigogidze, T. A. Loring, and H. Thiel, Nonseparable semiprojective C ∗ -algebras, in preparation, 2018. E. Gardella, Crossed products by compact group actions with the Rokhlin property, J. Noncommut. Geom. 11 (2017), 1593–1626. MR 3743232. K. H. Hofmann and K.-H. Neeb, Epimorphisms of C ∗ -algebras are surjective, Arch. Math. (Basel) 65 (1995), 134–137. MR 1338245. Zbl 0829.46044. S.-t. Hu, Theory of retracts, Wayne State University Press, Detroit, 1965. MR 0181977. Zbl 0145.43003. C. E. Linderholm, A group epimorphism is surjective, Amer. Math. Monthly 77 (1970), 176–177. MR 0255643. Zbl 0194.03501. M. Nogin, A short proof of Eilenberg and Moore’s theorem, Cent. Eur. J. Math. 5 (2007), 201–204. MR 2287720. Zbl 1120.20054. H. Osaka and N. C. Phillips, Crossed products by finite group actions with the Rokhlin property, Math. Z. 270 (2012), 19–42. MR 2875821. Zbl 1244.46032. G. A. Reid, Epimorphisms and surjectivity, Invent. Math. 9 (1969/1970), 295–307. MR 0260829. Zbl 0191.13503. A. P. W. Sørensen and H. Thiel, A characterization of semiprojectivity for commutative C ∗ -algebras, Proc. Lond. Math. Soc. (3) 105 (2012), 1021–1046. MR 2997045. Zbl 1266.46043. H. Thiel, Inductive limits of projective C ∗ -algebras, preprint (arXiv:1105.1979 [math.OA]), 2011. 12 HANNES THIEL Hannes Thiel Mathematisches Institut, Fachbereich Mathematik und Informatik der Universität Münster, Einsteinstrasse 62, 48149 Münster, Germany. E-mail address: [email protected] URL: www.math.uni-muenster.de/u/hannes.thiel/
4math.GR
Tensor Decompositions for Modeling Inverse Dynamics Stephan Baier ∗ Volker Tresp ∗∗ ∗ arXiv:1711.04683v1 [cs.LG] 13 Nov 2017 Ludwig Maximilian University of Munich, Oettingenstr. 67, 80538 Munich (e-mail: [email protected]). ∗∗ Siemens AG and Ludwig Maximilian University of Munich, Otto-Hahn-Ring 6, 81739 Munich (e-mail: [email protected]) Abstract: Modeling inverse dynamics is crucial for accurate feedforward robot control. The model computes the necessary joint torques, to perform a desired movement. The highly non-linear inverse function of the dynamical system can be approximated using regression techniques. We propose as regression method a tensor decomposition model that exploits the inherent threeway interaction of positions × velocities × accelerations. Most work in tensor factorization has addressed the decomposition of dense tensors. In this paper, we build upon the decomposition of sparse tensors, with only small amounts of nonzero entries. The decomposition of sparse tensors has successfully been used in relational learning, e.g., the modeling of large knowledge graphs. Recently, the approach has been extended to multi-class classification with discrete input variables. Representing the data in high dimensional sparse tensors enables the approximation of complex highly non-linear functions. In this paper we show how the decomposition of sparse tensors can be applied to regression problems. Furthermore, we extend the method to continuous inputs, by learning a mapping from the continuous inputs to the latent representations of the tensor decomposition, using basis functions. We evaluate our proposed model on a dataset with trajectories from a seven degrees of freedom SARCOS robot arm. Our experimental results show superior performance of the proposed functional tensor model, compared to challenging state-of-the art methods. Keywords: Tensor modeling, tensor decomposition, inverse dynamics, robot dynamics, supervised machine learning 1. INTRODUCTION Within model-based robot control, an inverse dynamics model is used to compute the necessary joint torques of the robot’s motors for the execution of a desired movement. The feedforward control command can be calculated using the rigid-body formulation uF F = M (q)q̈ + F (q, q̇), with q, q̇, q̈ being vectors of joint positions, joint velocities, and joint accelerations. However, in practice many nonlinearities such as friction or actuator forces need to be taken into account. Thus, methods modeling uF F = f (q, q̇, q̈) using non-linear regression techniques have shown superior performance in inferring the required joint torques for feedforward robot control. The parameters of the function f are estimated offline using collected trajectories of the robot. Craig (2005); Nguyen-Tuong et al. (2008); Nakanishi et al. (2005). Tensor models have been applied successfully in many application areas, e.g., relational learning, multilinear time invariant systems, factor analysis, and spatio-temporal analysis, see Nickel et al. (2011); Pangalos et al. (2013b); Mørup et al. (2006); Bahadori et al. (2014). Most literature on tensor modeling, however, is concerned with the decomposition of dense tensors, i.e., most of the elements in the tensor are nonzero. Models for sparse tensors have mainly become popular for the application of modeling large knowledge graphs, such as Yago, DBpedia, and Freebase, see Nickel et al. (2011); Suchanek et al. (2007); Auer et al. (2007). In these models, the elements of the tensor represent all possible triple combinations of entities and relations in the knowledge graph. Only elements that represent known facts from the knowledge graph are set to one. This results in a very sparse tensor, where the vast majority of elements are zero. Recently, the approach has been extended to higher order tensors for the task of classifying discrete sensor data, see Baier et al. (2016). The tensor represents the space of all possible combinations of sensor values. By learning a representation for each possible value of all sensors, the decomposition allows for approximating highly non-linear functions. In this paper we build upon the approach of decomposing sparse tensors, and apply it to inverse system identification. Our model exploits the inherent three-way interaction of positions × velocities × accelerations. We first show how the method can be applied to regression tasks. Furthermore, we extend the approach to continuous inputs, by including basis functions that map the continuous inputs to the latent representations of the tensor decompositions. In this way, we retrieve a functional version of tensor decompositions. The basis functions also imply smoothness on the inputs, such that the model is able to generalize well, in spite of the extreme sparsity. By using multivariate basis functions we can group inputs, such that the dimensionality of the tensor decomposition can be reduced. In our inverse dynamics model we group the joint positions, velocities, and accelerations of all degrees of freedom of the robot, resulting in a tensor of order three. This makes the powerful Tucker decomposition applicable to the problem. We evaluate our model on a dataset of a seven degrees of freedom SARCOS robot arm that was introduced in Vijayakumar and Schaal (2000). An inverse dynamics model is learned based on collected trajectories, and its performance is evaluated on a 10 percent test set. The results show that our model outperforms a number of competitive baseline methods, such as linear regression, radial basis function networks (RBF-networks), and support vector regression. Furthermore, the Tucker model shows superior performance over a PARAFAC model. The paper is structured as follows. The next section gives an overview of related work. Section 2 shows how the factorization of sparse tensors can be utilized for regression problems, and how the tensor decompositions can be extended to continuous inputs, using basis functions. In Section 3 we describe a functional Tucker decomposition for the task of modeling inverse dynamics. Related work is discussed in Section 4. Section 5 presents the experimental evaluation. Finally, we conclude our work in Section 6. 2. TENSOR DECOMPOSITIONS USING BASIS FUNCTIONS In this section we first show how the decomposition of sparse tensors can be applied to regression problems with discrete input variables. We then extend the model to continuous inputs, by using basis functions, which map the continuous input to the latent representations of the tensor decompositions. Y(v1 , v2 , ..., vS ) ≈ r̃ X g(r)·A1 (v1 , r)·A2 (v2 , r)·. . .·AS (vS , r). r=1 (2) with g ∈ Rr̃ . As PARAFAC only models the diagonal of the core tensor, its parameters scale linearly with the order of the tensor; see Harshman (1970). 2.2 Discrete Input Regression We consider a regression problem with S ∈ N discrete input variables. Each of the input variables vi for i ∈ {1, ..., S} assumes one out of Fi ∈ N discrete values. Furthermore, we consider a dependent variable y. We model a regression function for a dataset of N training examples {y j , (v1j , ..., vSj )}N j=1 . All training examples are mapped to a sparse tensor Y ∈ RF1 ,...,FS . The tensor is filled with Y(v1j , ..., vSj ) = y j ∀j ∈ {1, ..., N }. (3) The remaining entries of the tensor, which do not occur in the training data, are left unknown. This results in Y being a very sparse tensor. The tensor Y is approximated using a low-rank tensor decomposition, e.g., the PARAFAC decomposition see equation 2. Using low ranks for r̃, the approximation results in a dense tensor Φ. It describes the outcome y for all combinations of the input variables (v1 , ..., vS ). However, it would be impossible to compute and store the whole approximated tensor Φ; thus, only the parameters of the decomposition are stored. When predicting y for a new set of input variables, the representations for that tuple are indexed, and the approximation is computed on demand. In principle any tensor decomposition can be used for the approximation. However, in practice only few decompositions, such as PARAFAC and Tensor Train are scale-able to many dimensions, see Harshman (1970); Oseledets (2011). 2.1 Tensor Decompositions 2.3 Continuous Inputs Tensor decompositions are a generalization of low rank matrix factorizations to higher order tensors. There are multiple ways of decomposing a higher order tensor. The proposed model so far only works for a discrete input space. Furthermore, it does not imply any smoothness on the values of the input variables. Although, this makes it a powerful, highly non-linear model, it is prone to overfitting. If the input values follow a natural ordering, or if they are discretized from a continuous scale, the model requires many more training examples to learn the smoothness implicitly. To introduce smoothness explicitly, and to extend the model to continuous inputs, we use smooth basis functions for the latent parameters of the decomposition. Instead of indexing the latent representation from a matrix, their values are computed using basis functions. For example, all Ai in equation 2 can be modeled using a radial basis function Ai (vi , ri ) = exp (−γri kµri − vi k2 ). (4) This allows for continuous inputs vi ∈ R. The latent representation is now modeled by the similarity of the input to the center of the radial basis function. In this way, similar inputs induce similar representations. The parameters of the basis function are optimized during training, to yield optimal regression results. Also a mixture The full Tucker decomposition factorizes a tensor Y ∈ Rd1 ×···×dS into S matrices, including latent representations for all fibers in each mode. The tensor elements are expressed by the interaction of the latent representations, weighted by a core tensor G ∈ Rr̃×···×r̃ such that Y(v1 , . . . , vS ) ≈ r̃ X G(r1 , . . . , rS ) · A1 (v1 , r1 )· r1 ,...,rS (1) A2 (v2 , r2 ) · . . . · AS (vS , rS ) di ×r̃ with Ai ∈ R . The full Tucker decomposition does not scale to high dimensions, as the core tensor G grows exponentially with the dimensionality of the tensor; see Tucker (1965). A special case of the full Tucker decomposition is the PARAFAC decomposition, where the core tensor G is diagonal. All other interactions are left out, such that positions ... ... velocities torques accelerations Fig. 1. Inverse dynamics model using a functional Tucker decomposition. The output tensors and the representation matrices are replaced by functions (illustrated with dashed lines). The representations are computed given the continuous inputs using Gaussian kernels. of discrete and continuous inputs can easily be modeled, by applying the basis functions only to the continuous inputs, and learning representation matrices for the discrete input variables. It is also possible to group multiple inputs together into one tensor mode, such that vi ∈ Rm , where m ∈ N denotes the number of grouped inputs. In this way, the representation of a tensor mode is calculated given a vector of continous inputs. The grouping of input variables reduces the dimensionality of the tensor decomposition, and thus the number of free parameters. 3. APPLICATION TO INVERSE DYNAMICS In the following we describe how the continuous tensor decomposition proposed in section 2 can be applied to inverse dynamics modeling. 3.1 Functional Tucker Decomposition We describe a functional Tucker model for the approximation of the joint torques, necessary to perform a movement of a robot arm. Figure 1 shows the model schematically. We consider a robot with C ∈ N degrees of freedom (DoF). In the following we denote the vectors p, ṗ, p̈, describing the desired positions, velocities, and accelerations for each of the c DoFs, as x1 , x2 , x3 ∈ Rc for syntactic reasons. The vector y ∈ Rc describes the corresponding joint torques. We model the function y = f (x1 , x2 , x3 ) using a functional tensor decomposition model. Each input vector is modeled by one dimension in the tensor decomposition, resulting in third-order tensors Y, which describe the joint torques. Each element of the vector y is modeled in a separate model. The resulting three-dimensional tensors of the form positions × velocities × accelerations, are then factorized using the Tucker decomposition with limited rank, resulting in a tensor Φ ≈ Y, such that Φ(x1 , x2 , x3 ) = r̃ X G(r1 , r2 , r3 ) · A1 (x1 , r1 ) · A2 (x2 , r2 ) r1 ,r2 ,r3 ·A3 (x3 , r3 ). (5) A1 to A3 are functions, which map from the c-dimensional input to the latent representations of the Tucker model. We model the representations using multivariate Gaussian kernels, such that  Ai (xi , ri ) = exp −(µri − xi )T Dri (µri − xi ) (6) ∀i ∈ {1, 2, 3}, with µri ∈ Rc representing the centers and Dri ∈ Rc×c weighting the distance from the centers in the c dimensional input space. The closer a data point is to the center of a basis function, the higher is its activation. Thus, the centers of the basis functions can be seen as landmarks in the input space. All three-way interactions, between the representations of the three input dimensions, are explicitly modeled and weighted by the elements of the core tensor G. 3.2 Model Training For training the model, we take a maximum likelihood approach. We minimize the negative log-likelihood of the collected dataset {y j , (xj1 , xj2 , xj3 )}N j=1 as l = −log N X p(y j |xj1 , xj2 , xj3 , Θ), (7) j=1 where Θ includes the parameters of the decomposition and the basis functions. Assuming a Gaussian distribution, we get the squared error cost function Table 1. Normalized mean squared error for all 7 degrees of freedom in percent. Mean and standard deviation of ten random data splits. Method Linear Regression RBF-Network Regression Support Vector Regression Functional-Tucker Functional-PARAFAC C= N X DoF 1 6.80 2.64 0.88 0.59 1.64 DoF 2 11.62 1.79 0.67 0.28 1.14 (Y(xj1 , xj2 , xj3 ) − Φ(xj1 , xj2 , xj3 ))2 . DoF 3 10.82 1.01 0.43 0.46 0.61 (8) i=1 Note, that the cost function considers only nonzero elements of the tensor, i.e., the sparsity of the tensor is exploited. We minimize equation 8 using gradient descent. In experiments, we found the stochastic optimization algorithm Adam, see Kingma and Ba (2014), which adopts the learning rate automatically for each parameter, to work best for this task. The sampling of stochastic mini-batches for each update has also shown advantageous, for speeding up training. We initialize the centers of the Gaussian kernel in a preprocessing step, using three k-means clusterings, such that N r̃ X X kxji − µri k2 (9) Ji = i j=1 are minimized for i ∈ {1, . . . , 3}, see Lloyd (1982). All matrices D are initialized with the identity matrix. The elements of the core tensor G are initialized randomly with a Gaussian distribution of mean zero and standard deviation 0.05. While training all parameters are further optimized. We implemented the model using the computational python library Theano, see Theano Development Team (2016). 4. RELATED WORK Multiway data analysis has found applications in a number of different areas, such as signal processing, neuroscience, and data mining, see Cichocki (2014); Mørup et al. (2006); Harshman (1970); Kolda and Bader (2009). Recently, tensor models also have found applications in control engineering such as for modeling hybrid systems, see Pangalos et al. (2013a) and multilinear dynamical systems, see Rogers et al. (2013). Furthermore, tensor methods have been applied to Boolean networks, see Cheng et al. (2010) and pneumatic models, see Gróf et al. (2010). The factorization of sparse matrices has become popular in recommendation systems, especially due to its success in the Netflix challenge, see Koren et al. (2009). Extensions to higher order tensors can be found in the modeling of large knowledge bases, such as Yago, DBpedia, or Freebase, see Nickel et al. (2011, 2015). The multi-graphs have been modeled using sparse three-dimensional tensors and decompositions such as RESCAL, see Nickel et al. (2011, 2015). The approach of factorizing sparse tensors has further been exploited in Baier et al. (2016). Here, the decomposition of sparse tensors is applied to multi-class classification with discrete input features. Tensor regression methods are concerned with the regression of high dimensional data, structured in a multidimen- DoF 4 5.81 0.41 0.15 0.24 0.32 DoF 5 12.81 4.07 1.04 1.03 1.30 DoF 6 22.59 3.91 0.72 0.91 1.17 DoF 7 6.73 1.17 0.34 0.31 0.50 Mean ± std in % 11.03 ± 0.26 2.14 ± 0.19 0.60 ± 0.28 0.55 ± 0.24 0.96 ± 0.22 sional array. Tensor methods allow for efficient modeling where traditional methods are often insufficient, due to the complex structure of the data and the high input dimensionality. Tensor regression learns a linear mapping and deals with dense input tensors. Thus, their approach is fundamentally different from ours; see Zhou et al. (2013); Yu and Liu (2016). Our approach shows some similarities to RBF-networks which are able to approximate any non-linear function by using radial basis functions. RBF-networks have been successfully applied to a number of tasks including control engineering, see Broomhead and Lowe (1988). The main difference to our proposed functional Tucker model is that RBF-networks learn one latent representation for the complete input, and map it to the output; whereas, the functional Tucker model learns a representation for each tensor mode and jointes them using the tensor decomposition model. In this way multi-way interactions are modeled explicitly. Inverse dynamics are traditionally modeled using the rigidbody formulation, see Craig (2005). However, general regression techniques such as locally weighted projection regression (LWPR), Gaussian Processes, and RBF-networks, have shown advantageous for learning inverse dynamics, see Vijayakumar and Schaal (2000); Rasmussen (2006). The topic was subject to a number of studies, see Burdet and Codourey (1998); Nguyen-Tuong et al. (2008). Support vector regression has shown superior performance for this task. 5. EXPERIMENTS In this section we evaluate our proposed method on an inverse dynamics dataset including movements from a seven degrees of freedom SARCOS robot arm. We compare against various other state-of-the-art regression techniques for this task. 5.1 Dataset The dataset was introduced by Vijayakumar and Schaal (2000). 1 It contains data from a SARCOS robot arm with seven degrees of freedom. The data was collected from the moving robot arm at 100Hz and corresponds to 7.5 minutes of movement. The dataset includes 21 input dimensions, consisting of 7 joint torques, 7 joint positions, 7 joint velocities, and 7 joint accelerations. The whole dataset consists of 42482 samples. We split the dataset randomly into 90 percent training and 10 percent test data. Additional 5 percent of the training set where used as a validation set. The task is to learn a model on the training data, which models the 7 joint torques, given the 1 http://www.gaussianprocess.org/gpml/data/ 3 2 1.5 1 0.5 0 5.2 Baselines functional Tucker functional PARAFAC 2.5 nMSE in % positions, velocities and accelerations. The offline learned model can then be applied in the forward controller of the robot. The dataset has been subject to some studies on the topic, see Vijayakumar and Schaal (2000); Rasmussen (2006). The regression task has been found to be highly non-linear. Non-linear regression techniques outperformed the rigid-body dynamics formulation by a large margin. The performance of the regression techniques is evaluated on the test set, which includes unseen movements. We repeated the random split 10 times and report the average results and the standard deviation of multiple trials. 5 10 15 20 25 30 35 40 45 50 Rank We compare our model against various state-of-the art regression techniques, modeling the function y = f (q, q̇, q̈). The baseline models we consider are linear regression, RBF-networks and support vector regression. In previous studies support vector regression has shown the best results on this task. For all baseline models a concatenated vector x = [q, q̇, q̈] is built. The linear regression model learns a linear mapping from the inputs to the outputs, such that y = W x + b. (10) RBF-networks model the regression problem as, r̃ X wi exp (−βi kx − ci k2 ). (11) y= i=1 The parameters ci , βi and wi are learned using backpropagation. We initialized the parameters ci with the centroids of a k-means clustering on the training data, where r̃ is the number of centroids. Support vector regression (see Smola and Vapnik (1997)) has shown state-of-the-art results in modeling inverse dynamics. It predicts y as, N X y= (αj − αj? )k(xj , x) + b (12) j=1 0 with k(x, x ) being a kernel function. In the experiments we use a Gaussian kernel. αj and αj? are Lagrange multipliers, which are determined during optimization. In our experiments we use the libsvm library, see Chang and Lin (2011). Furthermore, we compare the functional Tucker model proposed in Section 3 with a functional PARAFAC model. For the functional PARAFAC model we replace the tensor decomposition in equation 5 with a PARAFAC decomposition, as shown in equation 2. 5.3 Results We report the normalized mean squared error (nMSE) for the regression task, which is defined as the mean squared error of all data points divided by the variance of the target variable in the training data. Table 1 summarizes the mean nMSE for all seven degrees of freedom in percent. In the rightmost column the mean of all seven degrees of freedom is shown. All results, as well as the standard deviation are referring to the average result of 10 random data splits. The performance of the regression techniques varies across the DoFs. The linear model reaches an nMSE of 11.03% Fig. 2. Normalized mean squared error of the functional Tucker and functional PARAFAC model, in dependency of the embedding rank. in average. The nonlinear RBF-networks performs much better with an nMSE of 2.14% in average. The number of of hidden neurons for the RBF-network was set to 1000. With larger numbers the predictive performance did not increase. The support vector regression model yields a very good result of 0.60%. Here, we set the parameter C to 600 and  to 0.1. All hyperparameters were evaluated on a separate validation set. Our proposed functional Tucker model resulted in a slightly better nMSE of 0.55%. Especially, for the first two DoFs the functional Tucker model performs significantly better than support vector regression. For the other DoFs the results of support vector regression and functional Tucker decomposition are very close to each other. The parameter efficient functional PARAFAC model reaches an nMSE of 0.96% in average. Figure 2 shows the performance of the two functional tensor decomposition models in dependence of the rank of the decompositions. For the Tucker model, the performance converges at a rank of 30 and for the PARAFAC model at a rank of 40. It is also notable that both methods already perform relatively well with a very small rank of 5. The nMSE of the Tucker model is 2.09% with a rank of 5 and the nMSE of the PARAFAC model is 2.43%. Both functional tensor models show clearly better results than RBF-networks. This indicates that the explicit modeling of the three-way interaction, yields a significant improvement. 6. CONCLUSION In this paper we apply a tensor model, that is based on the Tucker decomposition, to inverse dynamics. Our proposed model exploits the inherent three-way interaction of positions × velocities × accelerations. We show how the decomposition of sparse tensors can be applied to regression tasks. Furthermore, we propose to augment the tensor decompositions with basis functions for allowing continuous input variables. In this way, a functional version of a tensor decomposition can be derived. Representations for each tensor mode are induced through the basis functions and fused by the tensor model. The parameters of the basis functions are learned using backpropagation. Experiments on an inverse dynamics dataset, derived from a seven degrees of freedom robot arm, show promising results of our proposed model for the application of learning inverse dynamics. The proposed functional Tucker model outperforms RBF-networks, and even support vector regression, which has shown state-of-the-art performance on this task. Our extension of tensor decomposition models to continuous inputs enables a wide range of application areas. Especially if an inherent multi-way structure exists in the data, functional tensor models can be advantageous over traditional techniques, by explicitly modeling the multi-way interaction. Within automatic robot control the approach might be further extended to learning also a functional Tucker model for a feedback controller based on the tracking errors. REFERENCES Auer, S., Bizer, C., Kobilarov, G., Lehmann, J., Cyganiak, R., and Ives, Z. (2007). Dbpedia: A nucleus for a web of open data. In The semantic web, 722–735. Springer. Bahadori, M.T., Yu, Q.R., and Liu, Y. (2014). Fast multivariate spatio-temporal analysis via low rank tensor learning. In Advances in neural information processing systems, 3491–3499. Baier, S., Krompass, D., and Tresp, V. (2016). Learning representations for discrete sensor networks using tensor decompositions. International Conference on Multisensor Fusion and Integration for Intelligent Systems. Broomhead, D.S. and Lowe, D. (1988). Radial basis functions, multi-variable functional interpolation and adaptive networks. Technical report, DTIC Document. Burdet, E. and Codourey, A. (1998). Evaluation of parametric and nonparametric nonlinear adaptive controllers. Robotica, 16(01), 59–73. Chang, C.C. and Lin, C.J. (2011). Libsvm: a library for support vector machines. ACM Transactions on Intelligent Systems and Technology (TIST), 2(3), 27. Cheng, D., Qi, H., and Li, Z. (2010). Analysis and control of Boolean networks: a semi-tensor product approach. Springer Science & Business Media. Cichocki, A. (2014). Tensor networks for big data analytics and large-scale optimization problems. arXiv preprint arXiv:1407.3124. Craig, J.J. (2005). Introduction to robotics: mechanics and control, volume 3. Pearson Prentice Hall Upper Saddle River. Gróf, P., Takarics, B., Petres, Z., and Korondi, P. (2010). Tensor product model type polytopic decomposition of a pneumatic system with friction phenomena taken into account. In Applied Machine Intelligence and Informatics (SAMI), 2010 IEEE 8th International Symposium on, 153–158. IEEE. Harshman, R.A. (1970). Foundations of the parafac procedure: Models and conditions for an” explanatory” multi-modal factor analysis. Kingma, D. and Ba, J. (2014). Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. Kolda, T.G. and Bader, B.W. (2009). Tensor decompositions and applications. SIAM review, 51(3), 455–500. Koren, Y., Bell, R., and Volinsky, C. (2009). Matrix factorization techniques for recommender systems. Computer, (8), 30–37. Lloyd, S. (1982). Least squares quantization in pcm. IEEE transactions on information theory, 28(2), 129–137. Mørup, M., Hansen, L.K., Herrmann, C.S., Parnas, J., and Arnfred, S.M. (2006). Parallel factor analysis as an exploratory tool for wavelet transformed event-related eeg. NeuroImage, 29(3), 938–947. Nakanishi, J., Farrell, J.A., and Schaal, S. (2005). Composite adaptive control with locally weighted statistical learning. Neural Networks, 18(1), 71–90. Nguyen-Tuong, D., Peters, J., Seeger, M., and Schölkopf, B. (2008). Learning inverse dynamics: a comparison. In European Symposium on Artificial Neural Networks, EPFL-CONF-175477. Nickel, M., Murphy, K., Tresp, V., and Gabrilovich, E. (2015). A review of relational machine learning for knowledge graphs: From multi-relational link prediction to automated knowledge graph construction. arXiv preprint arXiv:1503.00759. Nickel, M., Tresp, V., and Kriegel, H.P. (2011). A threeway model for collective learning on multi-relational data. In Proceedings of the 28th international conference on machine learning (ICML-11), 809–816. Oseledets, I.V. (2011). Tensor-train decomposition. SIAM Journal on Scientific Computing, 33(5), 2295–2317. Pangalos, G., Eichler, A., and Lichtenberg, G. (2013a). Tensor systems - multilinear modeling and applications. In Proceedings of the 3rd International Conference on Simulation and Modeling Methodologies, Technologies and Applications, 275–285. doi: 10.5220/0004475602750285. Pangalos, G., Eichler, A., and Lichtenberg, G. (2013b). Tensor systems-multilinear modeling and applications. In SIMULTECH, 275–285. Rasmussen, C.E. (2006). Gaussian processes for machine learning. Rogers, M., Li, L., and Russell, S.J. (2013). Multilinear dynamical systems for tensor time series. In Advances in Neural Information Processing Systems, 2634–2642. Smola, A. and Vapnik, V. (1997). Support vector regression machines. Advances in neural information processing systems, 9, 155–161. Suchanek, F.M., Kasneci, G., and Weikum, G. (2007). Yago: a core of semantic knowledge. In Proceedings of the 16th international conference on World Wide Web, 697–706. ACM. Theano Development Team (2016). Theano: A Python framework for fast computation of mathematical expressions. arXiv e-prints, abs/1605.02688. URL http://arxiv.org/abs/1605.02688. Tucker, L.R. (1965). Some Mathematical Notes on Threemode Factor Analysis [by]. Urbana, Department of Psychology, University of Illinois. Vijayakumar, S. and Schaal, S. (2000). Locally weighted projection regression: An o (n) algorithm for incremental real time learning in high dimensional space. In International conference on machine learning, proceedings of the sixteenth conference. Yu, R. and Liu, Y. (2016). Learning from multiway data: Simple and efficient tensor regression. In Proceedings of the 33nd International Conference on Machine Learning (ICML-16), 238–247. Zhou, H., Li, L., and Zhu, H. (2013). Tensor regression with applications in neuroimaging data analysis. Journal of the American Statistical Association, 108(502), 540–552.
3cs.SY
Polly’s Polyhedral Scheduling in the Presence of Reductions Johannes Doerfert, Kevin Streit, and Sebastian Hack Zino Benaissa Qualcomm Innovation Center San Diego California, USA Computer Science Department Saarland University Saarbrücken, Germany [email protected] arXiv:1505.07716v1 [cs.PL] 28 May 2015 <lastname>@cs.uni-saarland.de ABSTRACT to loop carried data dependences. An often used definition for reductions describes them as an associative and commutative computation which reduces the dimensionality of a set of input data [16]. A simple example is the array sum depicted in Figure 1a. The input vector A is reduced to the scalar variable sum using the associative and commutative operator +. In terms of data dependences, the loop has to be computed sequentially because a read of the variable sum in iteration i + 1 depends on the value written in iteration i. However, the associativity and commutativity of the reduction operator can be exploited to reorder, parallelize or vectorize such reductions. While reordering the reduction iterations is always a valid transformation, executing reductions in a parallel context requires additional “fix up”. Static transformations often use privatization as fix up technique as it works well with both small and large parallel tasks. The idea of privatization is to duplicate the shared memory locations for each instance running in parallel. Thus, each parallel instance works on a private copy of a shared memory location. Using the privatization scheme we can vectorize the array sum example as shown in Figure 1b. For the shared variable sum, a temporary array tmp_sum, with as many elements as there are vector lanes, is introduced. Now the computation for each vector lane uses one array element to accumulate intermediate results unaffected by the computations of the other lanes. As the reduction computation is now done in the temporary array instead of the original reduction location we finally need to accumulate all intermediate results into the original reduction location. This way, users of the variable sum will still see the overall sum of all array elements, even though it was computed in partial sums first. The polyhedral model provides a powerful mathematical abstraction to enable effective optimization of loop nests with respect to a given optimization goal, e.g., exploiting parallelism. Unexploited reduction properties are a frequent reason for polyhedral optimizers to assume parallelism prohibiting dependences. To our knowledge, no polyhedral loop optimizer available in any production compiler provides support for reductions. In this paper, we show that leveraging the parallelism of reductions can lead to a significant performance increase. We give a precise, dependence based, definition of reductions and discuss ways to extend polyhedral optimization to exploit the associativity and commutativity of reduction computations. We have implemented a reduction-enabled scheduling approach in the Polly polyhedral optimizer and evaluate it on the standard Polybench 3.2 benchmark suite. We were able to detect and model all 52 arithmetic reductions and achieve speedups up to 2.21× on a quad core machine by exploiting the multidimensional reduction in the BiCG benchmark. Categories and Subject Descriptors D 3.4 [Programming languages]: Processors—Compilers, Optimization General Terms Algorithms; Performance Keywords Compiler Optimization; Affine Scheduling; Reductions 1. for (i = 0; i < 4 * N; i++) sum += A[i]; INTRODUCTION Over the last four decades various approaches [10, 11, 2, 17, 22, 6, 18, 21, 27, 31, 7] were proposed to tackle reductions: a computational idiom which prevents parallelism due (a) Sequential array sum computation. tmp_sum[4] = {0,0,0,0} for (i = 0; i < 4 * N; i+=4) tmp_sum[0:3] += A[i:i+3]; IMPACT 2015 Fifth International Workshop on Polyhedral Compilation Techniques Jan 19, 2015, Amsterdam, The Netherlands In conjunction with HiPEAC 2015. sum += tmp_sum[0] + tmp_sum[1]; + tmp_sum[2] + tmp_sum[3]; http://impact.gforge.inria.fr/impact2015 Figure 1: A canonical example of a single address reduction. (b) Vectorized array sum computation. 1 Transformations as described above have been the main interest of reduction handling approaches outside the polyhedral world. Associativity and commutativity properties are used to extract and parallelize the reduction loop [10, 6] or to parallelize the reduction computation with regards to an existing surrounding loop [17, 18, 21, 27, 31]. While prior work on reductions in the polyhedral model [22, 23, 24, 9, 32] was focused on system of affine recurrences (SAREs), we look at the problems a production compiler has to solve when we allow polyhedral optimizations that exploit the reduction properties. To this end our work supplements the polyhedral optimizer Polly [8], part of the LLVM [14] compiler framework with awareness for the associativity and commutativity of reduction computations. While we are still in the process of upstreaming, most parts are already accessible in the public code repository. The contributions of this paper include: dependences between individual instances thereof. R has a one-dimensional iteration space, as it is nested in the i-loop only. Statements S and T have a two-dimensional iteration space as they are nested in both the i-loop as well as in the j -loop. The axes in the Figure correspond to the respective loops. Single instances of each statement are depicted as dots in the graph. Dependences between individual statement instances are depicted as arrows: dashed ones for regular data dependences and dotted ones for loop carried data dependences. Stmt R j NY-1 j 0 NY-1 In the polyhedral model the iteration space of a statement Q is represented as a multidimensional Z-polytope IQ , defined by affine constraints on the iteration variables of loops surrounding the statement, as well as global parameters. The latter are basically loop invariant expressions like for example the upper bounds NX and NY of the loops in Figure 2. As a consequence, the polyhedral model is only applicable to well structured program parts with affine loop bounds and memory access functions, so called Static Control Parts (SCoP s) [8]. While, there are different over-approximations to increase the applicability (e.g., by Benabderrahmane [1]) we will assume that all restrictions of SCoP s are fulfilled. The dependences between two statements Q and T are also represented as a multidimensional Z-polytope known as the dependence polytope D<Q,T > . It contains a point < iQ , iT > for every pair of instances < iQ >∈ IQ and < iT >∈ IT for which the latter depends on the former. To ease reading we will however omit the index of the dependence polytopes and only argue about the set of all dependences D, defined as: The remainder of this paper is organized as follows: We give a short introduction into the polyhedral model in Section 2. Thereafter, in Section 3, our reduction detection is described. Section 4 discusses the benefits and drawbacks of different reduction parallelization schemes, including privatization. Afterwards, we present different approaches to utilize the reduction properties in a polyhedral optimizer in Section 5. In the end we evaluate our work (Section 6), compare it to existing approaches (Section 7) and conclude with possible extensions in Section 8. THE POLYHEDRAL MODEL The main idea behind polyhedral loop nest optimizations is to abstract from technical details of the target program. Information relevant to the optimization goal is represented in a very powerful mathematical model and the actual optimizations are well understood transformations on this representation. In the context of optimization for data locality or parallelism, the relevant information is the iteration space of each statement, as well as the data dependences between individual statement instances. 0; i < 0; = 0; j = q[i] = s[j] 0 Figure 3: Polyhedral representation of statements R, S and T of the BiCG Sub Kernel of Figure 2. • A dependence based approach to identify vectorization and parallelization opportunities in the presence of reductions. for (i = q[i] = for (j S: q[i] T: s[j] } } 0 Stmt T i 0 • A sound model to relax memory dependences with regards to reductions and its use in reduction-enabled polyhedral scheduling. R: i NX-1 • A powerful algorithm to identify reduction dependences, applicable whenever memory or value based dependence information is available. 2. Stmt S i D := {< iQ , iT > | ∀Q, T ∈ SCoP :< iQ , iT >∈ D<Q,T > } Later we will also distinguish all Write-After-Write (WAW or output dependence) dependences of D by writing DWAW . A loop transformation in the polyhedral model is represented as an affine function θQ for each statement Q. It is often called scheduling or scattering function. This function translates a point in the original iteration space IQ of statement Q into a new, transformed target space. One important legality criterion for such a transformation is that data dependences need to be respected: The execution of every instance of a source statement Q of a dependence has to precede the execution of the corresponding target statement T in the transformed space. Formulated differently: the target iteration vector of the value producing instance of Q has to be lexicographically smaller1 than the target NX; i++) { < NY; j++) { + A[i][j] * p[j]; + r[i] * A[i][j]; Figure 2: BiCG Sub Kernel of BiCGStab Linear Solver. Figure 2 shows an example program containing three statements R, S and T in a loop nest of depth two. Figure 3 shows the polyhedral representation of the individual iteration spaces for all statements, as well as value-based data 1 To compare two vectors of different dimensionality, we simply fill up the shorter vector with zeros in the end to match the dimensionality of the larger one. 2 iteration vector of the consuming instance of T : < iQ , iT >∈ D ⇒ θQ (iQ )  θT (iT ) SCoP . The range of a memory instruction is defined as the range of its affine access function: (1) ran(store x A[f(iS , p)]) := ran(A[f(iS , p)]) ran(load A[f(iS , p)]) := ran(A[f(iS , p)]) ran(A[f(iS , p)]) := A + ran(f(iS , p)) Multiple statements, or multiple instances of the same statement, that are mapped to the same point in the target space, can be executed in parallel. However, implementations of polyhedral schedulers [3, 29] usually generate scheduling functions with full rank, thus rank (dom(θ)) = rank (img(θ)). The parallelism is therefore not explicit in the scheduling function but is exposed later when the polyhedral representation is converted to target code. There are two things that make the described model particularly interesting for loop transformation: First, unlike classical optimizers, a polyhedral optimizer does not only consider individual statements, but instead individual dynamic instances of each statement. This granularity leads to a far higher expressiveness. Second, the combination of multiple classical loop transformations, like for instance loop skewing, reversal, fusion, even tiling, typically used as atoms in a sequence of transformations, can be performed in one step by the scattering function. There is no need to come up with and evaluate different, possibly equivalent or even illegal combinations of transformations. Instead, linear optimization is used to optimize the scattering function for every individual statement with respect to an optimization goal. 3. Note the absence of any kind of control flow producing or dependent instructions (φ instructions or branches). This is a side effect of the limited scope of the reduction detection analysis. It is applied only to polyhedral statements, in our setting basic blocks with exactly one store instruction. Furthermore, we assume all loop carried values are communicated in memory. This setup is equivalent to C source code statements without non-memory side effects. 3.1 DETECTING REDUCTIONS Pattern based approaches on source statements are limited to find general reduction idioms [6, 21, 27]. The two main restrictions are the amount of patterns in the compiler’s reduction pattern database and the sensitivity to the input code quality or preprocessing steps. To become as independent as possible of source code quality and canonicalization passes we replace the pattern recognition by a simple, data flow like analysis. This analysis will identify reductionlike computations within each polyhedral statement. Such a computation is a potential candidate for a reduction, thus it might be allowed to perform the computation in any order or even in parallel. Afterwards, we utilize the polyhedral dependence analysis [5] to precisely identify all reduction dependences [20] in a SCoP , hence to identify the actual reduction computations from the set of possible candidate (reduction-like) computations. l = load A[f(iS , p)] x = y Reduction-like Computations Reduction-like computations are a generalization of the reduction definition used e.g., by Jouvelot [11] or Rauchwerger [21]. Their main characteristic is an associative and commutative computation which reduces a set of input values into reduction locations. Furthermore, the input values, the control flow and any value that might escape into a nonreduction location needs to be independent of the intermediate results of the reduction-like computation. The difference between reduction-like computations and reductions known in the literature is the restriction on other appearances of the reduction location in the loop nest. We do not restrict syntactic appearances of the reduction location base pointer as e.g., Rauchwerger [21] does, but only accesses to the actual reduction location in the same statement. This means a reduction-like computation on A[i%2] is not invalidated by any occurrence of A[i%2 + 1] in the same statement or any occurrence of A in another statement. It is crucial to stress that we define reduction-like computations for a single polyhedral statement containing only a single store. Thus intermediate results of a reduction-like computation can only escape if they are used in a different statement or outside the SCoP . As we focus on memory reductions in a single statement we will assume such outside uses invalidate a candidate computation from being reduction-like. To this end we define the function: hasOutsideUses : Insts → bool that returns true if an instruction is used outside its statement. In Section 3.3 we explain how the situation changes if multiple statements are combined into compound statements in order to save compile time. Reconsider the array sum example in Figure 1. The reduction location is the variable sum, a scalar variable or zero dimensional array. However, we do not limit reductionlike computations to zero dimensional reduction locations, instead we allow multidimensional reduction locations, also called histogram reductions [18], as well. The second example, Figure 2, shows two such multidimensional reductions. The reduction locations are q[i] and s[j]. The first is variant in the outer loop, the second in the inner loop. To detect reduction-like computations we apply the detection function tS , shown in Figure 4, to the store in the polyhedral statement S. The idea is to track the flow of loaded values through computation up to the store. To this end, tS (I) for any instruction I will assign each load a symbol that describes how the value loaded by load used up to and by I. We will use Rop to refer to the set of all store x A[f(iS , p)] z Figure 5: SSA-based language subset. The following discussion is restricted to the SSA-based language subset (Insts) depicted in Figure 5. Our implementation however handles all LLVM-IR [14] instructions. The binary operation is parametrized with and can be instantiated with any arithmetic, bit-wise or logic binary operator. To distinguish associative and commutative binary operators we use ⊕ instead. The load instruction is applied to a memory location. It evaluates to the current value x stored in the corresponding memory location. The store instruction takes a value x and writes it to the given memory location. In both cases the memory location is described as A[f(iS , p)], where A is a constant array base pointer and f(iS , p) is an affine function with regards to outer loop indices of the statement S (iS ) and parameters (p) of the 3 tS (l = load A[f(iS , p)]) := λl : if (l 6= l) then ⊥ else if (hasOutsideUses(l)) then > else ↑ tS (x = y z) := λl : if ({ (tS (y))(l), (tS (z))(l) } = { ⊥, ⊥ }) then ⊥ else if ¬(isCommutative( ) ∧ isAssociative( )) then > else if (hasOutsideUses(x)) then > else tS (store x A[f(iS , p)]) := λl : if ({ (tS (y))(l), (tS (z))(l) } = { ↑, ⊥ }) then else if ({ (tS (y))(l), (tS (z))(l) } = { , ⊥ }) then else > if x ∈ / Insts then ⊥ else if (ran(l) ∩ ran(A[f(iS , p)]) = ∅) then > else if (∃l0 : l 6= l0 ∧ ran(l0 ) ∩ ran(l) ∩ ran(A[f(iS , p)]) 6= ∅) then > else (tS (x))(l) Figure 4: Detection function for reduction-like computations: tS : Insts → (loads(S) → Rop ). four symbols. It includes the ⊥ indicating that the load was not used by the instruction, the ↑ to express that it was only loaded but not yet used in any computation, the > stating that the loaded value may have been used in a nonassociative or non-commutative computation. Additionally, the ⊕ is used when the loaded value was exactly one input of a chain of ⊕ operations. Note that only a load l that flows with ⊕ into the store is a valid candidate for a reduction-like computation and only if the load and the store access (partially) the same memory. Furthermore, we forbid all other load instructions in the statement to access the same memory as both l and the store as that would again make the computation potentially non-associative and non-commutative. If a valid load l was found, it is the unique load instruction inside the statement S that accesses (partially) the same memory as the store s and (tS (s))(l) is an associative and commutative operation ⊕. We will refer to the quadruple (S, l, ⊕, s) as the reduction-like computation Rc of S and denote the set of all reduction-like computations in a SCoP as Rc . It is worth noting that we explicitly allow the access functions of the load and the store to be different as for example shown in Figure 6. In such cases a reduction can manifest only for certain parameter valuations or, as shown, for certain valuations of outer loop indices. Additionally, we could easily extend the definition to allow non-affine but Presburger accesses or even over-approximated non-affine accesses if they are pure. It is also worth to note that our definition does not restrict the shape of the induced reduction dependences. computation, reduction dependences can be considered to be “associative” and “commutative”. The latter allows a schedule to reorder the iterations participating in the reductionlike computation while it can still be considered valid, however all non-reduction dependences still need to be fulfilled. We split the set of all dependences D into the set of reduction dependences Dρ ⊆ D and the set of non-reduction dependences Dν := D \ Dρ . Now we can express the commutativity of a reduction dependence by extending the causality condition given in Constraint 1 as follows: (2) < iQ , iT >∈ Dρ =⇒ θQ (iQ ) 6= θT (iT ) (3) Constraint 2 is the same as the original causality condition (Constraint 1), except that we restrict the domain to non-reduction dependences Dν . For the remaining reduction dependences Dρ , Constraint 3 states that the schedule θ can reorder two iterations freely, as long as they are not mapped to the same time stamp. However, relaxing the causality condition for reduction dependences is only valid if D contains all transitive reduction dependences. This is for example the case if D is computed by a memory-based dependence analysis. In case only value-based dependence analysis [5] was performed it is also sufficient to provide the missing transitive reduction dependences e.g., by recomputing them using a memory-based dependence analysis. Reconsider the BiCG kernel (Figure 2) and its non transitive (value-based) set of dependences D shown in Figure 3. If we remove all reduction dependences Dρ from D, the only constraints left involve statement R and the iterations of statements S with j = 0. Consequently, there is no reason not to schedule the other instances of statement S before statement R. To address the issue of only value-based dependences without recomputing memory-based ones we use the transitive closure Dρ+ S of the reduction dependences for a statement S (Equation 4). As the transitive closure of a Presburger relation is not always a Presburger relation we might have to use an over-approximation to remain sound, however Pugh and Wonnacot [19] describe how the transitive closure can also be computed precisely for exact direction/distance vectors. They also argue in later work [20] that the transitive closure of value-based reduction dependences of real programs can be computed in an easy and fast way. If we now interpret Dρ+ S as a relation that maps instances of a reduction statement S to all instances of S transi- for (i = 0; i < N; i++) for (j = 0; j < M; j++) A[j] = A[j-i] + Mat[i][j]; Figure 6: Conditional reduction with different access functions. 3.2 < iQ , iT >∈ Dν =⇒ θQ (iQ )  θT (iT ) Reduction Dependences While the data flow analysis performed on all polyhedral statements only marks reduction-like computations, we are actually interested in reduction dependences [20]. These loop carried self dependences start and end in two instances of the same reduction-like computation and they inherit some properties of this computation. Similar to the reduction-like 4 tively dependent, we can define privatization dependences Dτ (Equation 5). In simple terms, Dτ will ensure that no non-reduction statement accessing the reduction location can be scheduled in-between the reduction statement instances by extending the dependences ending or starting from a reduction access to all reduction access instances. This also means that in case no memory locations are reused e.g., after renaming and array expansion [4] was applied, the set of privatization dependences will be empty. Dρ+ S := (Dρ ∩ < IS , IS >)+ non-reduction memory locations. This happens if and only if intermediate values—and therefore the reduction load— flow into multiple store instructions of the statement S. Additionally, other store instructions are not allowed to override intermediate values of the reduction computation. Thus, (S, l, ⊕, s) can only be a reduction-like computations, if for all other store instructions s’ in S: (t(s’))(l) = ⊥ ∧ range(s’) ∩ range(s) ∩ range(l) = ∅ Furthermore, we cannot assume that all loop carried WAW self dependences of a statement containing a reduction-like computation are reduction dependences: other read and write accesses contained in the statement could cause the same kind of dependences. However, we are particularly interested in dependences caused by the load and store instruction of a reduction-like computation Rc . To track these accesses separately we can pretend they are contained in their own statement SRc that is executed at the same time as S (in the original iteration space). This is only sound as long as no other instruction in S accesses (partially) the same memory as the load or the store, but this was already a restriction on reduction-like computations. The definition of reduction dependences (Equation 7) is finally changed to: (4) Dτ := {< iT , Dρ+ S (iS ) > | < iT , iS >∈ D<T,S> } ∪ {< Dρ+ S (iS ), iT > | < iS , iT >∈ D<S,T > } (5) Privatization dependences overestimate the dependences that manual privatization of the reduction locations would cause. They are used to create alternative causality constraint for the reduction statements that enforce the initial order between the reduction-like computation and any other statement accessing the reduction locations. To make use of them we replace Constraint 2 by Constraint 6. < iQ , iT >∈ (Dν ∪ Dτ ) =⇒ θQ (iQ )  θT (iT ) (6) If we now utilize the associativity of the reduction dependences we can compute intermediate results in any order before we combine them to the final result. As a consequence we can allow parallelization of the reduction-like computation, thus omit Constraint 3; thereby eliminating the reduction dependences Dρ from the causality condition of a schedule completely. However, parallel execution of iterations connected by reduction dependences requires special “treatment” of the accesses during the code generation as described in Section 4. The restriction on polyhedral statements, especially that it contains at most one store instruction, eases the identification of reduction dependences; they are equal to all loop carried Write-After-Write self dependences over a statement with a reduction-like computation2 . Thus, Dρ can be expressed as stated in Equation 7. Dρ := DWAW ∩ { IS × IS | (S, l, ⊕, s) ∈ Rc } 3.3 Dρ := DWAW ∩ { ISRc × ISRc | Rc ∈ Rc } (8) It is important to note the increased complexity of the dependence detection problem when we model reduction accesses separately. However, our experiments in Section 6 show that the effect is (in most cases) negligible. Furthermore, we want to stress that this kind of separation is not equivalent to separating the reduction access at the statement level as we do not allow separate scheduling functions for S and SRc . Similar to a fine-grained granularity at the statement level, separation might be desirable in some cases, however it suffers from the same drawbacks. 4. PARALLEL EXECUTION When executing accesses to a reduction location x , p times in parallel, it needs to be made sure that the read-modifywrite cycle on x happens atomically. While doing exactly that — performing atomic read-modify-write operations — might be a viable solution in some contexts [31], it is generally too expensive. The overhead of an atomic operation easily outweighs the actual work for smaller tasks [18]. Additionally, the benefit of vectorization is lost for the reduction, as atomic operations have to scalarize the computation again. We will therefore focus our discussion and the evaluation on privatization as it is generally well-suited for the task at hand [18]. (7) General Polyhedral Statements Practical polyhedral optimizer operate on different granularities of polyhedral statements; a crucial factor for both compile time and quality of the optimization. While Clan 3 operates on C statements, Polly is based on basic blocks in the SSA-based intermediate language of LLVM. The former eases not only reduction handling but also offers more scheduling freedom. However, the latter can accumulate the effects of multiple C statements in one basic block, thus it can perform better with regards to compile time. Finding a good granularity for a given program, e.g., when and where to split a LLVM basic block in the Polly setting, is a research topic on its own but we do not want to limit our approach to one fixed granularity. Therefore, we will now assume a polyhedral statement can contain multiple store instructions, thus we allow arbitrary basic blocks. As a first consequence we have to check that intermediate values of a reduction-like computation do not escape into 4.1 Privatizing Reductions Privatization means that every parallel context c i , which might be a thread or just a vector lane, depending on the kind of parallelization, gets its own private location xi for x . In front of the parallelized loop carrying a reduction dependence p, private locations x1 , · · · , xp of x are allocated and initialized with the identity element of the corresponding reduction operation ⊕. Every parallel context c i now non-atomically, and thus cheaply, modifies its very own location xi . After the loop, but before the first use of the x, accumulation code needs to join all locations into x again, thus: x := x ⊕ x1 ⊕ · · · ⊕ xp . 2 In this restricted environment we could also use the ReadAfter-Write (RAW) dependences instead of the WAW ones. 3 http://icps.u-strasbg.fr/˜bastoul/development/clan/ 5 // (A) init for (i = 0; i < NX; i++) // (B) init for (j = 0; j < NY; j++) // (C) init for (k = 0; k < NZ; k++) P[j] += Q[i][j] * R[j][k]; // (C) aggregate // (B) aggregate // (A) aggregate sulting code might be limited, which suggests that the scheduler should be aware of the implications of a chosen schedule with respect to the efficiency of necessary privatization. In Section 6.1 we discuss the effect of different placement choices for the BiCG benchmark shown in Figure 2. 5. MODELING REDUCTIONS As mentioned earlier, the set D of all dependences is partitioned into the set Dρ of reduction induced dependences and Dν of regular dependences. Reduction dependences inherit properties similar to associativity and commutativity from the reduction operator ⊕: the corresponding source and target statement instances can be executed in any order— provided ⊕ is a commutative operation—or in parallel—if ⊕ is at least associative. In order to exploit these properties the polyhedral optimizer needs to be aware of them. To this end we propose different scheduling and code generation schemes. Figure 7: Possible privatization locations (A-C ) for the reduction over P[j]. Such a privatization transformation is legal due to the properties of a reduction operation. Every possible user of x sees the same result after the final accumulation has been performed as it would have seen before the transformation. Nevertheless we gained parallelism which cannot be exploited without the reduction properties. It might seem, that the final accumulation of the locations needs to be performed sequentially, but note that the number of locations does not necessarily grow with the problem size but instead only with the maximal number of parallel contexts. Furthermore, accumulation can be done in logarithmic time by parallelizing the accumulation correspondingly [6]. One positive aspect of using privatization to fix a broken reduction dependence is that it is particularly well-suited for both ways of parallelization usually performed in the polyhedral context: thread parallelism and vectorization. For thread parallelism real private locations of the reduction address are allocated; in case of vectorization, a vector of suitable width is used. As described, privatization creates “copies” of the reduction location, one for each instance possibly executed in parallel. While we can limit the number of private locations (this corresponds to the maximal number of parallel contexts), we cannot generally bound the number of reduction locations. Furthermore, the number of necessary locations, as well as the number of times initialization and aggregation is needed, varies with the placement of the privatization code. Consider the example in Figure 7. Different possibilities exist to exploit reduction parallelism: using placement C for the privatization, the k -loop could be executed in parallel and only p private copies of the reduction location are necessary. There is no benefit in choosing location B as we then need p×NY privatization locations (we have NY different reduction locations modified by the j -loop and p parallel contexts), but there is no gain in the amount of parallelism (the j -loop is already parallel). Finally, choosing location A for privatization might be worthwhile. We still only need p × NY privatized values, but save aggregation overhead: While for location C , p values are aggregated NX × NY times and for location B , p × NY locations are aggregated NX times, for location A, p × NY locations are aggregated only once. Furthermore, the i-loop can now be parallelized. In general, a trade-off has to be made between memory consumption, aggregation time and exploitable parallelism. Finding a good placement however is difficult and needs to take the optimization goal, the hardware and the workload size into account. Furthermore, depending on the scheduling, the choices for privatization code placement in the re- Reduction-Enabled Code Generation is a simple, non-invasive method to realize reductions during the code generation, thus without modification of the polyhedral representation of the SCoP . Reduction-Enabled Scheduling exploits the properties of reductions in the polyhedral representation. All reduction dependences are basically ignored during scheduling, thereby increasing the freedom of the scheduler. Reduction-Aware Scheduling is the representation of reductions and their realization via privatization in the polyhedral optimization. The scheduler decides when and where to make use of reduction parallelism. However, non-trivial modifications of the polyhedral representation and the current state-of-the-art schedulers are necessary. 5.1 Reduction-Enabled Code Generation The reduction-enabled code generation is a simple, noninvasive approach to exploit reduction parallelism. The only changes needed to enable this technique are in the code generation, thus the polyhedral representation is not modified. So far, dimensions or loops are marked parallel if they do not carry any dependences. With regards to reduction dependences we can relax this condition, hence we can mark non-parallel dimensions or loops as parallel, provided we add privatization code, if they only carry reduction dependences. To implement this technique we add one additional check to the code generation that is executed for each non-parallel loop of the resulting code that we want to parallelize. It uses only non-reduction dependences Dν not D to determine if the loop exclusively carries reduction dependences. If so, the reduction locations corresponding to the broken dependences are privatized and the loop is parallelized. Due to its simplicity, it is easily integrable into existing optimizers while the compile time overhead is reasonably low. However, additional heuristics are needed. First, to decide if reductions should be realized e.g., if privatization of a whole array is worth the gain in parallelism. And second, where the privatization statements should be placed (cf. Section 4.1). Note that usually the code generator has no, and in fact should not have any, knowledge of the optimization goal of the scheduler. 6 Parallel Outer Tile Apart from the need for heuristics, reduction-aware code generation also misses opportunities to realize reductions effectively. This might happen if the scheduler has no reason to perform an enabling transformation or the applied transformation even disabled the reduction. Either way, it is hard to predict the outcome of this approach. 5.2 212 × 212 2.31 0.75 0.32 1.54 214 × 214 3.91 0.72 0.10 1.60 215 × 215 2.19 0.96 0.16 2.21 Table 1: BiCG run-time results. The values are speedups compared to the sequential Polly version, first for the 32core machine, then for the 4-core machine. Reduction-Enabled Scheduling execution environments or parameter values, there is more work needed in order to (1) predict the effects of parallelization and privatization on the actual platform and to (2) express them as affine constraints in the scheduling objective function. In contrast to reduction-aware code generation, which is basically a post-processing step, reduction-enabled scheduling actually influences the scheduling processes by eliminating reduction dependences beforehand. Therefore, the scheduler is (1) unaware of the existence of reductions and their dependences and (2) has more freedom to schedule statements if they contain reduction instances. While this technique allows to exploit reductions more aggressively, there are still disadvantages. First of all, this approach relies on reduction-aware code generation as a back-end, hence it shares the same problems. Second, the scheduler’s unawareness of reduction dependences prevents it from associating costs to reduction realization. Thus, privatization is implicitly assumed to come for free. Consequently, the scheduler does not prefer existing, reduction-independent parallelism over reduction parallelism and therefore may require unnecessary privatization code. For the BiCG example (Figure 2) omitting the reduction dependences might not result in the desired schedule if we assume we are only interested in one level of outermost parallelism4 and furthermore that the statements S and T have been split prior to the scheduling. In this situation we want to interchange the outer two loops for the T statement in order to utilize the inherent parallelism, not the reduction parallelism. However, without the reduction dependences the scheduler will not perform this transformation. In order to decrease the severity of this problem, the reduction dependences can still be used in the proximity constraints of the scheduler [29], thus the scheduler will try to minimize the dependence distance between reduction iterations and implicitly move them to inner dimensions. This solves the problem for all Polybench benchmarks with regards to outermost parallelism, however it might negatively affect vectorization if e.g., the innermost parallel dimension is always vectorized. 5.3 210 × 210 0.19 0.55 0.03 1.10 6. EVALUATION We implemented Reduction-Enabled Scheduling (c.f., Section 5.2) in the polyhedral optimizer Polly and evaluated the effects on compile time and run-time on the Polybench 3.2. We used an Intel(R) core i7-4800MQ quad core machine and the standard input size of the benchmarks. Our approach is capable of identifying and modeling all reductions as described in Section 3: in total 52 arithmetic reductions in 30 benchmarks 5 . As described earlier, our detection virtually splits polyhedral statements to track the effects of the load and store instructions that participate in reduction-like computations. As this increases the complexity of the performed dependence analysis we timed this particular part of the compilation for each of the benchmarks and compared our ?? hybrid dependence analysis to a completely ?? access-wise analysis and the default ?? statement-wise one. We use the term hybrid because reduction accesses are tracked separately while other accesses are accumulated on statement level. As shown in Figure 8 (top) our approach takes up to 5× as long (benchmark lu) than the default implementation but in average only 85% more. Access-wise dependence computation however is up to 10× slower than the default and takes in average twice as long as our hybrid approach. Note that both approaches do not only compute the dependences (partially) on the access level but also the reduction and privatization dependences as explained in Section 3.2. Figure 8 (bottom) shows the speedup of our approach compared to the non-reduction Polly. The additional scheduling freedom causes speedups for the data-mining applications (correlation and covariance) but slowdowns especially for the matrix multiplication kernels (2mm, 3mm and gemm). This is due to the way Polly generates vector code. The deepest dimension of the new schedule that is parallel (or now reduction parallel) will be strip-mined and vectorized. Hence the stride of the contained accesses, crucial to generate efficient vector code, is not considered. However, we do not believe this to be a general shortcoming of our approach as there are existing approaches to tackle the problem of finding a good vector dimension [13] that would benefit from the additional scheduling freedom as well as the knowledge of reduction dependences. Reduction-Aware Scheduling Reduction-enabled scheduling results in generally good schedules for our benchmark set, however resource constraints as well as environment effects, both crucial to the overall performance, are not represented in the typical objective function used by polyhedral optimizers. In essence we believe, the scheduler should be aware of reductions and the cost of their privatization, in terms of memory overhead as well as aggregation costs. This is especially true if the scheduler is used to decide which dimensions should be executed in parallel or if there are tight memory bounds (e.g., on mobile devices). In Section 6.1 we show that the execution environment as well as the values of runtime parameters are crucial factors in the actual performance of parallelized code, even more when reductions are involved. While a reduction-aware scheduler could propose different parallelization schemes for different 6.1 BiCG Case Study Polybench is a collection of inherent parallel programs, there is only one—the BiCG kernel— that depends on re5 This assumes the benchmarks are compiled with -ffastmath, otherwise reductions over floating point computations are not detected. 4 A reasonable assumption for desktop computers or moderate servers with a low number of parallel compute resources. 7 duction parallelism. To study the effects of parallelization combined with privatization of multidimensional reductions in the BiCG kernel we compared two parallel versions to the non-parallel code Polly would generate without reduction support. The first version “Outer ” has a parallel outermost loop and therefore needs to privatize the whole array s. The second version “Tile” parallelizes the second outermost loop. Due to tiling, only “tile size” (here 32) locations of the q array need to be privatized. Table 1 shows the speedup compared to the sequential version for both a quad core machine and a 8 × 4-core server. As the input grows larger the threading overhead as well as the interchip communication on the server will cause the speedup of Tile to stagnate, however on a one chip architecture this version generally performs best. Outer on the other hand will perform well on the server but not on the 4-core machine. We therefore believe the environment is a key factor in the performance of reduction-aware parallelization and a reduction-aware scheduler is needed to decide under which run-time conditions privatization becomes beneficial. 7. dimensions. This is similar to the nested Recur operator introduced by Redon and Feautrier [22, 24]. Hence, reductions are not only restricted to a single loop dimension, as in other approaches [11, 6, 25], but can also be multidimensional as shown in Figure 2. 7.2 RELATED WORK Reduction aware loop parallelization has been a long lasting research topic. Different approaches to detect reduction, to model them and finally to optimize them have been proposed. As our work has some intersection with all three parts we will discuss them in separation. 7.1 Modeling Modeling reductions was commonly done implicitly, e.g., by ignoring the reduction dependences during a post parallelization step [11, 17, 22, 18, 21, 30, 28]. This is comparable to the reduction-enabled code generation described in Section 5.1. However, we believe the full potential of reductions can only be exposed when the effects are properly modeled on the dependence level. The first to do so, namely to introduce reduction dependences, where Pugh and Wonnacot [20]. Similar to most other approaches [22, 23, 27, 24, 7, 25, 32], the detection and modeling of the reduction was performed only on Clike statements and utilizing a precise but costly access-wise dependence analysis (see the upper part of Figure 8). In their work they utilize both memory and value-based dependence information to identify statements with an iteration space that can be executed in parallel, possibly after transformations like array expansion. They start with the memory-based dependences and compute the value-based dependences as well as the transitive self-dependence relation for a statement in case the statement might not be inherently sequential. Stock et al.[26] describe how reduction properties can be exploited in the polyhedral model, however neither do they describe the detection nor how omitting reduction dependences may affect other statements. In the works of Redon and Feautrier [23] as well as the extension to that by Gupta et al. [9] the reduction modeling is performed on SAREs on which array expansion [4] and renaming was applied, thus all dependences caused by memory reuse were eliminated. In this setting the possible interference between reduction computation and other statements is simplified but it might not be practical for general purpose compilers due to memory constraints. As an extension to these scheduling approaches on SAREs we introduced privatization dependences. They model the dependences between a reduction and the surrounding statements without the need for any special preprocessing of the input. However, we still allow polyhedral optimizations that will not only affect the reduction statement but all statements in a SCoP . Detection Reduction detection started with pattern based approaches on source statements [11, 17, 22, 18, 21, 24] and evolved to more elaborate techniques that use symbolic evaluation [6], a data dependency graph [27] or even a program dependency graph [17] to find candidates for reduction computations. For functional programs Xu et al. [30] use a type system to deduce parallel loops including pattern based reductions. Their typing rules are similar to our detection function (Figure 4) we use to identify reduction-like computations. Sato and Iwasaki [25] describe a pragmatic system to detect and parallelize reduction and scan operations based on the ideas introduced by Matsuzaki et al. [15]: the representation of (part of) the loop as a matrix multiplication with a state vector. They can handle mutually recursive scan and reduction operations as well as maximum computations implemented with conditionals, but they are restricted to innermost loops and scalar accumulation variables. As an extension Zou and Rajopadhye [32] combined the work with the polyhedral model and the recurrence detection approach of Redon and Feautrier [22, 24]. This combination overcomes many limitations, e.g., multidimensional reductions (and scans) over arrays are handled. However, the applicability is still restricted to scans and reductions representable in State Vector Update Form [12]. In our setting we identify actual reductions utilizing the already present dependence analysis, an approach very similar to the what Suganuma et al. [27] proposed to do. However, we only perform the expensive, access-wise dependence analysis for reduction candidates, and not for all accesses in the SCoP . Nevertheless, both detections do not need the reductions to be isolated in a separate loop as assumed by Fisher and Ghuloum [6] or Pottenger and Eigenmann [18]. Furthermore, we allow the induced reduction dependences to be of any form and carried by any subset of outer loop 7.3 Optimization Optimization in the context of reductions is twofold. There is the parallelization of the reduction as it is given in the input and the transformation as well as possible parallelization of the input with awareness of the reduction properties. The first idea is very similar to the reduction-enabled code generation as described in Section 5.1. In different variations, innermost loops [25], loops containing only a reduction [6, 18] or recursive functions computing a reduction [30] were parallelized or replaced by a call to a possibly parallel reduction implementation [28]. The major drawback of such optimizations is that reductions have to be computed either in isolation or with the statements that are part of the source loop that is parallelized. Thus, the reduction statement instances are never reordered or interleaved with 8 other statement instances, even if it would be beneficial. In order to allow powerful transformations in the context of reductions, their effect, hence the reduction dependences, as well as their possible interactions with all other statement instances must be known. The first polyhedral scheduling approach by Redon and Feautrier [23] that optimally6 schedules reduction together with other statements assumed reductions to be computable in one time step. With such atomic reduction computations there are no reduction statement instances that could be reordered or interleaved with other statement instances. Gupta et al. [9] extended that work and lifted the restriction on an atomic reduction computation. As they schedule the instances of the reduction computation together with the instances of all other statements their work can be seen as a reduction-enabled scheduler that optimally minimizes the latency of the input. To speed up parallel execution of reductions the runtime overhead needs to be minimized. Pottenger [18] proposed to privatize the reduction locations instead of locking them for each access and Suganuma et al. [27] described how multiple reductions on the same memory location can be coalesced. If dynamic reduction detection [21] was performed, different privatization schemes to minimize the memory and runtime overhead were proposed by Yu et al. [31]. While the latter is out of scope for a static polyhedral optimizer, the former might be worth investigating once our approach is extended to multiple reductions on the same location. In contrast to polyhedral optimization or parallelization, Gautam and Rajopadhye [7] exploited reduction properties in the polyhedral model to decrease the complexity of a computation in the spirit of dynamic programming. Their work on reusing shared intermediate results of reduction computations is completely orthogonal to ours. While Array Expansion, as introduced by Feautrier [4], is not a reduction optimization, it is still similar to the privatization step of any reduction handling approach. However, the number of privatization copies the approach introduces, the accumulation of these private copies as well as the kind of dependences that are removed differ. While privatization only introduces a new location for each processor or vector lane, general array expansion introduces a new location for each instance of the statement. In terms of dependences, array expansion aims to remove false output and anti dependences that are introduced by the reuse of memory while reduction handling approaches break output and flow dependences that are caused by a reduction computation. Because of the flow dependences—the actual reuse of formerly computed values—the reduction handling approaches also need to implement a more elaborate accumulation scheme that combines all private copies again. Instead we want to allow any transformation possible to our scheduler with only one restriction: the integrity of the reduction computation needs to stay intact. In other words, no access to the reduction location is scheduled between the first and last instance of the reduction statement. This allows our scheduler not only to optimize the reduction statement in isolation, but also to consider other statements at the same time without the need for any preprocessing to get a SARE-like input. To this end we presented a powerful reduction detection based on computation properties and the polyhedral dependence analysis. Our design leverages the power of polyhedral loop transformations and exposes various optimization possibilities including parallelism in the presence of reduction dependences. We showed how to model and leverage associativity and commutativity to relax the causality constraints and proposed three approaches to make polyhedral loop optimization reduction-aware. We believe our framework is the first step to handle various well-known idioms, e.g., privatization or recurrences, not yet exploited in most practical polyhedral optimizers. Furthermore, we showed that problems and opportunities arising from reduction parallelism (see Section 6.1) have to be incorporated into the scheduling process, thus the scheduling in the polyhedral model needs to be done in a more realistic way. The overhead of privatization and the actual gain of parallelism are severely influenced by the execution environment (e.g., available resources, number of processors and cores, cache hierarchy), however these hardware specific parameters are often not considered in a realistic way during the scheduling process. Extensions to this work include a working reduction-aware scheduler and the modeling of multiple reduction-like computations as well as other parallelization preventing idioms. In addition we believe that a survey about the applicability of different reduction detection schemes as well as optimization approaches in a realistic environment is needed. In any case this would help us to understand reductions not only from the theoretical point of view but also from a practical one. 8. 10. 9. CONCLUSIONS AND FUTURE WORK REFERENCES [1] M.-W. Benabderrahmane, L.-N. Pouchet, A. Cohen, and C. Bastoul. The polyhedral model is more widely applicable than you think. In Proceedings of the 19th Joint European Conference on Theory and Practice of Software, International Conference on Compiler Construction, CC’10/ETAPS’10, pages 283–303, Berlin, Heidelberg, 2010. Springer-Verlag. [2] G. E. Blelloch. Scans as primitive parallel operations. IEEE Trans. Comput., 38(11):1526–1538, Nov. 1989. [3] U. Bondhugula, M. M. Baskaran, S. Krishnamoorthy, J. Ramanujam, A. Rountev, and P. Sadayappan. Earlier work already utilized reduction dependences in different varieties, depending on how powerful the detection was. Whenever reductions have been parallelized the reduction dependences have been implicitly ignored, in at least two cases they have even been made explicit [20, 26]. However, to our knowledge, we are the first to add the concept of privatization dependences in this context. The reason is simple: we believe the parallel execution of a loop containing a reduction is not always the best possible optimization. 6 ACKNOWLEDGMENTS We would like to thank Tobias Grosser, Sebastian Pop and Sven Verdoolaege for the helpful discussions during the development and implementation of this approach. Furthermore, we want to thank the reviewers who not only provided extensive comments on how to further improve this work but also pointed us to related work that was previously unknown to us. Lastly, we would like to thank Tomofumi Yuki for giving us many helpful tips. e.g., according to the latency 9 Figure 8: Evaluation results for Polybench 3.2. In the upper part the compile time for different grained dependence analyses is shown, in the lower part the speedup of Polly with reduction support compared to Polly without reduction support. [4] [5] [6] [7] [8] [9] Automatic transformations for communication-minimized parallelization and locality optimization in the polyhedral model. ETAPS ’08. P. Feautrier. Array expansion. In Proceedings of the 2Nd International Conference on Supercomputing, ICS ’88, pages 429–441, New York, NY, USA, 1988. ACM. P. Feautrier. Dataflow analysis of array and scalar references. International Journal of Parallel Programming, 20(1):23–53, 1991. A. L. Fisher and A. M. Ghuloum. Parallelizing complex scans and reductions. In Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation, PLDI ’94, pages 135–146, New York, NY, USA, 1994. ACM. Gautam and S. Rajopadhye. Simplifying reductions. In Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’06, pages 30–41, New York, NY, USA, 2006. ACM. T. Grosser, A. Größlinger, and C. Lengauer. Polly performing polyhedral optimizations on a low-level intermediate representation. Parallel Processing Letters, 22(4), 2012. G. Gupta, S. Rajopadhye, and P. Quinton. Scheduling reductions on realistic machines. In Proceedings of the Fourteenth Annual ACM Symposium on Parallel Algorithms and Architectures, SPAA ’02, pages 117–126, New York, NY, USA, 2002. ACM. [10] P. Jouvelot. Parallelization by semantic detection of reductions. In Proc. Of the European Symposium on Programming on ESOP 86, pages 223–236, New York, NY, USA, 1986. Springer-Verlag New York, Inc. [11] P. Jouvelot and B. Dehbonei. A unified semantic approach for the vectorization and parallelization of generalized reductions. In Proceedings of the 3rd International Conference on Supercomputing, ICS ’89, pages 186–194, New York, NY, USA, 1989. ACM. [12] P. M. Kogge and H. S. Stone. A parallel algorithm for the efficient solution of a general class of recurrence equations. IEEE Trans. Comput., 22(8):786–793, Aug. 1973. [13] M. Kong, R. Veras, K. Stock, F. Franchetti, L.-N. Pouchet, and P. Sadayappan. When polyhedral transformations meet simd code generation. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’13, pages 127–138, New York, NY, USA, 2013. ACM. [14] C. Lattner and V. Adve. Llvm: A compilation framework for lifelong program analysis & transformation. In Proceedings of the International Symposium on Code Generation and Optimization: Feedback-directed and Runtime Optimization, CGO ’04, pages 75–, Washington, DC, USA, 2004. IEEE Computer Society. [15] K. Matsuzaki, Z. Hu, and M. Takeichi. Towards automatic parallelization of tree reductions in 10 [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] dynamic programming. In Proceedings of the Eighteenth Annual ACM Symposium on Parallelism in Algorithms and Architectures, SPAA ’06, pages 39–48, New York, NY, USA, 2006. ACM. S. P. Midkiff. Automatic Parallelization: An Overview of Fundamental Compiler Techniques. Synthesis Lectures on Computer Architecture. 2012. S. S. Pinter and R. Y. Pinter. Program optimization and parallelization using idioms. In Proceedings of the 18th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’91, pages 79–92, New York, NY, USA, 1991. ACM. B. Pottenger and R. Eigenmann. Idiom recognition in the polaris parallelizing compiler. In Proceedings of the 9th International Conference on Supercomputing, ICS ’95, pages 444–448, New York, NY, USA, 1995. ACM. W. Pugh. Uniform techniques for loop optimization. In Proceedings of the 5th International Conference on Supercomputing, ICS ’91, pages 341–352, New York, NY, USA, 1991. ACM. W. Pugh and D. Wonnacott. Static analysis of upper and lower bounds on dependences and parallelism. ACM Trans. Program. Lang. Syst., 16(4):1248–1278, July 1994. L. Rauchwerger and D. Padua. The lrpd test: Speculative run-time parallelization of loops with privatization and reduction parallelization. In Proceedings of the ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation, PLDI ’95, pages 218–232, New York, NY, USA, 1995. ACM. X. Redon and P. Feautrier. Detection of recurrences in sequential programs with loops. In Proceedings of the 5th International PARLE Conference on Parallel Architectures and Languages Europe, PARLE ’93, pages 132–145, London, UK, UK, 1993. Springer-Verlag. X. Redon and P. Feautrier. Scheduling reductions. In Proceedings of the 8th International Conference on Supercomputing, ICS ’94, pages 117–125, New York, NY, USA, 1994. ACM. X. Redon and P. Feautrier. Detection of scans in the polytope model. Parallel Algorithms Appl., 15(3-4):229–263, 2000. S. Sato and H. Iwasaki. Automatic parallelization via matrix multiplication. In Proceedings of the 32Nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’11, pages 470–479, New York, NY, USA, 2011. ACM. K. Stock, M. Kong, T. Grosser, L.-N. Pouchet, F. Rastello, J. Ramanujam, and P. Sadayappan. A framework for enhancing data reuse via associative reordering. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’14, pages 65–76, New York, NY, USA, 2014. ACM. T. Suganuma, H. Komatsu, and T. Nakatani. Detection and global optimization of reduction operations for distributed parallel machines. In Proceedings of the 10th International Conference on Supercomputing, ICS ’96, pages 18–25, New York, NY, USA, 1996. ACM. [28] A. Venkat, M. Shantharam, M. Hall, and M. M. Strout. Non-affine extensions to polyhedral code generation. In Proceedings of Annual IEEE/ACM International Symposium on Code Generation and Optimization, CGO ’14, pages 185:185–185:194, New York, NY, USA, 2014. ACM. [29] S. Verdoolaege. Isl: An integer set library for the polyhedral model. In Proceedings of the Third International Congress Conference on Mathematical Software, ICMS’10, pages 299–302, Berlin, Heidelberg, 2010. Springer-Verlag. [30] D. N. Xu, S.-C. Khoo, and Z. Hu. Ptype system: A featherweight parallelizability detector. In In Proceedgins of 2nd Asian Symposium on Programming Languages and Systems (APLAS 2004), LNCS 3302, pages 197–212. Springer, LNCS, 2004. [31] H. Yu, D. Zhang, and L. Rauchwerger. An adaptive algorithm selection framework. In Proceedings of the 13th International Conference on Parallel Architectures and Compilation Techniques, PACT ’04, pages 278–289, Washington, DC, USA, 2004. IEEE Computer Society. [32] Y. Zou and S. Rajopadhye. Scan detection and parallelization in ”inherently sequential” nested loop programs. In Proceedings of the Tenth International Symposium on Code Generation and Optimization, CGO ’12, pages 74–83, New York, NY, USA, 2012. ACM. 11
6cs.PL
arXiv:1208.3773v1 [cs.DC] 18 Aug 2012 Haskell#: Coordinating Functional Processes Francisco Heron de Carvalho-Junior Departamento de Computação Universidade Federal do Ceará (UFC) Fortaleza, Brazil Rafael Dueire Lins Centro de Informática Universidade Federal de Pernambuco Recife, Brazil June 2004 Abstract This paper presents Haskell# , a coordination language targeted at the efficient implementation of parallel scientific applications on loosely coupled parallel architectures, using the functional language Haskell. Its programming environment encompasses an editor, a compiler into Petri nets, a Petri net animator and proof tool, and a skeleton library. Examples of applications, their implementation details and performance figures are presented. 1 Introduction The peak performance of parallel architectures is growing at a faster pace than predicted by Moore’s law, that states that at each 18 months computer hardware becomes twice as fast and halves its sale price. However, parallel programming tools have not being able to reconcile portability, scalability and a higher level of abstraction without imposing severe performance penalties to applications [28]. 1 The emerging technologies in the 1990s gave birth to new challenges in high-performance computing. The advent of clusters [8], low cost supercomputers built on top of networks of workstations and personal computers, disseminated supercomputing among academic institutions, industries and companies [11, 4, 19, 20]. More recently, advances in wide area network interconnection technologies have made possible to use their infra-structure to build distributed supercomputers of virtually infinite scale, the grids, which are particularly suitable for addressing very coarse grained scientific computing applications. Great efforts to make these technologies viable are been promoted, with promising results [34]. Clusters and grids sparkled a myriad of new applications in supercomputing for scientific computation. Most of them are not addressed adequately by contemporary tools, yielding inefficient distribution of parallel programs [83]. In [10], some parallel programming approaches used in scientific computing are compared in relation to scalability (efficiency), generality and abstraction dimensions. MPI (Message Passing Interface) [63], the most widespread message passing library, provides scalability, generality, but is less abstract than TCE (Tensor Contraction Engine) [7], PETSc [5], GA (Global Array) [66], openMP [67], auto-parallelized C/Fortran90 and HPF (High Performance Fortran) [32]. PETSc and TCE are specific purpose libraries for scientific computing, providing a high level of abstraction and scalability. Implicit approaches, such as C/Fortran90, present low scalability, high level of abstraction and high generality. These observations illustrate that, despite the efforts conducted on the last decade, the need for new parallel programming environments that reconcile a high-level of abstraction, modularity, and generality with scalability and peak performance is still a challenge [28, 77, 82]. This paper presents Haskell# , a process-oriented coordination language [35] where Haskell [75], a language considered de facto a standard in lazy functional programming, is used for programming at computation level. Haskell# aims to provide high-level programming mechanisms without sacrificing performance significantly, by minimizing the overheads of the management of parallelism. One of the most important concerns in Haskell# is to make easier to prove correctness of programs. For that, a divide-and-conquer approach was adopted to increase the chances of formally analyzing programs: the process network is completely orthogonal to the sequential blocks of code (process functionality). Haskell allows sequential programs to be proved correct in a simpler fashion than their equivalent written in languages which belong to other programming paradigms. The communication primitives 2 were designed in such a way as to allow their translation into Petri nets [72], a well reputed formalism for the specification of concurrent systems, with several analysis and verification tools [80, 12] available. Haskell# emphasizes compositional programming and provides support for skeletons [25]. Skeletons are used to expose topological information that can guide the Haskell# compiler in the generation of more efficient code. MPI (Message Passing Interface) [29] is used to manage parallelism without claiming for any run-time support. Due to the recent development of interoperable [84] and grid enabled [49] versions of MPI Haskell# programs may be executable on grids without any extra burden. Examples of benchmark programs and their performance figures are provided, elucidating the most important aspects of programming in Haskell# . This paper comprises five other sections. Section 2 gives background for programming in Haskell# , focusing on programming abstractions. Section 3 presents motivating application examples of Haskell# programming. Section 4 presents details about current implementation of Haskell# for clusters. Section 5 presents performance figures about applications presented in Section 3 running on implementation described in Section 4. Section 6 concludes this paper outlining the work in progress with Haskell# . 2 Programming in Haskell# Haskell# programs are composed from a set of components, each one describing an application concern. Concerns may be functional or non-functional. Examples of functional concerns are the calculation of an exact solution for a system of linear equations and the calculation of a finite-difference approximation for a system of partial differential equations. An example of nonfunctional concern is the allocation of processes to processors. Components may be reused among Haskell# programs. In Haskell# programming, the process of composing components is inductive. Simple components, functional modules implemented in Haskell, are basic building blocks. Given a collection of components, simple or composed ones, it is possible to define a new composed component by specifying their composition through Haskell# Configuration Language (HCL). The result of this process is a hierarchy of components, where the main component, describing the application functionality, is at the root. Components at the leaves are simple components (always addressing functional concerns) and 3 intermediate nodes are composed components. Under perspective of process-oriented coordination models [35], the collection of functional modules of a Haskell# program forms a computation medium, while the collection of composed components forms a coordination medium. The concerns on the parallel composition of Haskell functional computations are sufficiently and necessarily resolved at the coordination level. The use of Haskell for programming the computation medium allows that coordination and computation languages be really orthogonal. Lazy lists allow the overlapping of communication and computation in process execution, without to need to embed coordination extensions in the code of the functional modules. The idea of hierarchical compositional languages implemented using configuration languages is not a recent idea [13, 1]. Haskell# difference from its predecessor languages resides in its support for skeletons, by allowing to partially parameterize the concern addressed by components, and its ability for overlapping them, making possible to encapsulate cross-cutting concerns [21]. The use of skeletons has gained attention of parallel programming community since last decade [25] and now it is supported by many languages and paradigms [79]. The problem of modularizing cross-cutting concerns have gained attention in software engineering research community, particularly for programming large scale object-oriented systems. An example of cross-cutting concern is validation procedures executed by processes for accessing computational resources in a grid environment. With respect to this feature, Haskell# may implement the notions of AOP (Aspect Oriented Programming) [52] and Hyperspaces [68] using an unified set of language constructors. Skeletons may be overlapped, forming more complex ones. Haskell# programs may be translated into Petri nets. This allows to prove formal properties and to evaluate the performance of parallel programs using automatic tools. Some previous work have addressed the problem of translating Haskell# programs into Petri nets [56, 23]. The expressive power of HCL for describing patterns of interaction among processes is equivalent to descriptive power of labelled Petri nets [71]. Now, relevant details about how Haskell# programs are implemented are presented. HCL abstractions for programming at coordination medium are informally introduced and it is shown how simple components are programmed in Haskell. Motivating examples of Haskell# are presented in Section 3, illustrating the use of Haskell# programming abstractions. Appendix B formalizes an algebra for describing semantics of Haskell# programming 4 tallies tallying[1] events tracking[1] tallies tallying[2] events tracking[2] tallies tallying[3] events tracking[3] events tallies tallying[4] particles user information prob_def tally entries tally entries tally entries tally entries tracking[4] statistics[1] statistics[2] recip average energy tally entries Figure 1: Process Network of MCP-Haskell# abstractions. The informal description points at the corresponding Haskell# algebraic constructions. 2.1 Programming Composed Components Composed components, which form coordination medium of Haskell# programs, are programmed in HCL configurations. HCL programming corresponds to the inductive step in Haskell# programming task described in last section. In what follows, the constructors used at coordination level for programming Haskell# applications are informally introduced. Their for5 01. 02. 03. 04. 05. 06. 07. 08. 09. 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. component MCP<n,m> with iterator i range [1,n] use Skeletons.{PipeLine, Workpool} interface IProbDef () → (user info, particles, tally entries, recip, avg e, all tallies) where: IDispatcher () → particles behavior: seq { recip!; avg e!; all tallies!; tally entries!; user info!; repeat particles! until particles } interface ITracking (user info,particles*) → (events*, totals) where: IPipeStage particles → events behavior: seq { user info?; do process particles; totals! } interface ITallying (tally entries, events*) → tallies* where: IPipeStage events → tallies behavior: seq { tally entries?; do process events } interface IStatistics (avg e, recip, totals, tallies*) → () where: ICollector tallies → () behavior: seq { avg e?; recip?; all tallies?; repeat tallies? until tallies; totals? } unit pp; assign PipeLine<2> to pp unit wp; assign WorkPool<n> to wp unit unit unit unit prob def track tally statistics # # # # IProbDef wire tally entries all*2: distribute; assign ProbDef ITacking ; assign Tracking ITallying ; assign Tallying IStatistics ; assign Statistics to to to to prob def track tally statistics factorize wp.manager in → out to dispatcher # () → out, collector # in → () replace replace replace replace dispatcher pp.stage[1] pp.state[2] collector # # # # tallies → particle→ events → tallies → particles events tallies, (), by by by by prob def track tally statistics # # # # ( ( ( ( ,particles, , , , ) , particles) → (events, ) ,events) → tallies , , ,tallies) → () to manager replicate pp into n; [/ replace wp.worker[i] by pp[i] /] connect connect connect connect connect connect prob def→user info to prob def→tally entries[0] to prob def→tally entries[1] to to prob def→recip prob def→avg e to tracking→totals to tracking←user info, tallies←tally entries, statistics←tally entries, statistics←recip, statistics←avg e, statistics←totals, synchronous synchronous synchronous buffered buffered buffered replicate m statistics # (avg e, recip, totals, tallies,tally entries) → () adjust wire avg e: broadcast, recip: broadcast, totals: {# (map.sum.transpose) #} tally entries<>: distribute, tallies<>: broadcast Figure 2: HCL Code for MCP-Haskell# mal syntax is presented in Appendix A. Appendix B brings their algebraic semantics. MCP-Haskell# A parallel version of MCP-Haskell [22] is used for exemplifying the syntax of HCL. MCP-Haskell [39] is a simplified sequential version of MCNP, a code developed at Los Alamos during many years for simulating the statistical behaviour of particles (photons, neutrons, electrons, etc.) while they travel through objects of specified shapes and materials [15]. HCL code of MCP-Haskell# is shown in Figure 2. The corresponding network topology is presented in Figure 1. The parallelism is obtained from three sources. Firstly, tracking and tallying procedures must be executed concurrently using 6 Unit cluster Composed Component Simple Component Group of Input Ports process Individual Input Port Channel ... ... λ ... Individual Output port Group of Output Ports Associating an argument with an input port Associating a return point with an output port Binding a port to an argument/return point Figure 3: Diagrammatic Notation for Haskell# Abstractions a pipe-line. The main source of parallelism is the second. It comes from the fact that particles may be tracked and tallied independently. To take advantage of this problem feature, a work pool pattern of interaction is employed, where a manager process distributes jobs (particles) to worker processes, on demand controlled by their availability, and collects the results from each job. A third source of parallelism comes from the fact that the statistics of different tallies may be computed in parallel. Thus, each statistical process in the network is responsible for computing a specified set of tallies. In the following sections, it is explained how a HCL configuration may implement this network topology. A HCL configuration starts with a header, declaring the name of the composed component, its static formal parameters and its arguments and return points. MCP-Haskell# has two static parameters, m and n, which controls the number of parallel tasks, but no argument or return point is defined. In general, arguments and return points are not defined for the main component of an application. They are normally used in the configuration of the encapsulated functional concerns. 7 2.1.1 The Basic Abstractions: Units and Channels A Haskell# configuration is specified by a collection of units, which are abstractions for agents that execute a particular task. Units synchronize using communication channels. The task performed by a unit is defined statically, by assigning a component for it. Units may be viewed as a “glue” for composing components. Units have interfaces, comprising collections of input and output ports. Interfaces are necessary for allowing units to be connected through communication channels. An interface also describes a partial order for the activation of ports during execution, characterizing the behavior of a unit. A communication channel is defined by linking two ports from opposite directions through a communication mode: synchronous, buffered and ready. Communication modes of Haskell# channels have direct correspondence to MPI primitives, ensuring their efficient implementation, and have semantic equivalence with OCCAM [46] and CSP [43]. Ports linked through a communication channel are said to be communication pairs. In Figure 2, lines 20 to 26 have declarations of units, whose identifiers are placed after the keyword unit. The assign declarations bind components to units. The interface of a unit is declared after the clause “#”. In the example, an interface class identifier is employed but it is possible to declare an interface directly. This topic is discussed further in the next section. The low level of abstraction provided by units, ports and channels is not appropriate for programming large-scale and complex distributed parallel programs. Next sections introduce additional abstractions intended to raise the level of abstraction in HCL programming, simplifying the specification of large-scale and complex process topologies. Essentially, they provide support for partial topological skeletons. 2.1.2 Interface Classes Haskell# incorporates the notion of interface class for representing interfaces of units that present equivalent behavior. Examples of interface class declarations are shown in lines 07 to 18 of Figure 2. The identifier of an interface class is configured after the interface keyword. The notation (i1 , i2 , . . . , in ) → (o1 , o2 , . . . , om ) sets up n input ports and m output ports, with the respective identifiers. In a where clause, an interface composition operator (#) allows defining how an interface is obtained from the composition of existing ones. The semantics of the # operator is formalized in 8 Appendix B. Units that declare the same interface name after “#” clause in unit declarations inherit the same behavior, specified in the corresponding interface declaration. A small language is embedded in behavior clause of interface declarations, intended to describe partial orders in the activation of ports. Its combinators have semantic equivalence to operators of regular expressions controlled by semaphores [47], which are regular expressions enriched with an interleaving operator, represented in HCL by the combinator par, and counter semaphores primitives, represented by the primitives wait and signal. This feature ensures that the HCL descriptive power is equivalent to the power of terminal labelled Petri nets in describing the interaction patterns between processes. 2.1.3 Wire Functions In an assignment declaration, it is necessary to map input and output ports of the unit to arguments and return points of the assigned component, respectively. The notation (i1 , i2 , . . . , in ) → (o1 , o2 , . . . , om ) may be used whenever the order of ports does not match the order of corresponding arguments/return points. In fact, the association between the input and output ports and the arguments and return points of components in assign declarations defines how Haskell# glues coordination and computation media. Whenever an argument is not bound to an input port, an explicit value must be provided to it. Also, whenever a return point is not associated with an output port, it is not evaluated. In wire clauses of unit declarations, HCL allows to define a wire function that maps a value received through an input port onto a value that is passed to an argument. Analogously, it is possible to define a wire function that receives a value produced at a return point yielding another value that is sent through the associated output port. This increases the chances that a component be reused without changing its internal implementation, in such cases where there is some type incompatibility between the type or meaning of arguments and the return points and the expected input and output ports types and meaning at coordination level. 9 individual ports wire function ? wire function ! All group of ports ? ? wire function ? ! ! ... ... wire function ! Any group of ports wire function wire function ! ... ... ? ... ... choosen port choosen port Figure 4: Wire Functions and Groups of Ports 2.1.4 Groups of Ports Another useful feature of HCL is the replication of interface ports of a unit, forming groups of ports where individual members are referenced using enumeration indexes. A group of ports is treated as an individual entity from the local perspective of the unit. Thus, they are bound to a unique argument/return point and must be activated atomically. However, from a global view, individual ports of the group are treated in separate, being possible to connect them through different channels. Groups of ports may be of two kinds: any or all. When a group of input ports of kind all is activated, each port member must receive a value. The array of values received is mapped to a unique value by using a wire function. Then, the value is passed to the argument mapped onto the group of ports. When an output group of ports is activated, the value yielded at the return point mapped to it is transformed, using an wire function, into an array of values that are sent through port members of the group. In activation of groups of ports of kind any, one port belonging to the group is chosen among ports whose communication pair is activated. Once the port is chosen, communication occur like in individual ports. Notice that wire functions are necessary for configuring groups of ports of kind all. Because of that, groups of ports are configured in clause wire of unit declarations, like exemplified in Figure 2 with tally entries group of ports. For configuring a group of ports of kind any, use any keyword instead of all keyword, as illustrated in the example. Figure 4 illustrate semantics of wire functions 10 and groups of ports. 2.1.5 Stream Ports Stream ports allows to transmit sequences of values (streams) terminated by an end marker. Haskell# streams may be nested (streams of streams) at arbitrary nesting levels, which must be statically configured. Stream ports of units for which it is assigned a simple component must be mapped to argument and return points of lazy lists types in the functional module. Nested streams are associated to nested lazy lists of at least the same nesting level. In interface declarations in lines 11 and 14, stream ports may be identified by the occurrence of sequences of symbols “*” after the identifier of the port. The number of *’s indicates its nesting level. For instance, stream ports particles and events of interface ITracking have nesting level equal to one. In Figure 9, where Haskell code of the functional module Tracking is presented, arguments and return points associated to particles and events ports of track unit are lazy lists of nesting level greater than or equal to one. Stream ports are essential for Haskell# expressiveness, once it allows overlapping communication operations and computations during the execution of processes. The same approach is used by other parallel functional languages, such as Eden [14]. 2.1.6 Configuring Arguments and Return Points of Composed Components Arguments and return points of composed components are, respectively, input and output ports of units that are not connected through any communication channel. For speciying ports that must be connected to arguments and return points, HCL supports bind declarations. 2.1.7 The Distinction Between Processes and Clusters It is convenient to distinguish between units associated to simple and composed components. The former are called processes, while the latter are called clusters. Processes are concrete entities and may be viewed as agents that perform sequential computations programmed in Haskell. Clusters are abstract entities and must be viewed as a parallel composition of processes. The abstraction of clusters is essential for expressing hierarchical parallelism. 11 For example, in a constellation architecture 1 , a cluster must be associated with a multiprocessing node, in such a way that its comprising processes are allocated to processors for shared memory parallel execution. Instead of generating MPI code, the Haskell# compiler could generate openMP [67] code for implementing communications among processes inside the cluster, more appropriate for multiprocessors. The support for multiple hierarchies of parallelism is essential for grid computing architectures [48] and is recognized as an important challenge for parallel programming languages designers [9]. In MCP-Haskell# specification, pp and wp are clusters, units respectively associated to composed components PipeLine and Workpool, which represent skeletons. Units prob def, tally, track and statistics are declared as processes. The components assigned to these units are functional modules, written in Haskell. 2.1.8 Termination of Haskell# Programs Units may be declared as repetitive or non-repetitive. Non-repetitive units perform a task and go to their final state, while repetitive ones always go back to their initial state, for executing its task once more. In HCL, a unit is declared repetitive by placing a symbol “*” after the keyword unit in its declaration. For declaring a cluster as repetitive, all units belonging to the composed component assigned to it must be repetitive. Otherwise, an error is detected and informed by HCL compiler. A Haskell# program terminates whenever all non-repetitive units belonging to its main component terminates. If it has only repetitive units, it does not terminate. Repetitive units may be used to model reactive applications. A non-stream port of a repetitive unit may be connected to a stream port of a non-repetitive unit. Each value produced in the stream is consumed in an execution of the repetitive process. 2.1.9 Virtual Units and The Support for Skeletons A skeletons was defined above as a composed component where its addressed concern is partially defined or totally undefined. Now that the structure of composed components was scrutinized, it is possible to define Haskell# skeletons in more precise terms. In fact, the concern addressed by a composed 1 Constellations have been defined as clusters of multiprocessor nodes with at least sixteen processors per node [9, 28]. 12 Interface or Interface Class Assignmennt Instantiation interface declaration Unit (non−virtual) Virtual Unit unit declaration assign declaration Figure 5: Configuration of Units component is defined by the composition of concerns addressed by components assigned to its comprising units. If some unit of a component does not have a component assigned to it, it is said that the component is partially parameterized by its addressed concern. This kind of component is called a partial topological skeleton. Units not assigned to a component are called virtual units. In other skeleton-based languages, skeletons are usually total, in the sense that all units are virtual. After instantiating a partial topological skeleton, or simply a skeleton, by assigning it to a unit comprising a configuration of a component, it is possible to assign components to the virtual units of the skeleton, configuring its addressed concern. The components Farm and Workpool are examples of total skeletons. They are used for structuring the topology of the MCP-Haskell# program. They are instantiated by assigning them to units pp and wp, respectively. The replaces declaration, exemplified in lines 30 to 33 of Figure 2, takes a virtual unit from a skeleton and replaces it by another unit, such that there is an homomorphism relation from interface of the original unit to the interface of the new unit. This is formalized in Appendix B by the pair of relations ⊑ and ⊒ between interfaces. Indeed, replacing declarations are syntactic sugaring of HCL. The same effect could be obtained by creating a new unit, unifying it with the skeleton unit and assigning the appropriate component to the resulting unit. For that reason, replacing declarations are not formalized in Appendix B. This topic is revisited in the next section, where unification is introduced. 2.1.10 Operations over Virtual Units and Overlapping of Skeletons Two operations are useful for the specification of complex topologies through the composition of skeletons: unification and factorization. Unification sub- 13 A C e b F d F unification A CDE B D e a a e b G B d b G c factorization E c Figure 6: An Illustrative Example of Unification/Factorization stitutes a collection of virtual units by a new virtual unit, obeying the network connectivity and behavioral preserving restrictions formalized in the Appendix B. In this process, ports, individual or groups, may be grouped. To group groups of ports involves to merge their sets of ports. Factorization performs inverse operation of unification. It takes a unit and splits it in a collection of units, also respecting behavioral and networking connectivity preserving restrictions. It may be needed to replicate communication pairs of interface ports of a factorized unit for preserving network connectivity. Thus, it is also necessary to configure wire functions whenever a new group of ports is resulted from a factorization. For that, HCL provides clause adjust wire in unification and factorization declarations. In Figure 6, illustrative abstract examples of unification are presented, illustrating duality between these operations. A more concrete example of factorization is presented in line 28 of Figure 2, where manager unit from Workpool skeleton is split up into units dispatcher and collector, dividing tasks realized by the manager. Unification does not appear directly in example of Figure 2. But replacing declarations, like discussed in the last section, is a syntactic sugaring of HCL that may be defined using unification. For instance, consider replacing declaration in line 31. It can be rewritten using the following equivalent code: unit track’ # ITracking .. . unify pp.stage[1] # particle → events, track’ # (user info, particles) → (events, totals) to track # ITracking (user info, particles) → (events, totals) .. . assign Tracking to track 14 A A[1] B B[1] A[2] B[2] replication C C D D Figure 7: An Example of Replication Unification, and consequently replacing declarations, allows for overlapping skeletons. In this sense, units from distinct skeletons may be unified forming a new unit. Overlapping of skeletons is not supported by other skeleton-based languages. In general, only nesting composition has been addressed and cost models have been defined incorporating this feature [38]. A further step is to work on defining new cost models that incorporate the overlapping of skeletons. 2.1.11 Replicating Units Another useful feature of HCL is to support replicate sub-networks from the overall network of the units described by the configuration. For that, a collection of units to be replicated and a natural number greater than one are provided. Network preserving restrictions must be observed, making necessary to replicate communication pairs of interface ports of a replicated unit, like in factorization. Wire functions must be provided to resulted groups of ports using the adjust wire clause. Replication is exemplified in line 35 of Figure 2. The unit pp is replicated into n units (pp[i], 0 ≤ i ≤ n − 1), which replace worker units of Workpool skeleton. Figure 7 presents an illustrative example. 2.1.12 Indexed Notation The # configuration language supports a special kind of syntactic sugaring for allowing to declare briefly large collections of entities. The iterator declaration employs one or more indexes and their ranging values. Syntactic elements that appear enclosed in [/ and /] delimiters (variation scopes) are unfolded, according to range of indexes that appears on its scope. The # compiler incorporates a pre-processor for unfolding indexed notation. In Figure 2, an iterator i is declared, varying from 1 to n. The replacing 15 a1 a2 an main :: a1 −> a2 −> ... −> an −> (r1, r2, ..., rm) r1 r2 rm Figure 8: Simple Components in Haskell declaration in line 35 is put in context of a variation scope. Thus, it may be unfolded in the following code, assuming that n = 3: replace wp.worker[1] by pp[1]; replace wp.worker[2] by pp[2]; replace wp.worker[3] by pp[3] 2.2 Programming Simple Components Simple components are programmed using standard Haskell. No extensions are necessary to Haskell for gluing functional modules in the coordination medium. They are connected to units at the coordination medium by assignment declarations, where a mapping between ports of the unit interface and argument/return points of the component is defined. Arguments of a functional module are represented by the collection of arguments of its function named main, while return points are represented by the elements of the returned tuple. The general signature of main is shown in Figure 8. The main function may return values in the IO monad [90], but the I/O concerns may be resolved at coordination level using a skeleton that implements an I/O aspect, an example of cross-cutting non-functional concern. Figure 9 presents the Haskell code for the functional module Tracking of MCP-Haskell# . Notice the correspondence of the arguments and return points with the ports of the unit track. Functional modules are programmed in pure Haskell. There is no reference in the computation code for any 16 module Tracking(main) where import Track import Tallies import Mcp types main :: User spec info → [(Particle,Seed)] → ([[Event]],[Int]) main user info particle list = let events’s = map f particle list in (events’s, tally bal event lists) where f (particle@( , , , e, ), sd) = (Create source e):(track user info particle [] sd) Figure 9: A Functional Module from MCP-Haskell# element declared at the coordination level of abstraction. Other examples of functional modules, enforcing these characteristics, are provided in Figure 13. 2.3 Haskell# in the Parallel Functional Languages Context Some authors have written papers on the evolution of parallel functional languages [57, 41, 87]. It is convenient to analyze the evolution of parallel functional programming by dividing it into two periods [57]. In first one, the decades of 1970 and 1980, parallelism was viewed as possibility to make functional programs run faster. After that period, functional programming techniques have been viewed as a promising alternative to promote higher-level parallel programming, mainly motivated by the use of skeletons implemented using higher order functions [25]. The first attempts to embed the support for parallelism in functional languages suggested the technique of evaluating function arguments in parallel, with the possibility of functions absorbing unevaluated arguments and perhaps also exploiting speculative evaluation [16]. However, the granularity of the parallelism obtained from referential transparency in pure functional languages is too fine, not yielding good performance on distributed architectures. Techniques for controlling granularity, either statically or dynamically, produced little success in practice [44, 73, 50]. Implicit parallelizing compilers face difficulties to promote good load balancing amongst processors and to keep the communication costs low. On the other hand, explicit parallelism 17 with annotations to control the demand of the evaluation of expressions, the creation/termination of processes, the sequential and parallel composition of tasks, and the mapping of these tasks onto processors yielded better results [18, 51, 45, 76, 14, 86]. GpH adopts a semi-explicit approach, where programmers may annotate the code, but responsibility to decide when to evaluate expressions in parallel is left to the compiler. Explicit approaches have the disadvantage of cross-cutting the computation and the communication code, not allowing to reason about these elements in isolation. Skeleton-based approaches have obtained a relative success in parallel functional programming [26, 42, 64, 40]. The coordination paradigm [35] influenced the design of parallel functional languages in 1990s, being exploited from two perspectives. In the first one, it is used for abstracting parallel concerns from specification of computations. Eden [14], Caliban [85], and Haskell# focuses on these ideas. In the second one, a higher-order and non-strict style of functional programming has been seen as a convenient way for specifying the coordination amongst tasks. SCL [26] and Delirium [61] are examples of languages that employ the functional paradigm at coordination level, describing computations using languages from other paradigms. Haskell# have other similarities with Eden and Caliban besides adopting the coordination paradigm and Haskell for describing computations. They all use constructors for explicit specification of network topologies where processes communicate through point-topoint and unidirectional channels. Like Eden, Haskell# employs lazy lists for interleaving computation and computation and is strict in communication. Higher order values can not be transmitted through channels. Eden includes functionalities for specifying dynamic topologies, contraryse to Caliban and Haskell# . Static parallelism is an important premise of Haskell# design, since it is intended to analyze Haskell# programs by translating them into Petri nets. Also, Haskell# is oriented for high performance computing, where static parallelism is a reasonable assumption, and not for general concurrency. In the next paragraphs, some important distinguishable features Haskell# are discussed. The Adoption of a configuration based approach for coordination. Configuration languages [53], integrated to a lazy functional language like Haskell, allows a complete separation between parallelism and computational programming dimensions. No extensions are required to Haskell for program- 18 ming at computational level. Haskell and the HCL are orthogonal. Eden and Caliban, examples of embedded coordination languages, extend Haskell syntax with primitives for “gluing” processes to the coordination medium. GpH tries to separate parallel coordination code by using evaluation strategies [88]. Evaluation strategies is an interesting idea, but after inspecting some GpH programs that uses them, we noticed that a complete and transparent separation of the parallelism and the computation is very difficult to obtain. This is even worse when programmers want to reach peak performance of applications at any cost. The experience with Haskell# , and other parallel functional languages, has shown that a really transparent separation makes easier to parallelize existing Haskell programs. This increases opportunities for the reuse of code and allows independent specification and development of functional modules and coordination code, reducing programming efforts and costs. The ability of composing programs from parts using the configuration approach also makes Haskell# more suitable for programming large scale high-performance applications than other parallel functional languages [33, 27]. Programmers are forced to adopt a coarse grained view of parallelism that is convenient for clusters and grids. The Modelling of parallel architectures. Developing general techniques for freeing programmers from making decisions on the allocation of processes to processing nodes of a parallel architecture is an old challenge to the parallel programming community. However, this problem is hard to be treated in general. Existing mechanisms for this purpose, either dynamic or static, apply efficiently to restricted instances of the general problem and some of them are based on heuristics. With the advent of grids, cluster of heterogeneous nodes, constellations, etc, it is not expected that a unified approach, covering all realistic cases, may appear. Because of that, Haskell# follows a static and explicit approach for process allocation, as in Caliban. Eden and GpH, on the other hand, let allocation decisions to the compiler. In Haskell# , it is possible to model both processes needs for optimal execution and architecture characteristics by using partial topological skeletons for treating allocation as an aspect. Each skeleton may be implemented using specific allocation policies convenient for different architectures. The analysis of formal properties using Petri nets. The support for proving and analysing of formal properties of parallel programs by using 19 Petri nets is one of the most important premisses that guided the design of Haskell#. A compiler that translates HCL configurations into INA [80], a Petri net analysis tool, was developed [55]. In [23], a new translation schema incorporating some extensions to the original HCL was presented. Recently, a new translation schema has appeared and we are working on a new compiler for translating Haskell# programs into PNML [91], a format supported by many Petri net analysis tools, and SPNL [36], for analysing the performance of Haskell# programs by using stochastic Petri nets. TimeNET [92] will be used for this purpose. Other parallel functional languages do not support formal analysis of parallel programs. Simple and portable implementations . Unlike other parallel functional languages, it was not necessary to modify or extend the run-time system of GHC for implementing Haskell# . Indeed, any Haskell compiler could be used in alternative to GHC, with all optimizations enabled. Haskell# programs take advantage of the evolution of compilation techniques with little efforts. Eden, for example, modifies GHC compiler and disables some of its optimizations [69]. Modifications to the run-time system of the Haskell compiler makes difficult to adapt the parallel language extension to new versions of the compiler. In Haskell# , internal changes to the GHC run-time system do not require modifications to the code generated by the Haskell# compiler. Only if the interface of some used library is changed, minor modifications are necessary. GpH and Eden developers should also carefully analyze the effects of modifications to their parallel run-time system. Efficiency. Potentially, Haskell# compiler may generate efficient MPI code without using advanced compilation techniques for parallel code. This is due to the direct correspondence of HCL constructors to MPI primitives and the use of skeletons to abstract specific interaction patterns. Languages that use higher-level constructors, in the sense that parallelism is transparent or implicit, have difficulties on promoting the generation of MPI code able to take advantage of peak performance in cluster architectures and, mainly, in grid computing environments. 20 Toroidal Solution Farm Solution farm_a farm_b + 11111111 00000000 00000000 11111111 00000000 11111111 distributor 1111 0000 0000 1111 0000 1111 peer[n] 0000 1111 0000 1111 0000 1111 peer[1] 11111 00000 00000 11111 00000 11111 00000 11111 00000 11111 00000 11111 00000 11111 0000 1111 0000 1111 0000 1111 0000 1111 farm_a + farm_b peer[0] 11111111 00000000 00000000 11111111 00000000 11111111 00000000 11111111 collector = peer[0] 11111 00000 00000 11111 00000 11111 00000 11111 distributor 00000 11111 00000 11111 00000 11111 111111111 000000000 000000000 111111111 000000000 111111111 000000000 111111111 1111 0000 0000 1111 0000 1111 0000 1111 peer[1] collector ... 1111 0000 0000 1111 0000 1111 collector 0000 1111 0000 1111 0000 1111 11111111 00000000 00000000 11111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000 11111111 000000000 111111111 000000000 111111111 000000000 111111111 000000000 111111111 ... ... 11111 00000 00000 11111 00000 11111 distributor distributor 00000 11111 00000 11111 00000 11111 1111 0000 0000 1111 0000 1111 0000 1111 peer[0] 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 peer[1] 0000 1111 0000 1111 0000 1111 distributor peer[n] peer[n] + torus Workpool Solution wp_a 111111 000000 000000 111111 111111 000000 manager 000000 111111 000000 111111 000000 111111 worker[0] worker[1] worker[n] = 11111111 00000000 0000 0000 1111 1111 0000 1111 0000 0000 1111 0000 1111 ... 1111 0000 1111 0000 1111 0000 1111 0000 0000 1111 1111 0000 1111 worker[0] worker[1] cell[0,0] cell[0,0] ... cell[0,0] cell[0,0] cell[0,0] ... cell[0,0] ... cell[0,0] cell[0,0] cell[0,0] ... + 00000000 wp_a11111111 00000000 + 11111111 manager 00000000 wp_b11111111 ... 0000 1111 0000 1111 0000 1111 0000 1111 1111 0000 0000 1111 0000 1111 worker[n] worker[1] ... 1111 0000 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 manager ... 0000 1111 1111 0000 0000 1111 worker[0] 0000 1111 0000 1111 0000 1111 11111111111 00000000000 00000000000 11111111111 00000000000 11111111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000 00000000 11111111 00000000 11111111 ... 11111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000 00000000 11111111 11111111 00000000 11111111 wp_b worker[n] Figure 10: HCL Topologies For Matrix Multiplication Solutions 3 Motivating Examples This section presents Haskell# implementations for three applications recently used for benchmarking the parallel functional languages Eden, GpH and PMLS: Matrix Multiplication, LinSolv and Ray Tracer [59]. A Haskell# implementation for a sub-set of NPB (NAS Parallel Benchmarks) [2] is also presented. These applications will be used in Section 5 for performance evaluation of the current Haskell# implementation, presented in Section 4. 3.1 Matrix Multiplication Given two square matrices A, B ∈ Z n×n , n ∈ N, a matrix C ∈ Z n×n is calculated, such that Ci,j = n X Ai,k ∗ Bk,j . k=1 A trivial, fine-grained, parallel solution requires n × n processors. Each processor computes an element Ci,j , from scalar product of row i of A and column j of B. This solution is obviously impractical, since large matrices are common in real applications, requiring a number of processors not supplied by contemporary parallel architectures. Three approaches are commonly used in order to aggregate computations for increasing granularity [59]: • Row Clustering: each process computes a set of rows of C. For that, the process needs the corresponding set of rows of A and all matrix B; 21 {- In FILE: ManagerSkelBC WP.hcl -} configuration ManagerSkel a → (b,c) where {- In FILE: MatMultBC Farm.hcl -} configuration MatMult<N> where use ReadMatrix,WriteMatrix -- functional modules iterator i range [1,N] unit rA # () → (a::VMatrix); assign ReadMatrix to rA unit rB # () → (b::VMatrix); assign ReadMatrix to rB unit wC # c::Matrix → () ; assign WriteMatrix to wC {- In FILE: MatMultBC WP.hcl -} configuration MatMult<N> where unit farm a ; assign Farm<N, splitM, combineM > to farm a unit farm b ; assign Farm<N, splitM T, combineM > to farm b iterator i range [1,N] use Skeletons.Workpool use MatrixMult, ManagerSkel -- MatrixMult is a func. import MatrixMult WF(splitM,combineM) use Skeletons.Farm use ReadMatrix, MatrixMult, WriteMatrix -- functional modules import MatrixMult WFs(splitM,splitM T,combineM) module unit wa; assign Workpool<N> to wa unit wb; assign Workpool<N> to wb /[ unify farm a.worker[i] # a → c, farm b.worker[i] # b → c to worker[i] # (a::VMatrix, b::VMatrix ) → c::Matrix assign MatrixMult to worker[i] /] unify wa.manager # c → a, wb.manager # c → b to manager # c → (a, b) [/ unify wa.worker[i] # a → c, wb.worker[i] # b → c to worker[i] # (a::VMatrix, b::VMatrix ) → c::Matrix assign MatrixMult to worker[i] /] assign ManagerSkel to manager unify farm a.collector # c → (), farm b.collector # c → () to collector # c::Matrix → () assign WriteMatrix to collector assign ReadMatrix N → a to farm a.distributor # () → a assign ReadMatrix N → b to farm b.distributor # () → b Figure 11: Haskell# Configuration of Block Clustering using Workpool and Farm • Block Clustering: each process computes a block of the resulting matrix C. For that, the corresponding rows of A and columns of B are needed; • Gentleman’s algorithm: the processes are organized in a torus (circular mesh) for performing a systolic computation [78]. Each process computes a block in C. At initial state, the corresponding blocks in A and B are arranged across processes. Then, they execute k steps, where k is the number of rows and columns of processes. At each step, a process sends the blocks from A and B that it contains to its left and down neighbors, and receive new blocks from right and top neighbors. A local computation is performed and the resulting matrix is accumulated. The above solutions differ on the number and size of messages exchanged. In Haskell# programs, composition of skeletons may be used to describe topologies for the solutions. Firstly, consider implementations of row and block clustering using Workpool skeleton, where a manager process distributes rows or blocks, respectively, as jobs to a collection of worker processes, on demand of their availability. Once a worker finishes a job, it sends 22 {- In FILE: MatMultTorus.hcl -} configuration MatMult<N> where iterator i range [1,N*N] use Skeletons.{Torus, Farm} useReadMatrix, MatrixMult, WriteMatrix import MatrixMult WFs(splitM,combineM) unit farm a; assign Farm<N*N,splitM,combineM> to farm a unit farm b; assign Farm<N*N,splitM,combineM> to farm b unit torus; assign Torus<N> to torus [/ unify farm a.worker[i] # a → c, farm b.worker[i] # b → c, torus.cell[i/N][i%N] # (as l,bs t) → (as r,bs d) to cell[i/N][i%N] # (a::Matrix, b::Matrix, as l:: [Matrix ], bs t:: [Matrix ]) → (c::Matrix, as r :: [Matrix ], bs d:: [Matrix ]) /] unify farm a.collector # c → (), farm b.collector # c → () to collector # c::Matrix → () assign ReadMatrix N → a to farm a.distributor # () → a assign ReadMatrix N → b to farm b.distributor # () → b [/ assign MatrixMult to cell[i/N][i%N] /] assign WriteMatrix to collector Figure 12: Systolic Matrix Multiplication using a Torus (HCL Code) its result back to the manager and stay available for receiving another job. This technique is suitable when the number of jobs exceed the number of processors available. Load balancing is automatically achieved in architectures where processor workload or performance may vary. Because of that, it has been widely used in grid computations [34]. The unit manager in the Workpool skeleton in Haskell# has two groups of ports of kind any: one for sending jobs to workers and another for receiving results from them. Workers receive jobs from their input ports and send results through their output ports. Row and block clustering may also be implemented using Farm skeleton. Now, a master process sends a job to each slave process. Ideally, jobs have similar workload. After completing a job, slaves send the result to their master and finish. The master combines the solutions received from all slaves. This approach may reduce significantly the number of messages exchanged and minimizes the communication overheads by using underlying collective communication primitives. In fact, the Farm skeleton is defined by overlapping of Gather and Scatter skeletons. Farm employs wire functions for distributing and combining values sent to and received from slave processes. For achieving better load balancing, processors must be homogeneous. This is a reasonable assumption to be made in cluster architectures, but not in grid ones. 23 module LS homSol(main) where module MatMult Toroidal(main) where import import import import import MatrixTypes import List main :: Int -¿ Int -¿ Matrix -¿ Matrix -¿ [Matrix] -¿ [Matrix] -¿ (Matrix, [Matrix], [Matrix]) main = mult’ mult’ nc nr sm1 sm2 sm1s sm2s = (result, toRight, toDown) where toRight = take (nc-1) (sm1:sm1s) toDown = take (nr-1) (sm2’:sm2s) sm2’ = transpose sm2 sms = zipWith multMatricesTr (sm1:sm1s) (sm2’:sm2s) result = foldl1’ addMatrices sms addMatrices :: Matrix addMatrices m1 m2 = where addVectors addVectors -¿ Matrix -¿ Matrix zipWith addVectors m1 m2 :: Vector -¿ Vector -¿ Vector v1 v2 = zipWith (+) v1 v2 multMatricesTr :: Matrix -¿ Matrix -¿ Matrix multMatricesTr m1 m2 = [[prodEscalar row col | col ¡- m2] | row ¡- m1] Matrix LUDecompMatrix (det, homsolv) qualified Matrix (determinant) ModArithm main :: (SqMatrix Integer, Vector Integer) -¿ [Integer] -¿ [[Integer]] main (a,b) = gen xList where gen xList :: [Integer] -¿ [[Integer]] gen xList ps = map get homSol ps get homSol :: Integer -¿ [Integer] get homSol p = let b0 = vecHom p b a0 = matHom p a modDet = modHom p (determinant p a0) pmx = homsolv0 p a0 b0 ((iLo,jLo),(iHi,jHi)) = matBounds a in (p : modDet : if modDet == 0 then [0] else pmx) slow determinant :: SqMatrix Integer -¿ Integer slow determinant = Matrix.determinant foldl1’ :: (a-¿a-¿a) -¿ [a] -¿ a foldl1’ f (x:xs) = foldl’ f x xs determinant :: Integer -¿ SqMatrix Integer -¿ Integer determinant = det foldl’ :: (a -¿ b -¿ a) -¿ a -¿ [b] -¿ a foldl’ f a [] = a foldl’ f a (x:xs) = foldl’ f (f a x) xs homsolv0 :: Integer -¿ SqMatrix Integer -¿ Vector Integer -¿ [Integer] homsolv0 p a0 b0 = vecCont v where v = homsolv p a0 b0 prodEscalar :: Vector -¿ Vector -¿ MyInteger prodEscalar v1 v2 = sum (zipWith (*) v1 v2) Figure 13: Functional Modules of Matrix Multiplication and LinSolv Figure 11 presents the Haskell# configuration codes for block clustering using Workpool and Farm skeletons. Two matrices are distributed, thus it is necessary to overlap two instances of both skeletons, as illustrated in Figure 10. The units readA, readB and writeC are clustered to implement the manager process. The implementation of row clustering makes use of identical topological description. Differences are on port types and implementation of computations. This evidences the importance of reuse and composition in Haskell# programming. The Gentleman’s algorithm is implemented by overlapping two instances of the Farm skeleton, one for each input matrix, with a Torus skeleton, as in Figure 10. The Torus describes the interaction pattern among slave processes from the overlapped Farms. The HCL code for this arrangement is presented in Figure 12. Haskell# components that implement the solutions above have the same names and interfaces. Only internal details, concerning the parallelism strat24 manager guessedNoOfPrimes input_ab cra n primes pBound ab output add xList primes ... homSol[1] wp ation 1111 0000 0000 1111 0000 1111 0000 1111 worker[0] 0000 1111 0000 1111 0000 1111 1111 0000 0000 1111 0000 1111 0000 1111 worker[1] 0000 1111 0000 1111 0000 1111 ... v_manager 11111111111 00000000000 00000000000 11111111111 00000000000 11111111111 + 00000000 11111111 00000000 00000000 11111111 ... 11111111 11111111 00000000 00000000 11111111 00000000 11111111 00000000 00000000 11111111 11111111 00000000 11111111 peer[1] peer[2] 1111111111 0000000000 0000000000 1111111111 0000000000 1111111111 manager root 1111 0000 0000 1111 0000 1111 0000 1111 worker[N] 0000 1111 0000 1111 0000 1111 homSol[N] bcast_ab unific 111111 000000 000000 111111 000000 111111 manager 000000 111111 000000 111111 000000 111111 homSol[2] peer[N] = 0000 1111 0000 0000 1111 ... 1111 1111 0000 0000 1111 0000 1111 0000 0000 1111 1111 0000 1111 worker[0] worker[1] worker[N] Figure 14: Haskell# Topology For LinSolv egy adopted, varies. Thus, they can be used interchangeably in an application by nesting composition. The Haskell# visual programming environment allows several component versions to co-exist. The programmer may choose the appropriate version, depending on the target parallel architecture. For instance, implementing matrix multiplication using Farm may be more efficient in clusters. In grids, a Workpool may prove more suitable. In supercomputers where processors are organized in a torus, the toroidal solution may be the best choice. 3.2 LinSolv Given a matrix A ∈ Z n×n and a vector b ∈ Z n , n ∈ N, find an exact solution to the linear system of equations of the form Ax = b. The solution described here is exact and operates over arbitrary precision integers. A multiple homomorphic image approach is adopted [54], consisting of three stages [59]: 1. map the input data into several homomorphic images. The domain of homomorphic images is Z modulo p (Zp ), where p is a prime number; 25 {- In FILE: ManagerLS WP.hcl -} configuration LS Manager<N> # (ab,xList) → primes where use LS Input, LS Primes, LS CRA, LS Output unit unit unit unit input # primes # cra # output # connect connect connect connect connect () → (ab,pBound,n) ; (unlucky primes*,pBound) → (guessedNoOfPrimes,primes*) ; (n, guessedNoOfPrimes, xList*) → (c,unlucky primes*) ; c → () ; primes → guessedNoOfPrimes input ab → n input ab → pBound cra → unlucky primes cra → c to to to to to assign assign assign assign LS LS LS LS Input to Primes to CRA to Output to input primes cra output cra ← guessedNoOfPrimes cra ← n primes ← pBound primes ← unlucky primes output ← c {- In FILE: LinSolv WP.hcl -} configuration LinSolv<N> where iterator i range [0,N-1] use Skeletons.{Collective.BCast, Workpool} use LS Manager, LS HomSol unit bcast ab ; assign BCast<N> to bcast ab unit wp ; assign Workpool<N> to wp interface ILinSolv (ab, job) → (ab,job) where: ab@IBCast # job@IWorkpool behavior: seq {do ab; do job} unify wp.manager, bcast ab.root to ls manager # ILinSolv assign LS Manager to ls manager [/ unify wp.worker[i], bcast ab.peer[i] to ls worker[i] # ILinSolv assign HomSol to ls worker[i] /] Figure 15: LinSolv using a Workpool skeleton (HCL Code) 2. compute the solution in each of these images, using LU-decomposition followed by forward and backward substitution; 3. combine the results of all images into a result in the original domain, using a fold-based CRA (Chinese Remainder Algorithm) [58]. The parallel strategy implemented in Haskell# is based on Eden and GpH versions [60]. A manager process distributes computations of homomorphic solutions as jobs to a collection of worker processes. The skeleton Workpool was adopted to distribute prime numbers to workers and to collect computed homomorphic solutions. The BCast collective communication skeleton is used for distributing working data (A and b) to the workers. The Haskell# configuration code that implements this arrangement is presented in Figure 15. A composed component LS Manager is configured for aggregating computations of functional modules LS Input (obtains input data A and b), LS Primes (computes the list of primes for calculating homomorphic solutions), LS CRA (aggregates homomorphic solutions using Chinese Remainder Algorithm), and LS Output (outputs result x). In 26 manager rt_parameters output bcast_world 11111111111 00000000000 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 raytracer[0] root 00000000 11111111 11111111 00000000 11111111 00000000 11111111 00000000 00000000 11111111 00000000 11111111 00000000 00000000 11111111 11111111 00000000 11111111 peer[1] peer[2] peer[N−1] ... raytracer[1] + root + 00000000 11111111 00000000 00000000 11111111 11111111 11111111 00000000 00000000 11111111 00000000 11111111 00000000 00000000 11111111 11111111 00000000 11111111 peer[1] peer[2] peer[N−1] raytracer[N] gather_res scatter_xy 11111111111 00000000000 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 raytracer[2] v_manager 11111111111 00000000000 00000000000 11111111111 00000000000 11111111111 00000000 11111111 00000000 11111111 00000000 00000000 00000000 11111111 11111111 00000000 ... 11111111 11111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000 00000000 11111111 11111111 00000000 11111111 peer[1] peer[2] peer[N−1] 1111111111 0000000000 0000000000 1111111111 0000000000 1111111111 0000 1111 0000 1111 0000 0000 0000 1111 1111 0000 ... 1111 1111 0000 1111 0000 1111 0000 1111 0000 0000 1111 1111 0000 1111 root root = peer[1] peer[2] peer[N−1] Figure 16: Haskell# Topology Composition For Ray Tracer composed component LinSolv, the main component, a cluster is created by assigning LS Manager to unit ls manager, which is configured in such a way that it makes the role of root unit in BCast skeleton and manager of Workpool skeleton. The functional module LS HomSol implements computation of a homomorphic solution for a given prime number. It is assigned to units ls worker [i], for 0 ≤ i ≤ N − 1, obtained by unification of worker units of Workpool and peer units of BCast. Notice that these skeletons are overlapped. The cluster ls manager might be placed onto a multiprocessor node, in such a way that processes input, primes, cra and output could execute concurrently. Figure 14 illustrates topological specification of LinSolv. Figure 13 shows examples of functional modules of Matrix Multiplication and LinSolv. 3.3 Ray Tracer Given a collections of objects in the three dimensional space, calculate the corresponding two dimensional image. All rays in a window (for each pixel in the grid) are traced and their intersections with objects are computed. The colour of an intersection point is computed based on the strength of the ray 27 {- In FILE: RT Manager.hcl -} configuration RT Manager<N> # (rt raytracer←xy, world) → (rt parameters→xy[2], world) where use RT Parameters, RT Result -- functional modules unit rt parameters # () → (xy<2>, world) groups xy:broadcast assign RT Parameters to rt paramters # (xy,res) → (); assign RT Result to rt output unit rt output unit rt raytracer # (xy,world) → res connect rt parameters → xy[1] to rt output ← xy {- In FILE: RayTracer.hcl -} configuration RayTracer<N> where iterator i range [0,N-1] use BCast, Scatter, Gather from Skeletons.Colletive use RT RayTracer -- functional module unit bcast world; assign BCast<N> to bcast world unit scatter xy ; assign Scatter<N> to scatter xy unit gather res ; assign Gather<N> to gather res interface IRayTracer (xy.*, world.*, res.*) → (xy.*, world.*, res.*) where: (xy@IBCast # world@IScatter # res@IGather ) behavior: seq {do world; do xy; do res} [/ unify bcast ab.peer[i], scatter world.peer[i], gather res.peer[i] to rt worker[i] # IRayTracer assign RT RayTracer to rt worker[i] /] unify bcast world.root, scatter xy.root, gather res.root to manager # IRayTracer assign RT Manager to manager unify manager.rt raytracer, rt worker[0] Figure 17: Ray Tracer (HCL Code) and texture of the object reached [59]. A data parallel solution is trivial, since rays can be traced independently for each pixel. In Haskell# implementation, a direct mapping of the image lines to N parallel processes, assuming one at each processor, is employed. Each process receives the same number of lines to compute. This solution yields load balancing in homogeneous clusters. The HCL for ray tracer is presented in Figure 17 and its topology is described in Figure 16. It is implemented by overlapping three skeletons: BCast, Gatherv and Scatter. The root units of these skeletons are unified to form the manager unit, responsible for distributing and collecting work among worker units, obtained by overlapping their peer units. The manager also acts as a worker. Distribution and collection are specified by wire functions. The BCast skeleton disseminates the world scene to workers. Scatter and Gatherv are used to distribute jobs and collect the results from the workers. 28 3.4 NAS Parallel Benchmarks This section presents the Haskell# implementations for a sub-set of NPB (NAS Parallel Bechmarks) [2], a package comprising eight programs, specified in NASA Research Center at Ames, USA, intended to benchmark the performance of parallel computing architectures for execution of the NAS (Numerical Aerodynamic Simulation) programs. NPB programs implemented in Haskell# are: • EP (Embarrassingly Parallel ) generates pairs of Gaussian deviates according to a specified scheme and tabulates the number of pairs in successive square anulli. It was developed to estimate the upper achievable limit for floating point performance in a parallel architecture; • IS (Integer Sorting) performs parallel sorting of N keys using bucket sort algorithm. Keys are generated using a sequential algorithm described in [3] and must be uniformly distributed; • CG (Conjugate Gradient) implements a solution to an unstructured sparse linear system, based on conjugate gradient method. The inverse power method is used to find an estimate of the largest eigenvalue of a symmetric positive definite sparse matrix with a random pattern of non zeros; • LU (LU factorization) uses symmetric successive over-relaxation (SSOR) procedure to solve a block lower triangular-block upper triangular system of equations resulting from an unfactored implicit finite-difference discretization of the Navier-Stokes equations in three dimensions; NPB programs exercise the expressiveness of HCL for describing SPMD programs and for translating MPI programs into Haskell# . LU gave us an important insight on how to facilitate programming of applications where processes have a large number of input and output ports. CG and IS help on evaluating the performance of collective communication skeletons. 3.4.1 The Embarassingly Parallel (EP) Kernel The HCL code of EP is presented in Appendix C.1. It declares n units, named ep unit[i], for 1 ≤ i ≤ n. The interface class that describes the behavior of these units, IEP, is formed by the composition of three instances 29 All Reduce sy All Reduce sx sy sx sx ... EP EP sy EP ep[1] ep[0] ep[N−1] q q q All Reduce Figure 18: EP Topology of IAllReduce interface class, called sx, sy and q. The definition of channels is specified by overlapping three instances of the AllReduce skeleton. For that, clusters sx comm, sy comm, and q comm are associated with AllReduce component and their virtual units are unified. The HCL compiler uses the topological information provided by AllReduce skeleton and generates code that uses the MPI AllReduce primitive of MPI. 3.4.2 The Integer Sort (IS) Kernel The HCL code of IS is shown in Appendix C.2. It declares a network of n units, named is unit[i], for 1 ≤ i ≤ n. The interface class for describing the behavior of IS units, called IIS, is a composition of interfaces IAllRe- All Reduce bst 0 bs bst IS kb1 is[1] kb2 bs bst ... IS IS is[0] kb2 bst bs IS is[N−1] is[2] kb2 kb1 kb1 All To All v Figure 19: IS Topology 30 bs kb2 kb1 u[1][2] u[1][3] u[1][4] u[2][2] u[2][3] u[2][4] broadcast u[1][1] broadcast broadcast u[2][2] Factorize u[2][1] broadcast u[1][2] sum_arrays sum_arrays u[2][1] sum_arrays sum_arrays u[1][1] Figure 20: Transpose Skeleton Topology duce, IAllToAllv and IRShif. A cyclic pattern of communication (repeat combinator) now appears, due to presence of stream ports on specification of IIS. IS network topology is defined by overlapping skeletons AllReduce and AllToAllv, for collective communication, and RShift, which performs a data shift right amongst processes. Cluster units bs comm, kb comm and k shift are assigned to them, respectively, and their virtual units are unified. The interface components bs, kb, rshif t of IIS indicate which ports of IS units participate in the skeleton instances, respectively. 3.4.3 The Conjugate Gradient (CG Kernel) The original topology of CG, specified in FORTRAN/MPI, imposes that the number of processes, organized in a rectangular mesh, is a power of two. The version of CG in Haskell# is less restrictive. The programmer must provide parameters dim (the number of mesh rows), and col f actor (the number of mesh columns is obtained by multiplying it to dim). Any number of units may be configured using this approach, but different configurations may result in different performance. The programmer should adequate the parameters values to the features of the execution environment. CG units cg unit[i][j], for 1 ≤ i ≤ dim and 1 ≤ j ≤ dim ∗ col f actor. The HCL code of CG is presented in Appendix C.3. The interface class that describes the behavior of CG units, ICG, is a composition of interface classes IAllReduce (rho, aux, rnorm, norm temp 1 and norm temp 2) and ITranspose (q and r). CG topology is defined by overlapping AllReduce and Transpose skeletons. The former is used for data exchange during parallel scalar products at mesh rows, and the latter for data exchange in parallel matrix multiplications, whenever a transpose operation is performed on data stored in processors. In MPI original code, 31 several calls to MPI Irecv primitive are needed to perform these operations, making difficult to understand the structure of the topology without a careful analysis of the parameters of the problem. Five clusters are needed for each row of processes: rho comm[i], aux comm[i], rnorm comm[i], norm temp 1[i], and norm temp 2[i], 1 ≤ i ≤ rows. The AllReduce component is assigned to them. The Transpose component is assigned to the other two clusters, q comm and r comm, encompassing all processes in the network. Their units are unified producing the final Haskell# topology of CG. The Haskell# configuration code of Transpose is presented in Appendix C.3.1. It organizes virtual units according to parameters dim and col f actor, supplied by CG configuration. Firstly, a square mesh of units with dimension dim is assembled. The ports are connected to transpose data amongst processors using appropriate wire functions applied on groups of ports. These units are factorized in col f actor units, resulting in a square mesh with dim rows and dim ∗ col f actor columns. The diagram in Figure 20 illustrates the factorization process involved in Transpose specification. In order to make it easier to understand, only channels connected to u[1][1] ports are shown. They are replicated according to factorization rules. 3.4.4 The LU Factorization (LU Simulated Application) The HCL code of LU is presented in Appendix C.4. LU organizes n process, where n is a power of two, in a grid. It employs the wavefront method [6] in parallel computation. It differs from other NPB programs because communication is performed by small messages of approximately 40 bytes. Another particularity of LU is the great number of communication ports in units (thirty input ports and thirty output ports). Skeletons Exchange 1b, Exchange 3b, Exchange 4, Exchange 5, and Exchange 6 describes communication topologies in several communication phases during execution, using the wavefront method. The same nomenclature employed in the original LU versions are used here to make easier to compare the two approaches. In these skeletons, there are several interfaces for virtual units that comprise them. Their specification vary according to their position in the grid. Interface generalization is useful in such cases, avoiding classes of units to be treated individually in the configuration. 32 # Compiler # s on t ele High−level Topological Information sk # # FRONT−END flatten lea Flat Representation BACK−END ve s λ λ Functional Modules # PROGRAM Executable Process Wrapper Modules GHC FFI MPI ... Processes onto processors mapping Process Allocator 11 00 Switching Hub Figure 21: Simple Components in Haskell 4 Implementation Haskell# may be implemented on top of a message passing library and a sequential Haskell compiler, without any modifications or extensions to any of them. MPI 1.1 and GHC (Glasgow Haskell Compiler) are currently used, respectively. MPI is now considered the most efficient message passing library for clusters, providing standard bindings for C and Fortran. Recently, MPI versions for grid computing have appeared [49]. GHC is now considered state-of-the-art techniques for the compilation of lazy functional programs. It supports FFI (Foreign Function Interface) [24] to make direct calls to MPI routines from Haskell programs. The use of an efficient sequential Haskell compiler has important impact on performance of Haskell# programs, since Haskell# programs assumes medium and coarse grained parallelism, where most of time is spent in sequential mode of execution. Haskell# implementations are easily portable to new MPI and GHC versions. Indeed, it is possible to replace GHC with any Haskell compiler that supports FFI. All optimizations and extensions provided by the Haskell compiler may be enabled. This is an important feature of Haskell# , since other parallel functional languages built on top of GHC need to modify its run-time system. The current Haskell# implementation has already been tested on top of LAM-MPI 6.5.9 [17], MPICH 1.2.5.2 [37] and GHC versions 6.01 and 6.2 in clusters equipped with RedHat Linux 8.0 and 9.0. 33 4.1 An Overview of the Haskell# Compilation Process The Haskell# compiler has been entirely programmed in Haskell, using Alex 2.0 [30] and Happy 1.13 [62] for parsing. It is divided into two modules: front-end and back-end. The compilation process is illustrated in Figure 21. The front-end module parses all components of a Haskell# program, by traversing its tree of components, from application component to simple components. A flat representation of the processes network is generated. Relevant topological information, obtained from the use of skeletons, that could guide the back-end for the generation of optimized code is stored. The flat code is currently represented as an algebraic data type in Haskell, but it is intended to implement it in XML (Extended Markup Language), allowing to use it as an intermediate language for interfacing tools for the analysis performance and formal properties in the programming environment under development. The back-end uses flat code and topological information for generating a wrapper module for each process and for inferring the mapping of processes onto processors of the target architecture. A wrapper module is a Haskell program that controls the execution of a process. The wrapper modules and the functional modules are compiled using GHC. The mapper is a program that copies executable files onto the target machine where it will execute, based on the mapping of processes onto processors inferred by the back-end. 4.2 Wrapper Modules In Figure 22, the structure of a wrapper module is illustrated. A wrapper makes a call to the main function of the functional module associated to with the process. The values produced at return points (ri , 1 ≤ i ≤ k) are copied concurrently to channel variables 2 (chan rj ), using functions send stream and send atom, depending on the nature of the associated output port. The arguments provided to the main function (aj , 1 ≤ j ≤ n) may also be obtained from channel variables (ON DEMAND chan rj ) or directly (FORCED actionj ), on demand of evaluation of return points. The function perform actions controls the completion of the communication operations, according to a guide automaton that recognizes the behavior specified in the process interface. Whenever an output port must be activated, perform actions evaluates perform communication, which reads a value from the 2 Type Chan t from Concurrent Haskell [74]. 34 module Main(main) where import import import import System(getArgs) Concurrent(forkIO, Chan, newChan, newQSemN, waitQSemN, signalQSemN) HHashSupport qualified ¡Functional Module¿(main) ¡import declarations that appear in # code¿ main :: IO () main = do argv ← getArgs argc ← (return.length) argv -- MPI initialization give args [] argv (mpi init BUFFER SIZE argc) a1 chan :: Chan (Comm ¡Channel Type¿) ← newChan --Initializing channel variables for arguments a2 chan :: Chan (Comm ¡Channel Type¿) ← newChan ... an chan :: Chan (Comm ¡Channel Type¿) ← newChan r1 chan :: Chan (Comm ¡Channel Type¿) ← newChan --Initializing channel variables for return points r2 chan :: Chan (Comm ¡Channel Type¿) ← newChan ... rk chan :: Chan (Comm ¡Channel Type¿) ← newChan for each p, an individual port or group of ports involved in a collective operation: p ← [mpi register port . . . | mpi register peer . . .] let comm p = [SingleIPort | SingleOPort | GroupIPort | GroupOPort | Bcast | Gather | Scatter | Scatterv | Allgather | Allgatherv | Allreduce | Alltoall | Alltoallv | Reduce Scatter | Scan] p · · · caut ← ¡code to setup guide automata¿ control automata init caut sync ← newQSemN 0 forkIO (perform actions ¿¿ signalQSemN sem) let a1 = [recv stream | recv atom] [ON DEMAND action1 | FORCED chan a1 ] a2 = [recv stream | recv atom] [ON DEMAND action2 | FORCED chan a2 ] ··· an = [recv stream | recv atom] [ON DEMAND actionn | FORCED chan an ] (r1 ,r2 ,. . .,rk ) = ¡Functional Module¿.main a1 a2 . . . an forkIO ([send stream | send atom] r1 chan r1 ¿¿ signalQSemN sync) forkIO ([send stream | send atom] r2 chan r2 ¿¿ signalQSemN sync) ... forkIO ([send stream | send atom] rk chan rk ¿¿ signalQSemN sync) waitQSemN (k+1) sem mpi finalize Figure 22: Wrapper Module 35 perform_actions ! calls calls perform_communication! writeChan recv_stream! ON_DEMAND FORCED calls (guide automaton) readChan λ channel variable perform_communication! send_stream! writeChan readChan channel variable Figure 23: Schematic Representation of a Wrapper Module corresponding return point and sends it through the active port. For input ports, perform communication may be called inside recv stream or recv atom functions, when an argument value is demanded. In this case, the operation is validated by the guide automaton and a channel variable is not necessary. However, in some collective communication operations, when a process sends and then receives a value (the root process in a broadcast, for example), it is needed to write and read, in a single call to perform communication, channel variables associated to a return point and to an argument, respectively. This is a situation where a channel variable is necessary for an argument. The Haskell# compiler forces evaluation of the input ports inside perform actions whenever it may infer that an input port must be strictly activated before the activation of some output port. This is typical when the alt (choice) constructor does not occur in process behavior specification. Figure 23 illustrates the use of channel variables. Since processes spend some time with synchronization, concurrent evaluation of perform action and exit points, using send stream and send atom, allow the overlapping of computations when a process is executing perform communication. In multiprocessors and super scalar processors, which may execute instructions in parallel and speculate about their execution, performance might be improved. 4.3 Guide automaton: Controlling Activation of Ports A guide automaton is an abstract data type, implemented in C, used for controlling and validating the activation order of ports in execution of Haskell# programs. It might be algebraically described by a tuple of the following form: C = (Π, Q, T, ϕ0 , ϕ1 , ρ, F, S, σ, π, γ, κ) 36 ! q 1r ! q nr π(q)=Choice ... . .. ... γ (q)=True ... ! q ml Ql π(q)=Join kIO for γ (q)=False transition ... ... q 1l π(q)=Fork q path ! ! ! q 1l Ql q ml q current state forkIO q kIO for ... ... ... current state ! ! ... q ... ! forward states ... π(q)=Forward Qr Figure 24: Guide Automaton where: • Π is a set of port identifiers that forms the alphabet of the guide automata; • Q is a finite set of states; • T is a finite set of transitions; • ϕ0 : T → Q maps each transition to its origin state; • ϕ1 : T → Q maps each transition to its target state; • ρ : T → Π labels each transition with a port identifier; • F ⊆ Q is a set of final states; • S is a finite set of symbols, representing semaphores; • σ : Q → 2S×N at associates states to semaphore updates. For instance, consider a semaphore s ∈ S. If (s, n) ∈ σ(q) then the value of s must be incremented by n when entering state q; • π : Q → {f orward, choice, f ork, join} gives the kinds of the states; • γ : Q → {T rue, F alse} maps choice states to an expression (termination condition of a repeat combinator) that evaluates to True or False; • κ : Q → 2Q × 2Q associates a state q, to a pair of set of states (Ql , Qr ), whose meaning depends on π(q) (see the next paragraph). 37 States and transitions are represented as natural numbers. The initial state is 0 (zero). Let q be the current state of a guide automaton. The function perform actions looks up κ(q) in order to choose the next communication operation to be performed. For instance, consider κ(q) = (Ql , Qr ). There must be a path from state q to each state in Ql ∪ Qr . If π(q) = f orward, Qr = ∅ and Ql determines the forward states of q. Among them, the goal states are chosen. For that, let us consider a set of transitions T r = {t | ϕ1 (t) = q ′ ∧ q ′ ∈ Ql ∧ t is in a path from q to q ′ }. Port p is chosen from ports {p | t ∈ T r ∧ ρ(t) = p}, among those whose communication pairs are active at that instant (ready for communication). Forward states q, such that, for some t ∈ T r , ϕ1 (t) = q and ρ(t) = p, are goal states. Choices appear only in the implementation of occurrences of the alt constructor. The port p is activated. If p is an output port (default case), it may cause the implicit activation of input ports, in recv stream or recv atom function calls, before completing communication. After any port activation in perform communication, the advance automata function is called for updating the current automata state, validating the operation, by raising an error whenever there is no transition from the current state labelled with the activated port, and updated semaphores. After the activation of p, the guide automaton must be in one of the goal states. Otherwise, the operation is invalid. If π(q) = choice, γ(q) must be evaluated (termination condition of a repetition). If γ(q) is true, the set of forward states of q is Ql , otherwise it is Qr . Choice states are used in the implementation of occurrences of repeat and if combinators. If π(q) = f ork, Qr = ∅ and ∀t : ϕ0 (t) = q : ϕ1 (t) ∈ Ql ∧ ρ(t) = ⊥. When a fork state is reached, threads are forked for executing communication actions starting from the states in Ql . All threads must reach the same join state, where they finalize and resume execution from that state. If π(q) = join, Ql = ∅ and Qr = ∅. Fork and join states are used to implement occurrences of par combinator. If there is no forward state from current state and it is a final state, perform actions finalizes. Semaphores are updated in calls to advance automata. The function σ is used to update their values according to the new current state. A semaphore must have more than one value at a time. During execution, it must be guaranteed that all semaphores must be at least one positive value. Otherwise, an error is informed. Negative values are discarded. Semaphores only exist for validating non-regular patterns of communication that may be described by labelled Petri nets [89]. However, in general, regular patterns of communication are sufficient to describe behavior of most of high-performance 38 Table 1: Meaning of parameters of mpi register pair and mpi register peers Parameter Direction Source/Target rank Channel tag Collective Op. Type Number of Processes Processes in group Buffer Size Data Type Reduce Operation Is Probed Flag Pair is Probed Flag pair ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ peer ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ Description Specifies if a port is for input or output Rank of the process that owns its comm. pair A number that identifies individually a channel Kind of the collective communication operation Number of processes in the collective operation Ranks of processes in the collective operation Buffer used for storing data to be transmitted MPI data type (used in a reduce operations) MPI operation (used in a reduce operations) Flag indicating if a port belongs to a choice group Flag indicating if the communication pair of a port belongs to a choice group. parallel programs [65, 70]. Thus, overhead due to semaphore updating might be avoided for parallel programs where peak performance is critical. 4.4 Implementing Communication Operations There are two kinds of communication operations in Haskell# : point-to-point and collective. The former is implemented through simultaneous activation of channel’s communication pairs. MPI tags, in message envelopes, represent communication channels in calls to point-to-point primitives. The later is implemented using MPI support for dynamic configuration of communication groups and contexts and MPI collective communication primitives. Groups of ports involved in a collective communication are called communication peers. Each communication pair is configured using the function mpi register pair, while communication peers are configured in a single call to mpi register peers. These functions are implemented in C, being called from Haskell code through FFI. Their arguments, detailed in Table 1, set up parameters for completion of communication operations over involved ports during execution. A communication handle, an integer number, is returned and bound to a variable for allowing to access pair/peers information whenever necessary. The polymorphic and higher-order function perform communication has one argument, a value from the algebraic data type PortInfo t u v, whose constructors identifies the kind of communication operation to be performed: SingleIPort, SingleOPort, GroupIPort, GroupOPort (point-to-point 39 communication), Bcast, Gather, Scatter, Scatterv, Allgather, Allgatherv, Allreduce, Alltoall, Alltoallv, Reduce Scatter, Scan (collective communication. The PortInfo’s fields encapsulate necessary information for completion of communication operations: communication handle, port type (choice or combine), wire functions, and channel variables. The type variables t, u and v are used for generalization of channel variables and wire functions types. The MPI point-to-point communication primitive used for completion of communication over an output individual port (SingleOPort) depends on the communication mode of the channel where it is linked: buffered (MPI Bsend), synchronous (MPI Ssend) or ready (MPI Rsend). For groups of output ports of kind All, the corresponding asynchronous MPI sending primitives (MPI Ibsend, MPI Issend and MPI Irsend) are used for initiating the communication on each port belonging to the group. Then, a call to MPI Waitall waits for the completion of all the returned request. Similarly, a call to MPI Recv implements the communication on individual input ports, while MPI Irecv (asynchronous) and MPI Waitall, implements groups of input ports of kind All. Groups of ports of kind Any are implemented using the channel probing protocol, which allows the verification of the status of activation of communication pairs. Transmitting streams and atom values. In Haskell# , a value of type t is transmitted as a value of algebraic type Comm t, whose Haskell representation is depicted below: data Comm t = Atom {data :: t} | Mid {data :: t} | End {depth::Int} The Atom constructor encapsulates atomically transmitted values, while streamed ones are encapsulated using Mid and End constructors. The integer value in the End field represents the depth of a finalized stream. For instance, consider a stream port p of type (Int,Int) and nesting factor 2 (p**::(Int,Int)). The lazy list associated to the port must be of type [[(Int,Int)]]. Consider the lazy list [[[(1,2),(3,4)], [(5,6)]], [[(7,8),(9,0),(1,2)]], [[], [(3,4)], [(5,6),(7,8)]]]. The list of values effectively transmitted through the stream port p at each activation is [Mid (1,2),Mid (3,4), End 3, Mid (5,6), End 3, End 2, Mid (7,8), Mid (9,0),Mid (1,2), End 3, End 2, End 3, Mid (3,4), End 3, Mid (5,6), Mid (7,8), End 3, End 2, End 1]. Whenever possible, stream communication is implemented using MPI persistent 40 communication objects, for minimizing communication overhead. Marshalling Haskell Values to C Buffers. In order to transmit Haskell values using MPI primitives, they must be marshalled onto C contiguous buffers. For that, the Storable class, from FFI, is employed. Default Storable instances are provided for basic data types. User defined data types should be instantiated for this class. The Haskell# compiler traverses Haskell modules of the Haskell# program for finding user defined type values that must be instantiated for the Storable class. Structured data types, such as lists, arrays, tuples and algebraic data types must be packed and unpacked element by element. This could result in a considerable source of inefficiency when number of elements is very large. The benchmarks presented in Section 5.1 evidence this fact. GHC provides unboxed arrays, whose values are stored in contiguous memory areas and can be directly marshalled to MPI buffers. Since most high performance computing applications operate over arrays, and not using lists, unboxed arrays may be used in order to avoid this source of inefficiency. 5 Performance Evaluation This section presents some performance figures for Haskell# programs presented in Section 3. The architecture used is a Beowulf cluster comprising 16 dual Intel Xeon processors (clock: 2 GHz, RAM: 1GB), connected through a Fast Ethernet (100MBs). Measures with 32 nodes were performed in dual multiprocessing mode. MPICH 1.2.3 on top of TCP/IP was used for communication between processes. 5.1 Benchmarking Haskell# with NPB The benchmark results of Haskell# versions of NPB kernels (EP, IS and CG) are presented in Figure 25. The plots to left hand side present their respective running times, while the plots at right hand side presents their corresponding absolute speedups, comparing them to linear speedup, always represented by a solid line. Two problem instances were used for measuring performance of Haskell# kernel versions (Table 2). In the second one, processes demand about twice 41 EP Running Time EP Speedup 4722 15.8 EP-1 EP-2 15.8 Linear EP-1 EP-2 Time 2373 589 296 150 75 37 595 298 1 2 4 8 Number of Processors Speedup EP Running EP 1189 7.8 7.9 3.9 4 2 1 2 16 4 8 Number of Processors IS Running Time 16 2 1 IS Speedup 800 Linear IS-1 IS-2 IS-1 IS-2 Time 448 445 9.5 8.5 208 101 64 36 112 83 1 2 4 8 Number of Processors Speedup IS Running IS 201 6.2 5.3 3.4 3.3 1.7 16 1.6 1 2 4 8 Number of Processors 16 CG Speedup CG Running Time 4428 Linear CG-1 CG-2 CG-1 CG-2 Time 2881 Running CG 1427 1290 901 583 798 6 5.2 2161 2 4 Number of Processors 8 Speedup CG 1 3.7 3.4 2.1 2.2 1.1 1.1 1 2 4 Number of Processors Figure 25: Performance Figures of NPB kernels in Haskell# 42 8 Table 2: Instances of Problem Sizes Used to Run Each Kernel Kernel 1st Problem Size 2nd Problem Size EP m = 25 m = 28 IS total keys log2 = 20 total keys log2 = 21 max key log2 =16 max key log2 =17 CG na = 14000 nonzer = 11 niter = 45 na = 18000 nonzer = 12 niter = 45 as much memory space as the first one, without exhausting physical memory resources of a single node of the cluster. The default problem classes of NPB (S,W,A,B,C) were not used because they were tuned for use with C/FORTRAN + MPI original versions. Due to laziness and the use of immutable arrays, sequential performance of Haskell# versions are about an order of magnitude worse than the performance of the original versions of NPB kernels, both considering time and space. Because of that, some default problem sizes exhaust physical memory resources of cluster nodes, causing virtual memory overheads that must be avoided in measures. The use of mutable arrays could minimize this source of inefficiency, but they require the encapsulation of computations inside the IO monad, preventing arrays of being transmitted through lazy lists. Also due to performance differences in sequential mode of execution, granularity of Haskell# processes is coarser than the granularity of processes in original NPB versions. While Haskell computations execute slower than C/FORTRAN computations, the amount of data transmitted is about the same. The original speedup measures of NPB kernels serve only to establish the lower bounds of the performance of the cluster. One should not use that to make assumptions and claims about relative efficiency of Haskell# implementation. Using GHC profiling tools [81], five main cost centres were identified in CG and IS Haskell# implementations. Table 3 presents the impact of each of them in parallel execution. The impact of cost centres in speedup is evaluated on Table 4. By analyzing the data obtained, one may be conclude that: 1. If only time spent in computation is considered, the speedup is linear; 43 Table 3: Cost Centre Analysis of IS and CG (% of total execution time) i ii iii iv v i ii iii iv v SEQ 45,9 54,1 90,2 9,8 2 35,4 3,0 7,4 4,6 45,3 79,1 1,5 2,1 4,7 7,7 4 IS-1 37,6 3,0 7,2 11,0 35,7 CG-1 70,9 1,8 3,2 11,6 5,8 8 36,0 2,7 7,2 20,8 28,7 57,5 3,5 5,6 24,0 2,7 16 34,0 2,5 7,1 27,8 24,4 50,5 4,1 7,3 32,7 1,9 SEQ 34,5 65,5 84,5 15,5 2 38,6 2,8 6,7 5,4 49,3 68,5 1,2 1,7 10,8 11,6 4 IS-2 35,3 2,8 6,8 11,7 38,9 CG-2 70,2 1,5 2,5 12,9 6,3 8 32,8 2,7 7,0 21,1 32,6 61,1 3,2 5,1 19,5 4,5 16 30,1 2,7 7,2 27,8 28,7 58,5 3,5 5,6 25,0 2,7 i: Raw computation time, ii: Evaluation of wire functions, iii: Marshalling, iv: Communication and synchronization, v: Garbage Collection 2. The marshalling cost centre is the unique source of overhead inherent to Haskell# implementation. The other ones are inherent to parallelism. In some cases, marshalling overhead increases with the number of processors (CG-1 and CG-2). Marshalling could be avoided if GHC allows to copy immutable arrays to contiguous buffers in constant time. But this feature could not be provided yet; 3. The garbage collection overhead decreases by increasing the number of processors used in parallel computation. This fact is attributed to less use of heap when the problem size is split among more processors and the enforcement of data locality. Cache behavior effects are also being investigated. It is worthwhile to remember that garbage collector parameters were tuned before execution. The results obtained here do not guarantee that every Haskell program presents the same behavior; 4. In CG, whenever number of processors increases, the gains in performance due to the minimization of the garbage collection overhead appears to compensate losses due to the marshalling overhead. Thus, in some cases, Haskell# overhead may be considered null. Indeed, assuming that arrays are copied directly and in constant time, the minimization of the garbage collection overhead could compensate their sources of overhead that are inherent to parallelization; 44 Table 4: Influence of Cost Centres in Speedup 2 4 8 16 2 4 8 16 IS-1 IS-2 a 2,1 4,1 7,5 15,1 1,9 4,1 8,0 16,1 b 1,9 3,8 7,0 13,8 1,8 3,8 7,3 14,7 c 1,6 3,2 5,9 11,8 1,5 3,2 6,1 12,0 d 1,5 2,6 4,0 8,3 2,5 4,1 8,0 e 1,2 2,5 4,4 8,5 2,5 4,5 8,2 CG-1 CG-2 a 2,0 3,9 7,9 15,9 2,1 4,0 8,0 16,0 b 2,0 3,8 7,4 13,4 2,0 3,9 7,6 14,4 c 1,9 3,6 6,7 12,8 2,0 3,7 7,0 13,4 d 1,8 3,2 4,9 10,5 1,7 3,2 5,5 10,9 e 1,9 3,2 5,3 10,9 1,8 3,4 6,0 11,2 a: i, b: i/ii, c: i/ii/iii, d: i/ii/iii/iv, e: i/ii/iii/iv/v The observations above are evidences that Haskell# programs are an efficient approach for parallelizing functional computations. The fact observed that splitting of problems among processors may reduce the garbage collection overheads is another motivation for using Haskell# for parallelizing scientific high-performance applications written in Haskell, in addition to the gains in execution time of computations, since this kind of application normally processes large data structures stored in memory. The benchmarks presented in the next section compare Haskell# to other parallel functional languages. 5.2 Benchmarking Haskell# with Loild’s Benchmark Suite The benchmarking results of Haskell# implementations of Matrix Multiplication (MM), LinSolv (LS), and Ray Tracer (RT), based on Eden and GpH versions presented in [59], are shown in Figure 26. The parameters are described on Table 5. Since the cluster used has nodes about three times as fast as than nodes of the cluster used in Loild’s measures, the size of the problem instance of MM and RT used in this paper are larger. This attempts to approximate the sequential run-time of original measures and the increase of granularity of computations. For LS, however, the same problem size is used since its scalability is less sensitive to variations in problem size. The speedup curves of LS and RT are nearly linear, while the speedup 45 MM Speedup MM Run Time 265.3 Linear Row Block Torus Linear Row Block Torus 220.3 11 137 6.9 73.3 64 48.7 45.7 5.8 5.4 4.1 3.6 63 32 20 12 4 8 16 Null 3.5 1.9 32 12 4 8 LS Running Time 16 Null 32 1 LS Speedup 1031 24.5 521 14.3 263 7.6 136 72 42 3.9 2 12 4 8 16 32 12 4 8 RT Running Time 16 32 RT Speedup 400 30.8 221 15.6 100 8 50 26 13 4 1.8 12 4 8 16 32 12 4 8 16 Figure 26: Performance Figures of MM, LS and RT in Haskell# 46 32 Table 5: Problem Instance Parameters for Loild’s Benchmark Suite Matrix Multiplication 960 × 960 matrices of integers with maximum value of 65536. LinSolv Dense 62 × 62 matrix of arbitrary precision integers with maximum value of 216 − 1. Ray Tracer An 1000 × 1000 image (in pixels) with a scene comprising 640 spheres. curve of MM is negatively affected due to the overhead caused by marshalling large nested lists of integers. For row and block clustering of MM, the times measured in 16 processors were little worse than those obtained for 8 and 9 processors, respectively. The marshalling overhead could be minimized by use of Haskell arrays instead of lists to represent matrices. The Haskell# implementations for NPB kernels, where the amount of exchanged data is far larger, evidence this hypothesis. The toroidal version of MM yields a better performance scalability in comparison to row and block clustering, once the amount of data transmitted is comparatively smaller. It is important to observe that measures of LS and RT for 32 processors were obtained on dual processing mode across 16 nodes of the cluster. Unexpected additional overhead was observed when executing MPI programs using the dual mode processing capabilities. This effect was more easily observed when measuring the run time of Haskell# versions of NPB kernels CG and IS, probably due to the large amount of data exchanged between processors in collective communication. Because of that, the results for NPB with 32 processors was not presented. Best speedup for LS and RT were expected for 32 non-dual processors. For that reason, in following discussion, the measures with 16 processors is used as a reference for comparing benchmarks of Haskell# to benchmarks of GpH, Eden, and PMLS. Comparing Haskell# results to the best ones obtained for Eden, GpH, and PNML described in [59], one may observe that Haskell# results are slightly better in all cases. For example, MM using toroidal solution obtains a speedup of 11.0 on 16 processors, while a speedup of approximately 5.0 was the best obtained in Eden toroidal solution. For LS, the speedup obtained in 47 Haskell# is 14.3 on 16 processors, while the best speedup obtained in Eden version was 14.0. For RT, a speedup of 15.6 was obtained by Haskell# on 16 processors, while 15.1 was the best speedup obtained in PMLS version. The results presented herein are not yet sufficient to conclude that Haskell# programs are always more efficient than their GpH, Eden and PMLS versions. The two compared benchmarks were obtained for distinct architectures and using different problem sizes. However, the results presented in this paper evidence that Haskell# implementation presents comparable behavior to wellknown and mature implementations of parallel functional languages, such as GpH, Eden and PMLS. The results obtained are not surprising, since Haskell# run-time system is very light in relation to the complex parallel run-time systems of GpH, Eden, and PMLS, which try to hide some parallel management details from programmers at different degrees. Decades of experience in parallel languages design have shown that as explicit as it is a general parallel language, assuming that it has an efficient implementation, best scalability is obtained using a simpler run-time system. The combination of the results obtained in this paper and in [59] only confirm this hypothesis. In this sense, Haskell# is the most explicit of all, followed by Eden, PMLS and GpH, respectively. 6 Conclusions and Lines for Further Work This paper introduces Haskell# , a coordination language for describing parallel execution of functional computations in Haskell. Haskell# intends to raise the level of abstraction in explicit message-passing parallel programming on distributed architectures, such as clusters, for the development of large scale parallel scientific computing applications. Motivating examples, implementation issues and performance figures of Haskell# benchmarks are also presented. After some years of design, implementation and evaluation, Haskell# has reached some maturity. Several works unfoldings are on progress. Firstly, a parallel programming environment based on Haskell# have been prototyped in JAVA, including the support for programming with visual abstractions, integration to Petri net tools for animation, proving of formal properties, and performance evaluation of programs. It is also under development the use of network simulators, such as Network Simulator (NS) [31] for simulating the performance of parallel programs. Such tool will allow to study the effect of 48 modifications to network characteristics on performance of parallel programs. This work has important impact on studying behavior of Haskell# programs whenever executing on grids. Since HCL is a coordination language orthogonal to Haskell, it is conceptually possible to use other languages, in alternative to Haskell, for programming functional modules. The parallel programming environment under development assumes that Haskell is the ideal language for specifying, prototyping and evaluating the formal properties of parallel programs. Once parallel composition is proved be safe, programmers may implement the functional modules using a language more appropriate for implementing the functionality of the simple components. For example, numerical intensive functional modules could be implemented in Fortran, while sorting of large amount of numbers in parallel may be implemented in C. JAVA can be used for programming functional modules that make access to some database. This kind of multi-lingual compositional approach is a further development. One important design difficult with multilingual approach is to maintain the orthogonality between languages used at coordination and computations levels in absence of lazy and higher-order functional programming. Imperative languages, for example, do not allow to hide the control flow. It is intended to use techniques from aspect oriented programming (AOP) for addressing this matter. In this direction, parallel composition could be treated as an aspect of programming. The recent appearance of heterogeneous versions of MPI [84] is important for making feasible a multi-lingual approach for Haskell# . An even more relevant important topic to be addressed is to develop cost models for Haskell# skeletons, incorporating the possibility of overlapping them, and to use it for allowing Haskell# compiler to make automatic decisions, such as better allocation of processes to processors, use of special primitives, and special restrictions on communication modes, such as the size of buffers. However, a recent idea is to design a meta-language for programmers to teach explicitly Haskell# compiler on how to generate the appropriate code for a given skeleton or a combination of skeletons. The latter approach is more in tune with Haskell# design premisses. However, it is not difficult to see that the two lines could be combined. Further developments will address grid enabled implementations of Haskell# . A grid enabled version of MPI, such as the recently proposed MPICH-G2 [49], might be used. 49 References [1] F. Arbab, P. Ciancarini, and C. Hankin. Coordination Languages for Parallel Programming. Parallel Computing, 24(7):989–1004, 1998. [2] D. H. Bailey and et al. The NAS Parallel Benchmarks. International Journal of Supercomputing Applications, 5(3):63–73, 1991. [3] D. H. Bailey, T. Harris, W. Shapir, R. van der Wijngaart, A. Woo, and M. Yarrow. The NAS Parallel Benchmarks 2.0. Technical Report NAS-95-020, NASA Ames Research Center, December 1995. http://www.nas.nasa.org/NAS/NPB. [4] M. Baker, R. Buyya, and D. Hyde. Cluster Computing: A High Performance Contender. IEEE Computer, 42(7):79–83, July 1999. [5] S. Balay, K. Buschelman, W. Gropp, D. Kaushik, M. Knepley, L. C. McInnes, B. Smith, and H. Zhang. PETSc Users Manual. Technical Report ANL-95/11 Revision 2.1.3, Argonne National Laboratory, Argonne, Illinois, 1996. http://www.mcs.anl.gov/petsc. [6] E. Barscz, R. Fatoohi, V. Venkatakrishnan, and S. Weeratunga. Solution of Regular, Sparse Triangular Systems on Vector and DistributedMemory Multiprocessors. Technical Report NAS RNR-93-007, NASA Ames Research Center, April 1993. [7] G. Baumgartner, Bernholdt D. E., D. Cociorva, R. Harrison, S. Hirata, C. Lam, M. Nooijen, R. Pitzer, J. Ramanujam, and P. Sadayappan. A High-Level Approach to Synthesis of High-Performance Codes for Quantum Chemistry. In 2002 ACM/IEEE conference on Supercomputing, pages 1–10, 2002. Baltimore, Maryland, USA. [8] D. J. Becker, T. Sterling, D. Savarese, J. E. Dorban, U. A. Ranawak, and C. V. Packer. Bewoulf: A Parallel Workstation for Scientific Computation. In 1995 International Conference on Parallel Processing, 1995. [9] G. Bell and J. Gray. What’s the Next in High Performance Computing. Communications of the ACM, 45(2):91–95, 2002. [10] D. E. Bernholdt, J. Nieplocha, and P. Sadayappan. Raising Level of Programming Abstraction in Scalable Programming Models. In 50 IEEE International Conference on High Performance Computer Architecture (HPCA), Workshop on Productivity and Performance in HighEnd Computing (P-PHEC), pages 76–84. Madrid, Spain, IEEE Computer Society, 2004. [11] M. Bertozzi, G. Chiola, G. Ciaccio, G. Conte, P. Marenzoni, A. Poggi, and P. Rossi. DISCO Report on the State-of-the-Art of PC Cluster Computing. Technical Report DISI-TR-98-09, DISI, Universitá de Genova, December 1998. [12] E. Best, J. Esparza, B. Grahlmann, S. Melzer, S. Rmer, and F. Wallner. The PEP Verification System. In Workshop on Formal Design of Safety Critical Embedded Systems (FEmSys’97), 1997. [13] J. M. Bishop. Languages for Configuration Programming: A Comparison. Technical Report 94-04, University of Pretoria, 1994. [14] S. Breitinger, R. Lógen, Y. Ortega Mallén, and R. Peña. Eden - The Paradise of Functional Concurrent Programming. Lecture Notes in Computer Science (EUROPAR’96), 1123:710–713, 1996. [15] J. F. Briesmeister. MCNP - A General Monte Carlo N-Particle Transport Code. Technical Report LA-12625-M, Los Alamos National Laboratory, 1993. [16] W. H. Burge. Recursive Programming Techniques. Addison-Wesley Publishers Ltd., 1975. [17] G. Burns, R. Daoud, and J. Vaigl. LAM: An Open Cluster Environment for MPI. In Proceedings of Supercomputing Symposium, pages 379–386, 1994. [18] F.W. Burton. Functional Programming for Concurrent and Distributed Computing. Computer Journal, 30(5):437–450, 1987. [19] R. Buyya (ed.). High Performance Cluster Computing: Architectures and Systems. Prentice Hall, 1999. [20] R. Buyya (ed.). High Performance Cluster Computing: Programming and Applications. Prentice Hall, 1999. 51 [21] F. H. Carvalho Junior and R. D. Lins. Topological Skeletons in Haskell# . In International Parallel and Distributed Processing Symposium (IPDPS). IEEE Press, April 2003. 8 pages. [22] F. H. Carvalho Junior, R. D. Lins, and R. M. F. Lima. Parallelising MCP-Haskell# for Evaluating Haskell# Parallel Programming Environment. In UnB, editor, 13th Brazilian Symposium on Computer Architecture and High-Performance Computing (SBAC-PAD 2001), September 2001. [23] F. H. Carvalho Junior, R. D. Lins, and R. M. F. Lima. Translating Haskell# Programs into Petri Nets. Lecture Notes in Computer Science (VECPAR’2002), 2565:635–649, 2002. [24] M. (editor) et all Chakravarty. The Haskell 98 Foreign Function Interface (FFI) 1.0 (An Addendum to Haskell 98 Report). Glasgow University, Departament of Computing, Functional Programming Research Group, 2002. [25] M. Cole. Algorithm Skeletons: Structured Management of Paralell Computation. Pitman, 1989. [26] J. Darlington, Y. Guo, H.W. To, and J. Yang. Functional Skeletons for Parallel Coordination. Lecture Notes in Computer Science, 966:55–68, 1995. [27] F. DeRemer and H. H. Kron. Programming-in-the-Large versus Programming-in-the-small. IEEE Transactions on Software Engineering, pages 80–86, June 1976. [28] J. Dongarra, I. Foster, G. Fox, W. Gropp, K. Kennedy, L. Torczon, and A. White. Sourcebook of Parallel Computing. Morgan Kauffman Publishers, 2003. [29] J. Dongarra, S. W. Otto, M. Snir, and D. Walker. An Introduction to the MPI Standard. Technical Report CS-95-274, University of Tennessee, January 1995. http://www.netlib.org/tennessee/ut-cs-95-274.ps. [30] C. Dornan, I. Jones, and S. Marlow. http://www.haskell.org/alex. 52 Alex User Guide, 2003. [31] K. Fall and K. Varadhan. The NS Manual (formely NS Notes and Documentation). Technical report, The VINT Project, A Collaboration between researchers at UC Berkeley, LBL, USC/ISI, and Xerox PARC, April 2002. [32] High Performance Fortran Forum. High Performance Fortran, Language Specification, Version 2.0, January 1997. [33] I. Foster. Compositional Parallel Programming Languages. ACM Transactions on Programming Languages and Systems, 18(4):454–476, 1985. [34] I. Foster and C. Kesselman. The Grid 2: Blueprint for a New Computing Infrastructure. M. Kauffman, 2004. [35] D. Gelernter and N. Carriero. Coordination Languages and Their Significance. Communications of the ACM, 35(2):97–107, February 1992. [36] R. German. SPNL: Processes as Language-Oriented Building Blocks of Stochastic Petri Nets. In 9th Conference on Computer Performance Evaluation, Modelling Techniques and Tools, pages 123–134. Springer Verlag, 1997. [37] W. Gropp, E. Lusk, N. Doss, and A. Skjellum. A High-Performance, Portable Implementation of the MPI Message Passing Interface Standard. Parallel Computing, 22(6):789–828, 1996. [38] M. M. Hamdan. A Combinational Framework for Paralell Programming Using Skeleton Functions. PhD thesis, Department of Computing and Electrical Engineering, Hariot-Watt University, January 2000. [39] J. Hammes, O. Lubeck, and W. Böhm. Comparing Id and Haskell in a Monte Carlo Photon Transport Code. Journal of Functional Programming, pages 283–316, July 1995. [40] K. Hammond, J. Berthold, and R. Loogen. Automatic Skeletons in Template Haskell. Parallel Processing Letters, 13(3), 2003. [41] K. Hammond and G. Michaelson. Research Directions in Parallel Functional Programming. Springer-Verlag, 1999. [42] C. Herrman and C. Lengauer. A Higher-Order Language for Dividing and Conquer. Paralell Processing Letters, 10(2-3):239–250, 2000. 53 [43] C. A. R. Hoare. Communicating Sequential Processes. Prentice-Hall International Series in Computer Science, 1985. [44] P. Hudak. Serial Combinators: “Optimal” Grains of Parallelism. In FPCA’85, pages 382–399, September 1985. [45] P. Hudak. Para-Functional Programming in Haskell. Parallel Functional Languages and Compilers, B. K. Szymanski, Ed. ACM Press, New York, pages 159–196, 1991. [46] Inmos. Occam Programming Manual. Prentice-Hall, C.A.R. Hoare Series Editor, 1984. [47] T. Ito and Y. Nishitani. On Universality of Concurrent Expressions with Synchronization Primitives. Theoretical Computer Science, 19:105–115, 1982. [48] N. Karonis, B. D. Supinski, I. Foster, W. Gropp, E. Lusk, and J. Bresnahan. Exploiting Hierarchy in Parallel Computer Networks to Optimize Collective Operation Performance. In 14th International Parallel and Distributed Processing Symposium, pages 377–384, 2000. Los Alamitos, CA, USA. [49] N. Karonis, B. Toonen, and I. Foster. MPICH-G2: A Grid-enabled Implementation of the Messaging Passing Interface. Journal of Parallel and Distributed Computing, 63(5):551–563, 2003. [50] O. Kaser, C.R. Ramakrishnan, I. V. Ramakrishnan, and R. C. Sekar. Equals - A Fast Parallel Implementation of a Lazy Language. Journal of Functional Programming, 7(2):183–217, March 1997. [51] P. Kelly. Functional Programming for Loosely-coupled Multiprocessors. Research Monographs in Parallel and Distributed Computing, MIT Press, 1989. [52] G. Kiczales, J. Lamping, Menhdhekar A., Maeda C., C. Lopes, J. Loingtier, and J. Irwin. Aspect-Oriented Programming. In Lecture Notes in Computer Science (Object-Oriented Programming 11th European Conference – ECOOP ’97), volume 1241, pages 220–242. Springer-Verlag, November 1997. 54 [53] J. Krammer. Distributed Software Engineering. In IEEE Computer Society Press, editor, Proc. 16th IEEE International Conference on Software, 1994. [54] Lauer M. Computing by Homomorphic Images. In G. Buchberger, G. E. Collins, R. Loos, and Albrecht R., editors, Computer Algebra - Symbolic and Algebraic Computation, pages 139–168. Springer, 1982. [55] R. M. F. Lima. Haskell# - Uma Linguagem Funcional Paralela - Ambiente de Programação, Implementação e Otimização. PhD thesis, Centro de Informáica, UFPE, July 2000. [56] R. M. F. Lima and R. D. Lins. Translating HCL Programs into Petri Nets. In Proceedings of the 14th Brazilian Symposium on Software Engineering, 2000. [57] R. D. Lins. Functional programming and parallel processing. In 2nd International Conference on Vector and Parallel Processing - VECPAR‘96 - LNCS 1215 Springer-Verlag, pages 429–457, September 1996. [58] J. D. Lipson. Chinese Remainder and Interpolation Algorithms. In SYMSAM’71 - Symposium on Symbolic and Algebraic Manipulation, pages 372–391. Academic Press, 1971. [59] H.-W. Loidl, S. Priebe, A. J. Rebon, P. W. Trinder, F. Rubio, N. Scaife, K. Hammond, S. Horiguchi, L. Loogen, G. J. Michaelson, and R. Pe na. Comparing Parallel Functional Languages: Programming and Performance. Higher-Order and Symbolic Logic, 16(3):203–251, September 2003. [60] H. W. et al Loidl. LinSolv: A Case Study in Strategic Parallelism. In Glasgow Workshop on Functional Programming, pages 15–17, 1997. [61] S. Lucco and O. Sharp. Delirium: An Embedding Coordination Language. In Proceedings of the 1990 Conference on Supercomputing, pages 515–524. IEEE Computer Society Press, 1990. [62] S. Marlow and A. Gill. http://www.haskell.org/happy. Happy 55 User Guide, 2001. [63] Message Passing Interface Forum. MPI: A Message-Passing Interface Standard. International Journal of Supercomputer Applications and High Performance Computing, 8(3-4):169–416, 1994. [64] G. Michaelson, N. Scaife, and P. King. Nested Algorithmic Skeletons for Higher Order Functions. Parallel Algorithms and Applications, 16:181– 206, 2001. [65] E. E. Miller and R. H. Katz. Input/Output Behavior of Supercomputing Applications. In Proceedings of Conference Supercomputing’91, pages 567–576, November 1991. [66] J. Nieplocha, R. J. Harrison, and R. J. Littlefield. Global Arrays: A Non-Uniform-Memory-Access Programming Model for HighPerformance Computers. The Journal of Supercomputing, 10(2):169– 189, 1996. [67] OpenMP Architecture Review Board. OpenMP: Simple, Portable, Scalable SMP Programming, 1997. [68] H. Ossher and P. Tarr. Multi-Dimensional Separation of Concerns and the Hyperspace Approach. In Proceedings of the Symposium on Software Architectures and Component Technology: The State of the Art in Software Development. Kluwer Academics, June 2000. University of Twente, Enschede, The Netherlands. [69] C. Pareja, R. Pe na, F. Rubio, and C. Segura. Optimizing Eden by Transformation. In S. Gilmore, editor, Trends in Functional Programming (2nd Scottish Functional Programming Workshop), volume 1, chapter 4, pages 39–52. Intellect Books, 2000. [70] B. K. Pasquale and G. Plyzos. A Statis Analysis of I/O Characterization of Scientific Applications in a Production Workload. In Proceedings of Conference Supercomputing’93, pages 388–397, November 1993. [71] J. L. Peterson. Petri Net Theory and Modeling of Systems. PrenticeHall, 1981. [72] C. A. Petri. Kommunikation mit Automaten. Technical Report RADCTR-65-377, Griffiths Air Force Base, New York, 1(1), 1966. 56 [73] S. L. Peyton Jones, C. Clack, and J. Salkild. GRIP - A HighPerformance Architecture for Parallel Graph Reduction. FPCA’87: Conference on Functional Programming Languages and Computer Architecture - Springer-Verlag LNCS 274, pages 98–112, 1987. [74] S. L. Peyton Jones, A. Gordon, and S. Finne. Concurrent Haskell. In POPL’96 - Symposium on Principles of Programming Languages, ACM Press, pages 295–308, January 1996. [75] S. L. Peyton Jones and J. (editors) Hughes. Report on the Programming Language Haskell 98, A Non-strict, Purely Functional Language, February 1999. [76] M. J. Plasmeijer and M. van Eekelen. Functional Programming and Parallel Graph Rewriting. Addison-Wesley Publishers Ltd., 1993. [77] Post D. E. The Coming Crisis in Computational Science. In IEEE International Conference on High Performance Computer Architecture (HPCA), Workshop on Productivity and Performance in High-End Computing (P-PHEC). Madrid, Spain, 2004. [78] M. Quinn. Parallel Computing. McGraw-Hill, 1994. [79] F. A. Rabhi and S. Gorlatch. Patterns and Skeletons for Parallel and Distributed Computing. Springer, 2002. [80] S. Roch and P. Starke. Manual: Integrated Net Analyzer Version 2.2, 1999. [81] P. M. Sansom and S. L. Peyton Jones. Time and Space Profiling for Non-Strict, Higher-Order Functional Languages. In Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 355–366. ACM Press, 1995. [82] V. Sarkar, C. Williams, and K. Ebcioğlu. Application Development Productivity Challenges for High-End Computing. In IEEE International Conference on High Performance Computer Architecture (HPCA), Workshop on Productivity and Performance in High-End Computing, pages 14–18, 2004. 57 [83] D. B. Skillicorn and D. Talia. Models and Languages for Parallel Computation. ACM Computing Surveys, 30:123–169, June 1998. [84] J. M. Squyres, A. Lumsdaine, W. L. George, J. G. Hagedorn, and J. E. Devaney. The interoperable message passing interface (IMPI) extensions to LAM/MPI. In Proceedings, MPIDC’2000, March 2000. [85] F. Taylor. Parallel Functional Programming by Partitioning. PhD Thesis, Department of Computing, Imperial College of Science, Technology and Medicine, University of London, January 1997. [86] P. Trinder, K. Hammond, J. S. Mattson Junior, A. S. Partridge, and S. P. L. Jones. GUM: A Portable Parallel Implementation of Haskell. In PLDI’96 - Programming Languages Design and Implementation, pages 79–88, 1996. [87] P. W. Trinder, H-W. Loidl, and R. F. Pointon. Parallel and Distributed Haskells. Journal of Functional Programming, 12(4/5):469–510, July 2002. [88] P.W. Trinder, K. Hammond, and H. W. Loidl. Algorithm + Strategy = Parallelism. Journal of Functional Programming, 8(1):23–60, January 1998. [89] R. Valk and G. Vidal Naquet. Petri Nets and Regular Languages. Journal of Computer and System Sciences, 23:299–325, 1981. [90] P. Wadler. Monads for Functional Programming. Advanced Functional Programming, LNCS 925, Springer-Verlag, 1995. http://cm.bell-labs.com/cm/cs/who/wadler/papers/marktoberdorf/marktoberdorf.ps.gz. [91] Weber M. and Kindler E. The Petri Net Markup Language. Lecture Notes in Computer Science, 2002. Submitted for publication in april 2002. [92] A. Zimmermann, J. Freiheit, R. German, and G. Hommel. Petri Net Modelling and Performability Evaluation with TimeNET 3.0. In 11th Int. Conf. on Modelling Techniques and Tools for Computer Performance Evaluation (TOOLS’2000), pages 188–202. Lecture Notes in Computer Sciente, 2000. 58 A The Formal Syntax of HCL In what follows, it is described a context-free grammar for HCL, the Haskell# Configuration Language, whose syntax and programming abstractions were informally presented in Section 2. Examples of HCL configurations and their meanings were presented in Sections 2 and 3. The notation employed here is similar to that used for describing syntax of Haskell 98 [75]. Indeed, some non-terminals from that grammar are reused here, once some Haskell code appears in HCL configurations. They are faced italic and bold. A minor difference on notation resides on the use of (. . .)? , instead of [. . .], for describing optional terms. For simplicity, notation for indexed notation is ignored from the description of formal syntax of HCL. It may be resolver by a preprocessor, before parsing. A.1 Top-Level Definitions configuration → header → static parameter list→ component interface→ declaration → | | | A.2 header declaration 1 . . . declaration n (n ≥ 0) component ID static parameter list ? component interface ? < ID1 . . . IDn > (n ≥ 0) ports naming import decl | use decl | iterator decl | interface decl unit decl | assign decl | replace decl | channel decl unify decl | factorize decl | replicate decl | bind decl haskell code Use Declaration use decl → use use spec use spec → id | id.use spec | id.{ use spec 1 , . . . , use spec n } A.3 (n ≥ 1) Import Declaration import decl → impdecl A.4 Iterator Declaration iterator decl → iterator id1 , . . ., idn range [ numeric exp , numeric exp ] (n ≥ 1) 59 A.5 Interface Declaration interface decl → interface (context =>)? ID tyvar 1 . . . tyvar k interface spec interface spec → interface ports spec (where : interface inheritance)? (behavior : behavior expression)? A.5.1 Interface Ports Description interface ports spec → port spec list -> port spec list port spec list → port spec | ( port spec 1 , . . . , port spec n ) (n ≥ 2) → id (*)? (:: atype)? | id port spec A.5.2 Interface Composition interface inheritance → → interface slice ports naming composition → | ports naming → port naming list → A.5.3 Interface Behavior behavior expression → action → | | | condition → disjunction → sync conjunction → simple conjunction → A.6 interface slice 1 # . . . # interface slice k (k ≥ 1) id @ ID | ID ports naming composition ports naming ( ports naming 1 # . . . # ports naming n ) (n ≥ 1) port naming list -> port naming list id | ( id1 , . . . , idn ) (n ≥ 1) (sem id1 , . . . , idn )? : action (n ≥ 1) par { action 1 ; . . . ; action n } | seq { action 1 ; . . . ; action n } alt { action 1 ; . . . ; action n } | repeat action condition ? if condition then action else action id ! | id ? | signal id | wait id (n ≥ 2) until disjunction | counter numeric exp conjunction 1 ‘|’ . . . ‘|’ conjunction n (n ≥ 1) h simple conjunction i | simple conjunction id | ( id1 & . . . & idn ) (n ≥ 1) Unit Declaration → unit unit spec unit decl unit spec → (*)? id (# unit interface)? (wire wf setup 1 , . . . , wf setup n )? unit interface→ ID ports naming composition ? | interface spec 60 wf setup → group spec → group type → wire function → A.7 id (group type group spec)? (: wire function)? { id1 , . . ., idn } | * numeric exp any | all ? | exp Assignment Declaration assign decl → assigned component → actual parameter list→ → assigned unit A.8 assign assigned component to assigned unit ID actual parameter list ? ports naming composition ? < numeric exp 1 , . . . , numeric exp n > (n ≥ 1) qid ports naming composition ? Replace Declaration replace decl → replace qid ports naming composition ? by operand unit A.9 Channel Declaration channel decl → connect qid -> qid to qid <- qid , comm mode comm mode → synchronous | buffered numeric exp | ready A.10 Unification Declaration → unify operand unit 1 , . . . , operand unit n to unit spec adjust wire wf setup 1 , . . . , wf setup k (n ≥ 2, k ≥ 1) operand unit → qid # interface pattern 1 . . . # interface pattern n (n ≥ 1) interface pattern → port pattern list -> port pattern list | id port pattern list → pattern | ( pattern 1 , . . . , pattern n ) pattern → id | @ qid | | unify decl A.11 Factorization Declaration factorize decl → factorize operand unit to unit spec 1 . . . unit spec n adjust wire wf setup 1 , . . . , wf setup k (n ≥ 2, k ≥ 1) 61 A.12 Replication Declaration replicate decl → replicate operand unit 1 , . . . , operand unit n into numeric exp adjust wire wf setup 1 , . . . , wf setup k (n ≥ 2, k ≥ 1) A.13 Bind Declaration bind declaration → bind qid -> qid to -> id | bind qid <- qid to <- id A.14 Miscelaneous haskell code → topdecls qid → id1 ‘.’ . . . ‘.’ idn (n ≤ 2) qID → ID1 ‘.’ . . . ‘.’ IDn (n ≤ 2) B An Algebraic Semantics for Haskell# Components This appendix presents an algebra intending to formalize semantics of Haskell# programming abstractions at coordination level. A Haskell# component H may be defined by an algebra with the following elements: H =< G, R, C > where G is a set of generators, R is a set of relations on generators, and C is a set of restrictions on relations, defined as following: G=                            C, composed components S, simple components U, units G, ports groupings P, individual ports R, kinds of processes: repetitive or non-repetitive D, port directions: input or output T, port type: any or all M communication modes: synchronous, buffered or ready 62                            R=                                    ω : {⋆} → C ∪ S δ : C → 2U , ψ : P → P, γ : U → C ∪ S, π : G → U × D, β : U → G∗ , τ : Q → 2P × T, ρ : U → R, ν :P ×P ×M λ : G → N at ∗ ι : U → 2G × 2G main component units that comprise a component association of ports to argument/return points component associated to a unit unit of a port grouping behavior of a unit grouping of ports type of process communication channels nesting factor of a stream port interface of a unit                                    C = {R1, R2 , R3 , R4 , R5 , R6 , R7 , R8 , R9 , R10 , R11, R12 } A Haskell# program is a component that may execute. Essentially, it does not have virtual units in its composition (it is not a partial skeleton). All units are assigned to a component (∀u : u ∈ U : (∃c : c ∈ C ∪ S : γ(u) = c)). In what follows, the restrictions from R1 to R12 are described. They are formulas in predicate logic (predicate) of the following form (∀b1 , b2 , . . . , bn : R : P ) or (∃b1 , b2 , . . . , bn : R : P ), where ∀ and ∃ are the usual existential quantifier, bi , 1 ≤ i ≤ n, are bound variables, R is a formula that specifies the set of values of bound variables, and P is a logical predicate. The restriction R1 states that component ω (main component) is the only component that is not assigned to any unit: R1 ⊢ ∀u : u ∈ U : γ(u) 6= ω (1) R2 states that cyclic dependencies may not occur in component hierarchy: R2 ⊢ ∀u : u ∈ U ∧ γ(u) 6= ⊥ : u ∈ / (δ ◦ γ)(u) s∈S where : δ(s) = ∅ S δ(c) = u∈δ(c) (δ ◦ γ)(u) c ∈ C (2) R3 states that a cluster is repetitive whenever all units belonging to its assigned component are repetitive: R3 ⊢ ∀u : u ∈ U ∧ (∃c : c ∈ C : γ(u) = c ∧ δ(c) 6= ∅) : ρ(u) = Repetitive ⇔ (∀u : u ⊆ (δ ◦ γ)(u)) : ρ(u) = Repetitive) 63 (3) R4 state that groups of ports are disjoint, R5 states that all individual ports belong to a group of ports, and R6 states that groups of ports must not be empty: R4 ∀g, g ′ : g, g ′ ∈ G : π(g) ∩ π(g ′ ) = ∅ R5 ∀p ∃g : p ∈ P ∧ g ∈ G : p ∈ τ (g) (4) R6 ∀g : g ∈ G : τ (g) 6= ∅ In the algebra, all ports are treated as non-empty groups. Thus, an individual port in a Haskell# program is represented as a group containing an unique port. The restrictions above makes possible to define a “inverse” relation τ 3 , such that τ (p) returns the group g that p belongs. It is useful for simplifying next formulations. Restrictions R7 , R8 , and R9 specifies rules for formation of channels. Respectively, they say that channels are point-to-point, unidirectional and have the same nesting factors: R7 ⊢ (po1 , pi1 , m) ∈ ν ∧ (po2 , pi2 , m) ∈ ν ⇒ po1 = po2 ⇔ pi1 = pi2 R8 ⊢ (po , pi , m) ∈ ν ⇒ (∃u, u′ : u, u′ ∈ U : (π ◦ τ )(po ) = (u, Output) ∧ (π ◦ τ )(pi ) = (u′ , Input)) R9 ⊢ (po , pi , m) ∈ ν ⇒ (λ ◦ τ )(po ) = (λ ◦ τ )(pi )) (5) Let u be a cluster (γ(u) ⊆ C) and p be an individual port belonging to group g, such that π(g) = (u, d), for d ∈ D (p belongs to interface of u). The restriction R10 ensures that ψ(p) (argument or exit point of γ(u)) is a port with the same direction of p belonging to interface of unit u′ , such that u′ is a unit belonging to the component γ(u) (u′ ∈ (δ ◦ σ)(u)): R10 ⊢ ∀p : (π ◦ τ )(p) = (u, d) ∧ γ(u) ⊆ C : ((π ◦ ψ)(p) = (u′ , d) ∧ u′ ∈ (δ ◦ γ)(u)) (6) The restriction R11 defines the relation ι, which describes the interface of a unit: R11 ⊢ ι(u) =< {g | π(g) = (u, d)}, β(u) > 3 This is not the strict mathematical notion of inverse function, from set theory. 64 (7) R12 says that ports belonging to the same group whose communication pairs also belongs to the same groups are essentially the same port. R12 ⊢ (po1 , pi1 , m1 ) ∈ ν ∧ (po2 , pi2 , m2 ) ∧ τ (po1 ) = τ (po2 ) ∧ τ (pi1 ) = τ (pi2 ) ⇒ po1 = po2 ∧ pi1 = pi2 (8) B.1 Formalizing Interfaces This section formalizes homomorphism relations between interfaces, which are essential for formalizing unification and factorization operations in the next section. B.1.1 The # Operator The # operator allows for combining to interfaces, generating a new interface that inherits characteristics from original ones. It is defined as following: ˆ B2 >, where I1 =< Q1 , B1 > and I2 =< Q2 , B2 > I1 # I2 =< Q1 ∪ Q2 , B1 ∪ (9) ˆ The sets of ports from operand interfaces may overlap. The operator ∪ generates a new formal language describing a behavior for interface I1 #I2 , which is compatible with original behavior of I1 and I2 , in separate. Given an interleaving operator ⊙, from concurrent expressions [47] and ℓ a function that returns the language generated by a concurrent expression, formal ˆ is: definition of ∪ ˆ B2 = ℓ [(w1 ⊙ u1 ) s (w2 ⊙ u2 ) s . . . s (wn ⊙ un )] , n ≥ 1 B1 ∪ where s ∈ Q1 ∩ Q2 w1 s w2 s . . . s wn ∈ B1 u 1 s u 2 s . . . s u n ∈ B2 w1 w2 . . . wn ∈ (Q1 − {s})∗ u1 u2 . . . un ∈ (Q2 − {s})∗ 65 (10) ˆ B2 corresponds to interIf operand interfaces do not overlap ports, B1 ∪ leaving of their original behaviors (B1 ⊙ B2 ). Overlapping ports may be interpreted as synchronization points when combining formal languages B1 and B2 . B.1.2 Homomorphisms Between Interfaces Let I1 =< Q1 , B1 > and I2 =< Q2 , B2 > be interface classes. Let H be a pair < h : Q1 → Q2 , h : B1 → Q2 ∗ >, where h is defined as following: h(ǫ) = ǫ h(aw) = h(a)h(w) (11) With respect to H =< h, h >, the following interface relations are defined: H I1 ⊑ I2 ⇔ Im(h) ⊆ B2 H I1 ⊒ I2 ⇔ Im(h) ⊇ B2 (12) H I1 ≡ I2 ⇔ Im(h) = B2 Relations ⊑ and ⊒ characterize homomorphisms between interfaces, while ≡ characterize isomorphisms between them. B.2 An Algebra for Haskell# Programming Now, it is defined an algebra to formalize Haskell# programming task. Operations over units are defined here: unification, factorization, replication and assignment. They may be used to overlap and nest components that comprise a Haskell# component. An algebra for Haskell# programming is defined as: < {H}, {u : H × H, f : H × H, a : H × H, r : H × H, i : H × H}, ∅ > where generator H contains all well-formed Haskell# components. The relations u, f , a and r represents sets of pairs (h1 , h2 ), h1 ∈ H and h2 ∈ H, where h2 is a Haskell# component obtained from Haskell# component h1 from an application of unification, factorization, assignment or replication operations, respectively, defined further. The relation i is a identity relation containing pairs (h, h), ∀h ∈ H. 66 In what follows, assignment, unification, factorization, and replication operations, homomorphisms between Haskell# components, are defined. Since all Haskell# components may be described using HCL configurations that should be generated using a context-free grammar, the set H is recursively enumerable. Thus, in what follows, the i-ith Haskell# program, i ≥ 0, is denoted by #i = (Gi , Ri , Ci ), where Gi = {Ci , Si , Ui , Gi , Pi , Ri , Di , Ti , Mi }, Gi = {ωi , δi , ψi , γi , πi , βi , τi , ρi , νi , λi }. B.2.1 Unification and Factorization Unification and factorization, informally introduced in Section 2.1.10, are formalized here as mutually reversible relations in the algebra of Haskell# programming. For instance, consider two Haskell# components and their algebraic description, denoted by #k and #j , for some j, k ≥ 0. Consider V̂ = hv1 , v2 , . . . , vn i an ordered sub-set of virtual units in Uk , and their respective interfaces Î = hI1 , I2 , . . . , In i, such that Ii = ι(vi ) = (Qi , Bi ) , for 1 ≤ i ≤ n. Also, consider a virtual unit v ∈ Uj and its interface I = ι(v) = (Q, B). A set of interface mappings Ĥ = hH1 , H2 , . . . , Hn i, where Hi = (hi , hi ) maps interface Ii to interface I is defined. Suppose that #j is obtained from #k by unification of virtual units in V̂ to a unique virtual unit v. It is also supposed correct to say that #k is obtained from #j by factorization of the virtual unit v onto the set of virtual units V̂. Two restrictions may be ensured in a correct application of unification and factorization operations. The first one imposes behavior preserving restrictions for units, stating that v is a proper unification of virtual units in Hi set V̂ if Ii ⊒ I, for 1 ≤ i ≤ n. Analogously, units in V̂ constitute a proper Hi factorization of v if Ii ⊑ I, for 1 ≤ i ≤ n. The second one establishes restrictions for preservation of network connectivity. But before to talk about them, it is necessary to define relation τ̂ : Q → 2Pj . It makes possible to formalize partitioning of groups of ports, which must be configured explicitly in factorizations. In unifications, it is not necessary to configure τ̂ explicitly using HCL, since the inverse of partitioning of groups of ports is the union of them, which is resolved by merging the groups. Ports b and e in Figure 6 are examples of partitioning (right to left) and union (left to right) of ports. The relation τ̂ must satisfy the restriction defined in Equation 13, which relates it with interface mapping Ĥ. 67  ∀q ′ : q ′ ∈ Gj ∧ (∃q : q ∈ Q : Ĥ(q) = q ′ ) :  [ q∈R  τ̂ (q) = τ (q ′ ), R = {q | q ∈ Q ∧ Ĥ(q) = q ′ } (13) In this paragraph, restrictions for ensuring preservation of network connectivity with respect to unification/factorization are discussed. In the trivial case, where overlapping of ports does not occur (Ĥ(q1 ) = Ĥ(q2 ) ⇒ τ̂ (q1 )∩τ̂ (q2 ) = ∅), all ports and channels are preserved (Pj = Pk and νj = νk ) after applying unification/factorization. Essentially, only the sets of units (Uj − Uk = {v} ∧ Uk − Uj = V̂), ownership of ports (relations πk and πj ), and grouping of ports (relations τk and τj ) differs between #j and #k . Ownership and grouping of ports is affected by interface mappings Ĥ. If overlapping of port occurs, some adjustment of ports and channels may be necessary in order to ensure obedience to restrictions for channel formation. For instance, consider a port p, such that ∃Q : Q ⊆ Q : (∀q : q ∈ Q : p ∈ τ̂ (q)) ∧ |Q| ≥ 2. From the perspective of factorization, p is interpreted as a port of unit v, in component #j , that have more than one port in Pk associated to it, possibly all belonging to distinct units in the set V̂ of component #k . For ensuring point-to-point nature of channels (R7 ), the communication pair of p, p ((p, p, m) ∈ νj ∨ (p, p, m) ∈ νj ), must be replicated in |Q| copies as consequence of factorization. They are connected to the ports belonging to groups in Q that have association to p. From the perspective of unification, p is a port of #j that comes from unification of a set of ports Q = {p′ | p′ ∈ Pk ∧ p ∈ τ̂ (p′ )} of #k . The communication pairs of ports in Q, Q, are members of the same group of ports (∃g : g ∈ Gk : Q ⊆ τk (g)). In such case, in order to satisfy restriction R12 , ports in P are unified in a single port p in #j , the communication pair of p. B.2.2 Assignment In an executable Haskell# program, application component must not contain virtual units. Thus, it is necessary to define an operation for associating components to virtual units (nesting composition). Let #k and #i be Haskell# programs, v ∈ Vk be a virtual unit in program #k , and ψ a mapping from ports of interface of v to arguments and exit points of ωi (main component of #i ). 68 Assignment of main component of #i (ωi ) to virtual unit v of #k , produces a new program #k , the union of generators and relations from two programs, where v is associated to ωi through γk . Arguments and exit points of ωi are associated to v ports through ψk , using ψ. B.2.3 Replication Let #k be a Haskell# program. Given a positive integer r > 1 and a collection of units U ⊆ Uk , U = {u1 , u2 , . . . , un }, it is possible to replicate the subnetwork induced by units in U in r copies, forming a new program #j . In order to maintain network connectivity and attendance to Haskell# algebra restrictions, when defining #j from #k , it is necessary to replicate ports from units that are not in U but are connected to any port of some unit in U. HCL allows for specifying wire functions for new groups. Channels connecting unit ports between units in U are also replicated in n copies, one connecting each pair of ports from the n units copies. C C.1 HCL Code for NPB Benchmarks EP, IS, CG, and LU EP component EP<no nodes,mk, mm, nn, nk, nq, epsilon, a, s> with #define PARAMETERS (EP Params i no nodes mk mm nn nk nq epsilon a s) iterator i range [1..no nodes] use Skeletons.Collective.AllReduce use EP FM −− EP Functional Module interface IEP (sx, sy, q) → (sx,sy,q) where: sx@IAllReduce Double # sy@IAllReduce Double # q@IAllReduce UDVector behaviour: seq {do sx; do sy; do q} unit sx comm; assign AllReduce<no nodes, MPI SUM, MPI DOUBLE> to sx comm unit sy comm; assign AllReduce<no nodes, MPI SUM, MPI DOUBLE> to sy comm unit q comm ; assign AllReduce<no nodes, MPI SUM, MPI DOUBLE> to q comm [/ unify sx comm.p[i] # sx, sy comm.p[i] # sy, q comm.p[i] # q to ep unit[i] # IEP assign EP FM (PARAMETERS, sx, sy, q) → (sx, sy, q) to ep unit[i] # sx # sy # q /] C.2 IS component IS<problem class, num procs, max key log2, num buckets log2, total keys log2, max iterations, max procs, test array size> with #define PARAMETERS (IS Params problem class num procs max key log2 num buckets log2 total keys log2 max iterations max procs test array size) iterator i range [1, num procs] 69 use Skeletons.{Misc.RShift, Collective.{AllReduce, AllToAllv}} use IS FM −− IS Functional Module interface IIS (bs*, kb*, k) → (bs*, kb*, k) where: bs@IAllReduce (UArray Int Int) # kb@IAllToAllv (Int, Ptr Int) # k@RShift Int behaviour: seq {repeat seq {do bs; do kb} until <bs & kb>; do k} unit bs comm ; assign AllReduce<num procs, MPI SUM, MPI INTEGER> to bs comm to kb comm unit kb comm ; assign AllToAllv<num procs> ; assign RShift<num procs> 0 → to k shift unit k shift [/ unify bs comm.p[i] # bs, kb comm.p[i] # kb, k comm.p[i] # k to is unit[i] # IIS assign IS FM (PARAMETERS, bs, kb, k) → (bs, kb, k) to is unit[i] # bs # kb # k /] C.3 C.3.1 O kernel CG Esqueleto Transpose component Transpose<dim, col factor> iterator i, j range [1..dim] iterator k range [1..col factor] interface ITranspose (x::UDVector) → (w::UDVector) behaviour: seq { w!; x? } [/ unit trans[i][j] # ITranspose wire x all*dim:?, w all*dim:? /] [/ connect trans[i][j] → w[k] to trans[k][i] ← x[j] /] [/ factorize trans[i][j] # w → x to [/ u[(.i-1)*col factor+k][.j] # w → x /] adjust wires w: sum arrays, x: split and scatter /] C.3.2 Componente CG component CG<dim, col fator, na, nonzer, shift, niter, rcond zvv> # () → (zeta, x) with #define PARAMETERS (CG Params dim (dim*col factor) na nonzer shift niter rcond zvv) use Skeletons.MPI.Collective.AllReduce use Transpose use CG FM −− CG Functional Module index i range [1..dim] index j range [1..col factor] interface ICG (r*,q**,rho**,aux**,rnorm*,norm temp 1*,norm temp 2*) → (r*,q**,rho**,aux**,rnorm*,norm temp 1*,norm temp 2*, x::Array Int Double, zeta::Double) where: q@ITranspose # rho@IAllReduce Double # aux@IAllReduce Double # rnorm@IAllReduce Double # r@ITranspose # norm temp 1@IAllReduce Double # norm temp 2@IAllReduce Double # behaviour: repeat seq {do rho; repeat seq {do q; do aux; if rho then do rho else skip } until <q & aux & rho>; do r; do rnorm; do norm temp 1; do norm temp 2;} until <r & rnorm & q & aux & rho & norm temp 1 & norm temp 2> assign unit q comm; unit r comm; assign assign [/ unit rho comm[i]; unit aux comm[i]; assign assign unit rnorm comm[i]; unit norm temp 1 comm[i];assign unit norm temp 2 comm[i];assign Transpose<dim, Transpose<dim, AllReduce<dim AllReduce<dim AllReduce<dim AllReduce<dim AllReduce<dim dim * dim * * col * col * col * col * col dim * col factor> dim * col factor> factor, MPI SUM, MPI factor, MPI SUM, MPI factor, MPI SUM, MPI factor, MPI SUM, MPI factor, MPI SUM, MPI to to DOUBLE>to DOUBLE>to DOUBLE>to DOUBLE>to DOUBLE>to q comm r comm rho comm[i] aux comm[i] rnorm comm[i] norm temp 1 comm[i] norm temp 2 comm[i] /] [/ unify q comm.u[i][j] # q, rho comm[i].p[j] # rho, aux comm[i].p[j] # aux, r comm.u[i][j] # r, rnorm comm[i].p[j] # rnorm, norm temp 1 comm[i].p[j] # norm temp 1, norm temp 2 comm[i].p[j] # norm temp 2 to cg[i][j] # ICG assign CG FM (PARAMETERS, q, rho, r, aux, rnorm, norm temp 1, norm temp 1) → (q, rho, aux, r, rnorm, norm temp 1, norm temp 2) to cg[i][j] # q # rho # aux # r # rnorm # norm temp 1 # norm temp 2 /] 70 C.4 A Aplicação Simulada LU C.4.1 Esqueleto Exchange 1b component Exchange 1b < xdiv , ydiv ,itmax> with iterator m range [0..( ydiv -1)] iterator n range [0..( xdiv -1)] interface Exchange 1b # (from north**,from west**, from south**, from east** :: UArray (Int,Int) Double) → (to south**, to east**, to north**,tp west** :: UArray (Int,Int) Double) behaviour: repeat { seq {repeat seq{from north?; from west?; to south!; to east!} until <from north & from west & to south & to east>; repeat seq{from south?; from east?; to north!; to west!} until <from south & from east & to north & to west> } until itmax [/unit bigLoop[n][m] # Exchange 1b /] [/ connect connect connect connect C.4.2 bigLoop[n][m] bigLoop[n][m] bigLoop[n][m] bigLoop[n][m] → → → → to to to to south to bigLoop[(n+1) mod xdiv ][m] ← from north east to bigLoop[n][(m+1) mod ydiv ] ← from west north to bigLoop[(n+ xdiv -1) mod xdiv ][m] ← from south west to bigLoop[n][(m+ ydiv -1) mod ydiv ] ← from east /] Esqueleto Exchange 3b component Exchange 3b < xdiv , ydiv > with iterator m range [0..(ydiv-1)] iterator n range [0..(xdiv-1)] interface IExchange 3b # (from north*,from south*, from east*, from west*::UArray Int Double) →(to north*, to south*, to east*, to west*:: UArray Int Double) behaviour: repeat seq {to south!;from noth?; to north!;from south?; to east!; from west?; to west!; from east?} until to south [/ unit g1[n][m] # IExchange 3b /] [/ connect connect connect connect C.4.3 g1[n][m] g1[n][m] g1[n][m] g1[n][m] → → → → g1 g1 g1 g1 ts to g1 [(n+1) mod xdiv ][m]← g1 fn tn to g1 [(n+ xdiv -1) mod xdiv ][m]← g1 fs te to g1 [n][(m+1) mod ydiv ]← g1 fw tw to g1 [n][(m+ ydiv -1) mod ydiv ]← g1 fe /] Esqueleto Exchange 4 component Exchange 4 < xdiv , ydiv > with iterator iterator iterator iterator n range [0..(ydiv-2)] s range [1..(ydiv-1)] l range [0..(xdiv-2)] r range [1..(xdiv-1)] iterator i range [1..(ydiv-2)] iterator j range [1..(xdiv-2)] interface IExchange 4 interface IExchange 4 Null specializes IExchange 4 interface IExchange 4 Border # (in::UArray Int Double) → (out::UArray Int Double) behaviour: seq {out!;in?} specializes IExchange 4 interface IExchange 4 Corner NW # (in1, in2::UArray Int Double) → () behaviour: seq {in1?;in2?} specializes IExchange 4 71 interface IExchange 4 Corner SE # ()→(out1, out2::UArray Int Double) behaviour: seq {out1!;out2!} specializes IExchange 4 [/ unit h0[i][j] # IExchange 4 Null /] unit h0[0][0] # IExchange 4 Corner NW unit h0[ xdiv -1][ ydiv -1] # IExchange 4 Corner SE [/ unit h0[n][0] # IExchange 4 Border /] [/ unit h0[s][ xdiv -1] # IExchange 4 Border /] [/ unit h0[l][0] # IExchange 4 Border /] [/ unit h0[r][ ydiv -1] # IExchange 4 Border /] [/ connect h0[0][s] → out to h0[0][s-1] ← in /] [/ connect h0[ xdiv -1][s] → out to h0[ xdiv -1][s-1] ← in /] [/ connect h0[r][0] → out to h0[r-1][0] ← in /] [/ connect h0[r][ ydiv -1] → out to h0[r-1][ ydiv -1] ← in /] C.4.4 Esqueleto Exchange 5 component Exchange 5 < xdiv , ydiv > with iterator iterator iterator iterator m range [0..(ydiv-1)] n range [0..(xdiv-1)] i range [1..(ydiv-2)] j range [1..(xdiv-2)] interface generalization IExchange 5 interface interface interface interface IExchange 5 IExchange 5 IExchange 5 IExchange 5 behaviour: Null specializes IExchange 5 Top # (in::UArray Int Double)→() behaviour: in? specializes IExchange 5 Bottom # ()→(out::UArray Int Double) behaviour: out! specializes IExchange 5 Side # (in::UArray Int Double)→(out::UArray Int Double) seq {out!;in?} specializes IExchange 5 [/ unit h1[i][m] # IExchange 5 Null /] unit h1[0][0] # IExchange 5 Top unit h1[0][ ydiv -1] # IExchange 5 Top unit h1[ xdiv -1][0] # IExchange 5 Bottom unit h1[ xdiv -1][ ydiv -1] # IExchange 5 Bottom [/ unit h1[j][0] # IExchange 5 Side unit h1[j][ ydiv -1] # IExchange 5 Side /] [/ connect h1[l][0]→out to h1[l-1][0]←in /] [/ connect h1[l][ ydiv -1]→out to h1[l-1][ ydiv -1]←in /] C.4.5 Esqueleto Exchange 6 component Exchange 6 < xdiv , ydiv > with iterator m range [0..(ydiv-1)] iterator n range [0..(xdiv-1)] iterator i range [1..(ydiv-2)] iterator j range [1..(xdiv-2)] interface generalization IExchange 6 interface interface interface interface IExchange 6 IExchange 6 IExchange 6 IExchange 6 behaviour: Null specializes IExchange 6 Left # (in::UArray Int Double) → () behaviour: in? specializes IExchange 6 Right # ()→(out::UArray Int Double) behaviour: out! specializes IExchange 6 Side # (in::UArray Int Double) → (out::UArray Int Double) seq {out!; in?} specializes IExchange 6 [/ unit h1[i][m] # IExchange 6 Null /] unit h1[0][0] # IExchange 6 Left 72 unit h1[0][ ydiv -1] # IExchange 6 Left unit h1[ xdiv -1][0] # IExchange 6 Right unit h1[ xdiv -1][ ydiv -1] # IExchange 6 Right [/ unit h1[j][0] # IExchange 6 Side unit h1[j][ ydiv -1] # IExchange 6 Side /] [/ connect h1[0][l] → out to h1[0][l-1] ← in /] [/ connect h1[ xdiv -1][l] → out to h1[ xdiv -1][l-1 ← in /] C.4.6 Componente LU (Esqueleto de Aplicação) component LU <nprocs,problem size,dt default,itmax> with #define d ilog2(nprocs)/2 #define xdiv (ipow2(if (d*2 == ilog2(nprocs), d, d + 1))) #define ydiv (ipow2(d)) #define PARAMETERS (LU Params nprocs problem size dt default itmax) use Skeletons.MPI.{AllReduce,BCast} use Exchange 1b, Exchange 3b, Exchange 4, Exchange 5, Exchange 6 use LU FM −− LU Functional Module iterator m range [1,ydiv] iterator n range [1,xdiv] interface ILU (ipr,inorm,itmax,nx0,ny0,nz0,dt,omega,tolrsd,rsdnm*,errnm,frc1,frc2,frc3,rsd1,rsd0,u1,phis,phiver,phivor) → (ipr,inorm,itmax,nx0,ny0,nz0,dt,omega,tolrsd,rsdnm*,errnm,frc1,frc2,frc3,rsd1,rsd0,u1,phis,phiver,phivor) where: ipr, inorm, itmax, nx0, ny0, nz0 @IBCast Int # dt, omega @IBCast Double # tolrsd @IBCast MyArray1d, # rsdnm, errnm @IAllReduce MyArray1d # frc1, frc2, frc3 @IAllReduce Double # rsd1 @IExchange 1b # # rsd0, u1 @IExchange 3b # phis @IExchange 4 phiver @IExchange 5 # # phihor @IExchange 6 behaviour: seq { do ipr; do inorm; do itmax; do nx0; do ny0; do nz0; do dt; do omega; do tolrsd; do rsd0; do u1; do rsdnm; do rsd1; do u1; do rsdnm; do errnm; do phis; do frc1; do phiver; do frc2; do phihor; do frc3 } unit unit unit unit unit unit unit unit unit unit unit unit unit unit unit unit unit unit unit unit ipr comm inorm comm itmax comm nx0 comm ny0 comm nz0 comm dt comm omega comm tolrsd comm rsd0 comm u1 comm rsdnm comm ssor comm errnm comm phis comm frc1 comm phiver comm frc2 comm phihor comm frc3 comm ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; assign assign assign assign assign assign assign assign assign assign assign assign assign assign assign assign assign assign assign assign BCast BCast BCast BCast BCast BCast BCast BCast BCast Exchange 3b Exchange 3b AllReduce Exchange 1b AllReduce Exchange 4 AllReduce Exchange 5 AllReduce Exchange 6 AllReduce [/ unify ipr comm.p[n][m] inorm comm.p[n][m] itmax comm.p[n][m] dt comm.p[n][m] omega comm.p[n][m] tolrsd comm.p[n][m] nx0 comm.p[n][m] ny0 comm.p[n][m] nz0 comm.p[n][m] rsd0 comm.g1[n][m] u1 comm.g1[n][m] # # # # # # # # # # # < < < < < < < < < < < < < < < < < < < < xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv xdiv * ydiv > * ydiv > * ydiv > * ydiv > * ydiv > * ydiv > * ydiv > * ydiv > * ydiv > , ydiv > , ydiv > * ydiv , mpi double, , ydiv , itmax, nz> * ydiv , mpi double, , ydiv > * ydiv , mpi double, , ydiv > * ydiv , mpi double, , ydiv > * ydiv , mpi double, ipr , inorm , itmax , dt , omega , tolrsd, nx0 , ny0 , nz0 , rsd0 , u1 , 73 mpi mpi mpi mpi mpi to to to to to to to to to to to sum> to to sum> to to sum> to to sum> to to sum> to ipr comm inorm comm itmax comm nx0 comm ny0 comm nz0 comm dt comm omega comm tolrsd comm rsd0 comm u1 comm rsdnm comm ssor comm errnm comm phis comm frc1 comm phiver comm frc2 comm phihor comm frc3 comm rsdnm comm.p[n][m] ssor comm.bigLoop[n][m] errnm comm.p[n][m] phis comm.h0[n][m] frc1 comm.p[n][m] phiver comm.h1[n][m] frc2 comm.p[n][m] phihor comm.h2[n][m] frc3 comm.p[n][m] # # # # # # # # # rsdnm , rsd1 , errnm , phis , frc1 , phiver, frc2 , phihor, frc3 to lu[n][m] # ILU assign LU FM(PARAMETERS,ipr,inorm,itmax,nx0,ny0,nz0,dt,omega,tolrsd,rsdnm,errnm, frc1,frc2,frc3,rsd1,rsd0,u1,phis,phiver,phivor) → (ipr,inorm,itmax,nx0,ny0,nz0,dt,omega,tolrsd,rsdnm,errnm, frc1,frc2,frc3,rsd1,rsd0,u1,phis,phiver,phivor) to lu[n][m] # ipr # inorm # itmax # nx0 # ny0 # nz0 # dt # omega # tolrsd # rsdnm # errnm # frc1 # frc2 # frc3 # rsd1 # rsd0 # u1 # phis # phiver # phivor /] 74
6cs.PL
arXiv:1703.10088v1 [math.GR] 29 Mar 2017 Profinite semigroups Revekka Kyriakoglou, Dominique Perrin Université Paris-Est, LIGM February 12, 2018 Abstract We present a survey of results on profinite semigroups and their link with symbolic dynamics. We develop a series of results, mostly due to Almeida and Costa and we also include some original results on the Schützenberger groups associated to a uniformly recurrent set. Contents 1 Introduction 2 2 p-adic numbers 4 3 The Fibonacci morphism 5 4 Topological spaces, groups and 4.1 Topological spaces . . . . . . 4.2 Topological semigroups . . . . 4.3 Topological groups . . . . . . semigroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Profinite semigroups 5.1 Projective limits . . . . . . . . . . . . . 5.2 Profinite semigroups . . . . . . . . . . . 5.3 Profinite groups . . . . . . . . . . . . . . 5.4 Endomorphisms of profinite semigroups 5.5 The ω operator . . . . . . . . . . . . . . 5.6 The free profinite monoid . . . . . . . . 5.7 The free profinite group . . . . . . . . . 5.8 Recognizable sets . . . . . . . . . . . . . 5.9 The natural metric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6 8 8 9 9 11 12 13 13 14 15 16 17 6 Profinite codes 18 6.1 Finite codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 6.2 Codes and submonoids . . . . . . . . . . . . . . . . . . . . . . . . 19 1 7 Uniformly recurrent sets 20 7.1 Uniformly recurrent pseudowords . . . . . . . . . . . . . . . . . . 20 7.2 The J -class J(F ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7.3 Fixed points of substitutions . . . . . . . . . . . . . . . . . . . . 24 8 Sturmian sets and tree sets 26 8.1 Sturmian sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 8.2 Tree sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 9 Return words 29 9.1 Left and right return words . . . . . . . . . . . . . . . . . . . . . 29 9.2 Limit return sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 10 Schützenberger groups 33 10.1 Groups of tree sets . . . . . . . . . . . . . . . . . . . . . . . . . . 34 10.2 Groups of fixed points of morphisms . . . . . . . . . . . . . . . . 35 10.3 Groups of bifix codes . . . . . . . . . . . . . . . . . . . . . . . . . 37 1 Introduction The theory of profinite groups originates in the theory of infinite Galois groups and of p-adic analysis (see [33]). The corresponding theory for semigroups was considerably developed by Jorge Almeida (see [2] for an introduction). The initial motivation has been the theory of varieties of languages and semigroups, put in correspondance by Eilenberg’s theorem. Later, Almeida has initiated the study of the connexion between free profinite semigroups and symbolic dynamics (see [1]). He has shown in [7] that minimal subshifts correspond to maximal J -classes of the free profinite monoid. Moreover, the Schützenberger group of such a J -class is a dynamical invariant of the subshift [4]. Finally, it is shown in [5] that if a minimal system satisfies the tree condition (as defined in [11]), the corresponding group is a free profinite group. In these notes, we give a gentle introduction to the notions used in profinite algebra and develop the link with minimal sets. Our motivation to explore the profinite world is the following. We are interested in the situation where we fix a uniformly recurrent set F on an alphabet A (in general a non rational set, like the set of factors of the Fibonacci word). We want to study sets of the form F ∩ L where L is a rational set on A, that is the inverse image through a morphism ϕ : A∗ → M of a subset of a finite monoid M . The aim is thus to develop a theory of automata observing through the filter of a non rational set. We are particularly interested in sets L of the form 1. L = wA∗ w for some word w ∈ F (linked to the complete return words to w) 2. L = h−1 (H) where h : A∗ → G is a morphism onto a finite group G and H is a subgroup of G. 2 This question has been studied successfully in a number of cases starting with a Sturmian set F in [9] and progessively generalizing to sets called tree sets in [11]. The framework of profinite semigroups allows one to work simultaneously with all rational sets L. This is handled, as we shall see, both through the definition of an inverse limit and through a topology on words. This topology is defined by introducing a distance on words: two words are close if one needs a morphism ϕ on a large monoid M to distiguish them. For example, for any word x, the powers xn! of x will not be distinguished by a monoid with less than n elements. Thus one can consider a limit, called a pseudoword, and denoted xω which has the same image by all morphisms ϕ onto a finite monoid M . The moment of inspiration was the derivation by Ameida and Costa [5] of a result on profinite groups (the Schützenberger group of a tree set is free) which uses the main result of [11]. This result gives a global version of properties like the Finite Index Basis Property, as defined in [12]. One of the goals of this paper is to develop this connexion. We begin with two motivating examples: the first one concerns p-adic and profinite numbers (Section 2) and the second one the Fibonacci morphism (Section 3). We give in Section 5 an introduction to the basic notions concerning profinite semigroups. We have chosen a simplified presentation which uses the class of all semigroups instead of working inside a pseudovariety of semigroups. It simplifies the statements but the proofs work essentially in the same way. In Section 6 we describe results concerning codes in profinite semigroups. The main result, from [29], is that any finite code is a profinite code (Theorem 6.1). In Section 7 we introduce uniformly recurrent pseudowords. We prove a result of Almeida (Theorem 7.2) showing that uniformly recurrent pseudowords can be characterized in algebraic terms, as the J -maximal elements of the free profinite monoid. In Section 8, we recall some basic properties of Sturmian sets and their generalization, the tree sets, introduced in [11]. In Section 9, we prove several results due to Costa and Almeida concening the presentation of the Schützenberger group of a uniformly recurrent set. In Section 10, we prove a new result (Thorem 10.18) concerning the Schützenberger groups of uniformly recurrent sets. Acknowledgements We would like to thank Jorge Almeida and Alfredo Costa for their help in the preparation of this manuscript. It was written in connexion with a workshop held in Marne la Vallée on january 20-22 2016 and gathering around them Marie-Pierre Béal, Valérie Berthé, Francesco Dolce, Pavel Heller, Julien Leroy, Jean-Eric Pin and the autors. 3 2 p-adic numbers We begin with a motivating example (see [24] for an introduction to this subject). Let p be a prime number and let Zp denote the ring of p-adic integers, namely the completion of Z under the p-adic metric. This metric is defined by the norm ( p− ordp (x) if x 6= 0 |x|p = 0 otherwise where ord(x)p (x) is the largest n such that pn divides x. For the topology defined by this metric, Zp is compact. Any element γ ∈ Zp has a unique p-adic expansion γ = c0 + c1 p + c2 p2 + . . . = (. . . c3 c2 c1 c0 )p Note that infinite expansions may represent ordinary integers. For example (. . . 111)2 = −1. We can express the expansion of the elements in Zp as Zp = lim Z/pn Z = {(an )n≥1 ∈ Y Z/pn Z | for all n, an+1 ≡ an mod pn } n≥1 This expresses the ring Zp as a projective limit of the rings Z/pn Z. The direct product of all rings Zp Y Ẑ = Zp p over all prime numbers p is the ring of profinite integers. Its topolology is that induced by the product. As a product of compact spaces, Ẑ is itself compact. It does not depend on a particular number p and shares with all rings Zp the property of being a compact topological space. Thus it is a compact covering of all rings Zp . One may define it equivalently as the projective limit of all cyclic groups Y Ẑ = Z/nZ n≥1 = {(an )n≥1 ∈ Y Z/nZ | for all n|m, am ≡ an mod n} n≥1 or as the projective limit of the cyclic groups Z/n!Z Y Ẑ = Z/n!Z n≥1 = {(an )n≥1 ∈ Y Z/n!Z | for all n, an+1 ≡ an mod n!} n≥1 4 The last representation corresponds to an expansion of the form γ = c1 + c2 2! + c3 3! + . . . = (. . . c3 c2 c1 )! with digits 0 ≤ ci ≤ i. This expansion forms the factorial number system (see [23]). Note that this time −1 = (. . . 321)! which holds because 1 + 2.2! + . . . + n.n! = (n + 1)! − 1, as one may verify by induction on n. The profinite topology on Ẑ can also be defined directly by the norm |x|! = 2−r(x) where r(x) is the largest n such that n! divides x. A sequence converges with respect to this topology if the expansions converge in the usual sense, that is the number of equal digits, starting from the right, tends to infinity. It is possible to define profinite Fibonacci numbers (see [26]). Indeed, Fibonacci numbers are defined by F0 = 0, F1 = 1 and Fn = Fn−1 + Fn−2 . The definition can be extended to negative n by Fn = (−1)n−1 F−n . Then one may extend the function n 7→ Fn to a continuous function from Ẑ into itself. We note that since n! tends to 0 in Ẑ, the sequence Fn! tends to F0 = 0. Similarly Fn!+2 and Fn!+1 tend to 1. We come back to this in the next section. 3 The Fibonacci morphism In the last example, we have seen how a linear recurrent sequence (the Fibonacci numbers) can interestingly be extended to a topological limit. As well known, Fibonacci numbers are the lengths of the Fibonacci words defined inductively by w0 = b, w1 = a and satisfying the recurrence relation wn+1 = wn + wn−1 for n ≥ 1. Then |wn | = Fn+1 . In the same way as one may embed the ring of ordinary integers into the compact ring of profinite integers, we will see that one may extend the Fibonacci sequence to a converging sequence of pseudowords whose lengths are profinite integers. The Fibonacci morphism is the morphism ϕ : A∗ → A∗ with A = {a, b} defined by ϕ(a) = ab and ϕ(b) = a. The sequence of ϕn (a) ϕ(a) = ab ϕ2 (a) ϕ3 (a) = = aba abaab ϕ4 (a) = abaababa ··· is the Fibonacci sequence of words of length equal to the Fibonacci numbers. One has Fn = |ϕn−2 (a)| for n ≥ 2 (and for n ∈ Z with appropriate extensions). The Fibonacci sequence of words converges in the space AN to the Fibonacci infinite word x = abaababa · · · 5 It is a fixed-point of ϕ in the sense that ϕ(x) = x. From another point of view, this sequence is not convergent. Indeed, the terms of the sequence end alternately with a or b and thus can be distinguished by a morphism from A∗ into a monoid with 3 elements. A sequence converging in this stronger sense is ϕn! (a) ϕ(a) = ab 2 ϕ (a) ϕ6 (a) = = aba abaababaabaababaababa ϕ24 (a) = abaababa · · · abaababa ··· The limit in the sense of profinite topology, to be defined below, is a pseudoword denoted ϕω (a) which begins by the Fibonacci infinite word (ϕn (a))n≥0 and ends with the left infinite word (ϕ2n (a))n≥0 . Its length in Ẑ is the limit of the Fibonacci numbers Fn!+2 which is F2 = 1. We shall come back to this interesting property in Example 7.15. 4 Topological spaces, groups and semigroups In this section, we recall the basic definitions of topology and the notion of topological semigroup. 4.1 Topological spaces We begin with an introduction to the basic notions of topology (see [34] for example). A topological space is a set S with a family F of subsets such that (i) it contains ∅ and S, (ii) it is closed under union, (iii) it is closed under finite intersection The elements of F are called open sets. The complement of an open set is called a closed set. A clopen set is both open and closed. For any set S, the discrete topology is the topology for which all subsets are open. For any subset X of a topological set S, the topology induced on X by the topology of S corresponds to the family of open sets X ∩ Y for Y open in S. A limit point of a subset X of a topological space S is a point x such that any open set containing x contains a point of X distinct of x. As a particlular case, it is said to be an accumulation point if every open set containing x contains an infinite number of points of X. The closure of a subset X of S, denoted X̄ is the union of X and all its limit points. It is also the smallest closed set containing X. A set is closed if and only if X = X̄. The set X is dense in S is X̄ = S. 6 The notion of limit point can also be defined for a sequence. A point x is said to be a limit point of the sequence (xn )n≥0 if any open set containing x contains all but a finite number of terms of the sequence. It is said to be an accumulation point of the sequence if every open set containing x contains an infinite number of elements of the sequence. A limit point of the sequence (xn )n≥0 is a limit point of the set {xn | n ≥ 0}. A map ϕ : X → Y between topological spaces X, Y is continuous if for any open set U ⊂ Y , the set ϕ−1 (U ) is open in X. A basis of the family of open sets is a family B of sets such that any open set is a union of elements of B. Given a family of topological spaces Xi indexed by a set I, the product Q topology on the direct product X = i∈I Xi is defined as the coarsest topology such that the projections πi : X → Xi are continuous. A basis Q of the family of open sets is the family of open boxes, that is sets of the form i∈I Ui where the Ui are open sets such that Ui 6= Xi only for a finite number of indices i. Example 4.1 The set AN of infinite words over A is a topological space for the discrete topology on A. It is not a semigroup (a big motivation for introducing pseudowords!). However, there is a well defined product of finite words and infinite words. The open sets are the sets of the form XAN for X ⊂ A∗ . Metric spaces form a vast family of topological spaces. A metric space is a space S with a function d : S × S → R, called a distance, such that for all x, y, z ∈ S, (i) d(x, y) = 0 if and only if x = y, (ii) d(x, y) = d(y, x) (iii) d(x, z) ≤ d(x, y) + d(y, z) (triangle inequality). Any metric space can be considered as a topological space, considering as open sets the unions of open balls Bε (x) = {y ∈ S | d(x, y) < ε} for x ∈ S and ε ≥ 0. For example, the set Rn is a metric space for the Euclidean distance. A topological space is a Hausdorff space if any two distinct points belong to disjoint open sets. A metric space is a Hausdorff space. In a Hausdorff space, every limit point of a set is an accumulation point. A topological space is compact if it is a Hausdorff space and if from any family of open sets whose union is S, one may extract a finite subfamily with the same property. A closed subset of a compact space is compact and, by Tychononoff’s theorem, any product of compact spaces is compact. One may verify that in a compact space every infinite set has an accumulation point (the converse is true in metric spaces). Indeed, if X is an infinite subset of a compact space S without accumulation point, there is for every x ∈ S an open set containing x which contains only a finite number of elements of X. For a finite set F ⊂ X, denote by OF the union of the Ox such that Ox ∩ X = F . Then the sets OF form a family of open sets whose union is S 7 every finite subfamily of which intersects at most finitely many points in X. Thus no finite subfamily may cover S, a contradiction. The clopen sets in a product of compact spaces Si are the finite unions of clopen boxes, that is the sets of the form Πi∈I Ki where each Ki is clopen in Si and Ki = Si for all but a finite number of indices i. 4.2 Topological semigroups A semigroup is a set with an associative operation. A monoid is a semigroup with a neutral element. A topological semigroup is a semigroup S endowed with a topology such that the semigroup operation S × S → S is continuous. A topological monoid is a topological semigroup with identity. Example 4.2 A finite semigroup can always be viewed as a topological semigroup under the discrete topology. Example 4.3 As a less trivial example, the set R of nonnegative real numbers is a topological semigroup for the addition and the interval [0, 1] is a topological semigroup for the multiplication. A compact monoid is a topological monoid which is compact (as a topogical space). Note that we assume a compact space to satisfy Hausdorff separation axiom (any two distinct points belong to disjoint open sets). Note also the following elementary property of compact monoids. Recall that, is a monoid M , u ∈ M is a factor of v ∈ M if v ∈ M uM . 4.3 Topological groups A topological group is a group with a topology such that the multiplication and taking the inverse are continuous operations. It is in particular a topological semigroup. Example 4.4 The set R of real numbers with the usual topology is a topological group under addition. Any closed subgroup is a topological group for the induced topology. Moreover, since multiplication is continuous, the cosets Hg of an open (resp. closed) subgroup are open (resp. closed). Every open subgroup H of a topological group G is also closed since its complement is the union of all cosets Hg for g ∈ G \ H which are open. The following is [33, Lemma 2.1.2]. Proposition 4.5 In a compact group, a subgroup is open if and only if it is closed and of finite index. 8 Proof. Assume that H is an open subgroup of G. We have already seen that H is also closed. The union of the cosets of H form a covering by open sets. Since G is compact, there is a finite subfamily covering G and thus H has finite index. Conversely, if H is a closed subgroup of finite index, then the complement of H is the union of the cosets Hg for g ∈ / H and thus H is open. 5 Profinite semigroups In this section, we introduce the notions of profinite semigroup and of profinite group. We begin with the notion of projective limit. 5.1 Projective limits We want to define profinite semigroups as some kind of limit of finite semigroups in such a way that properties true in all finite semigroups will remain true in profinite semigroups. For this we need the notion of projective limit. A projective system (or inverse system) of semigroups is given by (i) a directed set I, that is a poset in which any two elements have a common upper bound, (ii) for each i ∈ I, a topological semigroup Si , (iii) for each pair i, j ∈ I with i ≥ j, a connecting morphism ψi,j : Si → Sj such that ψi,i is the identity on Si and for i ≥ j ≥ k, ψi,k = ψi,j ◦ ψj,k . Example 5.1 Let I be the set of natural integers ordered by divisibility: n ≥ m if m|n. The family of cyclic groups (Z/nZ)n∈I forms a projective system for the morphisms ψn,m defined by ψn,m (x) = x mod m. In the same way, the family of cyclic groups (Z/n!Z)n≥0 indexed by the set I of natural integers with the natural order is a projective system. The projective limit (or inverse limit ) of this projective system is a topological semigroup S together with morphisms Φi : S → Si such that for all i, j ∈ I with i ≥ j, ψi,j ◦ Φi = Φj , and for any topological semigroup T and morphisms Ψi : T → Si such that for all i, j ∈ I with i ≥ j, ψi,j ◦ Ψi = Ψj , there exists a morphism θ : T → S such that Φi ◦ θ = Ψi for all i ∈ I. The uniqueness of the projective limit can be verified (“as a standard diagram chasing exercise” [2]). The Q existence can be proved by considering the subsemigroup S of the product i∈I Si consisting of all (si )i∈I such that, for all i, j ∈ I with i ≥ j, ψi,j (si ) = sj endowed with the product topology. The maps Φi : S → Si are the projections, that is, if s = (si )i∈I , then Φi (s) = si . 9 T θ Ψj Ψi S Φj Φi ψi,j Si Sj Figure 1: The projective limit. One defines in the same way a projective system of monoids or groups and a projective limit of monoids or groups. For a projective system of monoids, one has to take all morphisms as monoid morphisms and similarly for groups (actually a monoid morphism between groups is already a group morphism). Example 5.2 The projective limit of the family of cyclic groups (Example 5.1) is the group of profinite integers. A variant of this construction allows to specify a fixed generating set for all semigroups. An A-generated topological semigroup is a topological semigroup S together with a mapping ϕ : A → S whose image generates a subsemigroup dense in S. A morphism between A-generated topological semigroups ϕ : A → S and ψ : A → T is a continuous morphism θ : S → T such that θ ◦ ϕ = ψ. We denote θ : ϕ → ψ such a morphism. A ϕ S ψ θ T Figure 2: A morphism of A-generated semigroups A projective system in this category of objects is given by a directed set I and for each i ∈ I, an A-generated topological semigroup ϕi : A → Si , and for each pair i, j ∈ I with i ≥ j, a connecting morphism ψi,j : ϕi → ϕj such that ψi,i is the identity on Si and for i ≥ j ≥ k, ψi,k = ψi,j ◦ ψj,k . The projective limit of this projective system is an A-generated topological semigroup Φ : A → S together with morphisms Φi : Φ → ϕi such that for all i, j ∈ I with i ≥ j, ψi,j ◦ Φi = Φj , and for any A-generated topological semigroup Ψ : A → T and morphisms Ψi : Ψ → ϕi such that for all i, j ∈ I with i ≥ j, ψi,j ◦ Ψi = Ψj , there is a morphism θ : Ψ → Φ such that Φi ◦ θ = Ψi for all i ∈ I. 10 A Ψ Ψ T ϕi θ θ Ψj Ψi ϕi Ψj Ψi S Φ Φj Φi ϕj ψi,j Φj Φi ϕj Si ψi,j Sj Figure 3: The projective limit of a family of A-generated semigroups. 5.2 Profinite semigroups A profinite semigroup is a projective limit of a projective system of finite semigroups. Example 5.3 The ring of profinite integers is a profinite group. A profinite semigroup is compact. Indeed, let S be the projective limit of a family Si of finite semigroups. Then S is a closed submonoid of a direct product of the finite and thus compact semigroups Si and thus is compact. A topological space is connected if it is not the union of two disjoint open sets. A subset of a topological space is connected if it is connected as a subspace, that is it cannot be covered by the union of two disjoint open sets. Every topological space decomposes as a union of disjoint connected subsets, called its conneted components. A topological space is (i) totally disconnected if its connected components are singletons, (iii) zero-dimensional if it admits a basis consisting of clopen sets. The term zero-dimensional is by reference to a notion of dimension in topological spaces (the Lebesgue dimension). The following result, from [2] gives a possible direct definition of profinite semigroup without using projective limits. A topological semigroup is residually finite if for any u, v ∈ S there exists a continuous morphism ϕ : S → M into a finite semigroup M such that ϕ(u) 6= ϕ(v). Theorem 5.4 The following conditions are equivalent for a compact semigroup S. (i) S is profinite, (ii) S is residually finite as a topological semigroup, (iii) S is a closed subsemigroup of a direct product of finite semigroups, 11 (iv) S is totally disconnected, (v) S is zero-dimensional. The explicit construction of the projective limit shows that (i)⇒ (ii) and (ii)⇒ (iii) results from the definitions. For (iii)⇒ (i), see [2]. Since a product of totally disconnected spaces is totally disconnected, we have (iii)⇒ (iv). The equivalence (iv)⇔ (v) holds for any compact space. Finally, the implication (v)⇒ (ii) results from Hunter’s Lemma (see [2]). Corollary 5.5 The class of profinite semigroups is closed under taking closed subsemigroups and direct product. The following is [2, Proposition 3.5]. A subset K of a semigroup S is recognized by a morphism ϕ : S → M if K = ϕ−1 ϕ(K). Proposition 5.6 Let S be a profinite semigroup. A subset K ⊂ S is clopen if and only if it is recognized by a continuous morphism ϕ : S → T into a finite semigroup T . Proof. The condition is sufficient since the set K is the inverse image under a continuous function of a clopen set. Conversely assume that K is clopen. Since S Q is profinite, it is by Theorem5.4 a closed subsemigroup of a direct product i∈I Si of finite semigroups Si . Since K is clopen, it is a finite union of clopen boxes, that is a finite union of sets Πi∈I Ki with Ki = Si for all but a finite number of indices i. Thus there is a finite set F ⊂ I such that being in K only depends on the coordinates in F . Then the projection ϕ : S → Πi∈F Si is a continuous morphism into a finite semigroup which recognizes K. Indeed, for s ∈ ϕ−1 ϕ(K), there is t ∈ K such that ϕ(s) = ϕ(t). Since s and t agree on their F -coordinates, we have s ∈ K. 5.3 Profinite groups A profinite group is a projective limit of a projective system of finite groups. A topological group which is a profinite semigroup is actually a profinite group. Indeed, let S be the projective limit of a family Si of finite semigroups. We may assume that the morphisms Φi : S → Si are surjective. If S is a group, since the image of a group by a semigroup morphism is a group, each Si is a finite group and thus S is a profinite group. Any profinite group is a compact group. Indeed, it is a closed subgroup of a direct product of finite and thus compact groups. A simple example of a compact group which is not profinite is the multiplicative group [0, 1], which has no nontrivial image which is a finite group. A closed subgroup of a profinite group is profinite. Indeed, let H be a closed subgroup of a profinite group G. Then H is a closed subsemigroup of G and thus it is a profinite semigroup by Corollary 5.5, whence a profinite group. 12 A group G is Hopfian if every endomorphism of G which is onto is an isomorphism. The following is [33, Proposition 2.5.2]. It is an analogue property for profinite groups. Proposition 5.7 Let G be a finitely generated profinite group. and let ϕ : G → G be a continuous surjective morphism. Then ϕ is an isomorphism. Proof. We show that Ker(ϕ) is contained in any subgroup of finite index of G. Since G is profinite, it will imply that Ker(ϕ) = {1}. For each finite group F , since G is finitely generated, there is a finite number of morphisms from G into F . Thus there is only a finite number of morphisms from G into a finite group of order n and thus also a finite number of normal subgroups of index n of G. Let Un be the family of normal subgroups of G of index n. Let Φ : Un → Un be defined by Φ(U ) = ϕ−1 (U ). Then Φ is an injective map from a finite set into itself and thus it is a bijection. Let U be a normal subgroup of index n of G. Then, since Φ is surjective, we have U = ϕ−1 (V ) for som V ∈ Un . This implies that Ker(ϕ) ⊂ U , which was to be proved. 5.4 Endomorphisms of profinite semigroups For a topological semigroup, we denote by End(S) the monoid of all its continuous endomorphisms. We consider End(S) as a topological monoid for the pointwise convergence. The following result is [2, Theorem 4.14]. Theorem 5.8 Let S be a finitely generated profinite semigroup. Then End(S) is a profinite monoid. 5.5 The ω operator Recall that an idempotent in a semigroup S is an element e ∈ S such that e2 = e. In a finite semigroup S, the semigroup generated by s ∈ S can be represented as in Figure 4 (the frying pan) with the index i and the period p such that si+p = si . It contains a unique idempotent, which is of the form snp with n such that np ≥ i. Thus, Z/pZ is a maximal subroup of the semigroup generated by s, which coincides with its minimal ideal. In a compact semigroup S, just as in a finite semigroup, the closure of the semigroup generated by an element s ∈ S contains a unique idempotent, denoted sω . If S is profinite, it is the limit of the sequence sn! . We note that in any profinite group, one has xω = 1 since the neutral element is the only idempotent of G. 13 s si+1 s s s s2 s s si ··· s si+p−1 s Figure 4: The semigroup generated by s. In general, the index can be a finite integer i, in which case we have sω+i = s . It can also be infinite and equal to ω, as in the semigroup N̂. Independently, the period can also be finite or infinite. We also note that for any endomorphism ϕ of a profinite monoid S, the endomorphism ϕω is a well defined endomorphism of S. ω 5.6 The free profinite monoid Consider the projective system formed by representatives of isomorphism classes of all A-generated finite monoids (the finite monoids are considered as topological monoids for the discrete topology). For ϕ : A → M and ψ : A → N , one has ϕ ≥ ψ if there is a morphism µ : M → N such that µ ◦ ϕ = ψ. Note that ϕ, ψ, µ have to be surjective. c∗ is the projective The free profinite monoid on a finite alphabet A, denoted A limit of this family. It has the following universal property (see Figure 5). c∗ is such that for any map Proposition 5.9 The natural mapping ι : A → A ϕ : A → M into a profinite monoid there exists a unique continuous morphism c∗ → M such that ϕ̂ ◦ ι = ϕ. ϕ̂ : A A ϕ ι c∗ A ϕ̂ M c∗ . Figure 5: The universal property of A c∗ are called pseudowords and the elements of A c∗ \ A∗ are The elements of A called infinite pseudowords. The free profinite monoid on one generator is commutative. Its image by the map an 7→ n is the monoid of profinite natural numbers , denoted N̂. 14 c∗ is discrete. Indeed, The topology induced A∗ by the profinite topology on A ∗ ∗ if u ∈ A is a word of length n, the quotient of A by the ideal formed by the words of length greater than n is a finite monoid. The congruence class of u for the corresponding quotient is reduced to u. c∗ is a profinite natural number. The The length |x| of a pseudoword x ∈ A c∗ → |x| ∈ N̂ is the continuous morphism λ such that λ(a) = 1 for map x ∈ A every a ∈ A. Example 5.10 The length of xy ω is |x| + ω. 5.7 The free profinite group Likewise, the free profinite group , denoted F\ G(A) is the projective limit of the projective system formed by the isomorphism classes of A-generated finite groups. The topology on the free group F G(A) induced by the topology of F\ G(A) is not discrete. Indeed, for any x in F G(A), the sequence xn! tends to 1. Thus A∗ c∗ onto F\ is dense in F\ G(A) and there is an onto homomorphism from A G(A). The topology induced on F G(A) by the topology of F\ G(A) is also called the Hall topology. It has been indeed introduced by M. Hall in [20]. Note that, since A∗ is embedded in F G(A), we actually have two topologies on A∗ respectively c∗ and F\ induced by the topologies of A G(A). To distinguish them, the first one is called the pro-M topology and the second one the pro-G topology. The first one is strictly stronger than the second one. The pro-G topology on A∗ was introduced by Reutenauer in [32]. The image of the free profinite group on one generator a by the map an 7→ n is the group Ẑ of profinite integers (see Section 2). The length |x| of an element x of F\ G(A) is a profinite integer. The map x ∈ F\ G(A) → |x| ∈ Ẑ is the unique continuous morphism such that |a| = 1 for every a ∈ A. In particular |a−1 | = −1. The following result is from [20, p. 131]. The property is not true for non finitely generated subgroups. The classical example is the commutator subgroup F ′ of a finitely generated free group F , which is known to be a free group of countable infinite rank. In the topology induced on F ′ by the profinite topology on F , there are only countably many open subgroups while the number of open subgroups in the profinite topology of F ′ is uncountable. Proposition 5.11 Any finitely generated subgroup H of F G(A) is closed for the topology induced on F G(A) by the pro-G topology. The proof relies on the following result (see [19, Theorem 5.1] or [28, Proposition 3.10]). Recall that a free factor of a group G is a subgroup H such that G is a free product of H and a subgroup K of G. When G is a free group, this is equivalent to the following property: for some basis X of H there is a subset Y of G such that X ∪ Y is a basis of G. 15 Theorem 5.12 (Hall) For any finitely generated subgroup H of F G(A) and any x ∈ F G(A) \ H, there is a subgroup of finite index K such that H is a free factor of K and x ∈ /K . To deduce Proposition 5.11 from Hall’s Theorem, consider a sequence (xn ) of elements of H converging to some x ∈ F G(A). Suppose that x ∈ / H. By Theorem 5.12, there is a subgroup K of finite index in F G(A) containing H such that x ∈ / K. Thus (xn ) cannot converge to x. It follows from Theorem 5.12 that one has the following result [14, Corollary 2.2] Corollary 5.13 Any injective morphism ϕ : F G(B) → F G(A) between finitely generated free groups extends to an injective continuous morphism ϕ̂ : F\ G(B) → F\ G(A) Proof. Let H = ϕ(F G(B)). Then ϕ is an isomorphism between F G(B) and H b the completion of H which extends to an isomorphism between F\ G(B) and H, with respect to the profinite metric. But, by Proposition 5.11, the subgroup H b is the same as the closure H̄ in F\ is closed in F G(A) and thus H G(A), which \ \ shows that ϕ b is an injective morphism from F G(B) into F G(A). 5.8 Recognizable sets A subset X of a monoid M is recognizable if it is recognized by a morphism into a finite monoid, that is, if there is a morphism ϕ : M → N into a finite monoid N which recognizes X. We also say that X is recognized by ϕ. Proposition 5.14 The following conditions are equivalent for a set X ⊂ A∗ . (i) X is recognizable. c∗ is open and X = X̄ ∩ A∗ . (ii) the closure X̄ of X in A c∗ . (ii) X = K ∩ A∗ for some clopen set K ⊂ A Proof. Assume that X is recognized by a morphism ϕ : A∗ → S from A∗ into a c∗ , there is a unique continuous finite monoid S. By the universal property of A −1 morphism ϕ̂ extending ϕ. Then X = ϕ̂ ϕ(X) is open and satisfies X = X̄ ∩A∗ . Thus (i)⇒ (ii). The implication (ii)⇒ (iii) is trivial. Finally, assume that (iii) c∗ → S into holds. By Proposition 5.6 there exists a continuous morphism ψ : A a finite monoid S which recognizes K. Let ϕ be the restriction of ψ to A∗ . Then X = A∗ ∩ K = A∗ ∩ ψ −1 ψ(K) and so X is recognizable. c∗ wA c∗ = A∗ wA∗ are clopen sets and so As an example, the sets of the form A c∗ = wA∗ . This shows that a pseudoword has a well-defined set are the sets wA of finite factors and a well-defined prefix of every finite length. 16 The analogue of Proposition 5.6 for the pro-G topology is also true (it actually holds in the pro-V topology for any pseudovariety V ). Thus a set X is recognizable by a morphim on a finite group if and only if X = K ∩ A∗ for some clopen set K ⊂ F\ G(A). In condition (ii), one has to add that X̄ ∩ A∗ = X, a condition always satisfied for the closure with respect to the pro-M topology. 5.9 The natural metric The natural metric on a profinite monoid M is defined by ( 2−r(u,v) if u 6= v d(u, v) = 0 otherwise where r(u, v) is the minimal cardinality of a monoid N for which there is a continuous morphism ϕ : M → N such that ϕ(u) 6= ϕ(v). It is actually an ultrametric since it satisfies the condition d(u, w) ≤ min(d(u, v), d(v, w)) stronger than the triangle inequality. Proposition 5.15 For a finitely generated profinite semigroup S, the topology is induced by the natural metric. Proof. Denote Bε (u) = {v ∈ S | d(u, v) < ε}. Let K be a clopen set in S. By Proposition 5.6 there is a continuous morphism ϕ : S → T into a finite semigroup T which recognizes K. Let n = Card(T ) and set ε = 2−n . For s ∈ S and t ∈ Bε (s), we have d(s, t) < ε and thus r(s, t) > n. It implies that ϕ(s) = ϕ(t). Since ϕ recognizes K, we conclude that t ∈ K. Thus the ball Bε (s) is contained in ϕ−1 (t) and thus K is a union of open balls. Thus, since the clopen sets form a basis of the topology, any open set is a union of open balls. Conversely, consider the open ball B = B2−n (u). Since there is a finite number of isomorphism types of semigroups with at most n elements, and since S is finitely generated, there are finitely many kernels of continuous morphisms into such semigroups and so their intersection is a clopen congruence on S. It follows that there exists a continuous morphism ϕ : S → T into a finite semigroup such that ϕ(u) = ϕ(v) if and only if r(u, v) > n. Hence B = ϕ−1 ϕ(B) so that B is open. This leads to an alternative definition of the free profinite monoid. Theorem 5.16 For a finite set A, the completion of A∗ for the natural metric c∗ . is the free profinite monoid A 17 Presentations of profinite semigroups A congruence of a profinite semigroup is called admissible if its classes are closed and the quotient is profinite. In other terms, admissible congruences are the kernels of continuous homomorphisms into profinite monoids. c∗ , the profinite Given a set X and a binary relation R on the monoid X ∗ c semigroup hX | Ri is the quotient of X by the admissible congruence generated by R. It is also said to have the presentation hX | Ri. The same notion holds for groups instead of semigroups and use the notation hX | RiS or hX | RiG to specify if the presentation is as a profinite semigroup or as a profinite group. The following is [4, Lemma 2.2]. Proposition 5.17 Let S be a profinite semigroup and let ϕ be an automorphism c∗ onto S and let Φ be a of S. Let π be a continuous homomorphism from A ∗ c continuous endomorphism of A such that the diagram below commutes. Then Φ c∗ c∗ A A π S π ϕ S S has the presentation hA | Ri with R = {(Φω (a), a) | a ∈ A}. 6 Profinite codes We will expore the notion of a code in the free profinite monoid. 6.1 Finite codes Let A, B be finite alphabets. Any morphism β : B ∗ → A∗ extends uniquely by c∗ → A c∗ . A finite set X ⊂ A c∗ is called continuity to a continuous morphism β̂ : B a profinite code if the continuous extension β̂ of any morphism β : B ∗ → A∗ inducing a bijection from B onto X is injective. The following statement is from [29]. Theorem 6.1 Any finite code X ⊂ A+ is a profinite code. Proof. Let β : B ∗ → A∗ be a coding morphism for X. We have to show c∗ of distinct elements, we have β̂(u) 6= β̂(v), that is, that for any pair u, v ∈ B c∗ → M into a finite monoid M such that there is a continuous morphism α̂ : A c∗ → N be a continuous morphism into a α̂β̂(u) 6= α̂β̂(v). For this, let ψ : B finite monoid N such that ψ(u) 6= ψ(v). Let P be the set of proper prefixes of X and let T be the prefix transducer associated to β (see [10]). Let α be the morphism from A∗ into the monoid of P × P -matrices with elements in N ∪ 0 18 defined as follows. For x ∈ A∗ and p, q ∈ P , we have ( x|y ψ(y) if there is a path p → q α(x)p,q = 0 otherwise. Then M = α(A∗ ) is a finite monoid and α extends to a continuous morphism c∗ → M . Since, by [10, Proposition 4.3.2], the transducer T realizes the α̂ : A decoding function of X, we have αβ(y)1,1 = ψ(y) for any y ∈ B ∗ . By continuity, c∗ . Then α̂ is such that α̂β̂(u) 6= α̂β̂(v). we have α̂β̂(y)1,1 = ψ(y) for any y ∈ B Indeed α̂β̂(u)1,1 = ψ(u) 6= ψ(v) = α̂β̂(v)1,1 . Example 6.2 Let A = {a, b} and X = {a, ab, bb}. The set X is a suffix code. It has infinite deciphering delay since abb · · · = a(bb)(bb) · · · = (ab)(bb)(bb) · · · . Nonetheless, X is a profinite code in agreement with Theorem 6.1. Note that, c∗ , the pseudowords a(bb)ω and ab(bb)ω are distinct (the first one is a limit in A of words of odd length and the second one of words of even length). Theorem 6.1 shows that the closure of the submonoid generated by a finite code is a free profinite monoid. This has been extended to rational codes in [6]. Actually, for any rational code X, the profinite submonoid generated by X is free with basis the closure X̄ of X [6, Corollary 5.7]. Note that we have here a free profinite monoid with infinite basis (see [6] for an extension of the notion of free profinite monoid to infinite alphabets). c∗ is Example 6.3 Let A = {a, b} and X = a∗ b. Then the profinite monoid X v free with basis the uncoutable set X̄ = {a b | v ∈ N̂}. 6.2 Codes and submonoids A submonoid N of a monoid M is called stable if for any u, v, w ∈ M , whenever u, vw, uv, w ∈ N then v ∈ N . It is called right unitary if for every u, v ∈ A∗ , u, uv ∈ N implies v ∈ N . It is well known that a submonoid of A∗ is stable if and only if it is generated by a code and it is unitary if and only if it is generated by a prefix code. The following statement extends these notions to pseudowords. Proposition 6.4 Let N be a recognizable submonoid of A∗ . If N is stable (resp. c∗ is a stable (resp. unitary) submonoid of A c∗ . unitary) its closure in A c∗ . Assume that N is stable. Proof. The set N̄ is clearly a submonoid of A c∗ be such that uv, w, u, vw ∈ N̄ . Let (un ), (vn ) and (wn ) be Let u, v, w ∈ A sequences of words converging to u, v and w respectively with un , wn ∈ N . c∗ and By Proposition 5.14, the closure N̄ of the submonoid N is open in A N = N̄ ∩ A∗ . Since N̄ is open, we have un vn , vn wn ∈ N̄ for large enough n and thus also un vn , vn wn ∈ N . Since N is stable, this implies vn ∈ N for large 19 enough n, which implies v ∈ N̄ . Thus N̄ is stable. The proof when N is unitary is similar. When X is a prefix code, every word w can be written in a unique way w = xp with x ∈ X ∗ and p ∈ A∗ \ XA∗ , a word without any prefix in X. When X is a maximal prefix code, a word which has no prefix in X is a proper prefix of a word in X and thus every word w can be written in a unique way w = xp with x ∈ X ∗ and p a proper prefix of X. This extends to pseudowords as follows. Proposition 6.5 Let X ⊂ A+ be a finite maximal prefix code and let P be c∗ has a unique factorization its set of proper prefixes. Any pseudoword w ∈ A ∗ w = xp with x ∈ X and p ∈ P . Proof. Let (wn ) be a sequence of words converging to w. For each n, we have wn = xn pn with xn ∈ X ∗ and pn ∈ P . Taking a subsequence, we may assume that the sequences (xn ) and (pn ) converge to x ∈ X ∗ and p ∈ P̄ . Since X is finite, P is finite and thus P̄ = P . This proves the existence of a factorization. c∗ and p, p′ ∈ P . To prove the uniqueness, consider xp = x′ p′ with x, x′ ∈ X ′ ′ Then, assuming that p is longer than p , we have p = up and xu = x′ for some u ∈ A∗ . Since X ∗ is unitary, we have u ∈ X ∗ and thus u = ε. 7 Uniformly recurrent sets In this section, we study the closure in the free profinite monoid of a uniformly recurrent set. 7.1 Uniformly recurrent pseudowords Let A be a finite alphabet. A set of finite words on A is factorial if it contains the alphabet A and all the factors of its elements. A factorial set F is recurrent if for any x, z ∈ F there is some y ∈ F such that xyz ∈ F . Recall that an infinite factorial set F of finite words is said to be uniformly recurrent or minimal if for any x ∈ F there is an integer n ≥ 1 such that x is a factor of every word in F of length n. A uniformly recurrent set is obviously recurrent. Note that a uniformly recurrent set is actually minimal for inclusion among the infinite factorial sets. Indeed, assume first that F is uniformly recurrent. Let F ′ ⊂ F be an infinite factorial set. Let x ∈ F and let n be such that x is factor of any word of F of length n. Since F ′ is factorial infinite, it contains a word y of length n. Since x is a factor of y, it is in F ′ . Thus F is mimimal. Conversely consider x ∈ F and let T be the set of words in F which do not contain x as a factor. Then T is factorial. Since F is minimal among infinite factorial sets, T is finite. Thus there is an n such that x is a factor of all words of F of length n. 20 A factorial set F is periodic if it is the set of factors of a finite word w. One may always assume w to be primitive, that is not a power of another word. In this case, the length of w is called the period of F . A periodic set is obviously uniformly recurrent. For an infinite pseudoword w, we denote by F (w) the set of finite factors of w. It is an infinite factorial set. An infinite pseudoword w is uniformly recurrent if F (w) is uniformly recurrent. This is the same definition as the definition commonly used for infinite words. The following is [7, Lemma 2.2]. Proposition 7.1 An infinite pseudoword is uniformly recurrent if and only if all its infinite factors have the same finite factors. Proof. Let w be an infinite pseudoword. Assume first that w is uniformly recurrent. Let u be an infinite factor of w. Let us show that F (u) = F (w). The inclusion F (u) ⊂ F (w) is clear. Conversely, let x ∈ F (w). Since w is uniformly recurrent, x is a factor of every long enough finite factor of w. In particular, x is a factor of every long enough finite prefix of u. Thus x ∈ F (u). Conversely, assume that F (w) = F (u) for all infinite factors u of w. Let v be a finite factor of w. Arguing by contradiction, assume that there are arbitrary long factors of w which do not have v as a factor. This infinite set contains, by Proposition ??, a subsequence converging to some infinite pseudoword u which is also a factor of w, and such that v 6∈ F (u), a contradiction. Recall that the J -order in a monoid M is defined by x ≤J y if x is a factor of y. Two elements x, y are J -equivalent if each one is a factor of the other (this is one of the Green’s relations , see [10]). Replacing the notion of factor by prefix (resp. suffix), one obtains the Rorder (resp. L-order). Thus, two elements x, y of a monoid M are R-equivalent (resp. L-equivalent) if xM = yM (resp. M x = M y). The H-equivalence is the intersection of R and L. In any monoid, one has RL = LR and one denotes D the equivalence RL = LR which is the supremum of R and L. In a compact monoid, one has D = J . The proof is the same as in a finite monoid. It uses the fact that a compact monoid satisfies the stability condition: if x ≤R y and xJ y, then xRy and dually for L. The following result is [7, Theorem 2.6]. It gives an algebraic characterization of uniform recurrence in the free profinite monoid. Theorem 7.2 An infinite pseudoword is uniformly recurrent if and only if it is J -maximal. The proof uses three lemmas. An element s of a semigroup S is regular if there is some x ∈ S such that sxs = s. In a compact semigroup, a J -class contains a regular element if and only if all its elements are regular, if and only if it contains an idempotent. 21 For a pseudoword w, we denote X(w) the set of all infinite pseudowords which are limits of sequences of finite factors of w. Lemma 7.3 Let w be uniformly recurrent pseudoword over a finite alphabet A. 1. Every element of X(w) is a factor of w. c∗ . 2. All elements of X(w) lie in the same J -class of A 3. Every element of X(w) is regular. Proof. Assertion 1 results from the fact that F (w) is closed. Suppose that u, v ∈ X(w). By Proposition 7.1, they have the same set of finite factors. Thus, by Assertion 1, they are J -equivalent. Assume that u is the limit of a sequence (un )n≥0 of finite factors of w. Since w is recurrent, there are finite words vn such that un vn un is a factor of w. If v is an accumulation point of the sequence vn , then uvu is a factor of w which belongs to X(w). By Assertion 2, it is J -equivalent to u. In a compact monoid, by the stability condition, this implies that u and uvu are H-equivalent and thus that u is regular (indeed, uHuvu implies uHu(vu)ω and thus (vu)ω is an idempotent in J(u)). Lemma 7.4 Let w be a uniformly recurrent pseudoword. Each H-class contained in the J -class of w contains some element of X(w). Proof. Let u ∈ J(w). Denote by xn and yn the prefix and the suffix of u of length n. Since w is uniformly recurrent by Proposition 7.1, there is a factor tn of w of length at least 2n having xn as a prefix and yn as a suffix. Taking a subsequence, we may assume that the sequences (xn ), (yn ) and (tn ) converge to x, y, t. Then x, y, t ∈ J(w) by Lemma 7.3(2). Since x ≥R t and t ≤L y, by stability, we obtain uHt. Lemma 7.5 Let u be a uniformly recurrent pseudoword and suppose v is a pseudoword such that uv is still uniformly recurrent. Then u and uv are Requivalent. Proof. Suppose first that v is finite. Let un be the suffix of u of length n. Since u is an infinite factor of uv which is uniformly recurrent, they have the same finite factors by Lemma 7.1. Hence for every n there is some m(n) such that um(n) = xn un vyn . By compactness, we may assume by taking subsequences that the sequences xn , yn , un converge to x, y, u′ respectively. Then by continuity of the multiplication, the sequence um(n) converges to xu′ vy. Since the limits of two convergent sequences of suffixes of the same pseudoword are L-equivalent, we obtain that xu′ vyLu and thus uRu′ v by stability. Since u′ is the limit of a sequence of suffixes of u, there is some factorization of the form u = zu′ . Since the R-equivalence is a left congruence, we finally obtain uv = zu′ vRzu′ = u. Assume next that v is infinite. We assume by contradiction that u >R uv. Let vn be a sequence of finite words converging to v. Taking a subsequence, we 22 may assume that uvn >R u for all n. Thus for each n, we have a factorization vn = xn an yn with an ∈ A such that uRuxn >R uxn an ≥R uv. Since the c∗ is compact we may, up to taking a subsequence, assume alphabet is finite and A that the letter sequence an is constant and the sequences xn , yn converge to x and y respectively. Thus we have p = xay with a ∈ A and uRux >R uxa ≥R uv. On the other hand, since ux and uxa are infinite factors of uv, they are both uniformly recurrent by Proposition 7.1. By the first part, we have uxRuxa, a contradiction. A dual result holds for the L-order. Proof of Theorem 7.2. Suppose first that w is J -maximal as an infinite pseudoword. If v is an infinite factor of w, it is J -equivalent to w. Hence v, w have the same factors and, in particular, the same finite factors. By Proposition 7.1, w is uniformly recurrent. c∗ \ A∗ are such that u ≥J w with w Suppose conversely that u, w ∈ A c∗ . By the dual of Lemma 7.5, uniformly recurrent. Set w = puq with p, q ∈ A we have puLu. And by Lemma 7.5, we have puRpuq. Thus u and w are J equivalent. c∗ is made of one H-class. The J -class of Example 7.6 The J -class of aω in A ω (ab) has four H-classes. It is represented in Figure 6. (ab)ω (ab)ω a b(ab)ω (ba)ω Figure 6: The J -class of (ab)ω . 7.2 The J -class J(F ) Let F be a uniformly recurrent set of finite words on the alphabet A. The c∗ is also factorial (see [3, Proposition 2.4]). The proof relies closure F̄ of F in A on the following useful lemma from [3, Lemma 2.5]. c∗ and every sequence (wn ) converging to uv, Lemma 7.7 For every u, v ∈ A there are sequences (un ), (vn ) such that lim un = u, lim vn = v and (un vn ) is a subsequence of (wn ). The set of two-sided infinite words with all their factors in F is denoted X(F ). It is closed for the product topology of AZ . It is also invariant by the shift σ : AZ → AZ defined by y = σ(x) if yn = xn+1 for any n ∈ Z. Such a 23 closed and shift invariant set is called a subshift . It is classical that a subshift is of the form X(F ) for some uniformly recurrent set if and only if it is minimal (see [27] for example). By the results of Section 7, all the infinite pseudowords in the closure F̄ of F are J -equivalent. We denote by J(F ) their J -class. Example 7.8 The Fibonacci morphism ϕ is primitive. The set F of factors of the words ϕn (a) for n ≥ 1 is called the Fibonacci set . It contains the infinitely recurrent pseudowords ϕω (a) and ϕω (b). For a uniformly recurrent set F , the J -class J(F ) can be described as follows. c∗ , denote by → x the right infinite word whose finite prefixes are those For x ∈ A ← of x. Symmetrically, x is the left inifnite word whose finite suffixes are those of x. The following is [3, Lemma 6.6]. Proposition 7.9 For a uniformly recurrent set F , two words u, v ∈ J(F ) are ← ← → → R-equivalent if and only if u = v and L-equivalent if and only if u = v It follows from this that w ∈ J(F ) belongs to a subgroup if and only if the ← → two-sided infinite word w · w has all its factors in F . Indeed, the finite factors of w2 are those of w plus the the products uv where u is a finite suffix of w and v is a finite prefix of w [3, Lemma 8.2]. Thus the maximal subgroups of J(F ) are in bijection with the elements of the set X(F ) of two-sided infinite words with all their factors in F . For x ∈ X(F ), we denote by Hx the maximal subgroup corresponding to x. Example 7.10 Let F be the Fibonacci set and let w = ϕω (a). The right ← → infinite word w is the Fibonacci word. The left infinite word w is the word with → ← suffixes ϕ2n (a) (see Section 3). The two sided infinite word w · w is a fixed point of ϕ2 . Example 7.11 let A = {a, b} and let ϕ : A∗ → A∗ be defined by ϕ(a) = ab and ϕ(b) = a3 b. Let F be the set of factors of ϕω (a). Since ϕ is primitive, F is uniformly recurrent. The pseudowords ϕω (a) and ϕω (b) belong to the same → → ← ← H-class of J(F ). Indeed, we have ϕω (a)=ϕω (b) and ϕω (a)=ϕω (b). 7.3 Fixed points of substitutions Let A be a finite alphabet. Let ϕ : A∗ → A∗ be a morphism, also called a substitution over A. Then ϕ extends uniquely by continuity to a morphism still c∗ → A c∗ . The monoid End(A c∗ ) is profinite by Theorem 5.8. Thus denoted ϕ : A ω the morphism ϕ is well defined as the unique idempotent in the closure of the semigroup generated by ϕ. A substitution ϕ : A∗ → A∗ is said to be primitive if there is an integer n such that all letters appear in every ϕn (a) for a ∈ A. 24 A fixed point of a substitution ϕ is an infinite word x ∈ AN such that ϕ(x) = x. As well known, a fixed point of a primitive substitution is uniformly recurrent (see [17, Proposition 1.3.2] for example). The following is a particular case of [7, Theorem 3.7] (in which the notion weakly primitive substitution is introduced). Theorem 7.12 Let ϕ be a primitive substitution over a finite alphabet A. Then the pseudowords ϕω (a) with a ∈ A are uniformly recurrent and are all J equivalent. Proof. Let u be a finite factor of ϕω (a) for some a ∈ A. Then there is an integer N such that u is a factor of any factor of length N of ϕn (b) for all b ∈ A. Thus u is a factor of any finite factor of length N of any ϕω (b). This proves both claims. Example 7.13 The Fibonacci morphism ϕ : a 7→ ab, b 7→ a is primitive. Thus the pseudowords ϕω (a) and ϕω (b) are uniformly recurrent and J -equivalent. Example 7.14 The Thue-Morse substitution is the morphism τ : a 7→ ab, b 7→ ba. It is primitive. The unique fixed point x = abbabaab · · · of τ beginning with a is called the Thue-Morse infinite word. The set of its factors is called the Thue-Morse set. Given a substitution ϕ over A, we denote by ϕG the endomorphism of F\ G(A) c∗ → F\ such that the following diagram commutes where π : A G(A) denotes the ϕ c∗ c∗ A A π F\ G(A) π ϕG F\ G(A) canonical projection. For a substitution ϕ over A, the endomorphism ϕω G is the identity if and only if ϕ is invertible (as a map from F G(A) into itself). Indeed, if ϕ is an automorphism of F G(A), then its extension to F\ G(A) is also an automorphism. But then ϕω G is the identity since in a group one has xω = 1 for any element x. Conversely, if ϕω G is the identity, then ϕ is a bijection from F G(A) onto itself and thus it is an automorphism of F G(A). Example 7.15 Let A = {a, b} and let ϕ : a 7→ ab, b 7→ a be the Fibonacci morphism. Then ϕ is an automorphism of F G(A) since ϕ−1 : a 7→ b, b 7→ b−1 a. ω Accordingly ϕω G is the identity. In particular, one has ϕG (a) = a. This explains in a simple way that the length of ϕω (a) is equal to 1 (see Section 3). G 25 8 Sturmian sets and tree sets Let F be a factorial set on the alphabet A. For w ∈ F , we denote LF (w) = {a ∈ A | aw ∈ F }, RF (w) EF (w) = {a ∈ A | wa ∈ F }, = {(a, b) ∈ A × A | awb ∈ F } and further ℓF (w) = Card(LF (w)), rF (w) = Card(RF (w)), eF (w) = Card(EF (w)). For w ∈ F , we denote mF (w) = eF (w) − ℓF (w) − rF (w) + 1. A word w is called neutral if mF (w) = 0. A factorial set F is neutral if every word in F is neutral. Example 8.1 The Fibonacci set is neutral as any Sturmian set. Example 8.2 The Thue-Morse set T is not neutral. Indeed, since A2 ⊂ T , one has mT (ε) = 1. Example 8.3 Let ϕ : a 7→ ab, b 7→ a3 b be as in Example 7.11. Let F be the set of factors of ϕω (a). It is not neutral since m(a) = 1 and m(aa) = −1. A neutral set has complexity kn + 1 where k = Card(A) − 1 (see [11]). 8.1 Sturmian sets We recall here some notions concerning episturmian words (see [9] for more details and references). A word w is right-special (resp. left-special ) if ℓF (w) ≥ 2 (resp. rF (w) ≥ 2). A right-special (resp. left-special) word w is strict if ℓF (w) = Card(A) (resp. rF (w) = Card(A)). In the case of a 2-letter alphabet, all special words are strict. By definition, an infinite word x is episturmian if F (x) is closed under reversal and if F (x) contains, for each n ≥ 1, at most one word of length n which is right-special. Since F (x) is closed under reversal, the reversal of a right-special factor of length n is left-special, and it is the only left-special factor of length n of x. A suffix of a right-special factor is again right-special. Symmetrically, a prefix of a left-special factor is again left-special. As a particular case, a strict episturmian word is an episturmian word x with the two following properties: x has exactly one right-special factor of each length and moreover each right-special factor u of x is strict, that is satisfies the inclusion uA ⊂ F (x) (see [15]). 26 For a ∈ A, denote by ψa the morphism of A∗ into itself, called elementary morphism, defined by ( ab if b 6= a ψa (b) = a otherwise Let ψ : A∗ → End(A∗ ) be the morphism from A∗ into the monoid of endomorphisms of A∗ which maps each a ∈ A to ψa . For u ∈ A∗ , we denote by ψu the image of u by the morphism ψ. Thus, for three words u, v, w, we have ψuv (w) = ψu (ψv (w)). A palindrome is a word w which is equal to its reversal. Given a word w, we denote by w(+) the palindromic closure of w. It is, by definition, the shortest palindrome which has w as a prefix. The iterated palindromic closure of a word w is the word Pal(w) defined recursively as follows. One has Pal(1) = 1 and for u ∈ A∗ and a ∈ A, one has Pal(ua) = (Pal(u)a)(+) . Since Pal(u) is a proper prefix of Pal(ua), it makes sense to define the iterated palindromic closure of an infinite word x as the infinite word which is the limit of the iterated palindromic closure of the prefixes of x. Justin’s Formula is the following. For every words u and v, one has Pal(uv) = ψu (Pal(v)) Pal(u) . This formula extends to infinite words: if u is a word and v is an infinite word, then Pal(uv) = ψu (Pal(v)) . (1) There is a precise combinatorial description of standard episturmian words (see e.g. [21, 18]). Theorem 8.4 An infinite word s is a standard episturmian word if and only if there exists an infinite word ∆ = a0 a1 · · · , where the an are letters, such that s = lim un , n→∞ where the sequence (un )n≥0 is defined by un = Pal(a0 a1 · · · an−1 ). Moreover, the word s is episturmian strict if and only if every letter appears infinitely often in ∆. The infinite word ∆ is called the directive word of the standard word s. The description of the infinite word s can be rephrased by the equation s = Pal(∆) . As a particular case of Justin’s Formula, one has un+1 = ψa0 ···an−1 (an )un . The words un are the only prefixes of s which are palindromes. 27 (2) Example 8.5 The Fibonacci word is a standard episturmian word with directive word ∆ = ababa · · · . Indeed, by Formula (2) one has Pal(∆) = ψab (Pal(∆)). Since ψab = ϕ2 where ϕ is the Fibonacci morphism, we have Pal(∆) = ϕ2 (Pal(∆)). This shows that Pal(∆) is the Fibonacci word. We note that for n ≥ 1, one has |un+1 | ≤ 2|un |. (3) Indeed, set un = u′n ba. If an = a, the word u′n baabũ′n is palindrome of length at most 2|un |. If an = b, then u′n babu˜′n is a palindrome of length strictly less than 2|un |. Example 8.6 As a consequence of Equation (2), when s is the Fibonacci word and ϕ the Fibonacci morphism, we have for every n ≥ 0 un+1 = ϕn (a)un . (4) In view of Equation (2), we need to show that ϕn (a) = ψa0 ···an−1 (an ). By Example 8.5, the directive word of s is ababa · · · . If n is even, then ψa0 ···an−1 (an ) = ψ(ab)n/2 (a) = ϕn (a) since ψab = ϕ2 . If n is odd, then ψa0 ···an−1 (an ) = ψ(ab)(n−1)/2 a (b) = ϕn−1 (ab) = ϕn (a) and the property is true also. As a consequence, we have in the prefix ordering for every n ≥ 0, un < ϕn+1 (a). (5) Indeed, both words are prefixes of the Fibonacci word and it is enough to compare their lengths. For n = 0, we have |u0 | = 0 and |ϕ(a)| = 2. Next, for n ≥ 1, we have by (4), un = ϕn−1 (a)un−1 . Arguing by induction, we obtain |un | < |ϕn−1 (a)| + |ϕn (a)| = |ϕn+1 (a)|. 8.2 Tree sets Let F be a factorial set of words. For w ∈ F , we consider the set EF (w) as an undirected graph on the set of vertices which is the disjoint union of LF (w) and RF (w) with edges the pairs (a, b) ∈ EF (w). This graph is called the extension graph of w. A factorial set F is called biextendable if every w ∈ F can be extended on the left and on the right, that is such that ℓF (w) > 0 and rF (w) > 0. A biextendable set is a tree set if for every w ∈ F , the graph EF (w) is a tree. A tree set is neutral. More generally one also defines a connected (resp. acyclic), as a biextendable set F such that for every w ∈ F , the graph EF (w) is connected (resp. acyclic). Thus a biextendable set is a tree set if and only if it is both connected and acyclic. Example 8.7 The Fibonacci set is a tree set. This follows from the fact that it is a Sturmian set (see [11]) and that every Sturmian set is a tree set. 28 Example 8.8 The Tribonacci set is the set of factors of the fixed point of the morphism ϕ : a 7→ ab, b 7→ ac, c 7→ a. It is a also a tree set (see [11]). The graph E(ε) is represented in Figure 7. a c b b c a Figure 7: The extension graph of ε in the Tribonacci set. Example 8.9 Let ϕ : a 7→ ab, b 7→ a3 b be as in Example 7.11. Let F be the set of factors of ϕω (a). The graphs E(a) and E(aa) are shown in Figure 8. The first graph has a cycle of length 4 and the second one has two connected a a a a b b b b Figure 8: The extension graphs E(a) and E(aa). components. Thus F is not a tree set (it is not either an acyclic or a connected set, as defined in [11]). Example 8.10 Let T be the Thue-Morse set (see example 7.14). The set F is not a tree set since ET (ε) is the complete bipartite graph K2,2 on two sets with 2 elements. 9 Return words In this section, we introduce return words. We begin with the classical notion of left and right return words in factorial sets. We then develop a notion of limit return sets for pseudowords. 9.1 Left and right return words Let F be a factorial set. A return word to x ∈ F is a nonempty word w ∈ F such that xw begins and ends by x but has no internal factor equal to x. We denote by RF (x) the set of return words to x. For x ∈ F , we denote ΓF (x) = {w ∈ F | xw ∈ F ∩ A∗ x}. 29 Thus RF (x) is the set of nonempty words in ΓF (x) without any proper prefix in ΓF (x). Note that ΓF (x) is a right unitary submonoid of A∗ . One also defines a left return word to x ∈ F as a nonempty word such that wx begins and ends with x but has no internal factor equal to x. We denote by R′F (x) the set of left return words to x. One has obviously R′F (x) = xRF (x)x−1 . Example 9.1 Let F be the Fibonacci set. The sets of right and left return words to a are RF (a) = {a, ba} and R′F (a) = {a, ab}. Similarly, RF (b) = {ab, aab} and R′F (b) = {ba, baa}. Example 9.2 Let F be a periodic set. Let w be a primitive word of length n such that F = F (w∗ ). Then, for any word x ∈ F of length at least n, the set RF (w) is reduced to one word of length n. The following is [13, Equation (4.2)]. Proposition 9.3 Let F be a factorial set. For any x ∈ F , one has ΓF (x) = RF (x)∗ ∩ x−1 F . Proof. If a nonempty word w is in ΓF (x) and is not in RF (x), then w = uv with u ∈ ΓF (x) and v nonempty. Since γF (x) is right unitary, we have v ∈ ΓF (x), whence the conclusion w ∈ RF (x)∗ by induction on the length of w. Moreover, one has xw ∈ F and thus w ∈ x−1 F . Conversely, assume that w is a nonempty word in RF (x)∗ ∩ w−1 F . Set w = uv with u ∈ RF (x) and v ∈ RF (x)∗ . Then xw = xuv ∈ A∗ xv ⊂ A∗ x and xw ∈ F . Thus w ∈ ΓF (x). Note that, as a consequence, for x, y ∈ F such that xy ∈ F , we have RF (xy) ⊂ RF (y)∗ . (6) Indeed, if w ∈ RF (xy), then xyw ∈ F ∩ A∗ xy implies yw ∈ F ∩ Ay and thus the result follows since ΓF (y) ⊂ RF (y)∗ by Proposition 9.3. The dual of Proposition 9.3 and of Equation (6) hold for left return words. By a result of [8], in a uniformly recurrent neutral set, one has Card(RF (x)) = Card(A) (7) for every x ∈ F . Example 9.4 Let ϕ : a 7→ ab, b 7→ a3 b be as in Example 7.11. Let F be the set of factors of ϕω (a). One has RF (a) = {a, ba} but RF (aa) = {a, babaa, babababaa}. Thus the number of return words is not constant in a uniformly recurrent set which is not neutral. There is an explicit form for the return words in a Sturmian set (see [21, Theorem 4.4, Corollaries 4.1 and 4.5]). 30 Proposition 9.5 Let s be a standard strict episturmian word over A, let ∆ = a0 a1 · · · be its directive word, and let (un )n≥0 be its sequence of palindrome prefixes. (i) The left return words to un are the words ψa0 ···an−1 (a) for a ∈ A. (ii) For each factor u of s, let n be the minimal integer such that u is a factor of un . There there is a unique word z such that zu is a prefix of un and the left return words to u are the words z −1 yz, where y ranges over the left return words to un . Example 9.6 Let ϕ be the Fibonacci morphism and let F be the Fibonacci set. We have for n ≥ 1, R′F (ϕ2n (aa)) = {ϕ2n (a), ϕ2n+1 (a)}. (8) For example, ϕ2 (aa) = abaaba and R′F (ϕ2 (aa)) = {aba, abaab}. Note that Equation (8) does not hold for n = 0. Indeed, R′F (aa) = {aab, aabab} = 6 {a, ab}. To show (8), we first observe that in the prefix order for n ≥ 1, u2n < ϕ2n (aa) ≤ u2n+1 . (9) u2n+1 = ϕ2n (a)u2n , (10) Indeed, one has by (4) and, since n ≥ 1, u2n = ϕ2n−1 (a)u2n−1 = ϕ2n−1 (a)ϕ2n−2 (a)u2n−2 = ϕ2n (a)u2n−2 . (11) Thus u2n+1 = ϕ2n (a)u2n = ϕ2n (aa)u2n−2 . This proves the second inequality in (9). Since |u2n | ≤ 2|u2n−1 | by (3), and |u2n−1 | < |ϕ2n (a)| by (5), we obtain |u2n | < 2|ϕ2n (a)| and this proves the first inequality . By (9), the minimal integer m such that ϕ2n (aa) is a factor of um is m = 2n + 1. Thus, by Proposition 9.5 (ii), one has R′F (ϕ2n )(aa) = R′F (u2n+1 ). On the other hand, by Proposition 9.5 (i), we have R′F (u2n+1 ) = {ψ(ab)n a (a), ψ(ab)n a (b)}. Since ψ(ab)n a (a) = ϕ2n (a) and ψ(ab)n a (b) = ϕ2n (ab) = ϕn+1 (a), this proves (8). The following is [11, Theorem 4.5]. It shows that in a tree set, a property much stronger than Equation (7) holds. Theorem 9.7 Let F be a uniformly recurrent tree set. For any x ∈ F , the set RF (x) is a basis of F G(A). The proof uses Equation (7) and the following result [11, Theorem 4.7]. Theorem 9.8 Let F be a uniformly recurrent connected set. For any w ∈ F , the set RF (w) generates the free group F G(A). Example 9.9 Let F be the Tribonacci set on A = {a, b, c}. Then RF (a) = {a, ba, ca}, which is easily seen to be a basis of F G(A). 31 9.2 Limit return sets Let k ≥ 1 be an integer. A recurrent set F is k-bounded if every x ∈ F has at most k return words. The set F is bounded if it is k-bounded for some k. Thus, by Equation (7), a neutral set is k-bounded with k = Card(A). Clearly, any bounded set is uniformly recurrent. There exist uniformly recurrent sets which are not bounded (see [16, Example 3.17]). Let F be a k-bounded set. Consider an element x which belongs to a group in J(F ). Let rn be a sequence of finite prefixes of x strictly increasing for the prefix order. Similarly, let ℓn be a sequence of finite suffixes of x stricly increasing for the suffix order. Since x2 ∈ J(F ), we have ℓn rn ∈ F . Let Rn = rn RF (ℓn rn )rn−1 . Up to taking a subsequence, we may assume that the set Rn has a fixed number ℓ ≤ k of elements rn,1 , . . . rn,ℓ and that the sequence (rn,1 , . . . , rn,ℓ ) is convergent ℓ c∗ . Its limit R is called a limit return set to x. The sequence (ℓn , rn , Rn ) in A is called an approximating sequence for R. We note that Rn+1 ⊂ R∗n . (12) Indeed, set rn+1 = rn sn . Since ℓn+1 rn is a prefix of ℓn+1 rn+1 , we have by the dual of (6) the inclusion R′F (ℓn+1 rn+1 ) ⊂ R′F (ℓn+1 rn )∗ . Thus RF (ℓn+1 rn+1 ) −1 −1 = rn+1 ℓn+1 R′F (ℓn+1 rn+1 )ℓn+1 rn+1 , −1 −1 ⊂ rn+1 ℓn+1 R′F (ℓn+1 rn )∗ ℓn+1 rn+1 ⊂ sn−1 RF (ℓn+1 rn )∗ sn . Since ℓn rn is a suffix of ℓn+1 rn , we have by (6) the inclusion RF (ℓn+1 rn ) ⊂ RF (ℓn rn )∗ . Thus we obtain Rn+1 −1 = rn+1 RF (ℓn+1 rn+1 )rn+1 , −1 ⊂ rn+1 sn−1 RF (ℓn+1 rn )∗ sn rn+1 , ⊂ rn RF (ℓn rn )∗ rn−1 = R∗n . Example 9.10 Let ϕ be the Fibonacci morphism and F be the Fibonacci set. We will show that {ϕω (a), ϕω (ba)} is a limit return set to x = ϕω (a). For this, consider the sequence ℓn = rn = ϕ2n (a). The sequence is increasing both for the prefix and the suffix order and its terms are both prefixes and ′ suffixes of x. The set Rn = rn RF (ℓn rn )rn−1 = ℓ−1 n RF (ℓn rn )ℓn is by (8) Rn = ϕ2n (a)−1 {ϕ2n (aa), ϕ2n+1 (a)}ϕ2n (a) = {ϕ2n (a), ϕ2n (b)ϕ2n (a)} = {ϕ2n (a), ϕ2n (ba)}. The sequence (ϕn! (a), ϕn! (ba)} converges to {ϕω (a), ϕω (ba)}, which proves the claim. 32 The following example shows that in degenerated cases, a limit return set may contain finite words. Example 9.11 Let F be a periodic set of period n. By Example 9.2 a return set to any word of length larger than n is formed of one word of length n. Thus any return set to a pseudoword x ∈ J(F ) is formed of one word of length n. 10 Schützenberger groups Let M be a topological monoid. For an element x ∈ M , we denote by H(x) the H-class of x. Let H be an H-class of M . Set T (H) = {x ∈ M | Hx = H}. Each x ∈ T (H) defines a map ρx : H → H defined by ρx (h) = hx. The set of the translations ρx for x ∈ T (H) is a topological group acting by permutations on H, denoted Γ(H). The groups corresponding to different H-classes contained in the same J -class J are continuously isomorphic and the equivalence called the Schützenberger group of J, denoted G(J). If J is a regular J -class, any H-class of J which is a group is isomorphic to G(J). Indeed, H ⊂ T (H) and the restriction to H of the mapping ρ : x ∈ T (H) → ρx ∈ Γ(H) is an isomorphism (see [25] for a more detailed presentation). The following is [4, Proposition 5.2]. Theorem 10.1 Let F be a non-periodic bounded set. Let x ∈ J (F ) be such that H(x) is a group and let R be a limit return set to x. Then H(x) is the closure of the semigroup generated by R. Note that Theorem 10.1 does not hold without the hypothesis that F is nonperiodic (see Example 9.11). This fundamental result is the key to understand the role played by the group generated by return words. Actually, let (ℓn , rn , Rn ) be an approximating sequence for R. Then, since Rn+1 ⊂ R∗n by (12), we have R∗ = ∩n≥0 R∗n . Thus the group H(x) is the intersection of the submonoids R∗n and each of them is the closure of the submonoid generated by Rn . Example 10.2 Let ϕ be the Fibonacci morphism and let F be the Fibonacci set. The H-class of the pseudoword x = ϕω (a) is a group. Indeed, H(x) contains the idempotent ϕω (aω ). The group H(x) is the closure of the semigroup generated by x and y = ϕω (ba), that is, isomorphic to F[ (A). The following statement is a generalization of [5, Theorem 6.5]. We denote by G(F ) the Schützenberger group of J(F ). c∗ → G be a Theorem 10.3 Let F be a non-periodic bounded set and let f : A ∗ c continuous morphism from A onto a profinite group G. The following conditions are equivalent. 33 (i) The restriction of f to G(F ) is surjective. (ii) For every w ∈ F , the submonoid f (RF (w)∗ ) is dense in G. Proof. Let x ∈ J(F ) be such that H(x) is a group. Let (ℓn , rn ) be a sequence of pairs of suffixes and prefixes of x of strictly increasing length. Taking a subsequence, we may assume that Rn = rn RF (ℓn rn )rn−1 converges to the limit return set R. Since, by (12) we have Rn+1 ⊂ R∗n , the semigroup generated by R is ∩n≥0 R∗n . (i) implies (ii). Assume by contradiction that f (RF (w)∗ ) is not dense in G. Since w is a factor of x, we may assume that r0 ends with w. Then RF (ℓ0 r0 ) ⊂ RF (w)∗ . This implies that f (RF (ℓ0 r0 )∗ ) is not dense in G. Since f (R∗0 ) is conjugate to f (RF (ℓ0 r0 )∗ ), the same holds for f (R∗0 ). Thus f (R∗ ) is not dense in G. But by Theorem 10.1, H(x) is the closure of the semigroup generated by R. We conclude that f (H(x)) is not dense in G. (ii) implies (i). Since H(x) = R∗ = ∩n≥0 R∗n , we have f (H(x)) = ∩n≥0 f (R∗n ). But Rn is conjugate to R(ℓn rn ) and thus by (ii), each f (R∗n ) is dense in G. Thus f (H(x)) = G. Corollary 10.4 Let F be a non-periodic bounded set on the alphabet A. The following conditions are equivalent. (i) The restriction to any maximal subgroup of J(F ) of the natural projection c∗ → F\ pG : A G(A) is surjective. (ii) For each w ∈ F the set RF (w) generates the free group F G(A). Proof. We apply Theorem 10.3 with f being the identity. Let x ∈ J(F ) be such that H(x) is a group. (i) implies (ii). Let w ∈ F . There is a maximal subgroup of J(F ) contained in the topological closure of RF (w)∗ in the free profinite monoid (indeed, RRF (ln rn )∗ is a subset of RF (w)∗ , for some suitable sequence of words ln rn as defined some pages before, for infinitely many n). It follows that the topological closure of RF (w)∗ in the free profinite group generated by A is the whole free profinite group. This implies that RF (w) generates F G(A). (ii) implies (i). By Theorem 10.3, the restriction to H(x) of the projection c∗ → F\ pG : A G(A) is surjective. 10.1 Groups of tree sets We now consider uniformly recurrent tree sets. Note that a uniformly recurrent tree set F is non-periodic. Indeed, if F is the set of factors of w∗ with w primitive, then RF (w) = {w} since w does not overlap nontrivially w2 . Thus F is not a tree set by Theorem 9.7. Theorem 10.5 Let F be a uniformly recurrent tree set. Then the following assertions hold. 34 1. The group G(F ) is the free profinite group on A. More precisely, the restriction to any maximal subgroup of J(F ) of the natural projection pG : c∗ → F\ A G(A) is an isomorphism. 2. Let H be a subgroup of finite index n in F G(A). For any maximal group G in J(F ), G ∩ p−1 G (H̄) is a subgroup of index n of G. Proof. 1. This results directly from Corollary 10.4 since by Theorem 9.7, RF (w) is a basis of F G(A) for every w ∈ F when F is a uniformly recurrent tree set. Since H(x) is the closure of a semigroup generated by Card(A) elements, there is a continuous morphism ψ from F\ G(A) onto H(x). Thus pG ◦ ψ is continuous \ surjective morphism from F G(A) onto itself. By Proposition 5.7, it implies that it is an isomorphism. This proves the first assertion. 2. This results from Corollary 10.4 since the restriction α of pG to G is an −1 (H̄). isomorphism from G onto F\ G(A) and G ∩ p−1 G (H̄) = α Example 10.6 Let F be the Fibonacci set. We have seen that G(F ) is the free profinite group on A (Example 9.10). 10.2 Groups of fixed points of morphisms Let ϕ : A∗ → A∗ be a primitive substitution and let F (ϕ) be the set of factors of a fixed point of ϕ. We denote by J(ϕ) the closure of F (ϕ) and by G(ϕ) the Schützenberger group of J(ϕ). A connexion for ϕ is a word ba with b, a ∈ A such that ba ∈ F (ϕ), the first letter of ϕω (a) is a and the last letter of ϕω (b) is b. Every primitive substitution has a connexion [7, Lemma 4.1]. A connective power of ϕ is a finite power ϕ̃ of ϕ such that the first letter of ϕ̃(a) is a, the last letter of ϕ̃(b) is b. We denote Xϕ (a, b) = aRF (ba)a−1 . The set Xϕ (a, b) is a code. Example 10.7 Let τ : a 7→ ab, b 7→ ba be the Thue-Morse morphism. The word aa is a connection for τ and τ̃ = τ 2 is a connecting power of τ . The set X = Xτ (a, a) has four elements x = abba, y = ababba, z = abbaba and t = ababbaba. The following is [4, Theorem 5.6]. Theorem 10.8 Let ϕ be a non periodic primitive substitution. Consider a connexion ba for ϕ and a connective power ϕ̃. The intersection Hba of the R-class of ϕω (a) with the L-class of ϕω (b) is a group and Hba = ϕ̃(Hba ) = ϕω (Hba ). The proof uses the notion of recognizablity of a substitution. We give the definition in the following form (see [22] for the equivalence with equivalent forms). Given a morphism ϕ : A∗ → A∗ , a pair (q, r) of words in A∗ is synchronizing if for any p, s, t ∈ A∗ such that ϕ(t) = pqrs, one has t = uv with 35 u v ϕ p ϕ q r s Figure 9: A synchronizing pair. ϕ(u) = pq and ϕ(v) = rs (see Figure 9). Let F be the set of factors of a fixed point of ϕ. The morphism ϕ is recognizable if there is an integer n ≥ 1 such that for any x, y ∈ F ∩ An such that xy ∈ F , the pair (ϕ(x), ϕ(y)) is synchronizing. By a result of Mossé [30], any non-periodic primitive substitution is recognizable (see [22] for a new version of the proof). The following is the main result if [4] (Theorem 6.2). Theorem 10.9 Let ϕ be a non-periodic primitive substitution over the alphabet A. Let ba be a connexion of ϕ and let Xϕ = Xϕ (a, b). Then G(ϕ) admits the presentation hX | ϕ̃ω X,G (x) = x, x ∈ XiG . Example 10.10 Let τ : a 7→ ab, b 7→ ba be the Thue-Morse morphism. We have seen in Example 10.7 that the word aa is a connection for τ and τ̃ = τ 2 is a connecting power of τ . The set X = Xτ (a, a) has four elements x = abba, y = ababba, z = abbaba and t = ababbaba. By Theorem 10.9, the group G(τ ) is ω the group generated by X with the relations τX,G (u) = u for u ∈ X. Actually, ω ω−1 ω ω since τ (y)τ (x)τ (z) = τ (t), the relation xy −1 z = t is a consequence of the relations above and thus G(ϕ) is generated by x, y, z. Let f : A∗ → G be a morphism from A∗ into a finite group G and let ϕ : A∗ → A∗ be a morphism. We denote by ϕG the map from GA into itself defined as follows. Consider h ∈ GA . We may naturally extend h to a map from A∗ into G. For a ∈ A, we define the image of a by ϕG (h) as ϕG (h)(a) = h(ϕ(a)). We say that ϕ has finite f -order if there is an integer n ≥ 1 such that ϕnG (f ) = f . The least such integer is called the f -order of ϕ. Any substitution ϕ which is invertible in F G(A) is of finite h-order for any morphism h into a finite group. Indeed, since G is finite, there are integers n, m with n < m such that ϕn+m = ϕnG . Since ϕ is invertible, ϕm G is the identity. G Example 10.11 Let ϕ : a 7→ ab, b 7→ a be the Fibonacci substitution and let h : A∗ → Z/2Z be the parity of the length, that is the morphism into the additive goup of integers modulo 2 sending each letter to 1. Then ϕ is of h-order 3. The following is a consequence of Theorem 10.9, using [4, Proposition 3.2]. Corollary 10.12 Let ϕ be a non-periodic primitive substitution over A and let c∗ → G h : A∗ → G be a morphism onto a finite group. The restriction of ĥ : A to any maximal subgroup of J(ϕ) is surjective if and only if ϕ has finite h-order. 36 Example 10.13 Let ϕ be as in Example 8.9, let G = Z/2Z and let h : A∗ → G be the parity of the length. Then ϕG (h) = (0, 0) and ϕG (0, 0) = (0, 0). Thus ϕ does not have finite h-order. Actually, any pseudoword in J(ϕ) which is in the image of ϕ̂ has even length and thus is mapped by h to 0. Thus, by Theorem 10.8, there is a maximal group G in J(F ) which contains only pseudowords of even length and therefore ĥ(G) = {0}, showing that the restriction of ĥ to G is not surjective. The following example is from [4, Section 7.2]. Example 10.14 Let ϕ : a 7→ ab, b 7→ a3 b be as in the previous example and let h : A∗ → A5 be the morphism from A∗ onto the alternating group A5 defined by h : a 7→ (123), b 7→ (345). One may verify that ϕ has h-order 12. Thus A5 is a quotient of G(ϕ). It is not known whether any finite group is a quotient of G(ϕ). Proper substitutions A substitution ϕ over A is proper if there are letters a, b ∈ A such that for every d ∈ A, ϕ(d) starts with a and ends with b. Theorem 10.9 takes a simpler form for proper substitutions. The following is [4, Theorem 6.4]. Theorem 10.15 Let ϕ be a non-periodic proper primitive substitution over a finite alphabet A. Then G(ϕ) admits the presentation hA | ϕω G (a) = a, a ∈ AiG . The proof uses Proposition 5.17 applied with the diagram of Figure 10. ϕω+1 c∗ c∗ A A ϕω H ϕω ϕ H Figure 10: A commutative diagram Example 10.16 Let A = {a, b} and let ϕ : a 7→ ab, b 7→ a3 b. The morphism ϕ is proper. Thus, by Theorem 10.15, the Schützenberger group of J(ϕ) has ω the presentation ha, b | ϕω G (a) = a, ϕG (b) = bi. Since the image of F G(A) by ϕ is included in the subgroup generated by words of length 2, the relations ω ϕω G (a) = a and ϕG (b) = b are nontrivial and thus G(F ) is not a free profinite group of rank two (it is actually not a free profinite group, see [7, Example 7.2]). 10.3 Groups of bifix codes For an automaton A, we denote by ϕA the natural morphism from A∗ onto the transition monoid of A. 37 Let F be a recurrent set. For any finite automaton A = (Q, i, T ), we denote by rankA (F ) the minimum of the ranks of the maps ϕA (w) for w ∈ F . By [31, Proposition 3.2], the set of elements of ϕA (F ) of rank rankA (F ) is included in a regular J -class, called the F -minimal J -class of the monoid ϕA (A∗ ) and denoted JA (F ). The structure group of this J -class is denoted GA (F ). Let X ⊂ A+ be a code. A parse of a word w ∈ A∗ with respect to X is a triple (p, x, q) with w = pxq such that p has no suffix in X, x ∈ X ∗ and q has no prefix in X. c∗ with respect to X is a triple (p, x, q) with A parse of a profinite word w ∈ A c∗ and q has no prefix in X. w = pxq such that p has no suffix in X, x ∈ X c∗ with respect to a finite maximal prefix The number of parses of w ∈ A code X is equal to the number of its prefixes which have no suffix in X. Indeed the map (p, x, q) 7→ p assigning to each parse its first component is bijective by Proposition 6.5. Let F be a recurrent set. A bifix code X ⊂ F is F -maximal if it is not properly contained in any bifix code Y ⊂ F . A bifix code X ⊂ F is F -thin if there is a word w ∈ F which is not a factor of X. When F is uniformly recurrent, a set X ⊂ F is F -thin if and only if it is finite. Let F be a recurrent set. The F -degree of a bifix code X, denoted dX (F ), is the maximal number of parses of a word in F . A bifix code X is F -maximal and F -thin if and only if its F -degree is finite. In this case a word of F has dX (F ) parses if and only if it is not an internal factor of a word of X (see [9, Theorem 4.2.8]). Proposition 10.17 Let F be a uniformly recurrent set and let X be a finite F -maximal bifix code. The number of parses of any element of F̄ is equal to dX (F ). Proof. Let w ∈ F̄ and let (un ) be a sequence of elements of F converging to w. Since each long enough un has dX (F ) parses, we may assume that all un have dX (F ) of parses. We may then number the parses of un as (pn,i , xn,i , qn,i ) in such a way that for fixed i, each sequence converges to (pi , xi , qi ). Since X is finite, the sequences (pn,i ) and qn,i are ultimately constant and the sequence c∗ . Thus w has dX (F ) parses. There cannot exist (xn,i ) converges to some xi ∈ A more than dX (F ) parses of a word in F̄ since the number of parses is equal to the number of suffixes which are prefixes of X. Let X be an F -thin and F -maximal bifix code. The F -degree of X is equal to the F -minimal rank of the minimal automaton A of X ∗ . We denote by ϕX the morphism ϕA , by JX (F ) the J -class JA (F ) and by GX (F ) the group GA (F ), called the F -group of X. It is a permutation group of degree dX (F ). We recall that for any uniformly recurrent tree set F a finite bifix code X ⊂ F is F -maximal of F -degree d if and only if it is a basis of a subgroup of index d (Finite Index Basis Theorem, see [12, Theorem 4.4]). 38 We prove the following result. It has the interesting feature that the hypothesis made on profinite objects has a consequence on finite words. Theorem 10.18 Let F be a uniformly recurrent set, let Z be a goup code of degree d and let X = Z ∩ F . Let h : A∗ → G be the morphism from A∗ onto the syntactic monoid of Z ∗ . The restriction of ĥ to a maximal subgroup of J(F ) is surjective if and only if the following properties hold. (i) X is an F -maximal bifix code of F -degree d. (ii) GX (F ) is isomorphic to G. (iii) The morphism ϕˆX maps each H-class of J(F ) which is a group onto GX (F ). Proof. Set ϕ = ϕX and M = ϕ(A∗ ). Let (Q, i, i) be the minimal automaton of Z ∗ . Thus G is a transitive permutation group on the set Q which has d elements and h(Z ∗ ) is the stabilizer of i ∈ Q. By [9, Theorem 4.2.11], since F is recurrent, the set X is an F -thin F maximal bifix code of F -degree at most d. Since F is uniformly recurrent, X is finite. Let x ∈ J(F ) be such that H = H(x) is a group such that the restriction of ĥ to H(x) is surjective. Since ĥ maps H(x) onto G, the pseudoword x has d parses with respect to Z and thus with respect to X. Indeed, for any p ∈ Q, ĥ(x) sends p on some q ∈ Q. Then x has the interpretation (u, v, w) with ph(u) = i, iĥ(v) = i and ih(w) = q. This implies that dX (F ) = d and proves (i). It is clear that ϕ̂(J(F )) is contained in JX (F ) since JX (F ) contains the image by ϕ of every long enough word of F . Thus ϕ̂(x) is in JX (F ) ∩ ϕ(F ) and its H-class K is a group. ĥ H(x) G ϕ̂ α K Figure 11: The reduction onto G. Let w be a word in F and not a factor of X such that ϕ(w) ∈ K. Let P be the set of suffixes of w which are proper prefixes of X. Since Card(P ) = dX (F ), K is a permutation group on the set {i · p | p ∈ P } which is identified by an isomorphism α with a subgroup of G. If the map ĥ is surjective from H(x) onto G, the commutativity of the diagram in Figure 11 forces α to be surjective. Moreover ϕ̂ maps H(x) onto K. The converse is also true. 39 In the case where F is a tree set, the hypothesis of Theorem 10.18 is satisfied by assertion 1 in Theorem 10.5. The conclusion of Theorem 10.18 is implied by assertion 2. Example 10.19 Let A = {a, b} and let Z = A2 . Let F be the Fibonacci set. Then X = {aa, ab, ba}. The group GX (F ) is the cyclic group of order 2, in agreement with the fact that X generates the kernel of the morphism from F G(A) onto Z/2Z sending a, b to 1. The minimal automaton of X ∗ is shown in Figure 12 on the left and the 0 minimal ideal of its transition monoid M is represented on the right. a, b 2 1, 2 1, 3 a 1 b a 1/2, 3 * a * ab 1/2 * ba b 3 Figure 12: The minimal automaton of X ∗ and the F -minimal D-class. Note that, in the above example, the F -minimal D-class D of M is the image of the J -class J(F ). The following example shows that this may be true although the image of J(F ) in the monoid M is strictly included in D. Example 10.20 Let F be the set of factors of the fixed point of the morphism ϕ : a 7→ ab, b 7→ a3 b (as in Example 7.11). The set F ∩ A2 is the same as in Example 10.19 and the F -minimal D-class is also the same. However, J(F ) contains maximal groups formed of words of even length and thus its image in M is aperiodic, that is has trivial subgroups. We now deduce from Corollary 10.12 the following statement which gives information on the groups GX (F ) when X is an F -maximal bifix code in a set F which is not a tree set. It would be interesting to have a direct proof of this statement which does not use profinite semigroups. Theorem 10.21 Let ϕ be a primitive non-periodic substitution over the alphabet A and let F be the set of factors of a fixed point of ϕ. Let Z be a group code of degree d on A and let h be the morphism from A∗ onto the syntactic monoid of Z ∗ . Set X = Z ∩ F . If ϕ has finite h-order, then X is an F -maximal bifix code of F -degree d and GX (F ) is isomorphic to G. Proof. By Corollary 10.12, the hypothesis of Theorem 10.18 is satisfied and thus the conclusion using conditions (i) and (ii). Example 10.22 Let F and ϕ be as in Example 8.3. We consider, as in [4], the morphim h : A∗ → A5 from A∗ onto the alternating group of degree 5 defined by h : a 7→ (123), b 7→ (345). We have seen in Example 10.14 that ϕ has h-order 40 12 and thus, by Corollary 10.12, ĥ induces a surjective map from any maximal subgroup of J(ϕ) onto A5 . Let Z be the bifix code generating the submonoid stabilizing 1 and let X = Z ∩ F . The F -maximal bifix code X has 8 elements. It is represented in Figure 13 with the states of the minimal automaton indicated on its prefixes. In agreement with Theorem 10.21, the F -degree of X is 5. The F -minimal a 1 a a 14 a 3 b b a a 5 7 9 11 b a a 2 b 15 a 1 a a b 1 b 4 6 b 16 a 12 a 1 8 10 b a a 9 11 b 17 b 15 a 1 1 a b a 14 17 15 1 a b a 14 17 15 1 15 a 1 Figure 13: The bifix code X. D-class is represented in Figure 14. The word a3 has rank 5 and RF (a3 ) = 1, 2, 3, 16, 17 1, 4, 5, 14, 15 1, 2, 6, 7, 17 a3 a3 b a3 ba 1/2, 4/3, 6, 15/ 1, 4, 8, 9, 15 * a3 bab 1, 2, 6, 10, 11 1, 2, 3, 12, 14 8/9 1/2/11, 17/6 * ba3 7, 9, 10 1/3, 6, 15/9, 14 aba3 * 5, 8/4 1/11, 17/7, 16 * baba3 bab 3, 6/2 1/2, 4/9, 14 * * 3, 6, 15/5, 12 * 1/2, 4/3, 6, 15 10/11 Figure 14: The F -minimal D-class. {babaaa, babababaaa}. The corresponding permutations defined on the image 41 {1, 2, 3, 16, 17} of a3 are respectively (1, 2, 16, 3, 17) (1, 17, 16, 2, 3) which generate A5 . The next example is from [31]. Example 10.23 Let F be the Thue-Morse set and let A be the automaton represented in Figure 15 on the left. The word aa has rank 3 and image I = a 2 b a 1 b 3 a b 4 b 6 b 10 b 1 a b 1 1 1 5 8 a a 1 a 7 0 b 9 a a 11 a 1 b b 1 b a 2 Figure 15: An automaton of F -degree 3 with trivial F -group {1, 2, 4}. The action on the images accessible from I is given in Figure 16. All b 1, 2, 8 1, 3, 10 a b b b a b a 1, 2, 4 1, 3, 6 1, 3, 5 1, 2, 7 1, 3, 9 1, 2, 11 a a Figure 16: The action on the minimal images words with image {1, 2, 4} end with aa. The paths returning for the first time to {1, 2, 4} are labeled by the set RF (aa) = {b2 a2 , bab2 aba2 , bab2 a2 , b2 aba2 }. Thus rankA (F ) = 3 by [31, Theorem 3.1]. Moreover each of the words of RF (a2 ) defines the trivial permutation on the set {1, 2, 4}. Thus GA (F ) is trivial. The fact that dA (F ) = 3 and that GA (F ) is trivial can be seen directly as follows. Consider the group automaton B represented in Figure 15 on the right and corresponding to the map sending each word to the difference modulo 3 of the number of occurrences of a and b. There is a reduction ρ from A onto B such that 1 7→ 0, 2 7→ 1, and 4 7→ 2. This accounts for the fact that dA (S) = 3. Moreover, one may verify that any return word x to a2 has equal number of a and b (if x = uaa then aauaa is in F , which implies that aua and thus uaa have the same number of a and b). This implies that the permutation ϕB (x) is the identity, and therefore also the restriction of ϕA (x) to I. 42 Example 10.24 Consider again the Thue-Morse substitution τ and the ThueMorse set F as in Example 10.10. Let h be the morphism h : a 7→ (123), b 7→ (345) from A∗ onto the alternating group A5 (already used in Example 9.4). One may verify that τ has h-order 6 and thus, by Corollary 10.12, h extends to a surjective continuous morphim from any maximal subgroup of J(ϕ) onto A5 . Let Z be the group code generating the submonoid stabilizing 1 and let X = Z ∩ F . The F -maximal bifix code X is represented in Figure 17. We represent in Figure 17 only the nodes corresponding to right special words, that is, vertices with two sons. abba 3 ab 2 a 1 b 4 b ba a ba 1 5 6 7 1 aba ba a b2 a a τ 2 (b) 1 1 1 τ 2 (a) 1 τ 2 (a) 1 τ 3 (a) 10 2 12 τ (b)a 8 ba 1τ 2 (a) 1 1 τ 2 (a) 1 1 2 τ 2 (a) 11 τ (bba) 12 τ 2 (b)a 9 ba 1 1 τ 3 (b) Figure 17: The bifix code X. The image of τ 4 (b) is {1, 3, 4, 9, 10} and thus it is minimal. The action on its image is shown in Figure 18. The return words to τ 4 (b) are τ 4 (b), τ 3 (a) and τ 5 (ab). The permutations on the image of τ 4 (b) are the 3 cycles of length 5 indicated in Figure 18. Since they generate the group A5 , we have GX (F ) = A5 . τ 3 (a) | (1, 10, 9, 3, 4) τ 4 (b) | (1, 9, 10, 3, 4) {1, 3, 4, 9, 10} τ 4 (a) {1, 2, 7, 8, 12} τ 4 (b) | (1, 10, 9, 4, 3) Figure 18: The action on the minimal images. References [1] Jorge Almeida. Dynamics of implicit operations and tameness of pseudovarieties of groups. Trans. Amer. Math. Soc., 354(1):387–411, 2002. [2] Jorge Almeida. Profinite semigroups and applications. In Structural theory of automata, semigroups, and universal algebra, volume 207 of NATO Sci. 43 Ser. II Math. Phys. Chem., pages 1–45. Springer, Dordrecht, 2005. Notes taken by Alfredo Costa. [3] Jorge Almeida and Alfredo Costa. Infinite-vertex free profinite semigroupoids and symbolic dynamics. J. Pure Appl. Algebra, 213(5):605–631, 2009. [4] Jorge Almeida and Alfredo Costa. Presentations of Schützenberger groups of minimal subshifts. Israel J. Math., 196(1):1–31, 2013. [5] Jorge Almeida and Alfredo Costa. A geometric interpretation of the Schützenberger group of a minimal subshift. Ark. Mat., 54(2):243–275, 2016. [6] Jorge Almeida and Benjamin Steinberg. Rational codes and free profinite monoids. J. Lond. Math. Soc. (2), 79(2):465–477, 2009. [7] Zh. Almeı̆da. Profinite groups associated with weakly primitive substitutions. Fundam. Prikl. Mat., 11(3):13–48, 2005. ’ [8] Lubomı́ra Balková, Edita Pelantová, and Wolfgang Steiner. Sequences with constant number of return words. Monatsh. Math., 155(3-4):251–263, 2008. [9] Jean Berstel, Clelia De Felice, Dominique Perrin, Christophe Reutenauer, and Giuseppina Rindone. Bifix codes and Sturmian words. J. Algebra, 369:146–202, 2012. [10] Jean Berstel, Dominique Perrin, and Christophe Reutenauer. Codes and Automata. Cambridge University Press, 2009. [11] Valérie Berthé, Clelia De Felice, Francesco Dolce, Julien Leroy, Dominique Perrin, Christophe Reutenauer, and Giuseppina Rindone. Acyclic, connected and tree sets. Monatsh. Math., 176:521–550, 2015. [12] Valérie Berthé, Clelia De Felice, Francesco Dolce, Julien Leroy, Dominique Perrin, Christophe Reutenauer, and Giuseppina Rindone. The finite index basis property. J. Pure Appl. Algebra, 219(7):2521–2537, 2015. [13] Valérie Berthé, Clelia De Felice, Francesco Dolce, Julien Leroy, Dominique Perrin, Christophe Reutenauer, and Giuseppina Rindone. Maximal bifix decoding. Dicrete Math., 338:725–742, 2015. [14] Thierry Coulbois, Mark Sapir, and Pascal Weil. A note on the continuous extensions of injective morphisms between free groups to relatively free profinite groups. Publ. Mat., 47(2):477–487, 2003. [15] Xavier Droubay, Jacques Justin, and Giuseppe Pirillo. Episturmian words and some constructions of de Luca and Rauzy. Theoret. Comput. Sci., 255(1-2):539–553, 2001. 44 [16] Fabien Durand, Julien Leroy, and Gwenaël Richomme. Do the properties of an S-adic representation determine factor complexity? J. Integer Seq., 16(2):Article 13.2.6, 30, 2013. [17] N. Pytheas Fogg. Substitutions in dynamics, arithmetics and combinatorics, volume 1794 of Lecture Notes in Mathematics. Springer-Verlag, Berlin, 2002. Edited by V. Berthé, S. Ferenczi, C. Mauduit and A. Siegel. [18] Amy Glen and Jacques Justin. Episturmian words: a survey. Theor. Inform. Appl., 43:403–442, 2009. [19] Marshall Hall, Jr. Coset representations in free groups. Trans. Amer. Math. Soc., 67:421–432, 1949. [20] Marshall Hall, Jr. A topology for free groups and related groups. Ann. of Math. (2), 52:127–139, 1950. [21] Jacques Justin and Laurent Vuillon. Return words in Sturmian and episturmian words. Theor. Inform. Appl., 34(5):343–356, 2000. [22] Karel Klouda and Stepan Starosta. Characterization of circular dol systems. 2014. http:\arxiv.org/abs/1401.0038. [23] Donald E. Knuth. The art of computer programming. Vol. 2. AddisonWesley, Reading, MA, 1998. Seminumerical algorithms, Third edition [of MR0286318]. [24] Neal Koblitz. p-adic numbers, p-adic analysis, and zeta-functions, volume 58 of Graduate Texts in Mathematics. Springer-Verlag, New York, second edition, 1984. [25] Gérard Lallement. Semigroups and combinatorial applications. John Wiley & Sons, New York-Chichester-Brisbane, 1979. Pure and Applied Mathematics, A Wiley-Interscience Publication. [26] Hendrick Lenstra. Profinite Fibonacci numbers. Wiskunde, 6:297–300, 2005. Nieuw Archief voor [27] Douglas Lind and Brian Marcus. An introduction to symbolic dynamics and coding. Cambridge University Press, Cambridge, 1995. [28] Roger C. Lyndon and Paul E. Schupp. Combinatorial group theory. Classics in Mathematics. Springer-Verlag, Berlin, 2001. Reprint of the 1977 edition. [29] S. Margolis, M. Sapir, and P. Weil. Irreducibility of certain pseudovarieties. Comm. Algebra, 26(3):779–792, 1998. [30] Brigitte Mossé. Puissances de mots et reconnaissabilité des points fixes d’une substitution. Theoret. Comput. Sci., 99(2):327–334, 1992. 45 [31] Dominique Perrin. Codes and automata in minimal sets. In Combinatorics on Words - 10th International Conference, WORDS 2015, Kiel, Germany, September 14-17, 2015, Proceedings, pages 35–46, 2015. [32] Christophe Reutenauer. Une topologie du monoı̈de libre. Semigroup Forum, 18(1):33–49, 1979. [33] Luis Ribes and Pavel Zalesskii. Profinite groups, volume 40 of Ergebnisse der Mathematik und ihrer Grenzgebiete. 3. Folge. A Series of Modern Surveys in Mathematics [Results in Mathematics and Related Areas. 3rd Series. A Series of Modern Surveys in Mathematics]. Springer-Verlag, Berlin, second edition, 2010. [34] Stephen Willard. General topology. Dover Publications, Inc., Mineola, NY, 2004. Reprint of the 1970 original [Addison-Wesley, Reading, MA; MR0264581]. 46
4math.GR
arXiv:1604.04146v1 [cs.NE] 14 Apr 2016 A Discrete Firefly Algorithm to Solve a Rich Vehicle Routing Problem Modelling a Newspaper Distribution System with Recycling Policy Eneko Osaba1,2 , Xin-She Yang1 , F. Diaz2 , E. Onieva2 , A. D. Masegosa2 , A. Perallos2 1) E. Osaba, X.S. Yang School of Science and Technology, Middlesex University Hendon Campus, London, NW4 4BT, United Kingdom 2) E. Osaba, F. Diaz, E. Onieva, A. Masegosa, A. Perallos Deusto Institute of Technology (DeustoTech), University of Deusto Av. Universidades 24, Bilbao 48007, Spain Citation Details: E. Osaba, Xin-She Yang, F. Diaz, E. Onieva, A. D. Masegosa, A. Perallos, A Discrete Firefly Algorithm to Solve a Rich Vehicle Routing Problem Modelling a Newspaper Distribution System with Recycling Policy, Soft Computing, Published First Online 18 March 2016. DOI 10.1007/s00500-016-2114-1 Abstract A real-world newspaper distribution problem with recycling policy is tackled in this work. In order to meet all the complex restrictions contained in such a problem, it has been modeled as a rich vehicle routing problem, which can be more specifically considered as an asymmetric and clustered vehicle routing problem with simultaneous pickup and deliveries, variable costs and forbidden paths (AC-VRP-SPDVCFP). This is the first study of such a problem in the literature. For this reason, a benchmark composed by 15 instances has been also proposed. In the design of this benchmark, real geographical positions have been used, located in the province of Bizkaia, Spain. For the proper treatment of this AC-VRP-SPDVCFP, a discrete firefly algorithm (DFA) has been developed. This application is the first application of the firefly algorithm to any rich vehicle routing problem. To prove that the proposed DFA is a promising technique, its performance has been compared with two other well-known techniques: an evolutionary algorithm and an evolutionary simulated annealing. Our results have shown that the DFA has outperformed these two classic meta-heuristics. 1 Introduction Transportation is an important factor for today’s smart society. Public transportation, for example, is used by almost the whole population, and it directly affects the quality of life. However, modelling and planning such complex transport system is a very challenging task. Here, this paper focuses on another sort of transport: the transportation in the business world. Due to the rapid advancement of technologies, logistics systems have become very important for media companies. The fact that anyone in the world can be well connected has 1 led to complex transport networks that are very demanding and are becoming increasingly important. Therefore, an efficient logistic network can make a huge difference for companies and relevant business operations. To cite one fact that highlights the importance of logistics in this sector, in some businesses, such as groceries delivery, the distribution costs can lead to an increase in the product price up to 70% [1]. Thanks to cases like this, it is obvious to show the importance of this sector. Therefore, this paper focuses on a real-world logistic problem, and its effective treatment. The real-world situation dealt in this work is related to the daily delivery of newspapers. Specifically, the object of this study is a medium-sized newspaper distribution company, which offers its services at the regional level. This company has certain mandatory principles, which must be taken into account when performing the daily planning tasks of deliveries. One of these principles is a strict recycling system. Another one is the treatment of the different towns, or cities, as separate units. Besides that, the company considers certain factors for the scheduling process, as variable travel times (depending on the hour they are carried out), or the transit prohibition in certain streets. Although this paper is focused on a specific company located in Bizkaia (Spain), it is noteworthy that the goal of this work is to develop a model that is applicable to every company of similar characteristics. Therefore, the aim of this paper is to address efficiently this Newspaper Distribution System with Recycling Policy (NDSRP). For this purpose, the NDSRP has been modeled as a Multi-Attribute, or Rich-Vehicle Routing Problem (R-VRP). Nowadays, as indicated in [2] or [3], R-VRPs form a hot topic in the scientific community. These kinds of problems are special cases of the well-known conventional vehicle routing problem (VRP) [4], with the distinction of having multiple constraints and complex formulations. This sort of problems can have a great scientific interest, since such NP-Hard problems present a tough challenge to solve. Furthermore, their social interest is also high, as their applicability to real-world situations is greater than the conventional versions of routing problems. To be more specific in the present paper, an Asymmetric and Clustered Vehicle Routing Problem with Simultaneous Pickup and Deliveries, Variable Costs and Forbidden Paths (AC-VRP-SPDVCFP) was proposed to address the presented NDSRP. Some examples of recently developed R-VRPs can be [5] or [6]. In the former work, the authors propose an R-VRP with hard and soft time windows, heterogeneous fleet, customers priorities and vehicle-customer constraints. The solution proposed by the authors of this paper has already been integrated into the optimization tool of a fleet management system used in the Canary Islands. In the latter work, an R-VRP was proposed to deal with the perishable food management. In this work, a heterogeneous fleet site-dependent VRP with multiple time windows was presented. Another example of recently developed R-VRP can be the proposed in [7]. In their paper, an R-VRP was developed for the olive oil collection in Tunisia. The R-VRP designed in this work was a multi-product, multi-period and multi-compartment VRP. These were some of the examples that justified the increasing interest of R-VRP in the scientific community. For further information on R-VRP, readers can refer to the surveys [2] and [3]. Though some appropriate methods can be found in the literature to address such complex problems, arguably the most successful techniques to solve these R-VRPs are the heuristics and metaheuristics [8]. In this study, the attention has been focused in the last ones. In fact, to solve the AC-VRP-SPDVCFP proposed in this paper one metaheuristic has been developed. Some classical examples of metaheuristics are the Tabu search [9] 2 and simulated annealing (SA) [10] as local search methods, and genetic algorithm (GA) [11, 12], ant colony optimization [13] and particle swarm optimization [14] as population ones. Though such methods were proposed some decades ago, they still attract the attention in the scientific community [15, 16, 17] and metaheuristics, especially new metaheuristic algorithms and their proper implementations still form a hot topic in the field. In fact, many different metaheuristics have been proposed in the last two decades, which have been successfully applied to various problems and fields. Some examples of these techniques are the imperialist competitive algorithm, presented in 2007 by Gargari and Lucas [18], the bat algorithm, proposed by Yang in 2010 [19], or the harmony search, presented in 2001 by Geem et al. [20]. Another type of technique that shows a good performance applied to routing problems are the memetic algorithms [21, 22]. In [23], for example, a hybrid genetic algorithm is presented for solving a large class of vehicle routing problems with time-windows. On the other hand, in [24] a hybrid genetic algorithm is presented to solve an R-VRP composed by multidepot and periodicity features. In [25] a decomposition based memetic algorithm is proposed for a multi-objective VRP with time windows. Another kind of R-VRP is solved by a hybrid techniques in [26]. In this case, the characteristics of the problem are clustered backhauls and 3D loading constraints. Finally, a multiperior VRP with profit is addressed by a memetic algorithm in [27]. Works cited in this paragraph are some recent and interesting examples of the whole literature, some other recent examples can be found in, for example, [28, 29, 30]. Therefore, in this paper one metaheuristic proposed a few years ago is used to solve the presented problem. This technique is the firefly algorithm (FA), proposed by Yang in 2008 [31]. This nature-inspired algorithm is based on the flashing behaviour of fireflies, which acts as a signal system to attract other fireflies. As can be seen in several surveys [32, 33], the FA has been successfully applied to many different optimization fields and problems since its proposal. In addition, it still attracts a lot of interests in the current scientific community [34, 35, 36]. Nevertheless, the FA has never been applied to any R-VRP. This lack of works, along with the growing scientific interest in bio-inspired algorithms, and the good performance shown by the FA since its proposal in 2008, has motivated its use in this study. In this way, the main novelties and contributions of this paper can be listed in the following way. It is noteworthy that these originalities and contributions have motivated the realization of this work: • In this paper, a DPRP is dealt with using an R-VRP. As will be mentioned in the following section, the problem of newspaper distribution has been previously addressed in the literature, but never using an R-VRP as complex as the one presented in this paper. Furthermore, it is the first time that an R-VRP of this characteristics is proposed in the literature. For this reason, a benchmark composed by 15 instances has been developed, based on real geographic locations. • In this work, a discrete version of the FA (DFA) is presented for solving the proposed R-VRP. Until the time of writing, the FA has never been applied to any R-VRP. Anyway, the main novelty of the presented DFA is not only its application field. The technique developed in this work uses the Hamming Distance function to measure the distance between two fireflies of the swarm. This approach has been rarely used previously, as well as the move strategy used by the fireflies, which is based 3 on evolution strategies. All these characteristics are described in following sections. Additionally, in order to prove that the DFA is a promising technique to solve the designed AC-VRP-SPDVCFP, the results obtained by the DFA are compared with the ones obtained by the evolutionary algorithm (EA) based on mutations and the evolutionary simulated annealing (ESA) [37]. The rest of the paper is organized as follows. In Section 2, the real-world problem addressed in this work is described. In Section 3, the R-VRP proposed to deal with the real problem is described in detail. Furthermore, in Section 4, the developed DFA is described in detail. After that, the experimentation carried out is detailed in Section 5, as well as the benchmark designed for the presented R-VRP. This paper then concludes with some brief conclusions and further research topics in Section 6. 2 Newspapers Distribution with Recycling Policy As has been pointed in the previous section, the real-world situation faced in this work is related to the newspaper distribution. More specifically, the object of study is a mediumsized newspaper distribution company. The area of the coverage of this company is at a provincial level. This means that the company has to serve a set of customers geographically distributed in separate towns and cities. The company in question has some principles, which are the base of their logistics planning. The first principle is to treat towns, or cities, as separate units. In this way, if one vehicle enters a city, or a town, it is forced to serve each and every customer located therein. Therefore, one vehicle is banned for entering one city or town whether it does not have sufficient capacity to meet the demand of all customers deployed there. On the other hand, due to the current environmental requirements, the company has a simple but robust paper recycling policy. In this case, the objects to recycle are the newspapers that were not sold the previous day. Thus, as can be deduced, vehicles not only have to meet the delivery demands of the customers. Besides that, they have to collect at each point those newspapers that have not been sold the day before. In addition, the company has to take into account certain factors in the routes planning process. The first one is related to the hours at which the deliveries and collections are done. The service is performed daily during morning from 6:00am to 15:00. Within this time window exists one range, established between 8:00am and 10:00am, considered as “peak hours”. In this way, traveling costs from one point to another are greater if they are performed at “peak hours”. Besides this, with the aim of respecting all the traffic rules, vehicles cannot go through prohibited roads. Throughout the past few decades, the problem of the newspaper delivery has been addressed many times in the literature. In 1996, Ree and Yoon presented a two-stage heuristic for a newspaper distribution problem, taking as a case study of a major press company of Korea [38]. The problem used in this study is a multi-VRP with time windows, which is faced in two different stages by the proposed heuristic. On the other hand, in [39] a free newspaper delivery problem is addressed. In their study, the problems was decomposed in two phases. In the first stage, the delivery plan was created, based on concept taken from the Inventory Routing Problem [40]. Once the delivery plan was fixed, the resulting problem was solved in the second stage as a variant of the conventional VRP with time windows (VRPTW) [41]. They used a heuristic for solving this second stage problem. The same VRPTW was used in [42] to face a case study of the newspaper delivery problem focused 4 in the city of Bangkok and a modified sweep algorithm was presented to solve the proposed VRPTW. These papers are some of the examples that can be found in the literature. Many others can be found, considering, for example, the problem of delivering newspapers to private subscribers [43, 44]. Regarding the problem addressed in this paper, some originalities and novelties are proposed: the features of the variable travel times and forbidden paths have never been used for the newspaper distribution system, as well as the recycling policy applied in this work. In addition, as we will see in the rest of the paper, the R-VRP proposed in this work has a great number of constraints, making easier its application to the real world. Finally, the technique developed in this work solves the proposed AC-VRP-SPDVCFP in only one phase, in contrast with the approaches presented in [38, 39]. This is an advantage because solving the problem in only one phase, the runtimes and the computational effort can be considerably reduced. 3 Asymmetric and Clustered Vehicle Routing Problem with Simultaneous Pickups and Deliveries, Variable Costs and Forbidden Paths As has been stated earlier in this paper, the real-world situation of the newspaper distribution has been modeled as an R-VRP. In this section, a detailed description of the presented problem is provided. First of all, in Section 3.1, the basic features of the problem are detailed, followed by the mathematical formulation of the proposed R-VRP is depicted in Section 3.2. 3.1 General description of the problem The proposed R-VRP has the following general characteristics. It is noteworthy that all these features proposed here are to take into account the conditions stated in Section 2. Besides those, some additional restrictions have been considered with the intention of developing a model closer to real conditions. 1. Asymmetry: The traveling costs in the proposed R-VRP are asymmetric. This means that the traveling cost from any i node to another j node is different from the reverse trip cost. It is important to highlight that, in the problem proposed in this paper, this asymmetry appears in every node-to-node travel. This feature is not common in most routing problems that can be found in the literature, and it brings realism to the problem. Anyway, asymmetric costs have been applied previously in the literature in a different context [45, 46, 47]. It is noteworthy that this feature is very valuable in real-world applications. 2. Clusterized : With this attribute, the different clients that make up the system are grouped in different sets or clusters. In this case, each cluster represents a city or town. The condition that vehicles must meet is the following: if one vehicle meets the demand of any customer belonging to any cluster, this vehicle must serve each and every customer of this cluster. In this way, one vehicle cannot enter a cluster if it does not have enough capacity to serve all customers in this city or town. This feature has been used previously in many studies in a different context. [48, 49, 50]. 5 3. Simultaneous Pickup and Delivery: This property is an adaptation of the often used pickup and delivery system of some routing problems [51, 52]. Basically, this system consists in the existence of two types of nodes: the delivery nodes and the collect nodes. The former ones are those points in where newspapers are delivered. On the other hand, in collect nodes, newspapers are collected, with the intention of bringing them back to the center for their subsequent recycling. In addition, it is important to highlight that, due to the simultaneous nature of the real-world situation, one customer can ask for both delivery and collection of newspapers. In this way, both delivery nodes and delivery-collect nodes can be found in the system. On the other hand, it is assumed that all customers request the delivery of newspapers. For these reason, customers which demand only the collection of newspapers have not been taken into account. 4. Variable Travel Times: In real transportation situations, the travel between two points does not always take the same cost, either temporarily or economically. In many cases, this cost is subject to some external variables, such as the hour, the traffic or the weather. With the intention of adding more realism to the problem, this situation has been represented in the R-VRP proposed in this work. To this end, it has established a schedule between 6:00am and 15:00. Within this schedule, two different time-periods have been established, called “peak hours” and “off-peak hours”. Peak hours are composed by two hours, between 8:00am and 10:00am. All trips performed in this time window imply a higher cost, comparing with the costs of conducting the same trip in “off-peak” period. A similar characteristic has been previously used a few times in the literature [53]. 5. Forbidden Paths: In the real world, it is common to find one-way roads, where the traffic in a particular direction is prohibited. There are also pedestrian streets, where vehicles cannot go through. With the aim of recreating this common situation, the problem has certain arcs (i, j) which cannot be used in the final solution. A similar philosophy has been used previously in some studies in the literature [54]. With the above assumptions and simplifications, the proposed AC-VRP-SPDVCFP is an R-VRP, whose objective is to find a set of r routes, trying to minimize the total cost of the complete solution, and taking into account the two different kinds of nodes, respecting the restrictions of the clusters and vehicles capacities (Q) and not traveling through any forbidden path. As can be seen, being an R-VRP problem, the AC-VRP-SPDVCFP has multiple constraints. It is important to point out that all these restrictions reduce the size of the search space which encompasses the feasible solutions. Anyway, all these constraints make the process of generating feasible solutions and successors to be a very complex task. In Figure 1, a possible 14-noded instance of the proposed AC-VRP-SPDVCFP is represented. A feasible solution for this instance is also shown in Figure 1. 3.2 Mathematical description of the problem The presented AC-VRP-SPDVCFP can be defined on a complete graph G = (V, A) where V = {v0 , v1 , . . . , vn } is the set of vertices which represent the nodes of the system. On the other hand, A = {(vi , vj ) : vi , vj ∈ V, i 6= j} is the set of arcs which represent the interconnections between nodes. Each arc has an associated cost dij . Due to the asymmetry feature, dij 6= dji . It is noteworthy that, in this case, the cost of traveling 6 Figure 1: Possible AC-VRP-SPDVCFP instance composed by 14 nodes, and one feasible solution. Gray paths represent forbidden arcs. from i to j is always different from the cost of traveling from j to i. The cost of traveling via a forbidden arc is infinite. In this way, it is ensured that they will not appear in the final solution. Furthermore, the vertex v0 represents the depot, and the rest are the visiting points. Additionally, V is divided into c + 1 mutually exclusive nonempty subsets, C = {V0 , V1 , ..., Vc }, each one for each cluster. These subsets hold the following conditions: V = V0 ∪ V1 ∪ ... ∪ Vc Va ∩ Vb = ∅, a, b ∈ 0, 1, ..., c, a 6= b (1) (2) It is noteworthy that V0 only contains v0 , which depicts the depot. The remaining n nodes are divided into c clusters. Besides that, each node i has assigned two kinds of demands: one associated with the delivery di > 0 and the other with the pick-up pi ≥ 0. The proposed AC-VRP-SPDVCFP can be mathematically formulated in the following way. It is important to highlight that yij depicts the demand picked-up in clients routed up to node i (including node i) and transported in arc (i, j). On the other hand, zij represents the demand to be delivered to clients routed after node i and transported in arc (i, j) [55]. Furthermore, wsr , is a binary variable, which takes 1 value whether vehicle r enters the cluster s, and 0 in other case. Finally, the binary variable xrij is 1 if the vehicle r uses the arc (i, j), and 0 otherwise. The main problem is now to minimize: n X n X k X dij xrij (3) i=0 j=0 r=1 where xrij ∈ {0, 1}, i, j = 0, . . . , n; i 6= j; r = 1 . . . k, wsr ∈ {0, 1}, yij ≥ 0, r = 1, . . . , k; s = 1, ..., c, i, j = 0, . . . , n, 7 (4) (5) (6) zij ≥ 0, i, j = 0, . . . , n. (7) This is subject to the following constraints: n X k X xrij = 1, j = 0, . . . , n; i 6= j, (8) xrij = 1, i = 0, . . . , n; j 6= i, (9) i=0 r=1 n X k X j=0 r=1 n X k X xr0j = k, (10) xri0 = k, (11) j=0 r=1 n X k X i=0 r=1 n X xrij − i=0 n X n X xrjl = 0, j = 0, . . . , n; r = 1 . . . k, (12) xrli = 0, i = 0, . . . , n; r = 1 . . . k, (13) l=0 xrij − j=0 n X l=0 n X yji − n X yij = pj , j = 0, . . . , n, (14) zij = dj , j = 0, . . . , n, (15) i, j = 0, ..., n, (16) dij xrij < ∞, j = 0, . . . , n; i 6= j, (17) dij xrij < ∞, i = 0, . . . , n; j 6= i, (18) i=0 i=0 n X n X zji − i=0 i=0 yij + zij ≤ Q k X xrij , r=1 n X k X i=0 r=1 n X k X j=0 r=1 k X wsk = 1 s = 1, ..., c. (19) r=1 The first clause represents the objective function, which is the sum of the costs of all routes of the solution, and it must be minimized. The formulas (4), (5), (6) and (7) depict the nature of the variables xrij , wsr , yij and zij . Equations (8) and (9) assure that all the nodes are visited exactly once. On the other hand, constraints (10) and (11) ensure that the total amount of vehicles leaving the depot, and the number of vehicles that return to it is the same. Besides, the correct flow of each route is ensured by functions (12) and (13). Additionally, restrictions (14) and (15) guarantee that the flows for the collection and delivery demands, respectively, are properly conducted. These formulas ensure that both 8 demands are satisfied for every customer. Furthermore, constraint (16) assures that the total capacity of any vehicle is never exceeded; it also establishes that pick-up and delivery demands will only be transported using arcs included in the solution [55]. On the other hand, functions (17) and (18) ensure that every trip between one node and another has not an infinite cost. Thus, it is guaranteed that forbidden paths will not form part of the final solution. Finally, restriction (19) assures that only one vehicle enters every cluster. This function, together with the above mentioned (8) and (9), ensures that all the customers belonging the same cluster are visited by the same vehicle. 4 Firefly algorithm As has been stated in the introduction, a discrete firefly algorithm (DFA) is proposed in this work to address the designed AC-VRP-SPDVCFP. In this section, the description of the classic FA is shown first (Section 4.1). Then, the proposed DFA is described in detail in Section 4.2. 4.1 Classic Firefly Algorithm The basic FA was first developed by Xin-She Yang in 2008 [31, 56], and it was based on the idealized behaviour of the flashing characteristics of fireflies. To properly understand the algorithm, it is important to highlight the following three idealized rules [31]: • All the fireflies of the swarm are unisex, and one firefly will be attracted to other ones regardless of their sex. • Attractiveness is proportional to the brightness, which means that, for any two fireflies, the brighter one will attract the less bright one. The attractiveness decreases as the distance between the fireflies increases. Furthermore, if one firefly is the brightest one of the swarm, it moves randomly. • The brightness of a firefly is directly determined by the objective function of the problem under consideration. In this manner, for a maximization problem, the brightness can be proportional to the objective function value. On the other hand, for a minimization problem, it can be the reciprocal of the objective function value. In Algorithm 1, the pseudocode of the basic FA is shown, which was proposed by Yang in [31]. In line with this, there are three important factors to consider in the FA: the attractiveness, the distance and the movement. In the basic version of the FA these factors are tackled in the following way. First of all, the attractiveness of a firefly is determined by its light intensity, and it can be calculated using this formula: β(r) = β0 e−γr 2 (20) On the other hand, in the basic FA the distance rij between any two fireflies i and j is calculated using the Cartesian distance, and it is computed by the following equation: v u d uX rij = ||Xi − Xj || = t (Xi,k − Xj,k )2 (21) k=1 9 Algorithm 1: Pseudocode of the basic FA. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Define the objective function f (x); Initialize the firefly population X = x1 , x2 , ..., xn ; Define the light absorption coefficient γ; for each firefly xi in the population do Initialize light intensity Ii ; end repeat for each firefly xi in the swarm do for each other firefly xj in the swarm do if Ij > Ii then Move firelfy xi toward xj ; end Attractiveness varies with distance r via exp(-γr); Evaluate new solutions and update light intensity; end end Rank the fireflies and find the current best; until termination criterion reached ; Rank the fireflies and return the best one; where Xi,k is the kth component of the spatial coordinate Xi of the ith firefly. Finally, the movement of a firefly i toward any other brighter firefly j is determined by this formula: 2 Xi = Xi + β0 e−γrij (Xj − Xi ) + α(rand − 0.5) (22) where α is the randomization parameter and rand is a random number uniformly distributed in [0,1]. On the other hand, the second term of the equation stems from the attraction assumption. 4.2 The proposed Discrete Firefly Algorithm It is noteworthy that the original FA was developed primarily for solving continuous optimization problems. For this reason, the classic FA cannot be applied directly to solve the proposed AC-VRP-SPDVCFP. Therefore, some modifications of the original FA are needed in order to prepare it for addressing such AC-VRP-SPDVCFP problem. First of all, in the proposed DFA, each firefly in the swarm represents a possible and feasible solution for the AC-VRP-SPDVCFP. All the fireflies are initialized randomly. Additionally, as has been detailed in Section 3, the sum of the costs of all routes of the solution has been used as the objective function. Therefore, the AC-VRP-SPDVCFP is a minimization problem, in which the fireflies with a lower objective function value are the most attractive ones. In addition, the concept of light absorption is also represented in this version of the FA. In this case, γ = 0.95, and this parameter is used in the way as can be seen in Equ. (22). This parameter has been set following the guidelines proposed in several studies of the literature [56, 31]. Besides that, the distance between two different fireflies is represented by the Hamming Distance. The Hamming distance between two fireflies is the number of non-corresponding 10 elements in the sequence. In the proposed AC-VRP-SPDVCFP, the comparison is made cluster by cluster. For example, taking into account two random fireflies, and one random cluster c composed by 8 nodes: x1 (cluster-c) : {0, 1, 2, 3, 4, 5, 6, 7}, x2 (cluster-c) : {0, 1, 3, 2, 5, 4, 6, 7}, the Hamming Distance between x1 and x2 for the cluster k would be 4. This same comparison is made for every cluster. In this way, the total distance between fireflies i and j is the sum of all the distances for every cluster. Finally, the movement of a firefly i attracted to another brighter firefly j is determined by n = Random(2, rij · γ g ) (23) xi = InsertionFunction(xi , n) (24) where rij is the Hamming Distance between firefly i and firefly j, and g is the iteration number. In this case, the length of the movement of a firefly will be a random number between 2 and rij · γ g . As for the movement function, the Insertion Function has been used. This function selects and extracts one random node from a random route. After that, this node is re-inserted in a random position inside the cluster of the selected node. This function takes into account the capacity constraint, in order not to create infeasible solutions. Following the same philosophy as other previously developed and published FA for the Traveling Salesman Problem [57, 58], fireflies in the proposed DFA do not have directions to move. Instead, fireflies move using evolution strategies. In this way, each firefly moves using n times the Insertion Function, generating n potential successors. After these n movements, the best one is performed, generating the new firefly. The pseudocode of the presented DFA is shown in Algorithm 5. In lines 1-3 the initialization phase of the algorithm is carried out, in which fireflies are initialized and evaluated. Besides, the γ parameter is initialized as previously described. In addition, in lines 10-12 the movement process is performed. In line 10 the distance between the selected xi and xj is calculated via Hamming Distance. Once the distance is obtained, the n parameter is calculated, which is a random number between 2 and rij · γ g . Finally, the movement is performed in line 12 using the Insertion Function as explained before. After this movement process, fireflies are evaluated in line 14 and ranked in line 17. This iterative procedure is repeated until termination criterion is reached. 5 Experimentation The computational experiments carried out in this study are described in this section. First of all, the details of the proposed benchmark for the AC-VRP-SPDVCFP are detailed (Section 5.1). After that, the results obtained by the developed DFA for this benchmark are presented (Section 5.2). In order to prove that the DFA is a promising metaheuristic for solving routing problems, the results obtained by the DFA have been compared with the ones obtained by the EA and the ESA. In addition, two different statistical tests have been conducted, with the aim of obtaining rigorous and fair conclusions (Section 5.3). 11 Algorithm 2: Pseudocode of the proposed DFA. Initialize the firefly population X = x1 , x2 , ..., xn ; γ = 0.95; for each firefly xi in the population do Ii = f itness(xi ); end repeat for each firefly xi in the swarm do for each other firefly xj in the swarm do if Ij < Ii then rij = HammingDistance(xi ,xj ); n = Random(2,rij · γ g ); xi = InsertionFunction (xi ,n); end Evaluate new solutions and update light intensity; end end Rank the fireflies and find the current best; until termination criterion reached ; Rank the fireflies and return the best one; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 5.1 The proposed benchmark for the VRP The type of R-VRP proposed in this paper has never been treated before in the literature. It is for this reason that there is no benchmark available in the literature for the AC-VRPSPDVCFP. In this work, a benchmark composed by 15 instances is proposed. At the same time, these instances are composed of 50 to 100 nodes. Every node represents a customer, and all nodes are placed in real geographical locations, which are located in the province of Bizkaia, Spain. In addition, the maximum number of clusters has been established as 10, existing also instances with 5, and 8 of them. In the Figure 2, a map with the geographical locations of the depot, the customers and the clusters are shown. This map has been made using Open Streep Maps technology, via uMap tool1 . The clusters have been organized in order of appearance. That is, the nodes 1-10 compose cluster 1, nodes 11-20 for cluster 2, and so on. It is important to highlight that every cluster has the same number of customers in all instances. Besides that, as has been pointed out in Section 3.1, each customer has assigned two kinds of demands: one associated with the delivery di and the other with the pick-up pi . The assignments of these demands have been performed following this procedure: 1 di = 10, pi = 5, ∀i ∈ {1, 5, 9, . . . , 97}, (25) di = 10, pi = 0, ∀i ∈ {2, 6, 10, . . . , 98}, (26) di = 5, pi = 3, ∀i ∈ {3, 7, 11, . . . , 99}, (27) di = 5, pi = 0, ∀i ∈ {4, 8, 12, . . . , 100}, (28) http://umap.openstreetmap.fr 12 Figure 2: Geographical locations of the depot, customers and clusters around the province of Bizkaia. Source: Open Street Maps, via uMap, accessed Sept 2015. Algorithm 3: Procedure of travel costs assignment for “off-peak” period. 1 2 3 4 5 6 7 8 9 10 for ∀i ∈ {1, 2, . . . , 99} do for ∀j ∈ {i + 1, . . . , 100} do dij = EuclideanDistance(i,j); if j is an odd number then dji = EuclideanDistance(j,i) · 1.2 ; else dji = EuclideanDistance(j,i) · 0.8 ; end end end where d0 =0 and p0 =0, taking into account that v0 is considered the depot. In addition, the costs of traveling from any customer i to other customer j have been established following the procedure depicted in Algorithm 3. By this method, the asymmetry characteristic is met. It is important to highlight that these costs are assigned for the “off-peak” period. These costs are incremented when they are conducted on the “peak” period, following the procedure shown in Algorithm 4. In is noteworthy that, with the intention of simplifying the complexity of the problem, the traveling time between any node i and j is the same as its traveling cost (in seconds). Finally, depending on the instance, some paths are chosen in each cluster to be forbidden. In Table 1, the characteristics of all the instances developed for the benchmark are summarized. In order to understand the content of this table correctly, the following clarifications should be made: Osaba 50 1 1 and Osaba 50 1 2 are comprised by 5 clusters, which are the clusters {1, 3, 5, 7, 9}. On the other hand, Osaba 50 2 1 and Osaba 50 2 2 are made up by clusters {2, 4, 6, 8, 10}. Moreover, clusters in Osaba 50 1 3 and Osaba 50 1 4 are composed by 5 nodes. In this case, this customers are the first 5 of every cluster. This is in contrast with what happens in Osaba 50 2 3 and Osaba 50 2 4, where the 10 clusters are comprised of the last 5 clients of every of them. Lastly, to complete all Osaba 80 X 13 Algorithm 4: Procedure of travel costs assignment for “peak” period. 1 2 3 4 5 6 7 8 9 10 for ∀i ∈ {1, 2, . . . , 99} do for ∀j ∈ {i + 1, . . . , 100} do dij = EuclideanDistance · 1.3; if j is an odd number then dji = (EuclideanDistance(j,i) · 1.2) · 1.2 ; else dji = (EuclideanDistance(j,i) · 0.8) · 1.4 ; end end end Table 1: Summary of the benchmark proposed for the AC-VRP-SPDVCFP. Forbidden paths depicts the number of forbidden arcs in each cluster. Instance Nodes Clusters Vehic. capacity Forbidden paths Osaba 50 1 1 50 5 240 5 Osaba 50 1 2 50 5 160 10 Osaba 50 1 3 50 10 240 5 Osaba 50 1 4 50 10 160 10 Osaba 50 2 1 50 5 240 5 Osaba 50 2 2 50 5 160 10 Osaba 50 2 3 50 10 240 5 Osaba 50 2 4 50 10 160 10 Osaba 80 1 80 8 240 5 Osaba 80 2 80 8 160 10 Osaba 80 3 80 10 240 5 Osaba 80 4 80 10 160 10 Osaba 100 1 100 10 140 5 Osaba 100 2 100 10 260 10 Osaba 100 3 100 10 320 10 instances, the first 8 clusters, or nodes (depending on the case) have been chosen.With the aim of allowing the replication of this experimentation, it is noteworthy that the benchmark developed is available under request to the corresponding author of this paper, or via Web2 5.2 Results All the tests conducted in this work have been performed on an Intel Core i5 2410 laptop, with 2.30 GHz and a RAM of 4 GB. Java has been used as the programming language. All the 15 instances described in the previous section have been used in this experiment. Every instance has been run 20 times. As has been said before, the results obtained by the DFA are compared with the ones obtained by the EA and the ESA. The reason why these two techniques have been used for this experimentation can be summarized as follows: First of all, both meta-heuristics are well-known, and they have been frequently used to solve routing problems. Proving that the DFA outperforms these two techniques can be concluded that it is a promising technique to solve R-VRPs. On the other hand, all these three techniques have two similarities: all of them base the movement of their individuals on a short-step 2 http://research.mobility.deustotech.eu/media/publication SPDVCFP.rar. 14 resources/Instances Osaba AC-VRP- Table 2: Parametrization of the EA and ESA for the proposed AC-VRP-SPDVCFP, where −sup∆f is the difference in the objective function of the best and the worse individuals of the initial population, and p=0.95. Parameter Population size Mutation functions Mutation prob. Survivor func. EA Value 100 Insertion Function 1.0 70% Elitist - 30% Random ESA Parameter Value Population size 100 Successor Function Insertion Function Temperature −sup∆f /ln(p) Cooling constant 0.95 operator, and they are easy to implement and can be adapted to solve new problems. It is worth highlighting that, as far as possible, the same operators and similar parameters have been used for all the algorithms implemented for the experimentation. In this way, the intention is to conclude which algorithm obtains better results using similar operators and a similar number of times. Furthermore, with the intention of facilitating the replicability of this study, the parameters used for the EA and ESA are shown in Table 2. It is worth pointing out that all the individuals are randomly generated. Additionally,Pas for the termination criterion, every algorithm finishes its execution when there are n + nk=1 k function evaluations without improvements in the best solution, where n is the size of the problem. In addition, the parameters used for DFA are the described in Section 4.2. In case of DFA, a population of 100 fireflies has also been used. Finally, in this study, the permutation codification has been used for the representations of the solutions. Thus, each solution X is encoded by an unique permutation of numbers, which represents the different routes that compose that solution. Besides that, with the aim of distinguishing the routes in one solution, they are separated by zeros. Before starting the tests, a small study about the parametrization of the DFA is shown. It should be taken into account that performing a comprehensive study on the parameterization of the algorithm would be very extensive. That study has been planned as future work, since the objective of this paper is to present the NDSRP model, and to demonstrate that the DFA shows an adequate performance applied to an R-VRP. For this reason, in this paper a small portion of that study is shown, in order to justify the population size used. For that, we compare 4 different versions of the DFA, each one with a different population size. Each version is called DF Ax , where x is the popualtion size. For this small test, 4 different instances have been used. In Table 3 the results of this experimentation are depicted. In this table, the results average (avg.), and average runtime (Time, in seconds) are shown. In addition, the last row of the table represents the average ranking for each alternative. Table 3: Small study about the population size on the DFA Instance DF A25 Name Avg. Time Osaba 50 1 1 51945.7 14.8 Osaba 50 1 2 57398.7 15.8 Osaba 80 3 92990.39 33.7 Osaba 100 1 110206.94 51.4 Ranking 4 DF A50 Avg. Time 51561.3 25.8 56721.8 26.9 91663.8 47.3 108241.6 81.8 3 DF A100 DF A150 Avg. Time Avg. Time 50989.5 37.9 50934.3 68.9 56203.8 35.1 56213.7 71.8 89512.0 75.3 89531.0 112.3 107799.5 112.8 107745.7 176.4 1.5 1.5 Some conclusions can be drawn if the data presented in Table 3 are analyzed. It can be seen a slight trend of improvement in the results when the population size increases. Even so, this fact involves a significant increase of runtime, which is not directly proportional to 15 Table 4: Results of DFA, ESA and EA for the proposed AC-VRP-SPDVCFP. Instance DFA Name Avg. S. dev. Time C. T. Osaba 50 1 1 50989.5 234.9 37.9 26.2 Osaba 50 1 2 56203.8 203.4 35.1 25.4 Osaba 50 1 3 71730.0 1486.2 37.6 22.3 Osaba 50 1 4 78883.8 1193.4 35.7 23.9 Osaba 50 2 1 49276.0 392.4 38.6 22.3 Osaba 50 2 2 54589.6 628.1 37.8 28.5 Osaba 50 2 3 69631.4 2400.1 38.4 25.9 Osaba 50 2 4 80543.7 1512.3 36.1 22.6 Osaba 80 1 82307.8 1043.4 72.4 57.6 Osaba 80 2 89324.9 698.0 74.0 60.7 Osaba 80 3 89512.0 1414.0 75.3 60.4 Osaba 80 4 104601.9 1299.2 75.0 64.8 Osaba 100 1 107799.5 1501.8 136.1 112.8 Osaba 100 2 100522.9 1683.0 138.0 109.2 Osaba 100 3 95553.7 1470.6 139.7 105.3 Avg. 51632.6 56929.4 72298.3 79168.0 49751.3 54871.6 71352.6 81122.0 80834.2 89989.6 89431.2 105141.7 109183.6 101708.0 95641.3 ESA S. dev. Time 479.0 31.0 459.1 31.7 1484.4 32.1 1788.8 29.4 538.3 33.0 621.0 31.8 2883.4 33.6 1675.3 32.4 1801.4 67.0 1134.4 67.6 2680.1 68.5 1963.3 69.4 1540.4 129.3 1644.1 130.4 2687.3 128.0 C. T. Avg. 22.7 51569.3 21.0 57008.8 17.4 72490.7 20.0 79207.9 19.8 49416.8 23.7 55007.3 21.6 71286.3 19.1 81297.3 53.4 81779.6 54.3 90090.6 55.2 89883.1 61.3 106689.3 108.1 109614.4 102.0 101908.1 98.4 95893.7 EA S. dev. 649.7 540.9 1413.4 1612.4 760.6 837.0 3037.6 1894.3 2018.4 1032.5 2949.6 1832.9 1700.7 1699.0 2472.0 Time 38.4 34.0 36.1 34.8 36.9 38.1 37.5 36.0 71.8 73.4 75.6 74.8 140.7 141.0 140.3 C. T. 26.8 26.4 21.8 24.5 20.4 27.9 25.1 23.1 58.0 59.4 59.8 65.3 116.7 111.9 108.4 the improvement in results. In this paper, to achieve the proposed, the option which best balances the runtime and results quality has been selected. This option is DF A100 . This version has acceptable execution times, and is the alternative that more improvement offers regarding its previous version. DF A150 , on the other hand, needs very high execution times without offering significant improvements in the results quality. Once carried out this small study, the results obtained by the three techniques for the proposed benchmark are summarized in Table 4. In this table, the results average (avg.), standard deviation (S. dev), average runtime (Time, in seconds) and average convergence time (C. T, in seconds) are shown. Additionally, the best results averages have been represented bolded. Besides that, the best results found for each instance are represented in Table 5. This table also shows the number of vehicles needed to perform every solution, and the technique which reached each of these results. Since this is the first appearance of the AC-VRP-SPDVCFP in the literature, these solutions are considered the best ones found until the publication of this paper. 5.3 Analysis and Discussion Analyzing the results in Table 4, the first conclusion that can be drawn is the following one: DFA outperforms clearly the other algorithms in terms of results. Specifically, the DFA performs better than ESA in 86.66% of the instance (13 out of 15), and in 93.33% of the cases comparing with the EA (14 out of 15). Additionally, the supremacy of DFA can also be seen in Table 5, having obtained the best solution in 80% of the instances (12 out of 15). In relation with the data shown in Table 5, in Figure 3 and Figure 4, the partial representation of the best solutions found by the DFA for the instances Osaba 80 2 and Osaba 100 1 are shown. It is noteworthy that, due to the complex nature of the problem, the complete representation of these solutions would lead to maps with some overlapping lines, complicating the visibility of the whole solution. Therefore, these solutions are shown at cluster-level, showing also several clusters in detail. Another important factor that is worth mentioning is the robustness of the DFA in 16 Table 5: Best solutions found for each instance of the proposed benchmark. Name Osaba Osaba Osaba Osaba Osaba Osaba Osaba Osaba Osaba Osaba Osaba Osaba Osaba Osaba Osaba 50 1 1 50 1 2 50 1 3 50 1 4 50 2 1 50 2 2 50 2 3 50 2 4 80 1 80 2 80 3 80 4 100 1 100 2 100 3 Best Result Vehicles Technique 50641.46 2 DFA 55923.48 3 DFA 68535.19 2 DFA 76276.83 3 DFA 48819.71 2 DFA 53876.86 3 DFA 65059.03 2 DFA 77497.06 3 DFA 77660.84 3 ESA 87835.50 4 DFA 83713.72 3 ESA 101497.11 5 DFA 105165.35 5 DFA 97924.51 4 DFA 88966.48 3 ESA Figure 3: Partial representation of the best solution found by the DFA for the instance Osaba 80 2. Source: Open Street Maps, via uMap, accessed Sept 2015. relation to the other techniques. It should be clarified that the robustness is the capacity of a technique to obtain similar solutions in every run. As can be seen in Table 4, the standard deviation of the results obtained by the DFA is lower than the ones presented by the other metaheuristics in most instances (12 out of 15). This means that the quality of the solutions provided by the DFA move in a narrow range. This characteristic gives robustness and reliability to the algorithm, something crucial if the technique is applied a real environment. Regarding the runtimes, in Table 4 it can be seen how DFA and EA have similar execution times, while the ESA takes less time than its competitors. These same conclusions can be drawn looking at the convergence times, where ESA shows that it needs less time to reach the final solution. This fact can be analyzed in the following way: The DFA needs more time to reach its final solution, showing a better exploration capacity than the ESA. On the other hand, it shows a better exploitation capacity than the EA, since it obtains better results needing similar execution and convergence times. Besides that, two different statistical tests have been conducted in order to obtain rigorous and fair conclusions. It is important to clarify that the result averages obtained by each technique have been use to perform these tests. The guidelines given by Derrac et al. in [59] have been followed to perform this statistical analysis. First of all, the 17 Figure 4: Partial representation of the best solution found by the DFA for the instance Osaba 100 1. Source: Open Street Maps, via uMap, accessed Sept 2015. Friedman’s non-parametric test for multiple comparisons has been used to check if there are any significant differences among all the techniques. The resulting Friedman statistic has been 17.73. Taking into account that the confidence interval has been stated at the 99% confidence level, the critical point in a χ2 distribution with 2 degrees of freedom is 9.21. Since 17.73>9.21, it can be concluded that there are significant differences among the results reported by the three compared algorithms, being DFA the one with the lowest rank. Finally, regarding this Friedman’s test, the computed p-value has been 0.000141. To evaluate the statistical significance of the better performance of DFA, the Holm’s post-hoc test has been conducted using DFA as control algorithm. The unadjusted and adjusted p-values obtained through the application of Holm’s post-hoc procedure can be seen in Table 7. Analyzing this data, and taking into account that all the p-values are lower than 0.05, it can be concluded that DFA is significantly better than ESA and EA at a 95% confidence level. Table 6: Average rankings returned by the Friedman’s non-parametric test for DFA, ESA and EA. Algorithm DFA ESA EA Average Ranking 1.2 2.0667 2.7333 Table 7: Unadjusted and adjusted p-values obtained through the application of Holm’s post-hoc procedure using DFA as control algorithm. Algorithm ESA EA 6 Unadjusted p 0.017622 0.000027 Adjusted p 0.017622 0.000054 Conclusions and Further Work In this work, a new version of the newspaper delivery problem with recycling policy has been tackled. This problem has been modelled as a rich vehicle routing problem, specifically, as an asymmetric and clustered vehicle routing problem with simultaneous pickup and deliveries, variable costs and forbidden paths. It is the first time that a problem like 18 this is presented in the literature, for this reason, a benchmark composed by 15 instances has been also developed, using real-world geographical locations. To deal with such a complex problem, a discrete firefly algorithm has been developed. This application can be considered as the first application of a firefly algorithm to any rich vehicle routing problem. To prove that the proposed DFA is a promising technique, its performance has been compared with those obtained by two other well-known techniques: the evolutionary algorithm, and the evolutionary simulated annealing. The DFA has outperformed these two classic metaheuristics. As for future work, it is intended to extend the application of the DFA to other complex real-world situations, related to transportation and logistics. In addition, comparison with more algorithms and techniques will be carried out. Various improvements will be investigate so as to see if the results shown in this work for the AC-VRP-SPDVCFP can be improved. Besides this, it is intended to conduct a thorough study on the parameterization of the DFA (analyzing, for example, the time complexity). This study has not been done in this work because the main objective is to present the NDSRP model, and to demonstrate that the DFA shows an adequate performance applied to an R-VRP. Finally, it would be useful to perform AC-VRP-SPDVCFP instances using random changes in the asymmetric travel costs. Acknowledgement This project was supported by the European Unions Horizon 2020 research and innovation programme through the TIMON: Enhanced real time services for optimized multimodal mobility relying on cooperative networks and open data project (636220). As well as by the projects TEC2013-45585-C2-2-R from the Spanish Ministry of Economy and Competitiveness, and PC2013-71A from the Basque Government. References [1] Golden, B.L., Wasil, E.A.: Or practicecomputerized vehicle routing in the soft drink industry. Operations research 35(1) (1987) 6–17 [2] Vidal, T., Crainic, T.G., Gendreau, M., Prins, C.: Heuristics for multi-attribute vehicle routing problems: A survey and synthesis. European Journal of Operational Research 231(1) (2013) 1–21 [3] Lahyani, R., Khemakhem, M., Semet, F.: Rich vehicle routing problems: From a taxonomy to a definition. European Journal of Operational Research 241(1) (2015) 1–14 [4] Toth, P., Vigo, D.: The vehicle routing problem. Society for Industrial and Applied Mathematics (2001) [5] de Armas, J., Melián-Batista, B., Moreno-Pérez, J.A., Brito, J.: Gvns for a real-world rich vehicle routing problem with time windows. Engineering Applications of Artificial Intelligence 42 (2015) 45–56 [6] Amorim, P., Parragh, S.N., Sperandio, F., Almada-Lobo, B.: A rich vehicle routing problem dealing with perishable food: a case study. Top 22(2) (2014) 489–508 19 [7] Lahyani, R., Coelho, L.C., Khemakhem, M., Laporte, G., Semet, F.: A multicompartment vehicle routing problem arising in the collection of olive oil in tunisia. Omega 51 (2015) 1–10 [8] Caceres-Cruz, J., Arias, P., Guimarans, D., Riera, D., Juan, A.A.: Rich vehicle routing problem: Survey. ACM Computing Surveys (CSUR) 47(2) (2014) 32 [9] Glover, F.: Tabu search, part i. ORSA Journal on computing 1(3) (1989) 190–206 [10] Kirkpatrick, S., Gellat, C., Vecchi, M.: Optimization by simmulated annealing. science 220(4598) (1983) 671–680 [11] Goldberg, D.: Genetic algorithms in search, optimization, and machine learning. Addison-Wesley Professional (1989) [12] De Jong, K.: Analysis of the behavior of a class of genetic adaptive systems. PhD thesis, University of Michigan, Michigan, USA (1975) [13] Dorigo, M., Blum, C.: Ant colony optimization theory: A survey. Theoretical computer science 344(2) (2005) 243–278 [14] Kennedy, J., Eberhart, R., et al.: Particle swarm optimization. In: Proceedings of IEEE international conference on neural networks. Volume 4., Perth, Australia (1995) 1942–1948 [15] Rodriguez, A., Gutierrez, A., Rivera, L., Ramirez, L.: Rwa: Comparison of genetic algorithms and simulated annealing in dynamic traffic. In: Advanced Computer and Communication Engineering Technology. Springer (2015) 3–14 [16] Cao, B., Glover, F., Rego, C.: A tabu search algorithm for cohesive clustering problems. Journal of Heuristics (2015) 1–21 [17] İnkaya, T., Kayalıgil, S., Özdemirel, N.E.: Ant colony optimization based clustering methodology. Applied Soft Computing 28 (2015) 301–311 [18] Atashpaz-Gargari, E., Lucas, C.: Imperialist competitive algorithm: an algorithm for optimization inspired by imperialistic competition. In: IEEE Congress on Evolutionary Computation. (2007) 4661–4667 [19] Yang, X.S.: A new metaheuristic bat-inspired algorithm. cooperative strategies for optimization. Springer (2010) 65–74 In: Nature inspired [20] Geem, Z.W., Kim, J.H., Loganathan, G.: A new heuristic optimization algorithm: harmony search. Simulation 76(2) (2001) 60–68 [21] Moscato, P., Cotta, C.: A gentle introduction to memetic algorithms. In: Handbook of metaheuristics. Springer (2003) 105–144 [22] Nalepa, J., Blocho, M.: Co-operation in the parallel memetic algorithm. International Journal of Parallel Programming (2014) 1–28 [23] Vidal, T., Crainic, T.G., Gendreau, M., Prins, C.: A hybrid genetic algorithm with adaptive diversity management for a large class of vehicle routing problems with timewindows. Computers & Operations Research 40(1) (2013) 475–489 20 [24] Vidal, T., Crainic, T.G., Gendreau, M., Lahrichi, N., Rei, W.: A hybrid genetic algorithm for multidepot and periodic vehicle routing problems. Operations Research 60(3) (2012) 611–624 [25] Qi, Y., Hou, Z., Li, H., Huang, J., Li, X.: A decomposition based memetic algorithm for multi-objective vehicle routing problem with time windows. Computers & Operations Research 62 (2015) 61–77 [26] Bortfeldt, A., Hahn, T., Männel, D., Mönch, L.: Hybrid algorithms for the vehicle routing problem with clustered backhauls and 3d loading constraints. European Journal of Operational Research 243(1) (2015) 82–96 [27] Zhang, Z., Che, O., Cheang, B., Lim, A., Qin, H.: A memetic algorithm for the multiperiod vehicle routing problem with profit. European Journal of Operational Research 229(3) (2013) 573–584 [28] Nagata, Y., Bräysy, O., Dullaert, W.: A penalty-based edge assembly memetic algorithm for the vehicle routing problem with time windows. Computers & Operations Research 37(4) (2010) 724–737 [29] Nalepa, J., Blocho, M.: Adaptive memetic algorithm for minimizing distance in the vehicle routing problem with time windows. Soft Computing (2015) 1–19 [30] Marinakis, Y., Marinaki, M., Spanou, P.: A memetic differential evolution algorithm for the vehicle routing problem with stochastic demands. In: Adaptation and Hybridization in Computational Intelligence. Springer (2015) 185–204 [31] Yang, X.S.: Nature-inspired metaheuristic algorithms. Luniver press, UK (2008) [32] Fister, I., Yang, X.S., Fister, D., Fister Jr, I.: Firefly algorithm: A brief review of the expanding literature. In: Cuckoo Search and Firefly Algorithm. Springer (2014) 347–360 [33] Fister, I., Fister Jr, I., Yang, X.S., Brest, J.: A comprehensive review of firefly algorithms. Swarm and Evolutionary Computation (2013) [34] Ma, Y., Zhao, Y., Wu, L., He, Y., Yang, X.S.: Navigability analysis of magnetic map with projecting pursuit-based selection method by using firefly algorithm. Neurocomputing (2015) [35] Liang, R.H., Wang, J.C., Chen, Y.T., Tseng, W.T.: An enhanced firefly algorithm to multi-objective optimal active/reactive power dispatch with uncertainties consideration. International Journal of Electrical Power & Energy Systems 64 (2015) 1088–1097 [36] Zouache, D., Nouioua, F., Moussaoui, A.: Quantum-inspired firefly algorithm with particle swarm optimization for discrete optimization problems. Soft Computing (2015) 1–19 [37] Yip, P.P., Pao, Y.H.: Combinatorial optimization with use of guided evolutionary simulated annealing. IEEE Transactions on Neural Networks 6(2) (1995) 290–295 21 [38] Ree, S., Yoon, B.S.: A two-stage heuristic approach for the newspaper delivery problem. Computers & industrial engineering 30(3) (1996) 501–509 [39] Archetti, C., Doerner, K.F., Tricoire, F.: A heuristic algorithm for the free newspaper delivery problem. European Journal of Operational Research 230(2) (2013) 245–257 [40] Campbell, A., Clarke, L., Kleywegt, A., Savelsbergh, M.: The inventory routing problem. In: Fleet management and logistics. Springer (1998) 95–113 [41] Kallehauge, B., Larsen, J., Madsen, O.B., Solomon, M.M.: Vehicle routing problem with time windows. Springer (2005) [42] Boonkleaw, A., Suthikarnnarunai, N., Srinon, R.: Strategic planning and vehicle routing algorithm for newspaper delivery problem: Case study of morning newspaper, bangkok, thailand. In: Proceedings of the World Congress on Engineering and Computer Science. Volume 2. (2009) 1067–1071 [43] Hurter, A.P., Van Buer, M.G.: The newspaper production/distribution problem. Journal of Business Logistics 17 (1996) 85–107 [44] Van Buer, M.G., Woodruff, D.L., Olson, R.T.: Solving the medium newspaper production/distribution problem. European Journal of Operational Research 115(2) (1999) 237–253 [45] Laporte, G., Mercure, H., Nobert, Y.: An exact algorithm for the asymmetrical capacitated vehicle routing problem. Networks 16(1) (1986) 33–46 [46] Toth, P., Vigo, D.: A heuristic algorithm for the symmetric and asymmetric vehicle routing problems with backhauls. European Journal of Operational Research 113(3) (1999) 528–543 [47] Herrero, R., Rodrı́guez, A., Cáceres-Cruz, J., Juan, A.A.: Solving vehicle routing problems with asymmetric costs and heterogeneous fleets. International Journal of Advanced Operations Management 6(1) (2014) 58–80 [48] Chisman, J.A.: The clustered traveling salesman problem. Computers & Operations Research 2(2) (1975) 115–119 [49] Battarra, M., Erdogan, G., Vigo, D.: Exact algorithms for the clustered vehicle routing problem. Operations Research 62(1) (2014) 58–71 [50] Vidal, T., Battarra, M., Subramanian, A., Erdogan, G.: Hybrid metaheuristics for the clustered vehicle routing problem. Computers & Operations Research 58(1) (2014) 87–99 [51] Wang, C., Mu, D., Zhao, F., Sutherland, J.W.: A parallel simulated annealing method for the vehicle routing problem with simultaneous pickup–delivery and time windows. Computers & Industrial Engineering 83 (2015) 111–122 [52] Li, J., Pardalos, P.M., Sun, H., Pei, J., Zhang, Y.: Iterated local search embedded adaptive neighborhood selection approach for the multi-depot vehicle routing problem with simultaneous deliveries and pickups. Expert Systems with Applications 42(7) (2015) 3551–3561 22 [53] Haghani, A., Jung, S.: A dynamic vehicle routing problem with time-dependent travel times. Computers & operations research 32(11) (2005) 2959–2986 [54] Villeneuve, D., Desaulniers, G.: The shortest path problem with forbidden paths. European Journal of Operational Research 165(1) (2005) 97–107 [55] Montané, F.A.T., Galvao, R.D.: A tabu search algorithm for the vehicle routing problem with simultaneous pick-up and delivery service. Computers & Operations Research 33(3) (2006) 595–619 [56] Yang, X.S.: Firefly algorithms for multimodal optimization. In: Stochastic algorithms: foundations and applications. Springer (2009) 169–178 [57] Jati, G.K., et al.: Evolutionary discrete firefly algorithm for travelling salesman problem. Volume 6943. Springer (2011) [58] Zhou, L., Ding, L., Qiang, X.: A multi-population discrete firefly algorithm to solve tsp. In: Bio-Inspired Computing-Theories and Applications. Springer (2014) 648–653 [59] Derrac, J., Garcı́a, S., Molina, D., Herrera, F.: A practical tutorial on the use of nonparametric statistical tests as a methodology for comparing evolutionary and swarm intelligence algorithms. Swarm and Evolutionary Computation 1(1) (2011) 3–18 23
9cs.NE
Improved EEG Event Classification Using Differential Energy A. Harati, M. Golmohammadi, S. Lopez, I. Obeid and J. Picone Neural Engineering Data Consortium, Temple University Philadelphia, Pennsylvania, USA {amir.harati, meysam, silvia.lopez, obeid, picone}@temple.edu Abstract— Feature extraction for automatic classification of EEG signals typically relies on time frequency representations of the signal. Techniques such as cepstral-based filter banks or wavelets are popular analysis techniques in many signal processing applications including EEG classification. In this paper, we present a comparison of a variety of approaches to estimating and postprocessing features. To further aid in discrimination of periodic signals from aperiodic signals, we add a differential energy term. We evaluate our approaches on the TUH EEG Corpus, which is the largest publicly available EEG corpus and an exceedingly challenging task due to the clinical nature of the data. We demonstrate that a variant of a standard filter bank-based approach, coupled with first and second derivatives, provides a substantial reduction in the overall error rate. The combination of differential energy and derivatives produces a 24% absolute reduction in the error rate and improves our ability to discriminate between signal events and background noise. This relatively simple approach proves to be comparable to other popular feature extraction approaches such as wavelets, but is much more computationally efficient. I. INTRODUCTION Electroencephalograms (EEGs) are used in a wide range of clinical settings to record electrical activity along the scalp. EEGs are the primary means by which neurologists diagnose brain-related illnesses such as epilepsy and seizures [1]. We have developed a system, known as AutoEEGTM, that automatically interprets EEGs, and delivers high performance on clinical data [2]. An overview of the system is shown in Figure 1. It incorporates a traditional hidden Markov model (HMM) based system and uses two stages of postprocessing to produce epoch labels. An N-channel EEG is transformed into N independent feature streams using a standard sliding window based approach. These features are then transformed into EEG signal event hypotheses using a standard HMM recognition system [3]. These hypotheses are postprocessed by examining temporal and spatial context to produce epoch labels. discharges that can be focal or lateralized over one hemisphere. These signals display quasi-periodic behavior. GPED events are similar to PLEDs, and manifest themselves as periodic shortinterval diffuse discharges, periodic long-interval diffuse discharges and suppression-burst patterns according to the interval between the discharges. Triphasic waves, which manifest themselves as diffuse and bilaterally synchronous spikes with bifrontal predominance, typically at a rate of 1-2 Hz, are also included in this class. The system also detects three events used to model background noise: (1) artifacts (ARTF) are recorded electrical activity that is not of cerebral origin, such as those due to the equipment, patient behavior or the environment; (2) eye movement (EYEM) are common events that can often be confused with a spike; (3) background (BCKG) is used for all other signals. These six classes were arrived at through several iterations of a study conducted with Temple University Hospital neurologists. Automatic labeling of these events allows a neurologist to rapidly search long-term EEG recordings for anomalous behavior. Performance requirements for this application are extremely aggressive. For the system to be clinically useful, detection rates for the three signal classes must be at least 95% with a false alarm rate below 5%. This is a challenge for clinical data because the recordings contain many artifacts that can easily be interpreted as spikes. Therefore, neurologists still rely on manual review of data in clinical applications. Hence, a unique aspect of the work reported here is that we have used the TUH EEG Corpus [2] for evaluation. TUH EEG is the world’s largest publicly available database of clinical EEG data, comprising more than 28,000 EEG records and over 15,000 patients. It represents the collective output from Temple Epochs are typically 1 sec in duration, while features are computed every 0.1 secs using 0.2 sec analysis windows. These parameters were optimized experimentally [2] in a previous study. Neurologists review EEGs in 10 sec windows, and it is common that pattern recognition systems classify 1 sec epochs. We further divide these 1 sec epochs into 10 frames of 0.1 secs each so that we can model an epoch with an HMM. The system detects three events of clinical interest [4]: (1) spike and/or sharp waves (SPSW), (2) periodic lateralized epileptiform discharges (PLED), and (3) generalized periodic epileptiform discharges (GPED). SPSW events are epileptiform transients that are typically observed in patients with epilepsy. PLED events are indicative of EEG abnormalities and often manifest themselves with repetitive spike or sharp wave Figure 1. A two-level architecture for automatic interpretation of EEGs that integrates hidden Markov models for sequential decoding of EEG events with deep learning for decision-making based on temporal and spatial context. University Hospital’s Department of Neurology since 2002 and is an ongoing data collection project. EEG signals were recorded using several generations of Natus Medical Incorporated’s NicoletTM EEG recording technology. The raw signals obtained from the studies consist of multichannel recordings that vary between 20 and 128 channels sampled at a minimum of 250 Hz minimum using a 16-bit A/D converter. The data is stored in a proprietary format that has been exported to EDF with the use of NicVue v5.71.4.2530. In our study, we have resampled all the data to a common sample frequency of 250 Hz. II. EEG FEATURES Our system uses a fairly standard cepstral coefficient-based feature extraction approach similar to the Mel Frequency Cepstral Coefficients (MFCCs) used in speech recognition [3],[5],[6]. Though popular alternatives to MFCCs in EEG processing include wavelets, which are used by many commercial systems, our experiments with such features have shown very little advantage over MFCCs [7] on the TUH EEG Corpus. Therefore, in this study we have focused on filter bank approaches. Further, unlike speech recognition which uses a mel scale for reasons related to speech perception, we use a linear frequency scale for EEGs, since there is no physiological evidence that a log scale is meaningful [4]. The focus of this paper is an exploration of some traditional tuning parameters associated with cepstral coefficient approaches. In this study, we limit our explorations to the tradeoffs in computing energy and differential features, since these have the greatest impact on performance. It is common in the MFCC approach to compute cepstral coefficients by computing a high resolution fast Fourier Transform, downsampling this representation using an oversampling approach based on a set of overlapping bandpass filters, and transforming the output into the cepstral domain using a discrete cosine transform [8],[9]. The zeroth-order cepstral term is typically discarded and replaced with an energy term as described below. There are two types of energy terms that are often used: time domain and frequency domain. Time domain energy is a straightforward computation using the log of the sum of the squares of the windowed signal: !" = log ' ( (.' /01 )(+) - have introduced a differential energy term that attempts to model the long-term change in energy. This term examines energy over a range of M frames centered about the current frame, and computes the difference between the maximum and minimum over this interval: !; = <=) !2 < > − <@+ !2 < > (2) We typically use a 0.9 sec window for this calculation. This simple feature has proven to be surprisingly effective. The final step to note in our feature extraction process is the familiar method for computing derivatives of features using a regression approach [5],[8],[9]: B" = H /(C DEF .CDGF ) FIJ K - H FIJ / (3) where B" is a delta coefficient, from frame L computed in terms of the static coefficients M"N/ to M"./ . A typical value for N is 9 (corresponding to 0.9 secs) for the first derivative in EEG processing, and 3 for the second derivative. These features, which are often called deltas because they measure the change in the features over times, are one of the most well-known features in speech recognition [8]. We typically use this approach to compute the derivatives of the features and then apply this approach again to those derivatives to obtain an estimate of the second derivatives of the features, generating what are often called delta-deltas. This triples the size of the feature vector (adding deltas and delta-deltas), but is well-known to deliver improved performance. This approach has not been extensively evaluated in EEG processing. Dimensionality is something we must always pay attention to in classification systems since our ability to model features is directly related to the amount of training data available. The use of differential features raises the dimension of a typical feature vector from 9 (e.g., 7 cepstral coefficients, frequency domain energy and differential energy) to 27. There must be sufficient training data to support this increase in dimensionality or any improvements in the feature extraction process will be masked by poor estimates of the model parameters (e.g., Gaussian means and covariances). As we will show in the next section, the TUH EEG Corpus is large enough to support such studies. (Error! No sequence specified.) We use an overlapping analysis window (a 50% overlap was used here) to ensure a smooth trajectory of this features. The energy of the signal can also be computed in the frequency domain by computing the sum of squares of the oversampled filter bank outputs after they are downsampled: !2 = 345 (.' 801 6 7 - (1) This form of energy is commonly used in speech recognition systems because it provides a smoother, more stable estimate of the energy that leverages the cepstral representation of the signal. However, the virtue of this approach has not been extensively studied for EEG processing. In order to improve differentiation between transient pulse-like events (e.g., SPSW events) and stationary background noise, we Figure 2. An illustration of how the differential energy term accentuates the differences between spike-like behavior and noiselike behavior. Detection of SPSW events is critical to the success of the overall system. III. EXPERIMENTATION No. We have used a subset of TUH EEG that has been manually labeled for the six types of events described in Section I. The training set contains segments from 359 sessions while the evaluation set was drawn from 159 sessions. No patient appears more than once in the entire subset, which we refer to as the TUH EEG Short Set. A distribution of the frequency of occurrence of the 6 types of events in the training and evaluation set is shown in Table 1. The training set was designed to provide a sufficient number of examples to train statistical models such as HMMs. Note that some classes, such as SPSW, occur much less frequently in the actual corpus than common events such as BCKG. In fact, 99% of the data is assigned to the class BCKG, so special care must be taken to build robust classifiers for the non-background classes. High performance detection of EEG events requires dealing with infrequently occurring events since the majority of the data is normal (uninformative). Hence, the evaluation set was designed to contain a reasonable representation of all classes. We refer to the 6 classes shown in Table 1 as the 6-way classification problem. This is not necessarily the most informative performance metric. It makes more sense to collapse the 3 background classes into one category. We refer to this second evaluation paradigm as a 4-way classification task: SPSW, GPED, PLED and BACKG. The latter class contains an enumeration of the 3 background classes. Finally, in order that we can produce a DET curve [10], we also report a 2-way classification task in which we collapse the data into a target class (TARG) and a background class (BCKG). DET curves are generated by varying a threshold typically applied to likelihoods to evaluate the tradeoff between detection rates and false alarms. However, it is also instructive to look at specific numbers in table form. Therefore, all experiments reported in the tables use a scoring penalty of 0, which essentially means we are evaluating the raw likelihoods returned from the classification system. In virtually all cases, the trends shown in these tables hold up for the full range of the DET curve. A. Absolute Features The first series of experiments was run on a simple combination of features. A summary of these experiments is shown in Table 2. Cepstral-only features were compared with several energy estimation algorithms. It is clear that the combination of frequency domain energy and differential energy provides a substantial reduction in performance. However, note that differential energy by itself (system no. 4) produces a noticeable Train Event SPSW GPED PLED EYEM ARTF BCKG Total: No. 645 6184 11,254 1,170 11,053 53,726 84,032 Eval % (CDF) No. 0.8% ( 1%) 7.4% ( 8%) 13.4% ( 22%) 1.4% ( 23%) 13.2% ( 36%) 63.9% (100%) 100.0% (100%) 567 1,998 4,677 329 2,204 19,646 29,421 % (CDF) 1.9% ( 2%) 6.8% ( 9%) 15.9% ( 25%) 1.1% ( 26%) 7.5% ( 33%) 66.8% (100%) 100.0% (100%) Table 1. An overview of the distribution of events in the subset of the TUH EEG Corpus used in our experiments. System Description Dims. 6-Way 4-Way 2-Way 1 Cepstral 7 59.3% 33.6% 24.6% 2 Cepstral + Ef 8 45.9% 33.0% 24.0% 3 Cepstral + Et 8 44.9% 33.7% 24.8% 4 Cepstral + Ed 8 55.2% 32.8% 24.3% 5 Cepstral + Ef +Ed 9 39.2% 30.0% 20.4% Table 2. Performance on the TUH EEG Short Set of the base cepstral features augmented with an energy feature. System no. 5 uses both frequency domain and differential energy features. Note that the results are consistent across all classification schemes. degradation in performance. Frequency domain energy clearly provides information that complements differential energy. The improvements produced by system no. 5 hold for all three classification tasks. Though this approach increases the dimensionality of the feature vector by one element, the value of that additional element is significant and not replicated by simply adding other types of signal features [11]. B. Differential Features A second set of experiments were run to evaluate the benefit of using differential features. These experiments are summarized in Table 3. The addition of the first derivative adds about 7% absolute in performance (e.g., system no. 6 vs. system no. 1). However, when differential energy is introduced, the improvement in performance drops to only 4% absolute. The story is somewhat mixed for the use of second derivatives. On the base cepstral feature vector, second derivatives reduce the error rate on the 6-way task by 4% absolute (systems no. 1, 6 and 11). However, the improvement for a system using differential energy is much less pronounced (systems no. 5, 10 and 15). In fact, it appears that differential energy and derivatives do something very similar. Therefore, we evaluated a system that eliminates the second derivative for differential energy. This system is labeled no. 16 in Table 3. We obtained a small but significant improvement in performance over system no. 10. The improvement on 4-way classification was larger, which indicates more of an impact on differentiating between No. System Description Dims. 6-Way 4-Way 2-Way 6 Cepstral + Δ 14 56.6% 32.6% 23.8% 7 Cepstral + Ef + Δ 16 43.7% 30.1% 21.2% 8 Cepstral + Et + Δ 16 42.8% 31.6% 22.4% 9 Cepstral + Ed + Δ 16 51.6% 30.4% 22.0% 10 Cepstral + Ef +Ed + Δ 18 35.4% 25.8% 16.8% 11 Cepstral + Δ + ΔΔ 21 53.1% 30.4% 21.8% 12 Cepstral + Ef + Δ + ΔΔ 24 39.6% 27.4% 19.2% 13 Cepstral + Et + Δ + ΔΔ 24 39.8% 29.6% 21.1% 14 Cepstral + Ed + Δ + ΔΔ 24 52.5% 30.1% 22.6% 15 Cepstral + Ef +Ed + Δ + ΔΔ 27 35.5% 25.9% 17.2% 16 (15) but no ΔΔ for Ed 26 35.0% 25.0% 16.6% Table 3. The impact of differential features on performance is shown. For the overall best systems (nos. 10 and 15), second derivatives do not help significantly. Differential energy and derivatives appear to capture similar information. PLEDs, GPEDs and SPSW vs. background. This is satisfying since this this feature was designed to address this problem. The results shown in Tables 1-3 hold up under DET curve analysis as well. DET curves for systems nos. 1, 5, 10, and 15 are shown in Figure 3. We can see that the relative ranking of the systems is comparable over the range of the DET curves. First derivatives deliver a measurable improvement over absolute features (system no. 10 vs. no. 5). Second derivatives do not provide as significant an improvement (system no. 15 vs. no. 10). Differential energy provides a substantial improvement over the base cepstral features. It should be noted that user requirements for this type of technology includes an extremely low false alarm rate. Neurologists have expressed a need for a false alarm rate on the order of no more than one or two per day per bed while maintaining a detection rate of 95%. In related work we are able to approach these levels of performance using postprocessing steps alluded to in Figure 1. At these levels of performance, the differences between systems becomes more significant, and the use of second derivatives can potentially be more significant. IV. SUMMARY In this paper, we have essentially calibrated some important algorithms used in feature extraction for EEG processing. We have shown that traditional feature extraction methods used in other fields such as speech recognition are relevant to EEGs. The use of a novel differential energy feature improved performance for absolute features (system nos. 1-5), but that benefit diminishes as first and second order derivatives are included. We have shown there is benefit to using derivatives and there is a small advantage to using frequency domain energy. In related research [7],[11] we are evaluating approaches based on wavelets and other time-frequency representations. Preliminary results seem to indicate there are no significant benefits to these representations. Hence, in this work we have focused on optimization of our standard approach. Future work will focus on new feature extraction methods based on principles of deep learning [12], discriminative training [13] and nonparametric Bayesian models [14]. ACKNOWLEDGEMENTS The primary funder of this research was the QED Proof of Concept program of the University City Science Center (Grant No. S1313). Research reported in this publication was also supported by the National Human Genome Research Institute of the National Institutes of Health under Award Number U01HG008468 and the National Science Foundation through Major Research Instrumentation Grant No. CNS-09-58854. The TUH EEG database work was funded by (1) the Defense Advanced Research Projects Agency (DARPA) MTO under the auspices of Dr. Doug Weber through the Contract No. D13AP00065, (2) Temple University’s College of Engineering and (3) Temple University’s Office of the Senior Vice-Provost for Research. Finally, we are also grateful to Dr. Mercedes Jacobson, Dr. Steven Tobochnik and David Jungries of the Temple University School of Medicine for their assistance in developing the classification paradigm used in this study and for preparing the manually annotated data. REFERENCES [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] Figure 3. A DET curve analysis of feature extraction systems that compares absolute and differential features. The addition of first derivatives provides a measurable improvment in performance while second derivatives are less beneficial. [14] T. Yamada and E. Meng, Practical Guide for Clinical Neurophysiologic Testing: EEG. Philadelphia, Pennsylvania, USA: Lippincott Williams & Wilkins, 2009. A. Harati, S. Lopez, I. Obeid, M. Jacobson, S. Tobochnik, and J. Picone, “THE TUH EEG CORPUS: A Big Data Resource for Automated EEG Interpretation,” in Proceedings of the IEEE SPMB, 2014, pp. 1–5. J. Picone, “Continuous Speech Recognition Using Hidden Markov Models,” IEEE ASSP Mag., vol. 7, no. 3, pp. 26–41, Jul. 1990. S. Sanei and J. A. Chambers, EEG signal processing. Hoboken, New Jersey, USA: Wiley-Interscience, 2008. J. Lyons, “Mel Frequency Cepstral Coefficient (MFCC) tutorial,” Practical Cryptography, 2015 (available: http://practicalcryptography. com/miscellaneous/machine-learning/guide-mel-frequency-cepstralcoefficients-mfccs/. S. Davis and P. Mermelstein, “Comparison of Parametric Representations for Monosyllabic Word Recognition in Continuously Spoken Sentences,” IEEE Trans. ASSP, vol. 28, no. 4, pp. 357–366, 1980. P. Garrit, et al., “Wavelet Analysis for Feature Extraction on EEG Signals,” presented at Temple University CoE Res. Exp. for UG Conf., 2015 (available at http://www.isip.piconepress.com/publications/ unpublished/conferences/2015/summer_of_code/wavelets/). X. Huang, A. Acero, and H.-W. Hon, Spoken Language Processing: A Guide to Theory, Algorithm and System Development. Upper Saddle River, New Jersey, USA: Prentice Hall, 2001. J. Picone, “Signal modeling techniques in speech recognition,” Proc. IEEE, vol. 81, no. 9, pp. 1215–1247, 1993. A. Martin, G. Doddington, T. Kamm, M. Ordowski, and M. Przybocki, “The DET curve in assessment of detection task performance,” in Proceedings of Eurospeech, 1997, pp. 1895–1898. A. Moura, I. Obeid, and J. Picone, “Feature Extraction Methods for EEG Event Detection,” in Temple University College of Eng. Res. Exp. for Undergrad. Conf., 2015 (available at http://www.isip.piconepress.com/ publications/unpublished/conferences/2015/summer_of_code/features/). J. Snoek, R. P. Adams, and H. Larochelle, “Nonparametric guidance of autoencoder representations using label information,” J. Mach. Learn. Res., vol. 13, no. 1, pp. 2567–2588, 2012. D. Povey, et al., “Boosted MMI for model and feature-space discriminative training,” Proceedings of the IEEE Int. Conf. on ASSP, Las Vegas, Nevada, USA, pp. 4057–4060, 2008. A. Harati and J. Picone, “A Doubly Hierarchical Dirichlet Process Hidden Markov Model with a Non-Ergodic Structure,” submitted to the IEEE/ACM Trans. Audio, Speech, Lang. Process., 2015.
1cs.CV
Grader variability and the importance of reference standards for evaluating machine learning models for diabetic retinopathy arXiv:1710.01711v1 [cs.CV] 4 Oct 2017 Jonathan Krause1 , Varun Gulshan1 , Ehsan Rahimy2 , Peter Karth3 , Kasumi Widner1 , Greg S. Corrado1 , Lily Peng1? , Dale R. Webster1? 1 Google Research 2 Palo Alto Medical Foundation 3 Oregon Eye Consultants Abstract. Diabetic retinopathy (DR) and diabetic macular edema are common complications of diabetes which can lead to vision loss. The grading of DR is a fairly complex process that requires the detection of fine features such as microaneurysms, intraretinal hemorrhages, and intraretinal microvascular abnormalities. Because of this, there can be a fair amount of grader variability. There are different methods of obtaining the reference standard and resolving disagreements between graders, and while it is usually accepted that adjudication until full consensus will yield the best reference standard, the difference between various methods of resolving disagreements has not been examined extensively. In this study, we examine the variability in different methods of grading, definitions of reference standards, and their effects on building deep learning models for the detection of diabetic eye disease. We find that a small set of adjudicated DR grades allows substantial improvements in algorithm performance. The resulting algorithm’s performance was on par with that of individual U.S. board-certified ophthalmologists and retinal specialists. 1 Introduction Diabetic retinopathy (DR) and diabetic macular edema (DME) are common complications of diabetes which can lead to vision loss. There are several methods for assessing the severity of diabetic eye disease, such as the Early Treatment Diabetic Retinopathy Study (ETDRS) Grading System [1], the Scottish Diabetic Retinopathy Grading System [2], and the International Clinical Diabetic Retinopathy (ICDR) disease severity scale [3]. The ICDR scale is one of the more commonly used grading rubrics and consists of a 5 point grade for DR – no, mild, moderate, severe, and proliferative. The grading of DR is a fairly complex process that requires the detection of fine features such as microaneurysms (MA), intraretinal hemorrhages, and intraretinal microvascular abnormalities (IRMA). Because of this, there can be a fair amount of grader variability [1,4,5]. This is not surprising as grader variability is a well-known issue with human interpretation of imaging in other medical fields such as radiology [6] or pathology [7]. There are different methods of obtaining the reference standard and resolving disagreements between graders. One method consists of taking the majority decision from ? Equal contribution a group of three or more independent graders. Another method consists of having a group of two or more graders work independently and then having a third generally more senior grader arbitrate disagreements, with the senior graders decision serving as the reference standard. Lastly, it is also common to have a group of three or more graders grade independently and then discuss disagreements until there is full consensus on the final grade. It is usually accepted that adjudication until full consensus will yield the best reference standard, but the difference between various methods of resolving disagreements has not been examined extensively. Deep learning [8] is a family of machine learning techniques that allows computers to learn the most predictive features directly from images, given a large dataset of labeled examples, without specifying rules or features explicitly. It has also been applied recently in medical imaging, producing highly accurate algorithms for a variety of classification tasks, including melanoma [9] and diabetic retinopathy (DR) [10, 11]. Because the network is trained to predict labels that have been paired with the images, it is imperative that the labels accurately represent the state of disease found in the image, especially for the evaluation sets (e.g. tuning and external validation/test sets). In this study, we examine the variability in different methods of grading, definitions of reference standards, and their effects on building deep learning models for the detection of diabetic eye disease. 2 2.1 Methods Datasets In this work, we build upon the datasets used by Gulshan et al. [10] for algorithm development and validation. The development dataset used consists of images obtained from the EyePACS clinics and three eye hospitals in India (Aravind eye hospital, Sankara Nethralaya, and Narayana Nethralaya) among patients presenting themselves for diabetic retinopathy screening. While Gulshan et al. [10] used only macula-centered images for development, in this work we also use temporal- and disc-centered field of view images, and in addition use more patient data acquired from the EyePACS clinics (see Table 1 for distributions). The clinical validation datasets used in Gulshan et al. [10] are also used as part of the development set. These consist of images from the EyePACS clinics and the publicly available Messidor 2 dataset [12, 13]. All images were deidentified according to Health Insurance Portability and Accountability Act Safe Harbor prior to transfer to study investigators. Ethics review and institutional review board exemption was obtained using Quorum Review IRB. For clinical validation, further macula-centered images were acquired from the EyePACS clinics (imaged between May-October 2015). A variety of cameras were used, including Centervue DRS, Optovue iCam, Canon CR1/DGi/CR2, and Topcon NW using 45 fields of view. EyePACS images were acquired as a part of routine clinical care for diabetic retinopathy screening. These did not overlap with any images used in the development dataset. 2 2.2 Grading and Adjudication There were three kinds of grades used in the development dataset: grading by ophthalmologists, grading by the EyePACS graders, and adjudicated grading by multiple retina specialists. The first grading source was the same as in Gulshan et al. [10], where each image was independently graded by ophthalmologists (post-residency or trainees in their 4th year). The second source of grades was provided by the EyePACS clinics, graded according to the EyePACS protocol [14]. In the EyePACS protocol, all three images of an eye are graded together and assigned a single grade. For development, we use the grade provided for the entire eye as a grade for each image – while this yielded a noisy label, we still found it helpful in training the algorithm (see Results). These grades were available for all images in the development set obtained from EyePACS. The third type of grades available were obtained on a small subset of images (referred to as the tuning set), using an adjudication protocol. The tuning set consisted of 1,989 images from the EyePACS clinics and 1,748 images from the Messidor-2 set. The images were first independently graded by three fellowship-trained retina specialists and then all disagreements resolved by face-to-face discussions. These adjudicated grades were only used for tuning the algorithm hyperparameters (e.g. image resolution, learning rate) and making model choices (e.g. network architectures), but not for training the model parameters. The test set was graded using the same adjudication protocol the tuning set (faceto-face adjudication by three retina specialists). In addition, the test set was graded by three ophthalmologists (distinct from the retina specialists who adjudicated the test set), in order to measure the performance of the ophthalmologists relative to the algorithm in an unbiased setting. After grading, all disagreements between the adjudicated consensus of retinal specialists and majority decision of the ophthalmologists were reviewed manually by a retinal specialist, who also assigned a likely reason for the discrepancy. 2.3 Algorithm Our deep learning algorithm for predicting diabetic retinopathy and diabetic macular edema builds upon the architecture used in Gulshan et al. [10], which we first provide a summary of for sake of completion. Gulshan et al. trained a convolutional neural network [15] for predicting multiple binary predictions, such as moderate or worse diabetic retinopathy, referable diabetic macular edema, or gradability of image. The input to the neural network is an image of a fundus, and through the use of many stages of computation, parameterized by millions of numbers, the network outputs a real-valued number between 0 and 1 for each of those binary predictions, indicating how confident it is that the image falls in the referable category. The parameters of a neural network are determined by training it on a dataset of fundus images. Repeatedly, a model is given an image with a known severity rating for diabetic retinopathy, and the model predicts its confidence in diabetic retinopathy, slowly adjusting its parameters over the course of the training process in order to become more accurate. The network used in Gulshan et al. was an Inception-v3 model [16], pre-trained on the ImageNet [17] dataset to speed up training. The model was trained via distributed stochastic gradient descent and evaluated periodically on 3 a tuning dataset throughout the training process. The tuning dataset was used to determine model hyperparameters (parameters of the model architecture that cannot be trained with gradient descent). Finally, Gulshan et al. created an ensemble of models, training 10 such Inception-v3 models and combining their predictions, which improves performance and robustness. 2.4 Algorithmic Improvements Compared to Gulshan et al., we make a number of improvements to the core neural network. First, we trained our model on a much larger set of images, obtained from the teleophthalmology provider EyePACS [18]. Since it would be prohibitively expensive to re-label all of these images with US-licensed ophthalmologists (as done in Gulshan et al.), we also use labels determined by the EyePACS grading centers to train our diabetic retinopathy classifier. In order to use both our ophthalmologist grading and the EyePACS grading effectively, we treat the labels obtained from these two independent sources as separate prediction targets, i.e. we train our model to predict both an EyePACS grade for diabetic retinopathy and a grade determined by our own labeling procedure, if present. Using this larger training set, we performed a more extensive search for wellperforming hyperparameters using a gaussian process bandit algorithm [19]. One significant change in model hyperparameters that resulted is an increase in the resolution of input images: the model used in this work has an input resolution of 779 x 779 pixels, a large increase over the 299 x 299 pixels used in Gulshan et al. This has the effect of increasing the effective resolution as which lesions are seen. For example, a microaneurysm or small hard exudate might occupy only one pixel or less within a 299 x 299 image [20, 21], but at this higher resolution, it would occupy roughly 3.4 x 3.4 pixels – still small, but more than 10 times the area. Other significant changes include upgrading our model architecture from Inceptionv316 to Inception-v4 and predicting a 5-class rating for diabetic retinopathy (Gulshan et al. only predicted binary referables). 2.5 Evaluation One advantage of using a machine learning-based system to predict diabetic retinopathy is that it explicitly outputs a confidence in the range [0,1] for each image. By applying a threshold to this confidence to determine referability, we can tune the algorithms sensitivity and specificity based on a particular use case – as one lowers the threshold, the algorithm becomes more sensitive, but less specific. Performance across many different thresholds is depicted in a receiver operating curve (ROC), and is summarized with the area under the curve (AUC). The primary evaluation of our model is thusly AUC for different levels of diabetic retinopathy (e.g. AUC for predicting moderate and above diabetic retinopathy). In addition, for some experiments on 5-class prediction, we evaluate using the quadratic-weighted Cohens kappa [22]. The decision criterion for predicting 5-class DR severity is based on a series of thresholds: if the predicted probability of proliferative DR is above a threshold (determined to reach a target sensitivity of on the tuning set), the algorithms prediction is proliferative DR. If not, then 4 a separate threshold is applied to the algorithms prediction for severe DR or worse to determine whether the algorithm predicts severe DR, and so on down to mild DR. If none of predicted probabilities pass their corresponding threshold, no DR is predicted. 3 3.1 Results Grading and Adjudication The baseline characteristics of the development and clinical validation datasets are described in Table 1. The training portion of the development set consisted of over 1.6M fundus images from 238,610 unique individuals. The tune portion of the development set consisted of adjudicated grades for 3,737 images from 2,643 unique individuals. The clinical validation set consisted of 1,958 photos from 998 unique individuals. Compared to the clinical validation set, the development set had a slightly higher proportion of abnormal images. A comparison of the grades generated by the majority decision of the retinal specialists in the panel before adjudication against the adjudicated reference standard is outlined in Table 2. Most grades remained within 1 step of each level of severity. For DR, there were 27 instances (1.5% of images) where the difference was two steps, and none that were three or more. Adjudication more often yielded new grades with higher levels of severity. The weighted-kappa score for the grade determined by the majority decision of retinal specialists and by adjudication was 0.91 (Table 3). To better characterize the difference in each retinal specialists pre-adjudication grade and the adjudicated consensus for detecting moderate and above diabetic retinopathy, we measured the sensitivity and specificity of the each specialist. While all three specialists were very specific ( 99%), sensitivity ranged from 74.4-82.1%, corresponding to weighted-kappa scores of 0.82-0.91. The majority decision of the panel of three retina specialists showed higher sensitivity (88.1%) than grades from individual specialists (Table 3), leaving 11.9% of further cases with moderate or above DR that required the adjudicated consensus to detect. In addition to having retinal specialists grade and adjudicate the clinical validation datasets, we also had three U.S.-board certified ophthalmologists grade the same set (Table 4). Quadratic-weighted kappa values were generally good (0.80-0.84), but somewhat lower for ophthalmologists than for the retina specialists (Table 5). The majority decision of the ophthalmologists yielded higher agreement (weighted kappa: 0.87) than individual ophthalmologists alone. Disagreements were more common in cases where the adjudicated consensus yielded referable disease (Figure 1). In-person face-to-face adjudication sessions of the three retina specialists yielded considerable insights in the grading process. First, image artifacts, especially those resembling typical pathology such as microaneurysms, were a common source of disagreement. This was carried over many images, as artifacts are often caused by consistent lens defects. The adjudication process was critical in correcting these errors. Additionally, there was initial subjective variance in exact definition of grades and de facto boundaries between grades at the outset of the adjudication process. While traditional grading definitions are fixed, it became very clear that there are gray areas and significant variance within these definitions, which caused initial disagreement. Once all 5 three retina specialists converged on a more precise set of definitions, staying within but also refining the traditional definitions, initial disagreements were reduced over time. Overall, each of the retina specialists voiced that the precision used in the adjudication process was above that typically used in everyday clinical practice. A summary of the causes of errors in the non-adjudicated grades generated from the majority decision of the ophthalmologists is presented in Table 6. The most common causes were missed microaneurysms (36%), artifacts (20%), and disagreement regarding whether a lesion was an MA or a hemorrhage (16%). 36 out of 193 disagreements differed by at least two grades (e.g. no DR vs. moderate or moderate vs. proliferative). Overgrading, i.e. cases where the majority decision of the ophthalmologists was more severe than the final adjudicated grade, accounted for 14 (7.3%) of the disagreements, while undergrading accounted for 22 (11.4%) of the cases. 3.2 Model Results We show our main results in Table 7, comparing performance of our model and its improvements using either the majority decision and adjudicated grades as the reference standard. When using majority decision as the reference standard, increasing image resolution shows no clear effect on predicting mild or worse DR (Figure 2). However, when using adjudicated grades, increasing resolution improves the models AUC from 0.930 to 0.986 for mild or worse DR. However, increasing resolution beyond roughly 500 x 500 pixel input seemed to have marginal performance gains. Another benefit of evaluating with adjudicated grades is in reduced metric variability, where one can observe significantly reduced metric variance (confidence intervals) across all input resolutions. We illustrate the performance of our final model using the adjudicated consensus as the reference standard in Table 8. On 5-class DR prediction, our model achieved a quadratic-weighted kappa of 0.84, which is on par with the performance of individual ophthalmologists and retinal specialists. There were 257 disagreements between the adjudicated consensus and the model. Out of the 56 (21.8%) disagreements that were two or more steps, 53 (20.6%) were the result of overgrading, i.e. the model predicted a higher grade than the adjudicated consensus, and 3 (1.2%) resulted from undergrading. In addition to 5-point grading analysis for DR, we also demonstrate the models performance in binary classification tasks. Figure 3 summarizes the models performance as well as that of the ophthalmologists and retinal specialists in detecting mild or worse DR, moderate or worse DR, severe or worse DR, and proliferative DR. For all of these classification tasks, the algorithms performance was roughly on par with that of individual ophthalmologists and retinal specialists. For mild or worse DR the algorithm had a sensitivity of 0.970, specificity of 0.917 and AUC of 0.986. 4 Discussion Deep learning has garnered much attention recently due to it ability to create highly accurate algorithms from large datasets of labeled data without feature engineering. However, care must be taken to evaluate these algorithms against as high-quality ground truth labels as possible. In previous work [10], we used majority decision as the way 6 of generate the ground truth. This works suggests that adjudication provides a more rigorous reference standard, especially for the identification of artifacts and missed microaneurysms. However, adjudication is costly. We demonstrate that by adjudicating a small subset (0.22%) of the training image grades for the tune set, we are able to significantly improve model performance without adjudicating the entire training corpus of images. The resulting models performance was roughly on par with that of individual ophthalmologists and retinal specialists. Using adjudication as the reference standard also improves algorithm development, allowing us to see an improvement in AUC when using higher-resolution images as input and reduced metric variability during training. 5 Acknowledgements From Google Research: Yun Liu, Derek Wu, Katy Blumer, Philip Nelson From EyePACS: Jorge Cuadros References 1. Early Treatment Diabetic Retinopathy Study Research Group et al. Grading diabetic retinopathy from stereoscopic color fundus photographsan extension of the modified airlie house classification: Etdrs report number 10. Ophthalmology, 98(5):786–806, 1991. 1 2. Diabetic retinopathy screening services in scotland: A training handbook July 2003: page 17. http://www.ndrs-wp.scot.nhs.uk/?page_id=1609. Accessed: June 21, 2017. 1 3. American academy of ophthalmology. international clinical diabetic retinopathy disease severity scale, detailed table. http://www.icoph.org/dynamic/attachments/ resources/diabetic-retinopathy-detail.pdf. Accessed: Oct 14, 2016. 1 4. Ingrid U Scott, Neil M Bressler, Susan B Bressler, David J Browning, Clement K Chan, Ronald P Danis, Matthew D Davis, Craig Kollman, Haijing Qin, Diabetic Retinopathy Clinical Research Network Study Group, et al. Agreement between clinician and reading center gradings of diabetic retinopathy severity level at baseline in a phase 2 study of intravitreal bevacizumab for diabetic macular edema. Retina (Philadelphia, Pa.), 28(1):36, 2008. 1 5. Helen K Li, Larry D Hubbard, Ronald P Danis, Adol Esquivel, Jose F Florez-Arango, Nicola J Ferrier, and Elizabeth A Krupinski. Digital versus film fundus photography for research grading of diabetic retinopathy severity. Invest Ophthalmol Vis Sci, 51(11):5846– 5852, 2010. 1 6. Joann G Elmore, Carolyn K Wells, Carol H Lee, Debra H Howard, and Alvan R Feinstein. Variability in radiologists’ interpretations of mammograms. New England Journal of Medicine, 331(22):1493–1499, 1994. 1 7. Joann G Elmore, Gary M Longton, Patricia A Carney, Berta M Geller, Tracy Onega, Anna NA Tosteson, Heidi D Nelson, Margaret S Pepe, Kimberly H Allison, Stuart J Schnitt, et al. Diagnostic concordance among pathologists interpreting breast biopsy specimens. Jama, 313(11):1122–1132, 2015. 1 8. Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436– 444, 2015. 2 9. Andre Esteva, Brett Kuprel, Roberto A Novoa, Justin Ko, Susan M Swetter, Helen M Blau, and Sebastian Thrun. Dermatologist-level classification of skin cancer with deep neural networks. Nature, 542(7639):115–118, 2017. 2 7 10. Varun Gulshan, Lily Peng, Marc Coram, Martin C Stumpe, Derek Wu, Arunachalam Narayanaswamy, Subhashini Venugopalan, Kasumi Widner, Tom Madams, Jorge Cuadros, et al. Development and validation of a deep learning algorithm for detection of diabetic retinopathy in retinal fundus photographs. Jama, 316(22):2402–2410, 2016. 2, 3, 7 11. Rishab Gargeya and Theodore Leng. Automated identification of diabetic retinopathy using deep learning. Ophthalmology, 2017. 2 12. Etienne Decencière, Xiwei Zhang, Guy Cazuguel, Bruno Laÿ, Béatrice Cochener, Caroline Trone, Philippe Gain, Richard Ordonez, Pascale Massin, Ali Erginay, et al. Feedback on a publicly distributed image database: the messidor database. Image Analysis & Stereology, 33(3):231–234, 2014. 2 13. Gwénolé Quellec, Mathieu Lamard, Pierre Marie Josselin, Guy Cazuguel, Béatrice Cochener, and Christian Roux. Optimal wavelet transform for the detection of microaneurysms in retina photographs. IEEE Transactions on Medical Imaging, 27(9):1230–1241, 2008. 2 14. Eyepacs digital retinal image grading protocol narrative. https: //www.eyepacs.org/consultant/Clinical/grading/ EyePACS-DIGITAL-RETINAL-IMAGE-GRADING.pdf. Accessed: June 21, 2017. 3 15. Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. 3 16. Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2818–2826, 2016. 3 17. Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015. 3 18. Jorge Cuadros and George Bresnick. Eyepacs: an adaptable telemedicine system for diabetic retinopathy screening. Journal of diabetes science and technology, 3(3):509–516, 2009. 4 19. Daniel Golovin, Benjamin Solnik, Subhodeep Moitra, Greg Kochanski, John Karro, and D Sculley. Google vizier: A service for black-box optimization. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 1487–1495. ACM, 2017. 4 20. H Kolb, E Fernandez, and R Nelson. Facts and figures concerning the human retina– webvision: The organization of the retina and visual system. 1995. 4 21. Peter H Scanlon, Ahmed Sallam, and Peter van Wijngaarden. A practical manual of diabetic retinopathy management. John Wiley & Sons, 2017. 4 22. Jacob Cohen. A coefficient of agreement for nominal scales. Educational and psychological measurement, 20(1):37–46, 1960. 4 8 Tables and Figures Development Train 1,665,151 Tune 3,737 Clinical Validation EyePACS-2 1,958 Images (#) Patient Demographics Unique Individuals (#) 238,610 2,643 999 Age (Average ± Stdev) 53.5 ± 11.6 54.3 ± 11.1 54.9 ± 10.9 Female / Total patients 140,183/230,556 (60.8%) 1,101/1,767 (62.3%) 607/999 (60.7%) where gender was known Image Quality Distribution Fully gradable / Total images where image quality was 1,343,726/1,529,771 (87.8%) 3,547/3,737 (94.9%) 1,813/1,958 (92.6%) assessed Development Train Tune Disease Severity Distribution Total images where DR was assessed No diabetic retinopathy Mild Moderate Severe Proliferative Total images where DME was assessed Referable diabetic macular edema Validation EyePACS-2 # % # % # % 1,662,646 100.0% 3,547 100.0% 1,813 100.0% 1,164,368 152,938 249,138 50,640 45,562 70.0% 9.2% 15.0% 3.0% 2.7% 2,417 458 497 106 69 68.1% 12.9% 14.0% 3.0% 1.9% 1,478 125 144 37 20 81.5% 6.9% 7.9% 2.0% 1.1% 252,544 100.0% 3,547 100.0% 1,813 100.0% 28,807 11.4% 699 19.7% 228 12.6% Table 1. Baseline characteristics. Summary of image characteristics and available demographic information in the development and clinical validation datasets. The adjudicated reference standard was used for computing the DR and DME distributions on the Tune and EyePACS-2 datasets, and the majority reference standard was used for the Train dataset. For DR, the majority was taken over both the EyePACS partner grade, and the grading done by our ophthalmologists (using whichever grades are available). For DME, the majority is taken over grades from our ophthalmologists. For Image quality distributions, the EyePACS partner grade was used for the Train dataset and an adjudicated image quality standard was used for the Tune and EyePACS-2 datasets. 9 Majority of retinal specialist grading before adjudication No Mild Moderate Severe Proliferative No 1,469 4 5 0 0 Mild 58 62 5 0 0 Adjudicated Moderate 22 3 118 1 0 Consensus Severe 0 0 13 36 1 Proliferative 0 0 0 1 15 Majority of retinal specialist grading before adjudication Not Referable Referable DME Adjudicated Not Referable 1,693 4 16 100 Consensus Referable DME Table 2. Comparison of retinal specialist grades before and after adjudication on the Validation dataset. Confusion matrix for DR and DME between the grade determined by majority decision and adjudicated consensus. DR Retina Specialist A Retina Specialist B Retina Specialist C Majority Decision (Retinal Specialists) DME Sensitivity Specificity 74.6% 74.4% 82.1% 99.1% 99.3% 99.3% Quadraticweighted kappa 0.82 0.80 0.91 88.1% 99.4% 0.91 Sensitivity Specificity kappa 70.1% 92.7% 86.2% 99.5% 99.3% 99.8% 0.78 0.91 0.90 86.2% 99.8% 0.90 Table 3. Agreement between each retina specialist and the adjudicated reference standard on the Validation dataset. Retina specialists correspond to those who contributed to the final adjudicated reference standard. Sensitivity and specificity metrics reported are for moderate or worse DR and Referable DME. Agreement between the pre-adjudication 5-point DR grade and the final adjudicated grade is also measured by the quadratic-weighted kappa. Since DME classification is binary, the quadratic-weighted kappa and kappa yield the same number. 10 Majority of ophthalmologist grading No Mild Moderate Severe Proliferative No 1,431 33 10 0 1 Mild 67 39 18 1 0 Adjudicated Moderate 20 14 94 14 2 Consensus Severe 0 0 9 41 0 Proliferative 0 0 1 2 13 Majority of ophthalmologist grading Not Referable Referable DME Adjudicated Not Referable 1,683 7 Consensus Referable DME 40 75 Table 4. Comparison of ophthalmologist grades versus adjudicated grades from retina specialists on the Validation dataset. Confusion matrix for DR and DME between the grade determined by majority decision of the ophthalmologists and the adjudicated consensus of retinal specialists. DR Ophthalmologist A Ophthalmologist B Ophthalmologist C Majority Decision (Ophthalmologists) DME Sensitivity Specificity 67.4% 72.0% 81.1% 98.0% 90.1% 91.2% Quadraticweighted kappa 0.84 0.80 0.81 83.8% 98.1% 0.87 Sensitivity Specificity kappa 69.1% 49.5% 68.8% 99.7% 99.0% 99.5% 0.78 0.58 0.77 65.2% 99.6% 0.75 Table 5. Agreement between ophthalmologists graders with the adjudicated reference standard on the Validation dataset. Sensitivity and specificity metrics are for moderate or worse DR and referable DME for each grader. Agreement between the adjudicated grade and the 5-point scale is also measured by the quadratic-weighted kappa. Since DME classification is binary, the quadratic-weighted kappa and kappa yield the same number. 11 Artifact vs not Extent of Lesions Hemorrhage vs MA Hemorrhage vs not IRMA vs not Missed hemorrhage Missed MA Missed NVD/NVE PRP vs not Other Total Adjudication grade (Retina Specialists) minus Majority decision grade (Ophthalmologists) -4 -2 -1 1 2 Total 5 28 1 5 39 1 16 9 26 1 13 13 3 30 4 4 11 19 1 1 2 2 6 63 69 2 1 3 1 1 1 3 1 1 1 13 65 92 22 193 Table 6. Reasons for difference between adjudication of retinal specialist and majority decision from ophthalmologist graders. Disagreements between the adjudicated consensus and majority decision were examined and characterized by a retinal specialist. Positive numbers denote that the adjudication grade was more than the majority decision of ophthalmologist grade, and viceversa for negative numbers. Majority decision ground truth Adjudicated ground truth Original Original model Original Original model Our full model + high res model + high res model Moderate DR+ 0.991 0.990 0.930 0.956 0.986 Referable DME 0.989 0.994 0.971 0.977 0.991 Table 7. Differences in the final AUC observed for algorithms trained in the image resolution algorithm selection experiments. “Original model” refers to the model and training data of Gulshan et al., “Original model + high res” uses higher resolution input images (779 x 779 pixels), and “Our full model” incorporates all changes described in the Algorithmic Improvements section in the main text. 12 Algorithm Grade No Mild Moderate Severe Proliferative No 1,356 74 44 1 3 Mild 7 43 74 0 1 Adjudicated Moderate 3 3 98 36 4 Consensus Severe 0 0 2 47 1 Proliferative 0 0 0 4 12 Algorithm Grade Not Referable Referable DME Adjudicated Not Referable 1,632 65 9 107 Consensus Referable DME DR Algorithm Sensitivity Specificity 97.1% 92.3% DME Quadraticweighted kappa 0.84 Sensitivity Specificity kappa 92.2% 96.2% 0.72 Table 8. Comparison of algorithm grade versus adjudicated grades from retina specialists. Confusion matrix for DR and DME where the grade is determined by either the algorithm or adjudicated consensus of the retinal specialists. Sensitivity and specificity metrics reported are for moderate or worse DR and referable DME. 13 No or Mild Diabetic Retinopathy (n=1603) Moderate or Worse Diabetic Retinopathy (n=210) 100% Fraction of Images Fraction of Images 100% 80% 60% 40% 20% 80% 60% 40% 20% 0% 0% 0% 20% 40% 60% 80% 100% 0% Agreement with Adjudicated Grade No DME (n=1697) 40% 60% 80% 100% Referrable Diabetic Macular Edema (n=116) 100% Fraction of Images Fraction of Images 100% 20% Agreement with Adjudicated Grade 80% 60% 40% 20% 80% 60% 40% 20% 0% 0% 0% 20% 40% 60% 80% 100% 0% Agreement with Adjudicated Grade 20% 40% 60% 80% 100% Agreement with Adjudicated Grade Fig. 1. Grader agreement based on the adjudicated referability of DR and DME. Graders include all three retina specialists and three ophthalmologists. Mild or Worse DR, Majority Vote Reference Standard 1.00 0.99 0.99 0.98 0.98 0.97 0.97 0.96 0.96 AUC AUC 1.00 0.95 0.95 0.94 0.94 0.93 0.93 0.92 0.92 0.91 Mild or Worse DR, Adjudicated Reference Standard 0.91 300 400 500 600 700 800 Input Image Resolution 300 400 500 600 700 800 Input Image Resolution Fig. 2. Image resolution input to model vs AUC for mild and above DR. Left: Using majority vote of all ophthalmologists and retinal specialists as the reference standard. Right: Using the adjudicated grade as a reference standard. Shaded areas represent a 95% confidence interval as measured via bootstrapping. 14 Mild or Worse Diabetic Retinopathy, AUC: 0.986 100 80 100 90 60 80 70 60 40 50 60 30 80 70 60 40 50 40 20 100 90 Sensitivity, % Sensitivity, % 80 Moderate or Worse Diabetic Retinopathy, AUC: 0.986 100 40 20 0 2 4 6 8 30 10 0 0 0 20 40 60 80 100 0 20 4 40 1 - Specificity, % 6 8 10 80 80 80 70 60 50 30 100 60 80 70 60 40 50 40 20 40 20 0 2 4 6 100 90 Sensitivity, % 90 40 80 Proliferative Diabetic Retinopathy, AUC: 0.998 100 100 60 60 1 - Specificity, % Severe or Worse Diabetic Retinopathy, AUC: 0.995 100 Sensitivity, % 2 0 8 30 10 0 0 2 4 6 8 10 0 0 20 40 60 80 100 0 20 1 - Specificity, % 60 80 100 Referrable Diabetic Macular Edema, AUC: 0.991 100 80 Sensitivity, % 40 1 - Specificity, % 100 90 60 80 70 60 40 50 40 20 30 0 2 4 6 8 10 0 0 20 40 60 80 100 1 - Specificity, % Fig. 3. Comparison of the algorithm, ophthalmologists, and retinal specialists using the adjudicated reference standard at various DR severity thresholds and DME. The algorithms performance is the blue curve. The three retina specialists are represented in shades of orange/red and the three ophthalmologists are in shades of blue. n=1,813 fully gradable images. 15 No No 1,472 Mild 65 Adjudicated Moderate 26 Consensus Severe 0 Proliferative 0 Majority of retinal specialist and ophthalmologist grading Mild Moderate Severe Proliferative 3 3 0 0 55 5 0 0 6 109 3 0 0 10 40 0 0 1 2 13 Majority of retinal specialist and ophthalmologist grading Not Referable Referable DME Adjudicated Not Referable 1,695 2 23 93 Consensus Referable DME Table S1. Comparison of combined retina specialist and ophthalmologist grades versus adjudicated grades from retina specialists. Confusion matrix for DR and DME where the grade is determined by either the majority decision of all six retina specialists and ophthalmologists or is the adjudicated consensus of the retinal specialists. 16 Fig. S1. STARD diagram for DR. 17 Fig. S2. STARD diagram for DME. 18
1cs.CV
J. Comput. Phys. Journal of Computational Physics 00 (2017) 1–33 arXiv:1708.08741v1 [cs.CE] 29 Aug 2017 Coupled Multiphysics Simulations of Charged Particle Electrophoresis for Massively Parallel Supercomputers Dominik Bartuschata,∗, Ulrich Rüdea,b a Lehrstuhl für Systemsimulation, Friedrich-Alexander Universität Erlangen-Nürnberg, Cauerstrasse 11, 91058 Erlangen, Germany b Parallel Algorithms Group, CERFACS, 42 Avenue Gaspard Coriolis, 31057 Toulouse, France Abstract The article deals with the multiphysics simulation of electrokinetic flows. When charged particles are immersed in a fluid and are additionally subjected to electric fields, this results in a complex coupling of several physical phenomena. In a direct numerical simulation, the dynamics of moving and geometrically resolved particles, the hydrodynamics of the fluid, and the electric field must be suitably resolved and their coupling must be realized algorithmically. Here the two-relaxation-time variant of the lattice Boltzmann method is employed together with a momentum-exchange coupling to the particulate phase. For the electric field that varies in time according to the particle trajectories, a quasistatic continuum model and its discretization with finite volumes is chosen. This field is coupled to the particulate phase in the form of an acceleration due to electrostatic forces and conversely via the respective charges as boundary conditions for the electric potential equation. The electric field is also coupled to the fluid phase by modeling the effect of the ion transport on fluid motion. With the multiphysics algorithm presented in this article, the resulting multiply coupled, interacting system can be simulated efficiently on massively parallel supercomputers. This algorithm is implemented in the waLBerla framework, whose modular software structure naturally supports multiphysics simulations by allowing to flexibly combine different models. The largest simulation of the complete system reported here performs more than 70 000 time steps on more than five billion (5 × 109 ) mesh cells for both the hydrodynamics, as represented by a D3Q19 lattice Boltzmann automaton, and the scalar electric field. The computations are executed in a fully scalable fashion on up to 8192 processor cores of a current supercomputer. c 2017 Published by Elsevier Ltd. Keywords: Parallel simulation; Electrokinetic flow; Electrophoresis; Fluid-particle interaction; MPI. 1. Introduction 1.1. Motivation The motion of charged particles in fluids under the influence of electric fields occurs in a wide range of industrial, medical, and biological processes. When the charged particles are immersed in liquids, their migration caused by electric fields is termed electrophoresis. Due to the complex interplay of the physical effects involved in such particle-laden electrokinetic flows, numerical simulations are required to analyze, ∗ Corresponding author Email address: [email protected] (Dominik Bartuschat) 1 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 2 predict, and optimize the behavior of these processes. To this end, we present a parallel multiphysics algorithm for direct numerical simulations of electrophoretic particle motion. Industrial applications that involve electrophoretic effects are electrofiltration [1, 2, 3] and electrodewatering [4]. Moreover, electrophoresis is utilized in electrophoretic deposition techniques for fabricating advanced materials [5] and especially ceramic coatings [6, 7] in material science. Electrophoresis and electric fields are also applied in many medical and biological applications. The trend towards miniaturization of analysis processes has lead to the development of micro total analysis systems. Due to their high portability, reduced costs, fast operation, and high sensitivity [8, 9], the design of such lab-on-a-chip systems has been a highly active area of research for many years. These microfluidic systems require only small samples of liquid and particles, which are transported, manipulated, and analyzed in structures of length scales from several nm to 100 µm. Therefore, microfluidic separation and sorting of particles and cells are important steps of diagnostics in such systems [10, 11]. Many of the employed techniques utilize electric fields to manipulate, separate, and sort biological particles and macromolecules [8], such as cells [9, 10] or DNA [12]. At the small scales of microfluidic analysis systems, flow measurements are difficult or even impossible. Moreover, the complex coupling of hydrodynamic and electrostatic effects involved in electrophoretic processes make predictions of electrophoretic motion challenging, especially for large numbers of particles. Therefore, numerical simulations are essential to aid the design and optimization of electrophoretic systems. The different physical effects in electrophoretic deposition can be better understood from insight gained in simulations. By means of such simulations, electrophoretic sorting in lab-on-a-chip systems can be optimized for maximal throughput, sorting efficiency, and sorting resolution. A review of simulation methods for electrophoretic separation of macromolecules is given in [13]. Also industrial applications of electrophoretic deposition can be optimized with the help of simulations, as presented in [14] for a coating process. 1.2. Multiphysics Coupling Strategy For simulations of electrokinetic flows with electrophoretic particle motion, the coupling between three system components must be modeled: charged objects, fluid flow, and electric effects. The interacting physical effects are sketched in Fig. 1. In the simulation method introduced in this article, the motion of the ce on io ty ns io ot e si m rg n de n n a ch r fo a st e rc fo io el tro ec tic Electroquasi-statics object motion Rigid body dynamics Fluid dynamics hydrodynamic force Figure 1: Coupled physical effects of electrophoresis simulated with waLBerla and pe. rigid, charged particles is modeled with Newtonian mechanics. The motion of the surrounding fluid, which exerts hydrodynamic forces on the particles, is described by the incompressible Navier-Stokes equation. To capture fluid-particle interactions, the hydrodynamic forces and the influence of the particle motion on the fluid are modeled, based on the momentum exchange between fluid and particles. In this way, long-range hydrodynamic interactions between individual particles and between particles and walls are recovered. Moreover, electrostatic forces exerted by applied electric fields on the charged particles are modeled, which cause the electrophoretic motion. The varying positions of the charged particles in return affect the electric 2 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 3 potential distribution in the simulation domain, based on their surface charge. Such a charge is carried by most biomolecules such as cells, proteins, and DNA [15]. In fact, most substances acquire surface charges when they get into contact with an aqueous medium [16] or electrolyte solution [17]. Electrostatic forces additionally act on the ions in the fluid and affect the fluid motion via body forces present in locations of net charge. This net charge originates from the repulsion of co-ions in the fluid of the same polarity as the surface charge and from the attraction of counter-ions. The ions in the fluid are transported with the fluid flow, which in turn alters the electric potential distribution. In general, the motion of ions in the fluid due to an electric field is governed by the Nernst-Planck equation, an advection-diffusion equation that employs a continuum description and treats the ions as point charges. For flows in which diffusion strongly dominates over advection and therefore quasi-thermodynamic equilibrium can be assumed to hold, as considered in this paper, the electric potential due to the ion charge distribution is governed by the Poisson-Boltzmann equation. The region of the particle’s surface charge and of excess counter-ions in the fluid is denoted as electric double layer (EDL). According to the Stern model [18] employed in this article, this double layer comprises a region of ions attached to the surface and a diffuse part in which the ion concentration follows a Boltzmann distribution. At the surface of shear between the particle and the surrounding diffuse double layer, the characteristic ζ-potential is defined. The employed equilibrium considerations based on the PoissonBoltzmann equation capture the dominant retardation effect of electrophoretic motion. This effect describes the retardation of the charged particle motion by the action of the applied electric field on the opposite net charge in the surrounding EDL. At high ζ-potentials, additionally the weaker relaxation effect occurs [16] that is caused by a distortion of the EDL and can be captured by the Nernst-Planck equation. In this article, we present an efficient parallel multiphysics simulation algorithm for electrophoresis on a fixed Eulerian grid with a Lagrangian representation of moving particles. The particles are represented by the physics engine pe [19, 20] as geometrically fully resolved three-dimensional objects. Dependent on the electrostatic and hydrodynamic forces acting on the particles, the pe computes their trajectories by rigid body dynamics and additionally resolves particle collisions. The pe is coupled to waLBerla [21, 22, 23], a massively parallel simulation framework for fluid flow applications that employ the lattice Boltzmann method (LBM) [24, 25]. By means of a modular software structure that avoids dependencies between modules, functionality from different modules can be combined flexibly. To model fluid-particle interactions, the LBM momentum exchange method [26, 27] implemented in waLBerla [28] is applied. For the electrophoresis simulations, the LBM is performed with the two-relaxation time collision operator [29, 30] and an appropriate forcing term for the electric body force due to the ions in the fluid. The electric potential is represented by the Debye-Hückel approximation of the Poisson-Boltzmann equation that is discretized with finite volumes whose mesh structure naturally conforms to the lattice Boltzmann (LB) grid. This discretization also facilitates accommodating variable and discontinuous dielectricity values that vary in time according to the particle positions, as required for simulating dielectrophoretic effects. By means of the waLBerla solver module introduced in [31] together with the cell-centered multigrid solver implemented therein, the resulting linear system of equations is solved. Since the counter-ions lead to a quicker decay of the electric potential compared to the long-range electric potentials modeled in [31], the parallel successive over-relaxation (SOR) method implemented in this module is an adequate choice. In a previous article, we have shown that the implemented fluid-particle interaction algorithm for arbitrarily shaped objects efficiently recovers hydrodynamic interactions also for elongated particles [32]. Moreover, we presented a parallel multiphysics algorithm for charged particles in the absence of ions in the fluid in [31]. We have therein shown that several millions of charged particles with long-range hydrodynamic and electrostatic interactions can be simulated with excellent parallel performance on a supercomputer. The present paper extends these simulation algorithms by also considering ions in the EDL around the particles and their effect on the fluid motion, and presenting suitable parallel coupling techniques. Together with the full four-way coupling of the fluid-particle interaction [31], the coupling with the quasi-equilibrium representation of the electric effects results in a 7.5-way interaction. 3 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 4 1.3. Related Work In the following, we give an overview of numerical methods for simulations of electrophoretic phenomena that have been developed for different resolution levels. At the coarsest modeling scale, both fluid and solid phase are described by an Eulerian approach. These continuum models represent the charged species in terms of concentrations and are well suited for simulations with large numbers of unresolved particles. In [33] two-dimensional electrophoresis simulations of biomolecule concentrations are presented. These finite element simulations consider the effect of reactive surfaces and the electric double layer is included through the biomolecule charge. Also three-dimensional parallel simulations of electrophoretic separation with continuum approaches have been reported. The finite element simulations in [34] consider the buffer composition and the ζ-potential at channel walls. In [35, 36] mixed finite element and finite difference simulations of protein separation were performed on up to 32 processes. At the finest level of resolution, fluid, ions, and particles are simulated by Lagrangian approaches. These explicit solvent methods [37] typically apply coarse-grained molecular dynamics (MD) models to describe the motion of fluid molecules and incorporate Brownian motion [38]. The mesoscale dissipative particle dynamics method is applied in [39] to simulate electrophoresis of a polyelectrolyte in a nanochannel. Another explicit solvent method is presented in [40] for simulating DNA electrophoresis, modeling DNA as a polymer. In both methods the polymer is represented by bead-spring chains with beads represented by a truncated Lennard-Jones potential and connected by elastic spring potentials. Explicit solvent models, however, are computationally very expensive, especially for large numbers of fluid molecules due to pairwise interactions [40]. Moreover, the resolution of solvent, macromolecules, and ions on the same scale limits the maximal problem sizes that can be simulated [41]. Also the mapping of measurable properties from colloidal suspensions to these particle-based methods is problematic [37]. The high computational effort is significantly reduced in implicit particle-based methods that incorporate hydrodynamic interactions into the inter-particle forces. Such methods are applied in [37] and [42] to simulate electrophoretic deposition under consideration of Brownian motion and van der Waals forces. Nevertheless, these methods are restricted to few particle shapes and hydrodynamic interactions in Stokes flow. Euler-Lagrange methods constitute the intermediate level of resolution. These approaches employ Eulerian methods to simulate the fluid phase, whereas the motion of individual particles is described by Newtonian mechanics. For simulations of particles in steady-state motion, the resolved particles can be modeled as fixed while the moving fluid is modeled by an Eulerian approach. In [43] the finite volume method is applied to simulate electrophoresis of up to two stagnant toroids in a moving fluid, employing the Hückel approximation for a fixed ζ-potential and different electrical double layer thicknesses. The steady-state electrophoretic motion of particles with low surface potentials under a weak applied electric field in a charged cylindrical pore is simulated in [44] for a single cylinder and in [45] for two identical spheres. In both cases, a two-dimensional simulation with a finite element method for Stokes flow and Hückel approximation is performed, exploiting the axial symmetry of the problem. For electrophoresis at steady state perturbation approaches can be employed that are based on the assumption that the double layer is only slightly distorted from the equilibrium distribution for weak applied electric fields (w.r.t. the field in the EDL). In addition to the equilibrium description based on the PoissonBoltzmann equation, small perturbations in the equilibrium EDL are considered in terms of linear correction terms in the applied electric field for the ion distribution and the electric potential (see e. g. [46]). Using a perturbation approach with finite elements, the electrophoresis of two identical spheres along the symmetry axis of a cylindrical domain at pseudo steady-state were studied in [47]. Additionally to the hydrodynamic and electric interactions, these axisymmetric simulations consider van der Waals forces for particles in close proximity. In [48] a perturbation approach is applied to simulate a single colloid in a rest frame with periodic boundary conditions. The zeroth-order perturbation corresponds to the Poisson-Boltzmann equation, which is solved by a constrained variational approach suggested in [49]. For the first-order perturbation, the stationary Stokes equation is solved by a surface element method, the convection-diffusion for ionic concentrations by a finite volume solver, and the Poisson equation by a fast Fourier Transform method. More sophisticated Euler-Lagrange methods include direct numerical simulation (DNS) models that represent the moving particles as geometrically fully resolved objects. These methods for particulate flows 4 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 5 include approaches with body-fitted moving meshes and fixed meshes. Moving meshes can be represented by the Arbitrary-Lagrangian-Eulerian (ALE) formulation [50, 51] that employs moving unstructured meshes for fluid-particle interaction problems. Such an ALE method is applied in [52] to simulate electrophoresis of a single particle surrounded by a thin electrical double layer. The moving-mesh techniques require re-meshing when the distortion of the updated mesh becomes too high, and subsequent projection of the solution onto the new mesh. This overhead is circumvented in fixed-mesh techniques that allow the use of regular grids and therefore the application of efficient solvers. The fluid particle dynamics method [53] falls into the latter category, solving the Navier-Stokes and continuity equation on a fixed lattice, and representing the moving solid particles by fluid particles of very high viscosity. By means of a concentration field that represents the particle distribution, the particles affect the fluid viscosity and, together with forces acting on the particles, the body force term of the Navier-Stokes equation. The rigid particles are geometrically modeled by the Lennard-Jones potential and their motion is described by Newtonian mechanics [53]. This technique is applied to simulate electrophoretic deposition of two charged particles in [54] and electrophoretic separation in [55]. In these simulations the electrostatic interactions of the particles are modeled in terms of the body force field, together with the advection and diffusion of ions and the resulting effect of the applied electric field on the fluid motion. With this method, however, the particle rigidity is imposed by very high viscosity values that restrict the time step size [56] and the Lennard-Jones potential restricts the particles shapes to spheres. The smoothed profile method (SPM) [56] circumvents this time-step constraint by directly modeling the particles as solid objects. Inside the particles and at solid-fluid boundaries that are represented by diffuse interfaces, a body force is imposed on the fluid to model the effect of the particle motion on the fluid. The fluid is again modeled on a fixed Cartesian grid and the particle motion with Newtonian mechanics, where particle overlaps are typically prevented by a truncated Lennard-Jones potential. With this method, electrophoresis of charged spherical particles is simulated in [57] for a constant, uniform electric field and in [58] for an oscillating electric field. In both articles, the ion number concentration is modeled by an advection-diffusion equation to recover non-equilibrium double layer effects. The SPM is also applied in [59] to simulate electrophoresis of single cylinders and microtubules, employing the equilibrium representation of the EDL. A further fixed-mesh technique is the immersed boundary method [60, 61, 62], where the rigid body motion is imposed on the flow by body forces applied at the particle boundaries. This method, combined with a finite volume method for solving the steady-state Poisson-Nernst-Planck equation system, is applied in [63] to simulate the electrophoretic motion of up to three spherical particles in a two-dimensional setup. Lattice-Boltzmann based methods are very well suited for parallel direct numerical simulations of fluidparticle interactions on fixed Cartesian grids. Both the Lagrangian particles and ions are often explicitly modeled by molecular dynamics approaches that represent the rigid objects by repulsive potentials. In [64] the electrophoresis of a colloidal sphere immersed in a fluid with counter-ions is simulated, modeling the solvent by a lattice Boltzmann method. The charged sphere modeled with molecular dynamics is represented by a raspberry model that comprised several beads connected by the finitely extensible nonlinear-elastic (FENE) potential. Using a modified raspberry model with two spherical shells of beads solidly attached to a larger spherical particle, this method is extended in [65] to simulate the electrophoresis of a spherical Janus particle. The partially uncharged particle is surrounded by anions and cations represented by charged beads. Electrophoresis simulations for a single highly charged spherical macro-ion in an electrolyte solution with explicitly modeled positive and negative micro-ions are presented in [66]. Since the coupling of fluid and macro-ion is performed via several particle boundary points, a single spherical particle is sufficient to represent the macro-ion. A similar LB-MD method is applied in [67] to simulate the stretching of a charged polyelectrolyte between parallel plates. The polyelectrolyte immersed in a liquid with explicitly modeled counter- and co-ions is modeled by beads bonded together by the FENE potential. In all these LB-MD simulations with explicitly modeled ions, hydrodynamic interactions are simulated with the LBM and thermal fluctuations are added to both the fluid and the MD objects. The high computational effort for modeling each individual ion by means of molecular dynamics, however, restricts the maximum feasible problem size. With these approaches, only a limited number of ions per colloidal particle can be simulated and the colloid radius is typically restricted to one order of magnitude larger than the ion size [48]. Therefore, approaches based on continuum descriptions of the suspended ions are more practical for simulations of many or for larger charged particles. 5 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 6 Alternatively to the continuum approach based on the Poisson-Boltzmann equation employed in this article, electrophoresis can be simulated with the link-flux method [68] that models the advection and diffusion of ions in terms of Nernst-Planck equations. The link-flux method employs the LBM for fluid dynamics and models ion motion in terms of fluxes between lattice cells. In [69] this method is compared to a LB-Poisson-Boltzmann approach for a fixed spherical particle in a periodic three-dimensional domain. The aim is to examine the influence of particle motion and counter-ion concentration on the ζ-potential, leading to the conclusion that for weakly perturbing electric fields or low Péclet numbers the equilibrium and dynamic ζ-potentials are indistinguishable. The link-flux method is extended in [41] to support moving particles in combination with the LB momentum exchange method. To ensure charge conservation in electrophoresis simulations, appropriate moving boundary conditions for the solute fluxes are introduced. This method is verified in [41] by electrophoresis simulations of up to eight particles. 1.4. Objectives and Outline The primary goal of this paper is the introduction of a parallel multiphysics algorithm for electrophoresis simulations together with validations of the physical correctness of the coupled algorithm for different particle sizes. For this algorithm, waLBerla is augmented by an efficient boundary handling method that is able to treat electric potential boundary conditions on the moving particles. Moreover, a joint parameterization for the different coupled numerical methods is introduced. To achieve excellent computational performance, a matrix-free representation of the linear system based on a stencil paradigm is used in the solver module [31]. For the linear Debye-Hückel approximation it is systematically exploited that these stencils are almost uniformly identical throughout the simulation domain. The validation runs were performed on up to 8192 parallel processes of a modern supercomputer. Moreover, simulation results for the electrophoretic motion of a single particle in a microchannel are presented, including visualizations of the electric potential distribution and of the resulting flow field around the particle. The equilibrium considerations in the present paper recover the predominant retardation effect due to an opposing electrostatic force on the net opposite charge in the electrical double layer that counteracts the particle motion. For the presented method, a computationally cheap and flexible SOR method is sufficient to solve the electric potential equations. With our approach we aim for simulations of millions of charged particles as in [31]. For these large numbers of particles the dynamics of an electrical double layer as in [41] is computationally too expensive, even on modern supercomputers. This paper is structured as follows: The physical background of fluid-particle interactions and electrophoresis are described in Sec. 2 and Sec. 3, respectively. In Sec. 4, the employed LB-momentum exchange method for fluid-particle interactions is outlined, together with the finite volume discretization and the common parameterization concept for the coupled multiphysics methods. Then the extension of the waLBerla framework for the electrophoresis algorithm is described in Sec. 5. Finally validation results for the electrophoretic motion of a spherical particle and visualizations of the resulting flow field and electric potential distribution are presented in Sec. 6 before conclusions are drawn in Sec. 7. 2. Fluid-Particle Interaction The macroscopic description of fluid behavior is based on the continuum hypothesis (cf. Batchelor [70]) that allows to consider a fluid as continuum, irrespective of the underlying molecular structure. In this case, fluid properties can be represented by macroscopic quantities like density ρf , velocity ~u, and pressure p, as functions of space and time. In terms of these quantities, fluid dynamics is described by conservation laws for mass, momentum, and energy. In this article isothermal flows are considered, and therefore the energy equation does not have to be solved. Moreover, non-continuum effects that become relevant for gas flows at very small scales [71] are assumed to be negligible. Therefore, no-slip boundary conditions are assumed to hold at solid-fluid interfaces, and slip velocities due to non-continuum Knudsen layer effects are not considered. Conservation of mass is described by the continuity equation. This equation can be derived by considering a fixed control volume in the fluid relative to a stationary observer (Eulerian view). For incompressible fluids 6 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 7 the density of a fluid element is not affected by pressure changes [70, 72]. Then the density is spatially and temporally constant (i. e. ρf = const), and the continuity equation reads as ∇· ~u = 0. (1) Conservation of momentum in a viscous, compressible fluid can be described in terms of the momentum flux density tensor Π [72]. The temporal change of momentum in a control volume is balanced by the net momentum flux through the surface of this volume and by external body forces f~b acting on the volume as ∂ (ρf ~u) = −∇· Π + f~b . ∂t (2) The second-order tensor Π comprises a term for the convective transport of momentum and the total stress tensor σ for the momentum transfer due to pressure and viscosity Π = ρf ~u~u> − σ. (3) The total stress tensor σ can be decomposed into a part representing normal stresses related to the pressure and a viscous part related to shear stresses. For incompressible Newtonian fluids, the stress tensor reads as   (4) σ = −pI + µf ∇~u + (∇~u)> , where the first term with the second-rank identity tensor I contains the thermodynamic pressure p defined according to Landau & Lifshitz [72] as used in the LBM literature [73]. The second term with dynamic viscosity µf represents the shear stresses that are proportional to the rate of deformation [74] and result from molecular transport of momentum [75]. With this stress tensor the incompressible Navier-Stokes equation results from Eqn. (2), together with basic vector calculus and the continuity equation for compressible fluids [76], as   ∂~u ρf + (~u · ∇)~u = −∇p + µf ∆ ~u + f~b . (5) | {z } |{z} ∂t | {z } | {z } pressure stress viscous stress external body force inertial forces This equation describes the balance of momentum change and the net force acting on a control volume in terms of Newton’s second law. The left-hand side represents inertial forces acting on a fluid volume. It comprises a term for local change of velocity and a term for convective acceleration i. e. the change of velocity in space [77]. The right-hand side represents surface forces and body forces acting on the fluid volume. Surface forces are short-range forces acting on the surface of the fluid element and are equivalent to stress in the fluid [70]. Body forces, such as gravity or electrostatic force, act on the center of mass and are represented by the force per unit volume of fluid element (or force density) f~b . An important dimensionless quantity to characterize fluid flows is the Reynolds number Re = UνfL , with µ kinematic viscosity νf = ρff , characteristic velocity U , and characteristic length scale L. Flows in the regime of creeping motion, where Re  1 and thus inertial forces are negligible, are termed Stokes flow. The Stokes equations for incompressible Newtonian fluids resulting from Eqns. (5) and (1) read as −∇p + µf ∆ ~u + f~b = 0, ∇· ~u = 0. (6) These equations are linear in both, velocity and pressure. Due to the linearity the superposition principle holds, which is often utilized for fluid-particle interaction in Stokes flow and is employed for the validations in Sec. 6.3. Particles immersed in a fluid experience a force in case of relative fluid motion or a pressure gradient in the fluid (e. g. due to gravity). This force exerted by the surrounding fluid can be calculated from the 7 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 8 stresses in the fluid next to the particle by integrating the stress tensor σ over the particle surface Γp [74, 46] Z F~part = σ · ~n dA. (7) Γp Here, dA denotes the surface area elements and ~n the associated normal vector pointing into the fluid. For simple cases, such as spherical bodies moving in unbounded Stokes flow, or single bodies moving in a confined domain, analytical solutions for the particle motion are known as described in the following. More complex fluid-structure interaction problems must be solved numerically, e. g. by the LBM. For the computation of particle motion in incompressible fluids, hydrostatic effects that result e. g. from gravitation acting on the fluid, do not have to be considered explicitly in the momentum equation (if the buoyancy and gravitational force are directly applied to the particle). In this case, the force exerted by the fluid on the particle according to Eqns. (7) and (4) is the drag force given by Z Z ~ ~ ~ Fd = − p dA + µf ∇~u + (∇~u)> dA, Γp Γp where p is the hydrodynamic part of the total pressure. The resistance to the motion of a sphere in an unbounded fluid at very low Reynolds numbers can be calculated analytically from the above expression for the drag force and the Stokes equations (6) that govern the fluid flow w.r.t. the imposed boundary conditions (BCs). For a sphere located at ~x = ~0, the unbounded fluid is represented by the BC ~u → 0 as ~x → ∞ imposed on the fluid velocity in the Stokes equations (6). The resulting drag force acting on a rigid sphere ~ was derived by Stokes [78] as of radius R that moves at constant velocity U ~. F~d = −6πµf RU (8) This equation is commonly referred to as Stokes’ law. For a sphere moving in a fluid subject to a constant force F~ , Stokes’ law relates the terminal steady-state velocity of the sphere to the drag force exerted by the fluid. Such a constant force may e. g. be the Coulomb force that acts on a charged particle in an electric field. The terminal sphere velocity is then obtained from the balance of the external force and the drag force F~ + F~d = ~0 as ~ = U 1 F~ . 6πµf R (9) A particle moving in a confined domain experiences a retardation caused by surrounding walls. Consequently, the drag force on a sphere that moves in a viscous fluid limited by walls is higher than the force according to Stokes’ law. The effect of walls on a moving particle in Stokes regime can be determined by means of the method of reflections, as described in detail in [74]. Happel & Bart [79] employed this method to obtain a first-order correction to the drag force on a sphere settling in a long square duct with no-slip walls. Miyamura et al. [80] found polynomial expressions for the increased drag by fitting the coefficients to experimentally obtained settling velocities of spheres in different confining geometries. The correctness of the wall effect recovered in LBM simulations with the fluid-particle interaction algorithm employed in this article was verified in [76] against these expressions. 3. Electrokinetic Flows The transport of ions in fluids subject to electric fields that occurs in electrokinetic flows can be modeled by means of a continuum theory, similar to the description of fluid dynamics by the Navier-Stokes equation. 8 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 9 Instead of modeling individual ions and their interactions, local ion concentrations ni and fluxes ~ji of the different ionic species i are considered. Based on these macroscopic quantities the ion transport in dilute electrolyte can be described by the Nernst-Planck equation combined with the law for the conservation of ionic species in a solution ∂ni = −∇· ~ji (10) ∂t in the absence of chemical reactions. Here ni denotes the number density or concentration that is related to the molar concentration as ci = NnAi with Avogadro’s number NA . The total ionic flux ~ji of species i comprises an advective flux with a common mass average velocity ~u for all species and fluxes relative to the advective flux due to diffusion and electric migration [46]. This relation is expressed by the Nernst-Planck equation ~ji = ni ~u − Di ∇ni − ni µ∗i ∇Φ, (11) |{z} | {z } | {z } advective flux diffusive flux migration flux where Di and represent the spatially homogeneous diffusion coefficient and ionic mobility of species i, respectively, and ∇Φ the local electric potential gradient. The ionic mobility is defined as µ∗i =: DkiBzTi e , where e denotes the elementary charge, zi the valence of a given ionic species, kB the Boltzmann constant and T the temperature. To model the influence of the charged ions on the electric potential governed by the Poisson equation µ∗i − ∆ Φ(~x) = ρe εe (12) for spatially uniform fluid permittivity εe , the ion charge distribution is considered in terms of the local mean macroscopic charge density as X ρe = e zi ni . (13) i The Poisson-Nernst-Planck equation system Eqns. (10)–(12) is highly nonlinear, and solving the overall system is computationally very expensive, especially for electrophoresis of many particles. Therefore the problem is simplified by restriction to equilibrium considerations based on the Boltzmann distribution that capture the dominant electrophoretic effects. The resulting Poisson-Boltzmann equation holds for (quasi-)thermodynamic equilibrium when the ion distribution is not affected by fluid flow or by externally applied electric fields. Therefore the electric potential ψ resulting from the non-uniform ion distribution in the EDL is considered in the following, instead of the total electric potential Φ = ψ + ϕ that additionally comprises the potential ϕ of the externally applied electric field. The Boltzmann distribution for ions can be derived from the Nernst-Planck equation, as outlined in [46]. Considering the Nernst-Planck equation (11) in one dimension and at equilibrium, i. e., for zero macroscopic fluid velocity u = 0 and ionic flux ji = 0, results in d ni zi e d ψ = −ni dx kB T dx (14) for the above definition of µ∗i . In this case, the Péclet number P e = UDL for mass transfer relating the advection rate to diffusion rate becomes zero. Here U is the fluid speed, L a characteristic length scale, and D the diffusion coefficient. Applying the chain rule to the left-hand side of Eqn. (14) and integrating from a reference point in the bulk with potential ψ∞ and concentration ni∞ , yields zi e(ψ − ψ∞ ) kB T ni = ni∞ e . − (15) Setting the reference potential ψ∞ in the electroneutral bulk solution to zero recovers the Boltzmann distribution with the number density ni∞ at the location of the neutral state. 9 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 10 From Poisson’s equation (12) with net charge density according to Eqn. (13) and the obtained Boltzmann distribution, the Poisson-Boltzmann equation follows as zi e ψ − e X − ∆ψ = zi ni∞ e kB T , εe i (16) relating the electric potential ψ to the ion concentrations at equilibrium. For binary, symmetric electrolyte solutions comprising two species of valence z = −z− = z+ , the Poisson-Boltzmann equation takes the form   2 z e n∞ zeψ − ∆ψ = − sinh . (17) εe kB T For low ζ-potentials compared to the thermal voltage kB T /e, the term kzBe ψT in Eqn. (17) becomes smaller than unity. At room temperature this is fulfilled for ζ  25.7zmV [81]. In this case the approximation sinh(x) ≈ x is accurate, up to a small error of order O(x3 ) (cf. Taylor’s expansion). With this linearization, the symmetric Poisson-Boltzmann equation simplifies to the Debye-Hückel approximation (DHA) − ∆ψ = − 2 e2 z 2 n∞ ψ = −κ2 ψ. εr ε0 kB T (18) This equation was originally derived by Debye & Hückel [82] for strong electrolytes [81]. The parameter κ, defined by r εr ε0 kB T κ := , (19) 2 e2 z 2 n∞ is commonly referred to as Debye-Hückel parameter. Moreover, the charge density in the fluid is then given by ρe (ψ) = −κ2 εe ψ. (20) In this article, we consider spherical particles with uniform ζ-potential distribution as depicted in Fig. 2. The electric potential ψ for such a particle of radius R is represented by the Debye-Hückel equation in E∞ r ψ =ζ ~u = −U θ R x λD ~ex Figure 2: Electrophoresis setup of a stationary (negatively) charged sphere of radius R, surrounded by a double layer and subject to an applied electric field in opposing fluid flow. Similar to [16]. spherical-polar coordinates as 1 d r2 dr  r2 dψ dr 10  = κ2 ψ, (21) D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 11 with radial distance r from the sphere center and subject to the Dirichlet BCs ψ=ζ ψ→0 at as r = R, r → ∞. (22) Solving this equation subject to these BCs results in the electric potential distribution in the surrounding EDL (and beyond) as [81] R ψ(r) = ζ e−κ(r−R) for r ≥ R. (23) r For the Debye-Hückel approximation, an analytical solution for the electrophoretic velocity of a single spherical particle at steady state and arbitrary EDL thickness has been derived by Henry [83]. Initially the problem was formulated to account for finite conductivities of particle and medium, and the potential in the EDL was described by the Poisson-Boltzmann equation. The final results, however, were provided for insulating spheres, and sufficiently low ζ-potentials for the Debye-Hückel approximation to hold. Therefore the Debye-Hückel approximation is employed in the following to represent the ion distribution around the particles under electrophoretic motion. Instead of modeling a sphere moving at terminal speed U , Henry [83] considered the analogous problem of a stationary sphere in a steadily moving liquid. To this end, the opposing velocity −U was imposed on the overall system by setting ~u r→∞ = −U ~ex in the liquid far from the particle. As shown in Fig. 2, a sphericalpolar coordinate system fixed at the particle center with radial distance r and polar angle θ was used. Under the assumption that the electric potential in the EDL is not distorted from its equilibrium distribution by the applied field and the fluid flow, the potentials ϕ and ψ were linearly superimposed. Therefore, the electric potential ψ in the diffuse double layer is described by the Poisson-Boltzmann equation and the applied potential ϕ by a Laplace equation. The BCs for the Laplace equation applied by Henry represent the insulating particle by homogeneous Neumann BCs at the particle surface and impose the applied field by the inhomogeneous Neumann condition ∂ϕ/∂x r→∞ = −E∞ . For the Poisson-Boltzmann equation, the ζ-potential at the hydrodynamic radius R and the decaying potential were imposed as given in Eqn. (22). Making use of the equations for the electric potential, the Stokes equations for steady-state creeping flow with body force term on the right-hand side −µf ∆ u + ∇p = −ρe ∇ (ϕ + ψ) ∇· ~u = (24) 0, (25) were solved by Henry [83]. In addition to the BC imposing the opposing velocity far from the particle to bring the whole system to rest, the no-slip condition ~u r=R = 0 was applied at the particle surface. From the flow field around the particle, the force acting on the particle was obtained by integrating the normal stresses over the sphere surface. To the resulting force that comprises Stokes drag and electric components, the electrostatic force on the particle due to its fixed surface charge was added. The total force must vanish at steady motion and was thus equated with zero, resulting in the electrophoretic velocity    ZR ZR ψ ψ ε ~ ext ~ EP = e ψR + R3 5R2 dr − 2 dr E (26) U µf r6 r4 ∞ ∞ | {z } =ζ f (κR) obtained by Henry for an insulating particle. The function f (κR) introduced in [83] is usually referred to as Henry’s function. In [84] the following expression is derived that approximates the integral equations as   f (κR) = 2  1 + 3 1  2 1+ 11 2.5 κR (1 + 2e−κR )   3  ,  (27) D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 12 with a relative error below 1 % for all values of κR [84]. In terms of Henry’s function f (κR) [83], the electrophoretic mobility of a spherical, non-conducting particle reads as εe ζ f (κR) . (28) µEP = µf This solution is correct to the first order of the ζ-potential, since the relaxation effect is neglected [85]. With the definition of the electrophoretic mobility µEP := UEP /Eext as electrophoretic speed per unit applied field the electrophoretic velocity of the particle can be obtained. Henry’s analytical solution for the electrophoretic velocity of a spherical particle of radius R in an unbounded electrolyte solution of dynamic viscosity µf with Debye-Hückel parameter κ, subject to an ~ ext reads as applied field of strength E   ~ EP = 2εe ζ  U 1 + 3µf 1 h 2 1+ 2.5 κR(1+2e−κR )  ~ i3  E ext , (29) according to the expression for the electrophoretic mobility of Ohshima given in Eqn. (27). For the electrophoresis simulations in this article, the particle charge must be known to compute the electrostatic force on the particle. Analytical solutions for electrophoretic motion such as Henry’s equation, however, are typically given in terms of the ζ-potential, which is defined at the slip surface between the compact and diffuse EDL layer. Since the particle charge is acquired as a surface charge, for a given ζpotential the surface charge (density) enclosed by the slip surface is therefore needed in the simulations. The surface charge density is hereby obtained from the overall surface charge bound at the fluid-particle interface and in the Stern layer. This approach is justified by the fact that the electric potential at the Stern surface and the ζ-potential can in general be assumed to be identical [86]. The relation of the surface density σs to the ζ-potential is obtained from the Neumann BC on the surface of the insulating particle [85] dψ σs = −εe (30) d~r r=R in case these electrical properties do not vary in angular direction. This condition holds for insignificant permittivity of the insulating particle compared to the fluid permittivity εe . Alternatively, this relation can be derived from the electroneutrality condition [46]. With the spatial distribution of ψ around the spherical particle according to Eqn. (23) the ζ–σs relationship follows from Eqn. (30) as   qs 1 + κR σs = = ζ ε . (31) e 4πR2 R For a spherical particle with an EDL potential ψ described by the spherical symmetric Poisson-Boltzmann equation, the more general ζ–σs relationship v      u zeζ u 8 ln cosh   zeζ u 2 1 2εe κkB T 1 4kB T u   +    u1 + sinh  (32) σs =  2 zeζ zeζ ze κR  2kB T t  (κR) 2 2 cosh sinh 4kB T 2kB T for 1-1 and 2-1 electrolyte solutions is derived in [87]. The relative error of this approximation w.r.t. the exact numerical results computed by [88] is below 1 % for 0.5 ≤ κR < ∞ [85]. This relationship is applied in the electrophoresis simulation validation in Sec. 6.3 to compute the particle charge for a given ζ-potential. The applied ζ–σs relationship is derived for electric potentials governed by the spherical Poisson-Boltzmann equation and is thus more general than the ζ–σs relationship (31) for the Debye-Hückel approximation. For the simulation parameters used in Sec. 6.2, the deviation of σs for the general relationship w.r.t. the exact value of the Debye-Hückel approximation is about 0.2 % and hence negligible. 12 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 13 4. Numerical Modeling 4.1. Lattice Boltzmann Method with Forcing The LBM is a mesoscopic method for the numerical simulation of fluid dynamics based on kinetic theory of gases. This method statistically describes the dynamics of ensembles of fluid molecules in terms of particle distribution functions (PDFs) that represent the spatial and velocity distribution of molecules in phase space over time. The temporal and spatial variation of PDFs, balanced by molecular collisions, is described by the Boltzmann equation. The solution of this equation converges towards the Maxwell-Boltzmann velocity distribution of molecules in local thermodynamic equilibrium. For small deviations from this equilibrium, the Navier-Stokes equations can be derived from the Boltzmann equation by means of a Chapman-Enskog expansion (cf. [89, 90]). In the LBM, the phase space is discretized into a Cartesian lattice Ωdx ⊂ RD of dimension D with spacing dx, and a set of Q discrete velocities ~cq ∈ RD , q ∈ {1, . . . , Q}. Moreover, time is discretized as cq are chosen Tdt = {tn : n = 0, 1, 2, . . .} ⊂ R+ 0 , with a time increment of dt = tn+1 − tn . The velocities ~ such that within a time increment, molecules can move to adjacent lattice sites or stay at a site. Associated with each of these velocities is a PDF fq : Ωdx × Tdt 7→ R. A forward-difference discretization in time and an upwind discretization in space [91] result in the discrete lattice Boltzmann equation fq (~xi + ~cq dt, tn + dt) − fq (~xi , tn ) = dtCq + dtFq , (33) with lattice site positions ~xi , discrete collision operator dtCq , and discrete body-force term Fq . This equation describes the advection of PDFs between neighboring lattice sites and subsequent collisions. In general, the collision operator can be represented in terms of the collision matrix S as dtCq = P eq  (cf. [92]), with the vector f~ := (f0 , f1 , . . . , fQ−1 )> of the PDFs fq , and f~eq of the equij Sqj fj − fj librium distributions fqeq . The latter are obtained from a low Mach number expansion of the MaxwellBoltzmann distribution [89]. With a representation of the macroscopic fluid density as ρf = ρ0 + δρ in terms of a reference density ρ0 and a density fluctuation δρ, the equilibrium distribution function for the incompressible LBM is derived in [93] as    (~u · ~u) (~cq · ~u) (~cq · ~u)2 + − , (34) fqeq (ρ0 , ~u) = wq ρf + ρ0 c2s 2c4s 2c2s where ‘·’ denotes the standard Euclidean scalar product. This distribution function depends on ρf , the macroscopic fluid velocity ~u, and lattice-model dependent weights wq . At each instant of time, ρf and ~u are given by moments of PDFs as P ρf (~xi , t) = fq (~xi , t), qP (35) ~cq fq (~xi , t). ~u(~xi , t) = ρ10 q c2s ρf (~xi , t) according to the equation of √ state for an ideal Moreover, the pressure p is given as p(~xi , t) = gas. We employ the D3Q19 model of [94] with thermodynamic speed of sound cs = c/ 3 for the lattice velocity c = dx/dt. For this model, the weights wq are: w1 = 1/3, w2,...,7 = 1/18, and w8,...,19 = 1/36. As discussed in [93], fqeq recovers the incompressible Navier-Stokes equation with at least second-order accuracy u| 2 of the Mach number Ma := |~ cs , O(Ma ). In LBM simulations, the kinematic fluid viscosity νf is generally determined by a dimensionless relaxation time τ of the collision operator as   1 2 c dt. (36) ν= τ− 2 s As shown in [95], with this definition the LBM is second-order accurate in space and time. Among the different collision operators available for the LBM, we employ the two-relaxation-time (TRT) collision operator of [29, 30] X    Sqj fj − fjeq = λe fqe − fqeq,e + λo fqo − fqeq,o , (37) j 13 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 14 with the relaxation parameters λe and λo for even- and odd-order non-conserved moments, respectively. Alternative collision operators either have disadvantages regarding stability and accuracy [96] such as the BGK model [97] or are computationally more costly such as the MRT operator [92] or the cumulant operator [98]. To ensure stability, both relaxation parameters should be within the interval ] − 2, 0[, cf. [99, 30]. The even relaxation parameter is related to the dimensionless relaxation time by λe = − τ1 and therefore determines the fluid viscosity. The free parameter λo is set to λo = −8(2 − 1/τ )/(8 − 1/τ ) in this article, which prevents τ -dependent boundary locations for no-slip BCs as they arise for the BGK operator. Instead, walls aligned with the lattice dimensions are fixed half-way between two lattice sites, as shown in [100]. For the TRT operator, the PDFs are decomposed as fq = fqe + fqo into their even and odd components fqe = 12 (fq + fq̄ ) fqo = 12 (fq − fq̄ ) and and fqeq,e = 12 (fqeq + fq̄eq ) fqeq,o = 12 (fqeq − fq̄eq ), with ~cq = −~cq̄ . The local equilibrium distribution function in Eqn. (34) is then given by   ρ0 ρ0 u · ~u) + 2c cq · ~u)2 fqeq,e = wq ρf − 2c 2 (~ 4 (~ s s fqeq,o = wq ρc20 (~cq · ~u). (38) (39) s At each time step tn ∈ Tdt the lattice Boltzmann method performs a collide– and a stream step f˜q (~xi , tn ) = fq (~xi , tn ) +λe [fqe (~xi , tn ) − fqeq,e (~xi , tn )] +λo [fqo (~xi , tn ) − fqeq,o (~xi , tn )] (40) fq (~xi + ~eq , tn + dt) = f˜q (~xi , tn ) + dtFq , (41) where f˜q denotes the post-collision state and ~eq = ~cq dt a discrete lattice direction. In the stream step, the product of dt and the forcing term Fq is added to the post-collision PDFs. The term Fq considers the external effect of body forces acting on the fluid. In this article, the discrete forcing term according to Luo [101] is employed as   (~cq − ~u) (~cq · ~u) ~ + ~ c Fq = w q (42) q · fb , c2s c4s with f~b representing the electrical body force per unit volume. The forcing terms lead to an additional term in the continuity equation that arises for spatially varying external forces, as shown in [102, 103]. This additional term can be removed by incorporating the external force in the momentum density definition as ! 1 X dt ~ ~u = fq~cq + fb . (43) ρ0 2 q Thus, [102] suggest to use the forcing term (42) in combination with the modified momentum density definition in Eqn. (43) for the BGK. We therefore use this forcing term with second-order accuracy, together with the modified momentum density for the resulting velocity ~u. To increase the computational efficiency of the implementation, the compute-intensive collide step and the memory-intensive stream step are fused to a stream-collide step. In the simulations presented in this article, no-slip and free-slip BCs are applied as described in [32]. 4.2. Momentum Exchange Approach To model the fluid-particle interaction and the resulting hydrodynamic interactions of the particles, the momentum exchange approach suggested by [27] is employed in this article. This approach computes the momentum exchange between the fluid and the suspended rigid particles from PDFs surrounding these solid objects. The implementation of this approach in waLBerla has recently been applied to simulate fluid-particle interactions also at Reynolds numbers beyond the Stokes regime, as presented in [104, 105, 106]. 14 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 15 For the momentum exchange approach, the solid particles are mapped onto the lattice by considering each cell whose center is overlapped by a particles a moving obstacle cell. All other lattice cells are fluid cells, resulting in a staircase approximation of the particle surfaces. These surfaces are represented by surface cells indicated by subscript s in the following. On the fluid cells denoted by subscript F , the LBM is applied. To model the momentum transfer from the particles to the fluid, the velocity bounce-back BC ωq fq̄ (~xF , tn + dt) = f˜q (~xF , tn ) − 2 2 ρ0~cq · ~us cs (44) is applied at fluid cells with position ~xF = ~xs + ~eq̄ adjacent to a surface cell at ~xs . This boundary condition introduced in [26] matches the fluid velocity to the local particle surface velocity ~us . From the sum of all force contributions due to the momentum transfer from fluid cells to neighboring surface cells (cf. [32]), the overall hydrodynamic force on the particle can be obtained according to [27] as  X X  dx3 ωq F~h = 2f˜q (~xF , tn ) − 2 2 ρ0~cq · ~us ~cq . (45) cs dt s q∈Ds Here, Ds is the set of direction indices q in which a given particle surface cell s is accessed from an adjacent ~ h is given by substituting ~cq × (~xs − ~xC ) for the last ~cq term in fluid cell. Analogously, the overall torque M Eqn. (45), with ~xC representing the particle’s center of mass. The mapping of the solid particles onto the lattice results in fluid cells appearing and disappearing as the particles move. Therefore, at uncovered lattice sites the PDFs must be reconstructed. We set the PDFs at those fluid cells to the equilibrium distribution f eq (ρ0 , ~us (~xs (tn − dt)) according to Eqn. (34) dependent on the local particle surface velocity from the previous time step. 4.3. Finite Volume Discretization for Electric Potential Equations To solve the Debye-Hückel approximation a cell-centered finite volume scheme is applied on the Cartesian lattice Ωdx introduced in Sec. 4.1. Associated with this lattice of spacing dx that represents the computational domain Ω ⊂ R3 is the three-dimensional cell-centered grid Gdx defined (cf. [107]) as     j − 1/2  V V  Gdx := ~xi ∈ Ω ~xi =  k − 1/2  dx i ∈ i , (j, k, m) ∈ J , (46)   m − 1/2 with Ωdx = Ω ∩ Gdx . For V indexing of lattice cells by tuples (j, k, m) of cell indices in the three spatial dimensions, the index set J := {(j, k, m) | j = 1, . . . , lx ; k = 1, . . . , ly ; m = 1, . . . , lz } is introduced. Here V lx , ly , and lz represent the numbers of cells in x, y, and z-direction, respectively. The set is related J V to the V setVof single cell indices i := {i | i = 1, . . . , lx · ly · lz } used for the LBM by a bijective mapping g : i → J , according to Eqn. (46). The finite volume discretization of the Debye-Hückel approximation Eqn. (18) includes volume integration over each lattice cell Ωi = Ωklm := [~xj−1,k,m , ~xj,k,m ] × [~xj,k−1,m , ~xj,k,m ] × [~xj,k,m−1 , ~xj,k,m ] and applying the divergence theorem to the Laplace operator ∆ = ∇· ∇, resulting in I Z 2 ~ − ∇ψ(~x) dΓi + κ ψ(~x) d~x = 0 ∀ Ωi ∈ Ωdx . (47) ∂Ωi Ωi Here, ∂Ωi denotes the closed surface of the cell, and ~Γi is a surface directed element. The cell surface consists of six planar faces with constant outward unit normal vectors ~niq (q = 1, . . . , 6). Therefore, the surface integral can be decomposed into a sum of integrals [108] as I − ∂Ωi ∇ψ(~x) d~Γi = − Z 6 X q=1 ∂Ω iq 15 ∇ψ(~x) · ~niq dΓiq , (48) D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 16 where q represents LBM direction indices introduced in Sec. 4.1, and ∂Ωiq is the common face with the neighboring cell in direction q. The gradients ∇ψ(~xi ) · ~niq in normal direction of the faces ∂Ωiq are approximated at the face centers by central differences of ψ from a neighboring and the current cell as ∇ψ(~xi ) · ~niq ~ xi + 12 ~ eq ≈ ψ(~xi + ~eq ) − ψ(~xi ) . dx (49) Here, ~eq represents the corresponding lattice direction introduced in Sec. 4.1. Substituting the approximation of the normal fluxes across the surfaces of area dΓiq = dx2 , Eqn. (49) into Eqn. (48) results in I 6 X ψ(~xi + ~eq ) − ψ(~xi ) 2 − dx . (50) ∇ψ(~x) d~Γi ≈ − dx q=1 ∂Ωi Applying the above finite volume discretization to the linear term of the Debye-Hückel approximation results in Z κ2 ψ(~x) d~x ≈ κ2 ψ(~xi ) dx3 . (51) Ωi DHA This additional term enters the central element of the resulting seven-point stencil Ξdx as     0 −1 0 0 0 0 0 0 0 1   −1 6 + κ2 dx2 −1 0 −1 0 , 0 −1 0 dx2 0 0 0 0 0 0 0 −1 0 (52) and the right-hand side for each unknown is zero. 4.4. Parametrization for Electrokinetic Flows Numerical simulations are typically performed in terms of dimensionless parameters. To ensure consistently good numerical accuracy independent of the simulated scales, the physical quantities are mapped to a computationally reasonable numerical value range. In LBM simulations usually the quantities are expressed in lattice units. Therefore, physical values must be converted to lattice values before the simulation and vice versa to obtain physical values from simulation results. In the following the lattice unit (LU) system employed in this article is presented, providing a common parameterization also for further (electrokinetic) flow scenarios [76]. Physical simulation parameters are given in terms of the international system of quantities (ISQ) associated to the international system of units (Système International d’Unités, SI [109]) [110]. The value of a quantity is defined as product of a numerical value and a unit, e. g. 10−6 m. The SI system comprises the base units displayed in Tab. 1, together with the corresponding mutually independent base quantities length, time, mass, electric current, thermodynamic temperature, amount of substance, and luminous intensity. Moreover, derived units such as N = kgs2m (Newton) are defined in the SI system as products of powers of base units [109]. For LBM simulations the base quantities are length, time, and mass density. The corresponding lattice Table 1: Physical and LBM base quantities for electrokinetic simulations. kind of quantity length time mass electr. thermodyn. chem. photometr. ISQ quantity SI unit x m t s m kg I A T K n mol Iv cd LBM quantity lattice unit x dx t dt ρ ρ0 Φ V – – – – – – 16 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 17 base units are the (physical) lattice spacing dx, time increment dt, and fluid reference density ρ0 . Therefore, the numerical values of these quantities in lattice units become unity, as shown in Tab. 2. The lattice parameters representing these dimensionless numerical values in LUs are indicated with subscript L in the following, e. g. dxL for the lattice spacing. Performing LBM computations on such normalized lattice parameters saves numerical operations: Additional scaling factors are avoided, e. g. in the LBM streamcollide step, when computing the equilibrium distribution function given in Eqn. (34) (cf. cL = dxL /dtL = 1) or the macroscopic velocity according to Eqn. (35) (cf. ρ0,L = 1). For the electrokinetic simulations, the electric potential Φ is chosen as electric base quantity. This quantity, however, is not scaled on the lattice but keeps its numerical value that typically lies in a range not too far from unity. In contrast to the SI system, the LU system for electrokinetic simulations requires no base units corresponding to the thermodynamic temperature T or the amount of substance n: In the simulations, temperature appears only in combination with the Boltzmann constant as energy, i. e., E = kB T , with the derived unit [E] = [m] [x]2 /[t]2 . With the relation of mass and mass density [m] = [ρ0 ] [x]3 , this unit can be represented in lattice base units (see Tab. 1). Moreover, by representing the molar concentration with unit [ci ] = mol l in terms of the number density as 1 ni = ci NA with Avogadro’s number NA = 6.022 14 · 1023 mol , the unit ‘mol’ cancels out, yielding [ni ] = [x]−3 . With the choice of the potential Φ as base quantity, the electric current I becomes a derived quantity in the LU system. The unit of I can be derived from the energy in electrical units [E] = [I] [Φ] [t] and the above definition of energy in terms of lattice units [E] = [ρ0 ] [x]5 /[t]2 . Equating both relations results in the derived lattice unit [ρ0 ] [x]5 . (53) [I] = [Φ] [t]3 In Tab. 2 different physical quantities and their SI units are displayed, as well as their representation by (dimensionless) lattice parameters and their lattice units. The conversion of physical quantities to lattice Table 2: Relation of physical quantities and lattice parameters for electrokinetic simulations. physical quantity SI unit dx (lattice spacing) dt (time increment) m s ρ0 (fluid density) Φ (electr. potential) kg m3 L (length) ν (kinem. viscosity) ~u (velocity) m (mass) F~ (force) I (electr. current) V m m2 s m s kg kg m s2 A lattice parameter dxL dtL ρ0,L ΦL LL νL ~uL mL F~L IL e (elem. charge) As eL ε0 (vacuum permittivity) ~ (electr. field ) E As Vm V m ε0,L ~L E J EL E (energy) numerical value 1 dx dx (= 1) 1 dt dt (= 1) 1 ρ0 ρ0 (= 1) 1 V Φ 1 dx L dt ν dx2 dt u dx ~ 1 m ρ0 dx3 dt2 F~ ρ0 dx4 3 V dt I ρ0 dx5 V dt2 e ρ0 dx5 V dt2 ε ρ0 dx5 0 dx ~ V E dt2 E ρ0 dx5 lattice unit dx dt ρ0 V dx dx2 dt dx dt ρ0 dx3 ρ0 dx4 dt2 ρ0 dx5 dt3 V ρ0 dx5 dt2 V ρ0 dx5 V dt2 V dx ρ0 dx5 dt2 units requires their division by powers of the LBM base quantities with the corresponding SI units. Since the potential Φ has the same numerical value in physical and lattice units, the LBM base unit of the potential is dx5 simply ‘1 V’. Therefore, the derived lattice unit ‘Ampere’ for the electric current is given by A = ρV0 dt 3 (see Eqn. (53)). The corresponding scale factors for converting the physical parameters (e. g. ν) to the associated 17 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 18 lattice parameters (e. g. νL ) are shown in Tab. 2. Multiplication with the inverse scale factors converts the lattice parameters back to physical quantities. 5. Extension of waLBerla for Electrophoresis Simulations Electrophoresis simulations require the mutual coupling of fluid dynamics, rigid body dynamics, and electro-statics, as shown in Fig. 1. In addition to electrostatic and hydrodynamic interactions, the applied field acts on the EDL charge and thereby affects fluid flow and particle motion. For the electrophoresis algorithm presented below, the equilibrium description of the EDL potential in terms of the linear DebyeHückel equation is employed. Therefore, the predominant retardation effect is recovered in the simulations. The applied potential ϕ and the EDL potential ψ are linearly superimposed (cf. Henry’s equation, Sec. 3), which is valid for weak applied fields when the EDL distortion by the field is negligible. Thus, the applied electric field can be imposed directly, without solving the associated Laplace equation. In the following the main concepts of the waLBerla framework are described, together with the functionality for electrophoresis simulations implemented therein. 5.1. Design Concepts of waLBerla WaLBerla is a framework for massively parallel multiphysics simulations with a MPI-based distributed memory parallelization that is specifically designed for supercomputers. The main software design goals of this framework are flexibility to combine models of different effects, extensibility to allow the incorporation of further effects and details, e. g., for electrokinetic flows, and generality to support further applications [76]. These goals are reached by integrating the coupled simulation models into waLBerla in a modular fashion that avoids unnecessary dependencies between the modules. This way, the modules can be augmented by more sophisticated models or models tailored to a certain application, and functionality from different modules can be combined flexibly. The modular code structure also provides excellent maintainability, since modifications of the code in one module do not affect other modules. Developers can therefore efficiently locate faulty modules and find bugs inside these modules, also by systematically utilizing automatic tests. In addition to modules, the waLBerla code structure comprises a core for sequence control that initializes data structures, performs the time stepping, and finalizes the simulation on each parallel process. By means of applications, multiphysics simulations can be defined by assembling the associated functionality and coupled models from the modules. The coupling strategy for multiphysics simulations is based on accessing mutually dependent data structures (see [31] for more details). These data strucutres are defined in the modules that implement models for the different physical effects. Also infrastructural and utility functionality is encapsulated in modules, e. g., for domain setup, MPI communication, BC handling, parameterization, or simulation data output. For parallel simulations the discretized simulation domain is decomposed into equally sized blocks of cells that can be assigned to different parallel processes. In this block concept, each block contains a layer of surrounding ghost cells that is needed for BC treatment and parallelization. For parallelization, cell data of neighboring processes is copied to the ghost layer, dependent on the data dependencies of the unknowns located on a given block. Moreover, metadata of a block specifies its location in the simulation domain or its rank for MPI communication. The communication concept provides a simple and flexible communication mechanism tailored to simulations on Cartesian grids and facilitates various communication patterns. Individual work steps of a simulation algorithm are specified as sweeps that are executed on a block-parallel level. The sweep concept defines a structure in which callable objects (i. e. kernels) implemented in the modules can be specified at compile time. By means of dynamic application switches, specific kernels tailored to a given computer architecture or implementing a desired model variant, can be selected at run time. For time-dependent simulations, the sweeps are organized in a timeloop that specifies the order in which the individual work steps are executed at each time step. To facilitate iterative solvers, sweeps can also be nested to repeatedly perform a grid traversal until a termination criterion is met. The boundary condition concept for handling multiple physical fields, numerical methods, and governing equations, introduced in [31], is applied in this article for moving obstacles with electric BCs. This concept relies on flags to indicate for each boundary cell the kind of boundary treatment that to is be performed, 18 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 19 with an individual BC flag for each condition. Moreover, cells adjacent to a boundary are indicated with a nearBC flag and non-boundary cells with a nonBC flag. Individual sets of these flags are defined for each governing equation. Due to specific LBM requirements, the boundary handling is performed such that the BCs are fulfilled when a boundary cell is accessed from a nearBC cell in the susequent sweep. The abstract boundary handling is implemented in the bc module and provides functionality for all BCs are handled either as direct or direction-dependent treatment. In direction-dependent treatment the BC value is set at a boundary cell dependent on the value at a neighboring cell, whereas in direct BC treatment the BC value is directly set at a boundary cell [31]. The actual boundary handling functionality is implemented in corresponding BC classes whose functions are executed when the associated BC flag is found. The parameterization concept for multiphysics simulations introduced in [76] is based on the conversion of physical parameters to lattice units before the simulation, as described in Sec. 4.4. This approach ensures consistent parameters in all waLBerla modules, independent of the underlying physics. Individual modules can therefore be developed independently w.r.t. the common lattice unit system. Simulation parameters and BCs are typically provided to waLBerla through an input file. To ensure a consistent parameter set and a correct mapping of the physical quantities to lattice units, the class PhysicalCheck has been introduced in waLBerla in [111]. This class checks the simulation parameter set specified in the input file for completeness and physical validity and converts the parameters to lattice units. Since the quantities are converted based on the SI system, the unit Ampere is re-defined for PhysicalCheck according to Eqn. (53) to support simulations including electric effects. 5.2. Overview of waLBerla Modules for Electrophoresis Simulations In the following an overview of the modules relevant for electrophoresis simulations is given. For fluid simulations with the LBM, the lbm module implements various kernels for the stream-collide step with the different collision operators and forcing terms described in Sec. 4.1. The classes for treating the corresponding BCs are provided by the associated lbm bc module. In the lbm module block-fields of cells are provided for the PDFs, the velocity, the density, and an external force. The external force field is used for coupling the LBM to other methods, e. g. via the forces exerted by electric fields on the EDL and the fluid in electrophoresis simulations. The PDF and velocity field are accessed by moving obstacle module functions for the simulation of moving particles. The moving obstacle module facilitates simulations of fluid-particle interactions with the momentum exchange method by implementing kernels for moving obstacle sweeps and providing the corresponding data structures. This module furthermore provides setup functions for initializing and connecting the pe to waLBerla. For the moving obstacle handling, an obstacle-cell relation field is provided that stores for each lattice cell overlapped by a pe object a pointer to this object. Moreover, from the lbm module the PDF source field is accessed for the hydrodynamic force computation and the reconstruction of PDFs. In the lbm velocity field, body velocities are stored and accessed in the moving boundary treatment of the LBM. For the computation of the electric potential distribution, the lse solver module described in Sec. 5.3 is employed. This module has been implemented for solving large sparse linear systems of equations as they arise from the discretization of the electric potential equations (see Sec. 4.3). The corresponding BC classes are implemented in the pot bc module described in Sec. 5.4. The data structures defined in the lse solver module, accessed by the application and other modules, include the stencil field representing the system matrix as well as the scalar fields for the solution and for the RHS. The electrokin flow module was designed for facilitating electrokinetic flow simulations. This module provides kernels for coupling the involved methods as well as the setup and parameterization of simulations such as electrophoresis. The setup includes initializing the stencils and RHS from the lse solver module according to the finite volume discretization of the Debye-Hückel equation presented in Sec. 4.3. The kernels for imposing the electric potential BCs on the moving particles and for computing the electrostatic forces on fluid and particles are described in Sec. 5.5 and Sec. 5.6, respectively. Finally, the coupled algorithm for electrophoresis provided by the electrokin flow module is presented in Sec. 5.7. 19 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 20 5.3. Solver for Linear Elliptic PDEs with Moving Boundaries The solver module lse solver in waLBerla for large linear systems of equations has been designed as an efficient and robust black-box solver on block-structured grids [112, 31, 76]. To specify the problem to be solved, the application sets up the system matrix, right-hand side, and BC handling. In the lse solver module, solver sweeps are pre-defined that perform the iterations at the position where they are added to the timeloop. For a given simulation setup, the employed solver is selected via the input file where also the solver parameters and BCs are specified. An iterative solver requires a nested sweep that is executed until a specific convergence criterion is satisfied. For all implemented solvers, these sweeps share a common structure. This structure is displayed for the SOR sweep solveTimeVaryingBCSOR for moving boundaries and linear PDEs such as the Debye-Hückel approximation in Fig. 3 as an activity diagram. For Adapt stencils and RHS to BCs Maximum iterations reached? yes no Compute residual and norm Termination criterion met? yes no Update ‘red’ unknowns Update ‘black’ unknowns Figure 3: Activity diagram for SOR sweep solveTimeVaryingBCSOR with time varying boundary conditions (BCs), e. g., due to moving particles the employed discretization of the electric potential equations, the system matrix is represented by D3Q7 stencils. These stencils comprise an entry for each, the center and the six cardinal directions. In the setup function for this SOR sweep, the communication for the ghost layer exchange of the solution field in the initialization phase is set up first. Then the SOR solver sweep is added to the timeloop, and the kernels for relaxation, communication, and BC treatment are specified as solver sub-sweeps. For parallel execution, the SOR algorithm is implemented in red-black order. The filled circle at the top of the diagram in Fig. 3 indicates the starting point of the sweep in the timeloop. At the beginning of the sweep solveTimeVaryingBCSOR for moving boundaries, the stencils are constructed to incorporate the BCs according to the present boundary locations. Furthermore, the RHS is adapted to these BCs before the solver iterations start. For this purpose, a sub-sweep with a kernel for re-setting the stencils and RHS is executed before the iteration loop, followed by the BC treatment functions adaptStencilsBC and adaptRHSBC described in Sec. 5.4. Then the standard parallel Red-Black SOR sweep is performed until the termination criterion is met. This sweep comprises a sub-sweep for computing the residual and its L2 -norm for the termination criterion, as well as two solver sub-sweeps for the SOR update of the ‘red’ and the ‘black’ unknowns, respectively. In these sub-sweeps, the quasi-constant stencil optimization technique introduced in [31] is employed. Based on the residual L2 -norm, the termination 20 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 21 criterion for the simulations performed in this article is provided as residual reduction factor RESRF w.r.t. the initial norm of the simulation. For multigrid solvers as applied in [31] to charged particle simulations in absence of ions in the fluid, the red-black update sub-sweeps in Fig. 3 are replaced by solver sub-sweeps of a V-cycle. To apply the SOR sweep to varying stencils of linearized PDEs, such as the symmetric Poisson-Boltzmann equation, only the sub-sweep for adapting the stencils and RHS to the BCs is performed at the beginning of each iteration instead of once before the iterations start (see [76]). 5.4. Boundary Condition Handling for Solver Module The implicit BC handling used and initiated by the solver module has been introduced in [31]. This boundary handling is based on incorporating the BCs into the stencils and right-hand side of the finite volume discretization. That way, at an iterative update of a near-boundary value, the method implicitly uses the new values for the BCs. For Dirichlet boundaries, the boundary values are linearly extrapolated to the boundary cell and for Neumann BCs the boundary values are approximated by central differences. For both the stencils and the right-hand side, a direction-dependent BC treatment is used. The functions for this BC treatment are implemented in the pot bc module. This module employs own nonBC and nearBC flags for the BC handling of scalar potentials. Moreover, for each BC class in this module an associated BC flag is defined. For the employed cell-centered discretization, the module contains one class for each, Neumann and Dirichlet BCs. For incorporating the BCs into the stencils the kernel adaptStencilsBC is implemented. This kernel iterates over all lattice cells to find scalar potential nearBC cells. At each cell with nearBC flag, the kernel employs the D3Q7 stencil directions to iterate over the neighboring cells. In directions of a cell with scalar potential BC flag, the stencil entry of the nearBC cell, associated with the direction of the BC flag, is adapted accordingly. The function adaptRHSBC employs the standard boundary handling of the bc module to invoke the pot bc kernels for adapting the RHS to the BCs. To this end, the direction-dependent BC treatment kernels in the corresponding BC classes implement the RHS adaption depending on the BC value. The BC value is specified in the input file for static BCs, or in a previous time step for BCs of moving particles (see Sec. 5.5). To facilitate such complex boundaries, the BC classes store the BC values and the corresponding boundary cell ranges. The latter are stored in a memory-efficient way either as cell intervals or as cell vectors. Moreover, to allow the computation of scalar potential gradients directly from the solution field, the BC values are set in this field at boundary cells when the RHS is adapted. From these BC values and from the solution at the nearBC cell, the value at the boundary cell required for the gradient can be extrapolated. 5.5. Electric Potential Boundary Condition Handling for Moving Particles Prior to the EDL potential distribution computation by the lse solver module, uniform ζ-potentials or surface charge densities are imposed at the moving particles by means of scalar potential BCs. These electrical surface properties are specified in the input file for different particle types with a common uid (unique identifier) defined in the pe. To this end, the sweep function setPotBC_ChargParticles is implemented in the electrokin flow module that maps the charged particles onto the lattice and sets the electric potential BC values and the associated BC handling flags at the corresponding cells. The function first overwrites the values of all cells in the RHS field with zero to remove the values from the previous BC treatment. Then the mapping is performed for all movable rigid bodies located in the subdomain of each process. For each particle the mapping is conducted in an extended axis-aligned bounding box that surrounds this rigid body and the associated nearBC flags. The mapping is realized in three steps: 1) First, all scalar potential nearBC and BC flags from the previous time step are removed, and the scalar potential nonBC flags are set. Moreover, the previous BC values and the associated cells in the BC class instances are removed. 2) Then, for particles with prescribed electric BCs, the BC handling for the lse solver module (see Sec. 5.4) is prepared. For each rigid body with a uid for which a surface property is specified in the input file, the associated BC is obtained. The cells overlapped by this particle are gathered and are added 21 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 22 together with the BC value to the corresponding BC class instance. Moreover, the BC flag is set at the overlapped cells. 3) Finally, the nearBC flag is set at all cells adjacent to a BC cell. Each step is performed for all bodies on a process before the next step begins, to prevent that for particles with overlapping bounding boxes the flags from a previous step are overwritten. 5.6. Computing Electrostatic Forces on Fluid and Particles The electric forces acting on the ions in the fluid are incorporated into the incompressible NavierStokes equation by the body force term f~b = −ρe (ψ) ∇ (ϕ + ψ), which coincides with the corresponding term employed in Henry’s solution (see Sec. 3). Due to the linear superposition of the electric potential ~ ext = −∇ϕ is components, the gradient is applied to both components separately. Since the applied field E given, only the EDL potential gradient must be computed. For the computation of the electric field due to the EDL, the electrokin flow module provides a kernel that performs the gradient computation at all scalar potential nonBC cells. The gradient of the electric potential is computed, as previously introduced in [31], by means of finite differences that provide O(dx2 ) accuracy. Where possible, an isotropy-preserving D3Q19 stencil is used (cf. [113]) instead of a D3Q7 stencil. With the LBM D3Q19 stencil, the gradient can be computed using wq -weighted differences of neighboring values in 18 directions ~eq as 19 ~eq 1 X wq ψ(~xb + ~eq ) · 2 . (54) ∇ψ(~xb ) ≈ w1 q=2 dx At nearBC cells the D3Q7 stencil is applied to compute the gradient of ψ from the BC values stored at particle and boundary cells in the BC treatment (see Sec. 5.4). The obtained electric field is stored in a field of cells that is accessed in the body force computation. For the computation of the electric body force and of the electrostatic force exerted on the particles, a further kernel is implemented in the electrokin flow module: The kernel first iterates on each parallel process over all lattice cells to compute the body force at scalar potential nonBC cells. This force is computed as product of charge density ρe (ψ) and total electric field ~ total = E ~ ext − ∇ψ. The relation of charge density and EDL potential follows Eqn. (20). The obtained E electric body force is written to the external force field of the lbm module that is accessed by the LBM kernels with forcing. Then the kernel iterates over all non-fixed particles residing on the current parallel process to compute the electrostatic force. For each of these particles the force is computed from the particle ~ ext and is then added to the particle. charge and the applied field as F~C = qe E 5.7. Algorithm for Electrophoresis The overall parallel algorithm for electrophoresis simulations with waLBerla is shown in Alg. 1. After the setup and initialization phase, the electric BCs for the EDL potential are set at the moving charged particles by means of setPotBC_ChargParticles at each time step. Then the Debye-Hückel approximation is solved by means of the SOR sweep solveTimeVaryingBCSOR. The iterations are performed until the specified termination criterion for the residual is met. From the obtained EDL potential distribution and the applied field the electric body force exerted on the fluid is computed, as described in Sec. 5.6. First the kernel computing the electric field caused by the EDL is applied. Then the kernel for the electric body force computation from the charge density distribution in the fluid and the total electric field is invoked. This kernel additionally applies the electrostatic force exerted by the applied field to the particles. Then the rigid body mapping sweep described in Sec. 4.2 is performed, imposing the particle velocities for the subsequent LBM sweep. In that parallel sweep, an LBM kernel with fused stream-collide step and forcing term (see Sec. 4.1) is employed to compute the fluid motion influenced by the moving particles and by the electrostatic force exerted on ions in the EDL. After the LBM sweep, the hydrodynamic forces on the particles are computed by the momentum exchange method. The obtained hydrodynamic force contributions and the electrostatic forces are then aggregated by 22 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 23 Algorithm 1: Electrophoresis Algorithm foreach time step, do // solve Debye-Hückel approximation (DHA): set electric BCs of particles while residual ≥ tol do apply SOR iteration to DHA // couple potential solver and LBM: begin compute electric field due to EDL compute charge density in fluid compute electric body force apply electrostatic force to particles // solve lattice Boltzmann equation with forcing, considering particle velocities: set velocity BCs of particles begin perform fused stream-collide step // couple potential solver and LBM to pe: begin apply hydrodynamic force to particles pe moves particles depending on forces the pe. From the resulting forces and torques, the new particle velocities and positions are computed in the subsequent pe simulation step by the PFFD algorithm [114] that additionally resolves rigid body collisions. 6. Electrophoresis Simulations In the following, the electric potential computation is validated for a sphere with uniform surface charge surrounded by an EDL. This sphere is placed in a micro-channel subject to an applied electric field. Moreover the flow field caused by the electrophoretic motion of the sphere in the micro-channel is visualized, together with the electric potential and the surrounding ions to qualitatively show the correctness of the simulations. Then the electrophoretic velocity and the retardation by the counter-ions in the EDL is validated w.r.t. Henry’s solution for different sphere sizes and values of κR. The simulation setup for the validation experiments is depicted in Fig. 4. A sphere is placed on the 2 L x/ BC Fy BC C B z x y BC BC Lz/2 Lz/2 2 L x/ C B Ly Figure 4: Setup for electrophoresis of spheres in square duct with different BCs. longitudinal axis of a cuboid domain of size Lx × Ly × Lz at an initial position of yinit , and an electrostatic force in y-direction acts on the sphere. The sphere is suspended in a symmetric aqueous electrolyte solution 23 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 24 kg of kinematic viscosity νf = 1.00 · 10−6 ms , density ρf = 1.00 · 103 m 3 , permittivity εe = 78.54 · ε0 , and ions of valence z = 1 at a temperature of T = 293 K. In all simulations, the EDL thickness λD is in the order of the particle diameter. The electric potential around the sphere due to the EDL is represented by the Debye-Hückel approximation. For this approximation, analytical solutions are known for the potential distribution and for the electrophoretic velocity. The LBM is employed with TRT operator and second-order forcing term by Luo and re-defined momentum density (see Sec. 4.1) in all simulations. The linear system of equations resulting from the finite volume discretization of the Debye-Hückel equation is solved by the SOR method that is sufficient for the quickly decaying electric potential due to the counter-ions in the EDL. For the SOR, a relaxation parameter of ωSOR = 1.7 is applied in all simulations. 2 6.1. Electric Potential in an EDL around a Sphere To validate the computation of the EDL potential ψ around a charged particle, a sphere of radius R with uniform ζ-potential is simulated in a large domain. The analytical solution of the Debye-Hückel equation (21) representing the EDL potential around the sphere is given by Eqn. (23). For the validation, a spherical particle of radius RL = 12 with initial position yinit = 64 dx is chosen and a domain size of 128 dx × 256 dx × 128 dx. The lattice spacing dx is displayed in Tab. 3 with the simulation parameters as employed related to the electric potential. The ζ-potential is chosen sufficiently low to approximate the Table 3: Parameters for sphere with uniform surface charge in micro-channel. c∞ / mol l ζ/mV −10.0 5.00 · 10 1 κ/ m −6 7.41 · 10 dx/m 6 10 · 10 λD,L −9 13.49 Poisson-Boltzmann equation by the Debye-Hückel approximation. To obtain the displayed values of κ and of the characteristic EDL thickness λD , a symmetric aqueous electrolyte solution with ions of the valence z and the bulk concentration c∞ shown in Tab. 3 is simulated. The EDL thickness is greater than the 12 lattice sites required for a sufficient resolution as observed in the electro-osmotic flow simulations in [76]. Despite its quick decay, the analytical solution of the electric potential at the domain boundaries differs from zero. Thus, the values of ψ at these boundaries are set to the analytical solution by means of Dirichlet conditions. To solve the Debye-Hückel equation subject to these BCs, a residual reduction factor of RESRF = 2 · 10−7 is employed as termination criterion for the SOR method. The analytical (ψ) and numerical (ψ ∗ ) solution at the initial particle position are depicted in Fig. 5 along ψ/V 0 ·10−3 Analytical solution −5 −10 Numerical solution 0 20 40 60 xL 80 100 120 Figure 5: Analytical and numerical solution for EDL potential of sphere with uniform surface charge. 24 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 25 a line in x-direction through the sphere center. Both graphs agree very well, showing the correctness of the finite volume discretization and the applied SOR solver, as well as the boundary handling at the particle surface. Inside the insulating particle, the electric potential is not computed explicitly, due to the uniform surface potential and the resulting symmetric distribution of ψ in the sphere. The electrostatic force needed to compute the particle motion is computed directly from the applied field and the particle charge, instead of the electric potential gradient as in [31]. 6.2. Electrophoresis of a Sphere in a Micro-Channel The application of the external electric field in the micro-channel setup described in Sec. 6.1 gives rise to an electrophoretic motion of the sphere. For the simulation of this scenario, the parameters listed in Tab. 4 are employed in addition to the parameters in Tab. 3. The particle is suspended in an electrolyte solution Table 4: Parameters for electrophoretic motion of sphere in micro-channel. V Ey / m qs /A s −18 −19.9 · 10 −4.7 · 10 dt/s 6 −12 200 · 10 UEP,L 4.49 · 10−3 with the parameters introduced at the beginning of Sec. 6. From the ζ-potential and the parameters in Tab. 3, the sphere’s charge qs in Tab. 4 is obtained from the surface charge density σs according to the ζ–σs relationship (32), multiplied by the surface area of the sphere, as qs = 4πR2 σs [81]. The high electric field strength Ey in Tab. 4 is chosen to keep the number of simulation time steps at a minimum. Due to the applied field and the resulting electrostatic force FC,y = 933 · 10−12 N the particle moves in y-direction, retarded by the channel walls and the opposing force on the EDL. For the chosen parameters, the terminal particle speed of UEP = 224.5 mm s is obtained for free space according to Henry’s solution (see Eqn. (29)), corresponding to a particle Reynolds number of Rep,d = 0.054. In the simulation, periodic BCs are applied in y-direction. At all other walls, no-slip conditions are applied for the LBM and homogeneous Neumann conditions for the electric potential. At each time step, the Debye-Hückel equation is solved by SOR with the termination criterion from Sec. 6.1. The LBM is run with τ = 6.5, resulting in the time increment dt listed in Tab. 4 for the chosen viscosity νf and dx (cf. Eqn. (36)). With dt and dx, the electrophoretic speed in lattice units UEP,L attains the values given in Tab. 4. Gravitational effects are neglected in the simulation to ensure that the particle motion is driven kg solely by electric forces. Thus, the employed density ρp = 1195 m 3 of the particle only has an impact on the time required to reach steady-state. In Fig. 6, the results of the electrophoresis simulation are visualized at different time steps. The EDL potential ψ in the y-z plane through the domain center is displayed, together with semi-transparent equipotential surfaces representing the excess counter-ions in the EDL. The flow field around the moving sphere is visualized in the x-z plane through the domain center. Arrows of uniform length indicate the flow direction, while the velocity magnitude is represented by the shown color-scale and by twelve white isosurface contour lines with logarithmic intervals in the range of 13.67 · 10−3 ms to 6.08 · 10−6 ms . The flow field around the moving particle shown in Fig. 6(a) is fully developed after 5001 time steps, and the particle has already attained its terminal velocity. Due to the periodicity of the domain, a channel flow in axial direction has emerged from the particle motion, as indicated by the contour lines. Moreover, a vortex has formed between the sphere and the surrounding no-slip walls. The flow field moves with the particle that translates along the channel centerline (see Fig. 6(b)). Because of the equilibrium representation of the EDL, the distribution of ψ is at all time steps symmetric w.r.t. the sphere center, almost up to the boundary. 6.3. Validation of Electrophoretic Motion of a Sphere To quantitatively validate the overall electrophoresis simulation algorithm, the electrophoretic velocity of spheres with uniform surface charge is compared to Henry’s solution Eqn. (29) for a spherical particle in an unbounded electrolyte solution. 25 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 26 (a) Results after 5001 time steps. (b) Results after 30 001 time steps. Figure 6: Electrophoresis of spherical particle in micro-channel with insulating no-slip walls. Visualization of flow field in x-y plane, EDL potential in y-z plane, and ion charge distribution around charged particle. In the simulation experiments, a sphere with uniform ζ-potential is moving under the influence of an ~ ext in a large domain filled with an electrolyte solution. The simulations are applied field of strength E performed for different values of κR by varying the sphere radius while keeping the EDL thickness constant. For validation, the relative deviation ∆r U of the obtained terminal sphere velocity from the theoretical velocity in Eqn. (29) is evaluated. The simulation parameters are chosen such that the electrophoretic motion is in the Stokes regime, and thus the nonlinear inertial term of Navier-Stokes equation can be neglected. Moreover, the EDL potential distribution is governed by the linear Debye-Hückel approximation. Therefore, the superposition principle is assumed to hold. Thus, from the obtained relative deviation from the analytical solution in an unbounded domain ∆r U , the relative deviation due to wall effects and volume mapping errors ∆r UStokes will be subtracted. These relative deviations were examined in [76] for several domain sizes and sphere radii. For no-slip BCs, the wall effect was shown to comply with analytical and experimental results. In the experiments, domain sizes are used for which the relative deviations ∆r UStokes for free-slip BCs are close to −3 %. For all simulations, the parameters in Tab. 5 are used. In each experiment, a sphere is suspended in a symmetric aqueous electrolyte solution with the parameters introduced at the beginning of Sec. 6 and a bulk concentration of c∞ = 1.60 · 10−5 mol l . These parameters result in the Debye-Hückel parameter κ shown in Tab. 5 and, together with the displayed lattice spacing dx, in the EDL thickness λD of approximately 15 26 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 27 Table 5: Parameters for electrophoretic velocity validation w.r.t. Henry’s solution. ζ/mV 1 κ/ m V Ey / m dx/m λD,L 10.0 13.3 · 106 99.0 · 106 5.00 · 10−9 15.08 lattice sites. The ζ-potential has the same absolute value as in the electrophoresis simulations in a microchannel from Sec. 6.2. Moreover, as in Sec. 6.2, a high electric field strength Ey is chosen to keep the number of simulation time steps low. The resulting electrostatic forces FC = qs Ey for the different sphere radii are displayed in Tab. 6, together with the electrophoretic charges qs on the spheres. These surface charges associated with the ζ-potential are obtained from the general ζ–σs relationship (32) as in Sec. 6.2. For all simulation parameters, the maximum relative deviation of σs for the general relationship from the exact value for the Debye-Hückel approximation is below 0.2 %. These charges are applied as particle charges to drive the spheres by the electrostatic force due to the electric field. For the different sphere radii and the associated values of κR, the electrophoretic velocities according to Henry’s solution are displayed in Tab. 6. These velocities correspond to particle Reynolds numbers Rep,d from 0.018 to 0.057 for the particle diameters of 40 nm to 120 nm. EM is introduced. To quantify the retardation by the opposing force on the EDL, the variable EPRet = UEPU−U EM This variable represents the relative deviation of the electrophoretic velocity of a particle with charge qs in presence of the electric double layer from the migration velocity UEM of a particle with the same charge in absence of surrounding ions. For the examined sphere radii, this retardation is in the range of 20 % to 42 %. Table 6: Electrophoresis parameters and domain sizes dependent on sphere size. Shown are the sphere radii RL in lattice units, the corresponding charges qs , and the electrostatic forces FC . For relation of sphere radius to EDL thickness κR, theoretical electrophoretic velocities UEP , Reynolds numbers Rep,d , and electrophoretic retardation parameter EPRet are given. Listed in lower part are domain sizes per dimension Lx,y,z , initial sphere positions yinit , process numbers per dimension #procx,y,z , and relative deviations of sphere velocities in free-slip domain from Stokes velocity ∆r UStokes . 4 6 8 9 12 qs /(10 A s) FC /(10−12 N) 2.21 219 3.67 363 5.36 530 6.29 622 9.43 934 κR UEP /(10−3 Rep,d EPRet /% 0.265 461 0.018 -20.6 0.398 464 0.028 -27.7 0.530 466 0.037 -33.6 0.597 468 0.042 -36.2 0.796 471 0.057 -42.8 864 1248 392 1280 1536 588 1632 2048 784 1632 2048 882 1632 2048 1176 8 × 16 × 8 8 × 16 × 16 16 × 16 × 32 16 × 16 × 32 16 × 16 × 32 -3.04 -2.65 -2.98 -2.89 -3.00 RL −18 m s ) Lx,z /dx Ly /dx yinit /dx #procx,y,z ∆r UStokes /% Then the domain sizes for which the relative deviation from Stokes velocity is about ∆r UStokes = −3 % are listed in Tab. 6, together with the initial position yinit in movement direction that correspond to 98 × RL . The LBM with TRT collision operator is employed with the relaxation time τ = 6, resulting in the time increment dt = 45.8 · 10−12 s. As in the micro-channel electrophoresis simulations, gravitational are effects kg neglected, and the insulating particles have a density of ρp = 1195 m 3. For the electric potential, homogeneous Neumann BCs are applied at the walls in x- and z-direction as 27 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 28 = 0. To improve convergence [31], homogeneous Dirichlet BCs are applied at the walls in y-direction as Φ Γ ∪Γ = 0 V. The particle is located at sufficient distance from these walls for the N S EDL potential to decay to approximately zero, and therefore these BCs do not affect the electric potential distribution. As termination criterion of the SOR solver for the Debye-Hückel equation, a residual reduction factor of RESRF = 1 · 10−6 is used. The parallel simulations are run on SuperMUC1 of the Leibniz Supercomputing Centre LRZ in Garching (Germany) on 64 to 512 nodes with the numbers of processes listed in Tab. 6. Within the execution time of 37 h to 48 h, a number of 70 296 to 74 000 time steps are performed, and the spheres cover a distance of about 300 dx. The high numbers of time steps are chosen to ensure that the spheres reach steady-state motion, and that large numbers of sampling values are available to compute the terminal velocities. The sphere velocities are sampled every 20 time steps during the simulation. In the second half of the simulation, the terminal particle velocity is reached. Thus, the mean particle velocity U ∗ and the velocity U ∗ −U ∗ fluctuations δU = maxU ∗ min due to volume mapping effects are computed from the last 50 % output values. In the considered range of time steps additionally the number of time steps between two SOR calls and the number of SOR iterations is monitored. The average number of time steps between two SOR calls decreases from ∆TSSOR = 24 to ∆TSSOR = 3 as RL increases from 4 to 12. Likewise, the average number of SOR iterations per solver call decreases from 451 iterations to 198 iterations for the respective sphere radii. The obtained terminal velocity in lattice units UL∗ and the fluctuations are displayed in Tab. 7. As expected, ∂Φ ∂~ n ΓW ∪ΓE ∪ΓB ∪ΓT Table 7: Simulation results of electrophoretic velocity validation for different sphere sizes. Shown are the theoretical velocities ∗ and fluctuations δ , the relative deviations ∆ U of UEP,L for unbounded domains in lattice units, the obtained velocities UL r U ∗ from U UL EP,L , and the relative deviations ∆r UEP corrected by hydrodynamic wall and mapping effects. 4 6 8 9 12 UEP,L /10 4.227 4.249 4.274 4.286 4.320 UL∗ /10−3 4.119 2.52 -2.56 0.5 4.144 1.52 -2.48 0.2 4.120 0.83 -3.59 -0.6 4.135 0.68 -3.51 -0.6 4.151 0.29 -3.91 -0.9 RL −3 δU /% ∆r U/% ∆r UEP /% the fluctuations decrease with increasing sphere resolution. Moreover, the relative deviation of the obtained velocity U ∗ from the theoretical electrophoretic velocity UEP given by ∆r U = (U ∗ − UEP )/UEP is listed in Tab. 7. For all examined sphere radii, the obtained velocities in the confined domain are by 2.5 % to 3.9 % lower than the theoretical values of UEP for a particle in an unbounded electrolyte solution. The effect of the confinement on the particle velocity is deducted by subtracting the relative deviation from Stokes velocity ∆r UStokes in Tab. 6 for the corresponding domain sizes from the relative electrophoretic velocity deviation ∆r U obtained in the electrophoresis simulation. From the resulting relative deviations ∆r UEP = ∆r U − ∆r UStokes , the inaccuracies due to electric effects in the electrophoresis simulation are assessed. As can be seen from the values of ∆r UEP in Tab. 7, the simulations results agree with the theoretical values with relative deviations of less than 1 %. 7. Conclusion In this article, a coupled multiphysics algorithm for parallel simulations of the electrophoretic motion of geometrically resolved particles in electrolyte solutions is presented. The physical effects are simulated by means of the lattice Boltzmann method for fluid dynamics, a physics engine for rigid body dynamics, and a scalar iterative solver for electric potentials. These components are integrated into the parallel software framework waLBerla to simulate the electrophoretic motion of fully resolved charged particles in 1 www.lrz.de/services/compute/supermuc/ 28 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 29 microfluidic flow. The simulations include fluid-particle and electrostatic particle interactions. Additionally electric effects on ions around the homogeneously charged particles are recovered. The current work is an extension of [31], where the electrical migration of charged particles without ions in the fluid was validated and excellent parallel performance was shown for more than seven millions of interacting charged particles. In the present article, the opposite net charge in the electric double layer (EDL) around the charged particles due to ions in the fluid is considered, together with its effect on the fluid motion that counteracts particle motion. To this end, the electric potential distribution in the fluid due to the EDLs is computed that causes an electric body force on the fluid. This quasi-equilibrium distribution recovers the motion of ions in the fluid along with the charged particles while neglecting EDL distortion. The overall electrophoresis algorithm is introduced and an overview of the coupled functionality implemented in the involved waLBerla modules is given. For the simulations, a solver sweep for time-varying boundary conditions has been developed that is presented here for the parallel SOR method employed to solve the EDL potential equation. Based on the multiphysics boundary handling concept [31] an efficient parallel algorithm is implemented to impose electric potential boundary conditions on the moving particles. These methods can also be employed for other governing equations with spatially varying boundary conditions that model physical effects different from electric fields. The presented parallel electrophoresis simulations are also facilitated by a joint parameterization concept for the different coupled governing equations and numerical methods implemented in waLBerla. This concept is based on lattice Boltzmann requirements and is applicable and extensible to further multiphysics simulations. For the electrophoresis simulations in this article, the electric potential in the double layer is shown to coincide with analytical solutions. The obtained terminal electrophoretic velocities comply with analytical solutions for different proportions of the particle radii to double layer thickness. These validation results verify the correctness of the implementation and the coupling of the different methods. Moreover, the observed relative errors in the modeling of electric effects are below 1 %. The retardation effect caused by the presence of the EDL is shown to be significant for the examined sphere radii, reducing the sphere velocity up to 42 %. For the electrophoretic motion in a micro-channel, the flow field and the electric potential distribution are visualized, including the ion charge distribution in the EDL surrounding the particle. The presented algorithm can be applied to find design parameters in industrial and medical applications, e. g., for optimal separation efficiency of charged biological particles in lab-on-a-chip devices, depending on fluid, particle, and electrolyte properties. Our algorithms were shown to correctly recover fluid-particle interactions for elongated particles in [32]. These future simulations may therefore include suspended, possibly charged particles of various shapes including spheres, spherocylinders, and particles of more complex shapes, e. g., to represent different biological particles. Also pairwise van-der-Waals forces can be added easily, to facilitate simulations of electrophoretic deposition in material science applications. The electrophoresis algorithm introduced here is well suited for massively parallel simulations. In the current implementation of this algorithm, the EDL thickness is restricted to values in the order of the particle radius. Therefore, adaptive lattice refinement as in [23] may be employed to allow for thinner double layers relative to the particle size. For the incorporation of transient effects in the simulations including EDLs, the link-flux method implemented into waLBerla in [115] and [41] may be employed. This method was extended in [41] to simulate electrophoresis, enabling the simulation of non-equilibrium ion distributions in the EDL. Due to the higher computational complexity of the link-flux method compared to the equilibrium approach in this article, the maximum number of particles will be lower than in our approach. Acknowledgements The authors are grateful to the LRZ for providing the computational resources on SuperMUC. References [1] K. J. Ptasinski, P. J. A. M. Kerkhof, Electric Field Driven Separations: Phenomena and Applications, Sep. Sci. Technol. 27 (8-9) (1992) 995–1021. doi:10.1080/01496399208019021. 29 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 30 [2] S. Zhang, R. Tan, K. Neoh, C. Tien, Electrofiltration of Aqueous Suspensions, J. Colloid Interface Sci. 228 (2) (2000) 393–404. doi:10.1006/jcis.2000.6966. [3] Y.-H. Weng, K.-C. Li, L. H. Chaung-Hsieh, C. Huang, Removal of humic substances (HS) from water by electromicrofiltration (EMF), Water Res. 40 (9) (2006) 1783–1794. doi:10.1016/j.watres.2006.02.028. [4] A. Mahmoud, J. Olivier, J. Vaxelaire, A. Hoadley, Electrical field: A historical review of its application and contributions in wastewater sludge dewatering, Water Res. 44 (8) (2010) 2381–2407. doi:10.1016/j.watres.2010.01.033. [5] L. Besra, M. Liu, A review on fundamentals and applications of electrophoretic deposition (EPD), Prog. Mater. Sci. 52 (1) (2007) 1 – 61. doi:10.1016/j.pmatsci.2006.07.001. [6] I. Zhitomirsky, Cathodic electrodeposition of ceramic and organoceramic materials. Fundamental aspects, Adv. Colloid Interface Sci. 97 (1–3) (2002) 279–317. doi:10.1016/S0001-8686(01)00068-9. [7] P. Sarkar, D. De, T. Uchikochi, L. Besra, Electrophoretic Deposition (EPD): Fundamentals and Novel Applications in Fabrication of Advanced Ceramic Microstructures, Springer, 2012, Ch. 5, pp. 181–215. doi:10.1007/978-1-4419-9730-2_ 5. [8] Y. Kang, D. Li, Electrokinetic motion of particles and cells in microchannels, Microfluid Nanofluid. 6 (4) (2009) 431–460. doi:10.1007/s10404-009-0408-7. [9] A. A. S. Bhagat, H. Bow, H. W. Hou, S. J. Tan, J. Han, C. T. Lim, Microfluidics for cell separation, Med. Biol. Eng. Comput. 48 (10) (2010) 999–1014. doi:10.1007/s11517-010-0611-4. [10] D. R. Gossett, W. M. Weaver, A. J. Mach, S. C. Hur, H. T. K. Tse, W. Lee, H. Amini, D. Di Carlo, Label-free cell separation and sorting in microfluidic systems, Anal. Bioanal. Chem. 397 (8) (2010) 3249–3267. doi:10.1007/ s00216-010-3721-9. [11] N. Pamme, Continuous flow separations in microfluidic devices, Lab Chip 7 (2007) 1644–1659. doi:10.1039/B712784G. [12] D. G. Hert, C. P. Fredlake, A. E. Barron, Advantages and limitations of next-generation sequencing technologies: A comparison of electrophoresis and non-electrophoresis methods, Electrophoresis 29 (23) (2008) 4618–4626. doi:10.1002/ elps.200800456. [13] G. W. Slater, C. Holm, M. V. Chubynsky, H. W. de Haan, A. Dube, K. Grass, O. A. Hickey, C. Kingsburry, D. Sean, T. N. Shendruk, L. Zhan, Modeling the separation of macromolecules: A review of current computer simulation methods, Electrophoresis 30 (5) (2009) 792–818. doi:10.1002/elps.200800673. [14] F. Keller, H. Nirschl, W. Dörfler, E. Woldt, Efficient numerical simulation and optimization in electrophoretic deposition processes, J. Eur. Ceram. Soc. 35 (9) (2015) 2619–2630. doi:10.1016/j.jeurceramsoc.2015.02.031. [15] D. Sheehan, Physical Biochemistry: Principles and Applications, John Wiley & Sons, 2013. [16] R. F. Probstein, Physicochemical Hydrodynamics: An Introduction, 2nd Edition, Butterworths series in chemical engineering, Butterworth Publishers, 1989. [17] H. C. Chang, L. Y. Yeo, Electrokinetically Driven Microfluidics and Nanofluidics, Cambridge Univ. Press, 2009. [18] O. Stern, ZUR THEORIE DER ELEKTROLYTISCHEN DOPPELSCHICHT, Z. Elektrochem. 30 (21-22) (1924) 508– 516. doi:10.1002/bbpc.192400182. [19] T. Preclik, U. Rüde, Ultrascale Simulations of non-smooth granular dynamics, Comp. Part. Mech. 2 (2) (2015) 173–196. doi:10.1007/s40571-015-0047-6. [20] K. Iglberger, U. Rüde, Massively Parallel Rigid Body Dynamics Simulation, Comp. Sci. Res. Dev. 23 (3-4) (2009) 159–167. doi:10.1007/s00450-009-0066-8. [21] C. Feichtinger, S. Donath, H. Köstler, J. Götz, U. Rüde, WaLBerla: HPC software design for computational engineering simulations, J. Comput. Sci. 2 (2) (2011) 105–112. doi:10.1016/j.jocs.2011.01.004. [22] C. Godenschwager, F. Schornbaum, M. Bauer, H. Köstler, U. Rüde, A Framework for Hybrid Parallel Flow Simulations with a Trillion Cells in Complex Geometries, in: Proc. Int. Conf. on High Performance Computing, Networking, Storage and Analysis, SC ’13, ACM, 2013, pp. 35:1–35:12. doi:10.1145/2503210.2503273. [23] F. Schornbaum, U. Rüde, Massively Parallel Algorithms for the Lattice Boltzmann Method on NonUniform Grids, SIAM J. Sci. Comput. 38 (2) (2016) C96–C126. arXiv:1508.07982, doi:10.1137/15M1035240. [24] S. Chen, G. D. Doolen, Lattice Boltzmann Method for Fluid Flows, Annu. Rev. Fluid Mech. 30 (1) (1998) 329–364. doi:10.1146/annurev.fluid.30.1.329. [25] C. K. Aidun, J. R. Clausen, Lattice-Boltzmann method for complex flows, Annu. Rev. Fluid Mech. 42 (1) (2010) 439–472. doi:10.1146/annurev-fluid-121108-145519. [26] A. J. C. Ladd, Numerical simulations of particulate suspensions via a discretized Boltzmann equation. Part 1. Theoretical foundation, J. Fluid Mech. 271 (1994) 285–309. doi:10.1017/S0022112094001771. [27] N. Q. Nguyen, A. J. C. Ladd, Lubrication corrections for lattice-Boltzmann simulations of particle suspensions, Phys. Rev. E 66 (4) (2002) 046708. doi:10.1103/PhysRevE.66.046708. [28] J. Götz, K. Iglberger, M. Stürmer, U. Rüde, Direct Numerical Simulation of Particulate Flows on 294912 Processor Cores, in: Proc. 2010 ACM/IEEE Proc. Int. Conf. for High Performance Computing, Networking, Storage and Analysis, SC ’10, IEEE, 2010, pp. 1–11. doi:10.1109/SC.2010.20. [29] I. Ginzburg, J.-P. Carlier, C. Kao, Lattice Boltzmann approach to Richards’ equation, in: W. G. G. C. T. Miller, M. W. Farthing, G. F. Pinder (Eds.), Computational Methods in Water Resources, Vol. 55 of Developments in Water Science, Elsevier, 2004, pp. 583–595. doi:10.1016/S0167-5648(04)80083-2. [30] I. Ginzburg, F. Verhaeghe, D. d’Humières, Two-relaxation-time lattice Boltzmann scheme: About parametrization, velocity, pressure and mixed boundary conditions, Commun. Comput. Phys. 3 (2) (2008) 427–478. [31] D. Bartuschat, U. Rüde, Parallel Multiphysics Simulations of Charged Particles in Microfluidic Flows, J. Comput. Sci. 8 (0) (2015) 1–19. doi:10.1016/j.jocs.2015.02.006. [32] D. Bartuschat, E. Fischermeier, K. Gustavsson, U. Rüde, Two Computational Models for Simulating the Tumbling 30 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 31 Motion of Elongated Particles in Fluids, Comput. Fluids 127 (2016) 17–35. doi:10.1016/j.compfluid.2015.12.010. [33] S. Jomeh, M. Hoorfar, Study of the effect of electric field and electroneutrality on transport of biomolecules in microreactors, Microfluid Nanofluid. 12 (1) (2012) 279–294. doi:10.1007/s10404-011-0871-9. [34] P. Kler, C. Berli, F. Guarnieri, Modeling and high performance simulation of electrophoretic techniques in microfluidic chips, Microfluid Nanofluid. 10 (1) (2011) 187–198. doi:10.1007/s10404-010-0660-x. [35] M. Chau, T. Garcia, P. Spiteri, Asynchronous grid computing for the simulation of the 3D electrophoresis coupled problem, Adv. Eng. Softw. 60–61 (2013) 111–121. doi:10.1016/j.advengsoft.2012.11.010. [36] M. Chau, P. Spiteri, H. C. Boisson, Parallel numerical simulation for the coupled problem of continuous flow electrophoresis, Int. J. Numer. Meth. Fluids 55 (10) (2007) 945–963. doi:10.1002/fld.1502. [37] B. Giera, L. A. Zepeda-Ruiz, A. J. Pascall, J. D. Kuntz, C. M. Spadaccini, T. H. Weisgraber, Mesoscale particle-based model of electrophoresis, J. Electrochem. Soc. 162 (11) (2015) D3030–D3035. doi:10.1149/2.0161511jes. [38] R. G. M. van der Sman, Simulations of confined suspension flow at multiple length scales, Soft Matter 5 (2009) 4376–4387. doi:10.1039/B915749M. [39] J. Smiatek, F. Schmid, Mesoscopic Simulations of Electroosmotic Flow and Electrophoresis in Nanochannels, Comput. Phys. Commun. 182 (9) (2011) 1941 – 1944, computer Physics Communications Special Edition for Conference on Computational Physics Trondheim, Norway, June 23-26, 2010. doi:10.1016/j.cpc.2010.11.021. [40] R. Wang, J.-S. Wang, G.-R. Liu, J. Han, Y.-Z. Chen, Simulation of DNA electrophoresis in systems of large number of solvent particles by coarse-grained hybrid molecular dynamics approach, J. Comput. Chem. 30 (4) (2009) 505–513. doi:10.1002/jcc.21081. [41] M. Kuron, G. Rempfer, F. Schornbaum, M. Bauer, C. Godenschwager, C. Holm, J. de Graaf, Moving charged particles in lattice Boltzmann-based electrokinetics, J. Chem. Phys. 145 (21) (2016) 214102. doi:10.1063/1.4968596. [42] J. S. Park, D. Saintillan, Direct Numerical Simulations of Electrophoretic Deposition of Charged Colloidal Suspensions, in: R. C. A. R. Boccaccini, O. Van der Biest, J. Dickerson (Eds.), Key Engineering Materials, Vol. 507, Trans Tech Publ, 2012, pp. 47–51. doi:10.4028/www.scientific.net/KEM.507.47. [43] J.-P. Hsu, C.-H. Chou, C.-C. Kuo, S. Tseng, R. Wu, Electrophoresis of an arbitrarily oriented toroid in an unbounded electrolyte solution, Colloids Surf., B 82 (2) (2011) 505–512. doi:10.1016/j.colsurfb.2010.10.009. [44] J.-P. Hsu, M.-H. Ku, Boundary effect on electrophoresis: finite cylinder in a cylindrical pore, J. Colloid Interface Sci. 283 (2) (2005) 592–600. doi:10.1016/j.jcis.2004.09.004. [45] J.-P. Hsu, L.-H. Yeh, Electrophoresis of Two Identical Rigid Spheres in a Charged Cylindrical Pore, J. Phys. Chem. B 111 (10) (2007) 2579–2586. doi:10.1021/jp068407z. [46] J. H. Masliyah, S. Bhattacharjee, Electrokinetic and Colloid Transport Phenomena, John Wiley & Sons, Inc., 2006. [47] S. Tseng, C.-H. Huang, J.-P. Hsu, Electrophoresis of two spheres: Influence of double layer and van der Waals interactions, J. Colloid Interface Sci. 451 (2015) 170–176. doi:10.1016/j.jcis.2015.03.060. [48] R. Schmitz, V. Starchenko, B. Dünweg, Computer simulation of electrokinetics in colloidal systems, Eur. Phys. J. Spec. Topics 222 (11) (2013) 2873–2880. doi:10.1140/epjst/e2013-02063-2. [49] M. Baptista, R. Schmitz, B. Dünweg, Simple and robust solver for the Poisson-Boltzmann equation, Phys. Rev. E 80 (2009) 016705. doi:10.1103/PhysRevE.80.016705. [50] H. H. Hu, N. A. Patankar, M. Y. Zhu, Direct Numerical Simulations of Fluid-Solid Systems Using the Arbitrary Lagrangian-Eulerian Technique, J. Comput. Phys. 169 (2) (2001) 427–462. doi:10.1006/jcph.2000.6592. [51] T. J. R. Hughes, W. K. Liu, T. K. Zimmermann, Lagrangian-Eulerian finite element formulation for incompressible viscous flows, Compu. Meth. Appl. Mech. and Engin. 29 (3) (1981) 329–349. doi:10.1016/0045-7825(81)90049-9. [52] C. Ye, D. Li, 3-D transient electrophoretic motion of a spherical particle in a T-shaped rectangular microchannel, J. Colloid Interface Sci. 272 (2) (2004) 480–488. doi:10.1016/j.jcis.2003.11.014. [53] H. Tanaka, T. Araki, Simulation Method of Colloidal Suspensions with Hydrodynamic Interactions: Fluid Particle Dynamics, Phys. Rev. Lett. 85 (2000) 1338–1341. doi:10.1103/PhysRevLett.85.1338. [54] H. Kodama, K. Takeshita, T. Araki, H. Tanaka, Fluid particle dynamics simulation of charged colloidal suspensions, J. Phys. Condens. Matter 16 (10) (2004) L115–L123. doi:10.1088/0953-8984/16/10/L01. [55] T. Araki, H. Tanaka, Physical principle for optimizing electrophoretic separation of charged particles, Europhys. Lett. 82 (1) (2008) 18004. doi:10.1209/0295-5075/82/18004. [56] Y. Nakayama, R. Yamamoto, Simulation method to resolve hydrodynamic interactions in colloidal dispersions, Phys. Rev. E 71 (2005) 036707. doi:10.1103/PhysRevE.71.036707. [57] K. Kim, Y. Nakayama, R. Yamamoto, Direct Numerical Simulations of Electrophoresis of Charged Colloids, Phys. Rev. Lett. 96 (2006) 208302. doi:10.1103/PhysRevLett.96.208302. [58] C. Shih, R. Yamamoto, Dynamic electrophoresis of charged colloids in an oscillating electric field, Phys. Rev. E 89 (2014) 062317. doi:10.1103/PhysRevE.89.062317. [59] X. Luo, A. Beskok, G. E. Karniadakis, Modeling Electrokinetic Flows by the Smoothed Profile Method, J. Comput. Phys. 229 (10) (2010) 3828 – 3847. doi:10.1016/j.jcp.2010.01.030. [60] C. S. Peskin, Flow patterns around heart valves: A numerical method, J. Comput. Phys. 10 (2) (1972) 252–271. doi: 10.1016/0021-9991(72)90065-4. [61] R. Mittal, G. Iaccarino, Immersed boundary methods, Annu. Rev. Fluid Mech. 37 (2005) 239–261. doi:10.1146/annurev. fluid.37.061903.175743. [62] M. Uhlmann, An immersed boundary method with direct forcing for the simulation of particulate flows, J. Comput. Phys. 209 (2) (2005) 448–476. doi:10.1016/j.jcp.2005.03.017. [63] S. Kang, Direct simulations on the electrophoretic motion of multiple charged particles using an immersed boundary method, Comput. Fluids 73 (2013) 10–23. doi:10.1016/j.compfluid.2012.12.005. 31 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 32 [64] V. Lobaskin, B. Dünweg, C. Holm, Electrophoretic mobility of a charged colloidal particle: a computer simulation study, J. Phys. Condens. Matter 16 (38) (2004) S4063–S4073. doi:10.1088/0953-8984/16/38/021. [65] T. Y. Molotilin, V. Lobaskin, O. I. Vinogradova, Electrophoresis of Janus particles: A molecular dynamics simulation study, J. Chem. Phys. 145 (24) (2016) 244704. doi:10.1063/1.4972522. [66] A. Chatterji, J. Horbach, The role of effective charges in the electrophoresis of highly charged colloids, J. Phys. Condens. Matter 22 (49) (2010) 494102. doi:10.1088/0953-8984/22/49/494102. [67] O. A. Hickey, C. Holm, J. Smiatek, Lattice-Boltzmann simulations of the electrophoretic stretching of polyelectrolytes: The importance of hydrodynamic interactions, J. Chem. Phys. 140 (16) (2014) 164904. doi:10.1063/1.4872366. [68] F. Capuani, I. Pagonabarraga, D. Frenkel, Discrete solution of the electrokinetic equations, J. Chem. Phys. 121 (2) (2004) 973–986. doi:10.1063/1.1760739. [69] G. Giupponi, I. Pagonabarraga, Determination of the zeta potential for highly charged colloidal suspensions, Phil. Trans. R. Soc. A: Mathematical, Physical and Engineering Sciences 369 (2011) 2546–2554. doi:10.1098/rsta.2011.0024. [70] G. K. Batchelor, An Introduction to Fluid Dynamics, Cambridge Univ. Press, 1979. [71] M. A. van der Hoef, M. Ye, M. van Sint Annaland, A. T. Andrews, S. Sundaresan, J. A. M. Kuipers, Multi-Scale Modeling of Gas-Fluidized Beds, in: G. B. Marin (Ed.), Computational Fluid Dynamics, Vol. 31 of Advances in Chemical Engineering, Elsevier, 2006, pp. 65–149. doi:10.1016/S0065-2377(06)31002-2. [72] L. D. Landau, E. M. Lifshitz, Fluid Mechanics, Second Edition: Volume 6 (Course of Theoretical Physics), 2nd Edition, Vol. 6 of Course of theoretical physics / by L. D. Landau and E. M. Lifshitz, Vol. 6, Butterworth-Heinemann, 1987. [73] P. J. Dellar, Bulk and shear viscosities in lattice Boltzmann equations, Phys. Rev. E 64 (3) (2001) 031203. doi: 10.1103/PhysRevE.64.031203. [74] J. Happel, H. Brenner, Low Reynolds number hydrodynamics: with special applications to particulate media, Vol. 1, Springer, 1983. [75] F. Durst, Grundlagen Der Strömungsmechanik, Springer, 2006. [76] D. Bartuschat, Direct Numerical Simulation of Particle-Laden Electrokinetic Flows on High Performance Computers, Ph.D. thesis, University of Erlangen-Nürnberg (2016). URL https://opus4.kobv.de/opus4-fau/frontdoor/index/index/docId/7298 [77] J. Anderson, Computational Fluid Dynamics, Computational Fluid Dynamics: The Basics with Applications, McGrawHill Education, 1995. [78] G. G. Stokes, On the effect of the internal friction of fluids on the motion of pendulums, Vol. 9, Pitt Press, 1851. [79] J. Happel, E. Bart, The settling of a sphere along the axis of a long square duct at low Reynolds’ number, Appl. Sci. Res. 29 (1) (1974) 241–258. doi:10.1007/BF00384149. [80] A. Miyamura, S. Iwasaki, T. Ishii, Experimental wall correction factors of single solid spheres in triangular and square cylinders, and parallel plates, Int. J. Multiph. Flow 7 (1) (1981) 41–46. doi:10.1016/0301-9322(81)90013-6. [81] R. J. Hunter, Zeta Potential in Colloid Science: Principles and Applications, Academic Press, London, 1981. [82] P. Debye, E. Hückel, Zur Theorie der Elektrolyte. I. Gefrierpunktserniedrigung und verwandte Erscheinungen, Phys. Z 24 (9) (1923) 185–206. [83] D. C. Henry, The cataphoresis of suspended particles. Part I. The equation of cataphoresis, Proc. R. Soc. Lond. A 133 (821) (1931) 106–129. doi:10.1098/rspa.1931.0133. [84] H. Ohshima, A Simple Expression for Henry’s Function for the Retardation Effect in Electrophoresis of Spherical Colloidal Particles, J. Colloid Interface Sci. 168 (1) (1994) 269–271. doi:10.1006/jcis.1994.1419. [85] H. Ohshima (Ed.), Theory of Colloid and Interfacial Electric Phenomena, Vol. 12 of Interface Science and Technology, Elsevier, 2006. doi:10.1016/S1573-4285(06)80022-0. [86] D. J. Shaw, Introduction to Colloid and Surface Chemistry, 4th Edition, Butterworth-Heinemann, 1992. [87] H. Ohshima, T. W. Healy, L. R. White, Accurate analytic expressions for the surface charge density/surface potential relationship and double-layer potential distribution for a spherical colloidal particle, J. Colloid Interface Sci. 90 (1) (1982) 17–26. doi:10.1016/0021-9797(82)90393-9. [88] A. L. Loeb, J. T. G. Overbeek, P. H. Wiersema, The Electrical Double Layer Around a Spherical Colloid Particle, J. Electrochem. Soc. 108 (12) (1961) 269C. doi:10.1149/1.2427992. [89] D. Hänel, Molekulare Gasdynamik, Springer, 2004. [90] S. Chapman, T. G. Cowling, The Mathematical Theory of Non-Uniform Gases, 3rd Edition, Cambridge Univ. Press, 1990. [91] D. A. Wolf-Gladrow, Lattice-Gas Cellular Automata and Lattice Boltzmann Models: An Introduction, no. 1725 in Lattice-gas Cellular Automata and Lattice Boltzmann Models: An Introduction, Springer, 2000. [92] D. d’Humières, Generalized lattice-Boltzmann equations, in: Rarefied Gas Dynamics: Theory and Simulations, Vol. 159 of Prog. Astronaut. Aeronaut., AIAA, 1992, pp. 450–458. doi:10.2514/5.9781600866319.0450.0458. [93] X. He, L.-S. Luo, Lattice Boltzmann Model for the Incompressible Navier-Stokes Equation, J. Stat. Phys. 88 (3) (1997) 927–944. doi:10.1023/B:JOSS.0000015179.12689.e4. [94] Y. H. Qian, D. d’Humières, P. Lallemand, Lattice BGK Models for Navier-Stokes Equation, Europhys. Lett. 17 (6) (1992) 479. doi:10.1209/0295-5075/17/6/001. [95] J. D. Sterling, S. Chen, Stability Analysis of Lattice Boltzmann Methods, J. Comput. Phys. 123 (1) (1996) 196–206. doi:10.1006/jcph.1996.0016. [96] L.-S. Luo, W. Liao, X. Chen, Y. Peng, W. Zhang, Numerics of the lattice Boltzmann method: Effects of collision models on the lattice Boltzmann simulations, Phys. Rev. E 83 (5) (2011) 056710. doi:10.1103/PhysRevE.83.056710. [97] P. L. Bhatnagar, E. P. Gross, M. Krook, A Model for Collision Processes in Gases. I. Small Amplitude Processes in Charged and Neutral One-Component Systems, Phys. Rev. 94 (3) (1954) 511–525. doi:10.1103/PhysRev.94.511. 32 D. Bartuschat and U. Rüde / Journal of Computational Physics 00 (2017) 1–33 33 [98] M. Geier, M. Schönherr, A. Pasquali, M. Krafczyk, The cumulant lattice Boltzmann equation in three dimensions: Theory and validation, Comput. Math. Appl. 70 (4) (2015) 507–547. doi:10.1016/j.camwa.2015.05.001. [99] F. J. Higuera, S. Succi, R. Benzi, Lattice Gas Dynamics with Enhanced Collisions, Europhys. Lett. 9 (4) (1989) 345. doi:10.1209/0295-5075/9/4/008. [100] I. Ginzburg, F. Verhaeghe, D. d’Humières, Study of Simple Hydrodynamic Solutions with the Two-Relaxation-Times Lattice Boltzmann Scheme, Commun. Comput. Phys. 3 (3) (2008) 519–581. [101] L.-S. Luo, Analytic Solutions of Linearized Lattice Boltzmann Equation for Simple Flows, J. Stat. Phys. 88 (3/4) (1997) 913–926. doi:10.1023/B:JOSS.0000015178.19008.78. [102] A. J. C. Ladd, R. Verberg, Lattice-Boltzmann Simulations of Particle-Fluid Suspensions, J. Stat. Phys. 104 (5) (2001) 1191–1251. doi:10.1023/A:1010414013942. [103] Z. Guo, C. Zheng, B. Shi, Discrete lattice effects on the forcing term in the lattice Boltzmann method, Phys. Rev. E 65 (4) (2002) 046308. doi:10.1103/PhysRevE.65.046308. [104] C. Rettinger, U. Rüde, A comparative study of fluid-particle coupling methods for fully resolved lattice Boltzmann simulations, Comput. Fluids 154 (2017) 74–89. doi:10.1016/j.compfluid.2017.05.033. [105] E. Fattahi, C. Waluga, B. Wohlmuth, U. Rüde, M. Manhart, R. Helmig, Lattice Boltzmann methods in porous media simulations: From laminar to turbulent flow, Comput. Fluids 140 (2016) 247 – 259. doi:10.1016/j.compfluid.2016. 10.007. [106] S. Bogner, S. Mohanty, U. Rüde, Drag correlation for dilute and moderately dense fluid-particle systems using the lattice Boltzmann method, Int. J. Multiph. Flow 68 (2015) 71–79. doi:10.1016/j.ijmultiphaseflow.2014.10.001. [107] P. Wesseling, Introduction To Multigrid Methods, R. T. Edwards, 2004. [108] P. Knabner, L. Angermann, Numerical Methods for Elliptic and Parabolic Partial Differential Equations, Texts in Applied Mathematics, Springer, 2003. [109] B. I. des Poids et Mesures, The International System of Units (SI), 8th Edition, BIPM, 2006 [cited Oct. 2015]. URL http://www.bipm.org/en/publications/si-brochure/ [110] I. 80000-1:2009, Quantities and units – Part 1: General, ISO/IEC, 2009 [cited Oct. 2015]. URL https://www.iso.org/obp/ui/#iso:std:30669:en [111] S. Donath, Wetting Models for a Parallel High-Performance Free Surface Lattice Boltzmann Method, Ph.D. thesis, University of Erlangen-Nürnberg (2011). URL http://www.dr.hut-verlag.de/978-3-8439-0066-9.html [112] D. Bartuschat, D. Ritter, U. Rüde, Parallel multigrid for electrokinetic simulation in particle-fluid flows, in: High Performance Computing and Simulation (HPCS). Madrid 2012, IEEE, 2012, pp. 374–380. doi:10.1109/HPCSim.2012. 6266940. [113] R. Ramadugu, S. P. Thampi, R. Adhikari, S. Succi, S. Ansumali, Lattice differential operators for computational physics, Europhys. Lett. 101 (5) (2013) 50006. doi:10.1209/0295-5075/101/50006. [114] K. Iglberger, Software design of a massively parallel rigid body framework, Ph.D. thesis, University of Erlangen-Nürnberg (2010). URL http://www.dr.hut-verlag.de/978-3-86853-736-9.html [115] L. Hufnagel, Transient simulation of electric double layers in electrokinetic flows with a coupled lattice Boltzmann Link-Flux method, Bachelor thesis, Lehrstuhl für Informatik 10 (Systemsimulation), Universität Erlangen-Nürnberg (November 2014). 33
5cs.CE
HIGH EFFICIENCY COMPRESSION FOR OBJECT DETECTION Hyomin Choi and Ivan V. Bajić School of Engineering Science, Simon Fraser University, Burnaby, BC, Canada arXiv:1710.11151v2 [eess.IV] 16 Feb 2018 ABSTRACT Image and video compression has traditionally been tailored to human vision. However, modern applications such as visual analytics and surveillance rely on computers “seeing” and analyzing the images before (or instead of) humans. For these applications, it is important to adjust compression to computer vision. In this paper we present a bit allocation and rate control strategy that is tailored to object detection. Using the initial convolutional layers of a state-of-the-art object detector, we create an importance map that can guide bit allocation to areas that are important for object detection. The proposed method enables bit rate savings of 7% or more compared to default HEVC, at the equivalent object detection rate. Index Terms— Bit allocation, rate control, HEVC, object detection, YOLO 1. INTRODUCTION Human perceptual quality has always been among the main guiding principles of image and video compression. This influence can be seen throughout the history of development of image and video codecs: from perceptually-optimized quantization matrices in JPEG [1] to the perceptual rate control [2, 3] for High Efficiency Video Coding (HEVC) [4]. However, modern multimedia applications do not have humans as the only users. In many cases, for example surveillance and visual analytics, computers must “see” and examine images or video before humans do. Often, the first step of computer vision would be to detect objects, after which higher-level analytics such as activity recognition or anomaly detection can be performed. Despite its importance for these applications, image and video coding tailored to computer (as opposed to human) vision has been largely unexplored. Among the few studies to tackle this topic is gradient-preserving quantization [5], which attempts to adjust quantiztion in image compression in order to preserve gradient information. The motivation is that gradients are useful features in a number of computer vision problems, so well-preserved gradients will likely improve the accuracy of the vision pipeline. Another recent work [6] develops a rate control scheme for H.264/AVC video coding that preserves SIFT [7] and SURF [8] features, which have also been found useful in many computer vision problems. These studies ([5, 6]) have proposed ways to preserve well-known handcrafted features through the compression process, without focusing on any particular problem. However, the recent trend in computer vision has been away from handcrafted features and towards learnt features, especially the features learnt by deep neural networks (DNNs) [9] for specific problems. In this paper we develop a bit allocation and rate control method that improves object detection of a DNN-based stateof-the-art object detector called YOLO9000 [10]. We utilize the outputs of the initial convolutional layers of this detector to create the importance map, which is used to guide bit allocation towards regions that are important for object detection. The resulting strategy offers significant bit savings of 7% or more compared to the default HEVC at the equivalent object detection rate. For the same bitrate, the proposed strategy offers more accurate object detection and classification compared to the default HEVC. The paper is organized as follows. Section 2 describes the creation of object importance maps from the outputs of convolutional layers, and presents the related bit allocation and rate control strategies. Section 3 presents the experimental results and Section 4 concludes the paper. 2. PROPOSED METHODS 2.1. Background In a convolutional neural network, convolutional layers compute cross-correlation between the input and a set of filters [9]. The cross-correlation is usually followed by maxpooling, which selects the local maximum within each small window of the cross-correlation output. Large values therefore tend to propagate through the network towards the final layers, where they contribute to the final output. It is important to appreciate that filter coefficients are computed during the training process to maximize the performance on a given task. Hence, DNN-based object detectors have filters whose coefficients have been tuned to extract the features relevant to detecting the objects that the network was trained on. And because max-pooling suppresses small outputs, it follows that large outputs are the ones that are relevant for detection. The input size of the YOLO9000 object detector [10] is fixed at 416 × 416. If an input image has different resolution, say W ×H, the image resolution is first scaled (while keeping Fig. 2. The proposed object detection-friendly compression framework (a) (b) (c) Fig. 1. Examples of (a) test images and outputs of selected filters in the (b) first and (c) third convolutional layers where l indicates the layer, x and y are spatial coordinates, and n is the filter index in the given layer. Then, all clamped outputs are stacked in a tensor h i (1) (1) (2) (2) (N ) (N ) vl (x, y) = αl ψ̂l (x, y) , αl ψ̂l (x, y) , . . . , αl ψ̂l (x, y) the aspect ratio) and centered so that it fits the input. The scaling constants for various layers are Sl = Cl /max{W, H}, where Cl is the spatial dimension of layer l, so C1 = 416, C2 = 208, etc. The first convolutional layer employs 32 filters with kernel size 3 × 3, and produces 32 outputs. This is followed by max-pooling over 2 × 2 windows. The subsequent convolutional layers operate on the previous layer’s outputs. There are total 32 layers in the YOLO9000 architecture. Fig. 1 shows several input images, and the corresponding outputs of several filters in the first and third convolutional layer. The brighter pixels in the output indicate the higher correlation with the associated filter. As seen in this figure, even the early layers in the convolutional network are able to provide some information about the objects, although precise object location and class is not available until upper layers of the network complete their processing. Based on this reasoning, we propose an object detectionfriendly compression framework shown in Fig. 2. The input image is processed by the initial convolutional layers of the object detector. The filters in each layer can run in parallel, so this process is highly parallelizable. From the resulting filter outputs, we construct an object importance map, which guides bit allocation and rate control in HEVC. The resulting image turns out to be more object detection-friendly, as demonstrated in Section 2.2. 2.2. Object importance map The object importance map is meant to indicate how important is each pixel to object detection. The YOLO9000 architecture employs leaky activation, which means that layer outputs can be negative. We first clamp the outputs to the range [0, 1] as (n) ψ̂l n n oo (n) (x, y) = max 0, min 1, ψl (x, y) (1) (2) (n) where αl is a weight factor for the n-th filter in layer l. The weights are meant to indicate how informative is a particular filter’s output for a given input image. Ideally, the filter’s output would be high near the objects of interest and low elsewhere. As seen in Fig. 1, filters’ outputs are not equally informative about the objects in the image. Moreover, a certain filter may be very informative on one image, and not very informative on another image, which means that weights should be adapted from image to image. We experimented with entropy of the filter output as a guide to set weights (lower entropy inducing higher weight), but eventually settled for a simpler approach that gave slightly better results. In particular, we set the weight as 1 minus the average clamped output: (n) αl =1− H l −1 W l −1 X X 1 (n) ψ̂ (x, y) Wl · Hl y=0 x=0 l (3) where Wl = W/Sl and Hl = H/Sl are the width and height of the filter’s output on the particular image at level l. When the filter produces high responses across the entire image (i.e., it is not very informative), the average is high, so its weight becomes low. If the filter’s output is low on average, its weight becomes high. Therefore, vl (x, y) in Eq. (2) will be high only when the filter is informative (high weight) and has a high response at the particular (x, y). Finally, we take the `2 norm of vl (x, y), Ol (x, y) = kvl (x, y)k2 , and then normalize Ol (x, y) by linearly mapping it to the range [0, 1] to produce the final importance map Õl (x, y). Figure 3 shows several importance maps generated from the first and third layer on different images. 2.3. Bit allocation and rate control The proposed bit allocation makes use of the object importance map Õl (x, y) to decide how to spend bits. importance of that block IF (i, j) w (i, j) = P P IF (i, j) (6) where again the double summation is over all valid (i, j). Then the total target bits for the block can be computed as Blk Tbits (a) (b) Fig. 3. The object importance maps combined using the outputs of the (a) first and (b) third layer  (i, j) = Lbits (i, j) + Lblk (i,j)(Lbits (i,j)−LEst bits (i,j)) SW  w(i, j) (7) where Lbits (i, j) are the remaining bits in the bit budget before coding block (i, j), Lblk (i, j) is the number of remaining blocks to be coded, including (i, j), and SW is the sliding window size used to smooth out the bit variation (we use the default SW = 4 from the HM16.12 [13]). LEst bits (i, j) is an estimate of the bits that will actually be used for coding the block (i, j) and all subsequent blocks, computed as XX LEst bppp (u, v) · Npixels (u, v) (8) bits (i, j) = u≥i v≥j First, the pixel-wise importance Õl (x, y) is converted into block-wise importance I(i, j). The size of the block is the size of the corresponding coding unit scaled by Sl . Then I(i, j) is computed by summing Õl (x, y) within the corresponding block and dividing by the total sum over the importance map. From here on, we use (i, j) as the coordinates of the top-left corner of the block. We then calculate the initial coarse estimates of the bits per pixel (bppcoarse ) for each block as bppcoarse (i, j) = 1 Npixels (i, j) · I (i, j) · Tbits 3. EXPERIMENTS (4) where Npixels (i, j) is the number of pixels in the block whose top-left corner is at (i, j) and Tbits represents the number of target bits for the image to be coded. In Eq. (4), the calculated bppcoarse (i, j) could possibly be zero, which turns out to be harmful in subsequent encoding. In order to refine this coarse estimate, we run the R-λ model [11, 12], which is default rate control model in the HEVC reference software [13]. Specifically, by inputting Tbits and bppcoarse (i, j) into the R-λ model, we compute the slice/picture-level QPs and the block-level preliminary quantization parameter QPp (i, j). Note that QPp (i, j) is bounded by QPs ± 2 by default, however we extend the range to QPs ± 3. Then, the preliminary bits per pixel bppp (i, j) is computed by inverting the R-λ model with QPp (i, j) as the input. Finally, QPp (i, j) is incremented by 1 if I (i, j) = 0. The final block importance is computed as bppp (i, j) IF (i, j) = P P bppp (i, j) where the summations are starting at (i, j) and going over all subsequent valid block indices (u, v). Finally, we estimate the actual QP values QPa by inBlk putting Tbits (i, j)/Npixels (i, j) to the R-λ model. The resulting QPa is bounded by QPs ± 2 by default. However, we shift the bound upward as [QPs , QPs + 4] if QPp ≥ QPs + 3. This has the potential to save bits in less important regions. (5) where the double summation is over all valid (i, j). Using this, we compute the weight for each block as the normalized In this section, we assess the performance of the proposed bit allocation and rate control scheme in terms of its effect on object detection. The proposed methods were implemented in HEVC reference software HM16.12 [13]. The YOLO9000 model in the Darknet framework [14] is used for the object detection performance evaluation. Bjøntegaard Delta (BD) [15] is a standard measurement method for evaluating compression performance. It compares the average bit rates of two coding methods at the equivalent quality metric. Usually, the quality metric is Peak Signal-toNoise Ratio (PSNR) and we refer to this measurement as BD bitrate for PSNR (BD-BR-PSNR). However, it is also possible to use quality metrics other than PSNR in the BD analysis. Specifically, since our goal is to compare object detection performance between methods, instead of PSNR we use the standard object detection accuracy metric called mean Average Precision (mAP) [16]. The mAP is in the range [0, 1]. By computing BD over rate vs. mAP curves, we can obtain the average bit rate saving (or increment) that one compression method would have over another at the equivalent mAP. We call this metric BD bitrate for mAP (BD-BR-mAP). For testing, we employ the widely used PASCAL VOC 2007 dataset [16], which has 9963 images out of which 4952 HM (QP=22) HM-RC Proposed HM (QP=22) HM-RC Proposed Increasing correct detections Decreasing false detections Increasing correct detections Alternative object class Fig. 4. Examples illustrating different object detection/classification produced by YOLO9000 on images encoded by HM with QP=22, HM-RC at the same bitrate, and the proposed method at the same bitrate, with importance maps computed from the third convolutional layer. are test images. The images are annotated with 20 different object classes, such as aeroplane, bicycle, bird, and so on. For encoding, 16×16 CTU is adopted and RDOQ tool is off, but other coding parameters follow the common HEVC test conditions [17] of the Main Still Picture Profile [18]. We first encode each test image using the default HM with QP∈ {22, 27, 32, 37}. The resulting bits are used as target bits for the default HM rate control (HM-RC) and our proposed method. For the proposed method we construct the importance maps from the outputs of the first, third, and seventh layer, in order to examine the behaviour of the system with different importance maps. maps can successfully guide bit allocation towards regions that are most relevant for object detection. Fig. 4 shows a few examples where YOLO9000 produces different detections on the images encoded by HM, HM-RC, and proposed methods. Although the images look very similar visually, detection on images encoded by the proposed method is the most accurate. This again illustrates that importance maps successfully guide bit allocation towards regions that are most relevant for object detection. All encoded images are then decoded and fed to the YOLO9000 object detector. mAP is computed by comparing detector’s output with the ground truth. Table 1 shows various comparisons among the three tested codecs: HM, HM-RC and proposed. For the rate control accuracy, ∆bpp is the mean absolute difference (MAD) in bits per pixel (bpp) between the output bits of HM and the two rate control methods (HM-RC and proposed) across all images. HM-RC shows averaged ∆bpp = 0.0483, while our rate control gave smaller deviation in each of the three cases, with importance map computed from the seventh layer being the most accurate. In terms of BD-BR-PSNR, both HM-RC and our proposed method have lower performance (positive BD-BR-PSNR) compared to the default HM, since they both deviate from the optimal ratedistortion allocation in order to achieve different objectives. However, our method achieves significant advantage in BDBR-mAP over both HM and HM-RC, which was the main design objective. In particular, with the importance map computed from the output of the third convolutional layer, 7.32% bit reduction is achieved over HM, and 8.23% reduction over HM-RC, at an equivalent mAP. This shows that importance We proposed a novel bit allocation and rate control strategy whose goal was to improve object detection after decoding. Using the outputs of the initial convolutional layers of a stateof-the-art object detector, the proposed algorithm successfully achieved efficient bit control and improved object detection performance over the default HEVC implementations. The proposed strategy can be used in many applications where computers “see” and analyze the data before (or instead of) humans. 4. CONCLUSION Table 1. Performance comparison among HM, HM-RC, and proposed method Test cases ∆bpp σbpp BD-BR-PSNR BD-BR-mAP HM vs. HM-RC HM vs. Ours w/ 1st L. HM vs. Ours w/ 3rd L. HM vs. Ours w/ 7th L. HM-RC vs. Ours w/ 1st L. HM-RC vs. Ours w/ 3rd L. HM-RC vs. Ours w/ 7th L. 0.0483 0.0385 0.0372 0.0232 - 0.1187 0.1113 0.1094 0.1086 - 3.08% 7.10% 7.15% 6.96% 3.82% 3.87% 3.68% 1.67% -3.90% -7.32% -6.33% -5.31% -8.23% -7.10% 5. REFERENCES [1] ITU-T Rec. T.81 and ISO/IEC 10918-1, “Information technology - digital compression and coding of continuous-tone still images,” 1992. [2] H. Zeng, K. N. Ngan, and M. Wang, “Perceptual adaptive lagrangian multiplier for high efficiency video coding,” in Picture Coding Symposium, Dec. 2013. [3] A. Yang, H. Zeng, L. Ma, J. Chen, C. Cai, and K.-K. Ma, “A perceptual-based rate control for HEVC,” in 6th Int. Conf. Image Processing Theory Tools and Applications, Dec. 2016. [4] G. J. Sullivan, J.-R. Ohm, W.-J. Han, and T. Wiegand, “Overview of the high efficiency video coding (HEVC) standard,” IEEE Trans. Circuits Syst. Video Technol., vol. 22, pp. 1649–1668, Dec. 2012. [5] M. Makar, H. Lakshman, V. Chandrasekhar, and B. Girod, “Gradient preserving quantization,” in Proc. IEEE ICIP’12, Sep. 2012, pp. 2505–2508. [6] J. Chao, R. Huitl, E. Steinbach, and D. Schroeder, “A novel rate control framework for SIFT/SURF feature preservation in H.264/AVC video compression,” IEEE Trans. Circuits Syst. Video Technol., vol. 25, no. 6, pp. 958–972, Jun. 2015. [7] D. Lowe, “Distinctive image feature from scaleinvariant keypoints,” Int. J. Computer Vision, vol. 60, no. 2, pp. 91–110, Nov. 2004. [8] H. Bay, T. Tuytelaars, and L. V. Gool, “Surf: Speeded up robust features,” in Proc. European Conf. Computer Vision, May. 2006, pp. 404–417. [9] Ian Goodfellow, Yoshua Bengio, and Aaron Courville, Deep Learning, MIT Press, 2016. [10] J. Redmon and A. Farhadi, “YOLO9000: better, faster, stronger,” in IEEE Conf. Computer Vision and Pattern Recognition, Jul. 2017. [11] B. Li, H. Li, L. Li, and J. Zhang, “λ domain rate control algorithm for high efficiency video coding,” IEEE Trans. Image Processing, vol. 23, no. 9, pp. 3841–3854, Sep. 2014. [12] B. Li, J. Xu, D. Zhang, and H. Li, “QP refinement according to Lagrange multiplier for high efficiency video coding,” in Proc. IEEE Int. Symp. Circuits Syst., May 2013, pp. 477–480. [13] “HEVC reference software (HM 16.12),” https://hevc.hhi.fraunhofer.de/trac/ hevc/browser/tags/HM-16.12, Accessed: 2017-05-27. [14] J. Redmon, “Darknet: Open source neural networks in C.,” http://pjreddie.com/darknet/, 20132017, Accessed: 2017-10-19. [15] G. Bjøntegaard, “VCEG-M33: Calculation of average PSNR differences between RD curves,” in Video Coding Experts Group (VCEG), Apr. 2001. [16] M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman, “The PASCAL Visual Object Classes Challenge 2007 (VOC2007) Results,” http://www.pascalnetwork.org/challenges/VOC/voc2007/workshop/index.html. [17] F. Bossen, “Common HM test conditions and software reference configurations,” in ISO/IEC JTC1/SC29 WG11 m28412, JCTVC-L1100, Jan. 2013. [18] T. Nguyen and D. Marpe, “Objective performance evaluation of the HEVC Main Still Picture profile,” IEEE Trans. Circuits Syst. Video Technol., vol. 25, no. 5, May 2015.
1cs.CV
arXiv:1803.02604v1 [math.GR] 7 Mar 2018 On certain semigroups of partial contractions of a finite chain Abdullahi Umar and M. M. Zubairu ∗ Department of Mathematics, The Petroleum Institute, Sas Nakhl, Khalifa University of Science and Technology, P. O. Box 2533 Abu Dhabi, UAE [email protected] Department of Mathematics, Bayero University Kano, P. M. B. 3011 Kano Nigeria [email protected] March 8, 2018 Abstract Let [n] = {1, 2, . . . , n} be a finite chain and let Pn be the semigroup of partial transformations on [n]. Let CP n = {α ∈ Pn : (f or all x, y ∈ Dom α) |xα − yα| ≤ |x − y|} be the subsemigroup of partial contraction mappings on [n]. We have shown that the semigroup CP n and some of its subsemigroups are nonregular left abundant semigroups for all n but not right abundant for n ≥ 4. 2010 Mathematics Subject Classification. 20M20. 1 Introduction and Preliminaries Let [n] = {1, 2, . . . , n} be a finite chain, a map α which has domain and image both subsets of [n] is said to be a transformation. A transformation α whose domain is a subset of [n] (i. e., Dom α ⊆ [n]) is said to be partial. The collection of all partial transformations of [n] is known as semigroup of partial transformations, usually denoted by Pn . A map α ∈ Pn is said to be order preserving (resp., order reversing) if (for all x, y ∈ Dom α) x ≤ y implies xα ≤ yα (resp. xα ≥ yα); is order decreasing if (for all x ∈ Dom α) xα ≤ x; an isometry (i. e., distance preserving) if (for all x, y ∈ Dom α) |xα−yα| = |x−y|; a contraction if (for all x, y ∈ Dom α) |xα − yα| ≤ |x − y|. Let CP n = {α ∈ Pn : (f or all x, y ∈ Dom α) |xα − yα| ≤ |x − y|} and OCP n = {α ∈ CP n : ∗ Corresponding Author. Email: [email protected] 1 (f or all x, y ∈ Dom α) x ≤ y implies xα ≤ yα} be the subsemigroups of partial contractions and of order preserving partial contractions of [n], respectively. Further, the collection of all order preserving or order reversing partial contractions denoted by ORCP n is a subsemigroup of ORP n (where ORP n denotes the semigroup of order preserving or order reversing partial transformations of [n]). In 2013, Zhao and Yang [23] characterized the Green’s relations on the subsemigroup OCP n of CP n (OCP n is the semigroup of order preserving partial contractions on [n]). Recently, Ali et al. [2] obtained a necessary and sufficient condition for an element in CP n to be regular and also described all its Green’s equivalences. Most of the results concerning regularity and Green’s relations for some subsemigroups of CP n can be deduced from the results obtained in that paper. Zhao and Yang [23] have shown that the semigroup OCP n (n > 2) is nonregular. Similarly, Ali et al. [2] have shown that the semigroups CP n and ORCP n are nonregular for n > 2. Thus, there is a need to identify the class of semigroups to which they belong, for example, whether they are abundant semigroups. Therefore, this paper is a natural sequel to Ali et al. [2]. This section includes a brief introduction giving some basic definitions and introducing some new concepts. In section 2, we characterize all the starred Green’s relations on the semigroups CP n , ORCP n and OCP n and show that D∗ = J ∗ [5]. In section 3, we show that the collection of all strongly regular elements of ORCP n is a subsemigroup and in section 4, we show that the semigroups CP n , ORCP n and OCP n are left abundant for all n but not right abundant for n ≥ 4. For standard concepts in semigroup theory, we refer the reader to Howie [12] and Higgins [11]. Let α be element of CP n . Let Dom α, Im α, h (α) and F (α) denote, the domain of α, image of α, | Im α| and {x ∈ Dom α : xα = x} (i. e., the set of fixed points of α), respectively. For α, β ∈ CP n , the composition of α and β is defined as x(α ◦ β) = ((x)α)β for any x in Dom α. Without ambiguity, we shall be using the notation αβ to denote α ◦ β. Next, given any transformation α in ORCP n , the domain of α is partitioned into p − blocks by the relation ker α = {(x, y) ∈ [n] × [n] : xα = yα} and so as in [13], α can be expressed as   A1 A2 . . . Ap ∈ Pn (1 ≤ p ≤ n), (1) α= x1 x2 . . . xp where, Ai (1 ≤ i ≤ p) are equivalence classes under the relation ker α, i. e., Ai = xi α−1 (1 ≤ i ≤ p) and further Ker α is ordered under the usual ordering, i. e., Ker α = {A1 < A2 < . . . < Ap }. Thus for the rest of the content of the paper we shall consider α to be as expressed in (1) unless otherwise specified. Now, let Ker α = (Ai )i∈[p] = {A1 , A2 , . . . , Ap } be the partition of Dom α. A subset Tα of [n] is said to be a transversal of the partition Ker α if |Ai ∩Tα | = 1 (1 ≤ i ≤ p). A transversal Tα is said to be relatively convex if for all x, y ∈ Tα with x ≤ y and if x ≤ z ≤ y (z ∈ Dom α), then z ∈ Tα . Notice that every convex 2 transversal is necessarily relatively convex but not vice-versa. A transversal Tα is said to be admissible if and only if the map Ai 7→ ti (ti ∈ Tα , i ∈ {1, 2, . . . , p}) is a contraction, see [2]. Notice that every convex transversal is admissible but not vice-versa. Let S be a semigroup and A be a subset of S, hAi denotes the semigroup generated by A and is a subsemigroup of S. If hAi = S then A is said to generate S and also hAi = A if and only if A is a subsemigroup of S. An element a in a semigroup S is said to be an idempotent if and only if a2 = a. As usual E(S) denotes the set of all idempotents in S. It is well known that an element α in Pn is idempotent if and only if Im α = F (α). (Equivalently, α is idempotent if and only if xi ∈ Ai for 1 ≤ i ≤ p, that is to say the blocks in Ker α are stationary.) Next, we quote some basic lemmas from [2] which would be useful for some of the subsequent results. Lemma 1.1 ([2], Lemma 1.3). For n ≥ 4, let α ∈ CP n such that there exists k ∈ {2, . . . , p − 1} (3 ≤ p ≤ n) with |Ak | ≥ 2. If Ai < Aj (i < j) for all i, j ∈ {1, 2, . . . , p} then the partition Ker α = {A1 , A2 , . . . , Ap } of Dom α has no relatively convex transversal. Corollary 1.2 ([2], Lemma 1.4). For n ≥ 4, let α ∈ ORCP n such that there exists k ∈ {2, . . . , p − 1} (p ≥ 3) with |Ak | ≥ 2. Then the partition Ker α = {A1 , A2 , . . . , Ap } of Dom α has no relatively convex transversal. Lemma 1.3 ([2], Lemma 1.5). Let α ∈ CP n such that Ai < Aj for all i < j in {1, 2, . . . , p} (p ≥ 3). If |Ai | = 1 for all 2 ≤ i ≤ p − 1 then the partition Ker α of Dom α has an admissible transversal Tα . Lemma 1.4 ([2] Lemma 1.8). Let α ∈ CP n and let A be a convex subset of Dom α. Then Aα is convex. Lemma 1.5 ([2], Corollary 4.2). Let α ∈ ORCP n . If | Im α| ≥ 3, then α is regular if and only if either min Ap − xp = max A1 − x1 = d and Ai = {xi + d} or min Ap − x1 = max A1 − xp = d and Ai = {xp−i+1 + d}, for i = 2, . . . , p − 1. Equivalently, if Tα is admissible then α is regular if and only if α|Tα is an isometry. 2 Starred Green’s relations Let S be a semigroup. A relation L∗ defined as (∀ a, b ∈ S) aL∗ b if and only if a, b are related by the Green’s L∗ relation in some oversemigroup of S, is known as the starred Green’s L relation. The relation R∗ is defined dually, while the relation D∗ is defined as the join of the relations L∗ and R∗ . The intersection of L∗ and R∗ is denoted by H∗ . A semigroup S is said to be left abundant (resp., right abundant ) if each L∗ −class (resp., R∗ −class) contains an idempotent, it is called abundant if each L∗ −class and R∗ −class of S contains an idempotent. An abundant semigroup in which the set E(S), of idempotents 3 of S is a subsemigroup of S is called quasi adequate and if E(S) is commutative then S is called adequate [4, 5]. Many nonregular classes of transformation semigroups were shown to be either abundant or adequate, for example see [18, 19, 20, 21, 15, 16, 22, 14]. Recently, AlKharousi et al. have shown that the semigroup OCI n , of all order preserving one to one contraction maps of a finite chain is adequate [3]. In this section we are going to show that the semigroups CP n , OCP n , CT n and OCT n are all left abundant (for all n) but not right abundant for n ≥ 4. We shall use the following notation from ([12], Chapter 2). If U is a subsemigroup of a semigroup S then aLU b means that there exist u, v ∈ U 1 such that ua = b and vb = a, while aLS b means that there exist x, y ∈ S 1 such that xa = b and yb = a. Similarly, for the relation R. Some of the earlier results concerning starred Green’s relations on a transformation semigroup were obtained by Umar [18, 19, 20, 21], where he described all the starred relations on the semigroups of order decreasing full and of order decreasing partial one-one transformations of a chain, these papers marked the beginning of the study of these relations on a transformation semigroup. Recently, Garba et al. characterized these relations on the semigroup of full contraction maps and of order preserving full contraction maps of a finite chain: CT n and OCT n , respectively [7]. In this section, we characterize these relations on the more general semigroup of partial contractions CP n and its subsemigroups of order preserving or order reversing partial contraction maps of a finite chain ORCP n , and of order preserving partial contraction maps of a finite chain OCP n , respectively. We equally show that the relations D∗ and J ∗ coincide on these semigroups. To begin our investigation let us start with the following. The relations L∗ and R∗ have the following characterizations as described in ([12], Exercise 2.6.7-9) or as described in [4]. L∗ = {(a, b) : (∀x, y ∈ S 1 ) ax = ay ⇔ bx = by} (2) R∗ = {(a, b) : (∀x, y ∈ S 1 ) xa = ya ⇔ xb = yb} (3) and We next give the characterizations of these relations on the semigroups CP n , ORCP n and OCP n as follows: Let S be a semigroup in {CP n , ORCP n , OCP n }. Theorem 2.1. Let α, β ∈ S. Then (i) αL∗ β if and only if Im α = Im β. (ii) αR∗ β if and only if ker α = ker β. (iii) αH∗ β if and only if Im α = Im β and ker α = ker β. (iv) αD∗ β if and only if | Im α| = | Im β|. ∗ Proof. (i) Let α, β be elements in S ∈ {CP n , ORCP n , OCP n } suchthat αL β  x1 x2 . . . xp . and Im α = {x1 , x2 , . . . , xp }. Further, let γ = x1 x2 . . . xp 4 Then clearly γ ∈ S and   x1 x2 . . . xp α. = α · 1[n] (by (2)) x1 x2 . . . xp   x1 x2 . . . xp = β · 1[n] ⇔β· x1 x2 . . . xp which implies that Im β ⊆ {x1 , x2 , . . . , xp } = Im α. Similarly in the same manner we can have Im α ⊆ Im β. Thus, Im α = Im β. Conversely, suppose that Im α = Im β. Then by ([12], Excercise 2.6, 17) αLPn β and it follows from definition that αL∗ β. Thus, the result follows. (ii) Suppose that α, β ∈ S and αR∗ β. Then (x, y) ∈ ker α if and only if     Dom α Dom α xα = yα ⇔ ◦α= ◦ α (by (3)) x y     Dom α Dom α ⇔ ◦β = ◦ β. x y ⇔ xβ = yβ ⇔ (x, y) ∈ ker β. Hence ker α = ker β. Conversely, suppose that ker α = ker β. Then by ([12], Excercise 2.6, 17) αRPn β and it follows from definition that αR∗ β. (iii) This follows from (i) and (ii). (iv) Suppose that αD∗ β. Then by ([12], Proposition 1.5.11) there exist elements γ1 , γ2 , . . . , γ2n−1 ∈ S such that αL∗ γ1 , γ1 R∗ γ2 , γ2 L∗ γ3 , . . . , γ2n−1 R∗ β for some n ∈ N. Thus, by (i) and (ii) we have Im α = Im γ1 , ker γ1 = ker γ2 , Im γ2 = Im γ3 . . . , ker γ2n−1 = ker β. This implies that | Im α| = | Im γ1 | = | Dom γ1 / ker γ1 | = | Dom γ2 / ker γ2 | = . . . = | Dom γ2n−1 / ker γ2n−1 | = | Dom β/ ker β| = | Im β|. Conversely, suppose that | Im α| = | Im β| where     B1 B2 . . . Bp A1 A2 . . . Ap (p ≤ n) (4) and β = α= y1 y2 . . . yp x1 x2 . . . xp such that the map xi 7→  yi (i = 1, 2, . . . , p) is an isometry. Then the map B1 B2 . . . Bp is in S. Moreover, by (i) and (ii), it follows that γ = x1 x2 . . . xp αL∗ γ and γR∗ β. Thus, by ([12] Proposition 1.5.11) we have αD∗ γ and the proof is complete. A left (resp. right) ∗−ideal of a semigroup S is defined as the left (rep. right) ideal of S for which L∗a ⊆ I (resp. Ra∗ ⊆ I) for all a ∈ I. A subset I of a semigroup S is a ∗−ideal if it is both left and right ∗−ideal of S. The principal J ∗ ∗−ideal, J ∗ (a), generated by a ∈ S is the intersection of all ∗−ideal of S containing a, where the relation J ∗ is defined as: aJ ∗ b if and only if J ∗ (a) = J ∗ (b) for all a, b ∈ S. We now recognize the following lemma from Fountain [5]. 5 Lemma 2.2 ( [5]). Let a,b be elements of a semigroup S. Then b ∈ J ∗ (a) if and only if there are elements a0 , a1 , . . . , an ∈ S, x1 , x2 , . . . , xn , y1 , y2 , . . . , yn ∈ S 1 such that a = a0 , b = an and (ai , xi ai−1 yi ) ∈ D∗ for i = 1, 2, . . . , n. As in [19], we immediately have: Lemma 2.3. Let S be in {CP n , ORCP n , OCP n }. Then for α, β ∈ S, α ∈ J ∗ (β) implies | Im α| ≤ | Im β|. Proof. Let α ∈ J ∗ (β), then by lemma(2.2), there exist η0 , η1 . . . , ηn ∈ S, ρ1 , ρ2 , . . . , ρn , τ1 , τ2 , . . . , τn ∈ S 1 such that β = η0 , α = ηn and (ηi , ρi ηi−1 τi ) ∈ D∗ for i = 1, 2, . . . , n. Thus, by Theorem(2.1)(iv), it implies that | Im ηi | = | Im ρi ηi−1 τi | ≤ | Im ηi | f or i = 1, 2, . . . , n, which implies that | Im α| ≤ | Im β|. Notice that, D∗ ⊆ J ∗ and together with Lemma (2.3) we have: Corollary 2.4. On the semigroups CP n , ORCP n or OCP n we have D∗ = J ∗ . We now are going to show in the next lemma that if S ∈ {CP n , OCP n , ORCP n } then S is left abundant. Lemma 2.5. Let S ∈ {CP n , OCP n , ORCP n }. Then S is left abundant.   A1 A2 . . . Ap Proof. Let α ∈ S and L∗α be an L∗ −class of α in S, where α = x1 x2 . . . xp   x1 x2 . . . xp . Clearly γ 2 = γ ∈ S and (1 ≤ p ≤ n). Define γ = x1 x2 . . . xp Im α = Im γ, therefore by Theorem(2.1)(i), αL∗ γ, which means that γ ∈ L∗α . Thus, S is left abundant, as required. Lemma 2.6. Let S ∈ {CP n , ORCP n , OCP n }. Then for n ≥ 4, S is not right abundant.   1 {2, 3} 4 Proof. Let n = 4 and consider α = . Clearly α is in S and 1 2 3         1 {2, 3} 4 1 {2, 3} 4 1 {2, 3} 4 1 {2, 3} 4 ∗ Rα = , , , , 1 2 3 3 2 1 2 3 4 4 3 2 which has no idempotent element. Remark 2.7. Let S ∈ {CP n , ORCP n , OCP n }. Then for 1 ≤ n ≤ 3, S is right abundant. 6 3 On strongly regular elements in ORCP n In 2018, Ali et al. [2] characterized the regular elements in ORCP n and showed that the semigroup ORCP n is not regular. We begin the section with a remark concerning the product of regular elements in ORCP n . Remark 3.1. Product of regular  elements  in ORCP  n or OCP nis not neces1 3 1 {2, 3} sarily regular. Consider α = and β = ∈ ORCP 3 . 1 3 1 2   1 3 Then αβ = is not regular. 1 2 Next, we recognize the following result (due to Hall ([10], Proposition 1.)) which is crucial in proving some of the results below. Proposition 3.2. ([10], Proposition 1.) Let S be an arbitrary semigroup. Then the following are equivalent: (i) For all idempotents e and f of S, the element ef is regular; (ii) Reg(S) is regular subsemigroup; (iii) hE(S)i is a regular semigroup. We now introduce the following definition. A regular element α in ORCP n is said to be strongly regular if and  only ifKer α has a convex transversal Tα . For 1 3 example, the contraction α = ∈ ORCP 3 is regular but not strongly 3 1 regular, = {1, 3} is not convex. On the other hand, the contraction  since Tα  1 {2, 3} β= ∈ ORCP 3 is strongly regular, since Tβ = {1, 2} is convex. 3 4 Now let SReg(ORCP n ) denote the set of all strongly regular elements in ORCP n . Then we have the following two lemmas: Lemma 3.3.Let ǫ be an idempotent element in SReg(ORCP n ). Then α can be A1 a + 2 a+ 3 ... a+ p − 1 Ap expressed as , where a + 1 = a + 1 a + 2 a+ 3 ... a+ p − 1 a+ p max A1 , a + p = min Ap . Proof. Let ǫ ∈ SReg(ORCP n ) be of height p. Then by the contrapositive of Lemma(1.2) we see that Ker ǫ = {A1 < {a + 2} < . . . < {a + p − 1} < Ap }, and so Tǫ is convex. Thus by Lemma (1.4), Tǫ ǫ = Im ǫ is convex and hence   A1 a+ 2 a + 3 ... a+ p − 1 Ap . ǫ= x + 1 x + 2 x + 3 ... x + p − 1 x + p However, since ǫ is an idempotent then the blocks of Ker ǫ are stationary i. e., x + 1 ∈ A1 , x + p ∈ Ap , and x + i = a + i (i = 2, . . . , p − 1), which implies x = a. However, since ǫ is regular then it follows by Lemma(1.5) that max A1 − (a + 1) = min Ap − (a + p) = 0, showing that max A1 = a and min Ap = a + p, as required. 7   A1 a+ 2 ... a + p − 1 Ap and Lemma 3.4. Let ǫ = a+ 1 a+ 2 ... a + p − 1 a + p   B1 b + 2 . . . b + s − 1 Bs τ = be two idempotent elements in b + 1 b + 2 ... b + s− 1 b + s SReg(ORCP n ) with p, s = 1, 2, . . . , n. Then ǫτ is strongly regular. Proof. Let c = max{a + 1, b + 1} and d = min{a + p, b + s}. Suppose also that F (ǫ) ∩ F (τ ) 6= ∅ and the blocks of the product ǫτ are D1 , D2 , . . . , Dk , where k ≤ min{p, s}. Then clearly, c ≤ d. Thus we shall consider four cases: (i) If a + 1 = c and a + p = d then b + 1 ≤ a + 1 and a + p ≤ b + s. Using convexity, it is now not difficult to see that D1 = A1 ∪ [b + 1, a + 1], Di = {a + i} (i = 2, . . . , k − 1) and Dk = [a + p, b + s] ∪ Ap . Moreover, D1 ǫτ = a + 1 = max D1 and Dk ǫτ = a + p = min Dk . Hence ǫτ is a strongly regular idempotent. The other three cases listed below are handled similarly. (ii) If a + 1 = c and b + s = d; (iii) If b + 1 = c and a + p = d; (iv) If b + 1 = c and b + s = d. Now as a consequence, from Proposition(3.2) and Lemma(3.4), we readily have: Theorem 3.5. Let S = SReg(ORCP n ). Then S is a regular subsemigroup of ORCP n . Acknowledgements. The second named author would like to thank Bayero University and TET Fund for financial support. He would also like to thank The Petroleum Institute, Khalifa University of Science and Technology for hospitality during his 3-month research visit to the institution. References [1] Adeshola, A. D. and Umar, A. Combinatorial results for certain semigroups of order-preserving full contraction mappings of a finite chain. J. Comb. Maths. and Comb. Computing. To appear. [2] Ali, B. Umar and A. Zubairu, M. M. Regularity and Green’s relations on the semigroup of partial contractions of a finite chain. Submitted. [3] AlKharousi, F., Garba, U. G., Ibrahim, M. J., Imam, A. T. and Umar, A. On the semigroup of finite order-preserving partial injective contraction mappings Submitted. 8 [4] Fountain, J. B. Adequate Semigroups. Proc. Edinb. Math. Soc. 22 (1979), 113–125. [5] Fountain, J. B. Abundant Semigroups. Proc. Lond. Math. Soc. 44 (1982), 103–129. [6] Garba G. U. Idempotents in partial transformation semifroups. Proc. Roy. Soc. Edinb. 116 A (1990), 359–366. [7] Garba, G. U., Ibrahim, M. J. and Imam, A. T. On certain semigroups of full contraction maps of a finite chain. Turk. J. Math. 41 (2017) 500-507. [8] Green, J. A. On the structure of semigroups, Ann. of Math. (2) 54 (1951), 163–172. [9] Ganyushkin, O. and Mazorchuk, V. Classical Finite Transformation Semigroups. Springer−Verlag: London Limited (2009). [10] Hall, P. Some properties of local subsemigroups inherited by larger subsemigroups. Semigroup Forum 1982, 35–49. [11] Higgins, P. M. Techniques of semigroup theory. Oxford university Press (1992). [12] Howie, J. M. Fundamental of semigroup theory. London Mathematical Society, New series 12. The Clarendon Press, Oxford University Press, 1995. [13] Howie, J. M., Robertson, E. F. and Schein, B. M. A combinatorial property of finite full transformation semigroups. Proc. Roy. Soc. Edinb. 109A (1988), 319-328. [14] Mendes-Gonalves, Suzana. Green’s relations, regularity and abundancy for semigroups of quasi-onto transformations. Semigroup Forum 91 (2015), no. 1, 39-52. [15] Pei, Huisheng and Zhou, Huijuan. Abundant semigroups of transformations preserving an equivalence relation. Algebra Colloq. 18 (2011), no. 1, 77-82. [16] Sun, Lei. A note on abundance of certain semigroups of transformations with restricted range. Semigroup Forum 87 (2013), no. 3, 681-684. [17] Umar, A. and Al-Kharousi, F. Studies in semigroup of contraction mappings of a finite chain. The Research Council of Oman Research grant proporsal No. ORG/CBS/12/007, 6th March 2012. [18] Umar, A. On the semigroups of order-decreasing finite full transformations. Proc. Roy. Soc. Edinb. Sect. A 120 (1992), no. 1-2, 129–142. [19] Umar, A. On the semigroups of partial one-one order-decreasing finite transformations. Proc. Roy. Soc. Edinb. Sect. A 123 (1993), 355–363. 9 [20] Umar, A. On certain infinite semigroups of order-decreasing transformations I Comm. Algebra 25 (1997), 2989–2999. [21] Umar, Abdullahi. On certain infinite semigroups of order-increasing transformations II. Arab. J. Sci. Eng. Sect. A Sci. 28 (2003), 203–210. [22] Zhao, Ping. On the semigroups of order-preserving and A -decreasing finite transformations. Algebra Colloq. 21 (2014), no. 4, 653-662. [23] Zhao, P. and Yang, M. Regularity and Green’s relations on semigroups of transformation preserving order and compression. Bull. Korean Math. Soc. 49 (2012), No. 5, 1015–1025. 10
4math.GR
Deep Visual Domain Adaptation: A Survey arXiv:1802.03601v1 [cs.CV] 10 Feb 2018 Mei Wang, Weihong Deng School of Information and Communication Engineering, Beijing University of Posts and Telecommunications, Beijing, China. [email protected], [email protected] Abstract time. Fortunately, the big data era makes a large amount of data available for other domains and tasks. For instance, although large-scale labeled video databases that are publicly available only contain a small number of samples, statistically, the YouTube face dataset (YTF) consists of 3.4K videos. The number of labeled still images is more than sufficient [85]. Hence, skillfully using the auxiliary data for the current task with scarce data will be helpful for realworld applications. However, there is always a distribution change or domain shift between two domains that can degrade the performance, as shown in Fig. 1. Mimicking the human vision system, domain adaptation (DA) is a particular case of transfer learning (TL) that utilizes labeled data in one or more relevant source domains to execute new tasks in a target domain. Over the past decades, various shallow DA methods have been proposed to solve a domain shift between the source and target domains. The common algorithms for shallow DA can mainly be categorized into two classes: instance-based DA [5, 12] and feature-based DA [30, 66, 23, 65]. The first class reduces the discrepancy by reweighting the source samples, and it trains on the weighted source samples. For the second class, a common shared space is generally learned in which the distributions of the two datasets are matched. Deep domain adaption has emerged as a new learning technique to address the lack of massive amounts of labeled data. Compared to conventional methods, which learn shared feature subspaces or reuse important source instances with shallow representations, deep domain adaption methods leverage deep networks to learn more transferable representations by embedding domain adaptation in the pipeline of deep learning. There have been comprehensive surveys for shallow domain adaption, but few timely reviews the emerging deep learning based methods. In this paper, we provide a comprehensive survey of deep domain adaptation methods for computer vision applications with four major contributions. First, we present a taxonomy of different deep domain adaption scenarios according to the properties of data that define how two domains are diverged. Second, we summarize deep domain adaption approaches into several categories based on training loss, and analyze and compare briefly the state-of-the-art methods under these categories. Third, we overview the computer vision applications that go beyond image classification, such as face recognition, semantic segmentation and object detection. Fourth, some potential deficiencies of current methods and several future directions are highlighted. Recently, neural-network-based deep learning approaches have achieved many inspiring results in visual categorization applications, such as image classification [53], face recognition [90], and object detection [28]. Simulating the perception of the human brain, deep networks can represent high-level abstractions by multiple layers of non-linear transformations. Existing deep network architectures [60] include convolutional neural networks (CNNs) [53, 84, 88, 36], deep belief networks (DBNs) [38], and stacked autoencoders (SAEs) [99], among others. As the architecture becomes deeper and wider, deep networks need more training data to avoid overfitting, which also results in the need for transferring knowledge from one domain to another. Although some studies have shown that deep networks can learn more transferable representations that 1. INTRODUCTION Over the past few years, machine learning has achieved great success and has benefited real-world applications. It has mainly owed to large-scale datasets under the major assumption that the training and testing data have the same feature space or distribution. However, a mismatch between the feature space and distribution always exists in realworld applications due to many factors (e.g., illumination, pose, and image quality). In addition, collecting and annotating testing datasets for every new task and domain are extremely expensive and time-consuming processes. Sufficient training data may not always be available, which typically degrades the performance of learning methods at test 1 Figure 1. (a) Some object images from the ”Bike” and ”Laptop” categories in Amazon, DSLR, Webcam, and Caltech-256 databases. (b) Some digit images from MNIST, USPS, and SVHN databases. (c) Some face images from LFW, BCS and CUFS databases. Realworld computer vision applications, such as face recognition, must learn to adapt to distributions specific to each domain. disentangle the exploratory factors of variations underlying the data samples and group features hierarchically in accordance with their relatedness to invariant factors, Donahue et al. [16] showed that a domain shift still affects their performance. The deep features would eventually transition from general to specific, and the transferability of the representation sharply decreases in higher layers. Therefore, recent work has addressed this problem by deep DA, which combines deep learning and DA. of data that define how two domains are diverged. 2) extending Csurka’s work, we improve and detail the three subsettings (training with classification loss, discrepancy loss and adversarial loss) and summarize different approaches used in different DA scenes. 3) Considering the distance of the source and target domains, multi-step DA methods are studied and categorized into hand-crafted, feature-based and representation-based mechanisms. 4) We provide a survey of many computer vision applications, such as image classification, face recognition, style translation, object detection, semantic segmentation and person re-identification. The remainder of this survey is structured as follows. In Section II, we first define some notations, and then we categorize deep DA into different settings (given in Fig. 2). In the next three sections, different approaches are discussed for each setting, which are given in Table 1 and Table 2 in detail. Then, in Section VI, we introduce some successful computer vision applications of deep DA. Finally, the conclusion of this paper and discussion of future works are presented in Section VII. There have been other surveys on TL and DA over the past few years [67, 80, 14, 68, 109, 13]. Pan et al. [67] categorized TL under three subsettings, including inductive TL, transductive TL, and unsupervised TL, but they only studied homogeneous feature spaces. Shao et al. [80] categorized TL techniques into feature-representation-level knowledge transfer and classifier-level knowledge transfer. The survey written by Patel [68] only focused on DA, a subtopic of TL. [14] discussed 38 methods for heterogeneous TL that operate under various settings, requirements, and domains. Zhang et al. [109] were the first to summarize several transferring criteria in detail from the concept level. These five surveys mentioned above only cover the methodologies on shallow TL or DA. The work presented by Csurka et al. [13] briefly analyzed the state-of-the-art shallow DA methods and categorized the deep DA methods into three subsettings based on training loss: classification loss, discrepancy loss and adversarial loss. However, Csurka’s work mainly focused on shallow methods, and it only discussed deep DA in image classification applications. 2. Overview 2.1. Notations and Definitions In this section, we introduce some notations and definitions that are used in this survey. The notations and definitions match those from the survey papers by [67, 13] to maintain consistency across surveys. A domain D consists of a feature space X and a marginal probability distribution P (X), where X = {x1 , ..., xn } ∈ X . Given a specific domain D = {X , P (X)}, a task T consists of a feature space Y and an objective predictive function f (·), which can also be viewed as a conditional probability distribution In this paper, we focus on analyzing and discussing deep DA methods. Specifically, the key contributions of this survey are as follows: 1) we present a taxonomy of different deep domain adaption scenarios according to the properties 2 P (Y |X) from a probabilistic perspective. In general, we can learn P (Y |X) in a supervised manner from the labeled data {xi , yi }, where xi ∈ X and yi ∈ Y. Assume that we have two domains: the training dataset with sufficient labeled data is the source domain Ds = {X s , P (X)s }, and the test dataset with a small amount of labeled data or no labeled data is the target domain Dt = {X t , P (X)t }. We see that the partially labeled part, Dtl , and the unlabeled parts, Dtu , form the entire target domain, that is, Dt = Dtl ∪ Dtu . Each domain is together with its task: the former is T s = {Y s , P (Y s |X s )}, and the latter is T t = {Y t , P (Y t |X t )}. Similarly, P (Y s |X s ) can be learned from the source labeled data {xsi , yis }, while tl P (Y t |X t ) can be learned from labeled target data {xtl i , yi } tu and unlabeled data {xi }. able when training the network. • In the heterogeneous DA setting, the feature spaces between the source and target domains are nonequivalent (X s 6= X t ), and the dimensions may also generally differ (ds 6= dt ). Similar to the homogeneous setting, the heterogeneous DA setting can also be divided into supervised, semi-supervised and unsupervised DA. All of the above DA settings assumed that the source and target domains are directly related; thus, transferring knowledge can be accomplished in one step. We call them one-step DA. In reality, however, this assumption is occasionally unavailable. There is little overlap between the two domains, and performing one-step DA will not be effective. Fortunately, there are some intermediate domains that are able to draw the source and target domains closer than their original distance. Thus, we use a series of intermediate bridges to connect two seemingly unrelated domains and then perform one-step DA via this bridge, named multi-step (or transitive) DA [91, 92]. For example, face images and vehicle images are dissimilar between each other due to different shapes or other aspects, and thus, one-step DA would fail. However, some intermediate images, such as ’football helmet’, can be introduced to be an intermediate domain and have a smooth knowledge transfer. Fig. 3 shows the differences between the learning processes of one-step and multi-step DA techniques. 2.2. Different Settings of Domain Adaption The case of traditional machine learning is Ds = Dt and T = T t . For TL, Pan et al. [67] summarized that the differences between different datasets can be caused by domain divergence Ds 6= Dt (i.e., distribution shift or feature space difference) or task divergence T s 6= T t (i.e., conditional distribution shift or label space difference), or both. Based on this summary, Pan et al. categorized TL into three main groups: inductive, transductive and unsupervised TL. According to this classification, DA methods are transductive TL solutions with the assumption that the tasks are the same, i.e., T s = T t , and the differences are only caused by domain divergence, Ds 6= Dt . Therefore, DA can be split into two main categories based on different domain divergences (distribution shift or feature space difference): homogeneous and heterogeneous DA. Then, we can further categorize DA into supervised, semi-supervised and unsupervised DA in consideration of labeled data of the target domain. The classification is given in Fig. 2. • In the homogeneous DA setting, the feature spaces between the source and target domains are identical (X s = X t ) with the same dimension (ds = dt ). Hence, the source and target datasets are generally different in terms of data distributions (P (X)s 6= P (X)t ). In addition, we can further categorize the homogeneous DA setting into three cases: s 3. Approaches of Deep Domain Adaption In a broad sense, deep DA is a method that utilizes a deep network to enhance the performance of DA. Under this definition, shallow methods with deep features can be considered as a deep DA approach. DA is adopted by shallow methods, whereas deep networks only extract vectorial features and are not helpful for transferring knowledge directly [16, 41, 72, 64, 110]. This approach reliably outperforms current state-of-the-art approaches based on traditional hand-crafted features because sufficient representational and transferable features can be extracted through deep networks, which can work better on discrimination tasks [16]. In a narrow sense, deep DA is based on deep learning architectures designed for DA and can obtain a firsthand effect from deep networks via back-propagation. The intuitive idea is to embed DA into the process of learning representation and to learn a deep feature representation that is both semantically meaningful and domain invariant. With the ”good” feature representations, the performance of the target task would improve significantly. In this paper, we focus on the narrow definition and discuss how to utilize deep networks to learn ”good” feature representations with 1. In the supervised DA, a small amount of labeled target data, Dtl , are present. However, the labeled data are commonly not sufficient for tasks. 2. In the semi-supervised DA, both limited labeled data, Dtl , and redundant unlabeled data, Dtu , in the target domain are available in the training stage, which allows the networks to learn the structure information of the target domain. 3. In the unsupervised DA, no labeled but sufficient unlabeled target domain data, Dtu , are observ3 Figure 2. An overview of different settings of domain adaption Figure 3. Different learning processes between (a) traditional machine learning, (b) one-step domain adaption and (c) multi-step domain adaption [67]. Kullback-Leibler (KL) divergence [114] and H divergence, among others. • Architecture Criterion: aims at improving the ability of learning more transferable features by adjusting the architectures of deep networks. The techniques that are proven to be cost effective include adaptive batch normalization (BN) [58, 46, 57], weak-related weight [78], domain-guided dropout [102], and so forth. • Geometric Criterion: bridges the source and target domains according to their geometrical properties. This criterion assumes that the relationship of geometric structures can reduce the domain shift [10]. The second case can be referred to as an adversarialbased deep DA approach [19]. In this case, a domain discriminator that classifies whether a data point is drawn from the source or target domain is used to encourage domain confusion through an adversarial objective to minimize the distance between the empirical source and target mapping distributions. Furthermore, the adversarial-based deep DA approach can be categorized into two cases based on whether there are generative models. • Generative Models: combine the discriminative model with a generative component in general based on generative adversarial networks (GANs). One of the typical cases is to use source images, noise vectors or both to generate simulated samples that are similar to the target samples and preserve the annotation information extra training criteria. 3.1. Categorization of one-step domain adaption In one-step DA, the deep approaches can be summarized into three cases, which refers to [13]. Table 1 shows these three cases and brief descriptions. The first case is the discrepancy-based deep DA approach, which assumes that fine-tuning the deep network model with labeled or unlabeled target data can diminish the shift between the two domains. Class criterion, statistic criterion, architecture criterion and geometric criterion are four major techniques for performing fine-tuning. • Class Criterion: uses the class label information as a guide for transferring knowledge between different domains. When the labeled samples from the target domain are available in supervised DA, soft label and metric learning are always effective [95, 40, 34, 70, 45, 37]. When such samples are unavailable, some other techniques can be adopted to substitute for class labeled data, such as pseudo labels [63, 111, 104] and attribute representation [22, 95]. • Statistic Criterion: aligns the statistical distribution shift between the source and target domains using some mechanisms. The most commonly used methods for comparing and reducing distribution shift are maximum mean discrepancy (MMD) [62, 104, 61, 63, 97, 25], correlation alignment (CORAL) [87, 71], 4 Table 1. Different Deep Approaches to One-Step DA One-step DA Approaches Brief Description Subsettings Discrepancybased fine-tuning the deep network with labeled or unlabeled target data to diminish the domain shift Adversarialbased using domain discriminators to encourage domain confusion through an adversarial objective Reconstructionbased using the data reconstruction as an auxiliary task to ensure feature invariance class criterion [95, 40, 34, 70] [45, 37, 63, 111, 104, 22, 95, 21] statistic criterion [62, 104, 61] [63, 97, 25, 87, 71, 114] architecture criterion [58, 46] [57, 78, 102, 73] geometric criterion [10] generative models [59, 3, 48] non-generative models [96] [95, 19, 18, 94, 69] encoder-decoder reconstruction [4, 26, 24, 114] adversarial reconstruction [105, 113, 50] Table 2. Different Deep Approaches to Multi-Step DA Multi-step Approaches Hand-crafted Instance-based Representation-based Brief Description users determine the intermediate domains based on experience [103] selecting certain parts of data from the auxiliary datasets to compose the intermediate domains [92, 10] freeze weights of one network and use their intermediate representations as input to the new network [79] 3.2. Categorization of multi-step domain adaption of the source domain [59, 3, 48]. • Non-Generative Models: rather than generating models with input image distributions, the feature extractor learns a discriminative representation using the labels in the source domain and maps the target data to the same space through a domain-confusion loss, thus resulting in the domain-invariant representations [96, 95, 19, 18, 94]. The third case can be referred to as a reconstructionbased DA approach, which assumes that the data reconstruction of the source or target samples can be helpful for improving the performance of DA. The reconstructor can ensure both specificity of intra-domain representations and indistinguishability of inter-domain representations. • Encoder-Decoder Reconstruction: by using stacked autoencoders (SAEs), encoder-decoder reconstruction methods combine the encoder network for representation learning with a decoder network for data reconstruction [4, 26, 24, 114]. • Adversarial Reconstruction: the reconstruction error is measured as the difference between the reconstructed and original images within each image domain by a cyclic mapping obtained via a GAN discriminator, such as dual GAN [105], cycle GAN [113] and disco GAN [50]. In multi-step DA, we first determine the intermediate domains that are more related with the source and target domains than their direct connection. Second, the knowledge transfer process will be performed between the source, intermediate and target domains by one-step DA with less information loss. Thus, the key of multi-step DA is how to select and utilize intermediate domains; additionally, it can fall into three categories referring to [67]: hand-crafted, feature-based and representation-based selection mechanisms. • Hand-Crafted: users determine the intermediate domains based on experience [103]. • Instance-Based: selecting certain parts of data from the auxiliary datasets to compose the intermediate domains to train the deep network [92, 10]. • Representation-Based: transfer is enabled via freezing the previously trained network and using their intermediate representations as input to the new one [79]. 4. HOMOGENEOUS DOMAIN ADAPTION As mentioned in Section 2.1, the data in the target domain have three types regardless of homogeneous or heterogeneous DA: 1) supervised DA with labeled data, 2) semi-supervised DA with labeled and unlabeled data and 5 Table 3. Different Approaches used in Different Domain Adaption Settings Discrepancy-based Adversarial-based Reconstruction-based Class Criterion Statistic Criterion Architecture Criterion Geometric Criterion Generative Model Non-Generative Model Encoder-Decoder Model Adversarial Model 3) non-supervised DA with unlabeled data. The second setting is able to be accomplished by combining the methods of setting 1 and setting 3; thus, we only focus on the first and third settings in this paper. The cases where the different approaches are mainly used for each DA setting are shown in Table 3. As shown, more work is focused on unsupervised scenes because supervised DA has its limitations. When only few labeled data in the target domain are available, using the source and target labeled data to train parameters of models typically results in overfitting to the source distribution. In addition, the discrepancy-based approaches have been studied for years and produced more methods in many research works, whereas the adversarialbased and reconstruction-based approaches are a relatively new research topic but have recently been attracting more attention. Supervised DA √ √ √ Unsupervised DA √ √ √ √ √ √ Figure 4. The average accuracy over the validation set for a network trained with different strategies. Baseline B: the network is trained on dataset B. 2) BnB: the first n layers are reused from baseline B and frozen. The higher layers are trained on dataset B. 3) BnB+: the same as BnB but where all layers are fine-tuned. 4) AnB: the first n layers are reused from the network trained on dataset A and frozen. The higher layers are trained on dataset B. 5) AnB+: the same as AnB but where all layers are fine-tuned [107]. 4.1. One-step Domain Adaption 4.1.1 Discrepancy-Based Approaches P training loss, L = − N i=0 yi log ŷi (ŷi are the softmax predictions of the model, which represent class probabilities) [95, 40, 34, 70, 45, 100]. To extend this, Hinton et al. [37] modified the softmax function to soft label loss: Yosinski et al.[107] proved that transferable features learned by deep networks have limitations due to fragile coadaptation and representation specificity and that finetuning can enhance generalization performance. Finetuning (can also be viewed as a discrepancy-based deep DA approach) is to train a base network with source data and then directly reuse the first n layers to conduct a target network. The remaining layers of the target network are randomly initialized and trained with loss based on discrepancy. During training, the first n layers of the target network can be fine-tuned or frozen depending on the size of the target dataset and its similarity to the source dataset [11]. Some common rules of thumb for navigating the 4 major scenarios are given in Table 4. • Class Criterion The class criterion is the most basic training loss in deep DA. After pre-training the network with source data, the remaining layers of the target model use the class label information as a guide to train the network. Hence, a small number of labeled samples from the target dataset is assumed to be available. Ideally, the class label information is given directly in supervised DA. Most work commonly uses the negative loglikelihood of the ground truth class with softmax as their qi = P exp(zi /T ) j (exp(zj /T )) (1) where z i is the logit output computed for each class. T is a temperature that is normally set to 1 in standard softmax, but it takes a higher value to produce a softer probability distribution over classes. By using it, much of the information about the learned function that resides in the ratios of very small probabilities can be obtained. For example, when recognizing digits, one version of 2 may obtain a probability of 106 of being a 3 and 109 of being a 7; in other words, this version of 2 looks more similar to 3 than 7. Inspired by Hinton, [95] fine-tuned the network by simultaneously minimizing the domain confusion loss (belonging to adversarial-based approaches, which will be presented in Section 4.1.2) and soft label loss. Using soft labels rather than hard labels can preserve the relationships between classes across domains. Gebru et al. [22] modified existing adaptation algorithms based on [95] and utilized 6 Table 4. Some Common Rules of Thumb for Deciding Fine-tuned or Frozen in the First n Layers. [11] The Distance between Source and Target Low Medium High The Size of Target Dataset Low Medium Freeze Try Freeze or Tune Try Freeze or Tune Tune Try Freeze or Tune Tune soft label loss at the fine-grained class level Lcsof t and attribute level Lasof t . High Tune Tune Tune humans can identify unseen classes given only a high-level description. For instance, when provided the description ”tall brown animals with long necks”, we are able to recognize giraffes. To imitate the ability of humans, [54] introduced high-level semantic attributes per class. Assume that ac = (ac1 , ..., acm ) is the attribute representation for class c, which has fixed-length binary values with m attributes in all the classes. The classifiers provide estimates of p(am |x) for each attribute am . In the test stage, each target class y obtains its attribute vector ay in a deterministic way, i.e., p(a|y) = [[a = ay ]]. By applying Bayes rule, p(y) y p(y|a) = p(a y ) [[a = a ]], the posterior of a test class can be calculated as follows: p(y|x) = X p(y|a)p(a|x) = a∈{0,1}M (3) Gebru et al. [22] drew inspiration from these works and leveraged attributes to improve performance in the DA of fine-grained recognition. There are multiple independent softmax losses that simultaneously perform attribute and class level to fine-tune the target model. To prevent the independent classifiers from obtaining conflicting labels with attribute and class level, an attribute consistency loss is also implemented. Occasionally, when fine-tuning the network in unsupervised DA, a label of target data, which is called a pseudo label, can preliminarily be obtained based on the maximum posterior probability. Yan et al. [104] initialized the target model using the source data and then defined the class posterior probability p(yjt = c|xtj ) by the output of the target model. With p(yjt = c|xtj ), they assigned pseudo-label ybt to xt by ybt = arg max p(y t = c|xt ). The deep trans- Figure 5. Deep DA by combining domain confusion loss and soft label loss [95]. In addition to softmax loss, there are other methods that can be used as training loss to fine-tune the target model in supervised DA. For example, given a pair of samples from the source and target domains (such as an RGB image and its paired depth image), [34] minimized the difference between the representations using a Euclidean loss. Embedding metric learning in deep networks is another method that can make the distance of samples from different domains with the same labels be closer while those with different labels are far away. Deep transfer metric learning was proposed by [45], which applies the marginal Fisher analysis criterion and MMD criterion (described in Statistic Criterion) to minimize their distribution difference:  (M) (M) min J = Sc(M) − αSb + βDts X s , X t +γ M X m=1 ( W (m) 2 F + b(m) 2 2 ) M p(y) Y p(aym |x) p(ay ) m=1 j j j c j j fer network (DTN) [111] used some base classifiers, e.g., SVMs and MLPs, to obtain the pseudo labels for the target samples to estimate the conditional distribution of the target samples and match both the marginal and the conditional distributions with the MMD criterion. When casting the classifier adaptation into the residual learning framework, [63] used the pseudo label to build the conditional entropy E(Dt , f t ), which ensures that the target classifier f t fits the target-specific structures well. • Statistic Criterion Although some discrepancy-based approaches search for pseudo labels, attribute labels or other substitutes to labeled target data, more work focuses on learning domain- (2) where α, β and γ are regularization parameters and W (m) and b(m) are the weights and biases of the mth layer of the (M) network. Dts (X s , X t ) is the MMD between representations of the source and target domains. Sc and Sb define the intra-class compactness and the interclass separability. However, what can we do if there is no class label information in the target domain directly? As we all know, 7 invariant representations via minimizing the domain distribution discrepancy in unsupervised DA. MMD is an effective metric for comparing the distributions between two datasets by a kernel two-sample test [2]. Given two distributions s and t, the MMD is defined as follows: M M D2 (s, t) = sup Exs ∼s [φ(xs )] − Ext ∼s [φ(xt )] kφkH ≤1 distributions are matched based on MMD. The shared feature extraction layer learns a subspace to match the marginal distributions of the source and the target samples, and the discrimination layer matches the conditional distributions by classifier transduction. In addition to adapting features using MMD, residual transfer networks (RTNs) [63] added a gated residual layer for classifier adaptation. More recently, [104] proposed a weighted MMD model that introduces an auxiliary weight for each class in the source domain when the class weights in the target domain are not the same as those in the source domain. If φ is a characteristic kernel (i.e., Gaussian kernel or Laplace kernel), MMD will compare all the orders of statistic moments. In contrast to MMD, CORAL [86] learned a linear transformation that aligns the second-order statistics between domains. Sun et al. [87] extended CORAL to deep neural networks (deep CORAL) with a nonlinear transformation. 1 2 (7) LCORAL = 2 kCS − CT kF 4d where k · k2F denotes the squared matrix Frobenius norm. CS and CT denote the covariance matrices of the source and target data, respectively. By the Taylor expansion of the Gaussian kernel, MMD can be viewed as minimizing the distance between the weighted sums of all raw moments [56]. The interpretation of MMD as moment matching procedures motivated Zellinger et al. [108] to match the higher-order moments of the domain distributions, which we call central moment discrepancy (CMD). An empirical estimate of the CMD metric for the domain discrepancy in the activation space [a, b]N is given by 2 H (4) where φ represents the kernel function that maps the original data to a reproducing kernel Hilbert space (RKHS) and kφkH ≤ 1 defines a set of functions in the unit ball of RKHS H. Based on the above, Ghifary et al. [25] proposed a model that introduced the MMD metric in feedforward neural networks with a single hidden layer. The MMD metric is computed between representations of each domain to reduce the distribution mismatch in the latent space. The empirical estimate of MMD is as follows: M N 1 X 1 X M M D (Ds , Dt ) = φ(xsi )− φ(xtj ) M i=1 N j=1 2 2 H (5) Subsequently, Tzeng et al. [97] and Long et al. [61] extended MMD to a deep CNN model and achieved great success. The deep domain confusion network (DDC) by Tzeng et al. [97] used two CNNs for the source and target domains with shared weights. The network is optimized for classification loss in the source domain, while domain difference is measured by an adaptation layer with the MMD metric. L=LC (X L , y) + λM M D2 (X s X t ) (6) CM DK (X s , X t ) = where the hyperparameter λ is a penalty parameter. LC (X L , y) denotes classification loss on the available labeled data, X L , and the ground-truth labels, y. M M D2 (X s X t ) denotes the distance between the source and target data. DDC only adapts one layer of the network, resulting in a reduction in the transferability of multiple layers. Rather than using a single layer and linear MMD, Long et al. [61] proposed the deep adaptation network (DAN) that matches the shift in marginal distributions across domains by adding multiple adaptation layers and exploring multiple kernels, assuming that the conditional distributions remain unchanged. However, this assumption is rather strong in practical applications; in other words, the source classifier cannot be directly used in the target domain. To make it more generalized, a joint adaptation network (JAN) [62] aligns the shift in the joint distributions of input features and output labels in multiple domain-specific layers based on a joint maximum mean discrepancy (JMMD) criterion. [111] proposed DTN, where both the marginal and the conditional + K X k=2 1 E(X s ) − E(X t ) (b − a) (8) 1 |b − a| 2 s k t Ck (X ) − Ck (X ) k 2 where Ck (X) = E((x − E(X)) is the vectorP of all k th 1 order sample central moments and E(X) = |X| x∈X x is the empirical expectation. • Architecture Criterion Some other methods optimize the architecture of the network to minimize the distribution discrepancy. This adaptation behavior can be achieved in most deep DA models, such as supervised and unsupervised settings. Rozantsev et al. [78] considered that the weights in corresponding layers are not shared but related by a weight regularizer rw (·) to account for the differences between the two domains. The weight regularizer rw (·) can be expressed as the exponential loss function:   2 rw (θjs , θjt ) = exp θjs − θjt −1 (9) 8 Figure 6. Different approaches with the MMD metric. (a) The deep adaptation network (DAN) architecture [61], (b) the joint adaptation network (JAN) architecture [62] and (c) the residual transfer network (RTN) architecture [63]. where θjs and θjt denote the parameters of the j th layer of the source and target models, respectively. To further relax this restriction, they allow the weights in one stream to undergo a linear transformation: rw (θjs , θjt ) = exp( aj θjs + bj − θjt 2 )−1 layers with instance normalization (IN) layers, where µ(x) and σ(x) are computed independently for each channel and each sample, the performance of DA can be further improved. Occasionally, neurons are not effective for all domains because of the presence of domain biases. For example, when recognizing people, the target domain typically contains one person centered with minimal background clutter, whereas the source dataset contains many people with more clutter. Thus, the neurons that capture the features of other people and clutter are useless. Domain-guided dropout was proposed by [102] to solve the problem of multi-domain adaptation, and it mutes non-related neurons for each domain. Rather than assigning dropout with a specific dropout rate, it depends on the gain of the loss function of each neuron on the domain sample when the neuron is removed. (10) where aj and bj are scalar parameters that encode the linear transformation. The work of Shu et al. [83] is similar to [78] using weakly parameter-shared layers. The penalty term Ω controls the relatedness of parameters. Ω= L X (l) (l) ( WS − WT i=1 (l) (l) 2 F (l) (l) + bS − bT (l) 2 F ) (11) (l) L where {WS , bS }L l=1 and {WT , bT }l=1 are the parameth ters of the l layer in the source and target domains, respectively. Li et al. [58] hypothesized that the class-related knowledge is stored in the weight matrix, whereas domain-related knowledge is represented by the statistics of the batch normalization (BN) layer [47]. BN normalizes the mean and standard deviation for each individual feature channel such that each layer receives data from a similar distribution, irrespective of whether it comes from the source or the target domain. Therefore, Li et al. used BN to align the distribution for recomputing the mean and standard deviation in the target domain.   x − µ(X t ) t +β (12) BN (X ) = λ σ(X t ) si = L(g(x)\i ) − L(g(x)) (13) where L is the softmax loss function and g(x)\i is the feature vector after setting the response of the ith neuron to zero. • Geometric Criterion The geometric criterion mitigates the domain shift by integrating intermediate subspaces on a geodesic path from the source to the target domains. A geodesic flow curve is constructed to connect the source and target domains on the Grassmannian. The source and target subspaces are points on a Grassmann manifold. By sampling a fixed [33] or infinite number of subspaces along the geodesic [31], we can form the intermediate subspaces to help to find the correlations between domains. Then, both source and target data are projected to the obtained intermediate subspaces to align the distribution. Inspired by the intermediate representations on the geodesic path, Chopra et al. [10] proposed a model called where λ and β are parameters learned from the target data and µ(x) and σ(x) are the mean and standard deviation computed independently for each feature channel. Furthermore, Ulyanov et al. [98] found that when replacing BN 9 Figure 7. The two-stream architecture with related weight [78]. deep learning for domain adaption by interpolating between domains (DLID). DLID generates intermediate datasets, starting with all the source data samples and gradually replacing source data with target data. Each dataset is a single point on an interpolating path between the source and target domains. Once intermediate datasets are generated, a deep nonlinear feature extractor using the predictive sparse decomposition is trained in an unsupervised manner. 4.1.2 Adversarial-Based Approaches Figure 8. Generalized architecture for adversarial domain adaptation. Existing adversarial adaptation methods can be viewed as instantiations of a framework with different choices regarding their properties. [96] Recently, great success has been achieved by the GAN method [32], which estimates generative models via an adversarial process. GAN consists of two models: a generative model G that extracts the data distribution and a discriminative model D that distinguishes whether a sample is from G or training datasets by predicting a binary label. The networks are trained on the label prediction loss in a minimax fashion: simultaneously optimizing G to minimize the loss while also training D to maximize the probability of assigning the correct label: min max V (D, G) = Ex∼pdata (x) [log D(x)] G D with labels are used to train the target model as if no DA were required. Adversarial-based approaches with generative models are able to learn such a transformation in an unsupervised manner based on GAN. The core idea of CoGAN [59] is to generate synthetic target data that are paired with synthetic source ones. It consists of a pair of GANs: GAN1 for generating source data and GAN2 for generating target data. The weights of the first few layers in the generative models and the last few layers in the discriminative models are tied. This weightsharing constraint allows CoGAN to achieve a domaininvariant feature space without correspondence supervision. A trained CoGAN can adapt the input noise vector to paired images that are from the two distributions and share the labels. Therefore, the shared labels of synthetic target samples can be used to train the target model. (14) +Ez∼pz (z) [log(1 − D(G(z)))] In DA, this principle has been employed to ensure that the network cannot distinguish between the source and target domains. [96] proposed a unified framework for adversarial-based approaches and summarized the existing approaches according to whether to use a generator, which loss function to employ, or whether to share weights across domains. In this paper, we only categorize the adversarialbased approaches into two subsettings: generative models and non-generative models. • Generative Models Synthetic target data with ground-truth annotations are an appealing alternative to address the problem of a lack of training data. First, with the help of source data, generators render unlimited quantities of synthetic target data, which are paired with synthetic source data to share labels or appear as if they were sampled from the target domain while maintaining labels, or something else. Then, synthetic data Figure 9. The CoGAN architecture. [59] More work focuses on generating synthetic data that 10 are similar to the target data while maintaining annotations. Yoo et al. [106] transferred knowledge from the source domain to pixel-level target images with GANs. A domain discriminator ensures the invariance of content to the source domain, and a real/fake discriminator supervises the generator to produce similar images to the target domain. Shrivastava et al. [82] developed a method for simulated+unsupervised (S+U) learning that uses a combined objective of minimizing an adversarial loss and a selfregularization loss, where the goal is to improve the realism of synthetic images using unlabeled real data. In contrast to other works in which the generator is conditioned only on a noise vector or source images, Bousmalis et al. [3] proposed a model that exploits GANs conditioned on both. The classifier T is trained to predict class labels of both source and synthetic images, while the discriminator is trained to predict the domain labels of target and synthetic images. In addition, to expect synthetic images with similar foregrounds and different backgrounds from the same source images, a content similarity is used that penalizes large differences between source and synthetic images for foreground pixels only by a masked pairwise mean squared error [17]. The goal of the network is to learn G, D and T by solving the optimization problem: ters of the target model are initialized by the pre-trained source one. This is more flexible because of allowing more domain-specific feature extractions to be learned. ADDA minimizes the source and target representation distances through iteratively minimizing these following functions, which is most similar to the original GAN: min Lcls (X s , Y s ) = M s ,C −E (xs ,y s )∼(X s ,Y s ) D 1[k=ys ] log C(M s (xs )) k=1 min LadvD (X s ,X t , M s , M t ) = D − E(xs )∼(X s ) [log D(M s (xs ))] − E(xt )∼(X t ) [log(1 − D(M t (xt )))] min LadvM (M s , M t ) = M s ,M t − E(xt )∼(X t ) [log D(M t (xt ))] (16) where the mappings M s and M t are learned from the source and target data, X s and X t . C represents a classifier working on the source domain. The first classification loss function Lcls is optimized by training the source model using the labeled source data. The second function LadvD is minimized to train the discriminator, while the third function LadvM is learning a representation that is domain invariant. Tzeng et al. [95] proposed adding an additional domain classification layer that performs binary domain classification and designed a domain confusion loss to encourage its prediction to be as close as possible to a uniform distribution over binary labels. Unlike previous methods that match the entire source and target domains, Cao et al. introduced a selective adversarial network (SAN) [6] to address partial transfer learning from large domains to small domains, which assumes that the target label space is a subspace of the source label space. It simultaneously avoids negative transfer by filtering out outlier source classes, and it promotes positive transfer by matching the data distributions in the shared label space via splitting the domain discriminator into many class-wise domain discriminators. min max V (D, G) = αLd (D, G) G,T K X (15) +βLt (T, G) + γLc (G) where α, β, and γ are parameters that control the trade-off between the losses. Ld , Lt and Lc are the adversarial loss, softmax loss and content-similarity loss, respectively. • Non-Generative Models The key of deep DA is learning domain-invariant representations from source and target samples. With these representations, the distribution of both domains can be similar enough such that the classifier is fooled and can be directly used in the target domain even if it is trained on source samples. Therefore, whether the representations are domainconfused or not is crucial to transferring knowledge. Inspired by GAN, domain confusion loss, which is produced by the discriminator, is introduced to improve the performance of deep DA without generators. The domain-adversarial neural network (DANN) [18] integrates a gradient reversal layer (GRL) into the standard architecture to ensure that the feature distributions over the two domains are made similar. The network consists of shared feature extraction layers and two classifiers. DANN minimizes the domain confusion loss (for all samples) and label prediction loss (for source samples) while maximizing domain confusion loss via the use of the GRL. In contrast to the above methods, the adversarial discriminative domain adaptation (ADDA) [96] considers independent source and target mappings by untying the weights, and the parame- 4.1.3 Reconstruction-Based Approaches In DA, the data reconstruction of source or target samples is an auxiliary task that simultaneously focuses on creating a shared representation between the two domains and keeping the individual characteristics of each domain. • Encoder-Decoder Reconstruction The basic autoencoder framework [1] is a feedforward neural network that includes the encoding and decoding processes. The autoencoder first encodes an input to some 11 Figure 10. The model that exploits GANs conditioned on noise vector and source images. [3] proposed in [26] learns a shared encoding representation that provides useful information for cross-domain object recognition. DRCN is a CNN architecture that combines two pipelines with a shared encoder. After a representation is provided by the encoder, the first pipeline, which is a CNN, works for supervised classification with source labels, whereas the second pipeline, which is a deconvolutional network, optimizes for unsupervised reconstruction with target data. min λLc ({θenc , θlab }) + (1 − λ)Lr ({θenc , θdec }) (17) Figure 11. The domain-adversarial neural network (DANN) architecture. [18] where λ is a hyper-parameter that controls the trade-off between classification and reconstruction. θenc , θdec and θlab denote the parameters of the encoder, decoder and source classifier, respectively. Lc is cross-entropy loss for classi2 fication, and Lr is squared loss k x − fr (x) k2 for reconstruction in which fr (x) is the reconstruction of x. Domain separation networks (DSNs) [4] explicitly and jointly model both private and shared components of the domain representations. A shared-weight encoder learns to capture shared representations, while a private encoder is used for domain-specific components in each domain. Additionally, a shared decoder learns to reconstruct the input samples by both the private and shared representations. Then, a classifier is trained on the shared representation. By partitioning the space in such a manner, the shared representations will not be influenced by domain-specific representations such that a better transfer ability can be obtained. Zhuang et al. [114] proposed transfer learning with deep autoencoders (TLDA), which consists of two encoding layers. The distance in distributions between domains is minimized with KL divergence in the embedding encoding layer, and label information of the source domain is encoded using a softmax loss in the label encoding layer. Ghifary et al. [24] extended the autoencoder into a model that jointly hidden representation, and then it decodes this hidden representation back to a reconstructed version. The DA approaches based on encoder-decoder reconstruction typically learn the domain-invariant representation by a shared encoder and maintain the domain-special representation by a reconstruction loss in the source and target domains. Xavier and Bengio [29] proposed extracting a high-level representation based on stacked denoising autoencoders (SDA) [99]. By reconstructing the union of data from various domains with the same network, the high-level representations can represent both the source and target domain data. Thus, a linear classifier that is trained on the labeled data of the source domain can make predictions on the target domain data with these representations. Despite their remarkable results, SDAs are limited by their high computational cost and lack of scalability to high-dimensional features. To address these crucial limitations, Chen et al. [7] proposed the marginalized SDA (mSDA), which marginalizes noise with linear denoisers; thus, parameters can be computed in closed-form and do not require stochastic gradient descent. The deep reconstruction classification network (DRCN) 12 Figure 12. The Adversarial discriminative domain adaptation (ADDA) architecture. [96] Figure 13. The deep reconstruction classification network (DRCN) architecture. [26] or G(Y ) ≈ X) by an adversarial loss and how well the original input is reconstructed after a sequence of two generations (F (G(X)) ≈ X or G(F (Y )) ≈ Y ) by a cycle consistency loss (reconstruction loss). Thus, the distribution of images from G(X) (or F (Y )) is indistinguishable from the distribution Y (or X). learns two types of data-reconstruction tasks taken from related domains: one is self-domain reconstruction, and the other is between-domain reconstruction. • Adversarial Reconstruction Dual learning was first proposed by Xia et al. [35] to reduce the requirement of labeled data in natural language processing. Dual learning trains two ”opposite” language translators, e.g., A-to-B and B-to-A. The two translators represent a primal-dual pair that evaluates how likely the translated sentences belong to the targeted language, and the closed loop measures the disparity between the reconstructed and the original ones. Inspired by dual learning, adversarial reconstruction is adopted in deep DA with the help of dual GANs. Zhu et al. [113] proposed a cycle GAN that can translate the characteristics of one image domain into the other in the absence of any paired training examples. Compared to dual learning, cycle GAN uses two generators rather than translators, which learn a mapping G : X → Y and an inverse mapping F : Y → X. Two discriminators, DX and DY , measure how realistic the generated image is (G(X) ≈ Y LGAN (G, DY , X, Y ) = Ey∼pdata (y) [log DY (y)] +Ex∼pdata (x) [log(1 − DY (G(x)))] Lcyc (G, F ) = Ex∼data(x) [kF (G(x)) − xk1 ] +Ey∼data(y) [kG(F (y)) − yk1 ] (18) where LGAN is the adversarial loss produced by discriminator DY with mapping function G : X → Y . Lcyc is the reconstruction loss using L1 norm. The dual GAN [105] and the disco GAN [50] were proposed at the same time, where the core idea is similar to cycle GAN. In dual GAN, the generator is configured with skip connections between mirrored downsampling and upsampling layers [76, 48], making it a U-shaped net to share low-level information (e.g., object shapes, textures, clutter, 13 Figure 14. The cycle GAN architecture. [113] and so forth). For discriminators, the Markovian patchGAN [55] architecture is employed to capture local highfrequency information. In disco GAN, various forms of distance functions, such as mean-square error (MSE), cosine distance, and hinge loss, can be used as the reconstruction loss, and the network is applied to translate images, changing specified attributes including hair color, gender and orientation while maintaining all other components. clearly be crawled as intermediate domain data. With the common sense that nighttime light intensities can be used as a proxy for economic activity, Xie et al. [103] transferred knowledge from daytime satellite imagery to poverty prediction with the help of some nighttime light intensity information as an intermediate domain. 4.2.2 Instance-Based Approaches In other problems where there are many candidate intermediate domains, some automatic selection criterion should be considered. Similar to the instance-transfer approaches proposed by Pan [67], because the samples of the source domain cannot be used directly, the mixture of certain parts of the source and target data can be useful for constructing the intermediate domain. Tan et al. [92] proposed distant domain transfer learning (DDTL), where long-distance domains fail to transfer knowledge by only one intermediate domain but can be related via multiple intermediate domains. DDTL gradually selects unlabeled data from the intermediate domains by minimizing reconstruction errors on the selected instances in the source and intermediate domains and all the instances in the target domain simultaneously. With removal of the unrelated source data, the selected intermediate domains gradually become closer to the target domain from the source domain: 4.1.4 Hybrid Approaches To obtain better performance, some of the aforementioned methods have been used simultaneously. [95] combined a domain confusion loss and a soft label loss, while [63] used both statistic (MMD) and architecture criteria (adapt classifier by residual function) for unsupervised DA. [104] introduced class-specific auxiliary weights assigned by the pseudo-labels into the original MMD. In DSNs [4], encoder-decoder reconstruction approaches separate representations into private and shared representations, while the MMD criterion or domain confusion loss is helpful to make the shared representations similar and soft subspace orthogonality constraints ensure dissimilarity between the private and shared representations. [78] used the MMD between the learned source and target representations and also allowed the weights of the corresponding layers to differ. [114] learned domain-invariant representations by encoderdecoder reconstruction approaches and the KL divergence. J1 (fe , fd , vS , vT ) = 4.2. Multi-Step Domain Adaption For multi-step DA, the selection of the intermediate domain is problem specific, and different problems may have different strategies. 4.2.1 Hand-Crafted Approaches nS 1 X v i x̂i − xiS nS i=1 S S + nI 1 X v i x̂i − xiI nI i=1 I I + nT 1 X x̂i − xiT nT i=1 T 2 2 2 2 2 2 + R(vS , vT ) (19) Occasionally, the intermediate domain can be selected by experience, that is, it is decided in advance. For example, when the source domain is image data and the target domain is composed of text data, some annotated images will where x̂iS , x̂iT and x̂iI are reconstructions of source data S i , target data T i and intermediate data I i based on the autoencoder, respectively, and fe and fd are the parameters of the 14 ⊤ encoder and decoder, respectively. vS = (vS1 , ..., vSnS ) and ⊤ vI = (vI1 , ..., vInI ) , vSi , vIi ∈ 0, 1 are selection indicators for the ith source and intermediate instance, respectively. R(vS , vT ) is a regularization term that avoids all values of vS and vI being zero. The DLID model [10] mentioned in Section 4.1.1 (Geometric Criterion) constructs the intermediate domains with a subset of the source and target domains, where source samples are gradually replaced by target samples. from the text domain to the image domain. DTNs take paired data, such as text and image, as input to two SAEs, followed by weakly parameter-shared network layers at the top, which were mentioned in the architecture criterion of Section 4.1.1. Chen et al. [8] proposed transfer neural trees (TNTs), which consist of two stream networks to learn a domain-invariant feature representation for each modality. Then, a transfer neural decision forest (Transfer-NDF) [77, 52] is used with stochastic pruning for adapting representative neurons in the prediction layer. 4.2.3 Representation-Based Approaches 6. Application of Deep Domain Adaption Representation-based approaches freeze the previously trained network and use their intermediate representations as input to the new network. Rusu et al. [79] introduced progressive networks that have the ability to accumulate and transfer knowledge to new domains over a sequence of experiences. To avoid the target model losing its ability to solve the source domain, they constructed a new neural network for each domain, while transfer is enabled via lateral connections to features of previously learned networks. In the process, the parameters in the latest network are frozen to remember knowledge of intermediate domains. Deep DA techniques have recently been successfully applied in many real-world applications, including image classification, object recognition, face recognition, object detection, style translation, and so forth. In this section, we present different application examples using various visual deep DA methods. Because the information of commonly used datasets for evaluating the performance is provided in [109] in detail, we do not introduce it in this paper. 6.1. Image Classification Because image classification is a basic task of computer vision applications, most of the algorithms mentioned above were originally proposed to solve such problems. Therefore, we do not discuss this application repeatedly, but we show how much benefit deep DA methods for image classification can bring. Because different papers often use different parameters, experimental protocols and tuning strategies in the preprocessing steps, it is quite difficult to perform a fair comparison among all the methods directly. Thus, similar to the work of Pan [67], we show the comparison results between the proposed deep DA methods and non-adaption methods using only deep networks. A list of simple experiments taken from some published deep DA papers are presented in Table 5. In [62], [108], and [95], the authors used the Office31 dataset1 as one of the evaluation data sets, as shown in Fig. 1(a). The Office dataset is a computer vision classification data set with images from three distinct domains: Amazon (A), DSLR (D), and Webcam (W). The largest domain, Amazon, has 2817 labeled images and its corresponding 31 classes, which consist of objects commonly encountered in office settings. By using this dataset, previous works can show the performance of methods across all six possible DA tasks. [62] showed comparison experiments among the standard AlexNet [53], the DANN method [18], and the MMD algorithm and its variations, such as DDC [97], DAN [61], JAN [62] and RTN [63]. Zellinger et al. [108] evaluated their proposed CMD algorithm in comparison to other discrepancy-based methods (DDC, deep Figure 15. The progressive network architecture. [79] 5. Heterogeneous Domain Adaption In heterogeneous DA, the feature spaces of the source and target domains are not the same, Xs 6= Xt, and the dimensions of the feature spaces may also differ. Most heterogeneous DA with shallow methods fall into two categories: the first learns feature transformations to project the source and target features onto a common subspace, and the second transforms one of them to align with the other. However, for deep methods, the network generally shares or reuses the first n layers between the source and target domains, which limits the feature spaces of the input to the same dimension. Therefore, little work focuses on heterogeneous DA with deep methods. [83] proposed weakly shared DTNs to transfer labeled information across heterogeneous domains, particularly 1 15 https://cs.stanford.edu/∼jhoffman/domainadapt/ Table 5. Comparison between Transfer Learning and Non-Adaption Learning Methods Data Set (reference) Source vs. Target Office-31 Dataset ACC (unit:%)[62] Office-31 Dataset ACC (unit:%)[108] Office-31 Dataset ACC (unit:%)[95] MNIST, USPS, and SVHN digits datasets ACC (unit:%)[96] A vs. W D vs. W W vs. D A vs. D D vs. A W vs. A Avg A vs. W D vs. W W vs. D A vs. D D vs. A W vs. A Avg A vs. W D vs. W W vs. D A vs. D D vs. A W vs. A Avg M vs. U U vs. M S vs. M Baselines Deep Domain Adaption Methods AlexNet 61.6±0.5 95.4±0.3 99.0±0.2 63.8±0.5 51.1±0.6 49.8±0.4 70.1 AlexNet 61.6 95.4 99.0 63.8 51.1 49.8 70.1 DDC 61.8±0.4 95.0±0.5 98.5±0.4 64.4±0.3 52.1±0.6 52.2±0.4 70.6 Deep CORAL 66.4 95.7 99.2 66.8 52.8 51.5 72.1 DAN 68.5 96.0±0.3 99.0±0.3 67.0±0.4 54.0±0.5 53.1±0.5 72.9 CMD 77.0±0.6 96.3±0.4 99.2±0.2 79.6±0.6 63.8±0.7 63.3±0.6 79.9 RTN 73.3±0.3 96.8±0.2 99.6±0.1 71.0±0.2 50.5±0.3 51.0±0.1 73.7 DLID 51.9 78.2 89.9 - AlexNet DLID DANN Soft Labels 56.5±0.3 92.4±0.3 93.6±0.2 64.6±0.4 47.6±0.1 42.7±0.1 66.2 VGG-16 75.2±1.6 57.1±1.7 60.1±1.1 51.9 78.2 89.9 DANN 77.1±1.8 73.0±2.0 73.9 53.6±0.2 71.2±0.0 83.5±0.0 CoGAN 91.2±0.8 89.1±0.8 - 82.7±0.7 95.9±0.6 98.3±0.3 84.9±1.2 66.0±0.5 65.2±0.6 82.17 ADDA 89.4±0.2 90.1±0.8 76.0±1.8 DANN 73.0±0.5 96.4±0.3 99.2±0.3 72.3±0.3 53.4±0.4 51.2±0.5 74.3 DANN 73 96.4 99.2 Confusion +Soft 82.7±0.8 95.7±0.5 97.6±0.2 86.1±1.2 66.2±0.3 65.0±0.5 82.22 be caused by poses, resolution, illuminations, expressions, and modality. Kan et al. [49] proposed a bi-shifting autoencoder network (BAE) for face recognition across view angle, ethnicity, and imaging sensor. In BAE, source domain samples are shifted to the target domain, and sparse reconstruction is used with several local neighbors from the target domain to ensure its correction, and vice versa. Single sample per person domain adaptation network (SSPPDAN) in [43] generates synthetic images with varying poses to increase the number of samples in the source domain and bridges the gap between the synthetic and source domains by adversarial training with a GRL in real-world face recognition. [85] improved the performance of video face recognition by using an adversarial-based approach with largescale unlabeled videos, labeled still images and synthesized images. Considering that age variations are difficult problems for smile detection and that networks trained on the current benchmarks do not perform well on young children, Xia et al. [101] applied DAN [61] and JAN [62] (mentioned CROAL [87], DLID [10], AdaBN [58]) and the adversarialbased method DANN. [95] proposed an algorithm combining soft label loss and domain confusion loss, and they also compared them with DANN and DLID under a supervised DA setting. In [96], MNIST2 (M), USPS3 (U), and SVHN4 (S) digit datasets (shown in Fig. 1(b)) are used for a cross-domain hand-written digit recognition task, and the experiment showed the comparison results on some adversarial-based methods, such as DANN, CoGAN [59] and ADDA [96], where the baseline is VGG-16 [84]. 6.2. Face Recognition The performance of face recognition significantly degrades when there are variations in the test images that are not present in the training images. The dataset shift can 2 JAN 75.2±0.4 96.6±0.2 99.6±0.1 72.8±0.3 57.5±0.2 56.3±0.2 76.3 AdaBN 74.2 95.7 99.8 73.1 59.8 57.4 76.7 Domain Confusion 82.8±0.9 95.6±0.4 97.5±0.2 85.9±1.1 66.2±0.4 64.9±0.5 82.13 http://yann.lecun.com/exdb/mnist/ 3 http://statweb.stanford.edu/∼tibs/ElemStatLearn/data.html 4 http://ufldl.stanford.edu/housenumbers/ 16 in Section 4.1.1) to two baseline deep models, i.e., AlexNet and ResNet, to transfer the knowledge from adults to infants. ages with the help of virtual ones. It uses the global label distribution loss of the images and local label distribution loss of the landmark superpixels in the target domain to effectively regularize the fine-tuning of the semantic segmentation network. Chen et al. [9] proposed a framework for cross-city semantic segmentation. The framework assigns pseudo labels to pixels/grids in the target domain and jointly utilizes global and class-wise alignment by domain adversarial learning to minimize domain shift. 6.3. Object Detection Recent advances in object detection are driven by regionbased convolutional neural networks (R-CNNs [28], fast RCNNs [27] and faster R-CNNs [74]). They are composed of a window selection mechanism and classifiers that are pre-trained labeled bounding boxes by using the features extracted from CNNs. At test time, the classifier decides whether a region obtained by sliding windows contains the object. Although the R-CNN algorithm is effective, a large amount of bounding box labeled data is required to train each detection category. To solve the problem of lacking labeled data, considering the window selection mechanism as being domain independent, deep DA methods can be used in classifiers to adapt to the target domain. Because R-CNNs train classifiers on regions just like classification, weak labeled data (such as image-level class labels) are directly useful for the detector. Most works learn the detector with limited bounding box labeled data and massive weak labeled data. The large-scale detection through adaptation (LSDA) [39] trains a classification layer for the target domain and then uses a pre-trained source model along with output layer adaptation techniques to update the target classification parameters directly. Rochan et al. [75] used word vectors to establish the semantic relatedness between weak labeled source objects and target objects and then transferred the bounding box labeled information from source objects to target objects based on their relatedness. Extending [39] and [75], Tang et al. [93] transferred visual (based on the LSDA model) and semantic similarity (based on work vectors) for training an object detector on weak labeled category. 6.5. Image-to-Image Translation Image-to-image translation has recently achieved great success with deep DA, and it has been applied to various tasks, such as style transferring and generating photographs from sketches or from attribute and semantic layouts. More approaches of image-to-image translation use a dataset of paired images and incorporate a DA algorithm into generative networks. Isola et al. [48] proposed the pix2pix framework, which uses a conditional GAN to learn a mapping from source to target images. Tzeng et al. [94] utilized domain confusion loss and pairwise loss to adapt from simulation to real-world data in a PR2 robot. However, several other methods also address the unpaired setting, such as CoGAN [59], cycle GAN [113], dual GAN [105] and disco GAN [50]. [89] employs a compound loss function that consists of a multiclass GAN loss, a regularizing component and an f-constancy component to transfer unlabeled face images to emoji images. Matching the statistical distribution by fine-tuning a deep network is another way to achieve image-to-image translation. Gatys et al. [20] fine-tuned the CNN to achieve DA by the total loss, which is a linear combination between the content and the style loss, such that the target image is rendered in the style of the source image maintaining the content. The content loss minimizes the mean squared difference of the feature representation between the original image and generated image in higher layers, while the style loss minimizes the element-wise mean squared difference between the Gram matrix of them on each layer. [57] demonstrated that matching the Gram matrices of feature maps is equivalent to minimizing the MMD. Rather than MMD, [71] proposed a deep generative correlation alignment network (DGCAN) that bridges the domain discrepancy between CAD synthetic and real images by applying the content and CORAL losses to different layers. 6.4. Semantic Segmentation Fully convolutional network models (FCNs) for dense prediction have proven to be successful for evaluating semantic segmentation, but their performance will also degrade under domain shifts. Therefore, some work has also explored using weak labels to improve the performance of semantic segmentation. Hong et al. [44] used a novel encoder-decoder architecture with attention model by transferring weak class labeled knowledge in the source domain, while [51, 81] transferred weak object location knowledge. Limited attention has also been given to deep unsupervised DA in semantic segmentation. Hoffman et al. [42] first introduced it, in which global domain alignment is performed using FCNs with adversarial-based training, while transferring spatial layout is achieved by leveraging classaware constrained multiple instance loss. Zhang et al. [112] enhanced the segmentation performance on real im- 6.6. Person Re-identification In the community, person re-identification (re-ID) has become increasingly popular. When given video sequences of a person, person re-ID recognizes whether this person has been in another camera to compensate for the limitations of fixed devices. Recently, deep DA methods have been used in re-ID when models trained on one dataset are 17 Figure 16. The single sample per person domain adaptation network (SSPP-DAN) architecture. [43] tasks. Deep DA is classified as homogeneous DA and heterogeneous DA, and it can be further divided into supervised, semi-supervised and unsupervised settings. The first setting is the simplest but is generally limited due to the need for labeled data; thus, most previous works focused on unsupervised cases. Semi-supervised deep DA is a hybrid method that combines the methods of the supervised and unsupervised settings. Furthermore, the approaches of deep DA can be classified into one-step DA and multi-step DA considering the distance of the source and target domains. When the distance is small, one-step DA can be used based on training loss. It consists of the discrepancy-based approach, the adversarial-based approach, and the reconstruction-based approach. When the source and target domains are not directly related, multi-step (or transitive) DA can be used. The key of multi-step DA is to select and utilize intermediate domains, thus falling into three categories, including hand-crafted, feature-based and representation-based selection mechanisms. In addition, the network of deep DA generally shares or reuses the first n layers between the source and target domains, which limits the feature spaces of the input to the same dimension. Therefore, most existing algorithms focus on homogeneous deep DA, which assumes that the feature spaces between the source and target domains are the same. However, this assumption may not be true in many applications. We expect to transfer knowledge without this severe limitation and take advantage of existing datasets to help with more tasks. Heterogeneous deep DA may attract increasingly more attention in the future. Finally, deep DA techniques have been successfully applied in many real-world applications, including image classification, face recognition, and style translation. We have also found that only a few papers address adaptation beyond classification and recognition, such as object detection, semantic segmentation and person re-identification. How to Figure 17. The architecture of pixel-level adversarial and constraint-based adaptation. [42] directly used on another. Xiao et al. [102] proposed the domain-guided dropout algorithm to discard useless neurons for re-identifying persons on multiple datasets simultaneously. Inspired by cycle GAN and Siamese network, the similarity preserving generative adversarial network (SPGAN) [15] translates the labeled source image to the target domain, preserving self similarity and domain-dissimilarity in an unsupervised manner, and then it trains re-ID models with the translated images using supervised feature learning methods. 7. Conclusion In a broad sense, deep DA is utilizing deep networks to enhance the performance of DA, such as shallow DA methods with features extracted by deep networks. In a narrow sense, deep DA is based on deep learning architectures designed for DA and optimized by back propagation. In this survey paper, we focus on this narrow definition, and we have reviewed deep DA techniques on visual categorization 18 achieve these tasks with no or a very limited amount of data is probably one of the main challenges that should be addressed by deep DA in the next few years. [13] G. Csurka. Domain adaptation for visual applications: A comprehensive survey. arXiv preprint arXiv:1702.05374, 2017. [14] O. Day and T. M. Khoshgoftaar. A survey on heterogeneous transfer learning. Journal of Big Data, 4(1):29, 2017. [15] W. Deng, L. Zheng, G. Kang, Y. Yang, Q. Ye, and J. Jiao. Image-image domain adaptation with preserved self-similarity and domain-dissimilarity for person reidentification. arXiv preprint arXiv:1711.07027, 2017. [16] J. Donahue, Y. Jia, O. Vinyals, J. Hoffman, N. Zhang, E. Tzeng, and T. Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning, pages 647–655, 2014. [17] D. Eigen, C. Puhrsch, and R. Fergus. Depth map prediction from a single image using a multi-scale deep network. In Advances in neural information processing systems, pages 2366–2374, 2014. [18] Y. Ganin and V. Lempitsky. Unsupervised domain adaptation by backpropagation. In International Conference on Machine Learning, pages 1180–1189, 2015. [19] Y. Ganin, E. Ustinova, H. Ajakan, P. Germain, H. Larochelle, F. Laviolette, M. Marchand, and V. Lempitsky. Domain-adversarial training of neural networks. Journal of Machine Learning Research, 17(59):1–35, 2016. [20] L. A. Gatys, A. S. Ecker, and M. Bethge. Image style transfer using convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2414–2423, 2016. [21] W. Ge and Y. Yu. Borrowing treasures from the wealthy: Deep transfer learning through selective joint fine-tuning. arXiv preprint arXiv:1702.08690, 2017. [22] T. Gebru, J. Hoffman, and L. Fei-Fei. Fine-grained recognition in the wild: A multi-task domain adaptation approach. arXiv preprint arXiv:1709.02476, 2017. [23] M. Gheisari and M. S. Baghshah. Unsupervised domain adaptation via representation learning and adaptive classifier learning. Neurocomputing, 165:300–311, 2015. [24] M. Ghifary, W. Bastiaan Kleijn, M. Zhang, and D. Balduzzi. Domain generalization for object recognition with multi-task autoencoders. In Proceedings of the IEEE international conference on computer vision, pages 2551–2559, 2015. [25] M. Ghifary, W. B. Kleijn, and M. Zhang. Domain adaptive neural networks for object recognition. In Pacific Rim International Conference on Artificial Intelligence, pages 898–904. Springer, 2014. [26] M. Ghifary, W. B. Kleijn, M. Zhang, D. Balduzzi, and W. Li. Deep reconstruction-classification networks for unsupervised domain adaptation. In European Conference on Computer Vision, pages 597–613. Springer, 2016. [27] R. Girshick. Fast r-cnn. In Proceedings of the IEEE international conference on computer vision, pages 1440–1448, 2015. [28] R. Girshick, J. Donahue, T. Darrell, and J. Malik. Rich feature hierarchies for accurate object detection and semantic 8. Acknowledgements This work was partially supported by the National Natural Science Foundation of China under Grant Nos. 61573068, 61471048, and 61375031, and Beijing Nova Program under Grant No. Z161100004916088. References [1] Y. Bengio. Learning deep architectures for ai. Foundations and Trends in Machine Learning, 2(1):1–127, 2009. [2] K. M. Borgwardt, A. Gretton, M. J. Rasch, H.-P. Kriegel, B. Schölkopf, and A. J. Smola. Integrating structured biological data by kernel maximum mean discrepancy. Bioinformatics, 22(14):e49–e57, 2006. [3] K. Bousmalis, N. Silberman, D. Dohan, D. Erhan, and D. Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. arXiv preprint arXiv:1612.05424, 2016. [4] K. Bousmalis, G. Trigeorgis, N. Silberman, D. Krishnan, and D. Erhan. Domain separation networks. In Advances in Neural Information Processing Systems, pages 343–351, 2016. [5] L. Bruzzone and M. Marconcini. Domain adaptation problems: A dasvm classification technique and a circular validation strategy. IEEE transactions on pattern analysis and machine intelligence, 32(5):770–787, 2010. [6] Z. Cao, M. Long, J. Wang, and M. I. Jordan. Partial transfer learning with selective adversarial networks. arXiv preprint arXiv:1707.07901, 2017. [7] M. Chen, Z. Xu, K. Weinberger, and F. Sha. Marginalized denoising autoencoders for domain adaptation. arXiv preprint arXiv:1206.4683, 2012. [8] W.-Y. Chen, T.-M. H. Hsu, Y.-H. H. Tsai, Y.-C. F. Wang, and M.-S. Chen. Transfer neural trees for heterogeneous domain adaptation. In European Conference on Computer Vision, pages 399–414. Springer, 2016. [9] Y.-H. Chen, W.-Y. Chen, Y.-T. Chen, B.-C. Tsai, Y.-C. F. Wang, and M. Sun. No more discrimination: Cross city adaptation of road scene segmenters. arXiv preprint arXiv:1704.08509, 2017. [10] S. Chopra, S. Balakrishnan, and R. Gopalan. Dlid: Deep learning for domain adaptation by interpolating between domains. In ICML workshop on challenges in representation learning, volume 2, 2013. [11] B. Chu, V. Madhavan, O. Beijbom, J. Hoffman, and T. Darrell. Best practices for fine-tuning visual classifiers to new domains. In Computer Vision–ECCV 2016 Workshops, pages 435–442. Springer, 2016. [12] W.-S. Chu, F. De la Torre, and J. F. Cohn. Selective transfer machine for personalized facial action unit detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3515–3522, 2013. 19 [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] S. Hong, W. Im, J. Ryu, and H. S. Yang. Sspp-dan: Deep domain adaptation network for face recognition with single sample per person. arXiv preprint arXiv:1702.04069, 2017. [44] S. Hong, J. Oh, H. Lee, and B. Han. Learning transferrable knowledge for semantic segmentation with deep convolutional neural network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3204–3212, 2016. [45] J. Hu, J. Lu, and Y.-P. Tan. Deep transfer metric learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 325–333, 2015. [46] X. Huang and S. Belongie. Arbitrary style transfer in realtime with adaptive instance normalization. arXiv preprint arXiv:1703.06868, 2017. [47] S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pages 448–456, 2015. [48] P. Isola, J.-Y. Zhu, T. Zhou, and A. A. Efros. Imageto-image translation with conditional adversarial networks. arXiv preprint arXiv:1611.07004, 2016. [49] M. Kan, S. Shan, and X. Chen. Bi-shifting auto-encoder for unsupervised domain adaptation. In Proceedings of the IEEE International Conference on Computer Vision, pages 3846–3854, 2015. [50] T. Kim, M. Cha, H. Kim, J. Lee, and J. Kim. Learning to discover cross-domain relations with generative adversarial networks. arXiv preprint arXiv:1703.05192, 2017. [51] A. Kolesnikov and C. H. Lampert. Seed, expand and constrain: Three principles for weakly-supervised image segmentation. In European Conference on Computer Vision, pages 695–711. Springer, 2016. [52] P. Kontschieder, M. Fiterau, A. Criminisi, and S. Rota Bulo. Deep neural decision forests. In Proceedings of the IEEE International Conference on Computer Vision, pages 1467– 1475, 2015. [53] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages 1097–1105, 2012. [54] C. H. Lampert, H. Nickisch, and S. Harmeling. Learning to detect unseen object classes by between-class attribute transfer. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pages 951– 958. IEEE, 2009. [55] C. Li and M. Wand. Precomputed real-time texture synthesis with markovian generative adversarial networks. In European Conference on Computer Vision, pages 702–716. Springer, 2016. [56] Y. Li, K. Swersky, and R. Zemel. Generative moment matching networks. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pages 1718–1727, 2015. [57] Y. Li, N. Wang, J. Liu, and X. Hou. Demystifying neural style transfer. arXiv preprint arXiv:1701.01036, 2017. [58] Y. Li, N. Wang, J. Shi, J. Liu, and X. Hou. Revisiting batch normalization for practical domain adaptation. arXiv preprint arXiv:1603.04779, 2016. segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 580–587, 2014. X. Glorot, A. Bordes, and Y. Bengio. Domain adaptation for large-scale sentiment classification: A deep learning approach. In Proceedings of the 28th international conference on machine learning (ICML-11), pages 513–520, 2011. B. Gong, K. Grauman, and F. Sha. Connecting the dots with landmarks: Discriminatively learning domaininvariant features for unsupervised domain adaptation. In International Conference on Machine Learning, pages 222–230, 2013. B. Gong, Y. Shi, F. Sha, and K. Grauman. Geodesic flow kernel for unsupervised domain adaptation. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pages 2066–2073. IEEE, 2012. I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial nets. In Advances in neural information processing systems, pages 2672–2680, 2014. R. Gopalan, R. Li, and R. Chellappa. Domain adaptation for object recognition: An unsupervised approach. In Computer Vision (ICCV), 2011 IEEE International Conference on, pages 999–1006. IEEE, 2011. S. Gupta, J. Hoffman, and J. Malik. Cross modal distillation for supervision transfer. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2827–2836, 2016. D. He, Y. Xia, T. Qin, L. Wang, N. Yu, T. Liu, and W.-Y. Ma. Dual learning for machine translation. In Advances in Neural Information Processing Systems, pages 820–828, 2016. K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016. G. Hinton, O. Vinyals, and J. Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. G. E. Hinton, S. Osindero, and Y.-W. Teh. A fast learning algorithm for deep belief nets. Neural computation, 18(7):1527–1554, 2006. J. Hoffman, S. Guadarrama, E. S. Tzeng, R. Hu, J. Donahue, R. Girshick, T. Darrell, and K. Saenko. Lsda: Large scale detection through adaptation. In Advances in Neural Information Processing Systems, pages 3536–3544, 2014. J. Hoffman, S. Gupta, J. Leong, S. Guadarrama, and T. Darrell. Cross-modal adaptation for rgb-d detection. In Robotics and Automation (ICRA), 2016 IEEE International Conference on, pages 5032–5039. IEEE, 2016. J. Hoffman, E. Tzeng, J. Donahue, Y. Jia, K. Saenko, and T. Darrell. One-shot adaptation of supervised deep convolutional models. arXiv preprint arXiv:1312.6204, 2013. J. Hoffman, D. Wang, F. Yu, and T. Darrell. Fcns in the wild: Pixel-level adversarial and constraint-based adaptation. arXiv preprint arXiv:1612.02649, 2016. 20 [76] O. Ronneberger, P. Fischer, and T. Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 234–241. Springer, 2015. [77] S. Rota Bulo and P. Kontschieder. Neural decision forests for semantic image labelling. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 81–88, 2014. [78] A. Rozantsev, M. Salzmann, and P. Fua. Beyond sharing weights for deep domain adaptation. arXiv preprint arXiv:1603.06432, 2016. [79] A. A. Rusu, N. C. Rabinowitz, G. Desjardins, H. Soyer, J. Kirkpatrick, K. Kavukcuoglu, R. Pascanu, and R. Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016. [80] L. Shao, F. Zhu, and X. Li. Transfer learning for visual categorization: A survey. IEEE transactions on neural networks and learning systems, 26(5):1019–1034, 2015. [81] W. Shimoda and K. Yanai. Distinct class-specific saliency maps for weakly supervised semantic segmentation. In European Conference on Computer Vision, pages 218–234. Springer, 2016. [82] A. Shrivastava, T. Pfister, O. Tuzel, J. Susskind, W. Wang, and R. Webb. Learning from simulated and unsupervised images through adversarial training. arXiv preprint arXiv:1612.07828, 2016. [83] X. Shu, G.-J. Qi, J. Tang, and J. Wang. Weakly-shared deep transfer networks for heterogeneous-domain knowledge propagation. In Proceedings of the 23rd ACM international conference on Multimedia, pages 35–44. ACM, 2015. [84] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. [85] K. Sohn, S. Liu, G. Zhong, X. Yu, M.-H. Yang, and M. Chandraker. Unsupervised domain adaptation for face recognition in unlabeled videos. arXiv preprint arXiv:1708.02191, 2017. [86] B. Sun, J. Feng, and K. Saenko. Return of frustratingly easy domain adaptation. In AAAI, volume 6, page 8, 2016. [87] B. Sun and K. Saenko. Deep coral: Correlation alignment for deep domain adaptation. In Computer Vision–ECCV 2016 Workshops, pages 443–450. Springer, 2016. [88] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9, 2015. [89] Y. Taigman, A. Polyak, and L. Wolf. Unsupervised cross-domain image generation. arXiv preprint arXiv:1611.02200, 2016. [90] Y. Taigman, M. Yang, M. Ranzato, and L. Wolf. Deepface: Closing the gap to human-level performance in face verification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1701–1708, 2014. [59] M.-Y. Liu and O. Tuzel. Coupled generative adversarial networks. In Advances in neural information processing systems, pages 469–477, 2016. [60] W. Liu, Z. Wang, X. Liu, N. Zeng, Y. Liu, and F. E. Alsaadi. A survey of deep neural network architectures and their applications. Neurocomputing, 234:11–26, 2017. [61] M. Long, Y. Cao, J. Wang, and M. Jordan. Learning transferable features with deep adaptation networks. In International Conference on Machine Learning, pages 97–105, 2015. [62] M. Long, J. Wang, and M. I. Jordan. Deep transfer learning with joint adaptation networks. arXiv preprint arXiv:1605.06636, 2016. [63] M. Long, H. Zhu, J. Wang, and M. I. Jordan. Unsupervised domain adaptation with residual transfer networks. In Advances in Neural Information Processing Systems, pages 136–144, 2016. [64] H. V. Nguyen, H. T. Ho, V. M. Patel, and R. Chellappa. Dash-n: Joint hierarchical domain adaptation and feature learning. IEEE Transactions on Image Processing, 24(12):5479–5491, 2015. [65] S. Pachori, A. Deshpande, and S. Raman. Hashing in the zero shot framework with domain adaptation. Neurocomputing, 2017. [66] S. J. Pan, I. W. Tsang, J. T. Kwok, and Q. Yang. Domain adaptation via transfer component analysis. IEEE Transactions on Neural Networks, 22(2):199–210, 2011. [67] S. J. Pan and Q. Yang. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2010. [68] V. M. Patel, R. Gopalan, R. Li, and R. Chellappa. Visual domain adaptation: A survey of recent advances. IEEE signal processing magazine, 32(3):53–69, 2015. [69] K.-C. Peng, Z. Wu, and J. Ernst. Zero-shot deep domain adaptation. arXiv preprint arXiv:1707.01922, 2017. [70] X. Peng, J. Hoffman, X. Y. Stella, and K. Saenko. Fine-tocoarse knowledge transfer for low-res image classification. In Image Processing (ICIP), 2016 IEEE International Conference on, pages 3683–3687. IEEE, 2016. [71] X. Peng and K. Saenko. Synthetic to real adaptation with deep generative correlation alignment networks. arXiv preprint arXiv:1701.05524, 2017. [72] A. Raj, V. P. Namboodiri, and T. Tuytelaars. Subspace alignment based domain adaptation for rcnn detector. arXiv preprint arXiv:1507.05578, 2015. [73] S.-A. Rebuffi, H. Bilen, and A. Vedaldi. Learning multiple visual domains with residual adapters. arXiv preprint arXiv:1705.08045, 2017. [74] S. Ren, K. He, R. Girshick, and J. Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in neural information processing systems, pages 91–99, 2015. [75] M. Rochan and Y. Wang. Weakly supervised localization of novel objects using appearance transfer. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4315–4324, 2015. 21 [106] D. Yoo, N. Kim, S. Park, A. S. Paek, and I. S. Kweon. Pixel-level domain transfer. In European Conference on Computer Vision, pages 517–532. Springer, 2016. [107] J. Yosinski, J. Clune, Y. Bengio, and H. Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pages 3320–3328, 2014. [108] W. Zellinger, T. Grubinger, E. Lughofer, T. Natschläger, and S. Saminger-Platz. Central moment discrepancy (cmd) for domain-invariant representation learning. arXiv preprint arXiv:1702.08811, 2017. [109] J. Zhang, W. Li, and P. Ogunbona. Transfer learning for cross-dataset recognition: A survey. 2017. [110] L. Zhang, Z. He, and Y. Liu. Deep object recognition across domains based on adaptive extreme learning machine. Neurocomputing, 239:194–203, 2017. [111] X. Zhang, F. X. Yu, S.-F. Chang, and S. Wang. Deep transfer network: Unsupervised domain adaptation. arXiv preprint arXiv:1503.00591, 2015. [112] Y. Zhang, P. David, and B. Gong. Curriculum domain adaptation for semantic segmentation of urban scenes. In The IEEE International Conference on Computer Vision (ICCV), volume 2, page 6, 2017. [113] J.-Y. Zhu, T. Park, P. Isola, and A. A. Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. arXiv preprint arXiv:1703.10593, 2017. [114] F. Zhuang, X. Cheng, P. Luo, S. J. Pan, and Q. He. Supervised representation learning: Transfer learning with deep autoencoders. In IJCAI, pages 4119–4125, 2015. [91] B. Tan, Y. Song, E. Zhong, and Q. Yang. Transitive transfer learning. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 1155–1164. ACM, 2015. [92] B. Tan, Y. Zhang, S. J. Pan, and Q. Yang. Distant domain transfer learning. In AAAI, pages 2604–2610, 2017. [93] Y. Tang, J. Wang, B. Gao, E. Dellandréa, R. Gaizauskas, and L. Chen. Large scale semi-supervised object detection using visual and semantic knowledge transfer. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2119–2128, 2016. [94] E. Tzeng, C. Devin, J. Hoffman, C. Finn, P. Abbeel, S. Levine, K. Saenko, and T. Darrell. Adapting deep visuomotor representations with weak pairwise constraints. CoRR, vol. abs/1511.07111, 2015. [95] E. Tzeng, J. Hoffman, T. Darrell, and K. Saenko. Simultaneous deep transfer across domains and tasks. In Proceedings of the IEEE International Conference on Computer Vision, pages 4068–4076, 2015. [96] E. Tzeng, J. Hoffman, K. Saenko, and T. Darrell. Adversarial discriminative domain adaptation. arXiv preprint arXiv:1702.05464, 2017. [97] E. Tzeng, J. Hoffman, N. Zhang, K. Saenko, and T. Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014. [98] D. Ulyanov, A. Vedaldi, and V. Lempitsky. Improved texture networks: Maximizing quality and diversity in feedforward stylization and texture synthesis. arXiv preprint arXiv:1701.02096, 2017. [99] P. Vincent, H. Larochelle, I. Lajoie, Y. Bengio, and P.A. Manzagol. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of Machine Learning Research, 11(Dec):3371–3408, 2010. [100] X. Wang, X. Duan, and X. Bai. Deep sketch feature for cross-domain image retrieval. Neurocomputing, 207:387– 397, 2016. [101] Y. Xia, D. Huang, and Y. Wang. Detecting smiles of young children via deep transfer learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1673–1681, 2017. [102] T. Xiao, H. Li, W. Ouyang, and X. Wang. Learning deep feature representations with domain guided dropout for person re-identification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1249–1258, 2016. [103] M. Xie, N. Jean, M. Burke, D. Lobell, and S. Ermon. Transfer learning from deep features for remote sensing and poverty mapping. 2015. [104] H. Yan, Y. Ding, P. Li, Q. Wang, Y. Xu, and W. Zuo. Mind the class weight bias: Weighted maximum mean discrepancy for unsupervised domain adaptation. arXiv preprint arXiv:1705.00609, 2017. [105] Z. Yi, H. Zhang, P. T. Gong, et al. Dualgan: Unsupervised dual learning for image-to-image translation. arXiv preprint arXiv:1704.02510, 2017. 22
1cs.CV
Safe Sequential Path Planning of Multi-Vehicle Systems via Double-Obstacle Hamilton-Jacobi-Isaacs Variational Inequality arXiv:1412.7223v2 [cs.MA] 21 Mar 2016 Mo Chen, Jaime F. Fisac, Shankar Sastry, Claire J. Tomlin Abstract— We consider the problem of planning trajectories for a group of N vehicles, each aiming to reach its own target set while avoiding danger zones of other vehicles. The analysis of problems like this is extremely important practically, especially given the growing interest in utilizing unmanned aircraft systems for civil purposes. The direct solution of this problem by solving a single-obstacle Hamilton-Jacobi-Isaacs (HJI) variational inequality (VI) is numerically intractable due to the exponential scaling of computation complexity with problem dimensionality. Furthermore, the single-obstacle HJI VI cannot directly handle situations in which vehicles do not have a common scheduled arrival time. Instead, we perform sequential path planning by considering vehicles in order of priority, modeling higher-priority vehicles as time-varying obstacles for lower-priority vehicles. To do this, we solve a double-obstacle HJI VI which allows us to obtain the reachavoid set, defined as the set of states from which a vehicle can reach its target while staying within a time-varying state constraint set. From the solution of the double-obstacle HJI VI, we can also extract the latest start time and the optimal control for each vehicle. This is a first application of the double-obstacle HJI VI which can handle systems with time-varying dynamics, target sets, and state constraint sets, and results in computation complexity that scales linearly, as opposed to exponentially, with the number of vehicles in consideration. I. I NTRODUCTION Consider a group of autonomous vehicles trying to perform a task or reach a goal which may be time-varying in their joint state space, while avoiding obstacles and other vehicles. Providing safety and performance guarantees for such a multi-agent autonomous system (MAAS) is very relevant practically: Recently, there has been a growing interest in using unmanned aerial vehicles (UAVs) for civil applications, as companies like Amazon and Google are looking in the near future to send UAVs into the airspace to deliver packages [1], [2]. Government agencies such as the Federal Aviation Administration (FAA) and National Aeronautics and Space Administration (NASA) of the United States are also expressing growing interest in analyzing these problems in order to prevent airspace conflicts that could arise with the introduction of potentially many UAVs in an urban environment [3]. In addition, UAVs can be used not only to deliver packages quickly, but in any situation where fast response is desired. For example, UAVs can provide This work has been supported in part by NSF under CPS:ActionWebs (CNS-931843), by ONR under the HUNT (N0014-08-0696) and SMARTS (N00014-09-1-1051) MURIs and by grant N00014-12-1-0609, by AFOSR under the CHASE MURI (FA9550-10-1-0567). The research of J.F. Fisac has received funding from the “la Caixa” Foundation. All authors are with the Department of Electrical Engineering and Computer Sciences, University of California, Berkeley. {mochen72, jfisac, sastry, tomlin}@eecs.berkeley.edu emergency supplies to disaster-struck areas that are otherwise difficult to reach [4]. In general, MAASs are difficult to analyze due to their inherent high dimensionality. MAASs also often involve aspects of cooperation and asymmetric goals among the vehicles or teams of vehicles, making their analysis particularly interesting. MAASs have been explored extensively in the literature. Some researchers have done work on multivehicle path planning in the presence of other unknown vehicles or moving entities with assumptions on their specific control strategies [5]. In a number of formulations for safe multi-vehicle navigation, these assumed strategies induce velocity obstacles that vehicles must avoid to maintain safety [6], [7]. Researchers have also used potential functions to perform collision avoidance while maintaining formation given a predefined trajectory [8], [9]. However, these bodies of work have not considered trajectory planning and collision avoidance simultaneously. One well-known technique for optimal trajectory planning under disturbances or adversaries is reachability analysis, in which one computes the reach-avoid set, defined as the set of states from which the system can reach a target set while remaining within a state constraint set for all time. For reachability of systems of up to five dimensions, single-obstacle Hamilton-Jacobi-Isaacs (HJI) variational inequalities (VI) [10], [11] have been used in situations where obstacles and target sets are static. Another HJI VI formulation [12] is able to handle problems with moving target sets with no obstacles. A major practical appeal of the above approaches stems from the availability of modern numerical tools such as [10], [13], [14], [15], which can efficiently solve HJI equations when the problem dimension is low. These numerical tools have been successfully used to solve a variety of differential games, path planning problems, and optimal control problems[10], [16], [17]. Despite the power of the previous HJI formulations, the approaches become numerically intractable very quickly as the number of vehicles in the system is increased. This is because the numerical computations are done on a grid in the joint state space of the system, resulting in an exponential scaling of computation complexity with respect to the dimensionality of the problem. Furthermore, state constraint sets, while useful for modeling unsafe vehicle configurations, are required to be time-invariant in [10], [11], [18]. To solve problems involving time-varying state constraints, [19] proposed to augment the state space with time; however, this process introduces an extra state space dimension, resulting in added computation complexity. Recently, [20] presented a double-obstacle HJI VI which handles problems in which the dynamics, target sets, and state constraint sets are all time-varying, and provided a numerical implementation based on well-known schemes. The formulation does not introduce any additional computation overhead compared to the above-mentioned techniques, yet it still maintains the same guarantees on the system’s safety and performance. In this paper, we provide a first application of the theory presented in [20]. As a point of clarification, “obstacles” in the context of HJI VIs refer to the effective constraints in the HJI VI, while obstacles in the state space represent physical obstacles that vehicles must avoid. Our contributions are as follows. First, we formulate a multi-vehicle collision avoidance problem involving N autonomous vehicles. Each vehicle seeks to get to its own target sets while avoiding obstacles and collision with all other vehicles. To reduce the problem complexity to make the problem tractable, we assign a priority to each vehicle, and model higher-priority vehicles as time-varying obstacles that need to be avoided. We then utilize the double-obstacle HJI VI proposed in [20] to compute reach-avoid sets to plan trajectories for vehicles in order of priority. This way, we are able to offer a tractable solution that scales linearly, as opposed to exponentially, with the number of vehicles. We demonstrate the scalability of our approach in a four-vehicle system. II. P ROBLEM F ORMULATION Consider N vehicles Pi , i = 1 . . . , N , each trying to reach one of N target sets Ti , i = 1 . . . , N , while avoiding obstacles and collision with each other. Each vehicle i has states xi ∈ Rni and travels on a domain Ω = Ωobs ∪ Ωf ree ∈ Rp , where Ωobs represents the obstacles that each vehicle must avoid, and Ωf ree represents all other states in the domain on which vehicles can move. Each vehicle i = 1, 2, . . . , N STA moves with the following dynamics for t ∈ [tEST i , ti ]: ẋi = fi (t, xi , ui ), 0 xi (tLST i ) = xi (1) where x0i represents the initial condition of vehicle i, and ui (·) represents the control function of vehicle i. In general, fi (·, ·, ·) depends on the specific dynamic model of vehicle i, and need not be of the same form across different vehicles. Denote pi ∈ Rp the subset of the states that represent the position of the vehicle. Given p0i ∈ Ωf ree , we define the admissible control function set for Pi to be the set of all control functions such that pi (t) ∈ Ωf ree ∀t ≥ tLST i . Denote P the joint state space of all vehicles x ∈ Rn where n = i ni , and their joint control u. We assume that the control functions ui (·) are drawn from STA 1 the set Ui := {ui : [tEST i , ti ] → Ui , measurable } where nu Ui ∈ R i is the set of allowed control inputs. Furthermore, we assume fi (t, xi , ui ) is bounded, Lipschitz continuous in xi for any fixed t, ui , and measurable in t, ui for each 1 A function f : X → Y between two measurable spaces (X, Σ ) X and (Y, ΣY ) is said to be measurable if the preimage of a measurable set −1 in Y is a measurable set in X, that is: ∀V ∈ ΣY , f (V ) ∈ ΣX , with ΣX , ΣY σ-algebras on X,Y . 𝜕Ω 𝑃3 𝒯2 Ω Ω𝑜𝑏𝑠 𝒯1 𝑅𝐶 Obstacle Targets Vehicle Danger zone 𝑃1 𝒯3 𝑃2 Fig. 1: An illustration of the problem formulation with three vehicles. Each vehicle Pi seeks to reach its target set Ti by time t = tSTA i , while avoiding physical obstacles Ωobs and the danger zones of other vehicles. xi . Therefore given any initial state x0i and any control function ui (·), there exists a unique, continuous trajectory xi (·) solving (1) [21]. The goal of each vehicle i is to arrive at Ti ⊂ Rni at or before some scheduled time of arrival (STA) tSTA in i minimum time, while avoiding obstacles and danger with all other vehicles. The target sets Ti can be used to represent desired kinematic quantities such as position and velocity and, in the case of non-holonomic systems, quantities such as heading angle. tEST can be interpreted as the earliest start i time (EST) of vehicle i, before which the vehicle may not depart from its initial state. Further, we define tLST i , the latest (acceptable) start time (LST) for vehicle i. Our problem can now be thought of as determining the LST tLST for each i vehicle to get to Ti at or before the STA tSTA i , and finding a control to do this safely. If the LST is before the EST tLST < tEST i i , then it is infeasible for vehicle i to arrive at LST Ti at or before the STA tSTA and tEST is i . Comparing ti i feasibility problem that may arise in practice; however, for simplicity of presentation, we will assume that tEST ≤ tLST i i ∀i. Danger is described by sets Dij (xj ) ⊂ Ω. In general, the definition of Dij depends on the conditions under which vehicles i and j are considered to be in an unsafe configuration, given the state of vehicle j. Here, we define danger to be the situation in which the two vehicles come within a certain radius RC of each other: Dij (xj ) = {xi : kpi − pj k2 ≤ RC }. Such a danger zone is also used by the FAA [22]. An illustration of the problem setup is shown in Figure 1. In general, the above problem must be analyzed in the joint state space of all vehicles, making the solution intractable. In this paper, we will instead consider the problem of performing path planning of the vehicles in a sequential manner. Without loss of generality, we consider the problem of first fixing i = 1 and determining the optimal control for vehicle 1, the vehicle with the highest priority. The resulting optimal control u1 sends vehicle 1 to T1 in minimum time. Then, we plan the minimum time trajectory for each of the vehicles 2, . . . , N , in decreasing order of priority, given the previously-determined trajectories for higher-priority vehicles 1, . . . , i − 1. We assume that all vehicles have complete information about the states and trajectories of higherpriority vehicles, and that all vehicles adhere to their planned trajectories. Thus, in planning its trajectory, vehicle i treats higher-priority vehicles as known time-varying obstacles. With the above sequential path planning (SPP) protocol and assumptions, our problem now reduces to the following for vehicle i. Given xj (·), j = 1, . . . , i − 1, determine ui (·) that maximizes tLST and such that xi (τ ) ∈ Ti , τ ≤ tSTA i i . III. S OLUTION VIA DOUBLE - OBSTACLE HJI VI AND SPP One direct way of solving the problem formulated in Section II is by solving a single-obstacle HJI VI [10], [11], [23], [24]. In this approach, one considers the joint time-invariant dynamics of the entire system, f (x, u), and defines the static goal set and the static avoid set in the joint state space of all vehicles. The goal set encodes the joint states representing all vehicles being at their target sets, and the avoid set encodes the joint states representing all unsafe configurations. These sets are defined as sub-zero level sets of appropriate implicit surface functions s(x) where x ∈ S ⇔ s(x) ≤ 0. Having defined the implicit surface functions, the HJI VI (2) is then solved backwards in time with the implicit surface function representing the terminal set l(x) as the initial condition and the implicit surface function representing the avoid set a(x) as an effective constraint:  max Dt V + min [0, H (x, Dx V )] , −a(x) − V (x, t) = 0, V (x, 0) = l(x) (2) with the optimal Hamiltonian H (x, p) = minu∈U p·f (x, u). The solution V (x, t) is the implicit surface function representing the reach-avoid set RA(t), which defines the set of states from which the system has a control to drive the state at time t to the goal set L at time 0 while staying out of the avoid set A at all times. Note that the joint dynamics, goal set, and avoid set must be time-invariant. Time-varying dynamics and sets can be treated by augmenting the state space with time as an auxiliary state [19]; however, this state augmentation comes at a large computational expense. The direct solution described above has been successfully used to solve a number of problems involving up to a pair of vehicles [10], [16], [17], [25]. However, since numerical methods for solving a PDE or a VI involve gridding up the state space, the computation complexity scales exponentially with the number of dimensions in the joint state. This makes the single-obstacle HJI VI inapplicable for problems involving three or more vehicles. Therefore, instead of solving aPsingle-obstacle HJI VI in the joint state space in Rn = R i ni , we will consider the problem in in Rni and solve a sequence of double-obstacle HJI VIs introduced in [20]. By doing so, we take advantage of the fact that timevarying targets, obstacles, and dynamics can be handled by the double-obstacle HJI VIs (but not by the single-obstacle HJI VI without incurring significant computational expense), making the analysis of the problem tractable. Furthermore, even if the dimensionality of the problem is sufficiently low for computing a numerical solution to the single-obstacle HJI VI, its inability to handle time-varying systems would still limit us to only consider problems in which the required time of arrival is common across all vehicles: tSTA = tSTA ∀i. i We first describe the framework for computing reach-avoid sets with arbitrary terrain, domain, moving obstacles, and moving target sets based on [20]. As with the single-obstacle HJI VI, sets are defined as sub-zero level sets of implicit surface functions; however, crucially, these implicit surface functions can be time-varying in the double-obstacle HJI VI without increasing computational complexity. Being able to compute reach-avoid sets with moving obstacles allows us to overcome the computational intractability described above by sequentially performing path planning for one vehicle at a time in order of priority, while treating higher-priority vehicles as moving obstacles. The target set is defined in the same way as in the single-obstacle HJI VI; the avoid set is by convention defined as the complement of the state constraint set in the double-obstacle HJI VI. A. Reachability via HJI VI We first state the result given in [20], and then specialize the result to the problem formulation given in Section II. Consider a general nonlinear system describing the state evolution of two players in a differential game for t ∈ [0, T ]. ẋ(t) = f (t, x, u, d), x(0) = x (3) where x is the joint state, u is the control input for player 1, and d is the control input for player 2. Their joint dynamics f is assumed to be bounded, Lipschitz continuous in x for any fixed u, d and t, and measurable in t, u, d for each x. Given control functions u(·), d(·), there exists a unique trajectory φu,d x ((τ ), τ ) [21]. Player 1 wishes to minimize, and player 2 wishes to maximize the following cost functional: V t, x, u(·), d(·)   u,d = min max l(φu,d x(0) (τ ), τ ), max g(φx(0) (s), s) τ ∈[t,T ] s∈[t,τ ] (4) The value of the game is thus given by  V (x, t) := sup inf V t, x, u(·), δ[u](·) δ[u](·) u(·) (5) where player 2 chooses a nonanticipative strategy d(·) = δ[u](·), under which the control signal d(t) is chosen in response to player 1’s control function up to time t, u(τ ), τ ≤ t [18]. The value of the game characterizes reach-avoid set, or all the states from which player 1 can reach the target L encoded by the implicit surface function l(x, t), while staying within some state constraint set G encoded by the implicit surface function g(x, t), despite the adversarial actions of player 2. The value function is the unique viscosity solution [26] to the following single-obstacle HJI VI [20]: max n  min Dt V + H (x, Dx V, t) , l(x, t) − V (x, t) o g(x, t) − V (x, t) = 0, t ∈ [0, T ], x ∈ Rn (6)  V (x, T ) = max l(x, T ), g(x, T ) , x ∈ Rn The proof is given in [20] and is based on viscosity solution theory [27], [28]. Now consider the system with dynamics given by (1). Given a time-varying target set Ti (t) and obstacle Ai (t) that vehicle i must avoid, we define implicit surface functions l(xi , t), g(xi , t) such that xi ∈ Ti (t) ⇔ li (xi , t) ≤ 0, xi ∈ / Ai (t) ⇔ gi (x, t) ≤ 0. Now, the problem formulated in Section II becomes one in which vehicle i chooses a control function ui (·) to minimize the following cost functional:  Vi t, xi , ui (·)  = min max li (xi (τ ), τ ), max gi (xi (s), s) τ ∈[t,T ] (7) s∈[t,τ ] ui (t) = arg min Hi (t, Dxi V (xi , t), V (xi , t)) Note here, we have an optimal control problem involving only one vehicle and no adversary (given gi (xi (s), s)), unlike in the case of the HJI VI (6). Now, specializing (6) to our optimal control problem, the value function that characterizes the reach-avoid set RAi (t) is Vi (xi , t), where xi ∈ RAi (t) ⇔ Vi (xi , t) ≤ 0. Vi (xi , t) is the viscosity solution [26] of the HJI VI  max min{Dt Vi + Hi (xi , Dxi Vi , t) , li (xi , t) − Vi (xi , t)} STA ni gi (xi , t) − Vi (xi , t) = 0, t ∈ [tEST i , ti ], xi ∈ R  STA STA ni Vi (xi , tSTA i ) = max li (xi , ti ), gi (xi , ti ) , xi ∈ R (8) where the Hamiltonian Hi (t, xi , p) and optimal control ui are given by Hi (t, xi , p) = min p · fi (t, xi , ui ) ui ∈Ui (9) u∗i = arg min Hi (t, xi , p) ui B. Sequential Path Planning In order to use (8) to perform SPP, we first define the moving obstacles induced by higher-priority vehicles. Specifically, for vehicle i, we define the moving obstacles Oji (t) induced by vehicles j = 1, . . . , i−1, given their known trajectories xj (·), to be Oji (t) := {xi : pi ∈ Dij (xj (t)). Each vehicle i must avoid being in Oji (t) for each j = 1, . . . , i − 1 and for all time t, as well as avoid being in static obstacles Ωobs in the domain. Therefore, for the ith vehicle, we compute the reach-avoid set with the following time-varying avoid set Ai (t) and goal set Li (t): Ai (t) := {xi : pi ∈ Ωobs } ∪  [ j=1,...,i−1 Oji (t) constraint set in the HJI VI is defined as the complement of the avoid set, Aci (t), and is represented by the implicit surface function g(xi , t), where g(xi , t) ≤ 0 ⇔ xi ∈ / Ai (t). For both li (xi , t) and g(xi , t), we use the signed distance function (in xi ) to the sets Li (t) and Aci (t), respectively. Now, we can solve the double-obstacle HJI VI (8). The solution V (xi , t) represents the reach-avoid set RA(t): V (xi , t) ≤ 0 ⇔ xi (t) ∈ RA(t). RA(t) is the set of states at starting time t from which vehicle i can arrive at Ti at or before time tSTA while avoiding obstacles and danger zones i of all higher-priority vehicles j = 1, . . . , i − 1. Alternatively, given an initial state x0i , we can solve (8) to some tLST = inf{t : x0i ∈ RA(t)}. This represents the i latest time that vehicle i must depart from its initial position in order to reach Ti while avoiding obstacles and all danger zones of higher-priority vehicles j = 1, . . . , i − 1. The optimal control is given by  (10) Li (t) := Ti , t ≤ tSTA i The goal set is represented by the implicit surface function li (x, t), where li (xi , t) ≤ 0 ⇔ xi (t) ∈ Li (t). The state (11) Observe that since each vehicle i is guaranteed to be safe with respect to higher priority vehicles j = 1, . . . , i − 1, the safety of all vehicles, including lower-priority vehicles, can also be guaranteed. IV. R ESULTS : F OUR V EHICLES WITH C ONSTRAINED T URN R ATE Consider four vehicles with states xi = [xi , yi , θi ]> modeled using a horizontal kinematics model with the following STA dynamics for t ∈ [tEST i , ti ], i = 1, 2, 3, 4: ẋi = vi cos(θi ) 0 xi (tEST i ) = xi ẏi = vi sin(θi ) (12) |ωi | ≤ ω̄i θ̇i = ωi where (xi , yi ) is the position of vehicle i, θi is the heading of vehicle i, and vi is the speed of vehicle i. The control input ui of vehicle i is the turning rate ωi , whose absolute value is bounded by ω̄i . For illustration, we chose ω̄i = 1∀i and assume vi = 1 is constant; however, our method can easily handle the case in which ω̄i differ across vehicles and vi is a control input. Optimizing the Hamiltonian associated with vehicle i, Hi (t, Dxi Vi (xi , t), Vi (xi , t)), we can obtain the optimal control ωi (t) = −ω̄i Dθi Vi (xi , t) |Dθi Vi (xi , t)| (13) The vehicles have initial conditions and STA as follows: x01 = (−0.5, 0, 0), tSTA =0 1 x02 x03 x04 = (0.5, 0, π), tSTA = 0.2 2 = (−0.6, 0.6, 7π/4) , tSTA = 0.4 3 = (0.6, 0.6, 5π/4) , tSTA = 0.6 4 (14) The target sets Ti of the vehicles are all 4 circles of radius 0.1 in the domain. The centers of the target sets are at (0.7, 0.2), (−0.7, 0.2), (0.7, −0.7), (−0.7, −0.7) for vehicles i = 1, 2, 3, 4, respectively. The obstacles are rectangles near Initial Setup Obstacle Target 1 Target 2 Target 3 Target 4 Position/Heading 1 Danger zone 1 Position/Heading 2 Danger zone 2 Position/Heading 3 Danger zone 3 Position/Heading 4 Danger zone 4 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 -0.5 0 0.5 Fig. 2: Initial configuration of the four-vehicle example. the middle of the domain. The setup for this example is shown in Figure 2. The joint state space of this system is twelve-dimensional, intractable for analysis using the single-obstacle HJI VI (2). Therefore, we will repeatedly solve the double-obstacle HJI VI (8) to compute the reach-avoid sets from targets Ti for vehicles 1, 2, 3, 4, in that order, with moving obstacles induced by vehicles j = 1, . . . , i − 1. We will also obtain tLST i , i = 1, 2, 3, 4, the LSTs for each vehicle in order to reach Ti by tSTA i . Figures 3, 4, and 5 show the results. Since the state space of each vehicle is 3D, the reach-avoid set is also 3D. To visualize the results, we slice the reach-avoid sets at the initial heading angles θi0 . Figure 3 shows the 2D reach-avoid = = −1.12, tLST set slices for each vehicle at its LSTs tLST 2 1 LST LST −0.94, t3 = −1.48, t4 = −1.44 determined from our method. The obstacles in the domain Ωobs and the obstacles induced by other vehicles inhibit the evolution of the reachavoid sets, carving out thin “channels” that separate the reach-avoid set into different “islands”. One can see how these channels and islands form by examining the time evolution of the reach-avoid set, shown in Figure 4 for vehicle 3. Finally, Figure 5 shows the resulting trajectories of the four vehicles. The subplot labeled t = −0.55 shows all four vehicles in close proximity without collision: each vehicle is outside of the danger zone of all other vehicles. The actual arrival times of vehicles i = 1, 2, 3, 4 are 0, 0.19, 0.34, 0.31, respectively. It is interesting to note that for some vehicles, the actual arrival times are earlier than the STAs tSTA i ,i = 1, 2, 3, 4. This is because in order to arrive at the target by tSTA i , these vehicles must depart early enough to avoid major delays resulting from the induced obstacles of other vehicles; these delays would have lead to a late arrival if vehicle i departed after tLST i . V. C ONCLUSION We have presented a problem formulation that allows us to consider the multi-vehicle trajectory planning problem in a tractable way by planning trajectories for vehicles in order of priority. In order to do this, we modeled higher-priority vehicles as time-varying obstacles. We then solved a doubleobstacle HJI VI to obtain the reach-avoid set for each vehicle. The reach-avoid set characterizes the region from which each 1 Vehicle 1, t=t i1 =-1.12 1 0.5 0.5 0 0 -0.5 -0.5 -1 -1 1 0 1 Vehicle 3, t=t i3 =-1.48 -1 -1 1 0.5 0.5 0 0 -0.5 -0.5 -1 -1 0 1 -1 -1 Vehicle 2, t=t i2 =-0.94 0 1 Vehicle 4, t=t i4 =-1.44 0 1 Obstacle Targets Initial pos. and heading Reach-avoid set Danger zones Fig. 3: Reach-avoid sets at t = tLST for vehicles 1, 2, 3, 4, i sliced at initial headings θi0 . Black arrows indicate direction of obstacle motion. Due to the turn rate constraint, the presence of static obstacles Ωobs and time-varying obstacles induced by higher-priority vehicles Oji (t) carves “channels” in the reach-avoid set, dividing it up into multiple “islands”. vehicle is guaranteed to arrive at its target within a time horizon, while avoiding collision with obstacles and higherpriority vehicles. The solution also gives each vehicle a latest start time as well as the optimal control which guarantees that each vehicle safely reaches its target on time. R EFERENCES [1] Amazon.com, Inc. (2014) Amazon prime air. [Online]. Available: http://www.amazon.com/b?node=8037720011 [2] J. Stewart. (2014) Google tests drone deliveries in Project Wing trials. [Online]. Available: http://www.bbc.com/news/technology-28964260 [3] Jointed Planning and Development Office (JPDO), “Unmanned aircraft systems (UAS) comprehensive plan – a report on the nation’s UAS path forward,” Federal Aviation Administration, Tech. Rep., Sep 2013. [4] W. M. Debusk, “Unmanned aerial vehicle systems for disaster relief: Tornado alley,” in Infotech@Aerospace Conferences, 2010. [5] G. C. Chasparis and J. Shamma, “Linear-programming-based multivehicle path planning with adversaries,” in Proceedings of American Control Conference, June 2005. [6] P. Fiorini and Z. Shillert, “Motion planning in dynamic environments using velocity obstacles,” International Journal of Robotics Research, vol. 17, pp. 760–772, 1998. [7] J. van den Berg, M. Lin, and D. Manocha, “Reciprocal velocity obstacles for real-time multi-agent navigation,” in Robotics and Automation, 2008. ICRA 2008. IEEE International Conference on, May 2008, pp. 1928–1935. [8] R. Olfati-Saber and R. M. Murray, “Distributed cooperative control of multiple vehicle formations using structural potential functions,” in in IFAC World Congress, 2002. 1 t=0.40 1 0.5 0.5 0 0 -0.5 -0.5 -1 -1 1 0 1 t=-0.88 -1 -1 1 0.5 0.5 0 0 -0.5 -0.5 -1 -1 0 1 -1 -1 t=-0.27 0 t=-1.15 0.5 0.5 0 0 -0.5 -0.5 1 -0.5 0 0.5 -0.5 t=0 t=-1.48 0 t=-0.55 1 Obstacle Targets Initial pos. and heading Reach-avoid set Danger zones Fig. 4: Time evolution of the reach-avoid set for vehicle 3, sliced at its initial heading θ30 = 7π 4 . Black arrows indicate direction of obstacle motion. Initially, the reachavoid set grows unobstructed by obstacles, as shown in the top subplots. Then, in the bottom subplots, the static obstacles Ωobs and the induced obstacles of vehicles 1 and 2, O13 , O23 , carve out “channels” in the reach-avoid set. [9] Y.-L. Chuang, Y. Huang, M. D’Orsogna, and A. Bertozzi, “Multivehicle flocking: Scalability of cooperative control algorithms using pairwise potentials,” in Robotics and Automation, 2007 IEEE International Conference on, April 2007, pp. 2292–2299. [10] I. Mitchell, A. Bayen, and C. Tomlin, “A time-dependent HamiltonJacobi formulation of reachable sets for continuous dynamic games,” IEEE Transactions on Automatic Control, vol. 50, no. 7, July 2005. [11] O. Bokanowski, N. Forcadel, and H. Zidani, “Reachability and minimal times for state constrained nonlinear problems without any controllability assumption,” SIAM Journal on Control and Optimization, pp. 1–24, 2010. [12] E. Barron and H. Ishii, “The Bellman equation for minimizing the maximum cost,” Nonlinear Analysis: Theory, Methods & Applications, 1989. [13] J. A. Sethian, “A fast marching level set method for monotonically advancing fronts,” Proceedings of the National Academy of Sciences, vol. 93, no. 4, pp. 1591–1595, 1996. [14] S. Osher and R. Fedkiw, Level Set Methods and Dynamic Implicit Surfaces. Springer-Verlag, 2002, ISBN: 978-0-387-95482-0. [15] I. Mitchell, A Toolbox of Level Set Methods, 2009, http://people.cs. ubc.ca/∼mitchell/ToolboxLS/index.html. [16] J. Ding, J. Sprinkle, S. S. Sastry, and C. J. Tomlin, “Reachability calculations for automated aerial refueling,” in IEEE Conference on Decision and Control, Cancun, Mexico, 2008. [17] H. Huang, J. Ding, W. Zhang, and C. Tomlin, “A differential game approach to planning in adversarial scenarios: A case study on capture-the-flag,” in Robotics and Automation (ICRA), 2011 IEEE International Conference on, 2011, pp. 1451–1456. [18] I. Mitchell, “Application of level set methods to control and reachability problems in continuous and hybrid systems,” Ph.D. dissertation, Stanford University, 2002. 0.5 0.5 0 0 -0.5 -0.5 -0.5 0 0 0.5 t=0.34 0.5 -0.5 0 0.5 Obstacle Targets Positions, Headings Trajectories Danger Zones Fig. 5: The planned trajectories of the four vehicles. In the left top subplot, only vehicles 3 (green) and 4 (purple) have started moving, showing tLST is not common across i the vehicles. Right top subplot: all vehicles have come within very close proximity, but none is in the danger zone another. Left bottom subplot: vehicle 1 (blue) arrives at T1 at t = 0. Right bottom subplot: all vehicles have reached their destination, some ahead of the STA tSTA i . [19] O. Bokanowski and H. Zidani, “Minimal time problems with moving targets and obstacles,” 18th IFAC World Congress, 2011. [20] J. F. Fisac, M. Chen, C. J. Tomlin, and S. S. Sastry, “Reach-Avoid Problems with Time-Varying Dynamics, Targets and Constraints,” in 18th International Conference on Hybrid Systems: Computation and Controls, 2015. [21] E. A. Coddington and N. Levinson, Theory of ordinary differential equations. Tata McGraw-Hill Education, 1955. [22] M. L. C. Mike M. Paglione and H. F. Ryan, “Generic metrics for the estimation of the prediction accuracy of aircraft to aircraft conflicts by a strategic conflict probe tool,” Air Traffic Control Quarterly, 1999. [23] K. Margellos and J. Lygeros, “Hamilton-Jacobi Formulation for Reach-Avoid Differential Games,” IEEE Transactions on Automatic Control, vol. 56, no. 8, Aug 2011. [24] K. Margellos and J. Lygeros, “Toward 4-D Trajectory Management in Air Traffic Control: A Study Based on Monte Carlo Simulation and Reachability Analysis,” IEEE Transactions on Control Systems Technology, vol. 21, no. 5, Sept 2013. [25] M. Chen, Z. Zhou, and C. Tomlin, “Multiplayer reach-avoid games via low dimensional solutions and maximum matching,” in Proceedings of the American Control Conference, 2014. [26] M. G. Crandall, L. C. Evans, and P. L. Lions, “Some properties of viscosity solutions of hamilton-jacobi equations,” Transactions of the American Mathematical Society, vol. 282, no. 2, p. 487, Apr. 1984. [27] L. C. Evans and P. E. Souganidis, “Differential games and representation formulas for solutions of Hamilton-Jacobi-Isaacs equations,” Indiana University Mathematics Journal, vol. 33, no. 5, 1984. [28] E. Barron, “Differential Games with Maximum Cost,” Nonlinear analysis: Theory, methods & applications, pp. 971–989, 1990.
3cs.SY
ARTIN ALGEBRAIZATION AND QUOTIENT STACKS arXiv:1510.07804v1 [math.AG] 27 Oct 2015 JAROD ALPER Abstract. This article contains a slightly expanded version of the lectures given by the author at the summer school “Algebraic stacks and related topics” in Mainz, Germany from August 31 to September 4, 2015. The content of these lectures is purely expository and consists of two main goals. First, we provide a treatment of Artin’s approximation and algebraization theorems following the ideas of Conrad and de Jong which rely on a deep desingularization result due to Néron and Popescu. Second, we prove that under suitable hypotheses, algebraic stacks are étale locally quotients stacks in a neighborhood of a point with a linearly reductive stabilizer. Contents Introduction Lecture 1: Artin approximation 1.1. Néron–Popescu desingularization 1.2. Artin approximation 1.3. Alternative formulations of Artin approximation 1.4. A first application of Artin approximation 1.5. Proof of Artin approximation 1.6. Categories fibered in groupoids Lecture 2: Artin algebraization 2.1. Conrad–de Jong approximation 2.2. Artin algebraization 2.3. Algebraic stacks 2.4. Artin’s axioms 2.5. A more refined version of Artin’s axioms Lecture 3: The geometry of quotient stacks 3.1. Quotient stacks 3.2. A summary of known results on quotient stacks 3.3. The local quotient structure of algebraic stacks 3.4. Ingredients in the proof of Theorem 3.16 Lecture 4: A Luna étale slice theorem for algebraic stacks and applications 4.1. Proof of Theorem 3.16 4.2. Equivariant Artin algebraization 4.3. Proof of Theorem 3.18 4.4. Applications References 1 2 3 3 4 5 6 7 8 12 12 16 18 19 21 25 25 27 28 30 32 32 33 34 35 38 2 ALPER Introduction The goal of these lectures is twofold: (1) Discuss Artin’s approximation and algebraization theorems. We will in fact prove that both theorems follow from a deep desingularization theorem due to Néron and Popescu. This approach follows the ideas of Conrad and de Jong. (2) Prove that “algebraic stacks with linearly reductive stabilizers at closed points are étale locally quotient stacks.” See Theorem 3.18 for a precise statement. This theorem was established by the author, Hall and Rydh in [AHR15]. These two goals are connected in the sense that Artin’s theorems will be one of the key ingredients in establishing the main theorem expressed in the second goal. In fact, the proof of Theorem 3.18 will rely on an equivariant generalization of Artin’s algebraization theorem. Perhaps more importantly though, both these goals shed light on the local structure of algebraic stacks. Artin’s approximation and algebraization theorems together with Artin’s criterion for algebraicity instruct us on how we should think of the local structure of algebraic stacks. The main theorem in the second goal yields a more refined and equivariant understanding of the local structure of algebraic stacks in the case that the stabilizers of the closed points have linearly reductive stabilizers, a property that is often satisfied for algebraic stacks appearing in moduli theory. Acknowledgements. We thank Ariyan Javanpeykar and Ronan Terpereau for organizing the summer school “Algebraic stacks and related topics” and we thank the attentive audience of this summer school for providing worthwhile feedback. In particular, we thank Pieter Belmans for providing a number of corrections of the first draft of these notes. Finally, we thank Jack Hall and David Rydh for extensive and useful suggestions on the content of these lectures. ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 3 Lecture 1: Artin approximation The goal of this first lecture is to discuss Artin approximation and provide a few applications. While we will not give a complete and self-contained proof of Artin approximation, we will show how it follows from Néron–Popescu desingularization, which is a very deep and difficult result. Throughout these lectures, k will denote an algebraically closed field. Although almost every statement we make can be generalized to an arbitrary base scheme S with the arguments being essentially identical, it is nevertheless my belief that working over a fixed algebraically closed field k makes the geometric content of the statements more transparent. Once the geometric content is digested over the field k, the motivated reader will have no problem stating and proving the analogous statements over an arbitrary base scheme. 1.1. Néron–Popescu desingularization. Definition 1.1. A ring homomorphism A → B of noetherian rings is called geometrically regular if A → B is flat and for every prime ideal p ⊂ A and every finite field extension k(p) → k ′ (where k(p) = Ap /p), the fiber B ⊗A k ′ is regular. Remark 1.2. It is important to note that A → B is not assumed to be of finite type. In the case that A → B is a ring homomorphism (of noetherian rings) of finite type, then A → B is geometrically regular if and only if A → B is smooth (i.e. Spec B → Spec A is smooth). Remark 1.3. It can be shown that it is equivalent to require the fibers B ⊗A k ′ to be regular only for inseparable field extensions k(p) → k ′ . In particular, in characteristic 0, A → B is geometrically regular if it is flat and for every prime ideal p ⊂ A, the fiber B ⊗A k(p) is regular. We will accept the following result as a black box. The proof is difficult. Black Box 1 (Néron–Popescu desingularization). Let A → B be a ring homomorphism of noetherian rings. Then A → B is geometrically regular if and only if B = lim Bλ is a direct limit of smooth A-algebras. −→ Remark 1.4. This was result was proved by Néron in [Nér64] in the case that A and B are DVRs and in general by Popescu in [Pop85], [Pop86], [Pop90]. We recommend [Swa98] and [Stacks, Tag 07GC] for an exposition on this result. Example 1.5. If l is a field and ls denotes its separable closure, then l → ls is geometrically regular. Clearly, ls is the direct limit of separable field extensions l → l′ (i.e. étale and thus smooth l-algebras). If l is a perfect field, then any field extension l → l′ is geometrically regular—but if l → l′ is not algebraic, it is not possible to write l′ is a direct limit of étale l-algebras. On the other hand, if l is a non-perfect field, then l → l is not geometrically regular as the geometric fiber is non-reduced and thus not regular. 4 ALPER In order to apply Néron–Popescu desingularization, we will need the following result, which we will also accept as a black box. The proof is substantially easier than Néron–Popescu’s result but nevertheless requires some effort. Black Box 2. If S is a scheme of finite type over k and s ∈ S is a k-point, b S,s is geometrically regular. then OS,s → O Remark 1.6. See [EGA, IV.7.4.4] or [Stacks, Tag 07PX] for a proof. b is Remark 1.7. A local ring A is called a G-ring if the homomorphism A → A geometrically regular. We remark that one of the conditions for a scheme S to be excellent is that every local ring is a G-ring. Any scheme that is finite type over a field or Z is excellent. 1.2. Artin approximation. Let S be a scheme and consider a contravariant functor F : Sch/S → Sets where Sch/S denotes the category of schemes over S. An important example of a contravariant functor is the functor representing a scheme: if X is a scheme over S, then the functor representing X is: (1.1) hX : Sch/S → Sets, (T → S) 7→ HomS (T, X). We say that F is limit preserving if for every direct limit lim Bλ of OS -algebras −→ Bλ (i.e. a direct limit of commutative rings Bλ together with morphisms Spec Bλ → S), the natural map lim F (Spec Bλ ) → F (Spec lim Bλ ) −→ −→ is bijective. This should be viewed as a finiteness condition on the functor F . For instance, the functor hX from (1.1) is limit preserving if and only if X → S is locally of finite presentation (equivalently locally of finite type if S is noetherian). Recall that Yoneda’s lemma asserts that for an S-scheme T , there is a natural bijection between F (T ) and the set Hom(T, F ) of natural transformation of functors (where we are abusing notation for writing T rather than its representable functor hT ). Moreover, we will consistently abuse notation by conflating objects ξ ∈ F (T ) and morphisms (i.e. natural transformations of functors) ξ : T → F . Theorem 1.8 (Artin approximation). Let S be a scheme of finite type over k and let F : Sch/S → Sets be a limit preserving contravariant functor. Let s ∈ S be a k-point and b S,s ). For any integer N ≥ 0, there exist an étale morphism ξb ∈ F (Spec O (S ′ , s′ ) → (S, s) and an element ξ ′ ∈ F (S ′ ) such that the restrictions of ξb +1 +1 ∼ and ξ ′ to Spec(OS,s /mN ) are equal (under the identification OS,s /mN = s s N +1 OS ′ ,s′ /ms′ ). ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 5 Remark 1.9. This was proven in [Art69a, Cor. 2.2] in the more general case that S is of finite type over a field or an excellent dedekind domain. In fact, this theorem holds when the base scheme S is excellent and our proof below works in this generality with only minor modifications. Remark 1.10. It is not possible in general to find ξ ′ ∈ F (S ′ ) restricting to ξb or even such that the restrictions of ξ ′ and ξb to Spec OS,s /mn+1 agree for all s n ≥ 0. For instance, F could be the functor hA1 representing the affine line b S,s could be a non-algebraic power series. A1 and ξb ∈ O 1.3. Alternative formulations of Artin approximation. Consider the case that S = Spec A is an affine scheme of finite type over k and hX : Sch/S → Sets is the functor representing the affine scheme X = Spec A[x1 , . . . , xn ]/ (f1 , . . . , fm ) of finite type over S. Restricted to the category of affine schemes over S (or equivalently A-algebras), the functor is: hX : AffSch/S → Sets Spec R 7→ {a = (a1 , . . . , an ) ∈ R⊕n | fi (a) = 0 for all i} Applying Artin approximation to this functor, we obtain: Corollary 1.11. Let A be a finitely generated k-algebra and m ⊂ A be a maximal ideal. Let f1 , . . . , fm ∈ A[x1 , . . . , xn ] be polynomials. Let b a = (b a1 , . . . , b an ) ∈ bm be a solution to the equations f1 (x) = · · · = fm (x) = 0. Then for every A N ≥ 0, there exist an étale ring homomorphism A → A′ , a maximal ideal m′ ⊂ A′ over m, and a solution a′ = (a′1 , . . . , a′n ) ∈ A′⊕n to the equations a mod mN +1 .  f1 (x) = · · · = fm (x) = 0 such that a′ ∼ =b Remark 1.12. Although this corollary may seem weaker than Artin approximation, it is not hard to see that it in fact directly implies Artin approximation. b S,s as a direct limit of finite type Indeed, writing S = Spec A, we may write O A-algebras and since F is limit preserving, we can find a commutative diagram b S,s Spec O ξb Spec A[x1 , . . . , xn ]/(f1 , . . . , fm ) ξ F. b ⊕n to the The vertical morphism corresponds to a solution b a = (b a1 , . . . , b an ) ∈ O S,s equations f1 (x) = · · · = fm (x) = 0. Applying Corollary 1.11 yields the desired étale morphism (Spec A′ , s′ ) → (Spec A, s) and a solution a′ = (a′1 , . . . , a′n ) ∈ A′⊕n to the equations f1 (x) = · · · = fm (x) = 0 agreeing with b a up to order N (i.e. congruent modulo mN +1 ). This induces a morphism ξ ′ : Spec A′ → Spec A[x1 , . . . , xn ]/(f1 , . . . , fm ) → F b S,s → F to order N. which agrees with ξb: Spec O 6 ALPER Alternatively, we can state Corollary 1.11 using henselian rings. Recall that a local ring (A, m) is called henselian if the following analogue of the implicit function theorem holds: if f1 , . . . , fn ∈ A[x1 , . . . , xn ] and a = (a1 , . . . , an ) ∈ (A/m)⊕n isa solution to the equations f1 (x) = · · · = fn (x) = 0 modulo m and ∂fi (a) i,j=1,...,n 6= 0, then there exists a solution a = (a1 , . . . , an ) ∈ A⊕n det ∂x j to the equations f1 (x) = · · · = fn (x) = 0. Equivalently, if (A, m) is a local k-algebra with A/m ∼ = k, then (A, m) is henselian if every étale homomorphism ′ ′ (A, m) → (A , m ) of local rings with A/m ∼ = A′ /m′ is an isomorphism. Also, if S is a scheme and s ∈ S is a point, one defines the henselization OhS,s of S at s to be Γ(S ′ , OS ′ ) OhS,s = lim − → ′ ′ (S ,s )→(S,s) where the direct limit is over all étale morphisms (S ′ , s′ ) → (S, s). In other words, OhS,s is the local ring of S at s in the étale topology. Corollary 1.13. Let (A, m) be a local henselian ring which is the henselization of a scheme of finite type over k at a k-point.1 Let f1 , . . . , fm ∈ A[x1 , . . . , xn ]. b⊕n is a solution to the equations f1 (x) = Suppose that b a = (b a1 , . . . , b an ) ∈ A · · · = fm (x) = 0. For any integer N ≥ 0, there exists a solution a = (a1 , . . . , an ) ∈ A⊕n to the equations f1 (x) = · · · = fm (x) = 0 such that b a∼ =a N +1 mod m . 1.4. A first application of Artin approximation. The next corollary states an important fact which you may have taken for granted: if two schemes are formally isomorphic, then they are isomorphic in the étale topology. First, we recall that if X → Y is a morphism of schemes of finite type over k and x ∈ X is a k-point, then X → Y is étale at x if and only if the induced b Y,f (x) → O b X,x of completions is an isomorphism. homomorphism O Corollary 1.14. Let X1 , X2 be schemes of finite type over k. Suppose x1 ∈ b X ,x ∼ b X1 , x2 ∈ X2 are k-points such that O Then there exists a 1 1 = OX2 ,x2 . common étale neighborhood (X ′ , x′ ) (1.2) (X1 , x1 ) (X2 , x2 ) . Proof. The functor F : Sch/X1 → Sets, (T → X1 ) 7→ Hom(T, X2 ) is limit preserving as it can be identified with the representable functor HomX1 (−, X2 ×X1 ) corresponding to the finite type morphism X2 ×X1 → X1 . b X ,x ∼ b b The isomorphism O 1 1 = OX2 ,x2 provides an element of F (Spec OX1 ,x1 ). By 1 More generally, this statement is true for any local henselian G-ring (see Remark 1.7) and, in particular, any local henselian excellent ring. ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 7 applying Artin approximation with N = 1, we obtain a diagram as in (1.2) with X ′ → X1 étale at x′ and such that OX2 ,x2 /m2x2 → OX ′ ,x′ /m2x′ is an isob X ,x , we can conclude b X ′ ,x′ is abstractly isomorphic to O morphism. But as O 2 2 b X ,x → O b X ′ ,x′ induced by X ′ → X2 is an isomorthat the homomorphism O 2 2 phism.2  1.5. Proof of Artin approximation. Proof of Artin approximation (Theorem 1.8). By Black Box 2, the morphism b S,s is geometrically regular. By Black Box 1 (Néron–Popescu desinOS,s → O b S,s = lim Bλ is a direct limit of smooth OS,s -algebras. Since gularization), O −→ b S,s and an F is limit preserving, there exist λ, a factorization OS,s → Bλ → O b S,s ) is ξ. b element ξλ ∈ F (Spec Bλ ) whose restriction to F (Spec O Let B = Bλ and ξ = ξλ . Geometrically, we have a commutative diagram ξb b S,s Spec O g Spec B ξ F Spec OS,s where Spec B → Spec OS,s is smooth. We claim that we can find a commutative diagram S′ Spec B (1.3) Spec OS,s where S ′ ֒→ Spec B is a closed immersion, (S ′ , s′ ) → (Spec OS,s , s) is étale, and +1 the composition Spec OS,s /mN → S ′ → Spec B agrees with the restriction s b S,s → Spec B.3 of g : Spec O To see this, observe that the B-module of relative differentials ΩB/OS,s is locally free. After shrinking Spec B around the image of the closed point under b S,s → Spec B, we may assume ΩB/O is free with basis db1 , . . . , dbn . Spec O S,s 2 The fact that we are using here is that if (A, m) is a local noetherian ring and φ : A → A is a local homomorphism such that the induced map A/m2 → A/m2 is an isomorphism, then φ is an isomorphism. Indeed, one can use Nakayama’s lemma to show that the inclusion φ(m) ⊂ m is also surjective and then Nakayama’s lemma again to show that φ : A → A is surjective. (See also Lemma 2.15 or [Har77, Lem. II.7.4].) Finally, we use the fact a surjective endomorphism of noetherian rings is necessarily an isomorphism. 3 This is where the approximation occurs. It is not possible to find a morphism S ′ → b S,s → Spec B → Spec OS,s which is étale at a point s′ over s such that the composition Spec O ′ S → Spec B is equal to g. 8 ALPER This induces a homomorphism OS,s [x1 , . . . , xn ] → B defined by xi 7→ bi and provides a factorization AnOS,s Spec B Spec OS,s where Spec B → AnOS,s is étale. We may choose a lift of the composition b S,s → OS,s /mN +1 OS,s [x1 , . . . , xn ] → B → O s to a morphism OS,s [x1 , . . . , xn ] → OS,s . This gives a section s : Spec OS,s → AnOS,s and we define S ′ as the fibered product S′ Spec OS,s  Spec B s AnOS,s . ξ This gives the desired Diagram 1.3. The composition ξ ′ : S ′ → Spec B − → F is b an element which agrees with ξ up to order N. By “standard direct limit” methods, we may “smear out” the étale morphism (S ′ , s′ ) → (Spec OS,s , s) and the element ξ ′ : S ′ → F to find an étale morphism (S ′′ , s′′ ) → (S, s) and an element ξ ′′ : S ′′ → F agreeing with ξb up to order N. Since this may not be standard for everyone, we spell out the details. Let Spec A ⊂ S be an open affine containing s. We may write ′ A , we S ′ = Spec A′ and A′ = OS,s [y1 , . . . , yn ]/(f1′ , . . . , fm ). As OS,s = limg∈m −→ / s g ′′ ′′ can find an element g ∈ / ms and elements f1 , . . . , fm ∈ Ag [y1 , . . . , yn ] restrict′ ′′ ing to f1′ , . . . , fm . Let S ′′ = Spec Ag [y1 , . . . , yn ]/(f1′′ , . . . , fm ) and s′′ ∈ S ′′ be the image of s′ under S ′ → S ′′ . Then S ′′ → S is étale at s′′ . As ′ A [y , . . . , yn ]/(f1′ , . . . , fm ) and F is limit preserving, we can, A′ = limh∈m −→ / s hg 1 after replacing g with hg, find an element ξ ′′ ∈ F (S ′′ ) restricting to ξ ′ and, in particular, agreeing with ξb up to order N. Finally, we shrink S ′′ around s′′ so that S ′′ → S is étale everywhere.  1.6. Categories fibered in groupoids. We now shift in the direction of stacks by introducing categories fibered in groupoids. ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 9 Let S be a scheme. Let X be a category and p : X → Sch/S be a functor. We visualize this data as α ξ1 X ξ2 β η2 p f T1 Sch/S T2 where the greek letters ξ1 and ξ2 , η2 are objects in X over the S-schemes T1 and T2 , respectively, and the morphisms α, β are over f . The main motivation for introducing categories fibered in groupoids rather than simply working with functors as above is to have a nice framework to handle moduli spaces parameterizing objects with automorphisms (see Example 1.18). Definition 1.15. A category fibered in groupoids over S is a category X together with a functor p : X → Sch/S such that: (1) (“existence of pullbacks”) For every morphism of S-schemes T1 → T2 and object ξ2 of X over T2 , there exists an object ξ1 over T1 completing the diagram ξ1 T1 α f ξ2 T2 where the morphism α is over f (i.e. p(α) = f ). (2) (“uniqueness and composition of pullbacks”) For all diagrams ξ1 ξ2 ξ3 T2 T3 T1 there exists a unique arrow ξ1 → ξ2 over T1 → T2 filling in the diagram. We will often simply write X for a category fibered in groupoids over S where it is implicitly understood that part of the data is the functor p : X → Sch/S. 10 ALPER Remark 1.16. Axiom (2) above implies that the pullback in Axiom (1) is unique up to unique isomorphism. Often we write ξ2 |T1 to indicate a choice of pullback of ξ2 under T1 → T2 . If X is a category fibered in groupoids over Sch/S and T is an S-scheme, we define the fiber category over T , denoted by X(T ), as the category whose objects are objects of X over T and whose morphisms are morphisms of X over the identity morphism idT : T → T . Axioms (1) and (2) imply that X(T ) is a groupoid, i.e. all morphisms in X(T ) are isomorphisms. Example 1.17. (Functors as categories fibered in groupoids) A contravariant functor F : Sch/S → Sets may be viewed as a category fibered in groupoids over Sch/S as follows. Let XF be the category whose objects are pairs (T, ξ), where T is an S-scheme and ξ ∈ F (T ). A morphism (T, ξ) → (T ′ , ξ ′ ) in the category XF is given by a morphism f : T → T ′ such that the pullback of ξ ′ via f is ξ (i.e. F (f )(ξ ′) = ξ). The functor XF → Sch/S takes (T, ξ) to T and a morphism (T, ξ) → (T ′ , ξ ′) to T → T ′ . It is easy to see that XF is a category fibered in groupoids over S. In this case, pullbacks (as defined in Definition 1.15(1)) are unique and each fiber category XF (T ) is a setoid, i.e. a set with identity morphisms. Example 1.18. (The moduli space Mg of smooth curves) We define Mg as the category of pairs (T, C → T ) where T is a scheme over k and C → T is a smooth proper morphism such that every geometric fiber is a connected genus g curve. A morphism (T, C → T ) → (T ′ , C′ → T ′ ) is the data of a cartesian diagram C C′  T. T The functor Mg → Sch/S takes (T, C → T ) to T and a diagram as above to the morphism T → T ′ . It is easy to see that Mg is a category fibered in groupoids over k. If C is a smooth curve over k, note that the morphisms from C to C in the fiber category Mg (k) correspond to automorphisms of C. We say that a category fibered in groupoids X over S is limit preserving if for every direct limit lim Bλ of OS -algebras, the natural functor −→ lim X(Spec Bλ ) → X(Spec lim Bλ ) −→ −→ is an equivalence of categories. As before, we have a Yoneda’s lemma which asserts that if T is an S-scheme, there is a natural equivalence of categories between X(T ) and the category Hom(T, X) of morphisms T → X of categories fibered in groupoids over S.4 4 Here T is considered as the corresponding category fibered in groupoids (for instance by first considering the corresponding functor as in (1.1) and then the corresponding category fibered in groupoids via Example 1.17). A morphism X1 → X2 of categories fibered in ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 11 We now restate Artin’s approximation using categories fibered in groupoids rather than functors. Theorem 1.19 (Groupoid version of Artin approximation). Let S be a scheme of finite type over k and X be a limit preserving category fibered in groupoids b S,s . For any over S. Let s ∈ S be a k-point and ξb an object of X over Spec O ′ ′ integer N ≥ 0, there exist an étale morphism (S , s ) → (S, s) and an element ′ b ξ ′ of X over S ′ such that ξ| Spec(OS,s /mN+1 ) and ξ |Spec(OS ′ ,s′ /mN+1 ) are isomorphic s s′ N +1 (under the identification OS,s /mN +1 ∼ = OS ′ ,s′ /m ′ ). s s Proof. The argument for the functorial case of Artin’s approximation goes through essentially without change. Alternatively, it can be seen to follow directly from the functorial version by considering the underlying functor F : Sch/S → Sets where for an S-scheme T , the set F (T ) is the set of isomorphism classes of X(T ).  groupoids over S is a functor X1 → X2 such that the diagram X1 X2 Sch/S strictly commutes. 12 ALPER Lecture 2: Artin algebraization The goal of this lecture is to prove Artin algebraization. We follow the ideas of Conrad and de Jong from [CJ02] (see also [Stacks, Tag 07XB]). Namely, we will show how Artin approximation (Theorem 1.8) implies a stronger approximation result (Theorem 2.1), which we refer to as Conrad–de Jong approximation, and then show how this implies Artin algebraization (Theorem 2.12). The logical flow of implications is: Néron–Popescu desingularization w w  Artin approximation w w  Conrad–de Jong approximation w w  Artin algebraization 2.1. Conrad–de Jong approximation. In Artin approximation the initial b S,s which is data is an object over a complete local noetherian k-algebra O assumed to be the completion of a finitely generated k-algebra at a maximal ideal. We will now see that a similar approximation result still holds if this latter hypothesis is dropped where one approximates both the complete local ring and the object over this ring. Recall first that if (A, m) is a local ring and M is an L A-module, then the associated graded module of M is defined as Grm M = n≥0 mn M/mn+1 M. Theorem 2.1 (Conrad–de Jong approximation). Let X be a limit preserving category fibered in groupoids over k. Let (R, m) be a complete local noetherian k-algebra and let ξb be an object of X over Spec R. Then for every integer N ≥ 0, there exist (1) an affine scheme Spec A of finite type over k and a k-point u ∈ Spec A, (2) an object ξA of X over Spec A, +1 , (3) an isomorphism αN +1 : R/mN +1 ∼ = A/mN u b (4) an isomorphism of ξ|Spec(R/mN+1 ) and ξA |Spec(A/mN+1 ) via αN +1 , and u ∼ (5) an isomorphism Grm (R) = Grmu (A) of graded k-algebras. Remark 2.2. This was proven in [CJ02] (see also [Stacks, Tag 07XB]). The proof of this theorem will proceed by simultaneously approximating equations and relations defining R and the object ξb of X over Spec R. The statements (1)–(4) will be easily obtained as a consequence of Artin approximation. A nice insight of Conrad and de Jong is that condition (5) can be ensured by Artin approximation, and moreover that this condition suffices to ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 13 imply the isomorphism of complete local k-algebras in Artin algebraization. As such, condition (5) takes the most work to establish. Proof of Conrad–de Jong approximation (Theorem 2.1). Since X is limit preserving and R is the direct limit over its finitely generated k-subalgebras, we can find an affine scheme V = Spec B of finite type over k and an object ξV of X over V together with a 2-commutative diagram ξb Spec R V ξV X. Let v ∈ V be the image of the maximal ideal m ⊂ R. After adding generators b V,v → R → to the ring B if necessary, we can assume that the composition O 2 R/m is surjective. A basic fact about complete local noetherian rings (Lemma b V,v → R is surjective. The goal now is to simultaneously 2.15) implies that O approximate over V the equations and relations defining the closed immersion b V,v and the object ξ. b In order to accomplish this goal, we Spec R ֒→ Spec O choose a resolution (2.4) b b ⊕s −β→ O b ⊕r −αb→ O b V,v −→ R, O V,v V,v and consider the functor F : (Sch/V ) → Sets  α ⊕s β (T → V ) 7→ complexes O⊕r T −→ OT −→ OT which is easily checked to be limit preserving. The resolution in (2.4) yields b V,v ). If we apply Artin approximation (Theorem 1.8), an element of F (Spec O we obtain an étale morphism (V ′ = Spec B ′ , v ′ ) → (V, v) and an element (2.5) α′ β′ (B ′⊕r −→ B ′⊕s −→ B ′ ) ∈ F (V ′ ) such that α′ , β ′ are equal to α b, βb modulo mN +1 . Let U = Spec A ֒→ Spec B ′ = V ′ be the closed subscheme defined by im β ′ and set u = v ′ ∈ U. We have an induced object ξ V ξA : U ֒→ V ′ → V −→ X of X over U. As R = coker βb and A = coker β ′ , we have an isomorphism +1 b Spec(R/mN+1 ) and together with an isomorphism of ξ| R/mN +1 ∼ = A/mN u ξA |Spec(A/mN+1 ) . This gives statements (1)–(4). u We are left to establish statement (5). First, we provide some motivation for the technical definition (Definition 2.3) and lemma (Lemma 2.5) below. To establish (5), we need to show that there are isomorphisms mn /mn+1 ∼ = N +1 ∼ mnu /mn+1 . For n ≤ N, this is guaranteed by the isomorphism R/m = u +1 A/mN . On the other hand, for n ≫ 0, this can be seen to be a consequence u of the Artin–Rees lemma (see the proof of Lemma 2.5(3) below). We will need 14 ALPER to handle the middle range of n and we accomplish this be controlling the constant appearing in the Artin–Rees lemma. We now establish statement (5) using Definition 2.3 and Lemma 2.5. We first realize that before we applied Artin approximation, we could have increased b Therefore, we are N in order to guarantee that (AR)N holds for α b and β. free to assume this. Now statement (5) follows directly if we apply Lemma b b ⊕r −αb→ O b ⊕s −β→ O b V,v from (2.4) and the complex 2.5 to the exact complex O V,v α b′ V,v βb′ b ⊕r −→ O b ⊕s −→ O b V,v obtained by restricting (2.5) to F (Spec O b V,v ). O V,v V,v  The Artin–Rees condition. Definition 2.3. Let (A, m) be a local noetherian ring. Let ϕ : M → N be a morphism of finite A-modules. Let c ≥ 0 be an integer. We say that (AR)c holds for ϕ if ϕ(M) ∩ mn N ⊂ ϕ(mn−c M), ∀n ≥ c. Remark 2.4. The Artin–Rees lemma (see [AM69, Prop. 10.9] or [Eis95, Lem. 5.1]) implies that (AR)c holds for ϕ if c is sufficiently large. The following lemma from [CJ02, §3] (see also [Stacks, Tags 07VD and 07VF]) is straightforward to prove. Lemma 2.5. Let (A, m) be a local noetherian ring. Let α β L− →M − →N and α′ β′ L− →M − →N be two complexes of finite A-modules. Let c be a positive integer. Assume that (a) the first sequence is exact, (b) the complexes are isomorphic modulo mc+1 , and (c) (AR)c holds for α and β. Then (1) (AR)c holds for β ′ , (2) the second sequence is exact, and (3) there exists an isomorphism Grm (coker β) → Grm (coker β ′ ) of Grm (A)modules. Remark 2.6. Only conclusion (3) was used in the proof of Conrad–de Jong approximation. Statements (1) and (2) are included as they serve as convenient steps in the proof of (3). Indeed, it is the fact that (AR)c holds for β that implies the containment “⊂” in (2.6). Likewise, the other containment “⊃” will hold once we know (AR)c holds for β ′ . Proof. We claim that (β ′)−1 (mn N) ⊂ α′ (L) + mn−c M for all n ≥ c. Let m ∈ M such that β ′ (m) ∈ mn N. Suppose we can find l ∈ L such that ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 15 m0 = m − α′ (l) ∈ mr M with r < n − c. We will show that we can modify l in order to increase r by 1. Note that β(m0 ) = β ′ (m0 ) + (β − β ′ )(m0 ) = β ′ (m) + (β − β ′ )(m0 ) ∈ mn N + mr+c+1 N = mr+c+1 N Since (AR)c holds for β, we have β(m0 ) ∈ β(mr+1 M). So we can write β(m0 ) = β(m1 ) with m1 ∈ mr+1 M. As the first complex is exact, we may write m0 − m1 = α(l1 ) for l1 ∈ L. Note that m0 − m1 ∈ mr M. We now break the argument into whether or not r ≥ c. If r ≥ c, then as (AR)c holds for α, we have m0 − m1 ∈ α(mr−c L) and we may replace l1 with an element of mr−c L. In this case, (α − α′ )(l1 ) ∈ mr−c · mc+1 M = mr+1 M. On the other hand, if r < c, then we automatically have (α − α′ )(l1 ) ∈ mc+1 M ⊂ mr+1 M. Therefore, m − α′ (l + l1 ) = m0 − α′ (l1 ) = m1 + (α − α′ )(l1 ) ∈ mr+1 M. By induction, this establishes the claim. For (1), the condition that β ′ (M) ∩ mn N ⊂ β ′ (mn−c M) follows directly from the claim. For (2), observe that the claim coupled with Krull’s intersection theorem implies that \ \ (β ′ )−1 (0) = (β ′ )−1 ( mn N) ⊂ α′ (L) + mn−c M) = α′ (L) n n which gives exactness of the second sequence. For (3), for n ≥ 0, we have Grm (coker β)n = mn N/(mn+1 N + β(M) ∩ mn N) and a similar description of Grm (coker β ′ )n . To obtain an isomorphism Grm (coker β) → Grm (coker β ′ ), it clearly suffices to show that (2.6) mn+1 N + β(M) ∩ mn N = mn+1 N + β ′ (M) ∩ mn N. We first show the containment “⊂”. If n ≤ c, then the statement is clear as β = β ′ mod mc+1 . If n > c, suppose x ∈ β(M) ∩ mn N. Since (AR)c holds for β, we may write x = β(m) for m ∈ mn−c M. Let x′ = β ′ (m). Then x − x′ = (β − β ′ )(m) ∈ mc+1 · mn−c M = mn+1 N. Since (AR)c also holds for β ′ , by symmetry we obtain the other containment “⊃”.  Remark 2.7. Conrad–de Jong approximation directly implies Artin approximab S,s and N ≥ 1. Apply Conrad–de Jong tion (Theorem 1.19). Indeed, let R = O approximation to X × S to obtain a finite type morphism (U = Spec A, u) → +1 ∼ +1 (S, s), an object ξA of X over U, an isomorphism αN +1 : OS,s /mN = OU,u /mN s u b and an isomorphism ξ| ) via αN +1 . We claim ) and ξA |Spec(OU,u /mN+1 Spec(OS,s /mN+1 u s b S,s /m2 → O b U,u /m2 is an isomorthat U → S is étale at u. Since we know that O s u b S,s → O b U,u is surjective. But condition phism, the induced homomorphism O 16 ALPER (5) in Conrad–de Jong approximation gives isomorphisms N +1 N +1 mN → mN s /ms u /mu b S,s → O b U,u is injective and thus an isomorfor every N. This implies that O phism. 2.2. Artin algebraization. Artin algebraization has a stronger conclusion than Artin approximation or Conrad–de Jong approximation in that no approximation is necessary. It guarantees the existence of an object ξA over a pointed affine scheme (Spec A, u) of finite type over k which agrees with the given effective formal deformation ξb to all orders. However, in order to enb This sure this, it is necessary to impose a further condition on the object ξ. condition is known as formal versality and is extremely natural (see Remarks 2.9-2.11). Definition 2.8. Let X be a category fibered in groupoids over k. Let R be a complete local noetherian k-algebra and x ∈ Spec R be the closed point. We say that an object ξb of X over Spec R is formally versal at x if for every commutative diagram Spec k(x) Spec B (2.7) Spec R ξb Spec B ′ X where B ′ → B is a surjection of artinian k-algebras, there is a lift Spec B ′ → Spec R filling in the above diagram. Remark 2.9. In other words, the formal versality of ξb means that whenever you have a surjection B ′ → B of artinian OS -algebras, an object η ′ of X over b Spec B ∼ Spec B ′ , a morphism Spec B → Spec R, and an isomorphism α : ξ| = ′ ′ η |Spec B , there exist a morphism Spec B → Spec R and an isomorphism α′ : ηb|Spec B′ ∼ = η ′ extending α. b Spec k(x) be the restriction of ξb to the closed point. Then Let ξ0 = ξ| η : Spec B → X can be viewed as an infinitesimal deformation of ξ0 and η ′ : Spec B ′ → X a further infinitesimal deformation of η. In colloquial language, the condition of formal versality implies that the family of objects ξb: Spec R → X contains all infinitesimal deformations of ξ0 . Remark 2.10. The lifting criterion in Diagram (2.7) above should remind the reader of the formal lifting property for smooth morphisms. Indeed, if f : X → Y is a morphism of finite type k-schemes, then it is a theorem of Grothendieck [EGA, IV.17.14.2] that f is smooth at x if and only if the above lifting criterion holds (replacing of course ξb: Spec R → X with f : X → Y ). Remark 2.11. It is easy to see that the condition of formal versality of b Spec R/mn+1 } ξb: Spec R → X only depends on the compatible family {ξn = ξ| ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 17 of restrictions. Therefore, we can extend the above definition to compatible families {ξn }. Theorem 2.12 (Artin algebraization). Let X be a limit preserving category fibered in groupoids over k. Let (R, m) be a complete local noetherian k-algebra, and let ξb be a formally versal object of X over Spec R. There exist (1) an affine scheme Spec A of finite type over k and a k-point u ∈ Spec A, (2) an object ξA of X over Spec A, ∼ b (3) an isomorphism α : R → A mu of k-algebras, and b Spec R/mn+1 ∼ (un(4) a compatible family of isomorphisms ξ| = ξU |Spec A/mn+1 u n+1 ∼ n+1 der the identification R/m = A/mu ) for n ≥ 0. Remark 2.13. This was first proven in [Art69b]. Remark 2.14. In the case that R is known to be the completion of a finitely generated k-algebra, this theorem can be viewed as an easy consequence of Artin approximation. Indeed, one applies Artin approximation with N = 1 and then uses the formal versality condition to obtain compatible ring homobmu which morphisms R → A/mn+1 and therefore a ring homomorphism R → A u bmu are abstractly isomorphic, the is an isomorphism modulo m2 . As R and A bmu is an isomorphism (see Footnote 2) and the statehomomorphism R → A ment follows. We leave the details to the reader but remark that this argument is very analogous to the proof of Artin algebraization below. For the general case, since we don’t know R is the completion of a finitely generated k-algebra, we apply Conrad–de Jong approximation instead of Artin approximation. Proof of Artin algebraization (Theorem 2.12). Applying Conrad–de Jong approximation with N = 1, we obtain an affine scheme Spec A of finite type over k with a k-point u ∈ Spec A, an object ξA of X over Spec A, an isomorphism b Spec(R/m2 ) → ξA |Spec(A/m2 ) , α2 : Spec A/m2u → Spec R/m2 , an isomorphism ι2 : ξ| u ∼ and an isomorphism Grm (R) = Grmu (A) of graded k-algebras. We claim that α2 and ι2 can be extended to a compatible family of morb phisms αn : Spec A/mn+1 → Spec R and isomorphisms ιn : ξ| u ) → Spec(A/mn+1 u n+1 . ξA | By induction, suppose we are given αn and ιn . Since ξb is Spec(A/mu ) formally versal, there is a lift αn+1 : Spec A/mn+1 → Spec R filling in the commutative diagram Spec A/mnu αn Spec R αn+1 Spec A/mn+1 u ξA ξb X, which establishes the claim. bmu which is surBy taking the limit, we have a homomorphism α b: R → A 2 jective as α b restricts to the given isomorphism R/m → A/m2u (where we have 18 ALPER used Lemma 2.15). On the other hand, for each n, we know that the k-vector N +1 spaces mN /mN +1 and mN have the same dimension. This implies that u /mu α b is an isomorphism which finishes the proof.  In the above arguments, this fact was used several times. Lemma 2.15. Let (A, mA ) and (B, mB ) be local noetherian complete rings. If A → B is a local homomorphism such that A/m2A → B/m2B is surjective, then A → B is surjective. Proof. This follows from the following version of Nakayama’s lemma for complete localTrings (A, m): if M is a (not-necessarily finitely generated) A-module such that k mk M = 0 and m1 , . . . , mn ∈ F generate M/mM, then m1 , . . . , mn also generate M (see [Eis95, Exercise 7.2]).  2.3. Algebraic stacks. We now quickly introduce the notion of stacks and algebraic stacks. ` We say that {Si → S} is an étale covering if each Si → S is étale and Si → S is surjective. To simplify the notation, we set Sij := Si ×S Sj and Sijk := Si ×S Sj ×S Sk . Definition 2.16. A category X fibered in groupoids over a scheme S is a stack over S if for any étale covering {Ti → T } of an S-scheme T , we have: (1) (“morphisms glue”) For objects a, b in X over T and morphisms φi : a|Ti → b over Ti → T such that φi |Tij = φj |Tij , then there exists a unique morphism φ : a → b over the identity with φ|Ti = φi . Pictorially, we are requiring that a commutative diagram a|Ti Ti φi a|Tij a φ b over Tij T φj a|Tj Tj can be completed in a unique way by an arrow φ : a → b. (2) (“objects glue”) For objects ai over Ti with isomorphisms αij : ai |Tij → aj |Tij over idTij satisfying the cocycle condition αij ◦ αjk = αik on Tijk , then there exist a unique object a over T and isomorphisms φi : a|Ti → ai over idTi such that αij ◦ φi |Tij = φj |Tij . Pictorially, we are requiring ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 19 that diagrams ai αij ai |Tij −→ aj |Tij Ti a aj over Tij T Tj where the αij satisfy the cocycle condition can be filled in with an object a over T . Remark 2.17. These gluing conditions are extremely natural and should already be familiar to you. For instance, rather than the étale topology, conS sider the Zariski topology (i.e. only consider Zariski covers S = Si ) and consider the category fibered in groupoids X over Spec Z parametrizing pairs (T, F), where T is a scheme and F is a quasi-coherent sheaf on T . A morphism (T ′ , F ′) → (T, F) in X is the data of a morphism f : T ′ → T together with ∼ an isomorphism F → f ∗ F ′ . Then the fact that X is a stack (in the Zariski topology) is the basic fact that quasi-coherent sheaves and their morphisms can be uniquely glued. In this case, X is also a stack in the étale (or even fppf) topology. Definition 2.18. Let S be a scheme. A stack X over S is algebraic if (1) the diagonal ∆ : X → X ×S X is representable, and (2) there exist a scheme U and a representable, smooth and surjective morphism U → X. Remark 2.19. The representability condition in (1) means that for every scheme T and pair of morphisms ξ, η : T → X, the fiber product X ×∆,X×S X,(ξ,η) T is an algebraic space. This in turn translates to the condition that the functor IsomT (ξ, η) : Sch/T → Sets, (T ′ → T ) 7→ MorX(T ′ ) (ξ|T ′ , η|T ′ ) is representable by an algebraic space, where MorX(T ′ ) (ξ|T ′ , η|T ′ ) denotes the set of morphisms (which are necessarily isomorphisms) in the fiber category X(T ′ ) of pullbacks of ξ and η to T ′ . In (2), the condition that U → X is representable, smooth and surjective means that for any morphism T → X where T is a scheme, the fiber product T ×X U is an algebraic space and T ×X U → T is smooth and surjective. (In fact, condition (2) can be shown to imply condition (1).) 2.4. Artin’s axioms. A spectacular application of Artin’s algebraization theorem is Artin’s local criterion for algebraicity of stacks. This is a foundational result in the theory of algebraic stacks and was proved by Artin in the very same paper [Art74] where he introduced algebraic stacks. We first state a conceptual version of Artin’s axioms that can be proved easily using only Artin algebraization. 20 ALPER Theorem 2.20. (Artin’s axioms—first version) Let X be a stack over k. Then X is an algebraic stack locally of finite type over k if and only if the following conditions hold: (0) (Limit preserving) The stack X is limit preserving. (1) (Representability of the diagonal) The diagonal X → X × X is representable. (2) (Existence of formal deformations) For every x : Spec k → X, there exist a complete local noetherian k-algebra (R, m) and a compatible family of morphism ξn : Spec R/mn+1 → X with x = ξ0 such that {ξn } is formally versal (as defined in Remark 2.11). (3) (Effectivity) For every complete local noetherian k-algebra (R, m), the natural functor X(Spec R) → lim X(Spec R/mn ) ←− is an equivalence of categories. (4) (Openness of versality) For any morphism ξU : U → X where U is a scheme of finite type over k and point u ∈ U such that ξU is formally b U,u → X is formally versal at u (i.e. the induced morphism Spec O versal), then ξU is formally versal in an open neighborhood of u. Proof. The “only if” direction is fairly straightforward and left to the reader. For the “if” direction, we first remark that Condition (1) implies that any morphism U → X from a scheme U is necessarily representable. Let x : Spec k → X be a morphism. We need to find a commutative diagram Spec k u U x X where U is a scheme and U → X is smooth. Condition (2) and (3) guarantee that there exists a complete local noetherian k-algebra (R, m) with R/m ∼ =k together with a commutative diagram Spec R Spec k x ξb X such that ξb is formally versal. By Artin’s algebraization theorem, we can find an affine scheme U = Spec A of finite type over k, a point u ∈ U, a morphism b U,u yielding a commutative diagram ξ : U → X, and an isomorphism R ∼ =O Spec k Spec R U ξb x ξ X. ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 21 We know that U → X is formally versal at u and condition (4) implies that it is formally versal in a neighborhood. But this implies that U → X is smooth in a neighborhood of u.5  Remark 2.21. In practice, Condition (1) is often easy to verify directly. Alternatively one could also apply the theorem to the diagonal X → X × X (i.e. to the sheaves IsomT (ξ, η) defined in Remark 2.19). Condition (2) is often a consequence of Schlessinger and Rim’s theorem on existence of formally versal deformations [Sch68], [Rim80]. Condition (3) is often a consequence of Grothendieck’s existence theorem [EGA, III.5.1.4]. In some simplified moduli problems, Condition (4) can be checked directly. For instance, if for each point x : Spec k → X, the formal deformation space (R, m) (as in Condition (2)) is regular (or more generally normal, geometrically unibranch and free of embedded points), then Condition (4) is automatically satisfied; see [Art69b, Thm. 3.9]. In more general moduli problems, Condition (4) is often guaranteed as a consequence of a well-behaved deformation and obstruction theory. This will be explained in the next section. 2.5. A more refined version of Artin’s axioms. We will now state a refinement of Theorem 2.20 that is often easier to verify in practice. In order to state the theorem succinctly, we need to introduce a bit of notation. Let A be a finitely generated k-algebra and let M be a finite A-module. Denote by A[M] the ring A ⊕ M defined by M 2 = 0. Let ξ : Spec A → X. Denote by Def ξ (M) the set of isomorphism classes of diagrams ξ Spec A X η Spec A[M]. Let Autξ (M) be the group of automorphisms of the trivial deformation Spec A[M] → Spec A → X which restrict to the identity automorphism of ξ. We remark that Autξ (M) naturally has the structure of an A-module.6 Condition (1a) below implies that Def ξ (M) is naturally an A-module.7 5 This isn’t a trivial implication. The formal versality condition is only a condition on lifting local artinian k-algebras but a theorem of Grothendieck [EGA, IV.17.14.2] implies that this is sufficient to guarantee smoothness. 6 Indeed, for a ∈ A, the A-algebra homomorphism A[M ] → A[M ], a0 + m0 7→ a0 + am0 induces a morphism fa : Spec A[M ] → Spec A[M ] over Spec A which in turn induces a group homomorphism Autξ (M ) → Autξ (M ) obtained by pulling back automorphisms along fa . 7 This may seem surprising since in condition (1a), the k-algebras A, A′ , B are only assumed to be artinian. However, as shown in [HR13], this is strong enough to imply that for any finitely generated k-algebra A and finite A-module M , the natural map X(Spec(A[M ⊕ M ])) → X(Spec A[M ]) ×X(Spec A) X(Spec A[M ]) 22 ALPER Note that Autξ (k) is the group of infinitesimal automorphism of ξ, and Def ξ (k) is the set of isomorphism classes of deformations over the dual numbers Spec k[ǫ] which can be thought of as the Zariski tangent space. Theorem 2.22 (Artin’s axioms—refined version). Let X be a stack over k. Then X is an algebraic stack locally of finite type over k if and only if the following conditions hold: (0) (Limit preserving) The stack X is limit preserving. (1) (Existence of formal deformations) (a) (Homogeneity) For every diagram A A′ B A′ ×A B of finitely generated local artinian k-algebras where A → A′ is surjective, the natural functor X(Spec(A′ ×A B)) → X(Spec A′ ) ×X(Spec A) X(Spec B) is an equivalence of categories. (b) (Finiteness of tangent spaces) For every object ξ : Spec k → X, Autξ (k) and Def ξ (k) are finite dimensional k-vector spaces. (2) (Effectivity) For every complete local noetherian k-algebra (R, m), the natural functor X(Spec R) → lim X(Spec R/mn ) ←− is an equivalence of categories. (3) (Openness of versality) (a) (Coherent deformation theory) For every finitely generated k-algebra A, finite A-module M and object ξ : Spec A → X, the A-modules Autξ (M) and Def ξ (M) are finite. Thus there are A-linear functors Autξ : Finite A-mod → Finite A-mod Def ξ : Finite A-mod → Finite A-mod. (b) (Existence of an obstruction theory) For every finitely generated k-algebra A and object ξ : Spec A → X, there exists an A-linear functor Obξ : Finite A-mod → Finite A-mod. is an equivalence of categories. Therefore, addition M ⊕M → M induces an A-algebra homomorphism A[M ⊕ M ] → A[M ] and thus a functor X(Spec A[M ]) ×X(Spec A) X(Spec A[M ]) ∼ = X(Spec A[M ⊕ M ]) → X(Spec A[M ]) which defines addition on Def ξ (M ). Multiplication by an element a ∈ A induces an A-algebra homomorphism A[M ] → A[M ] and therefore a functor X(Spec A[M ]) → X(Spec A[M ]) which defines multiplication by a ∈ A. ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 23 Moreover, for each surjection A′ → A with squarezero kernel I, there exists an element oξ (A′ ) ∈ Obξ (I) such that there is an extension Spec A ξ X Spec A′ if and only if oξ (A′ ) = 0. (c) (Constructibility) For every finitely generated k-algebra A, finite A-module M supported on Ared and object ξ : Spec A → X, there exists a dense open subset U ⊂ Spec A such that for every k-point u ∈ U, the natural maps Autξ (M) ⊗A k(u) → Autξ|u (M ⊗A k(u)) Def ξ (M) ⊗A k(u) → Def ξ|u (M ⊗A k(u)) Obξ (M) ⊗A k(u) → Obξ (M ⊗A k(u)) are isomorphisms. Remark 2.23. An analogous statement is true after replacing Spec k with an arbitrary excellent scheme after suitably modifying Conditions 1–3. Artin proved a version of the above theorem in [Art74]. We will not give a complete proof of this statement here and restrict ourselves to only making a few comments. First, one reduces to the case that X → X × X is representable by bootstrapping the below argument using automorphisms and deformations (rather than deformations and obstructions) to conclude that the isomorphism sheaves (as defined in Remark 2.19) are representable. Conditions 1(a)–(b) above allow us to apply Schlessinger and Rim’s theorem [Sch68], [Rim80] which guarantees the existence of formal deformation, i.e. Condition 1 in Theorem 2.20 holds. This condition is often fairly easy to check in practice for moduli problems. In practice, Condition 2 is often established as a direct consequence of Grothendieck’s Existence Theorem. Conditions 3(a)–(c) can be shown to imply that formal versality is an open condition, i.e. Condition 3 in Theorem 2.20 holds. To this end, it is necessary to show that if ξ : U → X is a morphism which is formally versal at u ∈ U, then for points v ∈ U in a sufficiently small neighborhood of u, any commutative diagram of the form Spec B (2.8) U ξ Spec B ′ X, where B ′ → B is a surjection of artinian k-algebras and Spec B → U maps to v, has an extension. This is a deformation problem. Vaguely speaking, 24 ALPER conditions 3(a)–(c) imply that the deformation theory of U → X is controlled in some sense by a coherent module, and formal versality at u implies that this coherent module vanishes at u and thus in an open neighborhood. Condition 3 certainly takes the most time and space to formulate. Moreover the most difficult part of the proof of Theorem 2.22 is to show that Condition 3 implies openness of versality. Nevertheless it is quite easy to establish Condition 3 in practice. For many moduli problems, one shows that if M is a finite A-module, then the A-modules Autξ (M), Def ξ (M), and Obξ (M) are naturally identified with certain cohomology modules in which case Condition 3(c) can be seen to follow from cohomology and base change. For example, if X is the moduli space of smooth curves as in Example 1.18 and ξ corresponds to a curve C → Spec A, then Autξ (M) = H0 (C, TC ⊗ M), Def ξ (M) = H1 (C, TC ⊗ M) and Obξ (M) = H2 (C, TC ⊗ M) = 0. Here the constructibility condition in 3(c) follows directly from cohomology and base change applied at the generic points of Spec A. We recommend [Hal14] for a conceptual proof of Artin’s criterion. There is some flexibility in how one precisely formulates Conditions 1 and 3. We recommend [HR13] for a technical account of various formulations of Artin’s axioms and in particular for a complete proof of the formulation given in Theorem 2.22. ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 25 Lecture 3: The geometry of quotient stacks In this lecture, we discuss a particularly important example of an algebraic stack, namely the quotient stack [X/G], which arises from the action of an algebraic group G on a scheme X. We will emphasize that the geometry of a quotient stack [X/G] is nothing other than the G-equivariant geometry of X. In this lecture, we discuss when a general algebraic stack is a quotient stack and then turn to the main theorem of these lectures which gives conditions for an algebraic stack to be étale locally a quotient stack. 3.1. Quotient stacks. Definition 3.1. Let G be a smooth affine group scheme over k acting on a scheme X over k. We define the quotient stack of X by G, denoted by [X/G], g π to be the category of objects (T, P − → T, P − → X) where T is a scheme, P → T is a principal G-bundle and P → X is a G-equivariant morphism. A morphism g′ g π π′ (T, P − → T, P − → X) → (T ′ , P ′ − → T ′, P ′ − → X) in this category consists of a commutative diagram g P′ P π T  g′ X π′ T′ where the square is cartesian. Remark 3.2. With the above hypotheses, [X/G] is an algebraic stack. Here Axiom (2) of the definition of an algebraic stack is satisfied by the projection X → [X/G]. The morphism X → [X/G] corresponds via Yoneda’s lemma to the object of [X/G] over X defined by the trivial G-bundle G × X → X together with the G-equivariant morphism σ : G × X → X (corresponding to the action of G on X). The morphism X → [X/G] is a G-torsor. Remark 3.3. In fact, in characteristic p, if G is not smooth, it can still be shown that [X/G] is an algebraic stack. Definition 3.4. We say that an algebraic stack X is a global quotient stack if X∼ = [U/ GLn ] where U is an algebraic space with an action of GLn . Remark 3.5. If G is an affine group scheme of finite type over k and U is an algebraic space over k with an action of G, then [U/G] is a global quotient stack. To see this, choose a faithful representation G ⊂ GLn . Then [U/G] ∼ = [(U ×G GLn )/ GLn ] where U ×G GLn = (U × GLn )/G (and here G acts diagonally on U × GLn ). Quotient stacks provide very important examples of algebraic stacks as their geometry is particularly well understood. In fact, the geometry of a quotient stack X = [X/G] is nothing other than the G-equivariant geometry of X. To 26 ALPER justify this philosophy, we provide a dictionary between geometric concepts of [X/G] and G-equivariant geometric concepts of X. G-equivariant geometry of X Geometry of X = [X/G] a point x : Spec k → X a G-orbit Gx ⊂ X the automorphism group AutX(k) (x) the stabilizer Gx a function f ∈ Γ(X, OX ) a G-invariant function f ∈ Γ(X, OX )G a morphism X → Y where Y is a a G-invariant morphism X → Y scheme (or an algebraic space) a line bundle on X a line bundle on X with a G-action a coherent OX -module a coherent OX -module with a G-action properties of the diagonal X → X × X properties of the group action G×X → X ×X the tangent space TX,x the normal TX,x /TGx,x space to the orbit Above, we used the notion of the tangent space of a stack at a point. Since this will be important later, let’s define it precisely. Definition 3.6. If X is an algebraic stack of finite type over k and x is a k-point, then the tangent space of X at x, denoted by TX,x , is defined as the set of isomorphism classes of extensions Spec k x X Spec k[ǫ]/ǫ2 . Remark 3.7. The equivalence TX,x ∼ = TX,x /TGx,x only holds when the stabilizer Gx is smooth. Example 3.8. Consider the action of the multiplicative group Gm = Spec k[t]t on An via multiplication. Then [An /Gm ] is an algebraic stack. The origin is the only closed k-point of [An /Gm ] as all other k-points have the origin in their closure. As [(An \ 0)/Gm ] = Pn−1 , there is an open substack Pn−1 ⊂ [An /Gm ]. Example 3.9. Consider the action of Gm on A2 via t·(x, y) = (tx, t−1 y). Then the closed k-points of [A2 /Gm ] correspond to the origin together with the hyperbolas {xy = a} ⊂ A2 (i.e. the Gm -orbit of (a, 1) for a 6= 0). The two orbits Gm (1, 0) and Gm (0, 1) both have the origin in their closure. Here the open substack [(A2 \ 0)/Gm ] ⊂ [A2 /Gm ] is isomorphic to the non-separated affine line ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 27 with a double origin. The morphism [A2 /Gm ] → A1 given by (x, y) 7→ xy gives a bijective correspondence between closed k-points in [A2 /Gm ] and k-points in A1 . Note that the fiber over the origin consists of 3 points corresponding to the orbits in the union of the x and y-axes. A central question is: Question 3.10. When is an algebraic stack X a global quotient? This question is very difficult. As we will see below, the question of whether X is a global quotient is related to other global geometric properties of X. 3.2. A summary of known results on quotient stacks. We first make a basic observation. In this discussion, we restrict ourselves to the case that X is a quasi-separated algebraic stack of finite type over k. If X = [X/ GLn ] is a global quotient, then X → X is a GLn -torsor and one can construct [X × An / GLn ] which is a vector bundle over X with the property that each stabilizer acts faithfully on the fiber. Conversely, given a vector bundle V → X with this same property, then the frame bundle Frame(V) is an algebraic space and Frame(V) → X is a GLn -torsor. We conclude that X ∼ = [alg space/ GLn ] (i.e. a global quotient) there exists a vector bundle V on X such that for every point x, the stabilizer Gx acts faithfully on the fiber V ⊗ k(x). In a similar spirit, a theorem due to Totaro [Tot04] (generalized by Gross [Gro13] to the non-normal case) implies X∼ = [quasi-affine/ GLn ] X∼ = [affine/ GLn ] ⇐⇒ ⇐⇒ X satisfies the resolution property (i.e. every coherent OX -module is surjected onto by some vector bundle) char(k) = 0 ⇐⇒ X satisfies the resolution property, has affine diagonal, and Hi (X, F) = 0 for every coherent OX -module F and i > 0. The last case when X ∼ = [Spec A/ GLn ] provides quotient stacks of the simplest structure. In fact, it is useful to replace GLn with any linearly reductive group scheme G. Recall that an affine group scheme G of finite type over k is called linearly reductive if the functor G-Rep → k-Vect, V → VG is exact (or equivalently every G-representation is completely reducible). If G is a linearly reductive group (e.g. G = GLn in characteristic 0) acting on an affine scheme X = Spec A, then there is an affine GIT quotient [Spec A/G] → Spec A//G := Spec AG whose geometry is very well understood. We now mention two nice results from [EHKV01]. 28 ALPER Proposition 3.11. [EHKV01, Thm. 2.18] If X is a smooth and separated Deligne-Mumford stack of finite type over k with generically trivial stabilizer, then X is a global quotient. Proposition 3.12. [EHKV01, Thm. 3.6] Let X be a noetherian scheme and let X → X be a Gm -gerbe corresponding to α ∈ H2 (X, Gm ). Then X is a global quotient if and only if α is in the image of the Brauer map Br(X) → H2 (X, Gm ). Remark 3.13. This latter proposition can be used to construct algebraic stacks that are not global quotient stacks, including a non-separated Deligne-Mumford stack and a normal (but non-smooth) algebraic stack with affine diagonal. See [EHKV01, Examples 2.21 and 3.12]. The following two questions are completely open. Question 3.14. Is every separated Deligne-Mumford stack a global quotient stack? Question 3.15. Does every smooth algebraic stack with affine diagonal satisfy the resolution property? The question of whether a given algebraic stack is a global quotient stack appears very difficult and is related to both global geometric properties (such as existence of vector bundles) as well as arithmetic questions (such as the surjectivity of the Brauer map). Below we will attempt to address the simpler question: when are algebraic stack étale locally quotient stacks? 3.3. The local quotient structure of algebraic stacks. Recall that k denotes an algebraically closed field of any characteristic. Also recall that we denote by TX,x the tangent space of a stack X at x; see Definition 3.6. Theorem 3.16. Let X be a quasi-separated algebraic stack, locally of finite type over k, with affine stabilizers. Let x ∈ X be a smooth k-point with smooth and linearly reductive stabilizer group Gx . Then there exist an affine and étale morphism (U, u) → (TX,x //Gx , 0), and a cartesian diagram   f [TX,x /Gx ], 0 (X, x) [Spec A/Gx ], w  (TX,x //Gx , 0) (U, u) such that f is étale and induces an isomorphism of stabilizer groups at w. Remark 3.17. This theorem was established in [AHR15, Thm. 1.1]. The theorem is true even if the stabilizer Gx is not smooth if one replaces the tangent space TX,x with the normal space Nx = (I/I2 )∨ , where I ⊂ OU denotes the sheaf of ideals defining x in an open substack U ⊂ X where x is a closed point. In the case that the stabilizer is smooth, TX,x ∼ = Nx . ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 29 This theorem implies that X and [TX,x /Gx ] have a common étale neighborhood of the form [Spec A/Gx ]. In the case that x is not necessarily a smooth point of X, one can prove a similar structure theorem: Theorem 3.18. [AHR15, Thm. 1.2] Let X be a quasi-separated algebraic stack, locally of finite type over an algebraically closed field k, with affine stabilizers. Let x ∈ X be a k-point with a linearly reductive stabilizer. Then there exist an affine scheme Spec A with an action of Gx , a k-point w ∈ Spec A fixed by Gx , and an étale morphism  f : [Spec A/Gx ], w → (X, x) such that f induces an isomorphism of stabilizer groups at w. These theorems justify the philosophy that quotient stacks of the form [Spec A/G], where G is a linearly reductive group, are the building blocks of algebraic stacks near points with linearly reductive stabilizers in the same way that affine schemes are the building blocks of schemes (and algebraic spaces). These theorems were known in the following special cases: (1) X is a Deligne-Mumford stack [AV02]. (2) More generally, X has quasi-finite inertia (i.e. all stabilizers groups are finite but not necessarily reduced). This follows from [AOV08, Thm. 3.2] and [KM97, §4]. (3) X ∼ = [X/G] where G is a linearly reductive algebraic group acting on an affine scheme X and Gx is smooth and linearly reductive. This case is often referred to as Luna’s étale slice theorem [Lun73, p. 97]. We will discuss the relation between the theorems above and Luna’s étale slice theorem in Section 4.4.1. We do emphasize though that there is still content in the theorems even in the case that X ∼ = [Spec A/G] as the theorems provide étale neighborhoods which are quotient stacks of affine schemes by the stabilizer. (4) X ∼ = [X/G] where G is a smooth affine group scheme and X is a normal scheme [AK15, §2.2]. (5) X = Mss g,n is the moduli stack of semistable curves. This is the central result of [AK15], where it is also shown that f can taken to be representable. We mention here counterexamples to Theorems 3.16 and 3.18 if either the linearly reductive hypothesis or the condition of affine stabilizers is weakened. Example 3.19. Some reductivity assumption of the stabilizer Gx is necessary in Theorem 3.18. For instance, consider the group scheme G = Spec k[x, y]xy+1 → A1 = Spec k[x] (with multiplication defined by y 7→ xyy ′ + y + y ′), where the generic fiber is Gm but the fiber over the origin is Ga . Let X = BG and x ∈ X be the point corresponding to the origin. There does not exist an étale morphism ([W/Ga ], w) → (X, x), where W is an algebraic space over k with an action of Ga . 30 ALPER Example 3.20. It is essential to require that the stabilizer groups are affine in a neighborhood of x ∈ X. For instance, let X be a smooth curve and E → X be a group scheme whose generic fiber is a smooth elliptic curve but the fiber over a point x ∈ X is isomorphic to Gm . Let X = BE. There is no étale morphism ([W/Gm ], w) → (X, x), where W is an affine k-scheme with an action of Gm . 3.4. Ingredients in the proof of Theorem 3.16. There are four main techniques employed in the proof of Theorem 3.16: (1) (2) (3) (4) deformation theory, coherent completeness, Tannakian formalism, and Artin approximation. Deformation theory produces an isomorphism between the nth infinitesimal neighborhood Tn of 0 in T = [TX,x /Gx ] and the nth infinitesimal neighborhood Xn of x in X. It is not at all obvious, however, that the system of closed morphisms {fn : Tn → X} algebraizes. We establish algebraization in two steps. The first step is effectivization. To accomplish this, we prove a result similar in spirit to Grothendieck’s existence theorem [EGA, III.5.1.4], which we refer to as coherent completeness. To motivate the definition, recall that if (A, m) is a complete local noetherian ring, then Coh(Spec A) = limn Coh(Spec(A/mn+1 )). ←− Here, if X is a noetherian scheme, then Coh(X) denotes the category of coherent OX -modules. Black Box 3. (Coherent completeness) Let G be a linearly reductive affine group scheme over an algebraically closed field k. Let Spec A be a noetherian affine scheme with an action of G, and let x ∈ Spec A be a k-point fixed by G. Suppose that AG is a complete local ring. Let X = [Spec A/G] and let Xn be the nth infinitesimal neighborhood of x. Then the natural functor  (3.9) Coh(X) → lim Coh Xn ←− n is an equivalence of categories. Remark 3.21. This was proven in [AHR15, Thm. 3]. The proof is not tremendously difficult but does require some care. Remark 3.22. Let Y = Spec AG and let Yn = Spec AG /(m ∩ AG )n+1 be the nth nilpotent thickening of the image of x under Spec A → Spec AG . The above theorem implies that (3.10) Coh(X) → lim Coh(X ×Y Yn ) ←− n ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 31 is an equivalence, which had been established in [GZB15]. We emphasize that the above theorem is significantly stronger in that it involves families of coherent sheaves defined only on the nilpotent thickenings of the closed point x ∈ X rather the fiber X ×Y Y0 . Example 3.23. Consider X = [AN /Gm ]. Then the theorem states that Gm -equivariant sheaves on AN are equivalent to compatible families of Gm equivariant sheaves on Spec k[x1 , . . . , xN ]/(x1 , . . . , xN )n+1 . Meanwhile, the equivalence (3.10) is trivial as Yn = Y = Spec k. The other key ingredient in the proof of Theorem 3.16 is Tannakian formalism. Black Box 4. (Tannakian formalism) Let X be an excellent stack and Y be a noetherian algebraic stack with affine stabilizers. Then the natural functor  Hom(X, Y) → Homr⊗,≃ Coh(Y), Coh(X) is an equivalence of categories, where Homr⊗,≃ (Coh(Y), Coh(X)) denotes the category whose objects are right exact monoidal functors Coh(Y) → Coh(X) and morphisms are natural isomorphisms of functors. Remark 3.24. In the above generality, this result was established in [HR14, Thm. 1.1]. Other versions had been established in [Lur04] and [BH15]. This proves that morphisms between algebraic stacks Y → X are equivalent to symmetric monoidal functors Coh(X) → Coh(Y). Therefore, to prove Theorem 3.16, we can combine Black Box 3 with Black Box 4 and the above deformation-theoretic observations to show that the morphisms {fn : Tn → X} b T //G ,0 . The morb → X, where T b = TX,x ×T //G Spec O effectivize to fb: T x x X,x X,x b phism f is then algebraized using Artin approximation over the GIT quotient TX,x //Gx . We will give the details of this argument in the next lecture. 32 ALPER Lecture 4: A Luna étale slice theorem for algebraic stacks and applications In this lecture, we will give proofs of Theorems 3.16 and 3.18. Recall that these theorems assert roughly that any algebraic stack with affine stabilizers is étale locally a quotient stack in a neighborhood of a point with a linearly reductive stabilizer. The proof of Theorem 3.18 will rely on an equivariant version of Artin approximation (Theorem 4.2). We will also give several applications of Theorems 3.16 and 3.18. Throughout this lecture, we will use the notation that if X is an algebraic stack over a field k and x ∈ X is a closed k-point, then Xn denotes the nth nilpotent thickening of the inclusion of the residual gerbe BGx ֒→ X; more precisely, if BGx ֒→ X is defined by the sheaf of ideals I, then Xn ֒→ X is defined by In+1 . The point x is not included in the notation Xn but it should always be clear from the context. 4.1. Proof of Theorem 3.16. Proof of Theorem 3.16. We may assume that x ∈ X is a closed point. Define the quotient stack T = [TX,x /Gx ]. Since Gx is linearly reductive and x ∈ X is a smooth point, a simple deformation theory argument implies that there are isomorphisms Xn ∼ = Tn . Let T → T = TX,x //Gx be the morphism to the GIT quotient, and denote b := Spec O b T,0 ×T T is by 0 ∈ T the image of the origin. The fiber product T noetherian and a quotient stack of the form [Spec A/G] with AG a complete b satisfies the hypotheses of Black Box 3. We have local ring. Therefore, T equivalences  b X) ≃ Homr⊗,≃ Coh(X), Coh(T) b Hom(T, (Tannakian formalism)  ≃ Homr⊗,≃ Coh(X), lim Coh Tn (coherent completeness) ←−  ≃ lim Homr⊗,≃ Coh(X), Coh Tn ←−  ≃ lim Hom Tn , X (Tannakian formalism). ←− b → X filling in Thus the morphisms Tn ∼ = Xn ֒→ X extend to a morphism T the diagram Xn ∼ = Tn b T T X  The functor F : Sch/T → Sets, b T,0 Spec O T.  (T ′ → T ) 7→ T ′ ×T T → X / ∼ b → X yields an is easily checked to be limit preserving. The morphism T b T,0 . By Artin approximation, there exist an étale element of F over Spec O ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 33 morphism (U, u) → (T, 0) where U is an affine scheme and a morphism (U ×T b 0) → (X, x) to first order. Since U ×T T T, (u, 0)) → (X, x) agreeing with (T, is smooth at (u, 0) and X is smooth at x, and since U ×T T → X induces an isomorphism of tangent spaces at (u, 0), the morphism U ×T T → X is étale at (u, 0). After shrinking U suitably, the theorem is established.  Remark 4.1. The smoothness hypothesis of x ∈ X is used above to establish the isomorphisms Tn ∼ = Xn as well as the étaleness of U ×T T → X. More critically, though, it implies that lim Γ(Xn , OXn ) is the completion of a finitely ←− b T,0 . If x ∈ X generated k-algebra since this inverse limit is identified with O is not smooth, there does not appear to be a direct way to establish that lim Γ(Xn , OXn ) (which can be identified with the Gx -invariants of a miniversal ←− deformation space of Gx ) is the completion of a finitely generated k-algebra. Recall that Artin algebraization was a direct consequence of Artin approximation in the case that the complete local ring was known to be the completion of a finitely generated algebra (see Remark 2.14). In a similar manner, one could deduce Theorem 3.18 if we did know that lim Γ(Xn , OXn ) was the completion ←− of a finitely generated algebra. In order to circumvent this problem, we will establish an equivariant version of Artin algebraization. 4.2. Equivariant Artin algebraization. Theorem 4.2 (Equivariant Artin algebraization). Let H be a linearly reductive affine group scheme over k. Let X be a limit preserving category fibered in groupoids over k. Let Z = [Spec A/H] be a noetherian algebraic stack over k. Suppose that AH is a complete local k-algebra. Let z ∈ Z be the unique closed point. Let ξb: Z → X be a morphism that is formally versal at z ∈ Z.8 Then there exist (1) an algebraic stack W = [Spec B/H] of finite type over k and a closed point w ∈ W; (2) a morphism ξ : W → X; b w , where W b w is defined as the fiber product (3) an isomorphism Z ∼ =W bw W W φ  b W,φ(w) Spec O 8 W = Spec B H ; This is a stacky extension of the notion of formal versality introduced in Definition 2.8. Namely, it means that for every commutative diagram of solid arrows Z0 T Z ξb T′ ′ X where T ֒→ T is a closed immersion of local artinian stacks over k (i.e. noetherian algebraic stacks over k with a unique point), there is a lift T ′ → Z filling in the above diagram. 34 ALPER b Zn ∼ (4) a compatible family of isomorphisms ξ| = ξ|Wn (under the identifica∼ tion Zn = Wn ) for n ≥ 0. Remark 4.3. If one takes H to be the trivial group, one recovers precisely the statement of Artin algebraization given in Theorem 2.12. Proof. This can be proved in a similar fashion to Theorem 2.12 by appealing to a stacky generalization of Theorem 2.1. See [AHR15, App. A].  4.3. Proof of Theorem 3.18. Proof of Theorem 3.18. We may assume that x ∈ X is a closed point. Let T = [TX,x /Gx ], T → T = TX,x //Gx be the morphism to the GIT quotient, b := Spec O b T,0 ×T T where 0 ∈ T is the image of the origin. Since Gx is and T linearly reductive, a simple deformation theory argument implies that there are compatible closed immersions Xn ֒→ Tn . The ideals sheaves In defining these closed immersions give a compatibly family {OXn /In } of coherent OXn b satisfies the hypotheses of Black Box 3, there exists an ideal modules. Since T sheaf I ⊂ OTb such that the surjection OTb → OTb /I extends the surjections b extending OXn → OXn /In . Therefore there exists a closed immersion Z ֒→ T the given closed immersions Xn ֒→ Tn . This yields a commutative diagram Xn Z Tn b T ξb X T  b T,0 Spec O T. of solid arrows. Since Z also satisfies the hypotheses of Black Box 3 and the nilpotent thickenings Zn are identified with Xn , the equivalences  Hom(Z, X) ≃ Homr⊗,≃ Coh(X), Coh(Z) (Tannakian formalism)  ≃ Homr⊗,≃ Coh(X), lim Coh Xn (coherent completeness) ←−  ≃ lim Homr⊗,≃ Coh(X), Coh Xn ←−  ≃ lim Hom Xn , X (Tannakian formalism). ←− imply the existence of a morphism ξb: Z → X filling in the above diagram. One can check easily that ξb: Z → X is formally versal. By applying equivariant Artin algebraization with (Theorem 4.2) with H = Gx , we obtain a morphism ξ : W = [Spec B/Gx ] → X where W is of finite type over k, a closed point b w over X, where W b w is defined as in the w ∈ W and an isomorphism Z → W b w commutes over X follows statement of Theorem 4.2. (The fact that Z → W b Zn ∼ from the compatible family of isomorphisms ξ| = ξ|Wn and the Tannakian ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 35 formalism (Black Box 4) as X is a noetherian algebraic stack with affine stabilizers.) Finally, it is easy to see that ξ : W → X is étale at w which completes the proof.  4.4. Applications. In this section, we provide a few applications of Theorems 3.16 and 3.18. We will not include the proofs and instead refer the reader to [AHR15]. 4.4.1. Application 1. Our first application is a generalization of Luna’s étale slice theorem and can be viewed as a refinement of Theorems 3.16 and 3.18 in the case that X = [X/G] is a quotient stack. Theorem 4.4. Let X be a quasi-separated algebraic space, locally of finite type over k, with an action of a smooth affine group scheme G over k. Let x ∈ X be a k-point with a linearly reductive stabilizer Gx . Then there exist an affine scheme W with an action of Gx which fixes a point w and an unramified Gx -equivariant morphism (W, w) → (X, x) such that fe: W ×Gx G → X is étale.9 Let Nx = TX,x /TGx,x be the normal space to the orbit at x; this inherits a natural linear action of Gx . If x ∈ X is smooth, then it can be arranged that there is an étale Gx -equivariant morphism W → Nx such that W//Gx → Nx //Gx is étale and Nx ×Gx G W ×Gx G fe X  Nx //Gx W//Gx is cartesian. Remark 4.5. The theorem above follows from Luna’s étale slice theorem [Lun73] if X is affine. In this case, Luna’s étale slice theorem is stronger than Theorem 4.4 as it asserts additionally that W → X can be arranged to be a locally closed immersion (which is obtained by choosing a Gx -equivariant section of TX,x → Nx and then restricting to an open subscheme of the inverse image of Nx under a Gx -equivariant étale morphism X → TX,x ). However, when W is not normal, it is necessary to allow unramified neighborhoods (for instance, consider the example of Gm acting on the nodal cubic). 4.4.2. Application 2. Our second application is a generalization of Sumihiro’s theorem on torus actions. Theorem 4.6. Let X be a quasi-separated algebraic space, locally of finite type over k, with an action of a torus T . If x ∈ X is a k-point, then there exist a T -equivariant étale neighborhood (Spec A, u) → (X, x). 9 Here, W ×Gx G denotes the quotient (W × G)/Gx . Note that there is an identification of GIT quotients (W ×Gx G)//G ∼ = W//Gx . 36 ALPER Remark 4.7. More generally, if X is a Deligne–Mumford stack (with the other hypotheses remaining the same), one can show that there exist a reparameterization α : T → T and an étale neighborhood (Spec A, u) → (X, x) that is equivariant with respect to α. In the case that X is a normal scheme, Theorem 4.6 was proved by Sumihiro in [Sum74, Cor. 2] in which case Spec A → X can be taken to be an open neighborhood. In the example of the Gm -action on the nodal cubic, there does not exist a Gm -invariant affine open neighborhood of the node. Thus, for non-normal schemes, it is necessary in general to allow étale neighborhoods. In fact, we can prove more generally: Theorem 4.8. Let X be a quasi-separated algebraic space, locally of finite type over k, with an action of an affine group scheme G of finite type over k. Let x ∈ X be a k-point with linearly reductive stabilizer Gx . Then there exist an affine scheme W with an action of G and a G-equivariant étale neighborhood W → X of x. 4.4.3. Application 3. We now translate the conclusion of Theorem 3.18 in the case that X is the stack of all (possibly singular) curves. By a curve, we mean a proper scheme over k of pure dimension one. Theorem 4.9. Let C be an n-pointed curve. Suppose that every connected component of C is either reduced of arithmetic genus g 6= 1 or contains a marked point. Suppose that Aut(C) is smooth and linearly reductive. Then there exist an affine scheme W of finite type over k with an action of Aut(C) fixing a k-point w ∈ W and a miniversal deformation C C  W w Spec k of C ∼ = Cw such that there exists an action of Aut(C) on the total family C compatible with the action of Aut(C) on W and Cw . 4.4.4. Application 4. In our final application, we will conclude that under suitable hypotheses the coherent completion of a point of an algebraic stack exists and moreover we will give equivalent conditions for algebraic stacks to be étale locally isomorphic. Let X be a noetherian algebraic stack over k with affine stabilizers and let x ∈ X be a closed k-point. We say that (X, x) is a complete local stack if the natural functor  Coh(X) → lim Coh Xn ←− n is an equivalence. ARTIN ALGEBRAIZATION AND QUOTIENT STACKS 37 Theorem 4.10. Let X be a quasi-separated algebraic stack, locally of finite type over k, with affine stabilizers. For any k-point x ∈ X with linearly reducb x, x tive stabilizer Gx , there exist a complete local stack (X b) and a morphism b η : (Xx , x b) → (X, x) inducing isomorphisms of nth infinitesimal neighborhoods b x , η) is unique up to unique 2-isomorphism. of x b and x. The pair (X If (W = [Spec A/Gx ], w) → (X, x) is an étale morphism as in Theorem 3.18 and φ : W → W = Spec AGx is the morphism to the GIT quotient, then the b x is constructed as the fiber product completion X bx X W φ  b W,φ(w) Spec O W. Example 4.11. The pair ([An /Gm ], 0) is a complete local stack where Gm acts with weight 1 on all coordinates. Example 4.12. If we let X = [A2 /Gm ] where Gm acts with weights (1, −1) on the coordinates A2 = Spec k[x, y] and x ∈ X denotes the origin, then (X, x) is not a complete local stack. The completion of X at x is given by the fiber product bx [A2 /Gm ] X  Spec k[[xy]] Spec k[xy] which is identified with the quotient stack [Spec(k[[xy]] ⊗k[xy] k[x, y])/Gm ]. The next result is a stacky generalization of Corollary 1.14, which was our first application of Artin approximation. Theorem 4.13. Let X and Y be quasi-separated algebraic stacks, locally of finite type over k, with affine stabilizers. Suppose x ∈ X and y ∈ Y are kpoints with linearly reductive stabilizer group schemes Gx and Gy , respectively. Then the following are equivalent: (1) There exist compatible isomorphisms Xn → Yn . bx → Y by . (2) There exists an isomorphism X (3) There exist an affine scheme Spec A with an action of Gx , a point w ∈ Spec A fixed by Gx , and a diagram of étale morphisms [Spec A/Gx ] f X g Y such that f (w) = x and g(w) = y, and both f and g induce isomorphisms of stabilizer groups at w. 38 ALPER If, in addition, the points x ∈ X and y ∈ Y are smooth and if the stabilizers Gx and Gy are smooth, then the conditions above are equivalent to the existence of an isomorphism Gx → Gy of group schemes and an isomorphism TX,x → TY,y of tangent spaces which is equivariant under Gx → Gy . References [AHR15] J. Alper, J. Hall, and D. Rydh, A Luna étale slice theorem for algebraic stacks, ArXiv e-prints (2015), arXiv:1504.06467. [AK15] Jarod Alper and Andrew Kresch, Equivariant versal deformations of semistable curves, ArXiv e-prints (2015), arXiv:1510.03201. [AM69] M. F. Atiyah and I. G. Macdonald, Introduction to commutative algebra, Addison-Wesley Publishing Co., Reading, Mass.-London-Don Mills, Ont., 1969. [AOV08] D. Abramovich, M. Olsson, and A. Vistoli, Tame stacks in positive characteristic, Ann. Inst. Fourier (Grenoble) 58 (2008), no. 4, 1057–1091. [Art69a] M. Artin, Algebraic approximation of structures over complete local rings, Inst. Hautes Études Sci. Publ. Math. (1969), no. 36, 23–58. , Algebraization of formal moduli. I, Global Analysis (Papers in Honor of [Art69b] K. Kodaira), Univ. Tokyo Press, Tokyo, 1969, pp. 21–71. [Art74] , Versal deformations and algebraic stacks, Invent. Math. 27 (1974), 165– 189. [AV02] Dan Abramovich and Angelo Vistoli, Compactifying the space of stable maps, J. Amer. Math. Soc. 15 (2002), no. 1, 27–75 (electronic). [BH15] B. Bhatt and D. Halpern-Leistner, Tannaka duality revisited, ArXiv e-prints (2015), arXiv:1507.01925. [CJ02] B. Conrad and A. J. de Jong, Approximation of versal deformations, J. Algebra 255 (2002), no. 2, 489–515. [EGA] A. Grothendieck, Éléments de géométrie algébrique, I.H.E.S. Publ. Math. 4, 8, 11, 17, 20, 24, 28, 32 (1960, 1961, 1961, 1963, 1964, 1965, 1966, 1967). [EHKV01] Dan Edidin, Brendan Hassett, Andrew Kresch, and Angelo Vistoli, Brauer groups and quotient stacks, Amer. J. Math. 123 (2001), no. 4, 761–777. [Eis95] D. Eisenbud, Commutative algebra, Graduate Texts in Mathematics, vol. 150, Springer-Verlag, New York, 1995, With a view toward algebraic geometry. [Gro13] P. Gross, Tensor generators on schemes and stacks, preprint, June 2013, arXiv:1306.5418. [GZB15] Anton Geraschenko and David Zureick-Brown, Formal GAGA for good moduli spaces, Algebr. Geom. 2 (2015), no. 2, 214–230. [Hal14] J. Hall, Openness of versality via coherent functors, J. Reine. Angew. Math. (2014), available online, http://dx.doi.org/10.1515/crelle-2014-0057. [Har77] Robin Hartshorne, Algebraic geometry, Springer-Verlag, New York-Heidelberg, 1977, Graduate Texts in Mathematics, No. 52. [HR13] J. Hall and D. Rydh, Artin’s criteria for algebraicity revisited, ArXiv e-prints (2013), arXiv:1306.4599. [HR14] J. Hall and D. Rydh, Coherent Tannaka duality and algebraicity of Hom-stacks, ArXiv e-prints (2014), arXiv:1405.7680. [KM97] S. Keel and S. Mori, Quotients by groupoids, Ann. of Math. (2) 145 (1997), no. 1, 193–213. [Lun73] D. Luna, Slices étales, Sur les groupes algébriques, Bull. Soc. Math. France, Mém., vol. 33, Soc. Math. France, Paris, 1973, pp. 81–105. [Lur04] J. Lurie, Tannaka Duality for Geometric Stacks, ArXiv e-prints (2004), arXiv:math/0412266. ARTIN ALGEBRAIZATION AND QUOTIENT STACKS [Nér64] [Pop85] [Pop86] [Pop90] [Rim80] [Sch68] [Stacks] [Sum74] [Swa98] [Tot04] 39 André Néron, Modèles minimaux des variétés abéliennes sur les corps locaux et globaux, Inst. Hautes Études Sci. Publ.Math. No. 21 (1964), 128. Dorin Popescu, General Néron desingularization, Nagoya Math. J. 100 (1985), 97–126. D. Popescu, General Néron desingularization and approximation, Nagoya Math. J. 104 (1986), 85–115. Dorin Popescu, Letter to the editor: “General Néron desingularization and approximation”, Nagoya Math. J. 118 (1990), 45–53. Dock Rim, Equivariant G-structure on versal deformations, Trans. Amer. Math. Soc. 257 (1980), no. 1, 217–226. Michael Schlessinger, Functors of Artin rings, Trans. Amer. Math. Soc. 130 (1968), 208–222. The Stacks Project Authors, Stacks Project, http://stacks.math.columbia.edu. H. Sumihiro, Equivariant completion, J. Math. Kyoto Univ. 14 (1974), 1–28. Richard G. Swan, Néron-Popescu desingularization, Algebra and geometry (Taipei, 1995), Lect. Algebra Geom., vol. 2, Int. Press, Cambridge, MA, 1998, pp. 135–192. B. Totaro, The resolution property for schemes and stacks, J. Reine Angew. Math. 577 (2004), 1–22. (Alper) Mathematical Sciences Institute, Australia National University, Canberra, ACT 0200 E-mail address: [email protected]
0math.AC
ON THE DIMENSION OF CONTACT LOCI AND THE IDENTIFIABILITY OF TENSORS arXiv:1706.02746v3 [math.AG] 1 Dec 2017 EDOARDO BALLICO, ALESSANDRA BERNARDI AND LUCA CHIANTINI Abstract. Let X ⊂ Pr be an integral and non-degenerate variety. Set n := dim(X). We prove that if the (k + n − 1)-secant variety of X has (the expected) dimension (k + n − 1)(n + 1) − 1 < r and X is not uniruled by lines, then X is not k-weakly defective and hence the k-secant variety satisfies identifiability, i.e. a general element of it is in the linear span of a unique S ⊂ X with ♯(S) = k. We apply this result to many Segre-Veronese varieties and to the identifiability of Gaussian mixtures G1,d . If X is the Segre embedding of a multiprojective space we prove identifiability for the k-secant variety (assuming that the (k + n − 1)-secant variety has dimension (k + n − 1)(n + 1) − 1 < r, this is a known result in many cases), beating several bounds on the identifiability of tensors. 1. Introduction The computation of the decompositions of tensors and the related evaluation of their ranks recently received great interest from people working in algebraic geometry. Indeed, a geometric analysis on projective spaces of tensors, Segre embeddings and their secant varieties produced currently several new results in the field. From the geometric point of view, the study of decompositions and ranks can be turned to a general problem. For any (irreducible) algebraic variety X which spans a projective space Pr , one can define the X-rank rX (q) of a point q ∈ Pr as the minimal cardinality of a finite set S ⊂ X such that q ∈ hSi, where h i denotes the linear span. Any set S for which the minimum is attained is a minimal X-decomposition of q. In tensor analysis, one interprets Pr as a space of tensors of given type (n1 + 1) × · · · × (ns + 1) (mod scalars), and X as the locus of tensors of rank 1. In geometric terms, X is the multiprojective product Pn1 × · · · × Pns , naturally embedded in Pr via the Segre map. Then, the notions of X-rank and minimal decompositions match with the usual multilinear algebra notion. The set of tensors of fixed rank k corresponds to an open subset of the k-th secant variety σk (X) of X. Properties of the rank decompositions can be derived from geometric properties of X, which determine some features of σk (X). Examples of such analysis are contained in several papers, e.g. see [8, 10, 25, 26, 36, 41], and the book [38]. In this paper we study the problem of the identifiability of generic points q ∈ Pr of given X-rank k. A point q is X-identifiable when the set S(q, X) of minimal X-decompositions of q is a singleton; in any case the cardinality of S(q, X) is called the secant degree of q or the k-th secant degree of q. In tensor analysis the identifiability of a tensor is fundamental for algorithms of data compression and for the analysis of mixture models (see [33, 34, 35, 43]). We will say that X is k-identifiable if a generic point of σk (X) is X-identifiable. We first work over an algebraically closed field of characteristic 0. Our investigation is based on the notion of weak defectivity introduced by the last author and C. Ciliberto in [25]. A projective variety X is weakly k-defective if hyperplanes of Pr , which are tangent to X at k general points, are indeed tangent along a positive dimensional subvariety. It turns out (see [26, Theorem 2.5]) that when r > k(n + 1) − 1 then X is k-identifiable, unless it is weakly k-defective (unfortunately the reverse is not true). Therefore the knowledge on the non-k weak defectivity provides an effective way to determine geometrically the identifiability of generic points. This approach has been applied to tensors and linear systems of tensors in a series of papers ([1, 16, 18, 19, 29, 30, 31]), where identifiability problems are partially or totally solved. A challenging task is therefore to get criterions that can establish identifiability (or not) in the cases when weak defectivity arises. To this purpose there is a related notion that is very helpful, meaning the tangential weak defectivity. Our new analysis starts with the following observation 1 2 CONTACT LOCI AND IDENTIFIABILITY (see [27]). If X is a weakly k-defective variety of dimension n, then a general choice of a set A of k points on X determines a positive dimensional tangential k-contact locus Γk (A): the tangency locus of the span of the tangent spaces to X at the points of A. If for a general choice of A we have that dim Γk (A) > 0 than X is tangential k-weakly defective. It turns out that the k-th secant degree of a general element of X is related with the k-th secant degree of the contact locus Γk (A) for a general choice of A (cf. Lemma 4.2, Corollary 4.3, [26, Theorem 2.4] and part (iii) of [27, Proposition 3.9]). We will exploit in more details the relation in Section 4. Moreover, when r ≥ (k + 1)(n + 1) − 1, then the weak k-defectivity of X implies the weak (k + 1)-defectivity. Moreover, we prove that, under some geometric assumption on X, if we take a generic subset A as above and let A′ be obtained by adding to A a generic point of X, then the dimension of the tangential contact locus Γk+1 (A′ ) is strictly bigger than the dimension of Γk (A). As the dimension of contact loci is bounded by n − 1, by repeating the previous construction we obtain the following result. Theorem. (see Theorem 5.1). Let X ⊂ Pr be an integral and non-degenerate n-dimensional variety and let k be a positive integer. Assume that X is not uniruled by lines and that dim σk+n−1 (X) = (k + n − 1)(n + 1) − 1 < r. Then X is not weakly j-defective for every j ≤ k. It follows from the previous analysis that, with the assumptions of Theorem 5.1, X is jidentifiable for every j ≤ k. The result can be directly applied e.g. to Segre-Veronese embeddings of products of projective spaces, provided that the multidegree (d1 , . . . , ds ) satisfies di > 1 for all i. When some degree di is 1, as in the case of Segre embeddings (where di = 1 for all i), then Theorem 5.1 does not apply directly. However, for the Segre product we can modify the argument of Theorem 5.1, and prove that the same conclusion holds when for each i ∈ {1, . . . , s} there is j ∈ {1, . . . , s} \ {i} such that nj = ni (see Theorem 5.3). Combining Theorem 5.3 with the main result in [23], for the Segre embedding X of s ≥ 5 copies of P1 , we find that X is not weakly k-defective, hence it is k-identifiable, whenever (k+s−1)(s+1) < 2s − 1 (see Corollary 5.4). Corollary 5.4 improves our previous knowledge on the weak defectivity of Segre embeddings of many copies of P1 , hence on the identifiability of generic binary tensors. Indeed it extends the range 2 −1 − s, which beats all previously known where we know that k-identifiability holds up to k ≤ ss+1 bounds (see Section 4 of [20]) as s grows. Since identifiability cannot hold, for trivial dimensional reasons, when k > s2 /(s + 1) − 1, then we are quite close to a complete analysis of the generic identifiability of binary tensors. We also get almost optimal results for the Segre embedding of (Pm )s , m > 1, see Corollary 5.5) (we use the very strong [9, Theorem 3.1]). See Example 5.8 for the case of Gaussian mixtures G1,d . When the assumptions of Theorem 5.1 does not hold, one cannot conclude the non weak kdefectivity of X. Yet, even if X is weakly k-defective, it can still be k-identifiable. We prove the following result. Theorem. (seePTheorem 5.9) Let X be the Segre embedding of a product Pn1 × · · · × Pnq in Pr , with n = ni = dim(X). Let k be a positive integer. Assume that dim σk+n−1 (X) = (k + n − 1)(n + 1) − 1 < r (in particular X is not (k + n − 1)-defective). Then X is j-identifiable for every j ≤ k. It would be interesting to overcame the assumption “X not uniruled by lines ” of Theorem 5.3 in other cases, apart the Segre varieties covered by Theorem 5.9, because it would expand the known cases of identifiability (e.g. for Grassmannians see [6], [17], [21], [22]; for the tangential variety of the Veronese varieties see [7]). We just recall that conjecturally only four Grassmannians have some defective secant variety. We stress that, in particular, Remark 5.10 suggests that if one is interested in the k-identifiability of some specific Segre product then the computational procedure induced by Theorem 5.9 can be faster than previously known direct procedures. In the last section of the paper we work over an algebraically closed base field K of arbitrary characteristic. To include varieties X defined in positive characteristic, we will assume that X is not very strange (see Definition 6.1). Under this mild assumption, we prove the following. CONTACT LOCI AND IDENTIFIABILITY 3 Theorem 1.1. Let M be an integral projective variety and L, R line bundles on M with L very ample. Set n := dim M . Fix a linear subspace V ⊆ H 0 (L) such that the associated map j : M → Pr is an embedding with image not very strange. Fix an integer k ≤ min{h0 (R), dim V − n − 2}. Let W ⊆ H 0 (L ⊗ R) be the image of the multiplication map V ⊗ H 0 (R) → H 0 (L ⊗ R) and let X ⊂ Pr , r = dim W − 1, be the embedding induced by W . Then σk (X) has dimension kn + k − 1 and ♯(S(q, X)) = 1 for a general q ∈ σk (X). We will apply Theorem 1.1 to the Segre-Veronese embeddings of a multiprojective space in arbitrary characteristic (see Example 6.3), where we do not have an analogue of [26, Theorem 2.5], hence the analysis of the previous section does not apply. Notice that Theorem 1.1 does not apply to Segre embeddings, because it requires L very ample (or at least birationally very ample) and h0 (X, R) > 1. The authors wish to thank C. Bocci, for his help to understand the case of almost unbalanced tensors (see Example 4.10 below) and the anonimous referee for pointing out an improvement in the formula after Corollary 5.4. 2. General notation In this section we work with projective spaces Pr defined over an algebraically closed field K. Let X ⊂ Pr be an integral and non-degenerate n-dimensional variety. We will denote with Xreg the set of regular points in X. For any x ∈ Xreg we will denote with Tx X the tangent space to X at x. For any integer k ≥ 2 we will denote with σk (X) the k-th secant variety of X which is an irreducible projective variety. If k(n + 1) − 1 ≤ r, then k(n + 1) − 1 is the expected dimension of σk (X) and X is k-defective if dim σk (X) < k(n + 1) − 1. We will often use the fact that if X is not k-defective, then, for all k ′ ≤ k, X is not k ′ -defective. Definition 2.1. For q ∈ Pr general, the X-rank rX (q) of a point q ∈ Pr is the minimal cardinality of a finite set A ⊂ X such that q ∈ hAi. We define SX (q) as the collection of subsets A ⊂ X of cardinality rX (q) such that q ∈ hAi. When SX (q) is finite, we will write αX (q) for the cardinality of SX (q). Remark 2.2. Since X is irreducible, then the secant varieties σk (X) are irreducible. Moreover a general point of σk (X) has X-rank k. By definition, the set SX (q) is finite for q ∈ σk (X) general if and only if dim σk (X) = k(n + 1) − 1 ≤ r. In this case, we will write simply αk for the cardinality of SX (q), where q ∈ σk (X) is generic. Such an αk is often called the k-th secant degree of X. The following result holds (with the same elementary proof) in arbitrary characteristic. Proposition 2.3. Assume dim σk+1 (X) = (k+1)(n+1)−1 and αk > 1. Fix a general q ∈ σk+1 (X), any A ∈ S(q) and any a ∈ A. There are at least αk elements B1 . . . , Bαk ∈ S(q) (one of them being A) such that a ∈ Bi for all i = 1, . . . , αk . Proof. Since dim σk+1 (X) = (k + 1)(n + 1) − 1, we have dim σk (X) = k(n + 1) − 1 and hence αk is a well-defined finite positive integer. Fix a general q ∈ σk+1 (X) and take any A ∈ S(q) and any a ∈ A. Set E := A \ {a}. Since q is general in σk+1 (X) and dim σk+1 (X) = (k + 1)(n + 1) − 1, a dimensional count gives that for each D ∈ S(q) the set D is a general element of the (k + 1)symmetric product of X. Thus E is a general subset of X with cardinality k. Since ♯(A) = rX (q), we have q ∈ / hA′ i for any A′ ( A; in particular q ∈ / E. Thus h{a, q}i is a line, which meets hEi in a unique point q ′ (because hEi + ha, qi = hAi) and q ′ ∈ / hE ′ i for any E ′ ( E. For a general ′ q ∈ hAi, q is a general element of hEi. Since E is general, q ′ is general in σk (X). Thus rX (q ′ ) = k, E ∈ S(q ′ ) and ♯(S(q ′ )) = αk > 1. Fix any F ∈ S(q ′ ). We have q ∈ h{F, a}i. Since rX (q) = k + 1, we have a ∈ / F and F ∪ {a} ∈ S(q). Now we have exactly αk such F ’s, say F1 , . . . , Fαk , the Bi of the statement are Bi = {Fi , a} for i = 1, . . . , αk concluding the proof.  3. Weak defectivity and identifiability In this section, as well as in the next two sections, we assume that the algebraically closed base field K has characteristic 0. 4 CONTACT LOCI AND IDENTIFIABILITY For a subset A of cardinality k contained in the regular locus Xreg we set: MA := h∪x∈A Tx Xi. By Terracini’s lemma ([8, Corollary 1.11]), for a general choice of A the space MA is the tangent space to σk (X) at a general point u ∈ hAi. Thus dim MA = min{k(n + 1) − 1, dimhXi} for A general, unless X is k defective. Definition 3.1. The tangential k-contact locus Γk (A) is the closure in X of the union of all the irreducible components which contain at least one point of A, of the locus of points of Xreg where MA is tangent to X. We will write tk := dim Γk (A) for a general choice of A. We say that X is weakly k-defective if tk > 0. We will write just Γk instead of Γk (A), when A is general. With the terminology just introduced we have the following remark: Remark 3.2. [25, Remark 3.1(iii) at p. 159] If σk+1 (X) ( Pr has the expected dimension (k + 1) dim X + (k + 1) − 1 < r and X is weakly k-defective, then X is also weakly (k + 1)-defective. We will need the following result of [27]. Proposition 3.3. For a general choice of A ⊂ Xreg , the algebraic set Γk := Γk (A) is equidimensional and either it is irreducible or it has exactly k irreducible components, each of them containing a different point of A. Proof. It is Proposition 3.9 of [27]. (Notice that our σk (X) is called the (k − 1)-th secant variety in [27], so that all the k’s there should be here replaced by k + 1, in order to apply the results of [27] to our terminology).  Definition 3.4. Following [26] and [27], we say that Γk is of the type I (resp. type II ) if Γk is irreducible (resp. it is not irreducible) for a general choice of A. The fundamental technical results of the present paper is the following lemma. It shows how one can control the growth of the dimension of contact loci. Mainly, one must take care of the case of contact loci of type II, which are not irreducible. Lemma 3.5. Let X ⊂ Pr be an irreducible projective variety such that dim σk+1 (X) = (k + 1)(n + 1) − 1 < r and assume that X is weakly k-defective. Then X is weakly (k + 1)-defective. Let B (resp. A) be a general subset of k (resp. k + 1) points of X. Call Γk (resp. Γk+1 ) the tangential contact locus of X at the points of B (resp. A). Then either: • dim Γk < dim Γk+1 ; or • both Γk and Γk+1 have type II, each of the irreducible components of Γk and Γk+1 is a linear space and these components are linearly independent, i.e. dimhΓk+1 i = dimhΓk i + dim Γk + 1 = (k + 1)(dim Γk + 1) − 1. Proof. Since dim σk+1 (X) = (k + 1)(n + 1) − 1, we have dim σk (X) = k(n + 1) − 1. By Remark 3.2, X is weakly (k + 1)-defective. By [25, first two lines after Definition 1.2], X is not i-defective for i = 1, . . . , k + 1. By [27, Proposition 3.9] we know that both Γk and Γk+1 are equidimensional, that A is in the smooth locus of Γk+1 , that B is in the smooth locus of Γk and that either Γk (resp. Γk+1 ) is irreducible or it has exactly k (resp. k + 1) irreducible components, each of them containing exactly one point of B (resp. A). Since B is general, we may assume that B ⊂ A. Thus Γk ⊆ Γk+1 . Since Γk is a proper subvariety of X and Γk+1 contains B plus a general point of X, then Γk 6= Γk+1 . Thus if either Γk or Γk+1 is irreducible, then tk < tk+1 (where tk is defined in Definition 3.1). Now assume that both Γk and Γk+1 are reducible, hence of type II, and that tk = tk+1 =: t. Let B = {P1 , . . . , Pk } and A = {Pk+1 } ∪ B. Call Γi the component of Γk+1 passing through Pi , so that also Γk = Γ1 ∪ · · · ∪ Γk . Call Πi the linear span of Γi . Of course, by the generality of A, all the Πi ’s have the same dimension. Assume that dim Πi > dim Γi and let us show that we get a contradiction. CONTACT LOCI AND IDENTIFIABILITY 5 For i = 2, . . . , k + 1 call Li the span of Π1 ∪ · · · ∪ Πi , which is also the span of Γ1 ∪ · · · ∪ Γi . By [26, Proposition 2.5] we know that, for all i, dim(Li ) ≥ it + i − 1, since X is not i-defective. Moreover by [27, Proposition 3.9] we know that dim(Lk ) = kt + k − 1 and dim(Lk+1 ) = (k + 1)t + k. If dim(Lk−1 ) > (k − 1)t + k − 2, then by Grassmann formula, the intersection of Lk−1 and Πk has dimension greater than (k − 1)t + k − 2 + dim(Πk ) − kt − k + 1 = dim(Πk ) − t − 1, so that, by Grassmann formula again, dim(Lk+1 ) < dim(Lk ) + dim(Πk+1 ) − dim(Πi ) + t + 1 = (k + 1)t + k, a contradiction. Thus dim(Lk−1 ) = (k − 1)t + k − 2. Arguing by induction, we obtain that dim(Li ) = it + i − 1 for i = 2, . . . , k + 1. In particular dim(Π1 ∩ Π2 ) = 2 dim(Π1 ) − 2t − 1 ≥ 0. By the generality of A again, dim(Πi ∩ Πj ) = dim(Π1 ∩ Π2 ) for all i, j. Thus Π3 intersects L2 in dimension at least dim Π1 ∩ Π2 ). It follows that L3 has dimension dim(L3 ) ≤ dim(L2 ) + dim(Π3 ) − 2 dim(Π1 ) + 2t + 1 = (2t + 1) − dim(Πi ) + 2t + 1 < 3t + 2, which yields the claimed contradiction.  4. Remarks on the secant degree of contact loci We collect in this sections some remarks on the general tangential contact loci Γk of X, which clarify the relations between the k-th secant degree of X and the k-th secant degree of a general Γk . To do that, we need to distinguish the case where Γk is of type I (i.e. irreducible) from the case where Γk is of type II. Notation 4.1. For the rest of the section, let X ⊂ Pr be an integral and non-degenerate ndimensional variety and let k be a positive integer. Assume that X is weakly k-defective with dim σk+n−1 (X) = (k + n − 1)(n + 1) − 1 < r. Call Γk the tangential k-contact locus of X at a general set A = {P1 , . . . , Pk } of k points of X, and call Πk the linear span of Γk . The following technical result is the analogue of [26, Theorem 2.4] for the tangential contact locus Γk . It is implicitly contained in part (iii) of [27, Proposition 3.9], but we prefer to make it explicit here. Lemma 4.2. For a general Q ∈ hAi ⊂ Πk , all subsets B ⊂ X of cardinality k such that Q ∈ hBi are contained in the span of Γk . Proof. Notice that, by the generality of A, Q is also a general point in the secant variety σk (X). Since Q is general, the tangent space to σk (X) at Q is also the span of the tangent spaces to X at the points of B, by the Terracini’s Lemma. The claim now follows from [27, proposition 3.9 (iii)].  Corollary 4.3. The k-secant degree of a projective variety X is equal to the k-secant degree of the intersection of X with the span of its tangential k-contact locus. When the general contact locus of X is of type I, we can give a more explicit statement. Proposition 4.4. Assume that Γk is irreducible (i.e. type I). Assume the existence of a component W of Πk ∩ X, different from Γk , such that Πk is tangent to X along W . Then for all a, b with a > 0 and a + b = k, the join of the a-th secant variety of W with the b-th secant variety of Γk cannot cover Πk . Proof. Assume on the contrary that the join covers Πk . Since σk (X) has the expected dimension and it is equal to the union of the spaces Πk ’s, when the k-th points P1 , . . . , Pk vary on X, then for dimensional reasons there cannot be a subvariety Y ( X which contains all the respective components W ’s. Thus, for P1 , . . . , Pk general, a general point Q of W is a general point of X. Hence the contact variety of Q, P2 , . . . , Pk has the same properties of Γk . In particular Πk is tangent to X along an irreducible variety of the same dimension of Γk , which contains P2 , . . . , Pk and Q. Since Q ∈ / Γk , this is excluded by the generality of P1 , . . . , Pk .  Corollary 4.5. Assume that Γk is irreducible (i.e. type I). Then the secant degree of X is equal to the secant degree of the general contact locus Γk . 6 CONTACT LOCI AND IDENTIFIABILITY The situation becomes completely different when the general Γk is of type II. Remark 4.6. Assume that dim σk+n (X) = (k + n)(n + 1) − 1 < r, so that X is also weakly (k + 1)-defective. Assume that a general tangential contact locus Γk+1 is formed by k + 1 linearly independent linear spaces. Then also the general tangential contact locus Γk is formed by k linearly independent linear spaces. Indeed, with no loss of generality, as in the proof of Lemma 3.5, we may assume Γk ⊂ Γk+1 . Thus Γk is of type II, and all its components are contained in one component of Γk+1 . But clearly if one takes irreducible varieties Γi , i = 1, . . . , k, of the same dimension tk , such that each Γi spans a linear space Πi of dimension > tk , and the linear spaces Πi ’s are linearly independent, then the span of the union of the Γi ’s cannot have dimension kd + k − 1. We point out the following example. Example 4.7. ([18, Proposition 1.7]) Let X be the Grassmanniann G := G(P2 , P7 ) and let k = 3. Then X is weakly 3-defective and, for a general choice of P1 , P2 , P3 ∈ X, Γ3 is the union of three disjoint linear spaces L1 , L2 , L3 of dimension 3, such that Li contains Pi . The span Π3 of Γ3 is also tangent to X along a linear space W = P5 , which misses the Pi ’s and intersects each Li along a line. One computes soon that the join of Li , Lj , W cannot fill Π3 , for obvious dimensional reasons. It follows that the secant degree of X equals the secant degree of Γ3 , which is 1. Hence the generic 3-identifiability of G holds. We can derive, as in the previous example a general statement for the case where the tangential contact variety Γk is of type II. Proposition 4.8. Assume that the general k-tangential contact locus Γk is of type II, i.e. it is the union of components Γ1 , . . . , Γk . Assume that Πk is tangent to X along Γk ∪ Γ, where Γ 6⊂ Γk . If hΓ1 ∪ · · · ∪ Γ̂I ∪ · · · ∪ Γk ∪ Γi = 6 Πk , where with Γ̂I we indicate any non empty subset of {Γ1 , . . . , Γk }, then the k-th secant degree of X is equal to the k-th secant degree of Γk . Corollary 4.9. In the assumptions of the previous proposition, assume the Γi ’s are linear subspaces of Pr , and linearly independent. Then X is j-identifiable for any j ≤ k. Proof. Clearly if X is k-identifiable then it is also j-identifiable for every j ≤ k, hence we need simply to show that X is k-identifiable. This last follows since the union of linearly independent linear spaces is identifiable.  On the other hand, there are cases (where X is an almost unbalanced products of projective spaces) in which Γk has type II and the previous proposition does not apply, moreover the k-th secant degree of Γk is different from the k-th secant degree of X. A first example is the following. Example 4.10. Consider the Segre variety X of P2 ×P2 ×P5 and let k = 5. One computes that the general tangential contact locus Γ5 consist of 5 linearly independent linear subspaces Γ1 ∪ · · · ∪ Γ5 , where each Γi is a P4 which passes through one of the points Pi . The span Π5 of Γ5 is a P24 which is tangent to X along an extra Γ = P4 . Γ is linearly independent from any subset of 4 among the Γi ’s. Thus the 5-th secant degree of Γ5 is 1, but the secant degree of X equals the secant degree of Γ5 ∪ Γ, hence it is 6. A similar situation holds for the almost unbalanced cases defined in Section 8 of [20]. 5. Applications to concrete examples We show below how Lemma 3.5 applies, thanks to the observations contained in Section 4, to conclude the identifiability of some relevant cases of Segre products, Veronese varieties, SegreVeronese varieties and moment varieties. Non-trivial Segre products X ⊂ Pr , X image of Pa1 × · · · × Pas , contain, for each j = 1, . . . , s, linear spaces L1 , . . . , Lk , of dimension aj passing through k general points, which are linearly independent, provided that k(aj + 1) is smaller than (r + 1). We do not know examples where these spaces are contact loci of weakly defective Segre products. In any case, the previous lemma, together with the analysis of weakly defective varieties contained in [26] and [29], yield the following. CONTACT LOCI AND IDENTIFIABILITY 7 Theorem 5.1. Let X ⊂ Pr be an integral and non-degenerate n-dimensional variety and let k be a positive integer. Assume that X is not uniruled by lines and that dim σk+n−1 (X) = (k + n − 1)(n+ 1) − 1 < r (in particular X is not (k + n − 1)-defective). Then X is not weakly j-defective (hence it is j-identifiable) for every j ≤ k. Proof. If X is not weakly j-defective, then the claim follows by [26]. Assume that X is weakly j-defective. Hence X is also weakly (j + i)-defective for i = 1, . . . , n − 1. Since X is not uniruled, then Γj+i cannot be a union of linear spaces of positive dimension, so by Lemma 3.5 we have: 1 ≤ dim Γj < · · · < dim(Γj+n−1 ). It follows that dim(Γj+n−1 ) ≥ n, a contradiction.  Theorem 5.1 is applicable to any embedding X ⊂ Pr with OX (1) ∼ = L⊗2 ⊗ M with L an ample line bundle and M a nef line bundle. In particular it is applicable to any Veronese embedding of Pn , since in this case dim σi (X) is known for all i by a famous theorem of Alexander and Hirschowitz ([10]). However, the result that we get from Theorem 5.1 for symmetric tensors is weaker than the results of [36, 31], where all the non-identifiable Veronese varieties are classified. Let us turn to the study of Segre Q varieties. Fix integer s ≥ 2, ni > 0, 1 ≤ i ≤ s. Set n := n1 + · · · + ns and r := −1 + si=1 (ni + 1) and let X ⊂ Pr be the (n-dimensional) Segre embedding of the multiprojective space Pn1 × · · · × Pns . Since X is uniruled by lines, we cannot apply Theorem 5.1 directly. On the other hand, the structure of linear spaces contained in Segre embeddings of multiprojective spaces is well known. Remark 5.2. Let πi : X → Pni denote the projection of the Segre variety X into its i-th factor. For any i = 1, . . . , s let OX (ǫi ) be the line bundle πi∗ (OPni (1)). Each OX (ǫi ) is a spanned line bundle and OX (1) = ⊗si=1 OX (1). Let L ⊂ X be any linear space of positive dimension. Since OL (1) ∼ = ⊕si=1 OX (ǫi )|L , there is j ∈ {1, . . . , s} such that OX (ǫi )|L ∼ = OL for all i 6= j, i.e. L is contained in a fiber of πj . Fix an integer k ≥ 1 such that dim σk+1 (X) = (k + 1)(n + 1) − 1 < r and assume that X is weakly (k + 1)-defective, with general tangential (k + 1)-contact locus Γk+1 equal to a union of linear spaces, say L1 , . . . , Lk , Lk+1 , of dimension ǫk > 0. Thus for each i = 1, . . . , k + 1 there is a unique integer j(i) ∈ {1, . . . , s} such that πj(i) (Li ) is a point. We get a function φk+1 : {1, . . . , k + 1} → {1, . . . , s} defined by the formula φk+1 (i) := j(i). The function φk+1 cannot depend on the choice of k + 1 general points. Then, moving independently the points, by monodromy we get that this function φk+1 must be invariant for the action of the full symmetric group on {1, . . . , k + 1}. Thus j(i) = j(1) for all i. Using the previous remark, we can prove the following. Theorem 5.3. Let X be the Segre embedding of Pn1 ×· · ·×Pnk in Pr as above. Assume that for each i ∈ {1, . . . , s} there is j ∈ {1, . . . , s} \ {i} such that nj = ni . Assume also that dim σk+n−1 (X) = (k + n − 1)(n + 1) − 1 < r. Then X is not weakly j-defective (hence it is j-identifiable) for every j ≤ k. Proof. Assume that X is weakly j-defective. Thus it is also weakly (j + i)-defective, for i = 0, . . . , n − 1. Each general contact locus Γj+i has dimension tj+i ≤ n − 1 and so there cannot be a strictly increasing sequence of integer tj , . . . , tj+n−1 . By Lemma 3.5 there is an integer h ∈ {j, . . . , j +n−1} such that Γh is a union L1 ∪ · · · ∪ Lh of h independent linear spaces of dimension th . Thus, by Remark 5.2, there is an integer m ∈ {1, . . . , s} such that, for all i = 1, . . . , h, πm (Li ) is a linear space of dimension dim Li , while πx (Li ) is a point for all x ∈ {1, . . . , s} \ {m}. Notice that the general contact locus Γh is invariant for linear automorphisms of Pr preserving X, in the sense that for any automorphism φ : Pr → Pr with φ(X) = X the set φ(Γh ) may be taken as a general contact locus. Thus πx (h(Li )) is a point for each x ∈ {1, . . . , s} \ {m}, while πm (h(Li )) is a linear space of dimension dim Πi . By assumption there is z ∈ {1, . . . , s} \ {j} with nz = nj . Hence there is an automorphism ψ of X exchanging the m-th factor and the zth factor. This automorphism extends to a linear automorphism φ : Pr → Pr with φ(X) = X, because the embedding X ֒→ Pr is induced by the complete linear system |OX (1, . . . , 1)| and ψ ∗ (OX (1, . . . , 1)) ∼ = OX (1, . . . , 1). We would have that πz (Li ) is a linear space of dimension dim Li , which yields a contradiction.  8 CONTACT LOCI AND IDENTIFIABILITY The condition that for each i ∈ {1, . . . , s} there is j ∈ {1, . . . , s} \ {i} such that nj = ni restricts the range of application of Theorem 5.3. However, the theorem applies to the products of many copies of a given Pq , i.e. to the case of cubic tensors (provided that one knows the non-defectivity of the corresponding Segre embedding). In particular, in the case ni = 1 for all i, as an immediate corollary of [23] and Theorem 5.3, we obtain the following result. Corollary 5.4. Fix an integer s ≥ 5 and an integer k > 0 such that (k + s − 1)(s + 1) ≤ 2s − 1. s Let X ⊂ P2 −1 be the Segre embedding of (P1 )s . Then X is not weakly k-defective, hence it is k-identifiable. Thus, we obtain that binary tensors, i.e. tensors of type 2 × · · · × 2 (s times), are k-identifiable for 2s − 1 − s + 1. k≤ s+1 This bound is very near to k0 = ⌈2s /(s + 1)⌉ is the maximal integer for which k-identifiability can hold. As an immediate corollary of [9, Theorem 3.1] we get the following result. Corollary 5.5. Take X = (Pm )s ⊂ Pr , m > 1, r + 1 = (m + 1)s . Set a := ⌊(m + 1)s /(ms + 1)⌋ and let ǫ be the only integer such that 0 ≤ ǫ ≤ m and a ≡ ǫ (mod m + 1). If either ǫ > 0 or (k + ms)(sm + 1) ≤ (m + 1)s − 1, set a′ := a − ǫ. If ǫ = 0 and (ms + 1)a = (m + 1)s set a′ := a − 1. For any positive integer k + ms − 1 ≤ a′ X is not weakly k-defective and hence it is k-identifiable. Take X as in Corollary 5.5. Note that if k ≥ a + 2, then σa+2 (X) has expected dimension > r and hence identifiability fails for σa+2 (X). In the special case s = 3, in Corollary 3.10 it is sufficient to assume 3m(k + 3m − 1) < (m + 1)3 , because the secant varieties of (Pm )3 are not defective, by [39]. Complete results on the defectivity of Segre products with more than 3 factors, except for the case of many copies of P1 and for (Pm )3 ([39]) and an almost complete for [9], are not available. As far as we know, the best procedure to find theoretically the non defectivity of Segre products is the inductive method described in [5]. For Segre-Veronese varieties, which correspond to rank 1 partially symmetric tensors, we can join Theorem 5.1 and Theorem 5.3 to get: Theorem 5.6. s ≥ 2, ni > 0, di > 0, 1 ≤ i ≤ s. Set n := n1 + · · · + ns and r =  Fix integer Q di +n r i . Let X ⊂ P be the (n-dimensional) Segre-Veronese embedding of the multiprojective −1+ di space Pn1 × · · ·× Pns , via the linear system Ld11 ⊗ · · ·⊗ Lds s , where each Li is the pull-back of OPni (1) in the projection onto the i-th factor. Assume that dim σk+n−1 (X) = (k + n − 1)(n + 1) − 1 < r. Assume also that either: • di > 1 for all i; or • for all i with di = 1 there exists j 6= i such that dj = 1 and ni = nj . Then X is not weakly j-defective (hence it is j-identifiable) for every j ≦ k. Proof. Notice that X is not uniruled by lines, unless di = 1 for some i. When some di is 1, one can still apply the trick introduced in the proof of Theorem 5.3.  Example 5.7. C. Araujo, A. Massarenti and R. Rischter proved that if h ≤ a⌊log2 (d−1)⌋ , then σh+1 (X) has the expected dimension (see [13, Theorem 1.1] for a more precise result). For the case s = 2 there is a very strong conjecture and several results supporting it ([1, 2, 4]). When s = 2 H. Abo and M. C. Brambilla give a list of 9 classes of secant varieties, which are known to be defective and they conjecture that they are the only defective ones for s = 2 ([4, Conjecture 5.5]. See [8, Table 2] for the list of known (in 2010) non-defective cases when s = 2. H. Abo and M. C. Brambilla also gave many examples of defective secant varieties when s = 3, 4 ([3]). See [4, §5] for a general conjecture for the non-defectivity of Segre-Veronese varieties. If di ≥ 2 for all i, then X is not uniruled by lines, so we may apply Theorem 5.1 to obtain the non weak defectivity. CONTACT LOCI AND IDENTIFIABILITY 9 Example 5.8. C. Améndola, J.-C. Faugère, K. Ranestad and B. Sturmfels ([11, 12]) studied the Gaussian moment variety Gn,d ⊂ PN , N = n+d − 1, whose points are the vectors of all moments n of degree ≤ d of an n-dimensional Gaussian distribution. We have dim Gn,d = n(n + 3)/2. They proved that all the secant varieties of G1,d are non-defective, but σ2 (Gn,d ) is defective for all n ≥ 3 ([12, Theorem 13 and Remark 15]). To apply Theorem 5.1 to G1,d we need prove that G1,d is not uniruled by lines. If so, Theorem 5.1 may be applied to σk (G1,d ) for all k with 2(k +1) < d. We may assume d ≥ 4. The variety G1,d ⊂ Pd is described in [11] and [12]; it is an arithmetically Cohen Macaulay surface of degree d2 ([11, Proposition 1 and the last part of its proof and Corollary 2]) and its singular locus is a line L ⊂ G1,d ([12, Lemma 4]). Let ℓL : Pd \ L → Pd−2 the note the linear projection of from L and let π : G1,d \ L → Pd−2 be the restriction of ℓL . Assume that G1,d is ruled by line and call ∆ the one-dimensional family of lines giving the ruling. Since the Grassmannian are complete, ∆ coves G1,d and hence the closure of the image of π would be an integral and non-degenerate curve Y ⊂ Pd−2 such that a general L ∈ ∆ is mapped to a general point of Y . The surface G1,d is covered by a family of degree d rational normal curves of Pd , each of them tangent to L at a different point. Hence Y must be the rational normal curve of degree d − 2 and X would be contained in a degree d − 2 3-dimensional cone T ⊂ Pd with vertex L. Since  d deg(G1,d ) = 2 > 3(d − 2), Bezout theorem gives that every cubic hypersurface containing G1,d contains T , contradicting the fact that G1,d is cut out by cubics ([11, Proposition 1]). For Segre products, the most general result that we can obtain with our techniques is resumed in the following theorem. It can be applied to a wide class of Segre products, not covered by Theorem 5.3. P Theorem 5.9. Let X be the Segre embedding of a product Pn1 × · · · × Pnq in Pr , with n = ni = dim(X). Let k be a positive integer. Assume that dim σk+n−1 (X) = (k + n − 1)(n + 1) − 1 < r (in particular X is not (k + n − 1)-defective). Then X is j-identifiable for every j ≤ k. Proof. Assume that X is weakly k-defective. Then, as in the proof of Theorem 5.1, there exists some j, k ≤ j ≤ k + n − 2, such that the general tangential contact loci Γj and Γj+1 have the same dimension. Thus, by Lemma 3.5 and its proof, the contact loci Γj and Γj+1 are formed by a union of linearly independent linear spaces Li , say of dimension s. By Remark 5.2, the Li ’s are contained in some component of the product, which, as in the proof of Theorem 5.6, is the same for all i’s. Say for simplicity that the Li ’s sits in the first component. Call Y the Segre embedding of Pn2 × · · · × Pnq and call Qi ∈ Y the point to which Li maps in the projection X → Y . The Qi ’s are general points of Y . Since X is not j + 1 defective, the span M of the Li ’s has dimension (j + 1)(s + 1) − 1. If M meets X only in the union of the Li ’s, which are linearly independent subspaces, then by [19, S Example 2.2] and Lemma 4.2 X is (j + 1)-identifiable. Otherwise there is a point P ∈ (M ∩ X) \ Li . The point P cannot belong to the same fiber over Y of some Li , for otherwise M contains the span of Li and P , and its dimension cannot be (j +1)(s+1)−1. Thus the projection of M ∩ X to Y contains a point Q different from the Qi ’s. It follows that for a general choice of j points Q1 , . . . , Qj in Y the span of the Qi ’s meets Y in a point Q different from the Qi ’s. By the trisecant lemma ([14, p. 109], [24, Example 1.8], [25, Proposition 2.6]), this meansP that the codimension of Y in its span is at most j − 1. Since the codimension of Y is Π(ni + 1) − ni − 1 (where the product and the sum range from 2 to q), and moreover (j + 1)(n + 1) < Πqi=1 (a1 + 1), after a short computation we get that: a1 > Πqi=2 (ai + 1) − q X ai , i=2 i.e. Y is unbalanced in the sense of [20, Section 8]. Since we also have j ≥ a1 , it follows by [5, Theorem 4.4] that either σj+1 (X) covers Pr , or X is (j + 1)-defective. In both cases we have a contradiction.  We should remark that the inductive method of [5] is extended to the study of weak defectivity in [20]. The results contained in [20] are, in several cases, improved by the results that one can get via Theorem 5.9. From the computational point of view, let us point out the following: 10 CONTACT LOCI AND IDENTIFIABILITY Remark 5.10. For specific examples of Segre products X, the stacked hessian method introduced in [30] can provide a positive answer to the k-identifiability of X. The stacked hessian method requires the computations of the derivatives of the span of k tangent spaces at general points, when the points move. In order to prove the non (k + n)-defectivity of X, by the Terracini’s lemma, one has just to compute the dimension of the span of k + n general tangent spaces (see e.g. [32, Section 6]). When n is not too big with respect to k, this second method, together with Theorem 5.9, can provide the k-identifiability of X with a faster procedure. 6. Positive characteristic In this section we work over an algebraically closed field K of arbitrary characteristic. Definition 6.1. Let X ⊂ Pr be an integral and non-degenerate variety. Set n := dim(X). X is said to be very strange if for a general codimension n linear subspace M ⊂ Pr the set X ∩ M is not in linearly general position in M , i.e. there is a hyperplane of M containing at least r − n + 2 points of M ∩ X ([42]). We recall that X ⊂ Pr is not very strange if a general 0-dimensional section of X is in uniform position ([14, Ch. 2],[42, Introduction]). Hence X ⊂ Pr is not very strange if either char(K) = 0 or X is non-singular in codimension 1 and r ≥ n + 3 ([42, Corollaries 1.6 and 2.2 and Theorem 0.1]). Thus none of the examples of the last section is very strange. X is not very strange if a general curve section of X is not strange ([42, Lemma 1.1]) and in particular X is not very strange if char(K) > deg(X). Lemma 6.2. Let Y ⊂ Pr be an integral and non-degenerate variety, which is not very strange. Set n := dim(Y ). Fix a general S ⊂ Y with ♯(S) ≤ r − n − 1. Then S is the set-theoretic base locus of the linear system on Y induced by H 0 (Pr , IS (1)). Proof. Let N ⊂ Pr be a general linear space of dimension n − r − 1. By Bertini’s theorem the scheme N ∩ Y is a finite set of deg(Y ) points. Since Y is not very strange, the set N ∩ Y is in linearly general position in N . Hence for any E ⊂ N ∩ Y with ♯(E) = ♯(S) ≤ n − r − 1, the restriction of U := H 0 (Pr , IE (1)) to N ∩ Y has E as its set-theoretic base locus. Since N is a linear space the restriction of U to Y has base locus contained in N ∩ Y . Thus E is the base locus of the restriction of U to T . Since Y is integral and non-degenerate, a general subset A ⊂ Y with cardinality at most r − n spans a general subspace of Pr with dimension ♯(A) − 1. Hence E is a general subset of Y with cardinality ♯(S).  Proof of Theorem 1.1: Fix a general q ∈ σk (X). If dim σk (X) < kn + k − 1, then a dimensional count gives that S(q, X) is infinite. Hence to prove Theorem 1.1 it is sufficient to find a contradiction to the existence of A, B ∈ S(q, X) with A 6= B. Set E := B \ A ∪ B and Z := A ∪ E. We have h1 (Pr , IZ (1)) > 0, because q ∈ hAi ∩ hBi and q ∈ / hA ∩ Bi ([15, Lemma 1]), i.e. Z does not impose ♯(Z) independent conditions to W . We may also assume that A and B are general in their irreducible component of the constructible set S(q, X). Since q is general, we may assume that A (resp. B) is a general subset of X with cardinality s, but of course A ∪ B is far from being general (in general). We identify X with M , so that L and R are line bundles on X and OX (1) ∼ = L⊗R. Since A is general and ♯(A) ≤ dim V , the set of all f ∈ V vanishing at all points of A is a linear subspace of V with dimension dim(V )−s. Hence h1 (Pr , IA (1)) = 0. Since A is general, by Lemma 6.2 there is a hypersurface T ∈ |V | with A ⊂ T and E ∩ T = ∅. Let f ∈ V \ {0} be an equation of T . The multiplication by f induces an isomorphism between H 0 (X, R) and the linear subspace W (−T ) := H 0 (X, IT ⊗ L ⊗ R) ∩ W of all g ∈ W vanishing on T . Moreover, for any finite subset S ⊂ X \ T this isomorphism sends H 0 (X, IS ⊗ R) onto W (−T − S) = {h ∈ W : h|T ∪S ≡ 0}. Since ♯(E) ≤ ♯(B) ≤ h0 (R) and B is general in X, we have h0 (X, IE ⊗ R) = h0 (X, R) − ♯(E), i.e. E impose s independent conditions to H 0 (X, R). Since T ∩ E = ∅, we get dim(W (−T − E)) = dim(W (−T )) − ♯(E). Hence H 0 (Pr , IZ (1)) = dim W − ♯(Z), i.e. h1 (Pr , IZ (1)) = 0, a contradiction.  We give an example of application of Theorem 1.1. CONTACT LOCI AND IDENTIFIABILITY 11 r ns n1 Example Take X = P × · · · × P and positive integers di > 0 and let X ⊂ P , r = Qs 6.3. ni +di −1+ i=1 ni . Write di = bi +ci with bi > 0, ci ≥ 0 and cj > 0 for some j. Set n := n1 +· · ·+ns . If we fix any integer k > 0 such that  s   s  Y n i + b i Y n i + ci k ≤ min{−2 − n + , }, ni ni i=1 i=1 then Theorem 1.1 applies and proves the identifiability of a general q ∈ Pr of X-rank k. References [1] H. Abo, On non-defectivity of certain Segre-Veronese varieties. J. Symb. Comput. 45 (2010), no. 12, 1254–1269. [2] H. Abo, and M. C. Brambilla, Secant varieties of Segre-Veronese varieties Pm × Pn embedded by O(1, 2). Experim. Math. 18 (2009), no. 3, 369–384. [3] H. Abo, and M. C. Brambilla, New examples of defective secant varieties of Segre-Veronese varieties. Collect. Math. 63 (2012), no. 3, 287–297. [4] H. Abo, and M. C. Brambilla, On the dimensions of secant varieties of Segre-Veronese varieties. Ann. Mat. Pura Appl. 192 (2013), no. 1, 61–92. [5] H. Abo, G. Ottaviani, and C. Peterson, Induction for secant varieties of Segre varieties. Trans. Amer. Math. Soc. 361 (2009), no. 2, 767–792. [6] H. Abo, G. Ottaviani, and C. Peterson, Non-defectivity of Grassmannians of planes. J. Alg. Geom. 21 (2012), 1–20. [7] H. Abo, and N. Vannieuwenhoven, Most secant varieties of tangential varieties to Veronese varieties are nondefective. Trans. Amer. Math. Soc. 370 (2018), no. 1, 393–420. [8] B. Ådlandsvik, Joins and higher secant varieties. Math. Scand. 62 (1987), 213-222. [9] T. Aladpoosh, and H. Haghighi, On the dimension of higher secant varieties of Segre varieties Pn × · · · × Pn . J. Pure Appl. Algebra 215 (2011), no. 5, 1040–1052. [10] J. Alexander, and A. Hirschowitz, Polynomial interpolation in several variables. J. Alg. Geom. 4 (1995), no. 2, 201–222. [11] C. Améndola, J.-C. Faugère, and B. Sturmfels, Moment varieties of Gaussian mixtures. J. Alg. Stat. 7 (2016), no. 1, 14–28. [12] C. Améndola, K. Ranestad, and B. Sturmfels, Algebraic Identifiability of Gaussian Mixtures. IMRN to appear. Preprint arXiv:1612.01129 (2016). [13] C. Araujo, A. Massarenti, and R. Rischter, On nonsecant defectivity of Segre-Veronese varieties. Preprint arXiv:1611.01674 (2016). [14] E. Arbarello, M. Cornalba, P. Griffiths, and J. Harris, Geometry of algebraic curves, Vol. I. Springer, Berlin Heidelberg - New York, 1985. [15] E. Ballico and A. Bernardi, Decomposition of homogeneous polynomials with low rank, Math. Z. 271 (2012), 1141–1149. [16] E. Ballico, A. Bernardi, M.V. Catalisano, and L. Chiantini, Grassman secants, identifiability, and linear systems of tensors. Linear Algebra Appl. 438 (2013), 121–135. [17] K. Baur, J. Draisma, and W. de Graaf, Secant dimensions of minimal orbits: computations and conjectures. Experim. Math. 16 (2007), no. 2, 239–250. [18] A. Bernardi, and D. Vanzo, A new class of non-identifiable skew symmetric tensors. Preprint arXiv:1606.04158 (2016). [19] C. Bocci, and L. Chiantini, On the identifiability of binary Segre products. J. Algebraic Geometry 22 (2013), 1–11. [20] C. Bocci, L. Chiantini, and G. Ottaviani, Refined methods for the identifiability of tensors. Ann. Mat. Pura Appl. 193 (2014), no. 6, 1691–1702. [21] A. Boralevi, A note on secants of Grassmannians. Rend. Istit. Mat. Univ. Trieste 45 (2013), 67–72. [22] M. V. Catalisano, A. V. Geramita, and A. Gimigliano, Secant Varieties of Grassmann Varieties. Proc. Amer. Math. Soc. 183 (2004), 633–642. [23] M. V. Catalisano, A. V. Geramita, and A. Gimigliano, Secant varieties of P1 × · · · × P1 (n-times) are NOT defective for n ≥ 5. J. Alg. Geom. 20 (2011), 295–327. [24] L. Chiantini, and C. Ciliberto, A few remarks on the lifting problem. Astérisque 218 (1993), 95–109. [25] L. Chiantini, and C. Ciliberto, Weakly defective varieties. Trans. Amer. Math. Soc. 454 (2002), no. 1, 151–178. [26] L. Chiantini, and C. Ciliberto, On the concept of k-secant order of a variety. J. London Math. Soc. 73 (2006), no. 2, 436–454. [27] L. Chiantini, and C. Ciliberto, On the dimension of secant varieties. J. Europ. Math. Soc. 73 (2006), no. 2, 436–454. [28] L. Chiantini, M. Mella, and G. Ottaviani, One example of general unidentifiable tensors. J. Algebr. Stat. 5 (2014), no. 1, 64–71. [29] L. Chiantini, and G. Ottaviani, On generic identifiability of 3-tensors of small rank. SIAM J. Matrix Anal. Applic. 33 (2012), 1018–1037. [30] L. Chiantini, G. Ottaviani, and N.Vanniuwenhoven, An algorithm for generic and low-rank specific identifiability of complex tensors. SIAM J. Matrix Anal. Applic. 35 (2014), 1265–1287. 12 CONTACT LOCI AND IDENTIFIABILITY [31] L. Chiantini, G. Ottaviani, and N.Vanniuwenhoven, On identifiability of symmetric tensors of subgeneric rank. Trans. Amer. Math. Soc. 369 (2017), no. 2, 4021–4042. [32] L. Chiantini, G. Ottaviani, and N.Vanniuwenhoven, Effective criteria for specific identifiability of tensors and forms. SIAM J. Matrix Anal. Applic. 38 (2017), 656–681. [33] I. Domanov, and L. De Lathauwer, On the uniqueness of the canonical polyadic decomposition of third-order tensors–part I: Basic results and unique- ness of one factor matrix. SIAM J. Matrix Anal. Appl. 34 (2013), 855–875. [34] I. Domanov, and L. De Lathauwer, On the uniqueness of the canonical polyadic decomposition of third-order tensors–part II: Uniqueness of the overall decomposition. SIAM J. Matrix Anal. Appl. 34 (2013), 876–903. [35] I. Domanov, and L. De Lathauwer, Generic uniqueness conditions for the canonical polyadic decomposition and INDSCAL. SIAM J. Matrix Anal. Applic. 36 (2015), no. 4, 1567-1589. [36] F. Galuppi, and M. Mella, Identifiability of homogeneous polynomials and Cremona Transformations. Preprint arXiv:1606.06895 (2016). [37] J. B. Kruskal, Three-way arrays: rank and uniqueness of trilinear decompositions, with application to arithmetic complexity and statistics. Linear Algebra Appl. 18 (1977), no. 2, 95–138. [38] J.M. Landsberg, Tensors: Geometry and Applications Graduate Studies in Mathematics, Amer. Math. Soc. Providence, 128 (2012). [39] T. Lickteig, Typical tensorial rank. Linear Algebra Appl. 69 (1985), 95–120. [40] A. Massarenti, and R. Rischter, Non-secant defectivity via osculating projections. Ann. Scuola Norm. Sup. to appear. Preprint arXiv:1610.09332v1 (2016). [41] M. Mella, Singularities of linear systems and the Waring problem. Trans. Amer. Math. Soc. 358 (2006), no. 12, 5523–5538. [42] J. Rathmann, The uniform position principle for curves in characteristic p. Math. Ann. 276 (1987), no. 4, 565–579. [43] N. D. Sidiropoulos, and R. Bro, On the uniqueness of multilinear decomposition of N-way arrays. J. Chemometrics 14 (2000), 229–239. (Edoardo Ballico) Dipartimento di Matematica, Univ. Trento, Italy E-mail address: [email protected] (Alessandra Bernardi) Dipartimento di Matematica, Univ. Trento, Italy E-mail address: [email protected] (Luca Chiantini) Dipartimento di Ingegneria dell’Informazione e Scienze Matematiche, Univ. Siena, Italy E-mail address: [email protected]
0math.AC
A High-Performance HOG Extractor on FPGA Vinh Ngo Arnau Casadevall Marc Codina Department of Microelectronics and Electronics Systems Spain [email protected] Department of Microelectronics and Electronics Systems Spain [email protected] Department of Microelectronics and Electronics Systems Spain [email protected] David Castells-Rufas Jordi Carrabina Department of Microelectronics and Electronics Systems Spain [email protected] Department of Microelectronics and Electronics Systems Spain [email protected] ABSTRACT Pedestrian detection is one of the key problems in emerging selfdriving car industry. And HOG algorithm has proven to provide good accuracy for pedestrian detection. There are plenty of research works have been done in accelerating HOG algorithm on FPGA because of its low-power and high-throughput characteristics. In this paper, we present a high-performance HOG architecture for pedestrian detection on a low-cost FPGA platform. It achieves a maximum throughput of 526 FPS with 640x480 input images, which is 3.25 times faster than the state of the art design. The accelerator is integrated with SVM-based prediction in realizing a pedestrian detection system. And the power consumption of the whole system is comparable with the best existing implementations. KEYWORDS Histogram of gradients, HOG extractor, FPGA HOG accelerator 1 INTRODUCTION Pedestrian detection is a safety critical application on autonomous cars. There are two main approaches to implement pedestrian detection systems. On one hand, the detection algorithm relies on all input image pixels. This approach uses deep learning method and it requires costly computing platforms with not only many processing cores but also large memory bandwidth and capacity. On the other hand, only extracted features from the image are input to the detection algorithm. This approach using HOG (Histogram of Gradients) [1] has proven to have good accuracy in detection [2]. While requiring less memory capacity, it is still a computing-intensive algorithm, which needs a low latency and high-throughput platform. FPGA, therefore, comes as suitable solution thanks to its capability in parallel processing. More importantly, FPGAs potentially have better energy efficiency in comparison with alternative platforms such as CPU and GPU. In this paper, we design and implement a hog feature extractor on a low-cost FPGA device, targeting at high throughput and low power consumption. This work is based on our previous work in [3]. There are several improvements to help achieve a highperformance design. First, the fixed-point number is used to represent values other than the integer number, which apparently increases the feature’s accuracy with the cost of computational complexity. Secondly, a pipeline for normalizing cell features to take advantages of hardware’s capability in pipeline and parallel execution. The output HOG normalized features are transferred to the HPS (Hard Processor System) for prediction process. Third, instead of buffering input images before extracting, which costs memory, input pixels are processed directly from the sensor by a pipeline. And finally, we optimize the pipeline design so as to achieve the highest throughput. The HOG extractor design can work at a maximum clock frequency of 162 MHz and provide a throughput of 526 FPS, the highest throughput in the state of the art. The design is then integrated into a heterogeneous system with SVM-based prediction software. The energy efficiency is comparable to the most efficient implementations. The paper is outlined as follows. An overview of the original HOG algorithm is described in section 2. Section 3 discusses related works regarding FPGA implementations of real-time HOG extractor. Section 4 presents our architectural design in detail. The experimental results and discussions are shown in section 5. Finally, the conclusions are presented in section 6. 2 HOG OVERVIEW The HOG algorithm consists of two main steps: gradient computation and histogram generation. HIP3ES, January 2018, Manchester, United Kingdom To compute the gradient of a pixel (x,y), first, we need to calculate the intensity difference of its two pairs of neighbor pixels in horizontal and vertical directions following the Equation (1) and (2) respectively. ( , ) = ( + 1, ) − ( − 1, ) (1) ( , ) = ( , + 1) − ( , − 1) (2) Then, the magnitude and the orientation of the gradient at pixel(x,y) are computed by Equation (3) and (4). | ( , )| = ( , ) + ( , )= ( , ) ( , ) ( , ) (3) (4) Figure 1: Histogram is generated cell by cell Having the gradients, the histogram is generated cell by cell. Each cell has a size of 8x8 pixels. Therefore, a cell consists of 64 pairs of magnitude and orientation gradient values. Depending on the associated orientations, the magnitude gradients are accumulated to the corresponding bins. A cell histogram with nine bins is illustrated in Figure 1. Figure 2 describes in detail how the orientation of the gradient is quantized into a range of 9 bins using the scale from 0 to 180o. Figure 2. Dividing into 9 bins from 0 to 180o The magnitude G, in this example, should be accumulated to bin 2 because its orientation is approximately 30o. For more accuracy, G will be accumulated fairly between adjacent bins depending on its exact orientation. 3 RELATED WORKS To our knowledge, the works in [4], [5] presented the first implementations of HOG extractors on FPGAs. In [4], the HOG extractor is shown to have a good latency of only 312 µs. However, V. Ngo et al. this design does not include the normalization module and it simplifies the computational process by using integer numbers. In [6], the authors proposed to process the pixel data at twice the pixel frequency and normalize the block histograms using L1-norm so that the available resources are efficiently used and can address parallel computing of multiple scales. With an input image of 1920x1080, the design achieves high speed with a latency of only 150 µs. But it is not clarified in the paper what this latency is about. Similarly, the design used some kinds of frame buffer before HOG processing module, which costs memory. Energy consumption of a HOG-based detection system on FPGA is first reported in [2]. In this work, the authors try to reduce the bit-width of the fixed-point representation to boost the performance. With a 640x480 frame size and a 13-bit fixed-point representation, the energy efficiency of the HOG extractor module is 0.54J/Frame. Anyway, the design leverages a costly hardware system with four FPGA devices and each device has 16 64-bit memory channels. The memory space for those 4 FPGA devices is 128 GB. Another approach is presented in [7], in which the authors investigate the cell size and number of histogram bins that provide better performance. In this implementation, all the process of the detection system is integrated into an FPGA device. With a negligible loss in accuracy, the best set of parameters provides a frame rate of 42.7fps and high energy-efficiency of only 0.451J/Frame. A detailed description of HOG implementation on FPGA is presented in [8], which achieves a high processing speed at 40fps, with 1920x1080 input image size. Interestingly, in [9], HOG algorithm is analyzed on a heterogeneous system, including CPU, GPU, and FPGA. Based on multiple configuration experiments, the authors concluded that FPGA is best suited for histogram extraction and classification tasks in the whole detection flow because it produces a good trade-off between power and speed. Recently, our previous work is published in [3], which simplifies the computing by using integer numbers. We achieved high throughput in HOG extracting process by buffering the input image. Besides, a look-up table is used to store the results of the square root and arctan computations. This approach heavily consumes on-chip memory. A low-complexity implementation of HOG-based pedestrian detection is presented recently in [10]. Instead of the original HOG, the authors proposed the use of histogram of significant gradients, and the hardware is, therefore, less complex. In addition, hardware resource usage is optimized by reducing the number of bits representing the intermediate values during computation processes. Besides, the authors avoid using complex representation numbers as well as DSP operations by precalculated values and simplification techniques. 4 IMPLEMENTATION We implement the whole system in Terasic’s DE1-SOC board. The system block diagram is shown in Figure 3. It includes the hardware components such as the image sensor, the HOG pipeline, the Hard Processor System (HPS), and other supporting modules. A High-Performance HOG Accelerator on FPGA HIP3ES, January 2018, Manchester, United Kingdom four cells and L2 normalization [1] is chosen for the sake of accuracy and simplicity. Figure 5 describes our hardware line buffers that allow the HOG module to compute the luminance difference Gx and Gy between neighbor pixels in vertical and horizontal directions. This design supports processing pixels on every clock cycle, which means that the performance of the design can be boosted if input pixels come at every clock cycle. Figure 3. System diagram Images from the sensor, after being filtered by the Bayern Pattern, are transferred directly to both the HOG pipeline module and the pixel FIFO. The pixel FIFO is necessary for later showing the original image on the VGA. A custom Avalon master interface is created to get pixels from this FIFO and write to the 1GB external SDRAM controlled by the HPS. The image sensor is configured through an I2C interface for some key parameters such as image size, pixel clock. The Bayer pattern filter module takes raw input pixels and calculates the three colors pixel values. After that, the grayscale pixel value is generated to provide the HOG extractor and the HPS for real-time visualization. The HOG extractor module is a long pipeline that generates the normalized hog features. Our best implementation in throughput used a 155 stages pipeline. The features are then written to the HPS memory by a DMA (Direct Memory Access). A Python code running on HPS will read these features out for predicting the present of pedestrians. The detailed architecture inside the HOG pipeline is presented in Figure 4. Figure 4. HOG extractor block diagram First of all, luminance differences Gx and Gy (Eq. 1,2) are calculated by the DELTAXY module. These are 9 bit signed integers. We used the vector translate function in CORDIC IP to compute the magnitude and the orientation gradients. Both of them are fixed-point numbers. To achieve 2 digits after the decimal point accuracy, we choose to represent the orientation gradient by 13 fractional bits. Thus, the number of fractional bits for the magnitude gradient is six, according to the configuring requirement of CORDIC IP. Depending on the orientation gradient, the magnitude gradient of each pixel will vote to appropriate bins. The AGGREGATE module adds 64 histogram values of 64 pixels in a cell bin by bin to output the final cell features. Finally, cell features are block-wise contrast normalized. In this design, each block has Figure 5. Pixel line buffers The depth of each buffer corresponds to the row size of the input image, in our case 640. The luminance differences, Gx and Gy, at pixel P_11 are calculated using P_21 and P_01 for the vertical direction, and P_10 and P_12 for horizontal direction as in Equation (5) and (6). (1,1) = (1,1) = − − (5) (6) Following the original HOG algorithm in [1], the final HOG feature is extracted from every cell of 8x8 pixel size. And the orientation is divided into 9 bins from 0 to 180º. In our case, with the 640x480 image size, the final HOG feature is a vector of 80x60x9 dimension. The HOG module processes in a pipeline approach every 8 continuous pixels in a row of a cell. And it generates a partial hog vector with 9 bins aggregating 8 magnitude gradient values. These partial hog vectors are put in a line buffer as shown in Figure 6. Only 80 partial cell hogs are needed to be stored so as to minimize the memory usage without stalling the pipeline. In order to generate the full HOG feature for a cell, it is necessary to aggregate 8 partial cell hogs from 8 different rows. The cell_hog_valid signal will be active only if all the partial cell hogs are fully collected. Figure 6. Partial cell hog line buffer HIP3ES, January 2018, Manchester, United Kingdom The normalization of the cell histogram is done following the equation in (7). In the equation, v is the cell hog features in the block, and ǁvǁ2 is the L2-normalization of all the cell hog features in the block. A small constant, Ɛ, is added to avoid dividing by zero. As illustrated in Figure 4, each bin of the normalized hog feature is represented by 32 bits. This is not the final HOG feature value and it is represented in floating-point format. We only do the conversion from the fixed-point format to the floating-point format for the final step. All the intermediate results are calculated by integer and fixed-point numbers depending on the specific task. = (7) ǁ ǁ Ɛ We used the ModelSim simulator and a C golden model of the HOG to verify the HOG extractor design. At the system level, we build a heterogeneous system as in Figure 7. An Ubuntu distribution runs on the HPS. We used Qsys (Quartus-II) to create the system-on-chip FPGA architecture. V. Ngo et al. We have trained and tested several models with different configurations using the INRIA Person Dataset [12] to achieve a maximum yield in terms of accuracy. We have tested our model not only with INRIA test dataset but also images from the camera sensor to have a more generalized model. 5 RESULTS AND DISCUSSIONS The hardware design of the HOG extractor is compared stepwise with a reference C model which uses floating point operations. And the output results of the two implementations, which is the final normalized hog features, have an average difference of only 2 units at the second digit after the decimal point, which corresponds to 2% accurate because the range of a normalized feature value is from 0 to 1. Table 1 reports the key compilation results for the HOG extractor and the heterogeneous system. For the HOG extractor, we provide two versions. The normal version works at 49 MHz and costs fewer hardware resources. The optimized one targets high throughput applications. It can work at 162 MHz clock frequency. Running at this frequency, the design only requires 2% more in ALMs and 9 more DSP blocks. And the number of registers is increased by nearly 20%. The on-chip memory usage is almost the same between the two versions. On the other hand, the heterogeneous system, as illustrated in Figure 7, is a system on chip design which includes the HOG extractor module as a hardware accelerator. Table 1: Compilation report for Cyclone V device Figure 7. HOG feature extraction system The normalized HOG feature is written to the external DDR3 SDRAM memory by a DMA through the f2h_axi_slave bridge. A custom Avalon bus master is created in Qsys to send image pixels also to the DDR3 memory. These two memory locations are set to be dedicated for FPGA. These transfer methods provide good system performance because data are transmitted in parallel with the HPS’s CPU execution. In the opposite direction, the pixels in the memory and detection results are sent to the VGA controller to visualize in real time. To extract all the data (pixel image and hog features) we used a Python C/C++ API to write an extension module for binding the communicating between the HPS memory and the Python interpreter. That is useful to compute, in a high-level manner, the detection and classification tasks using Machine Learning techniques. Our Python script is capable of reading both the frame and HOG vector provided by the board by reading in C their respective memory registers and, then, binding them with Python C/C++ API as Numpy [11] arrays. Design Block memory Kbits Logic (in ALMs) DSP Registers Fmax blocks (MHz) HOG extractor 324 (8%) 7,922 (25%) 65 (75%) 14,787 49 Optimized HOG extractor 326 (8%) 8,610 (27%) 74 (85%) 17,697 162 12,138 (38%) 65 (75%) 21,715 69 Heterogeneous 437 (11%) system Other than the clock frequency, a design’s output throughput also depends on the input throughput. Our design supports up to one input pixel every clock cycle. It means that if the input pixel clock is 162 MHz, our design throughput reaches 526 FPS as shown in Table 2. It is worth noting that the figures in this table are based on the HOG extractor design, not the heterogeneous system. According to Table 2, our design speeds up 3.25x over the equivalent design recently published [10]. In order to compare designs that have different input frame size, we use pixels per second unit. In this scale, our design also supports the highest performance. Our implementation achieves 22% higher than the work in [6]. Another interesting measurement is the number of pixels per clock period. This number reflects the throughput of the A High-Performance HOG Accelerator on FPGA HIP3ES, January 2018, Manchester, United Kingdom design without taking into account the clock frequency. Our design achieves nearly 1 pixel on every clock, and it is the highest throughput according to Table 2. Regarding FPGA resource, our design is optimized for memory usage and therefore consumes least memory resource among the designs in Table 2. The reason for this is that our pipeline works on every input pixel and there is not any buffer for input frames. For other resources, implementation in [6] is the most efficient. It targeted at low resource utilization by simplifying some computational operations. In the voting part, magnitudes are voted to only one unique bin without interpolation. Furthermore, all the calculations use integer numbers. On the other hand, the implementation in [13] is quite equivalent to ours. It consumes less LUTs, DSPs and registers thanks to a Look-up Table for storing in arctan values. In terms of energy efficiency, we measure for the entire detection system. Following Table 3, our design consumes 0.82J/Frame which is quite higher than results from [2] and [7]. Those are the best designs in the state-of-the-art in terms of energy efficiency. The interesting point is that our design is better in power consumption. Thus, the reason for lower energy efficiency is because of the system detection rate. Our system only supports 11 fps although the HOG extractor can work at multiple times higher speed. We believe that our system throughput will improve significantly if we implement the classification task on FPGA, and therefore the energy consumption is reduced accordingly. We observed that sliding detection window, which is the most timeconsuming task in the classification process, can be done in parallel in hardware but not in HPS’s software. And we still have a large room to implement a classifier in hardware since the latency of the hardware part is only 6.16 ms, which is 14% of the design in [2]. Last but not least, Table 3 shows that our design’s hardware resource is significantly small in comparison to the others. Table 2: Comparison of performance between different FPGA implementations Design Frame size FPGA Max FPS frequency (MHz) Pixels per Second (FPS*Frame Size) Pixels per clock period (Pixels per Second/Frequency) FPGA resources Memory (Kb) LUTs DSPs Registers [4] 800x600 Spartan 3 63 30 14,400,000 0.229 1080 42,435 - - [6] 1920x1080 Virtex 7 266 64 132,710,400 0.5 936 3,924 12 3,642 [10] 640x480 Cyclone IV 117.8 162 49,766,400 0.422 - - - - 125 60 124,416,000 0.995 432 7,226 26 12,462 162 526 161,587,200 0.997 326 8,610 74 17,697 [13] Ours 1920x1080 ZynQ 7000 640x480 Cyclone V Table 3: Comparison of energy efficiency [2] Frame size FPGA Freq. (MHz) Latency 640x480 Virtex 6 150 44 ms 37 0.54 68.2 Virtex 7 266 - 19 0.451 Cyclone V 50 6.16 ms 9 0.82 [7] 1920x1080 Us 640x480 Power Energy FPS Memory (W) (J/Frame) (Kb) # of LUTs DSPs # of FFs 13,738 184,953 190 208,666 42.7 4,079 30,360 364 48,576 11 437 12,138 65 21,715 6 CONCLUSION A high-performance HOG feature extractor is implemented on a low-cost FPGA device. Fixed-point representation is employed for achieving approximately 2% different in comparison with the floating-point golden model. The HOG extractor design, which supports 526 FPS, can be a well-fitted IP in high-performance pedestrian detection systems. The energy consumption of the whole detection system is 0.82J/Frame, which is among the good existing solutions. However, there is still room for future improvements to increase the detection throughput of our system design and lower down the energy consumption accordingly. This is can be done by implementing a classifier on chip. Thus, the classification task can slide the detection window through the HOG frame in parallel. Furthermore, the classification task also can be started early and pipelined together with the hog feature calculating process. ACKNOWLEDGMENTS HIP3ES, January 2018, Manchester, United Kingdom This work was supported by Spanish projects TEC2014-59679C2-2. REFERENCES [1] N. Dalal and W. Triggs, “Histograms of Oriented Gradients for Human Detection,” 2005 IEEE Comput. Soc. Conf. Comput. Vis. Pattern Recognit. CVPR05, vol. 1, no. 3, pp. 886–893, 2004. [2] X. Ma, W. A. Najjar, and A. K. Roy-Chowdhury, “Evaluation and acceleration of high-throughput fixed-point object detection on FPGAS,” IEEE Trans. Circuits Syst. Video Technol., vol. 25, no. 6, pp. 1051–1062, 2015. [3] V. Ngo, A. Casadevall, M. Codina, D. Castells-Rufas, and J. Carrabina, “A pipeline hog feature extraction for real-time pedestrian detection on FPGA,” in 2017 IEEE East-West Design & Test Symposium (EWDTS), 2017, pp. 1–6. [4] S. Bauer, U. Brunsmann, and S. Schlotterbeck-macht, “FPGA Implementation of a HOG-based Pedestrian Recognition System,” in MPC-Workshop, 2009, no. July. [5] R. Kadota, H. Sugano, M. Hiromoto, H. Ochi, R. Miyamoto, and Y. Nakamura, “Hardware architecture for HOG feature extraction,” IIH-MSP 2009 - 2009 5th Int. Conf. Intell. Inf. Hiding Multimed. Signal Process., no. 3, pp. 1330–1333, 2009. [6] M. Hahnle, F. Saxen, M. Hisung, U. Brunsmann, and K. Doll, “FPGA-Based realtime pedestrian detection on high-resolution images,” IEEE Comput. Soc. Conf. V. Ngo et al. Comput. Vis. Pattern Recognit. Work., pp. 629–635, 2013. [7] A. Khan, M. Umar, K. Khan, M. Bilal, and C. Kyung, “Hardware Architecture and Optimization of Sliding Window Based Pedestrian Detection on FPGA for High Resolution Images by Varying Local Features,” pp. 142–148. [8] J. Rettkowski, A. Boutros, and D. Gohringer, “Real-time pedestrian detection on a xilinx zynq using the HOG algorithm,” 2015 Int. Conf. ReConFigurable Comput. FPGAs, ReConFig 2015, 2016. [9] C. Blair, N. M. Robertson, and D. Hume, “Characterising a Heterogeneous System for Person Detection in Video using Histograms of Oriented Gradients: Power vs. Speed vs. Accuracy,” IEEE J. Emerg. Sel. Top. Circuits Syst., vol. 3, no. 2, pp. 236–247, 2013. [10] M. Bilal, A. Khan, M. U. K. Khan, and C.-M. Kyung, “A Low-Complexity Pedestrian Detection Framework for Smart VideoSurveillance Systems,” IEEE Trans. CIRCUITS Syst. VIDEO Technol., vol. 27, no. 10, pp. 2260–2273, Oct. 2017. [11] S. Van Der Walt, S. C. Colbert, and G. Varoquaux, “The NumPy array: a structure for efficient numerical computation,” Feb. 2011. [12] “INRIA Person dataset.” [Online]. Available: http://pascal.inrialpes.fr/data/human/. [Accessed: 16-Dec-2017]. [13] M. Hemmati, M. Biglari-Abhari, S. Berber, and S. Niar, “HOG Feature Extractor Hardware Accelerator for Real-Time Pedestrian Detection,” in 2014 17th Euromicro Conference on Digital System Design, 2014, pp. 543–550.
1cs.CV
Jolie Static Type Checker: a prototype Daniel de Carvalho1 , Manuel Mazzara1 , Bogdan Mingela1 Larisa Safina1 , Alexander Tchitchigin2 , Nikolay Troshkov1 1 Innopolis University, Russia Typeable.io LLC, Russia arXiv:1702.07146v5 [cs.SE] 18 Oct 2017 2 Abstract. Static verification of a program source code correctness is an important element of software reliability. Formal verification of software programs involves proving that a program satisfies a formal specification of its behavior. Many languages use both static and dynamic type checking. With such approach, the static type checker verifies everything possible at compile time, and dynamic checks the remaining. The current state of the Jolie programming language includes a dynamic type system. Consequently, it allows avoidable run-time errors. A static type system for the language has been formally defined on paper but lacks an implementation yet. In this paper, we describe a prototype of Jolie Static Type Checker (JSTC), which employs a technique based on a SMT solver. We describe the theory behind and the implementation, and the process of static analysis. 1 Introduction The microservice architecture is a style inspired by service-oriented computing that promises to change the way in which software is perceived, conceived and designed [20]. The trend of migrating monolithic architectures into microservices to reap benefits of scalability is growing fast today [10,11]. Jolie [23] is the only language natively supporting microservice architectures [8] and, currently, has dynamic type checking only. Static type checking is generally desirable for programming languages improving software quality, lowering the number of bugs and preventing avoidable errors. The idea is to allow compilers to identify as many issues as possible before actually run the program, and therefore avoid a vast number of trivial bugs, catching them at a very early stage. Despite the fact that, in the general case interesting properties of programs are undecidable [27], static type checking, within its limits, is an effective and well established technique of program verification. If a compiler can prove that a program is well-typed, then it does not need to perform dynamic safety checks, allowing the resulting compiled binary to run faster. A static type system for Jolie has been exhaustively and formally defined only on paper [25], but still lacks an implementation. The obstacles of programming in a language without a static type analyzer have been witnessed by Jolie developers, especially by newcomers. However, implementing such system is a non trivial task due to technical challenges both of general nature and specific to the language. In this paper, we introduce and describe the Jolie Static Type Checker (JSTC), building on top of the previous work on the Jolie programming language [23]. Our approach follows the formal derivation rules as defined in [25]. The project is built as a Java implementation of source code processing and verification via Z3 SMT solver [9] and it has to be intended as our community contribution to the Jolie programming language [4]. Section 2 recalls the basic of Jolie and section 3 discusses related work. The description of the static type-checking and the system architecture can be found in Section 4, while Section 6 draws conclusive remarks and discusses open issues. 2 Background Microservices [12] is an architectural style evolved from Service-Oriented Architectures [15]. According to this approach, applications are composed by small independent building blocks 2 Daniel de Carvalho et al. that communicate via message passing. These composing parts are indeed called microservices. This paradigm has seen a dramatic growth in popularity in recent years [24]. Microservices are not limited to a specific technology. Systems can be built using a wide range of technologies and still fit the approach. In this paper, however, we support the idea that a paradigm-based language would bring benefit to development in terms of simplicity and development cost. Jolie is the first programming language constructed above the paradigm of microservices: each component is autonomous service that can be deployed separately and operated by running in parallel processes. Jolie comprises formally-specified semantics, inspired by process calculi such as CCS [21] and the π-calculus [22]. As for practical side, Jolie was inspired by standards for Service-Oriented Computing such as WS-BPEL [2] and the attempts of formalizing it [18]. The composition of both theoretical and practical aspects allows Jolie to be the preferred candidate for the application of modern research methodologies, e.g. runtime adaptation, process-aware web applications, or correctness-by-construction of concurrent software. The basic abstraction unit of Jolie is the microservice [12]. It is based on a recursive model where every microservice can be easily reused and composed for obtaining, in turn, other microservices. Such approach allows distributed architecture and guarantees simple management of all components, which reduces maintenance and development effort. Microservices communicate and work together by sending messages to each other. In Jolie, messages are represented in tree structure. A variable in Jolie is a path in a data tree and the type of a data tree is a tree itself. Equality of types must therefore be handled with that in mind. Variables are not declared, wherefore the manipulation of the program state must be inferred. Communications are type checked at runtime, when messages are sent or received. Type checking of incoming messages is especially relevant, since it could moderate the consequences of errors. The Jolie language is constructed in three layers: The behavioural layer operates with the internal actions of a process and the communication it performs seen from the process point of view, the service layer deals with the underlying architectural instructions and the network layer deals with connecting communicating services. Other workflow languages are capable of expressing orchestration of (micro)services the same way Jolie can do, for example WS-BPEL [2]. WS-BPEL allows developers to describe workflows of services and other communication aspects (such as ports and interfaces), and it has been also shown how dynamic workflow reconfiguration can be expressed [17]. However, WS-BPEL has been designed for high-level orchestration, while programming the internal logic of a single micro-service requires fine-grained procedural constructs. Here it is were Jolie works better. 3 Related work The implementation of a static type checker for Jolie is part of a broader attempt to enhance the language for practical use. Previous work on the type system has been done, however focusing mostly on dynamic type checking. Safina extended the dynamic type system as described in [29], where type choices have been added in order to move computation from a process-driven to a data-driven approach. The idea to integrate dynamic and static type checking with the introduction of refinement types, verified via SMT solver, has been explored in [32]. The integration of the two approaches allows a scenario where the static verification of internal services and the dynamic verification of (potentially malicious) external services cooperates in order to reduce testing effort and enhancing security. The idea of using SMT Solvers for static analysis, in particular in combination with other techniques, has been successfully adopted before for other programming languages, for example LiquidHaskell and F*. LiquidHaskell [14]3 is a notable example of implementation of Liquid Types (Logically Qualified Data Types) [28]. It is a static verification technique 3 Online demo at http://goto.ucsd.edu/~rjhala/liquid/haskell/demo/ Jolie Static Type Checker: a prototype 3 combining automated deduction (SMT solvers), model checking (Predicate Abstraction), and type systems (Hindley-Milner inference). Liquid Types have been implemented for several other programming languages. The original paper presented an OCaml implementation. F* [1] instead an ML-like functional programming language specifically designed for program verification.The F* type-checker uses a combination of SMT solving and manual proofs to guarantee correctness Another direction in developing static type checking for Jolie is creating the verified type checker4 by means of proof assistant instead of SMT solver [3]. Proof assistant is a software tool needed to assist with the development of formal proofs by human-machine collaboration and helps to ascertain the correctness of them. The type checker is expressed as well-typed program with dependent types in Agda [26]. If the types are well formed, all required invariants and properties are described and expressed in the types of the program meaning that the program is correct. This work is currently in progress and evolves in parallel with ours. 4 Static type-checking implementation This paper builds on top of Julie Meinicke Nielsen’s work [25] at the Technical University of Denmark implementing the type system of the Jolie language. The thesis represents the theoretical foundation for the type checking of the core fragment of the language, which excludes recursive types, arrays, subtyping of basic types, faults and deployment instructions such as architectural primitives. The work of Nielsen presents the first attempt at formalizing a static type checker for the core fragment of Jolie, and the typing rules expressed there are the core theory behind our static checker. In Nielsen’s work typing rules are represented in the style of type theory where type rules are inference rules describing how a type system assigns a type to a syntactic construct of the language [7]. The rules are then applied by the type system to determine if a program is well typed or not. The main typing rules will be presented in the following of this paper. The implementation of JSTC consists of two system components. Firstly, a Java program accepts the source code of a Jolie program, builds an abstract syntax tree (AST), visits it and produces a set of logical assertions written in SMT Lib [5] language. At the second phase, the generated assertions are feed into Z3 solver. The basic idea is to implement, for each Jolie node5 , methods containing statements expressed in the SMT Lib syntax. These statements can then be processed via a solver. In Figure 1 the overall process is pictorially represented and details are described in section 4.4. The concept of SMT solvers is closely related to logical theorems. Logic, especially in the field of proof theory, considers theorems as statements of a formal language. Existence of such logical expressions allows to formulate a set of axioms and inference rules to formalize the typing rules for each of Jolie syntax nodes and then perform the validation of the nodes using constructed theorems. Consequently, the Jolie typing rules are the specific cases of logical theorems, that are used in the project. The concept is implied from software verification fundamentals [6]. Since Jolie program may contain complex expressions with function calls, it is also necessary to consider data structures representing a match between names and expressions, in order to be able to avoid inconsistency and redundancy, that are likely to cause conflicts during type-checking. The project implementation considers using a stack during the recursive checking of the nodes as illustrated in section 4.4. The decision of using an SMT-solver, instead of more lightweight techniques, was made in order to allow a future straightforward integration of Refinement Types into the type checker, objective on which our team is already working [29,32]. Furthermore, relying on a solid existing technology allowed us to prototype and release a proof of concept of the type checker in a shorter period of time. 4 5 https://github.com/ak3n/jolie Any syntax unit is considered a node. It can be a logical or arithmetic expression, an assignment; a condition; a loop etc. Those nodes comprise the abstract syntax tree. 4 Daniel de Carvalho et al. Fig. 1: Process of Type Checking in the Jolie Verifier 4.1 Jolie verifier The Java program reuses an existing structure of a Visitor pattern that was used in a previous project for formatting Jolie source code 6 . It accepts processed Jolie program source code in the form of AST and performs traversing. For each kind of node the system creates one or more logical formulas written using SMT-LIB [5] syntax, which are then stored into a file on disk. At the current implementation state the theorems are collected in a single data element.The verifier targets assignments, conditions, and other cases of variables usage where type consistency can be violated. 4.2 SMT Solver Z3 carries out the main functionality of program verification. Z3 is an SMT solver from Microsoft Research [9]. It is targeted at solving problems that arise in software verification and software analysis. Given a set of formulas that was previously created by the verifier in Java, Z3 processes it and returns whether this set is satisfiable or not. In case of any contradiction in the set, the solver will signal that the overall theorem is not satisfiable, therefore alerting that the input program is not consistent in terms of types usage. 4.3 Typing rules Our objective is to accurately translate Jolie typing rules into SMT statements, therefore allowing static type checking 7 . The foreground activity so far is producing the set of statements for the construct of the behavioural layer of Jolie. The layer describes the internal actions of a process and the communications it performs seen from the process’ point of view. The layer is chosen for the first phase of the development because of being the foundation of the syntactical structures of Jolie. Also there is a similarity of the layer with common programming languages in a sense of the abstraction level. So these facts make the behavioural level to be the first entry in the world of Jolie language capabilities. All statements at the behavioural layer of Jolie are called behaviours. We write Γ `B B . Γ 0 to indicate a behaviour B, typed with respect to an environment Γ , which updates Γ to Γ 0 during type checking [25]. There are some core rules presented and described below: T-Nil. The typing rule for a nil behaviour is an axiom. In the conclusion the typing environment is not changed, since the nil statement doesn’t affect the typing environment. 6 7 https://github.com/nickaleks/jolie Please note that, at the moment, not all the rules in [25] have been implemented. Jolie Static Type Checker: a prototype 5 Γ `B 0 . Γ T-If-Then-Else. The rule for typing an if statement is standard: An if statement is typable if its condition has type bool, and if the type checking of its branches perform the same updates to the environment. We require the branches to perform the same updates because we do not know which branch will be taken. The else part may also be omitted and B2 may be replaced by an empty behaviour. The conditional typing statement is the following: Γ ` e : bool Γ `B B1 . Γ 0 Γ `B B2 . Γ 0 Γ `B if (e) B1 else B2 . Γ 0 T-While. The rule for typing a while statement is standard: A while statement is typable if its condition has type bool, and if type checking its body has no influence on the typing environment. Γ ` e : bool Γ `B B . Γ Γ `B while(e)B . Γ Above, it is required that the body of the while loop does not change the typing of variables because we do not know whether the body will be executed at all, and for how many times. We also require that expression e is type checked against type bool. T-Seq. A sequence statement typed with respect to an environment is typable if its first component is typable with respect to the environment and its second component is typable with respect to the update of the environment performed by the first component. The update of the environment performed by the sequence statement is the update performed by the second component with respect to the update performed by the first component. Γ `B B1 . Γ 0 Γ 0 `B B2 . Γ 00 Γ `B B1 ; B2 . Γ 00 Thus, fundamental typing rules of the behavioral layer of Jolie programming language are presented and explained for further topic revelation. 4.4 Typing rules to SMT translation Here we will illustrate an example of the conditional rule translation in order to understand the procedure in detail. The typing rule of the if statement does not contradict intuition. The statement is typeable when its condition expression is boolean, and the execution of both its branches brings the same updates to the environment. This means that the set of matches between expressions and variables with their types remains the same with no difference from a branch choice. This is necessary since it is not possible to predict what branch will be executed at runtime 8 . The full implementation is available on github.9 Below we show the Java fragment that builds the corresponding SMT statement. public void visit(IfStatement n) { for (Pair<OLSyntaxNode, OLSyntaxNode> statement : n.children()) { OLSyntaxNode condition = statement.key(); OLSyntaxNode body = statement.value(); check(condition); TermReference conditionTerm = usedTerms.pop(); writer.writeLine("(assert (hasType " + conditionTerm.id + " bool))"); if (body != null) {body.accept(this);} } if (n.elseProcess() != null){n.elseProcess().accept(this);} } 8 9 The else part may also be omitted and B2 may be replaced by an empty behavior. https://github.com/innopolis-jolie-smt-typechecker/jolie 6 Daniel de Carvalho et al. The code structure represents basic steps to achieve a record with corresponding SMT statements of the block as a result. Firstly, a condition of the if statement is separated from the body. Then the condition is sent to be checked using the same visitor class. Eventually after the last ’recursion’ step the condition is put in the stack of terms, which contains any terms (expressions, variables etc.) processed during the checking. So the term corresponding to the condition is expected to be on top of the stack. Then an assertion that says the condition term is boolean is written. Afterwards the body is processed using one of the other overloads of the visitor. These steps can be repeated in case of existence of nested conditional statements. In the end of the method the else branch body of the very first if is processed if it is present. There is also an important note is that the conditional statement does not impose any other direct type restrictions besides the condition term that is confirmed by the mentioned typing rule. Other implemented nodes can be seen in the source mentioned above. The Jolie verifier takes some input for processing. Let us consider a simple piece of Jolie code with a conditional statement. a = 2; b = 3; if ( a > b ) { println@Console( a + b )() } else{ println@Console( "Hello!" )() } In the case everything works, none of the typing rules is violated. Z3 agrees with the opinion and results in ’sat’, that means the program state is satisfiable. We list here the SMT statements representing the condition processing: (declare-const $$__term_id_10 Term) (assert (hasType $$__term_id_10 bool)) (assert (hasType $$__term_id_10 bool)) The first assertion is made based on an expression type determination: the expression a > b is boolean. The second one is imposed by the typing rule: the condition expression must be boolean. In this case there is no contradiction between these two assertions. If the condition would be replaced with some other type expression the typing rule may be violated. The corresponding example case with a replacement of a > b is shown below: a = 2; b = 3; if ( 5 ) { println@Console( a + b )() } else{ println@Console( "Hello!" )() } And the constructed SMT statements for the condition expression are given here: (declare-const $$__term_id_10 Term) (assert (hasType $$__term_id_10 int)) (assert (hasType $$__term_id_10 bool)) Now the contradiction between the assertions is notable. The parser decided the expression to be an integer, which is correct. But the restriction on a condition type from the typing rule simply contradict with the actual type. Consequently Z3 results in ’unsat’. This means that the program state representing the assertion unsatisfiable and incorrect in terms of the considered static type checking analysis. Jolie Static Type Checker: a prototype 5 7 Evaluation The question of how to prove correctness of verification tools has always been widely discussed. How can we be sure that the output of such tool is correct? It can be poorly written, or the hardware could malfunction. However, in most cases we tend to trust verification tools, and in our project we have to make sure that this tool is as trustworthy as any other. The general solution is testing. Verification of the written code correctness was continuously performed during the development process. The Jolie Team created a collection of examples of Jolie programs.10 The verification results of some of these are presented in this section. 5.1 An unsatisfiable model The general purpose of the type checker is to find inconsistency in types usage. The program listed below is the most basic example of a program with inconsistent types. The variable myInt is assigned an integer first, and then a string. The current design of the type checker disallows this behavior. main { myInt = 15; myInt = "fifteen" } The resulting set of SMT theorems is listed below. (declare-const myInt Term) (declare-const $$__term_id_4 Term) (assert (hasType $$__term_id_4 int)) (assert (sameType myInt $$__term_id_4)) (assert (hasType myInt int)) (declare-const $$__term_id_10 Term) (assert (hasType $$__term_id_10 string)) (assert (sameType myInt $$__term_id_10)) (assert (hasType myInt string)) The model is unsatisfiable. Assertions on the lines 4-6 restrict type of myInt to integer, whereas assertions on the lines 9-11 ensure that the same variable should be of type string. These assertions cannot be evaluated to be true in the same model, considering the initial theorems of the type checker model. Therefore, the overall model is going to be unsatisfiable upon calling the check-sat Z3 command. 5.2 A satisfiable model In case everything in the program code is correct in terms of type consistency, the type checker should evaluate the resulting SMT model as satisfiable. It also should ignore cases that have not being processed properly yet, without giving any false positives on any inconsistency. The program listed below has, in fact, an inconsistency in types usage. The line 8 reassigns a variable to be of type integer, whereas at the line 5 the same variable was introduced as a variable of type string. However, as long as this assignment include a statement with a dynamic key, the type checker ignores it. The reason for this is inability to determine which variable this variable path will point to at the moment of execution. 10 https://github.com/jolie/examples 8 Daniel de Carvalho et al. main { key = "cat"; animals.cat = "I am a cat"; animals.(key) = 13 } The resulting set of SMT theorems is listed below. (declare-const key Term) (declare-const $$__term_id_4 Term) (assert (hasType $$__term_id_4 string)) (assert (sameType key $$__term_id_4)) (assert (hasType key string)) (declare-const $$__term_id_5 Term) (declare-const animals Term) (declare-const animals.cat Term) (declare-const $$__term_id_10 Term) (assert (hasType $$__term_id_10 string)) (assert (sameType animals.cat $$__term_id_10)) (assert (hasType animals.cat string)) (declare-const $$__term_id_11 Term) (declare-const animals.DYNAMIC_PATH_$$__term_id_14 Term) (declare-const $$__term_id_19 Term) (assert (hasType $$__term_id_19 int)) (assert (sameType animals.DYNAMIC_PATH_$$__term_id_14 $$__term_id_19)) (assert (hasType animals.DYNAMIC_PATH_$$__term_id_14 int)) The workaround for the dynamic keys issue can be seen at Lines 20 and 21. Any time a variable is used in order to construct another variable path, the whole Term is getting a unique identifier marked with the DYNAMIC PATH substring. This way it will not interfere with any other theorem, thus not affecting the overall model satisfiability. 6 Conclusions and future works Jolie is the first programming language specifically oriented to the microservice architecture. It has been shown how software attributes such as extensibility, modifiability and consistency can significantly benefit from a migration into the microservice paradigm [10,11]. Projects run by our team demonstrated the efficacy of the paradigm and of the Jolie programming language in the field of ambient intelligence and smart buildings [31,30]. Social networks implementation would also benefit from a reorganization of the software architecture [19]. Local projects, and beyond that a number of projects worldwide involving the use of Jolie, would immensely benefit from a fully stable implementation of the Jolie Static Type Checker. Static type checking allows compilers to identify certain programming mistakes (that violate types) at compile time, i.e. before actually running the program. Therefore a vast number of trivial bugs can be caught and fixed at a very early stage of the software lifecycle. In this paper we described JSTC, a static type checker for the Jolie programming language which natively supports microservices. A static type system for the language has been exhaustively and formally defined on paper, but so far still lacked an implementation. We introduced our ongoing work on a static type checker and presented some details of the implementation. The type checker prototype, at the moment, consists of a set of rules for the type system expressed in SMT Lib language. The actual implementation covers operations such as assignments, logical statements, conditions, literals and comparisons. Jolie Static Type Checker: a prototype 9 JSTC is already able to validate programs, as it has been shown in this paper. However, it works with certain assumptions. The main assumption is that programs do not contain implicit type casts. The Jolie language allows implicit type casts, however, their behavior is very complex. Handling such situations is an open issue left for future development and future versions. Two other major issues have not been addressed. Variable types can be changed at runtime. This strictly depends on the approach that has been chosen. Generally, static typing guarantees that a variable has a type that cannot be changed after declaration or assignment. However, Jolie allows this operation. We need to determine which behavior we expect from the type checker, thus deciding how to process type changes. Implicit type casts in Jolie are ambiguous. This is a major problem, and further research is required in order to find a solution. While Jolie allows implicit type casts, sometimes the result of a cast is not obvious. For example, casting a negative Integer to Boolean will result in a False. This is an unexpected behavior when compared to other programming languages. There may be a solid rationale for this, however, we need to investigate all cases and make sure that the type checker works accordingly to the Jolie actual behavior, and not to the expected one. JSTC future releases will need to be validated in real-life applications. The plan is to use the Jolie programming language and the type checker as a basis for the development of future research projects, the same way was done in [31] and [30]. Potential application scenarios are cognitive architecture [33], automotive systems [13] and smart houses [16]. References 1. F*. https://www.fstar-lang.org/. 2. WS-BPEL OASIS Web Services Business Process Execution Language. accessed April 2016. http://docs.oasis-open.org/wsbpel/2.0/wsbpel-specification-draft.html. 3. Evgenii Akentev, Alexander Tchitchigin, Larisa Safina, and Manuel Mazzara. Verified typechecker for jolie. https://arxiv.org/pdf/1703.05186.pdf. 4. Alexey Bandura, Nikita Kurilenko, Manuel Mazzara, Victor Rivera, Larisa Safina, and Alexander Tchitchigin. Jolie community on the rise. In 9th IEEE International Conference on ServiceOriented Computing and Applications, SOCA, 2016. 5. Clark Barrett, Aaron Stump, and Cesare Tinelli. The SMT-LIB Standard. Version 2.0 , 2010. 6. Hoare C.A.R. An axiomatic basis for computer programming. Communications of the ACM, 12:576–583, 1969. 7. Luca Cardelli. Type systems. ACM Comput. Surv., 28(1):263–264, 1996. 8. Manuel Mazzara Fabrizio Montesi Claudio Guidi, Ivan Lanese. Microservices: a language-based approach. In Present and Ulterior Software Engineering. Springer, 2017. 9. Leonardo de Moura and Nikolaj Bjrner. Z3: An efficient smt solver. In Tools and Algorithms for the Construction and Analysis of Systems, 14th International Conference, TACAS 2008, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2008, Budapest, Hungary, March 29-April 6, 2008. Proceedings, volume 4963 of Lecture Notes in Computer Science, pages 337–340. Springer, 2008. 10. N. Dragoni, I. Lanese, S. T. Larsen, M. Mazzara, R. Mustafin, and L. Safina. Microservices: How to make your application scale. In A.P. Ershov Informatics Conference (the PSI Conference Series, 11th edition). Springer, 2017. 11. Nicola Dragoni, Schahram Dustdar, Stephan T. Larse, and Manuel Mazzara. Microservices: Migration of a mission critical system. https://arxiv.org/abs/1704.04173. 12. Nicola Dragoni, Saverio Giallorenzo, Alberto Lluch-Lafuente, Manuel Mazzara, Fabrizio Montesi, Ruslan Mustafin, and Larisa Safina. Microservices: yesterday, today, and tomorrow. In Bertrand Meyer and Manuel Mazzara, editors, Present and Ulterior Software Engineering. Springer, 2017. 13. Rainer Gmehlich, Katrin Grau, Felix Loesch, Alexei Iliasov, Michael Jackson, and Manuel Mazzara. Towards a formalism-based toolkit for automotive applications. 2013 1st FME Workshop on Formal Methods in Software Engineering (FormaliSE), pages 36–42. 14. Ranjit Jhala. Liquid Haskell. http://goto.ucsd.edu/~rjhala/liquid/haskell/blog/about/. 10 Daniel de Carvalho et al. 15. M.C. MacKenzie et al. Reference model for service oriented architecture 1.0. OASIS Standard, 12, 2006. 16. Ilaria Baroni Marco Nalin and Manuel Mazzara. A holistic infrastructure to support elderlies’ independent living. Encyclopedia of E-Health and Telemedicine, IGI Global, 2016. 17. M. Mazzara, F. Abouzaid, N. Dragoni, and A. Bhattacharyya. Design, modelling and analysis of a workflow reconfiguration. In Proceedings of the International Workshop on Petri Nets and Software Engineering, Newcastle upon Tyne, UK, June 20-21, 2011, pages 10–24, 2011. 18. Manuel Mazzara. Towards Abstractions for Web Services Composition. Ph.D. thesis, University of Bologna, 2006. 19. Manuel Mazzara, Luca Biselli, Pier Paolo Greco, Nicola Dragoni, Antonio Marraffa, Nafees Qamar, and Simona de Nicola. Social networks and collective intelligence: a return to the agora. IGI Global, 2013. 20. Manuel Mazzara, Ruslan Mustafin, Larisa Safina, and Ivan Lanese. Towards microservices and beyond: An incoming paradigm shift in distributed computing. https://arxiv.org/pdf/1610. 01778.pdf. 21. Robin Milner. Communication and concurrency. Prentice Hall International (UK) Ltd., 1995. 22. Robin Milner. Communicating and Mobile Systems: The &Pgr;-calculus. Cambridge University Press, New York, NY, USA, 1999. 23. Fabrizio Montesi, Claudio Guidi, and Gianluigi Zavattaro. Service-Oriented Programming with Jolie. In Web Services Foundations, pages 81–107. Springer, 2014. 24. S. Newman. Building microservices. O’Reilly Media, Inc., 2015. 25. Julie Meinicke Nielsen. A Type System for the Jolie Language. Master’s thesis, Technical University of Denmark, 2013. 26. Chalmers University of Technology. Accessed December 2016. Agda. http://wiki.portal. chalmers.se/agda/pmwiki.php. 27. Henry Gordon Rice. Classes of recursively enumerable sets and their decision problems. Trans. Amer. Math. Soc., 74:358–366, 1953. 28. Patrick M. Rondon, Ming Kawaguci, and Ranjit Jhala. Liquid types. SIGPLAN Not., 43(6):159– 169, June 2008. 29. Larisa Safina, Manuel Mazzara, Fabrizio Montesi, and Victor Rivera. Data-driven workflows for microservices (genericity in jolie). In Proc. of The 30th IEEE International Conference on Advanced Information Networking and Applications (AINA), 2016. 30. Dilshat Salikhov, Kevin Khanda, Kamill Gusmanov, Manuel Mazzara, and Nikolaos Mavridis. Jolie good buildings: Internet of things for smart building infrastructure supporting concurrent apps utilizing distributed microservices. In Proceedings of the 1st International conference on Convergent Cognitive Information Technologies, pages 48–53, 2016. 31. Dilshat Salikhov, Kevin Khanda, Kamill Gusmanov, Manuel Mazzara, and Nikolaos Mavridis. Microservice-based iot for smart buildings. In Proceedings of the 31st International Conference on Advanced Information Networking and Applications Workshops (WAINA), 2017. 32. Alexander Tchitchigin, Larisa Safina, Manuel Mazzara, Mohamed Elwakil, Fabrizio Montesi, and Victor Rivera. Refinement types in jolie. In Spring/Summer Young Researchers Colloquium on Software Engineering, SYRCoSE, 2016. 33. Jordi Vallverdú, Max Talanov, Salvatore Distefano, Manuel Mazzara, Alexander Tchitchigin, and Ildar Nurgaliev. A cognitive architecture for the implementation of emotions in computing systems. Biologically Inspired Cognitive Architectures, 15(Supplement C):34 – 40, 2016.
6cs.PL
1 Unmixing urban hyperspectral imagery with a Gaussian mixture model on endmember variability arXiv:1801.08513v1 [cs.CV] 25 Jan 2018 Yuan Zhou, Student Member, IEEE, Erin B. Wetherley, and Paul D. Gader, Fellow, IEEE Abstract—Spectral unmixing given a library of endmember spectra can be achieved by multiple endmember spectral mixture analysis (MESMA), which tries to find the optimal combination of endmember spectra for each pixel by iteratively examining each endmember combination. However, as library size grows, computational complexity increases which often necessitates a laborious and heuristic library reduction method. In this paper, we model a pixel as a linear combination of endmembers sampled from probability distributions of Gaussian mixture models (GMM). The parameters of the GMM distributions are estimated using spectral libraries. Abundances are estimated based on the distribution parameters. The advantage of this algorithm is that the model size grows very slowly as a function of the library size. To validate this method, we used data collected by the AVIRIS sensor over the Santa Barbara region: two 16 m spatial resolution and two 4 m spatial resolution images. 64 validated regions of interest (ROI) (180 m by 180 m) were used to assess estimate accuracy. Ground truth was obtained using 1 m images leading to the following 6 classes: turfgrass, non-photosynthetic vegetation (NPV), paved, roof, soil, and tree. Spectral libraries were built by manually identifying and extracting pure spectra from both resolution images, resulting in 3,287 spectra at 16 m and 15,426 spectra at 4 m. We then unmixed ROIs of each resolution using the following unmixing algorithms: the setbased algorithms MESMA and AAM, and the distribution-based algorithms GMM, NCM, and BCM. The original libraries were used for the distribution-based algorithms whereas set-based methods required a sophisticated reduction method, resulting in reduced libraries of 61 spectra at 16 m and 95 spectra at 4 m. The results show that GMM performs best among the distributionbased methods, producing comparable accuracy to MESMA, and may be more robust across datasets. Index Terms—spectral unmixing, endmember variability, Gaussian mixture model, MESMA, hyperspectral image analysis I. I NTRODUCTION YPERSPECTRAL images have important applications in astronomy, agriculture, geoscience, surveillance (such as object identification), material identification, and detecting processes [1]. Because limited photons enter the sensor when collecting narrow bandwidth channels from a high altitude, the spatial resolution of hyperspectral image is usually very coarse, i.e. a pixel may correspond to a region with a diameter H Y. Zhou and P. D. Gader are with the Department of Computer and Information Science and Engineering, University of Florida, Gainesville, FL, USA. E-mail: yuan,[email protected]. E. B. Wetherley is with the Department of Geography, University of California Santa Barbara, Santa Barbara, CA, USA. E-mail: [email protected]. of several meters. Hence, multiple materials may exist in this region and contribute to the measured pixel spectrum, also known as a mixed pixel [2]. One important problem in hyperspectral imagery is to decompose mixed pixels to identify the constituting materials (endmember) and their proportions (abundance) that form the pixel spectrum. The most common model that relates endmembers and abundances to a pixel is the linear mixing model (LMM), which assumes that the reflectance measured within each pixel is a unique linear combination of the reflectances of each subpixel endmember, weighted by its abundance, plus some noise [3]. The intuition behind this model is that the fractional area of a material determines its representation in the measured signal. However, when unmixing a hyperspectral image with LMM, we usually encounter an additional problem that spectral reflectance for identical materials are often different. For example, asphalt spectra can vary significantly based on age, shadowing, and composite materials [4]. This is sometimes called endmember variability [5], [6]. Several factors can contribute to endmember variability, including both extrinsic factors and intrinsic factors. The most significant extrinsic factor is illumination. When solar incidence and emergence angles are different for a surface, the observed signal will be different [7]. Material angle matters as well, for example roofs can be present at a variety of angles relative to incoming solar radiation, producing different spectral signatures for one material. Atmospheric condition can be another extrinsic factor affecting reflectance, however this is usually corrected during image processing. Measurement scale represents an important intrinsic factor. Objects or materials that may be considered “pure” may in reality be composed of materials at smaller scales with varying reflectances [8]. For example, a tree canopy can be considered a single, pure endmember, however this ignores the spectral variety of tree leaves, bark, branches, and substrate that composes a single tree pixel [9]. Similarly, soils are composed of particles with different shapes, sizes, and chemical composition [6]. The larger scale we use to define an endmember, the larger intrinsic variability we may expect from its spectra. For example, trees and turfgrass can be defined as individual endmembers, however if we we wish to define a class of green vegetation comprised of both turfgrass and tree, its variability will not be less than the component endmember. Considering endmember variability, we can generalize the LMM to the following equation: 0000–0000/00$00.00 c 2018 IEEE 2 yn = M X mnj αnj + nn , n = 1, . . . , N (1) j=1 where yn ∈ RB is the spectrum of the nth pixel in the image, B is the number of bands, N is the number of pixels, M is the number of endmembers. mnj ∈ RB is the jth endmember for the nth pixel. αnj ∈ R is the abundance that usually satisfies the positivity and sum-to-one constraints, i.e. P αnj ≥ 0, j αnj = 1. Finally, we have some additive noise nn . When it comes to unmixing in terms of (1), we are referring to retrieving {mnj , αnj } from {yn }, or {αnj } from {yn } and a library of endmember spectra. The former is sometimes called unsupervised unmixing, and because it is undetermined this can be a difficult problem. Studies that have worked to solve unsupervised unmixing usually require several assumptions, such as spatial smoothness of the abundances and the existence of contiguous pure pixels [10], [11], [12]. The latter is called supervised unmixing and depends on a library of known endmember spectra. If the library is small enough to easily enumerate all possible spectral combinations, the task can be trivial. However, applying this scheme on larger libraries becomes computationally inefficient. This is the problem we are addressing in this study. Previous studies that have worked to solve this problem have used methods that can be categorized as set-based or distribution-based [5]. Set-based methods treat the endmember library as an unordered set and try to pick the best combination of endmembers to model each pixel. A widely used setbased method is multiple endmember spectral mixture analysis (MESMA) [13]. The general idea of MESMA is to test every endmember combination and select the one with the smallest error within set thresholds that limit pixel complexity. There are many variations to MESMA. In multipleendmember linear spectral unmixing model (MELSUM), the solution for abundances is obtained from directly solving the linear equations and discarding the negative values [14]. In automatic Monte Carlo unmixing (AutoMCU), pixels are unmixed using multiple sets of random combinations, with the mean fractional values assigned as abundances [15], [16]. In alternate angle minimization (AAM), projection is iteratively used to find the spectrum index of one endmember given the other endmembers fixed. Besides MESMA variants, there is sparse unmixing that used the full spectral library with a sparsity constraint on the abundances forcing them having only a few nonzero elements [17]. Contrary to set-based methods, distribution-based methods assume that the endmembers for each pixel are sampled from probability distributions, hence the linear combinations of these endmembers (pixels) also follow some distribution. It works by modeling the spectral library as statistical distributions, extracting parameters to describe these distributions, and unmixing the pixels based on the distribution parameters. The most widely used distribution is Gaussian, and its application for spectral unmixing is known as the normal compositional model (NCM) [18], [19], [10], [20], [21], [22]. The popularity of NCM comes from the fact that a linear combination of Gaussian random variables is also a Gaussian random variable whose mean and covariance matrix are linear combinations from the endmember means and covariance matrices. Hence, the resulting probability density function of the pixels has a simple analytical form. Fitting the actual pixel values to the pixel distribution, the abundances can be solved by several techniques, such as expectation maximization [20], sampling methods [18], [19], [10], and particle swarm optimization [22]. Following this philosophy, some have worked to extend the idea to distributions beyond Gaussian. In [23], the authors propose Beta distributions to model the spectral library. The benefit is that Beta distributions have a domain in the range 0 – 1, so are more suitable for the reflectance range, and the actual library may have a skewed mode in the distribution. In [24], [12], the idea is further extended to use Gaussian mixture models (GMM) for distributions. The rationale comes from the observation that library endmembers may have multiple modes, whose shape cannot be represented by a simple Gaussian or Beta distribution. Since GMM is more flexible, it can approximate any distribution found in the library. A. Our contribution Many unmixing studies are not well evaluated in presence of ground truth. Commonly used hyperspectral datasets include Pavia University, Indian Pines, Cuprite, Mississippi Gulfport, etc., which are not validated with ground truth endmembers and abundances. Hence, the primary method for evaluating their results include: 1) Compare the estimated endmembers with spectra in the USGS spectra library (e.g. in Cuprite dataset) [25], [26]. 2) Compare the estimated abundances with assumed segmentation maps of pure materials (e.g. in Indian Pines, Pavia University, Gulfport datasets) [21], [27]. 3) Calculate the reconstruction error of estimated endmembers and abundances and assume that a lower reconstruction error implies a better result [10], [11]. Each of these methods can be problematic. First, different conditions (sensor, atmosphere, light source) during data collection will affect measured reflectances, making library comparison less ideal. Second, high spatial resolution hyperspectral images are primarily composed of pure pixels, and segmentation like abundance maps do not necessarily indicate good unmixing capability for mixed pixels. Third, reconstruction error is more related to model complexity than unmixing accuracy since small reconstruction error could be achieved by overfitting [28]. Moreover, these datasets are not comprehensive with respect to spatial scales, scene diversity and generalization. For example, the Pavia University and Gulfport datasets have about 1 m spatial resolution in which most are pure pixels. Also, they are focused on only a few urban sites, which contain mostly manmade materials with segmentation like abundance distribution. Developing unmixing algorithms on them will have a bias on forcing smooth and sparse abundance maps. Hence, it is unknown if the algorithms validated on these datasets can be applied to datasets with generalized scenarios. 3 In this work, we introduce a supervised unmixing algorithm based on modeling endmember variability by GMM distributions, and compare several set-based and distribution-based algorithms with a highly validated, comprehensive dataset of 128 images with different spatial scales. The algorithm was first introduced in [12], [24] and we modified it for this application. The dataset was developed in [29] but only used for evaluating MESMA. It contains two types of images, one with about 16 m pixel size, the other with about 4 m pixel size. It covers a wide range of landcover, including various kinds of road, roof, vegetation, and soil. Validation abundances were obtained by classifying high resolution images corresponding to the hyperspectral images. Unlike MESMA, which requires a small and well-curated spectral library, the GMM algorithm uses the original source library without modification to unmix fractions using inferred parameters from the library. II. DATASET We used two low-resolution images (16 m) and two highresolution images (4 m) in this study. The low-resolution images were collected by the Airborne Visible/Infrared Imaging Spectrometer (AVIRIS) [1] over Santa Barbara, CA, on August 29, 2014. The spatial resolutions are 15.6 m/pixel and 15.8 m/pixel. The spectral range measures wavelengths from 380 – 2500 nm with 224 bands of approximately 10 nm bandwidth. High-resolution images were collected by AVIRISNext Generation with 3.9 m/pixel and 3.6 m/pixel spatial resolutions. The spectral resolution is also higher, recording 432 bands of about 5 - 6 nm bandwidth across a similar spectral range as the 16 m dataset. We spectrally resampled the AVIRIS-Next Generation imagery to 224 bands to produce an image with identical spectral parameters to the 16 m AVIRIS image. We also removed certain bands from analysis due to atmospheric interference, reducing the number of bands to 164. Initial image processing was conducted by the Jet Propulsion Laboratory, with additional processing in the lab to reduce the effects of elevation change on pixel location. The study area includes the cities of Santa Barbara and Goleta as well as the land between them, near the California coast. Urban composition is typical of the southwestern United States, including man-made materials such as asphalt, concrete, metal, gravel, and brick, as well as vegetation in the forms of turfgrass, various tree species, and large areas of undeveloped land covered in senesced vegetation [30]. A. Validation Polygons We produced 64 polygons that represented the variety of landcover within the study area. Each polygon was 180 m by 180 m in size, or 11-12 pixels wide in the 16 m images (46 or 50 pixels wide in the 4 m images). Validation polygons were randomly distributed across the area with a minimum distance 400 m. If a polygon contained large areas of open water or an undetermined material, it was discarded and a new polygon randomly generated. Cover was determined within each polygon using a 1 m NAIP high-resolution image. We used a combination of image segmentation, using ECognition, and manual adjustments to classify the cover within each Table I N UMBER OF SPECTRA FOR EACH ENDMEMBER CLASS IN THE LIBRARIES Turfgrass NPV Paved Roof Soil Tree Total Full 537 884 299 435 262 870 3287 16 m Reduced 10 14 6 17 3 11 61 Full 1468 3465 2902 2941 1442 3208 15426 4m Reduced 5 7 17 16 5 45 95 polygon as turf, tree, paved, roof, soil, or non-photosynthetic vegetation (NPV). Cover was further confirmed by visually inspecting August 2014 Google Earth imagery. Fig 1 displays all polygons as they appear in the 16 m images. Fig. 2 shows a scatter plot of the 64 ground truth abundances when the 6 endmember classes are merged to 3 categories of vegetation, impervious, and non-vegetated pervious. Most polygons are dominated by a mixture of impervious and vegetation materials. To improve the representation of less common mixtures in the scene, we added 5 polygons with high proportions of soil. B. Library Building We produced 240 polygons across the 4 m scene to extract pure spectra and build the full spectral libraries. The polygons were intended to capture class material variability as much as possible, and so included multiple roof types, asphalt, concrete, trees, turfgrass, soil, and NPV, as well as less common materials like rubber, solar panels, tennis courts, and plastic tarps. These materials were then grouped into one of our 6 endmember classes: turfgrass, NPV, paved, roof, soil, and tree. The same polygons were used to extract spectra from the 16 m imagery, with necessary modifications as described in [29]. Together, we produced a library of 16 m spectra and a library of 4 m spectra. After removing duplicate spectra, the final 16 m library was comprised of 3,287 spectra and the 4 m library contained 15,426 spectra. These full spectral libraries were used to train the parameters of distribution-based algorithms. However, they were too large to be used by MESMA, and required reduction. We performed reduction in two steps. First, iterative endmember selection (IES) [31] was used to automatically select a subset of spectra that represented the larger library. This is achieved iteratively, by gradually selecting the most representative spectra and evaluating their representativeness using a kappa coefficient. IES reduced the 16 m and 4 m library sizes to 226 and 187, respectively. Libraries were further reduced using iterative classification reduction (ICR), which uses MESMA as a classifier to quickly identify and remove spectra that tend to map materials incorrectly [29]. This reduced the libraries to a final size of 61 for 16 m images and 95 for 4 m images. The spectra for each endmember class for all the cases are plotted in Fig 3, and their numbers are shown in Table I. 4 Figure 1. Validation polygons on the site (a) and all 4 m ROI images (b). The two 16 m images are mosaicked by geographic coordinates. each has numerous spectra in the library. A pixel can be assumed to be generated by randomly picking one spectrum for each endmember, and linearly mixing them based on some abundances. In this way, if we use a probability density function to represent the spectral distribution, the actual endmembers can be assumed to be sampled from this distribution. Suppose the jth endmember for the nth pixel is sampled from a distribution modeled by GMM p (mnj |Θ) = Kj X  πjk N mnj |µjk , Σjk , k=1  Figure 2. Scatter plot of ground truth total abundances in terms of 3 categories, green vegetation (turfgrass and tree), pervious (NPV and soil), and impervious (paved and roof). Most of them lie on the plane, which corresponds with the selection of ROIs where almost all the pixels fall into the 6 endmember classes. III. M ETHOD A. The Gaussian Mixture Model for Unmixing Here we briefly introduce the GMM based unmixing [12], which is a generative model that models a distribution on the input space [32]. Suppose we have M endmember classes, where Θ := πjk , µjk , Σjk : j = 1, . . . , M, k = 1, . . . , Kj are the GMM parameters. Allowing GMM to represent the library, we can get multiple Gaussian components for each endmember. Take the dataset in Section II as an example, which can be viewed from two perspectives. Fig. 4 shows the pixels from all the validation ROIs, library endmembers, and corresponding Gaussian components when projected to 2 dimensions. The method for estimating GMM parameters will be discussed later, however we can see that the ellipses formed by these parameters surround validation pixels at multiple positions on the edge of the pixel cloud. The pixels can be viewed as picking points within ellipses and combining these points linearly. Fig. 5 shows the Gaussian components from 5 Figure 3. Original and reduced spectral libraries. The numbers of spectra in each category are shown in Table I. the wavelength-reflectance perspective, where the centers of Gaussian components and their variation patterns are shown as curves. Compared to MESMA, which evaluates every spectrum in the library, GMM tries to combine every center of Gaussian components, but allows the center to move according to its corresponding variation pattern. Following the distribution assumption, if {mnj : j = 1, . . . , M } are independent and the noise is also sampled from a Gaussian p (nn ) = N (nn |0, D), then P yn = j mnj αnj + nn implies that the pixel follows a distribution X p (yn |αn , Θ, D) = πk N (yn |µnk , Σnk ) , If we assume each pixel is independently sampled, the probability density function of all the pixels is the product as p (Y|A, Θ, D) = N Y p (yn |αn , Θ, D) , n=1 T where A := [α1 , . . . , αN ] ∈ RN ×M . Given Y, Θ, D, the abundances A can be estimated by maximum likelihood estimation (MLE). Specifically, we want to maximize p (Y|A, Θ, D), or minimize − log p (Y|A, Θ, D), which becomes the following optimization problem by combining the above equations k∈K where K := {1, . . . , K1 } × {1, . . . , K2 } × · · · × {1, . . . , KM } is the Cartesian product of the M index sets, k = (k1 , . . . , kM ) ∈ K, πk ∈ R, µnk ∈ RB , Σnk ∈ RB×B are defined by E (A) = − N X n=1 log X πk N (yn |µnk , Σnk ) , k∈K s.t. αnj ≥ 0, M X αnj = 1, ∀n. j=1 πk = M Y j=1 πjkj , µnk = M X j=1 αnj µjkj , Σnk = M X j=1 2 αnj Σjkj +D. The objective function can be minimized by a generalized expectation maximization (EM) algorithm, which alternates 6 Figure 4. Scatter plot of GMM components on the pixels and library spectra. The projection is determined by performing PCA on all the spectra in the library. The pixels of 64 images for each scale are combined and denoted by gray dots. The colored dots show the spectra in the library for each endmember class. The ellipses denote the Gaussian components. Figure 5. Wavelength-reflectance plot of GMM components on the library spectra. The spectra are put into 2-dimensional bins of wavelength-reflectance to form a histogram shown as gray scale background images. The center of each Gaussian component is shown as solid curve. The center plus (minus) twice the square root of the largest eigenvalue with its corresponding eigenvector is shown as a dashed curve, which indicates the major variation pattern of a Gaussian component. The prior probabilities are shown in the legends. 7 between an E step and an M step [33]. The E step calculates the posterior probability of the latent variable given the observed data and old parameters. The M step increases the expected value of the complete data log-likelihood. In our case, the E step calculates πk N (yn |µnk , Σnk ) . k∈K πk N (yn |µnk , Σnk ) γnk = P (2) The M step tries to minimize EM = − N X X γnk {log πk + log N (yn |µnk , Σnk )} . LKj out of all the candidates. To avoid many components, we tried Kj = 1, 2, 3, 4. This approach can serve as an ideal modelQ selection. However, the number of combinations |K| = j Kj can still be very large, especially in real datasets where the libraries contain many spectra. Hence, we use a threshold TCV IC to further reduce Kj manually. Let L0j be the maximum CVIC for the jth endmember; we pick the smallest Kj such that LKj − L0j ≤ TCV IC L0j . Hence when TCV IC = 0, we have the ideal CVIC-based model selection. As TCV IC increases, we can have a reduced number of components. n=1 k∈K It does not have a closed form solution for A. But we can use gradient descent to minimize EM , where the derivative can be calculated by C. Projection Analyzing the computation in Section III-A, we see that  the time complexity is O |K| N B 3 [12]. In addition to the number of combinations, the number of bands is also crucial X X ∂EM T T =− Λk Rk − 2A ◦ Ψk Sk , (3) to execution time. We can reduce the time cost by reducing ∂A the dimensionality of the data. k∈K k∈K We use PCA to reduce the dimensionality, which gives a 2 where Rk ∈ RM ×B , Sk ∈ RM ×B are defined by center c ∈ RB and a projection matrix E ∈ RB×d such that  T all the spectra are processed as ET (y − c). Note that (1) still Rk = µ1k1 , µ2k2 , . . . , µM kM , holds if both the pixel spectra and endmember spectra are T projected in this way. Hence the estimated abundances for the Sk = [vec (Σ1k1 ) , vec (Σ2k2 ) , . . . , vec (ΣM kM )] , projected spectra are the original abundances for the data. Also 2 and Λk ∈ RN ×B , Ψk ∈ RN ×B denote note that if an endmember follows a GMM distribution, the T projected endmember also follows a GMM distribution. So we Λk = [λ1k , λ2k , . . . , λN k ] , can directly estimate the GMM parameters from the projected T Ψk = [vec (Ψ1k ) , vec (Ψ2k ) , . . . , vec (ΨN k )] , library spectra. As for the data input to find this projection, there are two B×1 B×B where λnk ∈ R and Ψnk ∈ R are possibilities. One is to use all the pixel data. This works if the image is big enough, such that all the endmembers λnk = γnk Σ−1 nk (yn − µnk ) , have sufficient presence. However, if the image contains fewer 1 1 T −T −T −T pixels (e.g. in the 16 m dataset) with limited endmembers, the Ψnk = γnk Σnk (yn − µnk ) (yn − µnk ) Σnk − γnk Σnk . 2 2 directions determined by PCA will present the variation within Given an initial A, we can update γnk and A alternately until the image, which may not distinguish different endmembers. convergence, which leads to a local minimum of the objective The other method is to use the spectral library, i.e. combine function. This algorithm requires several clarifications and we all the spectra in the library and perform PCA on them. We adopted this method for our dataset. Specifically, we selected will explain them in the following subsections. an equal number of spectra for each endmember class in the library and concatenated them. This ensures that the relative B. Determining the GMM Parameters sizes of endmember classes do not affect the direction, and we have a library of endmember spectra  Suppose also ensures that the mean lies in the center. Yj ∈ RNj ×B : j = 1, . . . , M , with which we can estimate the GMM parameters Θ. The difficulty comes from estimating the number of components Kj for each endmember, as once D. The Algorithm The implementation of the algorithm is described in Algowe know Kj , πjk , µjk , Σjk can be estimated by the standard EM algorithm. Estimating this Kj is sometimes called rithm 1. In step 1, the spectra in the library are concatenated model selection and has several approaches [34]. We will use to form an input to PCA. We project the data to 10 dimensions cross-validation-based information criterion (CVIC) [35] as in step 2. Step 3 is elaborated in Section III-B. Step 4 involves initialization of A, which utilizes the information our metric to select Kj . To be Given a candidate Kj , we can evaluate CVIC in the follow- of multiple means from the Gaussian components. −1 Rk yn , project ing way. Let Yj be the spectra for the jth endmember in the specific, we set αnk ← Rk RTk + IM library, we can divide them into V = 5 subsets with equal size. αnk onto the simplex space, and initialize αn ← αnk̂ where For each subset Yjv , the remaining spectra are input to a MLE k̂ = arg mink kyn − RTk αnk k2 . Step 5 is the main body, in with Kj Gaussian components, and the trained parameters are which the M step is the most complicated part. Because of used to evaluate the log-likelihood of Yjv . Then the sum of the constraints on αn , we use projected gradient descent here. all these log-likelihood values is calculated as LKj , which is The projection function can be found in [36], [37]. The step our CVIC. Finally, the optimal Kj is the one that maximizes size τ can be set adaptively by using a small initial value 8 Algorithm 1 Spectral unmixing with GMM T Input: Y = [y1 , ..., yN ] , {Lj : j = 1, . . . , M }, TCV IC . 1) Determine the projection matrix by PCA. 2) Project the pixels and the spectra in the library to a low dimensional subspace. 3) Estimate the numbers of components {Kj } using CVIC and estimate the GMM parameters Θ using standard EM. 4) Initialize A by choosing the αnk that minimizes the reconstruction error. 5) Alternately update the E step and M step until convergence. • E step: update γnk by (2).  ∂EM M where ∂E • M step: update A by φ A − τ ∂A ∂A is defined in (3), τ is some step size, φ is the projection function to the simplex space. Output: A. and gradually increasing it by a multiplier of 10 as long as the objective function keeps decreasing. Since the covariance matrix from endmember variability is usually much larger than the noise covariance, the latter can be negligible in the computation and we use D = 0.0012 IB . IV. R ESULTS A. Setup We ran GMM on the 16 m and 4 m images after training it using the same resolution spectral libraries. Since GMM takes spectral libraries to estimate the Gaussian components, we used the same components on all 64 images. For reproducibility, we ran model selection of GMM 15 times, selected the most frequent combination, and applied it to the dataset. For comparison, we ran 2 set-based methods and 4 distribution-based methods: 1) MESMA [13]. It was implemented in IDL by the original authors and provided as an extension Viper Tool to ENVI. We used the same parameters as in [29], i.e. maximum RMSE 2.5%, threshold RMSE 0.7%, abundances constrained between 0 and 1, maximum shade threshold 80%, and a maximum of three endmembers plus shade for each pixel. Also, it will not allow multiple spectra from one endmember class in the mixture. The obtained fractions were normalized to give the final abundances. 2) Alternate angle minimization (AAM) [38]. Its code was implemented in Matlab and downloaded from Rob Heylen’s website. It tries every subset of endmembers, iteratively updates the spectrum index of each endmember such that the reconstruction error is minimized given the rest selected spectra, and hence finds the best combination and abundances. Since it uses projection to find the combination, theoretically it should work faster. It is different from MESMA in several ways. First, it may not find the global minimum because of its alternate optimization. Second, it may find a pixel mixed by many endmembers instead of maximum three. Finally, it does not include a shade endmember to adjust for brightness differences between endmember and measured spectra. 3) Gaussian mixture model (GMM). We used TCV IC = 0.05 for the 16 m dataset, which produced 216 combinations from the library. Because the 4 m dataset was about 20 times larger, and the number of spectra in the library was 3 times larger, we used a larger TCV IC = 0.2 (18 combinations) such that the whole process could still run in a few hours. 4) GMM-1. We set the number of combinations to be 1, i.e. one component for each endmember, which makes it to be NCM theoretically. However, it has the same implementation of GMM hence reflects the difference introduced by bringing multiple components. 5) Normal compositional model with sampling optimization (NCM Sampling). There are many variations of NCM, with different optimization approaches [18], [19], [10], [20], [21], [22]. We chose the sampling strategy in [39] which does not assume statistical independence between different bands. 6) Beta compositional model (BCM) [23]. It is available from Alina Zare’s website. Assuming the independence of bands, it uses Beta distribution to model each band and unmixes the pixels. Excluding MESMA, which was implemented in IDL, all methods were implemented in Matlab. MESMA was run on a PC with Intel Core i7-2760QM CPU and 8 GB memory. The other methods were run on a PC with Intel Core i7-3820 CPU and 64 GB memory. For distribution-based methods, the original libraries were input to train the parameters for unmixing while set-based methods used the reduced libraries. We used two metrics to measure the differences between the estimated and ground truth fractions: mean absolute difference (MAD) and correlation coefficient (R). They were calculated for each endmember class based on the 64 pairs of values. To visualize the values, we used a variation of the Bland-Altman plot where the x-axis is the ground truth value and the yaxis is the estimated minus the ground truth value [40]. When comparing different algorithms for unmixing quality, we will mainly resort to MAD as correlation coefficient itself is not sufficient (slope and intercept are needed to accompany R). B. Accuracy and Efficiency 16 m Case. Table II shows the MAD and correlation coefficient for the 16 m images. Original errors for 6 classes implies that GMM and AAM have the best accuracy, followed by MESMA. The difference comes from the paved, roof and tree classes, where GMM outperformed MESMA. In general, MESMA, AAM, GMM and GMM-1 had similar accuracy. Comparing all the distribution-based methods with same input, GMM has the best performance overall, with fewest errors for NPV, paved and roof. Merged errors show that GMM and AAM retain their higher accuracy, with MESMA falling further behind due to poor impervious accuracy. Since merged errors are differences between summed up quantities of similar materials, such as paved and roof, if the errors are enlarged compared to 9 individual errors, it means that both of the similar materials are overestimated or underestimated, i.e. the algorithm tends for confuse even dissimilar materials, such as pervious and impervious. Fig. 6 compares the estimated total abundances to validated abundances for each material. We can see that NCM Sampling and BCM tend to ignore paved or roof when they have presence. The difference statistics between the estimated and the ground truth are plotted in the Bland-Altman plots in Fig. 7, where the set-based methods and GMM appear to be better than the others. 4 m Case. The error statistics of 4 m data are shown in Table III. MESMA and GMM are the most accurate, with AAM is not as good as MESMA. One possible reason for the high accuracy of MESMA is that MESMA inherently takes shade into account while AAM only combines input library spectra. Hence, the slightly better performance of GMM over AAM is more significant since they both ignore shade. Fig. 8 and Fig. 9 show the scatter plots and Bland-Altman plots for this data. Similar to the statistics in Table III, GMM has an advantage over the other distribution-based methods on paved and roof. Compared to AAM, GMM presents stable results to some extremely bad outliers for soil in AAM. Efficiency. Since they were run on different machines with different implementation (MESMA and NCM Sampling have multiple threads), the time costs are not for comparison, but for reference. In general, all the algorithms run in a few hours. The fastest algorithm is GMM-1, which is our implemented GMM with only one combination. NCM Sampling turns out to be the slowest algorithm. It is expected since sampling algorithms are usually slower than deterministic algorithms. The times costs on the 4 m dataset are usually more than 10 times slower than those on the 16 m dataset. This is because the image size of the former is 16-19 times larger than the latter and the library size is also larger. The least gap comes from GMM because of a changed TCV IC leading to a significantly less number of combinations. In [38] the authors show that with the same implementation AAM is much faster than MESMA, but here the result is converse. One reason is that the parameters of MESMA force it to pick at most 3 endmembers for a pixel instead of all the combinations. Also, multi-threading and implementation techniques impact the real world time costs significantly. C. Extend to Semi-realistic Images We extended the experiments to semi-realistic images to check if the algorithm implementation or library reduction was overfitted to this particular dataset. The method was to test the algorithms on another batch of synthetic images generated by the library spectra. Since all the algorithms assumed that a pixel was a linear combination of endmember spectra from the library, the creation of this synthetic dataset would use this assumption. We created this dataset following the literature that emphasizes realistic simulation [41], [42]. For each image in the original dataset, we randomly sampled spectra from the full library while the number of spectra for each endmember class is equal to the number in the reduced library. Then we used AAM to unmix the image with these sampled spectra. The obtained abundances were sorted to keep the largest three while the other were set to 0, and rescaled such that their summation was one. This is to conform with the assumption of MESMA. The endmembers and abundances were combined according to the LMM to generate pixels. In this way, we can have a dataset where the endmembers are randomly picked from the full library, and the spatial distribution of abundances looks similar to the original one. Fig. 10 shows all the 4 m synthetic images generated in this way. Comparing it with Fig. 1, we can see its similarity. But inherently, the synthetic images follow exactly the LMM with at most 3 endmembers for each pixel and they are randomly picked from the full library. We ran all the algorithms on this simulated dataset. Table IV shows the unmixing results on this dataset. We can see that GMM and NCM Sampling turn out to be the best methods. The superior performance of NCM contrasts sharply to its worst result in Table II. Since we evaluate the difference between total abundances for a material, it is possible that the relatively large pixel abundance error is mitigated by averaging them. This is more possible for sampling algorithms because statistically they tend to sample values around the correct ones. Compared to the negligible difference between GMM and set-based methods in Section IV-B, the advantage of GMM is more obvious. Since the endmembers were randomly sampled from the big library, set-based methods were less capable to unmix the pixels using a reduced library that was derived based on the another dataset. It is possible that a different reduced library based on this simulated dataset may lead to better results for set-based methods. However, that means, setbased methods may not be as robust as GMM across datasets. V. D ISCUSSION AND C ONCLUSION We have proposed an unmixing algorithm based on endmember variability modeled by GMM distributions. We validated the algorithm on a dataset consisting of 128 images across 2 scales, with ground truth abundances obtained by inspecting high resolution images. The results show that with large libraries, GMM achieves comparable accuracy to MESMA without the need for guided manual library reduction. We will discuss several issues regarding the dataset, algorithm and results in this Section. The dataset was well developed with various scenes, but the ground truth has intrinsic errors coming from UTM coordinates. It happens when the universal coordinates are used in the hyperspectral images and the other high-resolution images for region correspondence. Because these airborne images are spatially calibrated from its unstable collection process, the coordinates derived from the map information may not accurately reflect the real coordinates. Therefore, the region for calculating the total abundances may have a small shift compared to the region in the hyperspectral image. This is more likely in the 16 m data, which may explain larger overall errors for all the algorithms, and could be mitigated by registering the two images to find exact correspondence in the future [43]. 10 Merged Individual Table II C OMPARISON OF ERROR AND CORRELATION COEFFICIENT FOR THE 16 M IMAGES a b Set-based MESMA AAM 0.029 / 0.693 0.029 / 0.703 0.069 / 0.830 0.069 / 0.819 0.093 / 0.588 0.093 / 0.685 0.087 / 0.240 0.079 / 0.241 0.069 / 0.773 0.080 / 0.768 0.098 / 0.835 0.065 / 0.855 0.074 / 0.660 0.069 / 0.678a 0.088 / 0.909 0.057 / 0.898 0.082 / 0.836 0.084 / 0.870 0.102 / 0.762 0.087 / 0.818 0.091 / 0.836 0.076 / 0.862 MAD / R2 Turfgrass NPV Paved Roof Soil Tree Average GV Pervious Impervious Average NPV Tree 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0.5 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0.5 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0.5 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0.5 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 0 0 1 0 1 0 0 1 0 0.5 0 0 1 0 0 0 0 1 0 BCM Soil 1 0 NCM Sampling Roof 1 0 GMM-1 Paved 1 0 GMM BCM 0.042 / 0.610 0.073 / 0.750 0.096 / 0.538 0.125 / 0.000 0.067 / 0.733 0.184 / 0.534 0.098 / 0.527 0.175 / 0.701 0.074 / 0.886 0.175 / 0.722 0.141 / 0.770 1 0 AAM Distribution-based GMM-1 NCM Sampling 0.041 / 0.629 0.193 / 0.117 0.071 / 0.813 0.132 / 0.381 0.093 / 0.768 0.196 / 0.058 0.105 / 0.032 0.112 / 0.362 0.067 / 0.781 0.071 / 0.000 0.071 / 0.849 0.107 / 0.632 0.075 / 0.645 0.135 / 0.258 0.073 / 0.913 0.156 / 0.515 0.075 / 0.880 0.145 / 0.515 0.088 / 0.819 0.199 / 0.181 0.079 / 0.871 0.167 / 0.404 the entries in red fonts denote the best two results in each category. the running time on all the images for the 6 methods is 18, 27, 83, 0.3, 220, 101 minutes respectively. Turfgrass MESMA GMM 0.045 / 0.632 0.064 / 0.805 0.081 / 0.691 0.078 / 0.279 0.071 / 0.834 0.076 / 0.798 0.069 / 0.673 0.070 / 0.872 0.072 / 0.880 0.084 / 0.845 0.075 / 0.866 0 0 0.5 1 Figure 6. Scatter plots of 64 abundance values in 16 m for ground truth (x-axis) and estimated (y-axis). In applying GMM on the dataset, there are several implementation details that affected the results. First, the projection affected the results of GMM. Hence, we used a carefully determined projection in Algorithm 1. Second, the number of combinations impacted the performance. If some training data were present, we could gradually decrease TCV IC until the error stopped improving during reasonable time. Otherwise, we suggest gradually increasing TCV IC from 0 (without running the whole algorithm) until the number of combinations reduces to approximately 100, which is a reasonable time cost multiplier of GMM-1. Third, we didn’t use a spatial prior in the original GMM paper [12]. We found that the prior made it work better on some images, while worse on some other images when applied to this dataset. In total, it didn’t improve the results much. This has two possible reasons: (i) the pixel size is big enough such that smoothness and sparsity are not obvious on the abundance maps; (ii) the dataset contains a variety of scenes in which some of them violate this property. We also have some remarks on the results. For the real dataset, GMM is slightly better than MESMA for the 16 m data while slightly inferior for the 4 m data, so they are close in accuracy. However, MESMA used a library reduction 11 Turfgrass MESMA 0.5 0 0 0 0 0 0 -0.5 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -1 0 0.2 0.4 -0.5 0 0.5 1 0.2 0.5 0.5 0.5 0.5 0.5 0 0 0 0 0 0 -0.5 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -0.5 0 0.2 0.4 0.5 1 0.5 0.5 0.5 0.5 0.5 0 0 0 0 0 0 -0.5 0 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -0.5 0 0.2 0.4 0.5 1 0.5 0.5 0.5 0.5 0.5 0 0 0 0 0 0 -0.5 0 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -0.5 0 0.2 0.4 0.5 1 0.5 1 0.5 1 0.5 0 0 0 0 0 0 -0.5 0 0.5 -1 0 0.5 1 -0.5 0 0.5 1 -1 0 0.2 0.4 0.5 1 0.5 0.5 0.5 0.5 0.5 0 0 0 0 0 0 -0.5 0 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -0.5 0 0.2 0.4 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 -0.5 0 0.5 -0.5 1 -0.5 0 0.5 -0.5 0.5 -0.5 0 0.5 -0.5 0 -0.5 0 0.5 -0.5 BCM Tree 1 0 NCM Sampling Soil 0.5 -0.2 GMM-1 Roof 0.5 0 GMM Paved 0.5 -0.2 AAM NPV 0.2 -0.5 0 0.5 1 Figure 7. Bland-Altman plots of 64 abundance values in 16 m for ground truth and estimated. The x-axis is the ground truth. The y-axis is the difference between estimated and ground truth. The solid line in each plot is the mean of these differences while the dashed lines show the mean plus (minus) twice the standard deviation of these differences. method that relied on manual guidance and user knowledge of the study area, while GMM used the original library without refinement. Hence, GMM may be more applicable to datasets without ground truth. Second, the results of MESMA were slightly different from those reported in [29], which used this same imagery and validation dataset. In [29], the average R2 for individual and merge cases are 0.642 and 0.867 for 16 m, 0.811 and 0.923 for 4 m. Comparing them to Table II and Table III, they are very similar. Note that we used Matlab to extract the polygon ROIs directly from the original images while in [29] the images were resampled to a uniform spatial resolution of 18 m and corrected for locational errors using Delaunay triangulation. Additionally, that study used 178 spectral bands in contrast to 164 bands used here. Future work could include developing a dataset with more images and more scale variation. Also, validation abundances can be more accurately obtained by registration of hyperspectral and high resolution images. Further work can also be done to improve the efficiency of GMM using covariance matrices with a simple form. ACKNOWLEDGMENTS The authors wish to thank Alina Zare and Sheng Zou for providing the NCM sampling code. We wish to acknowledge funding from the NASA Earth and Space Science Fellowship Program and the Belgian Science Policy Office in the framework of the STEREO III Program— Project UrbanEARS (SR/00/307). We also thank the Jet Propulsion Laboratory for providing radiometrically calibrated, orthorectified AVIRIS imagery. R EFERENCES [1] G. Vane, R. O. Green, T. G. Chrien, H. T. Enmark, E. G. Hansen, and W. M. Porter, “The airborne visible/infrared imaging spectrometer (AVIRIS),” Remote Sensing of Environment, vol. 44, no. 2-3, pp. 127– 143, 1993. [2] C. Small, “Estimation of urban vegetation abundance by spectral mixture analysis,” International journal of remote sensing, vol. 22, no. 7, pp. 1305–1334, 2001. [3] J. Settle and N. Drake, “Linear mixing and the estimation of ground cover proportions,” International Journal of Remote Sensing, vol. 14, no. 6, pp. 1159–1177, 1993. [4] M. Herold and D. Roberts, “Spectral characteristics of asphalt road aging and deterioration: implications for remote-sensing applications,” Applied Optics, vol. 44, no. 20, pp. 4327–4334, 2005. [5] A. Zare and K. Ho, “Endmember variability in hyperspectral analysis: Addressing spectral variability during spectral unmixing,” IEEE Signal Processing Magazine, vol. 31, no. 1, pp. 95–104, 2014. [6] B. Somers, G. P. Asner, L. Tits, and P. Coppin, “Endmember variability in spectral mixture analysis: A review,” Remote Sensing of Environment, vol. 115, no. 7, pp. 1603–1616, 2011. [7] G. Meister, A. Rothkirch, H. Spitzer, and J. Bienlein, “BRDF field studies for remote sensing of urban areas,” Remote Sensing Reviews, vol. 19, no. 1-4, pp. 37–57, 2000. [8] E. A. Wentz, D. A. Quattrochi, M. Netzband, and S. W. Myint, “Synthesizing urban remote sensing through application, scale, data and case studies,” Geocarto International, vol. 27, no. 5, pp. 425–442, 2012. 12 Merged Individual Table III C OMPARISON OF ERROR AND CORRELATION COEFFICIENT FOR THE 4 M IMAGES a b Set-based MESMA AAM 0.028 / 0.740 0.033 / 0.712 0.044 / 0.885 0.059 / 0.874 0.057 / 0.859 0.100 / 0.822 0.060 / 0.574 0.078 / 0.287 0.040 / 0.941 0.065 / 0.793 0.049 / 0.910 0.055 / 0.918 0.046 / 0.818a 0.065 / 0.735 0.039 / 0.943 0.045 / 0.931 0.053 / 0.935 0.091 / 0.858 0.054 / 0.943 0.072 / 0.817 0.049 / 0.941 0.069 / 0.868 MAD / R2 Turfgrass NPV Paved Roof Soil Tree Average GV Pervious Impervious Average NPV Tree 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0.5 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0.5 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0.5 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0.5 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 0 0 1 0 1 0 0 1 0 0.5 0 0 1 0 0 0 0 1 0 BCM Soil 1 0 NCM Sampling Roof 1 0 GMM-1 Paved 1 0 GMM BCM 0.049 / 0.710 0.074 / 0.822 0.089 / 0.607 0.105 / 0.181 0.094 / 0.734 0.102 / 0.682 0.086 / 0.623 0.120 / 0.823 0.078 / 0.897 0.151 / 0.791 0.116 / 0.837 1 0 AAM Distribution-based GMM-1 NCM Sampling 0.027 / 0.811 0.033 / 0.754 0.052 / 0.867 0.068 / 0.872 0.075 / 0.794 0.165 / 0.847 0.100 / 0.250 0.199 / 0.655 0.084 / 0.897 0.065 / 0.867 0.039 / 0.937 0.057 / 0.926 0.063 / 0.759 0.098 / 0.820 0.042 / 0.942 0.058 / 0.932 0.082 / 0.906 0.087 / 0.886 0.075 / 0.911 0.092 / 0.895 0.067 / 0.919 0.079 / 0.904 the entries in red fonts denote the best two results in each category. the running time on all the images for the 6 methods is 165, 499, 213, 8, 3153, 1347 minutes respectively. Turfgrass MESMA GMM 0.036 / 0.811 0.052 / 0.879 0.061 / 0.834 0.069 / 0.458 0.078 / 0.904 0.043 / 0.934 0.056 / 0.803 0.043 / 0.943 0.075 / 0.916 0.067 / 0.921 0.062 / 0.927 0 0 0.5 1 Figure 8. Scatter plots of 64 abundance values in 4 m for ground truth (x-axis) and estimated (y-axis). [9] D. A. Roberts, S. L. Ustin, S. Ogunjemiyo, J. Greenberg, S. Z. Dobrowski, J. Chen, and T. M. Hinckley, “Spectral and structural measures of northwest forest vegetation at leaf to landscape scales,” Ecosystems, vol. 7, no. 5, pp. 545–562, 2004. [10] A. Halimi, N. Dobigeon, and J.-Y. Tourneret, “Unsupervised unmixing of hyperspectral images accounting for endmember variability,” IEEE Trans. on Image Processing, vol. 24, no. 12, pp. 4904–4917, 2015. [11] L. Drumetz, M.-A. Veganzones, S. Henrot, R. Phlypo, J. Chanussot, and C. Jutten, “Blind hyperspectral unmixing using an extended linear mixing model to address spectral variability,” IEEE Transactions on Image Processing, vol. 25, no. 8, pp. 3890–3905, 2016. [12] Y. Zhou, A. Rangarajan, and P. D. Gader, “A Gaussian mixture model representation of endmember variability in hyperspectral unmixing,” IEEE Transactions on Image Processing, vol. To Appear, 2018. [13] D. A. Roberts, M. Gardner, R. Church, S. Ustin, G. Scheer, and R. Green, “Mapping chaparral in the Santa Monica Mountains using multiple endmember spectral mixture models,” Remote Sensing of Environment, vol. 65, no. 3, pp. 267–279, 1998. [14] J.-P. Combe, S. Le Mouelic, C. Sotin, A. Gendrin, J. Mustard, L. Le Deit, P. Launeau, J.-P. Bibring, B. Gondet, Y. Langevin, et al., “Analysis of OMEGA/Mars express data hyperspectral data using a multipleendmember linear spectral unmixing model (MELSUM): Methodology and first results,” Planetary and Space Science, vol. 56, no. 7, pp. 951– 975, 2008. [15] G. P. Asner and D. B. Lobell, “A biogeophysical approach for automated SWIR unmixing of soils and vegetation,” Remote sensing of environment, vol. 74, no. 1, pp. 99–112, 2000. [16] G. P. Asner and K. B. Heidebrecht, “Spectral unmixing of vegetation, soil and dry carbon cover in arid regions: comparing multispectral and hyperspectral observations,” International Journal of Remote Sensing, 13 Turfgrass MESMA 0.5 0 0 0 0 0 0 -0.5 0.5 -0.2 0 0.5 1 -0.5 0 0.5 1 -0.5 0 0.2 0.4 -0.5 0 0.5 1 0.2 0.5 0.5 0.5 1 0.2 0 0 0 0 0 0 -0.5 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -1 0 0.2 0.4 0.5 1 0.5 0.5 0.5 0.5 0.2 0 0 0 0 0 0 -0.5 0 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -0.5 0 0.2 0.4 0.5 1 0.5 0.5 0.5 0.5 0.5 0 0 0 0 0 0 -0.5 0 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -0.5 0 0.2 0.4 0.5 1 0.5 1 0.4 0.5 0.5 0 0 0 0.2 0 0 -0.5 0 0.5 -1 0 0.5 1 0 0 0.5 1 -0.5 0 0.2 0.4 0.5 1 0.5 0.5 0.5 0.5 0.5 0 0 0 0 0 0 -0.5 0 0.5 -0.5 0 0.5 1 -0.5 0 0.5 1 -0.5 0 Figure 9. Bland-Altman plots of 64 abundance values in 4 m for ground truth and estimated. Figure 10. Simulated 4 m ROI images. They are very similar to the real images in Fig. 1. 0.2 0.4 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1 -0.5 0 0.2 -0.2 1 -0.5 0 0.2 -0.2 0.5 -0.2 0 0.2 -0.2 0 -0.2 0 0.2 -0.2 BCM Tree 0.5 0 NCM Sampling Soil 0.5 -0.2 GMM-1 Roof 0.2 0 GMM Paved 0.5 -0.2 AAM NPV 0.2 -0.5 0 0.5 1 14 4m 16 m Table IV C OMPARISON OF ERROR AND CORRELATION COEFFICIENT FOR THE SYNTHETIC IMAGES a MAD / R2 Turfgrass NPV Paved Roof Soil Tree Average Turfgrass NPV Paved Roof Soil Tree Average Set-based MESMA AAM 0.044 / 0.791 0.050 / 0.837 0.039 / 0.948 0.027 / 0.940 0.074 / 0.512 0.115 / 0.563 0.063 / 0.441 0.063 / 0.569 0.038 / 0.643 0.033 / 0.723 0.090 / 0.882 0.058 / 0.822 0.058 / 0.703 0.058 / 0.742 0.032 / 0.838 0.019 / 0.912 0.040 / 0.955 0.016 / 0.965 0.062 / 0.836 0.121 / 0.819 0.048 / 0.478 0.051 / 0.537 0.043 / 0.661 0.042 / 0.845 0.050 / 0.906 0.035 / 0.911 0.046 / 0.779 0.047 / 0.832 GMM 0.021 / 0.913 0.023 / 0.963 0.078 / 0.745 0.054 / 0.742 0.028 / 0.738 0.051 / 0.880 0.042 / 0.830 0.021 / 0.921 0.012 / 0.990 0.070 / 0.773 0.046 / 0.472 0.026 / 0.840 0.055 / 0.864 0.038 / 0.810a Distribution-based GMM-1 NCM Sampling 0.025 / 0.916 0.016 / 0.954 0.026 / 0.956 0.018 / 0.978 0.116 / 0.598 0.038 / 0.927 0.118 / 0.259 0.027 / 0.894 0.028 / 0.781 0.016 / 0.956 0.060 / 0.923 0.029 / 0.960 0.062 / 0.739 0.024 / 0.945 0.015 / 0.921 0.014 / 0.919 0.013 / 0.991 0.019 / 0.995 0.103 / 0.742 0.041 / 0.890 0.087 / 0.254 0.035 / 0.617 0.028 / 0.813 0.036 / 0.953 0.045 / 0.880 0.033 / 0.951 0.049 / 0.767 0.030 / 0.887 BCM 0.042 / 0.827 0.041 / 0.848 0.101 / 0.307 0.129 / 0.170 0.067 / 0.604 0.179 / 0.669 0.093 / 0.571 0.019 / 0.896 0.027 / 0.955 0.053 / 0.723 0.088 / 0.222 0.041 / 0.766 0.099 / 0.748 0.054 / 0.718 the entries in red fonts denote the best two results in each category. vol. 23, no. 19, pp. 3939–3958, 2002. [17] A. Castrodad, Z. Xing, J. B. Greer, E. Bosch, L. Carin, and G. Sapiro, “Learning discriminative sparse representations for modeling, source separation, and mapping of hyperspectral imagery,” IEEE Transactions on Geoscience and Remote Sensing, vol. 49, no. 11, pp. 4263–4281, 2011. [18] O. Eches, N. Dobigeon, C. Mailhes, and J.-Y. Tourneret, “Bayesian estimation of linear mixtures using the normal compositional model: Application to hyperspectral imagery,” IEEE Trans. on Image Processing, vol. 19, no. 6, pp. 1403–1413, 2010. [19] O. Eches, N. Dobigeon, and J.-Y. Tourneret, “Estimating the number of endmembers in hyperspectral images using the normal compositional model and a hierarchical Bayesian algorithm,” IEEE Journal of Selected Topics in Signal Processing, vol. 4, no. 3, pp. 582–591, 2010. [20] D. Stein, “Application of the normal compositional model to the analysis of hyperspectral imagery,” in IEEE Workshop on Advances in Techniques for Analysis of Remotely Sensed Data, 2003, pp. 44–51. [21] A. Zare and P. D. Gader, “PCE: Piecewise convex endmember detection,” IEEE Trans. on Geoscience and Remote Sensing, vol. 48, no. 6, pp. 2620–2632, 2010. [22] B. Zhang, L. Zhuang, L. Gao, W. Luo, Q. Ran, and Q. Du, “PSO-EM: A hyperspectral unmixing algorithm based on normal compositional model,” IEEE Trans. on Geoscience and Remote Sensing, vol. 52, no. 12, pp. 7782–7792, 2014. [23] X. Du, A. Zare, P. D. Gader, and D. Dranishnikov, “Spatial and spectral unmixing using the Beta compositional model,” IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, vol. 7, no. 6, pp. 1994–2003, 2014. [24] Y. Zhou, A. Rangarajan, and P. D. Gader, “A Gaussian mixture model representation of endmember variability for spectral unmixing,” in 2016 8th Workshop on Hyperspectral Image and Signal Processing: Evolution in Remote Sensing (WHISPERS), Aug 2016, pp. 1–5. [25] J. M. Nascimento and J. M. Bioucas Dias, “Vertex component analysis: A fast algorithm to unmix hyperspectral data,” IEEE Trans. on Geoscience and Remote Sensing, vol. 43, no. 4, pp. 898–910, 2005. [26] X. Lu, H. Wu, Y. Yuan, P. Yan, and X. Li, “Manifold regularized sparse NMF for hyperspectral unmixing,” IEEE Trans. on Geoscience and Remote Sensing, vol. 51, no. 5, pp. 2815–2826, 2013. [27] A. Zare, P. D. Gader, O. Bchir, and H. Frigui, “Piecewise convex multiple-model endmember detection and spectral unmixing,” IEEE Trans. on Geoscience and Remote Sensing, vol. 51, no. 5, pp. 2853– 2862, 2013. [28] K. P. Murphy, Machine learning: a probabilistic perspective, MIT press, 2012. [29] E. B. Wetherley, D. A. Roberts, and J. P. McFadden, “Mapping spectrally similar urban materials at sub-pixel scales,” Remote Sensing of Environment, vol. 195, pp. 170–183, 2017. [30] D. A. Roberts, D. A. Quattrochi, G. C. Hulley, S. J. Hook, and R. O. Green, “Synergies between VSWIR and TIR data for the urban environment: An evaluation of the potential for the hyperspectral infrared imager (HyspIRI) decadal survey mission,” Remote Sensing of Environment, vol. 117, pp. 83–101, 2012. [31] A. N. Schaaf, P. E. Dennison, G. K. Fryer, K. L. Roth, and D. A. Roberts, “Mapping plant functional types at multiple spatial resolutions using imaging spectrometer data,” GIScience & Remote Sensing, vol. 48, no. 3, pp. 324–344, 2011. [32] C. M. Bishop, Pattern recognition and machine learning, springer New York, 2006. [33] X.-L. Meng and D. B. Rubin, “Maximum likelihood estimation via the ECM algorithm: A general framework,” Biometrika, vol. 80, no. 2, pp. 267–278, 1993. [34] G. J. McLachlan and S. Rathnayake, “On the number of components in a Gaussian mixture model,” Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery, vol. 4, no. 5, pp. 341–355, 2014. [35] P. Smyth, “Model selection for probabilistic clustering using crossvalidated likelihood,” Statistics and Computing, vol. 10, no. 1, pp. 63– 72, 2000. [36] J. Duchi, S. Shalev-Shwartz, Y. Singer, and T. Chandra, “Efficient projections onto the l1-ball for learning in high dimensions,” in Proc. of the 25th International Conference on Machine learning (ICML). ACM, 2008, pp. 272–279. [37] Y. Zhou, A. Rangarajan, and P. D. Gader, “A spatial compositional model for linear unmixing and endmember uncertainty estimation,” IEEE Trans. on Image Processing, vol. 25, no. 12, pp. 5987–6002, 2016. [38] R. Heylen, A. Zare, P. Gader, and P. Scheunders, “Hyperspectral unmixing with endmember variability via alternating angle minimization,” IEEE Transactions on Geoscience and Remote Sensing, vol. 54, no. 8, pp. 4983–4993, 2016. [39] A. Zare, P. Gader, and G. Casella, “Sampling piecewise convex unmixing and endmember extraction,” IEEE Transactions on Geoscience and Remote Sensing, vol. 51, no. 3, pp. 1655–1665, 2013. [40] J. M. Bland and D. Altman, “Statistical methods for assessing agreement between two methods of clinical measurement,” The lancet, vol. 327, no. 8476, pp. 307–310, 1986. [41] L. Gao, Q. Du, B. Zhang, W. Yang, and Y. Wu, “A comparative study on linear regression-based noise estimation for hyperspectral imagery,” IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, vol. 6, no. 2, pp. 488–498, 2013. [42] Z. Hao, M. Berman, Y. Guo, G. Stone, and I. Johnstone, “Semi-realistic simulations of natural hyperspectral scenes,” in IEEE International Geoscience and Remote Sensing Symposium (IGARSS). IEEE, 2015, pp. 1004–1007. [43] Y. Zhou, A. Rangarajan, and P. D. Gader, “Nonrigid registration of hyperspectral and color images with vastly different spatial and spectral resolutions for spectral unmixing and pansharpening,” in 2017 IEEE Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), July 2017, pp. 1571–1579. 15 Yuan Zhou received the B.E degree in Software Engineering (2008), the M.E. degree in Computer Application Technology (2011), both from Huazhong University of Science and Technology, Wuhan, Hubei, China. Then he worked in Shanghai UIH as a software engineer for two years. Since 2013, he has been a Ph.D. student in the Department of CISE, University of Florida, Gainesville, FL, USA. His research interests include image processing, computer vision and machine learning. Erin Wetherley is a doctoral candidate in the Geography Department at the University of California, Santa Barbara. She specializes in characterizing urban environments using hyperspectral imagery, thermal imagery, and sub-pixel analyses. Prior to her doctoral work, Erin earned a bachelors degree in Environmental Studies from Brown University, and worked for several years as a GIS and database manager at a Washington, D.C. non-profit organization. Paul Gader (M’86–SM’09–F’11) received the Ph.D. degree in mathematics for image-processingrelated research from the University of Florida, Gainesville, FL, USA, in 1986. He was a Senior Research Scientist with Honeywell, a Research Engineer and a Manager with the Environmental Research Institute of Michigan, Ann Arbor, MI, USA, and a Faculty Member with the University of Wisconsin, Oshkosh, WI, USA, the University of Missouri, Columbia, MO, USA, and the University of Florida, FL, USA, where he is currently a Professor of Computer and Information Science and Engineering. He performed his first research in image processing in 1984 working on algorithms for the detection of bridges in forward-looking infrared imagery as a Summer Student Fellow at Eglin Air Force Base. He has since worked on a wide variety of theoretical and applied research problems including fast computing with linear algebra, mathematical morphology, fuzzy sets, Bayesian methods, handwriting recognition, automatic target recognition, biomedical image analysis, landmine detection, human geography, and hyperspectral and light detection, and ranging image analysis projects. He has authored/co-authored hundreds of refereed journal and conference papers.
1cs.CV
Inertial Hegselmann-Krause Systems arXiv:1502.03332v3 [cs.SY] 9 Mar 2016 Bernard Chazelle ∗ Chu Wang † March 10, 2016 Abstract We derive an energy bound for inertial Hegselmann-Krause (HK) systems, which we define as a variant of the classic HK model in which the agents can change their weights arbitrarily at each step. We use the bound to prove the convergence of HK systems with closed-minded agents, which settles a conjecture of long standing. This paper also introduces anchored HK systems and show their equivalence to the symmetric heterogeneous model. 1 Introduction The Hegselmann-Krause model of multiagent consensus has emerged as a “model organism” for opinion dynamics [9]. In an HK system, a collection of n agents, each one represented by a point in Rd , evolves by applying the following rule at discrete times: move each agent to the mass center of all the agents within unit distance. It has been shown that the system always freezes eventually [6, 10, 13, 18, 19]. While the model has been the subject of numerous studies [2, 3, 5, 11, 12, 14] and much is known about its convergence rate, its heterogeneous variant remains a mystery [24, 25, 26, 27, 21]. In that model, each agent can choose its own radius of confidence. In the HK model with closed-minded agents, all of the agents have radius either 1 or 0. While extensive simulations have pointed to the convergence of that system [14, 15, 17, 21], a proof has remained elusive. This open question has been described by a leading researcher as one of the outstanding gaps in our understanding of opinion dynamics [8]. This paper resolves this issue by settling the conjecture in the affirmative: HK systems with closedminded agents always converge. Our proof entails making the problem a special case ∗ Department of Computer Science, Princeton University, [email protected] . This author was supported in part by NSF grants CCF-0963825 and CCF-1420112 † Program in Applied and Computational Mathematics, Princeton University, chuw@math. princeton.edu 1 of a much broader class of dynamical systems, the inertial HK systems (more on which below). The relaxation time of the original HK model has been shown to be nO(n) in any fixed dimension [6], a bound later improved to a polynomial bound in both n and d [1]. For the particular case d = 1, a bound of O(n5 ) was established in [16], which was lowered to O(n4) in [20] and then to O(n3 ) in [1]. The model can be generalized in various ways, its ultimate expression being the grand unified model of influence systems [7], in which each agent gets to pick its neighbors by following its own distinct, arbitrary criteria. Oddly, even the most seemingly innocuous modifications of the original HK model have stumped researchers in the field. This is the case of HK systems with closed-minded agents, where any agent’s radius of confidence is either 0 or 1. To prove that these systems always converge, we introduce the more general inertial HK systems and establish a bound on their kinetic 2-energy. We also introduce the anchored variant of HK systems and prove that it is equivalent to the symmetric heterogeneous model. This fairly surprising result sheds new light on the convergence properties of these systems. 1.1 Inertial HK systems Instead of being required to move to the mass center of its neighbors at each step, each agent of an inertial HK system may move toward it by any fraction of length; setting this fraction to zero makes the agent closed-minded, which means that it remains frozen in place. Formally, the system consists of n agents represented by points x1 (t), . . . , xn (t) in Rd at time t = 0, 1, 2, etc. Two agents i and j are said to be neighbors if they are within unit distance: kxi (t) −xj (t)k2 ≤ 1. When the time t is understood, the neighbors of i form a set we denote by Ni ; these sets form an undirected communication network Gt with a self-loop at each of the n nodes. The dynamics of the system is specified by xi (t + 1) = (1 − λ)xi (t) + λ X xj (t), |Ni | j∈N (1) i where λ ∈ [0, 1] is called the inertia. Not only λ need not have the same value for all the agents, but it can be reset to a different value with each application of (1). In this way, we can select any agent to be closed-minded by setting their inertia to 0. We can also retrieve the original HK model by turning all the inertias to 1. In its full generality, however, an inertial HK system is not deterministic. We tackle the issue of convergence by turning our attention to their kinetic s-energy. The concept was introduced in [6] as a generating function for studying averaging processes in dynamic networks. It is defined as follows: n X X kxi (t + 1) − xi (t)ks2 . K(s) = t≥0 i=1 We provide an upper bound for the case s = 2. 2 Theorem 1.1. The kinetic s-energy of an n-agent inertial HK-system whose inertias are uniformly bounded from above by λ0 satisfies K(2) ≤ λ0 n2 /4. We use this result to establish the convergence of HK systems with closed-minded agents. Note that the convergence is asymptotic. This is even true for n = 2 with a single closed-minded agent. Indeed, if the mobile agent is initialized close enough to the closed-minded one, it will eventually converge to it by halving its distance at each step. The network Gt becomes fixed in this case. In general, it changes with time, however. Interestingly, fixed-point attraction does not automatically imply the convergence of the communication network, so we address this issue separately. Theorem 1.2. An HK system with any number of closed-minded agents converges asymptotically to a fixed-point configuration. The communication network converges for all initial conditions if d = 1 and for all initial conditions outside a set of measure zero if d > 1. The specific meaning of this last clause is that, in dimension two and higher, as long as we perturb the closed-minded agents by an arbitrarily small amount at the beginning, the communication network Gt will settle to a fixed graph in finite time almost surely. The perturbation is likely an unnecessary artifact of the proof and it would be nice to settle this point. The main open problem, however, is to derive an effective upper bound on the relaxation time. 1.2 Anchored HK systems An anchored HK system consists of n agents, each one represented by a vector zk = (xk (t), yk ). The vector is a combination of a mobile part xk (t) ∈ Rd and a static part ′ yk ∈ Rd ; the dimensions d and d′ are the same for all the agents. Two agents i and j are neighbors if and only if kzi (t) − zj (t)k2 ≤ r, where r is a fixed positive constant. At each step, the mobile part of an agent moves to the mass center of all its neighbors while its anchored part remains fixed. (Note that the averaging is done one coordinate at a time, so the static coordinates affect only the neighborhood relationships and do not participate in the averaging itself.) Anchored HK systems capture a notion of partial closed-mindedness: agents are closed-minded in some coordinates but open-minded in others. Both mobile and anchored parts, on the other hand, affect the communication network. By contrast, a symmetric heterogeneous HK system consists of n agents, each one represented by a vector xk (t). For each pair of agents (i, j), a threshold rij specifies that agents i and j are neighbors at time t whenever kxi (t) − xj (t)k2 ≤ rij . It is required that rij = rji and rii ≥ 0 (the latter to create self-loops). Note that rij = 0 means that i and j are neighbors only when their positions coincide, while rij < 0 implies that i and j 3 are never joined together. Surprisingly, anchored and symmetric heterogeneous systems are conjugate: in other words, there exists a bijection between them that respects their dynamics and establishes the equivalence of the two systems. Specifically, we prove the following: ′ Theorem 1.3 Given any anchored HK system zk (t) = (xk (t), yk ) in Rd × Rd , there exists a conjugate symmetric heterogeneous HK system x′k (t) in Rd . Conversely, a symmetric heterogeneous HK system of n agents in Rd is conjugate to an anchored HK system zk (t) = (xk (t), yk ) with agents in Rd × Rn−1 . In both cases, the conjugacy is formed by the trivial correspondence: xk (t) = x′k (t) for any k and t. Both anchored and symmetric heterogeneous HK systems converge asymptotically to a fixed configuration. If there is no pair of agents (i, j) such that kyi − yj k2 = r in an anchored HK system or such that rij = 0 in a symmetric heterogeneous HK system, then the communication network converges to a fixed graph. While the convergence of symmetric heterogeneous HK systems can be inferred directly from known results, the convergence of the communication networks requires special treatment, however. An interesting corollary of these results is the convergence of HK systems embedded within a social network [22, 23, 28]. Imagine that the existence of an edge between two agents i, j is a function not only of their relative distance but also of a predetermined, fixed relationship. By setting rij < 0, we can enforce the absence of an edge. In this way we can restrict the HK action to the edges of a fixed, arbitrary social network, and still assert convergence. 2 Inertial HK Systems The purpose of this section is to prove Theorem 1.1. To do that, we assign each agent i a certain amount of “money” Ci (0) at the beginning (t = 0) and specify a protocol for spending and exchanging it with other agents as time progresses. If we knew ahead of time the total contribution of agent i to the kinetic 2-energy, we could simply set Ci (0) to that amount and let the agent “pay” for its contribution from its own pocket. This information is not available, however, so we take an initial guess and set up an exchange protocol so that no agent runs out of money. By giving money to their neighbors in a judicious manner, we show how each agent remains in a position to pay for its share of the 2-energy at each step. The proof is algorithmic: it is a message-passing protocol that simulates the update of a distributed Lyapunov function. Our initial guess is Ci (0) = n X j=1 o n min kxi (0) − xj (0)k22 , 1 . 4 To specify the exchange protocol, we first simplify the notation as follows:    ∆i = xi (t + 1) − xi (t) dij = xi (t) − xj (t)   ′ dij = xi (t + 1) − xj (t + 1). The two rules below are applied to every agent i at any time step t ≥ 0: • For every neighbor of j at time t (which includes i itself), agent i spends k∆i +∆j k22 units of money and gives to agent j an amount equal to 2(dij − ∆j )T ∆j . • If agent j becomes a new neighbor of i at time t + 1 or, conversely, ceases to be one, then agent i spends |kd′ij k22 − 1|. Let Ci (t) be the amount of money held by agent i at time t, and let Niin (resp. Niout ) denote the set of agents that are neighbors of i at time t + 1 (resp. t) but not at time t (resp. t + 1). Using the symmetry of the neighbor relation, we express the cash flow at time t by X X Ci (t + 1) − Ci (t) = 2 (dji − ∆i )T ∆i − 2 (dij − ∆j )T ∆j j∈Ni − X j∈Ni j∈Ni k∆i + ∆j k22 − X j∈Niin ∪Niout |kd′ij k22 − 1|. Since (djiP − ∆i )T ∆i − (dij − ∆j )T ∆j = dTij (∆i − ∆j ) − 2dTij ∆i + k∆j k22 − k∆i k22 and, by (1), λ j∈Ni dij = −|Ni |∆i , we have Ci (t + 1) − Ci (t) o Xn T 2 T 2dij (∆i − ∆j ) + k∆i − ∆j k2 − 4dij ∆i − 4|Ni |k∆i k22 − = j∈Ni = Xn j∈Ni o  2dTij (∆i − ∆j ) + k∆i − ∆j k22 + 4 λ−1 − 1 |Ni |k∆i k22 − X |kd′ij k22 − 1| X |kd′ij k22 − 1|. j∈Niin ∪Niout j∈Niin ∪Niout Note that λ = 0 implies that ∆i = 0, so it is understood that (λ−1 − 1)|Ni |k∆i k22 = 0 in the identity above. Since d′ij = dij + ∆i − ∆j , the first summand in the last equality above is equal to kd′ij k22 − kdij k22 ; therefore Ci (t + 1) − Ci (t) o Xn kd′ij k22 − kdij k22 − = j∈Ni = n X j=1 min  kd′ij k22 , 1 − X j∈Niin ∪Niout n X j=1  |kd′ij k22 − 1| + 4 λ−1 − 1 |Ni |k∆i k22   min kdij k22 , 1 + 4 λ−1 − 1 |Ni |k∆i k22 . 5 Since |Ni | > 0 and λ ≤ λ0 , it follows that Ci (t) ≥ n X j=1 min  kdij k22 , 1 +4 λ−1 0 −1 t−1 X k=0 kxi (k + 1) − xi (k)k22 . Being its own neighbor, agent i spends at least 4k∆i k22 money at each step. Summing up over all the agents, this amounts to 4K(2). This shows that the initial  injection of money −1 allows the system to spend 4K(2) and still be left with 4 λ0 − 1 K(2). Theorem 1.1 follows from the fact that the initial injection of money is at most n2 .  3 HK Systems with Closed-Minded Agents This section proves Theorem 1.2. The bound on the kinetic 2-energy shows that the system eventually slows down to a crawl but it falls short of proving convergence. Indeed, an agent moving along a circle by 1/t at time t contributes finitely to the kinetic 2energy yet travels an infinite distance. We prove that HK systems with closed-minded agents always converge asymptotically. We treat the one-dimensional separately for two reasons: the proof is entirely self-contained and the convergence of the communication network does not require perturbation. In dimension two and higher, we prove that the agents always converge to a fixed position: the system has a fixed-point attractor. We show how a tiny random perturbation ensures that the network eventually settles on a fixed graph. 3.1 The one-dimensional case We begin with the one-dimensional case, which is particularly simple. By Lemma 1.1, we can choose a small enough ε > 0 and an integer tε large enough so that no agent moves by a distance of more than ε at any time t ≥ tε . Fix t > tε and let xi (resp. Ni ) denote the position (resp. neighbors) of agent i at time t; we use primes and double primes to indicate the equivalent quantities for time t + 1 and t + 2. The symmetric difference between Ni and Ni′ , if nonempty, is the disjoint union of a set Li of agents located at xi − 1 ± O(ε) at times t and t + 1 and a set Ri at locations xi + 1 ± O(ε). For each subset, we distinguish between the agents of Ni not in Ni′ and vice-versa, which out gives the disjoint partitions Li = Lin and Ri = Riin ∪ Riout . The locations x′i and i ∪ Li ′′ xi of agent i at times t + 1 and t + 2 are given by ( P P |Ni |x′i = ( j∈Ni ∩N ′ xj ) + ( j∈Lout∪Rout xj ) i i P P i |Ni′ |x′′i = ( j∈Ni ∩N ′ x′j ) + ( j∈Lin ∪Rin x′j ). i i 6 i All x′k and x′′k are of the form xk ± O(ε), so subtracting the two identities shows that out (|Ni′ | − |Ni |)xi = (|Lin i | − |Li |)(xi − 1) + (|Riin | − |Riout |)(xi + 1) ± O(εn). Since the dynamics is translation-invariant, we can assume that xi = 0. Setting ε small enough, the integrality of the set cardinalities implies that the net flow of neighbors on the left of agent i is the same as it is on the right: in out in |Lout i | − |Li | = |Ri | − |Ri |. (2) Among all the agents undergoing a change of neighbors between times t and t + 1, pick the one that ends up the furthest to the right at time t + 1, choosing the one of largest index i to break ties. We distinguish between two cases: 1. x′i ≥ xi : No agent of Riout can be closed-minded; nor can it be mobile since, ranks being preserved, it would provide an agent undergoing a change of neighbors and landing to the right of i at time t + 1, in contradiction with the definition of i. It follows that Riout is empty, which in turn implies that Lin i is not, since by our choice of i not all four terms in (2) can be zero. Since agent i is not moving left, neither is any agent j of Lin i . Its set Nj of neighbors changes between time t and t + 1 and Rjout is empty. To see why the latter is true, we first note that Nj cannot lose any closed-minded agent to the right. Also, since any mobile agent in Rjout is to the left of i at time t, it stays to the left of it by conservation of ranks; hence the agent remains a neighbor of j, a contradiction. The argument so far uses the rightmost status of agent i only to assert that Riout is empty. This means we are back to square one and we can proceed inductively, eventually reaching a contradiction. 2. x′i < xi : The key observation is that our previous argument never uses time directionality, so we can exchange the role of t and t + 1, which implies that now x′i > xi . Note that the superscripts in and out must be swapped. While we chose i as the mobile agent landing furthest to the right, by symmetry we must now choose the one starting the furthest to the right: of course, since mobile agents can never cross this make no difference. We conclude that each agent is now endowed with a fixed set of neighbors, so the dynamics is specified by the powers of a fixed stochastic matrix with positive diagonal, which are well known to converge. The system is attracted to a fixed point at an exponential rate, but of course we have no a priori bound on the time it takes to fall into that basin of attraction. The communication network converges. 3.2 The higher-dimensional case Generalizing the previous argument to higher dimension fails on several counts, the most serious one being the loss of any left-right ordering. We follow a different tack, which 7 begins with a distinction between two types of agents. An agent is trapped at time t if there exists a path in the current communication graph leading to a closed-minded agent; it is said to be free otherwise. There exists a time to after which the agents fall into two categories: some of them are never trapped past t0 and are called eternally free; the others are chronically trapped (ie, trapped an infinite number of times). As we did before, we pick a parameter ε > 0 (to be specified below) and tε > to large enough so that no agent moves by a distance of more than ε at any time t ≥ tε . If two agents ever get to share the same position, their fates become completely tangled since they can never again get separated. Since such merges occur fewer than n times, we can make tε big enough, if necessary, so that all merges are in the past. To summarize, past tε , the mobile agents move by increments less than ε, no merging occurs, and the system consists only of eternally free and chronically trapped agents. At any time, the state system is represented by a n-by-d matrix whose i-th row encode the position of agent i in Rd . The matrix consists of two parts: x for the mobile agents and y for the closed-minded ones. A transition of the system is a linear map of the form x 7→ Ax + By, where each row of the nonnegative matrix (A | B) sums up to 1. Lemma 3.1. Past tε , no agent can move while free. Proof. Fix t ≥ tε and consider a connected component C of the graph induced by the free agents. If z denotes its position matrix at time t and k its number of rows, then z ′ = Cz, where primes refer to time t + 1 and C is a k-by-k stochastic matrix for a random walk in the undirected graph C. Because the graph is connected, the eigenvalue 1 of C is simple, so the null space of I − C, and hence of (I − C)T (I − C), is spanned by 1. By Courant-Fischer, therefore, any vector u normal to 1 satisfies k(I − C)uk2 ≥ σkuk2 , where σ is the smallest positive singular value of I − C. If we define z̄ = z − k1 11T z, it immediately follows that √ σkz̄k2 ≤ k(I − C)z̄k2 = k(I − C)zk2 = kz − z ′ k2 ≤ ε n. √ Setting ε < 12 σ/ n ensures that any two of the k agents are within unit distance. It follows that C is the complete graph and C = k1 11T . Since the agents can no longer merge, the only option left is for all k of them to be already merged at time t, hence unable to move.  The lemma implies that eternally free agents can never move again past tε . Indeed, it shows that an eternally free agent can only move if it is joined to a trapped one, which, by definition, it cannot be. Since eternal freedom keeps the agents from playing any role after time tε , we might as well assume that all the mobile agents in the system are chronically trapped. This means that, at all instants, either an agent is trapped (ie, joined to a closed-minded agent via a path) or it is isolated, meaning that the other agents are either merged with it or at distance greater than one. An agent cannot move while isolated. 8 The position matrix z of the k trapped agents at time t ≥ tε satisfies the relation z ′ = T z +Uy, where primes denote time t+1 and the k-by-n matrix (T | U) has each row summing up to 1. Being trapped implies that U is not the null matrix. In fact, viewed as a Markov chain, the trapped agents correspond to transient states, which means that T k tends to the null matrix as k goes to infinity. This shows that T cannot have 1 as an eigenvalue; therefore I − T is nonsingular. Let µ be a uniform upper bound on the singular values of all the (so-called fundamental) matrices (I − T )−1 ; since their number √ is finite, so is µ. Since z ′ = T z + Uy and kz ′ − zk2 ≤ ε n, the matrix z is very close to (I − T )−1 Uy; specifically, √ (3) kz − (I − T )−1 Uyk2 = k(I − T )−1 (z − z ′ )k2 ≤ µkz − z ′ k2 ≤ µε n. A matrix of the form (I − T )−1 Uy is called an anchor. Since the set of all possible anchors (for given y) is finite, the minimum (Frobenius-norm) distance r between any two distinct anchors is strictly positive. The value of r does not depend on ε, so √ we can always lower the value of the latter, if necessary, to ensure that r > (1 + 2µ)ε n. By (3) and Lemma 3.1, we know that, at any time √ t past tε , any mobile agent is either stuck in place (if free) or at distance at most µε n away from an anchor. As a result, no agent can change anchors since this would necessitate a one-step leap √ ever √ of at least r − 2µε n > ε n for the positional matrix, hence the displacement of an agent by a distance of at least ε, which has been ruled out. Since the argument holds for any ε small enough, each mobile agent is thus constrained to converge toward its chosen anchor. This concludes the proof that all agents converge to a fixed point in Rd . The convergence is asymptotic and no bound can be inferred directly from our analysis. The result does not imply that the communication network should also converge to a fixed graph. The lack of convergence points to a situation where the agents are still moving in increasingly small increments, yet edges of the network keep switching forever. This can only occur if at least one pair of anchor points are at distance 1: by anchor point, we mean the points formed by any row of an anchor matrix or of y. The key observation is that all the anchor points are convex combinations of the rows of y, so an interdistance of 1 is expressed by an equality of the form kv T yk2 = 1. There are only a finite set of such equalities to consider and each one denotes an algebraic surface of codimension 1. Any random perturbation of the closed-minded agents will result in the convergence of the communication network almost surely. This completes the proof of Theorem 1.2.  4 Anchored and Symmetric Heterogeneous HK Systems This section proves Theorem 1.3. We begin with a proof of the conjugacy between the two types of HK systems. 9 4.1 The bijection relation To express an anchored HK system z(t) = (xk (t), yk ) as a symmetric heterogeneous one is straightforward. We have the equivalence kzi (t) − zj (t)k22 ≤ r 2 ⇔ kxi (t) − xj (t)k22 ≤ r 2 − kyi − yj k22 . (4) p We define rij = r 2 − kyi − yj k22 if the right hand side of (4) is non-negative, and rij = −1 otherwise. Then the system xk (t) together with thresholds rij forms a symmetric heterogeneous HK system. Notice that the equivalence (4) ensures that the communication graphs of the given anchored HK system and its corresponding symmetric heterogeneous HK counterpart are identical. For the other direction, we need to lift the given symmetric heterogeneous HK system to an anchored HK version. We need the following lemma, whose proof can be found in the Appendix. Lemma 4.1. For any n-by-n symmetric matrix R = (rij ) with no negative terms in the diagonal, there exist r > 0 and vectors yk ∈ Rn−1 (1 ≤ k ≤ n), such that q kyi − yj k2 = r 2 − rij2 sign (rij ), (5) for any i 6= j; here sign (x) = 1 if x ≥ 0 and −1 otherwise. Given a symmetric heterogeneous HK system xk (t), we choose the anchors yk by appealing to Lemma 4.1. For any rij ≥ 0, it then follows that kxi (t) − xj (t)k22 ≤ rij2 ⇔ kxi (t) − xj (t)k22 + kyi − yj k22 ≤ r 2 , (6) and for any rij < 0, and we always have kxi (t) − xj (t)k22 + kyi − yj k22 > r 2 , (7) for any i 6= j, which prevents any edge between i and j. This means that the dynamics of the symmetric heterogenous HK system coincides precisely with that of the mobile part of the lifted anchored system. Remark: Lemma 4.1 asserts that, given (n − 1)n/2 lengths dij (i 6= j) of the form (r 2 − rij2 sign(rij ))1/2 , we can find n points yk ∈ Rn−1 such that the pairwise distance kyi − yj k2 = dij . Notice that, if dij itself is arbitrary, this is not always possible. For example, in the case n = 3, the problem is equivalent to finding a triangle in R2 with each side length given. The problem is solvable if and only if the three lengths satisfy the triangle inequality. In our case, however, there is an extra parameter r that we can use. Intuitively, if we choose a large r such that all the |rij | are relatively small, then the problem of finding yk is equivalent to finding an almost regular polytope, each edge of which is roughly of the same length r. 10 4.2 Proof of convergence The fixed-point attraction of symmetric heterogeneous HK systems can be inferred directly from known results about infinite products of type-symmetric stochastic matrices [6, 10, 13, 18]. The same holds of anchored systems. In both cases, given any ε > 0 and any initial condition, the n agents will eventually reach a ball of radius ε that they will never leave; we call this ε-convergence. We study the conditions for this to imply that the corresponding communication networks themselves converge to a fixed graph. It suffices to consider the case of a symmetric heterogeneous HK system. Consider a connected component C of the graph and let z and z ′ = Cz denote the corresponding position matrices at time t and t + 1, where C is the corresponding k-by-k stochastic matrix associated with C. As we did in the proof of Lemma 3.1, we define σ to be a uniform lower bound on any positive singular value of I − C for any such matrix C. Setting σ ε = √ min rij 2 n rij >0 implies that √ 1 nǫ 1 1 ′ ≤ min rij , kz̄k2 ≤ k(I − C)z̄k2 = kz − z k2 ≤ σ σ σ 2 rij >0 where z̄ = z − k1 11T z is the projection of z onto the orthogonal space of 1. It follows that, for any pair (i, j) in C such that rij > 0, there will be an edge between i and j. With the assumption rij 6= 0, the communication graph is now fixed and convergence proceeds at an exponential rate from that point on. The bijection result of the previous section shows that the condition rij = 0 corresponds to kyi − yj k2 = r in the case of anchored systems. This concludes the proof of Theorem 1.3.  References [1] Bhattacharyya, A., Braverman, M., Chazelle, B., Nguyen, H.L. On the convergence of the Hegselmann-Krause system, Proc. 4th ITCS (2013), 61–66. [2] Blondel, V.D., Hendrickx, J.M., Tsitsiklis, J.N. On the 2R conjecture for multiagent systems, Proc. European Control Conference 2007 (ECC 2007), July 2007, 874-881, Kos (Greece), 2007. [3] Blondel, V.D., Hendrickx, J.M., Tsitsiklis, J.N. On Krause’s multi-agent consensus model with state-dependent connectivity, IEEE Transactions on Automatic Control 54, 11 (2009), 2586–2597. 11 [4] Bullo, F., Cortés, J., Martinez, S., Distributed Control of Robotic Networks, Applied Mathematics Series, Princeton University Press, 2009. [5] Castellano, C., Fortunato, S., Loreto, V. Statistical physics of social dynamics, Rev. Mod. Phys. 81 (2009), 591–646. [6] Chazelle, B. The total s-energy of a multiagent system, SIAM J. Control Optim. 49 (2011), 1680–1706. [7] Chazelle, B. Diffusive influence systems, SIAM J. Comput. 44 (2015), 1403–1442 [8] Fagnani, F. Lecture, Foundations of Computational Mathematics Conference (FoCM’11), Budapest, Hungary, 2011. [9] Hegselmann, R., Krause, U. Opinion dynamics and bounded confidence models, analysis, and simulation, J. Artificial Societies and Social Simulation 5, 3 (2002). [10] Hendrickx, J.M., Blondel, V.D. Convergence of different linear and non-linear Vicsek models, Proc. 17th International Symposium on Mathematical Theory of Networks and Systems (MTNS2006), Kyoto (Japan), July 2006, 1229–1240. [11] Krause, U. A discrete nonlinear and non-autonomous model of consensus formation, Communications in Difference Equations (2000), 227–236. [12] Kurz, S., Rambau, J. On the Hegselmann-Krause conjecture in opinion dynamics, Journal of Difference Equations and Applications (2009). [13] Lorenz, J. A stabilization theorem for dynamics of continuous opinions, Physica A: Statistical Mechanics and its Applications 355 (2005), 217–223. [14] Lorenz, J. Continuous opinion dynamics under bounded confidence: a survey, International Journal of Modern Physics C 16 (2007), 1819–1838. [15] Lorenz, J. Bounds of confidence: Meet, discuss and find consensus!, Complexity, 4 (2010), 43–52. [16] Martinez, S., Bullo, F., Cortés, J., Frazzoli, E. On synchronous robotic networks Part ii: Time complexity of rendezvous and deployment algorithms, IEEE Transactions on Automatic Control 52 (2007), 2214–2226. [17] Mirtabatabaei A., Bullo, F. Opinion dynamics in heterogeneous networks: convergence conjectures and theorems, SIAM Journal on Control and Optimization, 50 (5):2763–2785, 2012. [18] Moreau, L. Stability of multiagent systems with time-dependent communication links, IEEE Transactions on Automatic Control 50 (2005), 169–182. 12 [19] Nedić, A., Touri, B., Multi-dimensional Hegselmann-Krause dynamics, Proceedings of the 51st IEEE Conference on Decision and Control (CDC), Maui, Hawaii, December 9-13, 2012, pp. 68-73. [20] Touri, B., Nedić, A. Discrete-time opinion dynamics, Proc. 45th IEEE Asilomar Conference on Signals, Systems, and Computers (2011), 1172–1176. [21] Guiyuan Fu, Weidong Zhang. Opinion Dynamics of Modified Hegselmann-Krause Model with Group-based Bounded Confidence, Proc. 19th World Congress of the International Federation of Automatic Control, Vol. 14, 2014. [22] Das, Abhimanyu, Sreenivas Gollapudi, and Kamesh Munagala. ”Modeling opinion dynamics in social networks.” Proceedings of the 7th ACM international conference on Web search and data mining. ACM, 2014. [23] Christakis, Nicholas A., and James H. Fowler. ”The collective dynamics of smoking in a large social network.” New England journal of medicine 358.21 (2008): 22492258. [24] Olfati-Saber, Reza, and Richard M. Murray. ”Consensus problems in networks of agents with switching topology and time-delays.” Automatic Control, IEEE Transactions on 49.9 (2004): 1520-1533. [25] Lorenz, Jan. ”Heterogeneous bounds of confidence: meet, discuss and find consensus!.” Complexity 15.4 (2010): 43-52. [26] Mirtabatabaei, Anahita, and Francesco Bullo. ”On opinion dynamics in heterogeneous networks.” American Control Conference (ACC), 2011. IEEE, 2011. [27] Etesami, Seyed Rasoul, and Tamer Basar. ”Game-theoretic analysis of the Hegselmann-Krause model for opinion dynamics in finite dimensions.” Automatic Control, IEEE Transactions on 60.7 (2015): 1886-1897. [28] Weisbuch, Gerard. ”Bounded confidence and social networks.” The European Physical Journal B-Condensed Matter and Complex Systems 38.2 (2004): 339-343. 13 Appendix Our proof of Lemma 4.1 relies on two technical facts. For convenience, we use bold letters to denote vectors; for example, uk denotes the k-th coordinate of vector u. Fact A. There exist n + 1 vectors u(k) ∈ Rn (0 ≤ k ≤ n) such that ku(i) − u(j) k2 = 1 √ (k) (k) (0 ≤ i < j ≤ n), ui = 0 for i > k ≥ 0 and all uk exceed 1/ 2 and decrease as k grows. √ Proof. Proceeding by induction, we write u(0) = 0, u(1) = e1 and u(2) = 12 e1 + 23 e2 , where ei is the unit vector in the i-th dimension. Assume we already constructed u(k) √ (k) (k) (0 ≤ k ≤ m < n) such that ui = 0 for i > k and uk > 1/ 2. Then we can write u(k) as k X (k) (k) u = ui ei , k = 1, 2, . . . , m. i=1 We define u (m+1) = m−1 X (m) ui ei + i=1 (m) √  (m) um − 1  (m) 2um em + s 1− Since um > 1/ 2, we have (m+1) um+1 > s 1− 1 em+1 . (m) 2 4 um 1 1 √ =√ . 2 4(1/ 2) 2 For k = 0, 1, . . . , m, (m) (k) (m) ku(m+1) − u(k) k22 = ku(m) − u(k) k22 + u(k) m /um = (1 − δkm ) + um /um = 1. Notice that, for 0 ≤ k < n, (k+1) 2 uk+1 − (k) 2 uk =  1− 1 (k) 2 4 uk which proves the monotonicity claim.  − (k) 2 uk  (k) = − uk − 1 (k) 2uk 2 ≤ 0, Fact B. For any integer n > 0, there is a positive number γ depending on n such that, for any tij satisfying |1 − tij | ≤ γ and tij = tji (0 ≤ i < j ≤ n), there exist vectors y (k) ∈ Rn (0 ≤ k ≤ n) such that ky (i) − y (j) k2 = tij , for 0 ≤ i < j ≤ n. Proof. We make repeated use of the matrix infinity norm. Recall that if M is a p-by-q matrix, its infinity norm is defined as the maximum absolute row sum of M: kMk∞ := max 1≤i≤p 14 q X j=1 |mij |. As one would expect of a matrix norm, the infinity norm is submultiplicative: kMNk∞ ≤ kMk∞ kNk∞ , for any p-by-q matrix M and q-by-r matrix N. We define a constant α = 5n + max kCk−1 k∞ , 1≤k≤n where Ck is the k-by-k matrix whose i-th row consists of the first k elements of the vector u(i) in Fact A. Note that Ck is lower-triangular and invertible. Let γ = α−4n . The intuition of the proof is that the vectors y (k) we are seeking should be close to the vectors u(k) . We build the desired vectors by induction. Let y (0) = 0 and y (1) = t01 e1 . Then it is obvious that ky (0) − y (1) k2 = t01 and y (0) and y (1) are close to the vectors from Fact A: ky (0) − u(0) k∞ = 0 < γ, ky (1) − u(1) k∞ = |t01 − 1| ≤ γ ≤ α4 γ. (j) Suppose y (0) , y (1) , . . . , y (k−1) have been specified such that yi = 0 for i > j, ky (i) − u(i) k∞ ≤ α4i γ (0 ≤ i ≤ k − 1), (8) and ky (i) − y (j) k2 = tij (0 ≤ i < j ≤ k − 1). (k) We need to show is that there exists a vector y (k) such that yi = 0 for i > k, ky (k) − u(k) k∞ ≤ α4k γ (9) and ky (k) − y (i) k2 = tik This last relation is equivalent to i X j=1 (k) yj − (i) 2 yj + k X (0 ≤ i ≤ k − 1). (k) 2 yj j=i+1 = t2ik (10) (0 ≤ i ≤ k − 1). (11) By subtracting the equations for 1 ≤ i ≤ k − 1 from the one for i = 0, we get a linear (k) (k) (k) system for ŷ := (y1 , y2 , . . . , yk−1)T : Aŷ = b. (i) Here the (k − 1) × (k − 1) matrix A is a lower triangular matrix where Aij = yj (i ≥ j) and b is a (k − 1) dimensional column vector where i X (i) 2  1 2 bi = t0k − t2ik + yj . 2 j=1 15 We derive similar relations from Fact A: i X (k) uj j=1 − (i) 2 uj + k X (k) 2 uj j=i+1 (k) =1 (k) (0 ≤ i ≤ k − 1), (12) (k) which implies a linear system for û := (u1 , u2 , . . . , uk−1)T : C û = d, P (i) 2 where C is shorthand for Ck−1 and di = 12 ij=1 uj . We already observed that C is √ (i) nonsingular; we note that, by (8) and ui > 1/ 2, the same is true of A. Next, we derive upper bounds on the length of the vector b and its distance from d. By |1 − tij | ≤ γ and γ < 1/2, |t20k − t2ik | = |t0k + tik ||t0k − tik | ≤ (2 + 2γ) · 2γ < 6γ. (13) (i) By our induction hypothesis (8), the fact that |yj | ≤ 1 + γ, and the definition of γ, we have (i) 2 (i) 2 (i) (i) (i) (i) yj − uj = |yj + uj ||yj − uj | ≤ (2 + α4i γ) · α4i γ < 3α4(k−1) γ. (14) Thus, by (13, 14), kb − dk∞ ≤ 3(1 + nα4(k−1) /2)γ. By inequality (13) and the fact that γ is small enough, we have  1 1 max |t20k − t2ik | + max ky (i) k22 < (6γ + (1 + γ)2 ) < 1. kbk∞ ≤ 1≤i≤k 2 1≤i≤k 2 (15) (16) We also claim that kA−1 − C −1 k∞ ≤ 2nα4k−2 γ. (17) kC −1 (A − C)k∞ ≤ kC −1 k∞ kA − Ck∞ < nα4k−3 γ. (18) Here is why. First, notice that (8) implies kA − Ck∞ ≤ nα4(k−1) γ. Then based on the definition of α, we have kC −1 k∞ < α, and hence The right hand side of the above inequality is smaller than 1/2 based on the definition of γ, which allows us to expand the matrix inverse [I + C −1 (A − C)]−1 as [I + C −1 (A − C)] −1 =I+ ∞ X i=0 (−1)i [C −1 (A − C)]i , from which it follows that k[I + C −1 (A − C)]−1 k∞ ≤ 2. 16 (19) Notice that A−1 − C −1 = [I + C −1 (A − C)]−1 C −1 (C − A)C −1 , then inequality (17) directly follows from inequalities (18) and (19). By (15, 16, 17) and the fact that kC −1 k∞ < α, finally we have kŷ − ûk∞ = = ≤ ≤ This shows that kA−1 b − C −1 dk∞ k(A−1 − C −1 )b + C −1 (b − d)k∞ k(A−1 − C −1 )k∞ kbk∞ + kC −1 k∞ k(b − d)k∞ 2nα4k−2 γ + 3(1 + nα4(k−1) /2)αγ < α4k−1 γ. (k) (k) |yj − uj | ≤ α4k−1 γ (1 ≤ j ≤ k − 1). In turn, this implies that (k) 2 (k) 2 (k) (k) (k) (k) yj − uj = |yj + uj ||yj − uj | < (2 + α4k−1 γ)α4k−1 γ < 3α4k−1γ. (20) (21) It suffices now to set the remaining (nonzero) coordinate of y (k) yet to be specified, (k) which is yk . Recall that it must satisfy k X j=1 (k) 2 yj = t20,k and, by our construction, this single equality suffices to imply all of (10). This implies a (k) unique setting of (positive) yk , so we need only be concerned with (9) and the positivity  (k) 2 of yk . Since |1 − t20k | = |1 − t0k ||1 + t0k | ≤ γ(2 + γ) < 3γ, inequality (12) for i = 0, combined with (14), establishes that (k) 2 yk (k) 2 − uk ≤ k−1 X i=1 (k) 2 yi (k) 2 − ui + |1 − t20k | ≤ 3(1 + nα4k−1 )γ. √ Since > 1/ 2, it follows that 1 (k) 2 > − 3(1 + nα4k−1 )γ > 0. yk 2 Furthermore, (k) 2 (k) 2 √ − uk yk (k) (k) ≤ 3 2(1 + nα4k−1 )γ < α4k γ. |yk − uk | = (k) (k) yk + uk (k) uk (22) In conjunction with (20), this establishes (9), and completes the inductive construction.  It should be noted that Fact B can also be proven via the implicit function theorem and a perturbation argument based on Fact A. The benefit of the proof given above is to provide an explicit construction. 17 Lemma 4.1 For any n-by-n symmetric matrix R = (rij ) with no negative terms in the diagonal, there exist r > 0 and vectors yk ∈ Rn−1 (1 ≤ k ≤ n), such that q kyi − yj k2 = r 2 − rij2 sign (rij ), (23) for any i 6= j; here sign (x) = 1 if x ≥ 0 and −1 otherwise. Proof. Choose a sufficiently large r such that max |rij | < γr, i,j where γ is the small positive constant from Fact B. We set tij to q 1 − rij2 sign(rij )/r 2 and easily verify that |1 − tij | ≤ γ. Fact B guarantees the existence of vectors zk ∈ Rn−1 (1 ≤ k ≤ n) such that kzi − zj k2 = tij . Setting yk = rzk satisfies the requirements.  18
3cs.SY
TUE-AF-PO2.10 1 STEAM: A Hierarchical Co-Simulation Framework for Superconducting Accelerator Magnet Circuits arXiv:1801.08957v1 [physics.acc-ph] 26 Jan 2018 L. Bortot, B. Auchmann, I. Cortes Garcia, A.M. Fernandez Navarro, M. Maciejewski, M. Mentink, M. Prioli, E. Ravaioli, S. Schöps, and A.P. Verweij Abstract—Simulating the transient effects occurring in superconducting accelerator magnet circuits requires including the mutual electro-thermo-dynamic interaction among the circuit elements, such as power converters, magnets, and protection systems. Nevertheless, the numerical analysis is traditionally done separately for each element in the circuit, leading to possible non-consistent results. We present STEAM, a hierarchical cosimulation framework featuring the waveform relaxation method. The framework simulates a complex system as a composition of simpler, independent models that exchange information. The convergence of the coupling algorithm ensures the consistency of the solution. The modularity of the framework allows integrating models developed with both proprietary and in-house tools. The framework implements a user-customizable hierarchical algorithm to schedule how models participate to the co-simulation, for the purpose of using computational resources efficiently. As a case study, a quench scenario is co-simulated for the inner triplet circuit for the High Luminosity upgrade of the LHC at CERN. Index Terms—Superconducting accelerator magnet; cosimulation; field-circuit coupling; finite element analysis; quench; circuit modelling; CLIQ; Large Hadron Collider. I. I NTRODUCTION Circuits consisting of superconducting accelerator magnets are complex systems that integrate components and technologies belonging to heterogeneous fields of engineering. Each component is coupled with the others, showing mutual interactions. Due to the physical size of the circuit of up to several kilometres, the number of components, and the variety of possible dynamic effects, the simulation of such a system is intrinsically a multi-physics, multi-scale, and multi-rate problem. In particular, this holds in case of a quench: quench heaters (QH) [1] or the recently developed Coupling-Loss Induced Quench system (CLIQ) [2] cause transient effects that propagate through the circuit [3], interacting with the magnets, the power converters and the protection electronics. Simulations are crucial for understanding the transient phenomena occurring within superconducting accelerator magnet L. Bortot, M. Prioli, A.M. Fernandez Navarro, M. Mentink and A.P. Verweij are with CERN, Switzerland (e-mail: [email protected]). B.Auchmann is with CERN, Switzerland, and with Paul Scherrer Institute, 5232 Villigen PSI, Switzerland. M. Maciejewski is with CERN, Switzerland, and with Institute of Automatic Control, Technical University of Łódź, 18/22 Stefanowskiego St., Poland. I.C. Garcia and S. Schöps are with Technische Universität Darmstadt, Karolinenpl. 5, 64289 Darmstadt, Germany. E. Ravaioli is with the Lawrence Berkeley National Laboratory, Berkeley, CA 94720 USA. The authors I. Cortes Garcia and S. Schöps have been supported by the Excellence Initiative of the German Federal and State Governments and the Graduate School of CE at TU Darmstadt. Figure 1: MQXF cross-section (left), and magnetic flux density field at nominal current (right). circuits. Numerical methods are widely used in the analysis of both the magnets and the quench protection systems, bringing insights on the quench behaviour and contributing to prevent potentially irreversible consequences. Nevertheless, the currently available high-performance tools cannot capture within one model all the phenomena occurring in an accelerator magnet circuit. Therefore, the system is traditionally decomposed in component-specific models, refined by expert know-how. As a consequence, consistent results are achieved only if all the models’ mutual influences are correctly taken into account, with a proper two-way coupling strategy. These considerations led to the development of STEAM, a co-simulation framework [4]–[7] implemented in Java. The key features are a communication bus and a user-customizable hierarchical algorithm. The former exchanges information between multiple models, the latter schedules how the models participate to the co-simulation, solving them only when needed for the accuracy of solution. The coupling of the models occurs via a dedicated algorithm implementing the waveform relaxation method [8]. The convergence of the coupling algorithm ensures the consistency of the solution. The framework architecture is expandable and can support both proprietary and in-house tools. In this paper we introduce the core algorithms and the architecture of the framework. Then a case-study illustrates the decomposition of the system, the choice of the solvers, and the hierarchical organization of the models. The case-study assumes a quench occurring in one of the Nb3 Sn quadrupole magnets (MQXF) [9] (see Fig. 1) belonging to the future inner triplet circuit for the High Luminosity upgrade of the LHC at CERN [10]. The relevance of achieving consistent simulations is discussed in the results section. c 2017 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. TUE-AF-PO2.10 2 II. F RAMEWORK I MPLEMENTATION The hierarchical co-simulation approach turns the analysis of a circuit of accelerator magnets into a coupled problem [11]. The complexity of the original system is represented through a composition of simpler models. The waveform relaxation method [7] is applied to resolve the mutual dependencies between the models, with the following algorithm. i) The overall simulation time is divided into windows. ii) Within a window, the models are solved and the relevant waveforms are exchanged, following a Gauss-Seidel scheme [12]. iii) The previous operation is repeated for the same window until the waveforms belonging to two consecutive iterations differ by less than a prescribed tolerance, then the algorithm moves to the next window. The convergence of the algorithm for every window ensures the consistency of the overall solution [13]. A. Architecture The STEAM framework is developed on a three-layer, scalable and expandable structure (see Fig. 2) [14]: 1) The top layer contains the hierarchical co-simulation algorithm implementing the waveform relaxation method. The functionalities of the layer are to manage the execution of the models over the simulation time windows, to check the waveform relaxation convergence and to provide the necessary input/output interfaces. 2) The middle layer exchanges information between the models that participate to the co-simulation. The layer is composed by a communication bus which expects a specific communication protocol. The bus can handle both time- and space-dependent signals. For the latter ones, the MpCCI [15] mesh-based interpolation tool is in use [16]. 3) The bottom layer implements a modular structure, composed by blocks called tool adapters. Each adapter exchanges signals between the communication bus and the models belonging to a tool via a suitable Application Programming Interface (API), which is tool-dependent. This ensures that different models developed within the same tool rely on the same tool adapter. The architecture is scalable and expandable: new simulation tools can be interfaced with the framework by developing the dedicated tool adapters. B. Hierarchy The transient phenomena characterizing a circuit of accelerator magnets might occur at different times, with different durations. If these phenomena are distributed among separated multiphysical models, then possibly not all the models are necessary during the full co-simulation timespan. This observation justifies the introduction of a hierarchical state-machine algorithm for the models’ management. Referring to Fig. 3, the user defines both the states and the transitions of the system. The simulation time is separated into states, and the subset of active models are determined for each state. A transition can be defined by a fixed time, or a conditional expression dependent on the waveforms exchanged among the models. The benefit is twofold: the state machine input explicitly determines the causality relations existing between the models, and the overall computational cost is reduced. Figure 2: Framework architecture. A generic coupled problem is decomposed in n models developed with k different tools. Figure 3: Hierarchical organization of the n models representing a time-dependent coupled problem, in m states. III. C ASE S TUDY As an example, STEAM is used for analysing a quench scenario of the future inner triplet circuit for the High Luminosity LHC. The circuit powering scheme requires three power supply units (see Fig. 4): a main one (PSM) on the outer current loop and two trim units (PST1, PST2) located in nested current loops. Moreover, the system contains nonlinear bypass components such as flywheel diodes and crowbars, and six newly designed Nb3 Sn magnets Q1a , Q1b , Q2a , Q2b , Q3a , Q3b . The magnets are protected by a combination of QHs and CLIQ units, with the latter ones connected over single and multiple magnets [17]. Furthermore, the circuit protection strategy requires the simultaneous intervention of the protection systems for all the magnets, in case of a quench. As a consequence, the mutual dependencies between the system components justify the co-simulation approach for the numerical analysis of the scenario. In the case study, the current in the circuit is rampedup to nominal conditions, with IPSM = 16.47 kA, and IPST1 = IPST2 = −2 kA. Subsequently, one of the high-field turns of Q2a is assumed to quench. The longitudinal propagation of the quench within the conductor and the steadily increasing temperature result in a growing resistive voltage. At a certain moment the quench is detected: the power converters are then switched off, the crowbars are activated and the TUE-AF-PO2.10 3 Figure 4: Inner triplet circuit. the system decomposition and the choice of the tools are highlighted. simulated with a dedicated 1D adiabatic model, due to the local nature of the quench initiation and propagation. Since the heat propagation between adjacent turns is neglected, the model provides conservative results; 2) The quadrupole magnets are represented by individual models simulating the magnetothermal transient induced by the action of the protection systems; 3) The network (see Fig. 4) provides the electrical coupling between all the components in the circuit. Each component is included in the network using an equivalent lumped-parameters representation. An additional a Java code simulates the quench detection signals associated to each magnet (Sec. IV). B. Choice of tools Figure 5: Transient phenomena occurring in a generic superconducting accelerator circuit, represented in a time-scale reference frame. quench protection systems of the magnets are triggered. In order to give generality to the method, a malfunction in the QHs of Q2a is assumed. A. System decomposition The inner triplet system decomposition is tailored to capture only the transient phenomena which are relevant for the given quench scenario (see Fig. 5). In particular, the study focuses on simulating the initial quench propagation, the magnetothermal dynamics of the magnets and the electrical behaviour of the network. Nevertheless, the system decomposition can be refined with more dedicated models, to include other devices and physical phenomena. As an example, one can include the thermal behaviour of the bypass diodes, the action of the digital controllers of the power converters [18], or the mechanical response of the magnets [16]. The system is partitioned in three sub-units (see Fig. 4): the magnet turn where the initial quench occurs, the magnets and the remaining network. 1) The quenching turn is As a consequence of the system decomposition, each model covers only a subset of transient phenomena. At this point, the most suitable simulation tools are determined for each subset. 1) A SPICE [19] tool is used to calculate the currents and voltages of the inner triplet equivalent network. The proprietary distribution PSpicer [20] has been used, although the freeware version LTspice [21] is also supported; 2) The finite-element (FE) proprietary tool COMSOLr [22] is used to calculate the quench initiation and propagation, and the consequent resistive voltage; 3) Q2a is represented with a COMSOLr magnetothermal model, which implementation details are described in [23]. The FEM method is chosen for providing a detailed analysis of the quenching magnet. The 2D representation is justified due the large length/diameter ratio of the coils, and the uniform energy deposition along the coils by means of CLIQ; 4) The other magnets are modelled using LEDET [2], [24]. In particular, the magnetothermal formulation is implemented using equivalent networks of lumped elements which solve faster in comparison to the FE model. C. Hierarchical organization of the models The models are organized in a hierarchical structure, reflecting the different system’s states during the co-simulation (see Fig. 6). At t0 the circuit is powered: only the network solver is required to ramp up the circuit to nominal operation conditions. At tquench the quench is introduced and the 1D TUE-AF-PO2.10 4 (a) (b) Figure 6: Hierarchical organization of the models, as function of the simulation time. (c) 40 tquench tdetection tdischarge T (K) 30 20 10 0 0 0.1 0.2 0.3 0.4 0.5 x (m) (d) 0.2 VR tquench tdetection tdischarge VR (V) 0.15 0.1 0.05 0 -50 -40 -30 -20 -10 0 10 t (ms) Figure 7: Top: temperature profile along the quenching turn, during the quench propagation. Bottom: Evolution of the associated resistive voltage. model is activated. The resistive voltage grows until it is detected, at tdischarge . At this point the 1D model is disabled. The dynamics of the circuit is determined by the action of the quench protection systems on the quadrupole magnets. For this reason, the dedicated 2D MQXF models are enabled and kept active until tend , when the energy in the circuit is completely discharged. IV. R ESULTS The results focus on the dissipation of the energy stored in the circuit after tquench . Firstly, the magnetothermal transient occurring in Q2a is discussed in detail. Next, two magnetnetwork coupling strategies are applied, the former based on an equivalent thermal representation and the latter on the fieldcircuit coupling technique. Lastly, the results given by the two coupling strategies are compared. The magnet Q2a is assumed to quench at tquench (Fig. 7, top), developing a resistive voltage contribution VR (Fig. 7, bottom). The normal zone propagates along the turn until the quench detection threshold (VR > 100 mV) is reached, at Figure 8: (a) Voltage-to-ground distribution, 5 ms after tdischarge . (b) Inter-filament and inter-strand coupling losses, 5 ms after tdischarge . (c) Ohmic losses, 25 ms after tdischarge . (d) Temperature distribution, 500 ms after tdischarge . tdetection . Subsequently, a validation criterion is applied to VR , requiring the resistive voltage signal to exceed a threshold of 100 mV for 10 ms. Once the quench is validated, the protection systems are activated at tdischarge . The 1000 V / 40 mF CLIQ unit is discharged in parallel to the Q2a coil poles. This induces a voltage redistribution (Fig. 8a), turning into an imbalance in the poles currents which oscillate due to the resonance between the inductive and capacitive behaviour of the magnet and CLIQ unit, respectively. The oscillation of the magnetic field determines the dissipation within the coil of the energy stored in the CLIQ unit, as inter-filament and inter-strand (Fig. 8b) coupling currents [25], [26]. The energy deposition determines the quench of a bigger volume of the coil, which becomes resistive and contributes both to the discharge of the magnet through the dissipation of Joule losses (Fig. 8c), and to a temperature increase in the coil (Fig. 8d). The computational time of the co-simulation is about 5h, on a standard workstation. The magnets’ internal dynamics imposes the equivalent impedances seen by the network. The network, in turn, determines the currents driving the magnets’ dynamics. Hence, a reliable quench protection simulation requires a consistent TUE-AF-PO2.10 (a) 5 and a lower Joule integral (MIITs). This is reflected both in Fig. 9b) where the hot-spot temperature decrease by 42 K, and in Fig. 9c), where the peak voltage to ground decrease by 15 V. A summary of the comparison is provided in Tab. I, showing an overall reduction in the estimation of the magnet stress parameters. 20 I (kA) 15 10 5 I Q2a CSTh I Q2a CSMTh ICLIQ CSTh ICLIQ CSMTh Table I: Comparison of results 0 Quantity 100 MIITs THotspot VPeakGnd 101 102 103 t (ms) (b) Unit CSTh CSMTh ∆ ∆% MA2 s K V 27 253 935 24 211 920 -3 -42 -15 -9 -16 -2 300 250 Thot−spot CSTh Thot−spot CSMTh V. C ONCLUSIONS AND OUTLOOK T (K) 200 150 100 50 0 100 101 102 103 102 103 t (ms) (c) 1 VPeak CSTh VPeak CSMTh V (kV) 0.5 0 -0.5 -1 100 101 t (ms) Figure 9: Q2a magnet. (a) Currents in the coil and in the CLIQ unit; (b) Hot-spot temperature; (c) Maximum and minimum voltage to ground. two-way coupling between the magnets and the circuit. To prove this, a comparison is provided. In the co-simulation CSTh , each magnet is represented in the network as a linear inductor in series with a time varying resistor. Such a simplification takes into account the thermal response of the magnet but neglects both the saturation and the dynamic phenomena in the superconducting coils. In the co-simulation CSMTh , the dynamics of each magnet is consistently represented using the field-circuit coupling technique [7], [27], [28]. The currents for Q2a and the related CLIQ unit are shown in Fig. 9a), for both the co-simulations. The coil dynamics greatly reduces the magnet’s differential inductance, determining steeper initial derivatives in the currents of CSMTh . This, in turn, causes a higher deposition of dynamic losses, a more homogeneous spread of the quench, a faster current decay The role of simulations is twofold. On the one hand, numerical methods provide support to the design of both circuit components and quench protections systems. On the other hand, they bring insights to the transient phenomena occurring in superconducting accelerator magnet circuits, even for quantities that cannot be measured. This holds true for the high-performance, low-margin inner triplet circuit for the LHC High Luminosity upgrade. The design requires accurate simulations, due to the mutual electro-thermal coupling occurring among the magnets, the quench protection systems and the rest of the network. Simulating such a complex system in a single tool with high accuracy is currently not feasible. For this reason, we propose STEAM, a Java-developed framework which allows to decompose the original system into simpler, independent models solved consistently, as a coupled problem. The hierarchical algorithm ensures an efficient use of computational resources, enforcing the models to be solved only for the simulation time span where they contribute to the accuracy of the solution. The framework architecture is scalable and expandable, giving the possibility to add further proprietary and in-house solvers in the future. A quench protection scenario in the inner triplet circuit is used as a case study, to illustrate the co-simulation approach. Results remark the importance of taking into account the mutual influences between the sub-units in the circuit, in a consistent way. The analysis of the magnets’ dynamics is improved, leading to less conservative results: welcomed margins are highlighted in the baseline design of the high-performance MQXF magnets. STEAM is actively supporting the simulation needs of the most demanding accelerator projects [29]–[32]. The framework is ready to be extended to new modules and tools, to cover more simulation needs: examples are the QHs dynamics, the mechanical response of the magnet coils, the 3D quench propagation, and the fluid dynamics of the coolant. VI. ACKNOWLEDGEMENT The authors would like to thank K. Król, and J.C. Garnier from CERN for the continuous help provided in developing the STEAM Framework, and S. Yammine from CERN for the support in the development of the inner triplet PSpice model. TUE-AF-PO2.10 6 R EFERENCES [1] F. Rodriguez-Mateos and F. Sonnemann, “Quench heater studies for the LHC magnets,” in Particle Accelerator Conference, 2001. PAC 2001. Proceedings of the 2001, vol. 5. IEEE, 2001, pp. 3451–3453. [2] E. Ravaioli, “CLIQ. A new quench protection technology for superconducting magnets,” Ph.D. dissertation, Universiteit Twente, 2015. [3] E. Ravaioli, K. Dahlerup-Petersen, F. Formenti, V. Montabonnet, M. Pojer, R. Schmidt, A. Siemko, M. S. Camillocci, J. Steckert, H. Thiesen et al., “Impact of the voltage transients after a fast power abort on the quench detection system in the LHC main dipole chain,” IEEE Transactions on Applied Superconductivity, vol. 22, no. 3, pp. 9 002 504– 9 002 504, 2012. [4] F. Henrotte, E. Lange, and K. Hameyer, “An efficient field-circuit coupling method by a dynamic lumped parameter reduction of the FE model,” in Power Electronics and Motion Control Conference, 2008. EPE-PEMC 2008. 13th. IEEE, 2008, pp. 2393–2399. [5] E. Lange, F. Henrotte, and K. Hameyer, “An efficient field-circuit coupling based on a temporary linearization of FE electrical machine models,” IEEE Transactions on Magnetics, vol. 45, no. 3, pp. 1258– 1261, 2009. [6] P. Zhou, D. Lin, W. Fu, B. Ionescu, and Z. Cendes, “A general cosimulation approach for coupled field-circuit problems,” IEEE transactions on magnetics, vol. 42, no. 4, pp. 1051–1054, 2006. [7] S. Schops, H. De Gersem, and A. Bartel, “A cosimulation framework for multirate time integration of field/circuit coupled problems,” IEEE Trans. Magn., vol. 46, no. 8, pp. 3233–3236, 2010. [8] J. K. White and A. Sangiovanni-Vincentelli, “Waveform relaxation,” in Relaxation Techniques for the Simulation of VLSI Circuits. Springer, 1987, pp. 79–100. [9] P. Ferracin, G. Ambrosio, M. Anerella, A. Ballarino, H. Bajas, M. Bajko, B. Bordini, R. Bossert, D. Cheng, D. Dietderich et al., “Development of MQXF: The Nb3 Sn Low-β Quadrupole for the HiLumi LHC,” IEEE Transactions on Applied Superconductivity, vol. 26, no. 4, pp. 1–7, 2016. [10] H. L. Collaboration et al., “HL-LHC Preliminary Design Report,” FP7 High Luminosity Large Hadron Collider Design Study, CERN-ACC2014, vol. 300, 2014. [11] K. Park and C. A. Felippa, “Partitioned analysis of coupled systems,” Computational Methods for Transient Analysis, vol. 1, pp. 157–219, 1983. [12] K. Burrage, Parallel and sequential methods for ordinary differential equations. Clarendon Press, Oxford, 1995. [13] A. Bartel, M. Brunk, M. Günther, and S. Schöps, “Dynamic iteration for coupled problems of electric circuits and distributed devices,” SIAM Journal on Scientific Computing, vol. 35, no. 2, pp. B315–B335, 2013. [14] M. Maciejewski, B. Auchmann, L. Bortot, I. Cortes Garcia, A. M. Fernandez Navarro, M. Prioli, S. Schöps, and A. P. Verweij, “Architecture of a Hierarchical Co-Simulation Framework for the Simulation of Transient Effects in Superconducting Accelerator Circuits,” Under preparation. [15] R. Ahrem, M. Hackenberg, P. Post, R. Redler, and J. Roggenbuck, “MpCCI-Mesh Based Parallel Code Coupling Interface,” Institute for Algorithms and Scientific Computing (SCAI), GMD, http://www. mpcci. org, 2000. [16] M. Maciejewski, B. Auchmann, L. Bortot, I. Cortes Garcia, A. M. Fernandez Navarro, M. Prioli, S. Schöps, and A. P. Verweij, “Coupling of Magneto-Thermal and Mechanical Superconducting Magnet Models by Means of Mesh-Based Interpolation„” IEEE Transactions on Applied Superconductivity, vol. 28, no. 3, 2018, accepted for publication. [17] E. Ravaioli, G. Ambrosio, B. Auchmann, P. Ferracin, M. Maciejewski, F. Rodriguez-Mateos, G. Sabbi, E. Todesco, and A. P. Verweij, “Quench protection system optimization for the High Luminosity LHC Nb3 Sn [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] quadrupoles,” IEEE Transactions on Applied Superconductivity, vol. 27, no. 4, pp. 1–7, 2017. M. Maciejewski, I. C. Garcia, S. Schöps, B. Auchmann, L. Bortot, M. Prioli, and A. Verweij, “Application of the Waveform Relaxation Technique to the Co-Simulation of Power Converter Controller and Electrical Circuit Models,” in 22nd International Conference on Methods and Models in Automation and Robotics (MMAR 2017), Miedzyzdroje, Poland, accepted for publication, 2017. A. Vladimirescu, The SPICE book. John Wiley & Sons, Inc., 1994. OrCAD, PSpice 17.2, [CD-ROM]. San Jose, CA: Cadence Design Systems Inc., 2017. M. Engelhardt, “Ltspice iv,” Linear Technology Corporation, Sept, 2011. [Online]. Available: http://www.linear.com/designtools/software/ #LTspice.[Accessed:Nov.01,2017]. COMSOL, COMSOL Multiphysics, v. 5.2, [CD-ROM]. Stockholm, Sweden: COMSOL AB, 2017. L. Bortot, B. Auchmann, I. Cortes Garcia, A. M. Fernandez Navarro, M. Maciejewski, M. Prioli, S. Schöps, and A. P. Verweij, “A 2-D FiniteElement Model for Electro-Thermal Transients in Accelerator Magnets,” IEEE Transactions on Mangetics, vol. 54, no. 3, 2018, accepted for publication. E. Ravaioli, B. Auchmann, M. Maciejewski, H. ten Kate, and A. Verweij, “Lumped-element dynamic electro-thermal model of a superconducting magnet,” Cryogenics, vol. 80, pp. 346–356, 2016. M. N. Wilson, Superconducting magnets. Clarendon Press, Oxford, 1983. A. P. Verweij, “Electrodynamics of superconducting cables in accelerator magnets,” Ph.D. dissertation, Universiteit Twente, 1995. I. C. Garcia, S. Schops, M. Maciejewski, L. Bortot, M. Prioli, B. Auchmann, and A. P. Verweij, “Optimized field/circuit coupling for the simulation of quenches in superconducting magnets,” IEEE Journal on Multiscale and Multiphysics Computational Techniques, vol. 2, pp. 97– 104, May 2017. L. Bortot, M. Maciejewski, M. Prioli, A. M. F. Navarro, J. B. Ghini, B. Auchmann, and A. P. Verweij, “A consistent simulation of electrothermal transients in accelerator circuits,” IEEE Transactions on Applied Superconductivity, vol. 27, no. 4, pp. 1–5, 2017. M. Valette, L. Bortot, A. Fernandez Navarro, B. Lindstrom, R. Schmidt, A. Verweij, and D. Wollmann, “Effect of Quench Heater and CLIQ Firing on the Circulating HL-LHC Beam,” in 8th Int. Particle Accelerator Conf.(IPAC’17), Copenhagen, Denmark, 14 - 19 May, 2017. JACOW, Geneva, Switzerland, 2017, pp. 2101–2104. A. M. Fernandez Navarro, M. Maciejewski, A. P. Verweij, L. Bortot, M. Mentink, M. Prioli, B. Auchmann, S. Izquierdo Bermudez, E. Ravaioli, and S. Yammine, “Simulation of a Quench Event in the Reconfigured LHC Main Dipole Circuit Including the 11 T Magnets for the High-Luminosity Upgrade,” IEEE Transactions on Applied Superconductivity, vol. 28, no. 4, 2018, under review. M. Prioli, T. Salmi, B. Auchmann, L. Bortot, M. Maciejewski, M. Mentink, E. Ravaioli, A. Stenvall, and A. Verweij, “Strategies to reduce the voltage to ground in the FCC main dipole circuits,” in Contribution submitted to the FCC Week 2017 Conference , Berlin, Germany, 29 May - 2 June, 2017. [Online]. Available: https://indico.cern.ch/event/556692/ M. Mentink, T. M. Salmi, M. Prioli, J. Zhao, and C. Lorin, “Magnet quench protection of the FCC-hh 16 T block-type dipole magnet by means of quench absorption coils,” in Contribution submitted to the 25th International Conference on Magnets Technology (MT25), August 26 - September 1, 2017, Amsterdam, The Netherlands. [Online]. Available: https://indico.cern.ch/event/445667/contributions/2563167/
5cs.CE
SINGLE STREAM PARALLELIZATION OF GENERALIZED LSTM-LIKE RNNS ON A GPU Kyuyeon Hwang and Wonyong Sung arXiv:1503.02852v1 [cs.NE] 10 Mar 2015 Department of Electrical and Computer Engineering Seoul National University Seoul 151-744, South Korea Email: [email protected], [email protected] ABSTRACT Recurrent neural networks (RNNs) have shown outstanding performance on processing sequence data. However, they suffer from long training time, which demands parallel implementations of the training procedure. Parallelization of the training algorithms for RNNs are very challenging because internal recurrent paths form dependencies between two different time frames. In this paper, we first propose a generalized graph-based RNN structure that covers the most popular long short-term memory (LSTM) network. Then, we present a parallelization approach that automatically explores parallelisms of arbitrary RNNs by analyzing the graph structure. The experimental results show that the proposed approach shows great speed-up even with a single training stream, and further accelerates the training when combined with multiple parallel training streams. Index Terms— Recurrent neural network (RNN), long shortterm memory (LSTM), generalization, parallelization, graphics processing unit (GPU) 1. INTRODUCTION Deep neural networks have shown quite impressive performances in several pattern recognition applications [1, 2]. Among the deep neural networks, the feed-forward networks are suitable for processing input data with a fixed length, and they are usually used for image and phoneme recognition. On the other hand, recurrent neural networks (RNNs) employ feedback inside, and they are suitable for processing input data whose dimension is not fixed or limited. For example, automatic speech recognition (ASR) systems can perform better with an RNN-based language modeling [3]. Since RNNs contain feed-back loops inside, the past input can be memorized and affect the current output. If RNNs are properly trained, it is possible to compress the input history effectively and yield good results even when there are considerable time delays between the input and output. Especially, the long short-term memory (LSTM) RNN is known to solve the problems with long time lag very successfully [4]. However, the LSTM RNN employs a very complex component known to be the memory block. It demands much effort even for slight modification of the structure because of the difficulty in deriving the corresponding training equation. Thus, it is needed to develop a generalized RNN structure that can be modified easily while representing LSTM networks perfectly. Previously, a generalized This work was supported in part by the Brain Korea 21 Plus Project and the National Research Foundation of Korea (NRF) grants funded by the Ministry of Education, Science and Technology (MEST), Republic of Korea (No. 2012R1A2A2A06047297). LSTM-like RNN structure with real-time recurrent learning (RTRL) [5] was proposed in [6] with special gated connections. However, we propose a much more general structure by introducing multiplicative layers and delayed connections. Also, we derive a backpropagation through time (BPTT) [7] based training algorithm for our RNN structure, which is generally more flexible than the RTRL-based one. RNNs also demand very long training time, thus implementation with GPUs or multiprocessors is needed. However, parallelization of the network is difficult due to dependency induced by the internal feedback loops. The conventional approach uses independent multiple training streams that employs plural copies of the network [8]. However, this inter-stream parallelism demands huge memory, which is a serious bottleneck for GPU based implementations. In this paper, we propose a parallelization approach as well as the generalized RNN structure. For this purpose, we first develop training algorithms for the generalized RNNs. The training equations of conventional LSTM can be perfectly represented with the generalized equations. Then, the parallelization approach exposes single-stream parallelization (intra-stream parallelism) that does not increase the size of mini-batches as the conventional multi-stream parallelization (inter-stream parallelism). Experimental results show that further speed-up can be achieved by combining the two parallelism. This paper is organized as follows. The generalized LSTM-like RNN structure is proposed and its training equations are derived in Section 2. In Section 3, the intra-stream parallelism of the generalized RNNs is explored and combined with the conventional interstream parallelism. In Section 4, experimental results of the proposed approach on a GPU are presented, followed by concluding remarks in Section 5. 2. GENERALIZATION To apply our parallelization approach to various types of RNNs, we first introduce a generalized RNN structure that can represent complex RNNs using simple basic blocks. This generalization fully covers advanced LSTM network structures with forget gates and peephole connections, and their BPTT-based training algorithm. Also, with the generalized RNN, one can easily design a new RNN structure quite easily since every equation and the parallelization approach remain the same. 2.1. Generalized RNN structure The proposed generalized RNN structure is basically a directed graph, which consists of a set of nodes and edges. Each node represents a layer and each edge makes a connection between two layers. Softmax output There are two types of connections: delayed or not. A delayed connection makes a fixed amount of delay on the signal, and is used to construct a recurrent loop. More specifically, the connection m propagates the activation of the source layer k at the frame t − dm to the destination layer at the frame t as zm (t) = Wm yk (t − dm ), (1) where zm is the output of the connection m, Wm is the corresponding weight matrix, yk is the activation of the source layer k, and dm is the amount of delay at the connection m. The value of dm is 0 for non-delayed connections and larger than 0 for delayed connections. In an additive layer, the inputs are summed up and the activation function is applied on it: X sk (t) = zm (t) (2) m∈Ak yk (t) = fk (sk (t)), (3) where sk is the state (input), Ak is the set of the indices of the anterior connections, yk is the activation, and fk (·) is the activation function of the layer k. In addition to the normal additive layers, multiplicative layers are employed to represent gate units of LSTM networks. A multiplicative layer performs element-wise multiplication of input vectors (or matrices for batched computation) as follows: Y sk,i (t) = zm,i (t), (4) m∈Ak where the subscript i represents the index of elements in a vector. For generality, we introduce an aggregation function gk (·) as sk (t) = gk ({zm (t)|m ∈ Ak }), (5) where gk (·) is a vector addition function for an additive layer or an element-wise multiplication function for a multiplicative layer, or it can be other nonlinear functions to add further nonlinearity to the network. In the previous approach on the generalized LSTMs [6], the gate units are implemented with gated connections. However, the gated connection has two input layers, so cannot be regarded as an edge of a familiar directed graph structure, where each edge has one input and one output. In our approach, by introducing the multiplicative layers, LSTM gates can be regarded as normal nodes in a graph structure, which allows general graph algorithms to be directly applied in Section 3. As an example, Figure 1 shows a generalized representation of a singlelayer LSTM network with forget gates and peephole connections. 1 1 1 SCC LSTM layer Input Fig. 1. Generalized representation of an LSTM network with forget gates and peephole connections. Thick arrows represent connections with full weight matrices. On the other hand, connections with the thin arrows have identity weight matrices. The numbers on the dashed lines indicate the corresponding delay amounts. A nonsingleton strongly connected component (SCC) is drawn, of which nodes will be grouped into a single recurrent node to make the network acyclic. These two variables will be back-propagated at the backward pass. If the layer k is an output layer, δk,j (t) should be initialized by comparing the output with a desired output dk,j (t) according to the error criterion defined by E(t) and the activation function of the output layer. Using the minimum cross-entropy criterion with the softmax activation function, δk,j (t) = dk,j (t) − yk,j (t). (9) If the layer k is not an output layer, δk,j (t) = − X X ∂E total (t0 , t1 ) ∂zn,i (t + dn ) ∂yk,j (t) ∂zn,i (t + dn ) ∂yk,j (t) ∂sk,j (t) n∈P i∈I k 2.2. Training n (10) In this section, BPTT [7] based training equations for the generalized RNN are derived. The objective is to minimize the following total error from t0 + 1 to t1 : X E total (t0 , t1 ) = E(t), (6) t0 <t≤t1 where E(t) is the error at frame t. For convenience, we define two derivative variables as δk,i (t) = − ∂E total (t0 , t1 ) ∂sk,i (t) (7) m,i (t) = − ∂E total (t0 , t1 ) . ∂zm,i (t) (8) = X X n,i (t + dn )Wn,ij fk0 (sk,j (t)), (11) n∈Pk i∈In where Pk is the set of posterior connection indices of the layer k and In is the set of element indices of the vector zn . Also, m,j (t) becomes ∂E total (t0 , t1 ) ∂sk,j (t) ∂sk,j (t) ∂zm,j (t) ∂ = δk,j (t) gk ({zn (t)|n ∈ Ak }), ∂zm,j (t) m,j (t) = − (12) (13) where k is the index of the destination layer of the connection m. To truncate errors at t = t00 , we backpropagate the two derivative variables while t > t00 where t00 ≤ t0 using (11) and (13). After the backward pass, the truncated error gradient of the connection m ∈ Pk can be acquired by ∂E total (t0 , t1 ) ≈ ∂Wm,ij X t00 <t≤t1 =− ∂E total (t0 , t1 ) ∂zm,i (t) ∂zm,i (t) ∂Wm,ij (14) m,i (t)yk,j (t − dm ). (15) X LSTM layer t00 <t≤t1 In matrix form, (11) can be represented as  X  δ k (t) = WnT n (t + dn ) ◦ fk0 (sk (t)), Recurrent node (16) n∈Pk where ◦ denotes element-wise vector multiplication. If the layer k is an additive layer, then (13) becomes m (t) = δ k (t). (17) Fig. 2. Feed-forward representation of the LSTM network that is depicted in Figure 1. Otherwise for the multiplicative layer k, m (t) = δ k (t) ◦ ◦ Y Input zn (t), (18) n∈Ak ,n6=m Q where element-wise multiplications are performed with . The error gradient matrix for the connection m ∈ Pk is computed by X ∇Wm = − m (t)ykT (t − dm ). (19) t00 <t≤t1 The error gradients can be used for the first order optimization methods such as stochastic gradient descent. 3. PARALLELIZATION Parallelization of RNN computation is quite challenging due to dependencies between two consecutive frames. The state of an RNN of the frame k cannot be determined until the computation for the frame k − 1 is finished. In this section, we first develop a parallelization method for the forward and the backward pass with a single stream (intra-stream parallelism), and then extend the approach to a multi-stream case (inter-stream parallelism). 3.1. Intra-stream parallelism The key concept of separating sequential parts from the parallel parts of an RNN is to determine loops in the RNN and group each loop into a single special node called a recurrent node. Then, the remaining structure becomes a directed acyclic graph (DAG), which can be easily parallelized as in a mini-batch based feed-forward neural network computation. Only the internal computations of the recurrent nodes are performed sequentially. More specifically, strongly connected components (SCCs) are found to determine which nodes should be grouped into a recurrent node. An SCC is a subgraph that is strongly connected, that is, there are one or more paths between every pair of two vertices inside the subgraph. An SCC analysis finds a set of SCCs that form a partition of the vertex set of the original graph. For SCCs that are singletons and do not contain a self-loop, the original nodes inside the SCCs remain unchanged. Otherwise, the nodes in each SCC are grouped into a single recurrent node. Then, the final graph becomes a DAG and be ready for parallel computation. An example of an LSTM network is shown in Figure 2. One of the famous algorithms for finding SCCs is the Tarjan’s strongly connected component algorithm [9]. Tarjan’s algorithm also provides a reverse topological sort of the resulting DAG, which is useful to determine the activation order. Once an RNN is represented as a DAG, the forward computation becomes very similar to that of feedforward networks. As in the case of feedforward networks, computations of nodes and edges are performed in a topological order of the DAG. These operations can be done in parallel over several frames since the network is represented as a DAG and there are no dependencies between different frames except the isolated recurrent nodes. Recurrent nodes are subgraphs of the original RNN and should be computed sequentially. The computation of a recurrent node from frame t0 to t1 in the forward pass requires t1 −t0 +1 sequential steps. In each step of the forward pass, delayed connections are computed first. Then the remaining part excluding the delayed connections becomes a DAG and can be computed in a topological order. The computation of a backward pass can be performed similarly with reversed topological orders. The sequential computations of recurrent nodes are quite expensive and often become a bottleneck of the overall performance. To speed up these sequential parts, we need to employ the multi-stream parallelization. 3.2. Inter-stream parallelism Inter-stream parallelism can be explored in the multi-stream mode where an RNN processes N streams with independent contexts. This is equivalent to running N independent copies of the RNN. Therefore, the multi-stream mode greatly increases parallelism and the overall execution speed. Recently, this approach was successfully applied to speed up language model training with an Elman network on a GPU [8]. For training an RNN in the multi-stream mode, the input and target streams are usually given by connecting randomly ordered training sequences. Since the lengths of the training sequences are very long, we apply the efficient version of truncated BPTT(h), denoted as BPTT(h; h0 ) proposed in [10]. BPTT(h; h0 ) is similar to the or- ·104 0.8 Elman / baseline Elman / proposed LSTM / baseline LSTM / proposed Processing speed (GFLOPS) Training speed (words/sec) 1 0.6 0.4 4,000 2,000 1024 / baseline 1024 / proposed 2048 / baseline 2048 / proposed 4096 / baseline 4096 / proposed Tesla K40 0.2 0 100 0 100 101 102 103 101 102 103 Number of streams Number of streams Fig. 3. Comparison of language model training speeds with Elman and LSTM networks. The LSTM employs forget gates and peephole connections. The sizes of the input layer, hidden or LSTM layer, and output layer is 38,000, 512, and 20,000 respectively. The minibatch size is fixed to 1,024, so the error propagates from 1,024/N to 2,048/N − 1 previous steps where N is the number of streams. dinary truncated BPTT(h) in that the network is unrolled h times. However, in the forward pass of BPTT(h; h0 ), h0 time steps are computed at once. Also, the error gradients for the recent h0 output errors are obtained by one iteration. These error gradients are summed up over the N training streams. Therefore, output errors of total N × h0 frames affect the error gradients when updating weights after backward passes. We call the set of these frames as a mini-batch throughout the paper, as it is equivalent to a mini-batch in stochastic gradient descent methods of feedforward neural networks. Increasing N also speeds up the training. However, we cannot make N very large since the size of a mini-batch, N × h0 , is limited by the physical memory size of a GPU. Moreover, increasing the size of a mini-batch results in infrequent update of the weights and may slow down the convergence [11]. Also, the parameter h0 cannot be easily modified since the training speed is approximately proportional to the ratio of h0 to h. For simplicity, let us assume h = 2h0 to fix the training speed. In this case, error propagates through h0 to 2h0 − 1 previous time steps in backward pass. Therefore h0 should be set sufficiently large to solve long time lag problems. 4. EXPERIMENTAL RESULTS Nvidia Tesla K40 GPU is used for the following experiments. For all experiments, BPTT(2h; h) is used for simplicity. Since the training algorithm for the generalized RNN structure is mathematically equivalent to that of Elman or LSTM networks, results with performance measures such as accuracy or the mean squared error (MSE) are not reported. To evaluate the proposed parallelization approach, we evaluate the language model training speed with the multi-stream mode as in [8]. The RNN architecture is an Elman network with 38,000 input, 512 hidden, and 20,000 output units. The mini-batch size is fixed to 1,024 to use the same amount of GPU memory. Hence, with N streams, h = 1,024/N and the error propagates from 1,024/N to 2,048/N − 1 previous time steps. For comparison, an LSTM version of the network with forget gates and peephole connections are also evaluated. Note that the LSTM network has no self recurrent Fig. 4. Comparison of GPU processing power utilizations when training LSTM networks with the three different sizes of LSTM layers: 1,024, 2,048, and 4,096. The input and output layers have the same size as the LSTM layer. Also, the theoretical peak performance of Tesla K40 GPU is shown. The mini-batch size is fixed to 1,024. connection from the output of the LSTM layer to the input of that. The training speeds are compared in Figure 3 with varying number of streams. Since the baseline approaches does not exploit intrastream parallelism, they show poor training speeds when the number of streams are small. On the other hand, the proposed approach employs intra-stream parallelism and shows over 10 times of speed-up over the baseline approach when a single stream is used. Also, with the proposed approach, we can obtain almost the maximum speed only with 64 streams. This is a nice advantage since using less number of streams allows RNNs to learn longer time lags when the size of mini-batch is limited, as discussed in Section 3.2. To analyze scalability and GPU efficiency with various size of networks, we perform another experiment with LSTM networks with forget gates and peephole connections. All layers of each network have the same size, which is 1,024, 2,048, or 4,096. To examine the GPU utilizations, we present the number of single-precision floating point operations per second (FLOPS) in Figure 4 along with the theoretical peak performance of Tesla K40 GPU. Note that only the operations for parameters and error gradients are counted. Compared to the previous experiment where the input and output layers are very large, this example is much closer to the deep RNN architectures in terms of the ratio of the sequential computations (inside the recurrent nodes) to the parallel computations. As shown in the figure, the GPU utilization gets higher as the layer size or the number of streams increases. Also, the intra-stream parallelism further accelerates the training especially with the small number of streams. 5. CONCLUDING REMARKS We introduced a generalized structure for RNNs which covers LSTM networks with forget gates and peephole connections. This generalized structure is represented as a directed graph where nodes and edges correspond to layers and connections, respectively. Due to the graph representation, we can automatically find loops inside RNNs using the Tarjan’s strongly connected component algorithm and explore intra-stream parallelism. The proposed intra-stream parallelism is combined with inter-stream parallelism in multi-stream mode for further acceleration. The experiments show that exploiting these two parallelisms greatly speeds up the training task on a GPU. 6. REFERENCES [1] Geoffrey E Hinton and Ruslan R Salakhutdinov, “Reducing the dimensionality of data with neural networks,” Science, vol. 313, no. 5786, pp. 504–507, 2006. [2] Geoffrey Hinton, Li Deng, Dong Yu, George E Dahl, Abdelrahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara N Sainath, et al., “Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups,” Signal Processing Magazine, IEEE, vol. 29, no. 6, pp. 82–97, 2012. [3] Tomas Mikolov, Stefan Kombrink, Lukas Burget, JH Cernocky, and Sanjeev Khudanpur, “Extensions of recurrent neural network language model,” in Acoustics, Speech and Signal Processing (ICASSP), 2011 IEEE International Conference on. IEEE, 2011, pp. 5528–5531. [4] Felix A Gers, Jürgen Schmidhuber, and Fred Cummins, “Learning to forget: Continual prediction with LSTM,” Neural computation, vol. 12, no. 10, pp. 2451–2471, 2000. [5] Ronald J Williams and David Zipser, “A learning algorithm for continually running fully recurrent neural networks,” Neural computation, vol. 1, no. 2, pp. 270–280, 1989. [6] Derek Monner and James A Reggia, “A generalized LSTMlike training algorithm for second-order recurrent neural networks,” Neural Networks, vol. 25, pp. 70–83, 2012. [7] Paul J Werbos, “Backpropagation through time: what it does and how to do it,” Proceedings of the IEEE, vol. 78, no. 10, pp. 1550–1560, 1990. [8] Xie Chen, Yongqiang Wang, Xunying Liu, Mark JF Gales, and Philip C Woodland, “Efficient GPU-based training of recurrent neural network language models using spliced sentence bunch,” in INTERSPEECH, 2014. [9] Robert Tarjan, “Depth-first search and linear graph algorithms,” SIAM journal on computing, vol. 1, no. 2, pp. 146– 160, 1972. [10] Ronald J Williams and Jing Peng, “An efficient gradient-based algorithm for on-line training of recurrent network trajectories,” Neural Computation, vol. 2, no. 4, pp. 490–501, 1990. [11] Richard H Byrd, Gillian M Chin, Jorge Nocedal, and Yuchen Wu, “Sample size selection in optimization methods for machine learning,” Mathematical programming, vol. 134, no. 1, pp. 127–155, 2012.
9cs.NE
DID: Distributed Incremental Block Coordinate Descent for Nonnegative Matrix Factorization Tianxiang Gao, Chris Chu arXiv:1802.08938v1 [cs.LG] 25 Feb 2018 Department of Electrical and Computer Engineering, Iowa State University, Ames, IA, 50011, USA {gaotx, cnchu}@iastate.edu Abstract Nonnegative matrix factorization (NMF) has attracted much attention in the last decade as a dimension reduction method in many applications. Due to the explosion in the size of data, naturally the samples are collected and stored distributively in local computational nodes. Thus, there is a growing need to develop algorithms in a distributed memory architecture. We propose a novel distributed algorithm, called distributed incremental block coordinate descent (DID), to solve the problem. By adapting the block coordinate descent framework, closed-form update rules are obtained in DID. Moreover, DID performs updates incrementally based on the most recently updated residual matrix. As a result, only one communication step per iteration is required. The correctness, efficiency, and scalability of the proposed algorithm are verified in a series of numerical experiments. 1 Introduction Nonnegative matrix factorization (NMF) (Lee and Seung 1999) extracts the latent factors in a low dimensional subspace. The popularity of NMF is due to its ability to learn parts-based representation by the use of nonnegative constraints. Numerous successes have been found in document clustering (Xu and Gong 2004; Lu, Hong, and Wang 2017), computer vision (Lee and Seung 1999), signal processing (Gao, Olofsson, and Lu 2016; Lu, Hong, and Wang 2017), etc. Suppose a collection of N samples with M nonnegative measurements is denoted in matrix form X ∈ RM×N , + where each column is a sample. The purpose of NMF is to approximate X by a product of two nonnegative matrices B ∈ RM×K and C ∈ RK×N with a desired low dimen+ + sion K, where K ≪ min{M, N }. The columns of matrix B can be considered as a basis in the low dimension subspace, while the columns of matrix C are the coordinates. NMF can be formulated as an optimization problem in (1): minimize f (B, C) = subject to B, C ≥ 0, B,C 1 2 kX − BCkF 2 (1a) (1b) Copyright © 2018, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. where “≥ 0” means element-wise nonnegative, and k·kF is the Frobenius norm. The problem (1) is nonconvex with respect to variables B and C. Finding the global minimum is NP-hard (Vavasis 2009). Thus, a practical algorithm usually converges to a local minimum. Many algorithms have been proposed to solve NMF such as multiplicative updates (MU) (Lee and Seung 2001), hierarchical alternating least square (HALS) (Cichocki, Zdunek, and Amari 2007; Li and Zhang 2009), alternating direction multiplier method (ADMM) (Zhang 2010), and alternating nonnegative least square (ANLS) (Kim and Park 2011). Amongst those algorithms, ANLS has the largest reduction of objective value per iteration since it exactly solves nonnegative least square (NNLS) subproblems using a block principal pivoting (BPP) method (Kim and Park 2011). Unfortunately, the computation of each iteration is costly. The algorithm HALS, on the other hand, solves subproblems inexactly with cheaper computation and has achieved faster convergence in terms of time (Kim and Park 2011; Gillis and Glineur 2012). Instead of iteratively solving the subproblems, ADMM obtains closed-form solutions by using auxiliary variables. A drawback of ADMM is that it is sensitive to the choice of the tuning parameters, even to the point where poor parameter selection can lead to algorithm divergence (Sun and Fevotte 2014). Most of the proposed algorithms are intended for centralized implementation, assuming that the whole data matrix can be loaded into the RAM of a single computer node. In the era of massive data sets, however, this assumption is often not satisfied, since the number of samples is too large to be stored in a single node. As a result, there is a growing need to develop algorithms in distributed system. Thus, in this paper, we assume the number of samples is so large that the data matrix is collected and stored distributively. Such applications can be found in e-commerce (e.g., Amazon), digital content streaming (e.g., Netflix) (Koren, Bell, and Volinsky 2009) and technology (e.g., Facebook, Google) (Tan, Cao, and Fong 2016), where they have hundreds of millions of users. Many distributed algorithms have been published recently. The distributed MU (Liu et al. 2010; Yin, Gao, and Zhang 2014) has been proposed as the first distributed algorithm to solve NMF. How- ever, MU suffers from slow and ill convergence in some cases (Lin 2007). Kannan, Ballard, and Park (Kannan, Ballard, and Park 2016) proposed high performance ANLS (HPC-ANLS) using 2D-grid partition of a data matrix such that each node only stores a submatrix of the data matrix. Nevertheless, six communication steps per iteration are required to obtain intermediate variables so as to solve the subproblems. Thus, the communication overhead is significant. Moreover, the computation is costly as they use ANLS framework. The most recent work is distributed HALS (D-HALS) (Zdunek and Fonal 2017). However, they assume the factors B and C can be stored in the shared memory of the computer nodes, which may not be the case if N is large. Boyd et al. (Boyd et al. 2011) suggested that ADMM has the potential to solve NMF distributively. Du et al. (Du et al. 2014) demonstrated this idea in an algorithm called Maxios. Similar to HPC-ANLS, the communication overhead is expensive, since every latent factor or auxiliary variable has to be gathered and broadcasted over all computational nodes. As a result, eight communication steps per iteration are necessary. In addition, Maxios only works for sparse matrices since they assume the whole data matrix is stored in every computer node. In this paper, we propose a distributed algorithm based on block coordinate descent framework. The main contributions of this paper are listed below. • We propose a novel distributed algorithm, called distributed incremental block coordinate descent (DID). By splitting the columns of the data matrix, DID is capable of updating the coordinate matrix C in parallel. Leveraging the most recent residual matrix, the basis matrix B is updated distributively and incrementally. Thus, only one communication step is needed in each iteration. • A scalable and easy implementation of DID is derived using Message Passing Interface (MPI). Our implementation does not require a master processor to synchronize. • Experimental results showcase the correctness, efficiency, and scalability of our novel method. The paper is organized as follows. In Section 2, the previous works are briefly reviewed. Section 3 introduces a distributed ADMM for comparison purpose. The novel algorithm DID is detailed in Section 4. In Section 5, the algorithms are evaluated and compared. Finally, the conclusions are drawn in Section 6. 2 Previous Works In this section we briefly introduce three standard algorithms to solve NMF problem (1), i.e., ANLS, HALS, and ADMM, and discuss the parallelism of their distributed versions. Notations. Given a nonnegative matrix X ∈ RM×N with + M rows and N columns, we use xri ∈ R1×N to denote its + i-th row, xj ∈ RM×1 to denote the j-th column, and x ij ∈ + R+ to denote the entry in the i-th row and j-th column. In ×1 addition, we use xrT ∈ RN and xTj ∈ R1×M to denote + + i the transpose of i-th row and j-th column, respectively. 2.1 ANLS The optimization problem (1) is biconvex, i.e., if either factor is fixed, updating another is in fact reduced to a nonnegative least square (NNLS) problem. Thus, ANLS (Kim and Park 2011) minimizes the NNLS subproblems with respect to B and C, alternately. The procedure is given by 2 C := argminC≥0 kX − BCkF B := argminB≥0 kX − 2 BCkF (2a) . (2b) The optimal solution of a NNLS subproblem can be achieved using BPP method. A naive distributed ANLS is to parallel Cminimization step in a column-by-column manner and B-minimization step in a row-by-row manner. HPC-ANLS (Kannan, Ballard, and Park 2016) divides the matrix X into 2D-grid blocks, the matrix B into Pr row blocks, and the matrix C into Pc column blocks so that the memory NK requirement of each node is O( PMN + MK Pr + Pc ), where r Pc Pr is the number of rows processor and Pc is the number of columns processor such that P = Pc Pr is the total number of processors. To really perform updates, the intermediate variables CC T , XC T , B T B, and B T X are computed and broadcasted using totally six communication steps. Each of them has a cost of log P · (α + β · N K), where α is latency, and β is inverse bandwidth in a distributed memory network model (Chan et al. 2007). The analysis is summarized in Table 1. 2.2 HALS Since the optimal solution to the subproblem is not required when updating one factor, a comparable method, called HALS, which achieves an approximate solution is proposed by (Cichocki, Zdunek, and Amari 2007). The algorithm HALS successively updates each column of B and row of C with an optimal solution in a closed form. The objective function in (1) can be expressed with respect to the k-th column of B and k-th row of C as follows 2 X − BC F = X− PK r i=1 bi ci = X− r i6=k bi ci P − bk crk 2 F , P Let A , X − i6=k bi cri and fix all the variables except bk or crk . We have subproblems in bk and crk min kA − bk crk kF , 2 (3a) min kA − bk crk k2F (3b) bk ≥0 crk ≥0 By setting the derivative with respect to bk or crk to zero and projecting the result to the nonnegative region, the optimal solution of bk and crk can be easily written in a closed form   −1 bk := (crk crT (AcrT (4a) k ) k ) +  T −1 T  r (4b) ck := (bk bk ) (A bk ) + where [z]+ is max{0, z}. Therefore, we have K inner-loop iterations to update every pair of bk and crk . With cheaper computational cost, HALS was confirmed to have faster convergence in terms of time. Zdunek and Fonal in 2017 proposed a distributed version of HALS, called DHALS. They also divide the data matrix X into 2D-grid blocks. Comparing with HPC-ANLS, the resulting algorithm DHALS only requires two communication steps. However, they assume matrices B and C can be loaded into the shared memory of a single node. Therefore, DHALS is not applicable in our scenario where we assume N is so big that even the latent factors are stored distributively. See the detailed analysis in Table 1. 2.3 ADMM The algorithm ADMM (Zhang 2010) solves the NMF problem by alternately optimizing the Lagrangian function with respect to different variables. Specifically, the NMF (1) is reformulated as 1 minimize kX − W Hk2F (5a) B,C,W,H 2 subject to B = W, C = H (5b) B, C ≥ 0, (5c) where W ∈ RM×K and H ∈ RK×N are auxiliary variables without nonnegative constraints. The augmented Lagrangian function is given by 1 2 kX − W HkF + hΦ, B − W i 2 ρ ρ 2 2 + hΨ, C − Hi + kB − W kF + kC − HkF (6) 2 2 L(B, C, W, H; Φ, Ψ)ρ = where Φ ∈ RM×K and Ψ ∈ RK×N are Lagrangian multipliers, h·, ·i is the matrix inner product, and ρ > 0 is the penalty parameter for equality constraints. By minimizing L with respect to W , H, B, C, Φ, and Ψ one at a time while fixing the rest, we obtain the update rules as follows be broadcasted to all other computational nodes. As a consequence, Maxios requires theoretically eight communication steps per iteration and only works for sparse matrices. Table 1 summarizes the analysis. 3 Distributed ADMM This section derives a distributed ADMM (DADMM) for comparison purpose. DADMM is inspired by another centralized version in (Boyd et al. 2011; Hajinezhad et al. 2016), where the update rules can be easily carried out in parallel, and is stable when ρ is small. As the objective function in (1) is separable in columns, we divide matrices X and C into column blocks of P parts P X1 1 2 2 kX − BCkF = kXi − BCi k2 , 2 2 i=1 M×Ni i where Xi ∈ R+ and Ci ∈ RK×N are column blocks + PP of X and C such that i=1 Ni = N . Using a set of auxiliary variables Yi ∈ RM×Ni , the NMF (1) can be reformulated as P X 1 minimize Yi ,B,C i=1 2 kXi − Yi k2F Yi = BCi , B, C ≥ 0. subject to (9a) for i = 1, 2, · · · , P (9b) (9c) The associated augmented Lagrangian function is given by L(Yi , B, C; Λi )ρ = P X 1 i=1 + P X 2 kXi − Yi k2F hΛi , Yi − BCi i + P X ρ i=1 i=1 M×K W := (XH T + Φ + ρB)(HH T + ρIK )−1 (7a) where Λi ∈ R sulting ADMM is H := (W T W + ρIK )−1 (W T X + Ψ + ρC) B := [W − Φ/ρ]+ (7b) (7c) Yi := argmin C := [H − Ψ/ρ]+ (7d) Φ := Φ + ρ(B − W ) Ψ := Ψ + ρ(C − H) (7e) (7f) where IK ∈ RK×K is the identity matrix. The auxiliary variables W and H facilitate the minimization steps for B and C. When ρ is small, however, the update rules for W and H result in unstable convergence (Sun and Fevotte 2014). When ρ is large, ADMM suffers from a slow convergence. Hence, the selection of ρ is significant in practice. Analogous to HPC-ANLS, the update of W and B can be parallelized in a column-by-column manner, while the update of H and C in a row-by-row manner. Thus, Maxios (Du et al. 2014) divides matrix W and B in column blocks, and matrix H and C in row blocks. However, the communication overhead is expensive since one factor update depends on the others. Thus, once a factor is updated, it has to (8) Yi 2 2 kYi − BCi kF , (10) are the Lagrangian multipliers. The re- 1 ρ 2 2 kXi − Yi k2 + kΛi /ρ + Yi − BCi kF 2 2 (11a) 2 Ci := argmin kΛi /ρ + Yi − BCi k2 (11b) B := argmin kΛ/ρ + Y − BCk2F (11c) Λi := argmaxhΛi , Yi − BCi i (11d) Ci ≥0 B≥0 Λi where Λ , [Λ1 Λ2 · · · ΛP ] and Y , [Y1 Y2 · · · YP ]. Clearly, the Yi update has a closed-form solution by taking the derivate and setting it to zero, i.e., Yi := 1 (Xi − Λi + ρBCi ) 1+ρ (12) Moreover, the updates for Yi , Ci , and Λi can be carried out in parallel. Meanwhile, B needs a central processor to update since the step (11c) requires the whole matrices Y , C, Algorithm HPC-ANLS D-HALS Maxios DADMM DBCD DID Runtime BPP O (M N K(1/Pc + 1/Pr )) O K 3 + M N K/P BPP O (M N K/P ) O (M N K/P ) Memory per processor O (M N/(Pc Pr ) + M K/Pr + N K/Pc ) O (M N/(Pc Pr ) + M K + N K) O (M N ) O (M N/P + M K) O (M N/P + M K) O (M N/P + M K) Communication time 3(α + βN K) log Pr + 3(α + βM K) log Pc (α + βN K) log Pr + (α + βM K) log Pc 4(2α + β(N + M )K) log P (α + βM K) log P K(α + βM K) log P (α + βM K) log P Communication volume O (M KPc + N KPr ) O (M KPc + N KPr ) O ((M + N )KP ) O (M KP ) O (M KP ) O (M KP ) Table 1: Analysis of distributed algorithms per iteration on runtime, memory storage, and communication time and volume. and Λ. If we use the solver BPP, however, we do not really need to gather those matrices, because the solver BPP in fact does not explicitly need Y , C, and Λ. Instead, it requires two intermediate variables W , CC T and H , (Λ/ρ + Y )C T , which can be computed as follows: W , CC T = P X Ci CiT , (13a) 4.1 Distributed Block Coordinate Descent i=1 H , (Λ/ρ + Y )C T = P X (Λi /ρ + Yi )CiT . (13b) i=1 It is no doubt that those intermediate variables can be calculated distributively. Let Ui = Λi /ρ, which is called scaled dual variable. Using the scaled dual variable, we can express DADMM in a more efficient and compact way. A simple MPI implementation of algorithm DADMM on each computational node is summarized in Algorithm 1. Algorithm 1: DADMM for each computational node Input: Xi , Ci , B Initialize P processors, along with Yi , B, Ci , Xi repeat 1 Ui := Ui + (Yi − BCi ) 1 2 Yi := 1+ρ (Xi − ρUi + ρBCi ) 3 4 5 2 Ci := argminCi ≥0 kUi + Yi − BCi k2 (W, H) := Allreduce(Ci CiT , (Ui + Yi )CiT ) B := BPP(W, H) until stopping criteria satisfied; At line 4 in Algorithm 1, theoretically we need a master processor to gather Ci CiT and (Ui +Yi )CiT from every local processor and then broadcast the updated value of CC T and (U + Y )C T back. As a result, the master processor needs a storage of O (M KP ). However, we use a collaborative operation called Allreduce (Chan et al. 2007). Leveraging it, the master processor is discarded and the storage of each processor is reduced to O (M K). 4 expensive as it is required to find optimal solutions of subproblems to ensure convergence. In this section, we will propose another distributed algorithm that adapts block coordinate descent framework and achieves approximate solutions at each iteration. Moreover, leveraging the current residual matrix facilitates the update for matrix B so that columns of B can be updated incrementally. Distributed Incremental Block Coordinate Descent The popularity of ADMM is due to its ability of carrying out subproblems in parallel such as DADMM in Algorithm 1. However, the computation of ADMM is costly since it generally involves introducing new auxiliary variables and updating dual variables. The computational cost is even more We firstly introduce a naive parallel and distributed algorithm, which is inspired by HALS, called distributed block coordinate descent (DBCD). Since the objective function in (1) is separable, the matrix X is partitioned by columns, then each processor is able to update columns of C in parallel, and prepare messages concurrently to update matrix B. Analogous to DADMM, the objective function in (1) can be expanded as follows 2 X − BC F = PN j=1 2 xj − Bcj = PN j=1 xj − PK 2 k=1 bk ckj By coordinate descent framework, we only consider one element at a time. To update cij , we fix the rest of variables as constant, then the objective function becomes X XN 2 xj − bk ckj − bi cij . (14) j=1 k6=i Taking the partial derivative of the objective function (14) with respect to cij and setting it to zero, we have    X = 0. (15) bTi bi cij − xj − bk ckj k6=i The optimal solution of cij can be easily derived in a closed form as follows " # P bTi (xj − k6=i bk ckj ) cij := (16a) bTi bi +   T b (xj − Bcj + bi cij ) = i (16b) bTi bi +   bTi (xj − Bcj ) = cij + (16c) bTi bi + Based on the equation (16c), the j-th column of C is required so as to update cij . Thus, updating a column cj has to be sequential. However, the update can be executed in parallel for all j’s. Therefore, the columns of matrix C can be updated independently, while each component in a column cj is optimized in sequence. The complexity of updating each cij is O (M K). Thus, the entire complexity of updating matrix C is  O M N K 2 /P . This complexity can be reduced by bringing xj − Bcj outside the loop and redefining as ej , xj − Bcj . The improved update rule is ej := ej + bi cij  T  b ej cij := iT bi bi + (17a) (17b) ej := ej − bi cij (17c) By doing so, the complexity is reduced to O (M N K/P ). The analogous derivation can be carried out to update the i-th column of matrix B, i.e., bi . By taking partial derivative of the objective function (14) with respect to bi and setting it to zero, we have equation N  X j=1  X bi cij − xj − k6=i bk ckj  cij = 0 Solving this linear equation gives us a closed-form optimal solution of bi " PN # j=1 (xj − Bcj + bi cij )cij bi := PN 2 j=1 cij + # " PN j=1 (xj − Bcj )cij = bi + PN 2 j=1 cij +   (X − BC)crT i = bi + cri crT i + (18) to the (19a) zj , c2ij 4.2 Incremental Update for bi (19c) (20a) (20b) The vector yj and scaler zj can be computed in parallel. After receiving messages including yj ’s and zj ’s from other processors, a master processor updates the column bi as a PN scaled summation of yj with scaler z , j=1 zj , that is, bi := [y/z]+ PN Algorithm 2: DBCD for each computational node Input: xj , cj , B repeat // Update C ej := xj − Bcj for all i ∈ {1, 2, · · · , K} do Update cij using equations (17) end // Update B for all i ∈ {1, 2, · · · , K} do ej = ej + bi cij yj = ej cij zj = c2ij (y, z) = Allreduce(yj , zj ) bi := [y/z]+ ej = ej − bi cij end until stopping criteria satisfied; (19b) Unfortunately, there is no way to update bi in parallel since the equation (19c) involves the whole matrices X and C. That is the reason why sequential algorithms can be easily implemented in the shared memory but cannot directly be applied in distributed memory. Thus, other works (Kannan, Ballard, and Park 2016; Zdunek and Fonal 2017; Du et al. 2014) either use gather operations to collect messages from local processors or assume small size of the latent factors. By analyzing the equation (19a), we discover the potential parallelism. We define a vector yj and a scaler zj as follows yj , (xj − Bcj + bi cij )cij = (ej + bi cij )cij identify vectors yj ’s and scalars zj ’s to update matrix B, and their computation can be executed concurrently among computational nodes. A MPI implementation of this algorithm for each processor is summarized in Algorithm 2. (21) where y , j=1 yj . Thus, the update for matrix B can be executed in parallel but indirectly. The complexity of updating bi is O (M N/P ) as we reserve error vector ej and concurrently compute yj and zj . The complexity of updating entire matrix B is O (M N K/P ). By partitioning the data matrix X by columns, the update for matrix C can be carried out in parallel. In addition, we The complexity of algorithm DBCD is O (M N K/P ) per iteration, which is perfectly parallelizing a sequential block coordinate descent algorithm. However, the performance of DBCD could be deficient due to the delay in network. In principle, DBCD sends totally KP messages to a master processor per iteration, which is even more if we implement DBCD using Allreduce. Any delay of a message could cause a diminished performance. In contrast, the algorithm DID has a novel way to update matrix B incrementally using only a single message from each processor per iteration. To successfully update matrix B, the bottleneck is to iteratively compute yj and zj for associated bi since once bi is updated, the yj and zj have to be recomputed due to the change occurred in matrix B from equation (19b). Nevertheless, we discovered this change can be represented as several arithmetic operations. Thus, we in fact do not need to communicate every time in order to update each bi . Suppose that after t-th iteration, the i-th column of matrix B is given, i.e., bti , and want to update it to bt+1 . Let E = i X − BC, which is the most current residual matrix after t-th iteration. From equation (19c), we have   EcrT t i bt+1 := b + (22) i i cri crT i + Once we update bti to bt+1 , we need to update bi in matrix B i so as to get new E to update the next column of B, i.e., bi+1 . However, we do not really need to recalculate E. Instead, we can update the value by cri E := E + bti cri − bt+1 i (23) We define and compute a variable δbi as δbi , bt+1 i − bti . (24) Using the vector δbi , we have a compact form to update E E := E − δbi cri (25) The updated E is substituted into the update rule of bi+1 in equation (22), and using bti+1 we obtain   (E − δbi cri )crT i+1 t+1 t bi+1 := bi+1 + (26a) cri+1 crT i+1 +   EcrT cri crT i+1 i+1 t (26b) = bi+1 + r rT − r rT δbi ci+1 ci+1 ci+1 ci+1 + In the equation (26b), the first two terms is the same as general update rule for matrix B in DBCD, where Eci+1 can be computed distributively in each computational node. On the other hand, the last term allows us to update the column bi+1 still in a closed form but without any communication step. Therefore, the update for matrix B can be carried out incrementally and the general update rule is given by " # P r rT EcrT k<i (ci ck )δbk t+1 t i bi := bi + r rT − (27) ci ci cri crT i + Comparing to the messages used in DBCD, i.e., (yj , zj ), we need to compute the coefficients for the extra term, that is, cri crT k for all k < i. Thus, a message communicated among processors contains two parts: the weighted current residual matrix Wj , and a lower triangular matrix Vj maintaining the inner product of matrix C. The matrices Wj and Vj are defined as below # " | | ··· | (28) Wj , ej c1j ej c2j · · · ej cKj | | ··· |   2 c1j 0 0 ··· 0  c2j c1j c22j 0 ··· 0    Vj ,  .  (29) . . .. .. ..  .. . 0  cKj c1j cKj c2j cKj c3j ··· c2Kj Using variables Wj and Vj , the update rule to columns of matrix B becomes # " X bi := bi + wi /vii − (vik /vii )δbk (30) k<i + where wi is the i-th column of matrix W , vij is the i-th component of j-th column of matrix V , and matrices W and V are the summations of matrices Wj and Vj , respectively, PN PN i.e., W , j=1 Wj and V , j=1 Vj . For each processor, they store a column of X, a column of C, and the matrix B. They execute the same algorithm and a MPI implementation of this incremental algorithm for each computational node is summarized in Algorithm 3. Clearly, the entire computation is unchanged and the volume of message stays the same as DBCD, but the number of communication is reduced to once per iteration. Algorithm 3: DID for each computational node Input: xj , cj , B repeat // Update C ej := xj − Bcj for all i ∈ {1, 2, · · · , K} do Update cij using equations (17) end Compute Wj and Vj from equations (28) and (29). (W, V ) := Allreduce(Wj , Vj ) // Update B for all i ∈ {1,   2, · · · , K} doP bt+1 := bti + wi /vii − k<i (vik /vii )δbk + i δbi := bt+1 − bti i end until stopping criteria satisfied; 5 Experiments We conduct a series of numerical experiments to compare the proposed algorithm DID with HALS, ALS, ADMM, BCD, DBCD, DADMM, and HPC-ANLS. The algorithm BCD is the sequential version of DBCD. Due to the ill convergence of ADMM and Maxios in (Zhang 2010; Du et al. 2014), we derive DADMM in Section 3 and set ρ = 1 as default. Since we assume M and K are much smaller than N , HPC-ANLS only has column partition of the matrix X, i.e., Pc = P and Pr = 1. We use a cluster1 that consists of 48 SuperMicro servers each with 16 cores, 64 GB of memory, GigE and QDR (40Gbit) InfiniBand interconnects. The algorithms are implemented in C code. The linear algebra operations use GNU Scientific Library (GSL) v2.42 (Gough 2009). The Message Passing Interface (MPI) implementation OpenMPI v2.1.03 (Gabriel et al. 2004) is used for communication. Note that we do not use multi-cores in each server. Instead, we use a single core per node as we want to achieve consistent communication overhead between cores. Synthetic datasets are generated with number of samples N = 105 , 106 , 107 and 108 . Due to the storage limits of the computer system we use, we set the dimension M = 5 and low rank K = 3, and utilize P = 16 number of computational nodes in the cluster. The random numbers in the synthetic datasets are generated by the Matlab command rand that are uniformly distributed in the interval [0, 1]. We also perform experimental comparisons on four realworld datasets. The MNIST dataset4 of handwritten digits has 70,000 samples of 28x28 image. The 20News dataset5 is a collection of 18,821 documents across 20 different newsgroups with totally 8,165 keywords. The UMist dataset6 1 http://www.hpc.iastate.edu/ http://www.gnu.org/software/gsl/ 3 https://www.open-mpi.org/ 4 http://yann.lecun.com/exdb/mnist/ 5 http://qwone.com/~jason/20Newsgroups/ 6 https://cs.nyu.edu/~roweis/data.html 2 0.25 0.12 4000 HALS DBCD 0.1 ANLS Time (seconds) ×10 -3 E r/E 0 BCD 15 0.06 3000 DADMM 0.15 ×10 -3 0 r E /E HPC-ANLS ADMM 0.08 Computation Communication 3500 0.2 0.1 10 DID 15 10 2500 2000 1500 0.04 5 5 1000 0.05 0.02 1500 2000 2500 3000 3500 150 200 250 300 500 0 0 1000 2000 3000 4000 5000 6000 7000 0 0 100 200 300 400 Time (seconds) 500 600 700 800 900 1000 0 DBCD Time (seconds) (a) Sequential DID HPC-ANLS DADMM (c) Computation v.s. communication (b) Distributed Figure 1: Convergence behaviors of different algorithms with respect to time consumption of communication and computation on the dataset with N = 108 samples. N 105 106 107 108 MNIST 20News UMist YaleB HALS 1281 225 596 339 495 302 677 1001 ANLS 141 238 1120 163 197 169 1001 352 ADMM 170 115 1191 97 199 169 953 224 Number of iterations BCD HPC-ANLS 549 141 396 238 654 1120 302 163 492 197 231 169 622 1001 765 352 DADMM 170 115 1191 97 199 169 953 224 DBCD 549 396 654 302 492 231 622 765 DID 549 396 654 302 492 231 622 765 HALS 16.88 36.86 587.47 3779.11 705.32 2550.02 314.72 223.58 ANLS 56.59 630.43 29234.61 43197.12 395.61 745.28 657.14 201.22 ADMM 45.88 476.83 31798.51 27590.16 610.65 714.61 836.76 149.35 Time (seconds) BCD HPC-ANLS 10.61 4.31 95.24 50.47 909.76 2372.47 8808.92 10172.55 942.68 31.84 2681.49 131.12 422.11 492.72 236.13 50.69 DADMM 3.46 37.06 2563.47 5742.37 46.17 172.69 471.01 40.61 DBCD 1.42 14.04 126.01 785.57 170.65 651.52 92.49 44.08 DID 1.17 8.61 106.60 610.09 133.50 559.70 82.34 36.45 Table 2: Performance comparison for algorithms on synthetic and real datasets with P = 16 number of computing nodes. contains 575 images of 20 people with the size of 112x92. The YaleB dataset7 includes 2,414 images of 38 individuals with the size of 32x32. The MNIST and 20News datasets are sparse, while UMist and YaleB are dense. The algorithms HALS, (D)BCD, and DID could fail if kbi k or kcri k is close to zero. This could appear if B or C is badly scaled. That means the entries of E = X − BC are strictly negative. We avoid this issue by using well scaled initial points for the synthetic datasets and K-means method to generate the initial values for the real datasets. All the algorithms are provided with the same initial values. When an iterative algorithm is executed in practice, a stopping criteria is required. In our experiments, the stopping criteria is met if the following condition is satisfied Et 2 F ≤ ǫ E0 2 F , (31) where E t is the residual matrix after t-th iteration. Throughout the experiments, we set ǫ = 10−6 as default. In addition, we combine the stopping criterion with a limit on time of 24 hours and a maximum iteration of 1000 for real datasets. The experimental results are summarized in the Table 2. Correctness In principle, the algorithms HALS, (D)BCD, and DID have the same update rules for the latent factors B and C. The difference is the update order. The algorithm DID has the exact same number of iterations as BCD and DBCD, which demonstrates the correctness of DID. 7 http://www.cad.zju.edu.cn/home/dengcai/Data/FaceData.html Efficiency As presented in Table 2, DID always converges faster than the other algorithms in term of time. HALS and BCD usually use a similar number of iterations to reach the stopping criteria. ANLS and ADMM use much fewer iterations to converge. Thanks to auxiliary variables, ADMM usually converges faster than ANLS. Figure 1(a) shows that comparing with HALS, BCD actually reduces the objective value a lot at the beginning but takes longer to finally converge. Such phenomenon can also be observed in the comparison between ANLS and ADMM. In Figure 1(b), DID is faster than DBCD. The reason is shown in Figure 1(c) that DID involves much less communication overhead than DBCD. Based on the result in Table 2, DID is about 1015% faster than DBCD by incrementally updating matrix B. (HPC-)ANLS works better in MNIST and 20News datasets because these datasets are very sparse. Scalability As presented in Table 2, the runtime of DID scales linearly as the number of samples increases, which is much better than the others. It can usually speed up a factor of at least 10 to BCD using 16 nodes. (D)ADMM is also linearly scalable, which is slightly better than (HPC-)ANLS. Due to the costly computation, (D)ADMM is not preferred to solve NMF problems. 6 Conclusion In this paper, we proposed a novel distributed algorithm DID to solve NMF in a distributed memory architecture. Assume the number of samples N to be huge, DID divides the matrices X and C into column blocks so that updating the matrix C is perfectly distributed. Using the variables δb, the ma- trix B can be updated distributively and incrementally. As a result, only a single communication step per iteration is required. The algorithm is implemented in C code with OpenMPI. The numerical experiments demonstrated that DID has faster convergence than the other algorithms. As the update only requires basic matrix operations, DID achieves linear scalability, which is observed in the experimental results. In the future work, DID will be applied to the cases where updating matrix B is also carried out in parallel. Using the techniques introduced by (Hsieh and Dhillon 2011) and (Gillis and Glineur 2012), DID has the possibility to be accelerated. How to better treat sparse datasets is also a potential research direction. References [Boyd et al. 2011] Boyd, S.; Parikh, N.; Chu, E.; Peleato, B.; and Eckstein, J. 2011. Distributed optimization and statistical learning via the alternating direction method of multipliers. Foundations and Trends in Machine Learning 1–122. [Chan et al. 2007] Chan, E.; Heimlich, M.; Purkayastha, A.; and Van De Geijn, R. 2007. Collective communication: theory, practice, and experience. Concurrency and Computation: Practice and Experience 1749–1783. [Cichocki, Zdunek, and Amari 2007] Cichocki, A.; Zdunek, R.; and Amari, S.-i. 2007. Hierarchical als algorithms for nonnegative matrix and 3d tensor factorization. In International Conference on Independent Component Analysis and Signal Separation, 169–176. Springer. [Du et al. 2014] Du, S. S.; Liu, Y.; Chen, B.; and Li, L. 2014. Maxios: Large scale nonnegative matrix factorization for collaborative filtering. In Proceedings of the NIPS 2014 Workshop on Distributed Matrix Computations. [Gabriel et al. 2004] Gabriel, E.; Fagg, G. E.; Bosilca, G.; Angskun, T.; Dongarra, J. J.; Squyres, J. M.; Sahay, V.; Kambadur, P.; Barrett, B.; Lumsdaine, A.; Castain, R. H.; Daniel, D. J.; Graham, R. L.; and Woodall, T. S. 2004. Open MPI: Goals, concept, and design of a next generation MPI implementation. In Proceedings, 11th European PVM/MPI Users’ Group Meeting, 97–104. [Gao, Olofsson, and Lu 2016] Gao, T.; Olofsson, S.; and Lu, S. 2016. Minimum-volume-regularized weighted symmetric nonnegative matrix factorization for clustering. In 2016 IEEE Global Conference on Signal and Information Processing (GlobalSIP), 247–251. IEEE. [Gillis and Glineur 2012] Gillis, N., and Glineur, F. 2012. Accelerated multiplicative updates and hierarchical als algorithms for nonnegative matrix factorization. Neural computation 1085–1105. [Gough 2009] Gough, B. 2009. GNU scientific library reference manual. Network Theory Ltd. [Hajinezhad et al. 2016] Hajinezhad, D.; Chang, T.-H.; Wang, X.; Shi, Q.; and Hong, M. 2016. Nonnegative matrix factorization using admm: Algorithm and convergence analysis. In 2016 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 4742–4746. IEEE. [Hsieh and Dhillon 2011] Hsieh, C.-J., and Dhillon, I. S. 2011. Fast coordinate descent methods with variable selection for non-negative matrix factorization. In Proceedings of the 17th ACM SIGKDD international conference on Knowledge discovery and data mining, 1064–1072. ACM. [Kannan, Ballard, and Park 2016] Kannan, R.; Ballard, G.; and Park, H. 2016. A high-performance parallel algorithm for nonnegative matrix factorization. In Proceedings of the 21st ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, 9. ACM. [Kim and Park 2011] Kim, J., and Park, H. 2011. Fast nonnegative matrix factorization: An active-set-like method and comparisons. SIAM Journal on Scientific Computing 3261– 3281. [Koren, Bell, and Volinsky 2009] Koren, Y.; Bell, R.; and Volinsky, C. 2009. Matrix factorization techniques for recommender systems. Computer. [Lee and Seung 1999] Lee, D. D., and Seung, H. S. 1999. Learning the parts of objects by non-negative matrix factorization. Nature 788–791. [Lee and Seung 2001] Lee, D. D., and Seung, H. S. 2001. Algorithms for non-negative matrix factorization. In Advances in neural information processing systems, 556–562. [Li and Zhang 2009] Li, L., and Zhang, Y.-J. 2009. Fastnmf: highly efficient monotonic fixed-point nonnegative matrix factorization algorithm with good applicability. Journal of Electronic Imaging 033004–033004. [Lin 2007] Lin, C.-J. 2007. On the convergence of multiplicative update algorithms for nonnegative matrix factorization. IEEE Transactions on Neural Networks 1589–1596. [Liu et al. 2010] Liu, C.; Yang, H.-c.; Fan, J.; He, L.-W.; and Wang, Y.-M. 2010. Distributed nonnegative matrix factorization for web-scale dyadic data analysis on mapreduce. In Proceedings of the 19th international conference on World wide web, 681–690. ACM. [Lu, Hong, and Wang 2017] Lu, S.; Hong, M.; and Wang, Z. 2017. A nonconvex splitting method for symmetric nonnegative matrix factorization: Convergence analysis and optimality. IEEE Transactions on Signal Processing. [Sun and Fevotte 2014] Sun, D. L., and Fevotte, C. 2014. Alternating direction method of multipliers for non-negative matrix factorization with the beta-divergence. In Acoustics, Speech and Signal Processing (ICASSP), 2014 IEEE International Conference on, 6201–6205. IEEE. [Tan, Cao, and Fong 2016] Tan, W.; Cao, L.; and Fong, L. 2016. Faster and cheaper: Parallelizing large-scale matrix factorization on gpus. In Proceedings of the 25th ACM International Symposium on High-Performance Parallel and Distributed Computing, 219–230. ACM. [Vavasis 2009] Vavasis, S. A. 2009. On the complexity of nonnegative matrix factorization. SIAM Journal on Optimization 1364–1377. [Xu and Gong 2004] Xu, W., and Gong, Y. 2004. Document clustering by concept factorization. In Proceedings of the 27th annual international ACM SIGIR conference on Research and development in information retrieval, 202–209. ACM. [Yin, Gao, and Zhang 2014] Yin, J.; Gao, L.; and Zhang, Z. M. 2014. Scalable nonnegative matrix factorization with block-wise updates. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, 337–352. Springer. [Zdunek and Fonal 2017] Zdunek, R., and Fonal, K. 2017. Distributed nonnegative matrix factorization with hals algorithm on mapreduce. In International Conference on Algorithms and Architectures for Parallel Processing, 211–222. Springer. [Zhang 2010] Zhang, Y. 2010. An alternating direction algorithm for nonnegative matrix factorization. preprint.
2cs.AI
arXiv:1304.7992v3 [q-bio.MN] 23 Nov 2013 Fast Reconstruction of Compact Context-Specific Metabolic Network Models Nikos Vlassis∗ ∗ Maria Pires Pacheco† Thomas Sauter† Luxembourg Centre for Systems Biomedicine, University of Luxembourg † Life Sciences Research Unit, University of Luxembourg November 26, 2013 Abstract Systemic approaches to the study of a biological cell or tissue rely increasingly on the use of context-specific metabolic network models. The reconstruction of such a model from high-throughput data can routinely involve large numbers of tests under different conditions and extensive parameter tuning, which calls for fast algorithms. We present fastcore, a generic algorithm for reconstructing context-specific metabolic network models from global genome-wide metabolic network models such as Recon X. fastcore takes as input a core set of reactions that are known to be active in the context of interest (e.g., cell or tissue), and it searches for a flux consistent subnetwork of the global network that contains all reactions from the core set and a minimal set of additional reactions. Our key observation is that a minimal consistent reconstruction can be defined via a set of sparse modes of the global network, and fastcore iteratively computes such a set via a series of linear programs. Experiments on liver data demonstrate speedups of several orders of magnitude, and significantly more compact reconstructions, over a rival method. Given its simplicity and its excellent performance, fastcore can form the backbone of many future metabolic network reconstruction algorithms. 1 Introduction Cell metabolism is known to play a key role in the pathogenesis of various diseases [11] such as Parkinson’s disease [31] and cancer [19]. The study of human metabolism has been greatly advanced by the development of computational models of metabolism, such as Recon 1 [13], the Edinburgh human metabolic network [18], and Recon 2 [39]. These are genome-scale metabolic network models that have been reconstructed by combining various sources of ‘omics’ and literature data, and they involve a large set of biochemical reactions that can be active in different contexts, e.g., different cell types or tissues [38]. To maximize the predictive power of a metabolic model when conditioning on a specific context, for instance the energy metabolism of a neuron or the metabolism of liver, recent efforts go into the development of context-specific metabolic models [3, 9, 22, 8, 25, 2]. These are network models that are derived from global models like Recon 1, but they only contain 1 a subset of reactions, namely, those reactions that are active in the given context. Such context-specific metabolic models are known to exhibit superior explanatory and predictive power than their global counterparts [22, 15, 5]. Most algorithms for context-specific metabolic network reconstruction (see Section 2.5 for a short overview) first identify a relevant subset of reactions according to some ‘omics’ information (typically expression data and bibliomics), and then search for a subnetwork of the global network that satisfies some mathematical requirements and contains all (or most of) these reactions [3, 35, 22, 7, 20, 2]. The mathematical requirements are typically imposed via flux balance analysis, which characterizes the steady-state distribution of fluxes in a metabolic network via linear constraints that are derived from the stoichiometry of the network and physical conservation laws [34, 36, 32, 16, 14]. The search problem may target the optimization of a specific functionality of the model (e.g., biomass production) or some other objective [4], and it may involve repeated tests under different conditions and parameter tuning [3, 15, 29, 41]. The latter calls for fast algorithms. We present fastcore, a generic algorithm for context-specific metabolic network reconstruction. fastcore takes as input a core set of reactions that are supported by strong evidence to be active in the context of interest. Then it searches for a flux consistent subnetwork of the global network that contains all reactions from the core set and a minimal set of additional reactions. Flux consistency implies that each reaction of the network is active (i.e., has nonzero flux) in at least one feasible flux distribution [34, 1]. An attractive feature of fastcore is its generality: As it only relies on a preselected set of reactions and a simple mathematical objective (flux consistency), it can be applied in different contexts and it allows the integration of different pieces of evidence (‘multi-omics’) into a single model. Computing a minimal consistent reconstruction from a subset of reactions of a global network is, however, an NP-hard problem [1], and hence some approximation is in order. Our key observation is that a minimal consistent reconstruction can be defined via a set of sparse modes of the global network, and fastcore is designed to compute a minimal such set. Every iteration of the algorithm computes a new sparse mode via two linear programs that aim at maximizing the support of the mode inside the core set while minimizing that quantity outside the core set. fastcore’s search strategy is in marked contrast to related approaches, in which the search for a minimal consistent reconstruction involves, for instance, incremental network pruning [22]. fastcore is simple, devoid of free parameters, and its performance is excellent in practice: As we demonstrate on experiments with liver data, fastcore is several orders of magnitude faster, and produces much more compact reconstructions, than the main competing algorithm MBA [22]. 2 2.1 Methods Background A metabolic network of m metabolites and n reactions is represented by an m × n stoichiometric matrix S, where each entry Sij contains the stoichiometric coefficient of metabolite i in reaction j. A flux vector v ∈ Rn is a tuple of reaction rates, v = (v1 , . . . , vn ), where vi 2 B v2 v1 2 v3 A v4 C D v6 v5 Figure 1: A metabolic network with one blocked reaction (A↔B). Note that A appears with stoichiometric coefficient 2 in the boundary reaction →2A. is the rate of reaction i in the network. Reactions are grouped into reversible ones (R) and irreversible ones (I). For a reaction i ∈ I it holds that vi ≥ 0; this and other imposed flux bounds, e.g., lower and upper bounds per reaction, are collectively denoted by B (which defines a convex set). A flux vector is called feasible or a mode if it satisfies a set of steady-state mass-balance constraints that can be compactly expressed as: v ∈ B. Sv = 0, (1) An elementary mode is a feasible flux vector v 6= 0 with minimal support, that is, there is no  other feasible flux vector w 6= 0 with supp(w) ⊂ supp(v), where supp(v) = j ∈ {1, 2, . . . , n} : vj 6= 0 is the support (i.e., the set of nonzero entries) of v [34, 16]. A reaction i is called blocked if it cannot be active under any mode, that is, there exists no mode v ∈ Rn such that vi 6= 0 (in practice |vi | ≥ ε, for some small positive threshold ε). A metabolic network model that contains no blocked reactions is called (flux) consistent [34, 1]. 2.2 Network consistency testing Given a metabolic network model with stoichiometric matrix S, a problem of interest is to test whether the network is consistent or not. Additionally, if the network is inconsistent, it would be desirable to have a method that detects all blocked reactions. It has been suggested that network consistency can be detected by a single linear program (LP) [1]. The idea is to first convert each reversible reaction into two irreversible reactions (and define a reversible flux as the difference of two irreversible fluxes), and then test if the minimum feasible flux on the new set J of irreversible-only reactions is strictly positive (in practice, at least ε). This is equivalent to testing if the following LP is feasible: max v,z s.t. z z≥ε z∈R vi ≥ z ∀i ∈ J Sv = 0 v ∈ B. (LP-2) This test of consistency, however, can produce spurious solutions. In Figure 1 we show a toy metabolic network comprising four metabolites (A,B,C,D) and six reactions annotated with corresponding fluxes v1 , . . . , v6 . Fluxes are bounded as 0 ≤ vi ≤ 3 for i = 6 2, and 3 |v2 | ≤ 3. All stoichiometric coefficients are equal to one, except for the reaction →2A. The only reversible reaction is A↔B, which is a dead-end reaction and therefore blocked, whereas all other reactions are irreversible and unblocked. After converting A↔B to a pair of irreversible reactions, LP-2 achieves optimal value z ∗ = 1.5, which implies (wrongly) that the network is consistent. The test here fails because the two irreversible copies of A↔B have equal flux at the solution, thereby nullifying the actual net flux of A↔B. A straightforward solution to the problem would involve iterating through all reactions, computing the maximum and minimum feasible flux of each reaction via an LP that satisfies the constraints in (1). Reactions with minimum and maximum flux zero would then be blocked. This is the idea behind the FVA (Flux Variability Analysis) algorithm and the reduceModel function of the COBRA toolbox [26, 33]. However, iterating through all reactions can be inefficient. A faster variant is fastFVA [17], which achieves acceleration over FVA via LP warm-starts. Another fast algorithm is CMC (CheckModelConsistency) [22], which involves a series of LPs, where each LP maximizes the sum of fluxes over a subset J of reactions: X max vj v j∈J (LP-3) s.t. Sv = 0 v ∈ B. The set J is initialized by J = R ∪ I (all reactions in the network), and it is updated after each run of LP-3 so that it contains the reactions whose consistency has not been established yet. When J cannot be reduced any further, we can reverse the signs of the columns of S corresponding to the reversible reactions in J and resume the iterations. Eventually, all remaining reactions may have to be tested one by one for consistency, as in FVA. Such an iterative scheme is complete, in the sense that it will always report consistency if the network is consistent, and if not, it will reveal the set of blocked reactions. However, as we will clarify in the next section, LP-3 is not optimizing the ‘correct’ function, which may result in unnecessarily many iterations. For example, when applied to the network of Figure 1, LP-3 will pick up the elementary mode that corresponds to the pathway A→C→D (because this pathway achieves maximum sum of fluxes v1 + v4 + v5 + v6 = 1.5 + 3 + 3 + 3), and it will set v3 = 0. To establish the consistency of the reaction A→D, an additional run of LP-3 would be needed, where the set J would only involve the reactions A↔B and A→D. Hence, an iterative algorithm like CMC that relies on LP-3 would need two iterations to detect the consistent part of this network. However, one LP suffices to detect the consistent subnetwork in this example, as we explain in the next section. In more general problems involving larger and more realistic networks, CMC may involve unnecessarily many iterations, as we demonstrate in the experiments. 2.3 Fast consistency testing In most problems of interest there will be no single mode that renders the whole network consistent, and an iterative algorithm like the one described in the previous section must be used. For performance reasons it would therefore be desirable to be able to establish the consistency of as many reactions as possible in each iteration of the algorithm. 4 Since consistency implies nonzero fluxes, it is sufficient to optimize a function that just ‘pushes’ all fluxes away from zero. Formally, this amounts to searching for modes v whose cardinality—denoted by card(v) and defined as card(v) = #supp(v), i.e., the number of nonzero entries of v—is as large as possible. Directly maximizing card(v) is, however, not straightforward, for the following reasons: First, the card function is quasiconcave only for v ∈ Rn+ (the nonnegative orthant), and it is nonconvex for general v ∈ Rn [6]. Second, even if we restrict attention to nonnegative fluxes in each iteration (which we can do without loss of generality by flipping the signs of the corresponding columns of S), it is not obvious how to efficiently maximize the quasiconcave card(v). Third, in practice consistency implies fluxes that are ε-distant from zero, in which case some adaptation of the card function is in order. Here we propose an approach to approximately maximize card(v) over a nonnegative flux subspace indexed by a set of reactions J . First note that the cardinality function can be expressed as X card(v) = θ(vi ) , (4) i∈J where θ : R → {0, 1} is a step function: ( θ(vi ) = 0 if vi = 0 1 if vi > 0 . (5) The key idea is to approximate the function θ by a concave function that is the minimum of a linear function and a constant function: θ(vi ) ≈ min{ vi , 1} , ε (6) where ε is the flux threshold. The problem of approximately maximizing card(v) can then be cast as an LP: We introduce an auxiliary variable zi ∈ R+ for each flux variable vi , for i ∈ J , P and take epigraphs [6], in which case maximizing card(v) = i∈J θ(vi ) can be expressed as X max zi v,z s.t. i∈J zi ≤ θ(vi ) ∀i ∈ J , zi ∈ R+ vi ≥ 0 ∀i ∈ J Sv = 0 v ∈ B. Using (6) and assuming constant ε, this simplifies to X max zi v,z s.t. i∈J zi ∈ [0, ε] ∀i ∈ J , zi ∈ R+ vi ≥ z i ∀i ∈ J Sv = 0 v ∈ B. (LP-7) Note that LP-7 tries to maximize the number of feasible fluxes in J whose value is at least ε (contrast this with LP-2). 5 Returning to the network of Figure 1, if J comprises all network reactions, then note that the flux vector [v1 , v2 , v3 , v4 , v5 , v6 ] = [ε, 0, ε, ε, ε, 2ε] is an optimal solution of LP-7. Hence, a single run of the latter can detect all unblocked reactions of that network. More generally, a single run of LP-7 on an arbitrary subset J of a given network will typically detect all unblocked irreversible reactions of J . The intuition is that LP-7 prefers flux ‘splitting’ over flux ‘concentrating’ in order to maximize the number of participating reactions in the solution, which, in the case of irreversible reactions, corresponds to flux cardinality maximization. By construction, the above approximation of the cardinality function applies only to nonnegative fluxes. In order to deal with reversible reactions that can also take negative fluxes, we can embed LP-7 in an iterative algorithm (as in the previous section), in which reversible reactions are first considered for positive flux via LP-7, and then they are considered for negative flux. The latter is possible by flipping the signs of the columns of the stoichiometric matrix that correspond to the reversible reactions under testing, in which case the fluxes of the transformed model are again all nonnegative, and the above approximation of the cardinality function can be used. This gives rise to an algorithm for detecting the consistent part of a network that we call fastcc (for fast consistency check). Since fastcc is just a variant of fastcore, we defer its detailed description until the next section. Independently to this work, a similar approach to network consistency testing was recently proposed, called OnePrune [12]. OnePrune first converts each reversible reaction into two irreversible reactions, forming an augmented set J of irreversible-only reactions (as in LP-2 above), and then it employs an LP that coincides with LP-7 for the above choice of J and ε = 1. However, such an approach is prone to the same drawback as LP-2, namely, that the two irreversible copies of a blocked reaction can carry equal positive flux at the solution of LP7 due to the presence of cycles introduced by the transformation. The authors acknowledge this problem but they do not fully resolve it. In our case, we avoid this problem by working with the original reactions and a series of LPs with appropriate sign flips of the stoichiometric matrix, thereby guaranteeing the completeness of the algorithm. 2.4 Context-specific network reconstruction The reconstruction problem involves computing a minimal consistent network from a global network and a ‘core’ set of reactions that are known to be active in a given context. Formally, given (i) a consistent global network {N , SN } with reaction set N = {1, 2, . . . , n} and stoichiometric matrix SN , and (ii) a set C ⊂ N , the problem is to find the smallest set A ⊆ N such that C ⊆ A and the subnetwork {A, SA } induced by the reaction set A is consistent. (By SA we denote the submatrix of SN that contains only the columns indexed by A.) This problem is known to be NP-complete [1], suggesting that a practical solution should entail some approximation. (We note that Acuña et al. [1] prove NP-completeness of this problem by noting that a special case involves C being the empty set, in which case the problem comes down to finding the smallest elementary mode of the global network, which, as the authors show, is NP-complete. However, this leaves open the case of a nonempty core set C, since a solution to the minimal reconstruction problem need not constitute an elementary mode. We conjecture that the problem remains NP-hard when C is nonempty, but we are not pursuing 6 this question here.) Our approach hinges on the observation that a consistent induced subnetwork of the global network can be defined via a set of modes of the latter: Theorem 1. Let V be a set of modes of the global network {N , SN }, and let A = ∪v∈V supp(v) be the union of the supports of these modes. The induced subnetwork {A, SA } is consistent. Proof. For each v ∈ V, let vA be the ‘truncated’ v after dropping all dimensions not indexed by A. Clearly, SA vA = 0, therefore each vA is a mode in the reduced model {A, SA }. By construction of A, each reaction in A is in the support of some v ∈ V, and hence also in the support of some mode vA of the reduced model. This simple result allows one to cast the reconstruction problem as a search problem over sets of modes of the global network: min card(A) V [ s.t. A = supp(v) (NLP-8) v∈V C⊆A ∀v ∈ V : SN v = 0, v ∈ B . Note that this optimization problem involves searching for a set V of modes of {N , SN }, such that the union of the support of these modes (the set A) is a minimal-cardinality set that contains the core set C. In order to practically make use of this theorem, one has to define a search strategy over modes. Next we discuss two possibilities. The first gives rise to an exact algorithm, but this algorithm does not scale to large networks. The second is a scalable greedy approach that gives rise to fastcore. Exact reconstruction via mixed integer linear programming Note that, without loss of generality, in NLP-8 we can restrict the search for V over all elementary modes of the global network, since the union of their supports covers the whole set N . As we show next, if all elementary modes are available, NLP-8 can be cast as a mixed integer linear program (MILP) and solved exactly. This MILP is defined as follows. Let r be the number of elementary modes, and {m1 , . . . , mr } be a set of length-n binary vectors, where each vector mj captures the support of elementary mode j (so, its ith entry is 1 if reaction i is included in elementary mode j, and 0 otherwise). Also, let c = (c1 , . . . , cn ) be a length-n binary vector with ci = 1 if reaction i is included in the core set C, and ci = 0 otherwise. The decision variables of the MILP are a length-n binary vector x = (x1 , . . . , xn ) and a length-r real vector y = (y1 , . . . , yr ). At an optimal solution of the MILP, the set A is defined as A = {i ∈ N : x∗i = 1}. Theorem 2. When all elementary modes are available, the following MILP-9 solves NLP-8 7 exactly. min x,y s.t. X xi i 1X mj yj r j X c≤ mj yj x≥ (MILP-9) j y ∈ [0, 1] x ∈ {0, 1} . Proof. By definition, x∗i = 1 implies that reaction i will be included in the reconstruction P A, hence the objective minimizes the cardinality of A. The sum j mj yj∗ is a vector whose support is the union of the supports of all selected elementary modes at the solution, where P an elementary mode j is selected when yj∗ > 0. The first constraint x ≥ 1r j mj yj therefore imposes that the set A must contain the union of the supports of the selected elementary P modes at the solution. (The factor 1r ensures that 1r j mj yj ≤ 1). Since superfluous reactions P are removed by the minimization of i xi in the objective, the above implies that A is precisely the union of the supports of the selected elementary modes at the solution. The P second constraint c ≤ j mj yj imposes that the core set must be included in the union of the supports of the selected elementary modes at the solution, and hence the core set must be included in A. Therefore, all constraints of NLP-8 are satisfied at the optimal solution of MILP-9, and since the two programs minimize the same objective, an optimal solution of MILP-9 must be an optimal solution of NLP-8. Note, however, that MILP-9 does not scale to large networks, for the following reasons: First, it requires computing all elementary modes of the global network, which can be a very large number [16]. Second, the binary decision variables xi index all reactions of the global network, and therefore MILP-9 needs to search over a binary hypercube of dimension n, which can be prohibitive for large n. Nonetheless, it is reassuring to know that an exact solution to the context-specific network reconstruction problem is possible, albeit with high complexity. Next we describe fastcore, an approximate greedy algorithm that scales much better to large networks, and we compare it to MILP-9 in the Results section. Greedy approximation and the fastcore algorithm An alternative search strategy for computing V in NLP-8 is a greedy approach, reminiscent of greedy heuristics for the related set covering problem [10]. This is the idea behind the proposed fastcore algorithm: We build up the set V in a greedy fashion, by computing in each iteration a new mode of the global network. Further, as a means to approximately minimize card(A), each added mode is constrained to have sparse support outside C. This is implemented via L1 -norm minimization, which is a standard approach to computing sparse solutions to (convex) optimization problems [6, 23]. The overall fastcore algorithm is shown in Algorithm 1. The algorithm maintains a set J ⊆ C that is initialized with the irreversible reactions in C, and a ‘penalty’ set P = (N \C)\A 8 Algorithm 1 The fastcore algorithm Input: A consistent metabolic network model {N , SN } and a reaction set C ⊂ N . Output: A consistent induced subnetwork {A, SA } of {N , SN } such that C ⊆ A. 1: function fastcore( N , C ) 2: J ← C ∩ I, P ← N \ C 3: f lipped ← F alse, singleton ← F alse 4: A ← FindSparseMode( J , P, singleton ) 5: J ←C\A 6: while J 6= ∅ do 7: P ←P \A 8: A ← A ∪ FindSparseMode( J , P, singleton ) 9: if J ∩ A = 6 ∅ then 10: J ← J \ A, f lipped ← F alse 11: else 12: if f lipped then 13: f lipped ← F alse, singleton ← T rue 14: else 15: f lipped ← T rue 16: if singleton then 17: J˜ ← J (1) (the first element of J ) 18: else 19: J˜ ← J 20: end if 21: for each i ∈ J˜ \ I do 22: flip the sign of the i’th column of SN and 23: swap the upper and lower bounds of vi 24: end for 25: end if 26: end if 27: end while 28: return A 29: end function that contains all reactions outside C that have not been added yet to the set A. Each iteration adds to the set A the support of a mode that is dense in J (i.e., contains as many nonzero fluxes in J as possible) and sparse in P (i.e., contains as many zero fluxes in P as possible), computed by the function FindSparseMode (Algorithm 2). This function first applies an LP-7 to compute an active subset K of J , and then it applies the following L1 -norm minimization LP constrained by the set K: X min zi v,z s.t. i∈P vi ∈ [−zi , zi ] ∀i ∈ P, zi ∈ R+ vi ≥ ε ∀i ∈ K SN v = 0 v ∈ B. 9 (LP-10) Algorithm 2 The FindSparseMode function Input: A set J ⊆ C, a penalty set P ⊆ N \ C, and the singleton flag. Output: The support of a mode that is dense in J and sparse in P. 1: function FindSparseMode( J , P, singleton ) 2: if J = ∅ then 3: return ∅ 4: end if 5: if singleton then 6: v ∗ ← LP-7 on set J (1) 7: else 8: v ∗ ← LP-7 on set J 9: end if 10: K ← {i ∈ J : vi∗ ≥ ε} 11: if K = ∅ then 12: return ∅ 13: end if 14: v ∗ ← LP-10 on sets K, P 15: return {i ∈ N : |vi∗ | ≥ ε} 16: end function P The LP-10 minimizes i∈P |vi |, the L1 norm of fluxes in the penalty set P (expressed via epigraphs), subject to a minimum flux constraint on the set K. However, some care is needed to preempt false negative solutions arising from the minimization of L1 norm in LP-10. For example, suppose in the network of Figure 1 that the global network comprises all reactions except A↔B, and C = J = K = {6} and P = {1, 3, 4, 5}. In this case, LP-10 could settle to a solution [v1 , v3 , v4 , v5 , v6 ] = [ 2ε , ε, 0, 0, ε]. The flux v1 , being below ε, would be treated as zero by FindSparseMode, in which case the reaction →2A would be erroneously excluded from the reconstruction. A simple way to avoid this is to use a scaled version of ε (we used 105 ε) in the second constraint of LP-10, with an equal scaling of all flux bounds in B. The fastcore algorithm first goes through the I ∩ C reactions (step 2), and then through the R ∩ C ones (and eventually through each individual reversible reaction in the core set; when singleton = T rue). The f lipped variable ensures that a reversible reaction is tested in both the forward and negative direction. The algorithm terminates when all reactions in C have been added to A, which is guaranteed since in the main loop the set J never expands (step 10) and the global network is consistent. Note that fastcore has no free parameters besides the flux threshold ε. The fastcc algorithm for detecting the consistent part of an input network (see previous section) can be viewed as a variant of fastcore(N , N ) in which the steps 10–14 of FindSparseMode are omitted (and there is no P set). It is easy to verify that fastcc is complete, in the sense that it will always report consistency if the network is consistent, and if not, it will reveal the set of blocked reactions. 10 Table 1: Summary of the main characteristics of GIMME [3], MBA [22], iMAT [43], mCADRE [41], INIT [2], and fastcore (this paper) reconstruction algorithms. Optimization Computational cost Function required Omics required Code available 2.5 GIMME LP low yes yes yes MBA MILP high no optional yes iMAT MILP high no yes yes mCADRE MILP high yes yes yes INIT MILP high yes yes no fastcore LP low no no yes Related work Several algorithms have been published in the last years for extracting condition-specific models from generic genome-wide models like Recon 1. Among them, mCADRE [41], INIT [2], iMAT [43], MBA [22] and GIMME [3] are the most commonly used (see Table 1 for an overview). Here we provide a short outline of the different algorithms, and refer to [4] for a more extensive overview. For GIMME, iMAT, and MBA, we briefly discuss some notable differences to fastcore. GIMME [3] takes as input microarray data and a biological function to optimize for, such as biomass production. GIMME starts by removing reactions with associated expression levels below a user-defined threshold, and then it optimizes for the specified biological function using linear programming. In case the pruning steps compromise the input biological function, GIMME reintroduces some previously removed reactions that are in minimal disagreement with the expression data. Since GIMME has not been designed to include all core reactions in the solution (as fastcore does), the reconstructions obtained by GIMME and fastcore can differ significantly: Running the createTissueSpecific function of the COBRA toolbox on a set of liver core reactions (see Section 3) treating them as expressed reactions (and adding a biomass reaction [41] and a sink reaction for glycogen to be used as optimization function), only about 50% of the core reactions of the GIMME model were consistent at the solution. A fairer comparison would require adapting fastcore to explicitly deal with omics data, which is outside the scope of the current work. iMAT [43] was originally designed for the integration of transcriptomic data. iMAT optimizes for the consistency between the experimental data and the activity state of the model reactions. iMAT tries to include modes composed of reactions associated to genes with high expression value, and therefore a threshold needs to be chosen to segregate between low, medium, and highly expressed genes. The computational demands of iMAT are high due to the repeated use of mixed integer linear programming. As with GIMME, direct comparison of iMAT to fastcore is problematic. Nevertheless, we applied iMAT (own implementation) on the liver problem (see Section 3), by setting the liver core reactions to RH (reaction high) and all non-core reactions to RL (reaction low). iMAT determined 549 core reactions as active, while 182 and 338 reactions were classified as undetermined and inactive, respectively. This 11 means that about 50% of the core reactions were lost during iMAT model building. As with GIMME, this demonstrates the difficulty of directly comparing fastcore to algorithms that optimize different objectives. mCADRE [41] is similar to MBA, except that the pruning order is not random, but it depends on the tissue-specific expression evidence and weighted connectivity to other reactions of the network. Reactions that are associated to genes that are never tagged as expressed and which are not connected to reactions associated to highly expressed genes are first evaluated in the pruning step. Reactions are effectively removed if the removal does not impair core reactions and metabolic functions to carry a flux (mCADRE removes core reactions if the core/non-core reaction ratio is below a user-given threshold). mCADRE uses mixed integer linear programming and therefore it does not scale up to large networks (but it is in general faster than MBA). INIT [2] uses data retrieved from public databases in order to assess the presence of a certain reaction-respective metabolites in the cell type of interest. INIT uses mixed integer linear programming to build a model in which all reactions can carry a flux. Contrary to other algorithms, INIT does not rely on the assumption of a steady state, but it allows small net accumulation of all metabolites of the model. The closest algorithm to fastcore is the MBA algorithm of Jerby et al. [22]. MBA takes as input two core sets of reactions, and it searches for a consistent network that contains all reactions from the first set, a maximum number of reactions from the second set (for a given tradeoff), and a minimal number of reactions from the global network. (fastcore can be easily adapted to work with multiple core sets, by introducing a set of weights that reflect the confidence of each reaction to be active in the given context, and adding appropriate regularization terms in the objective functions of LP-7 and LP-10 that capture the given tradeoff. We will address this variant in future work.) Both fastcore and MBA involve a search for a minimal consistent subnetwork, however the search strategy of fastcore is very different to MBA: Whereas fastcore iteratively expands the active set A starting with A = ∅, MBA starts with A = N and iteratively prunes the set A by checking whether the removal of each individual reaction (selected in random order) compromises network consistency. As the pruning order affects the output model, this step of MBA is repeated multiple times. MBA builds a final model by adding one by one non-core reactions with the highest presence rate over all pruning runs, and it stops when a consistent final model is obtained. Due to the multiple pruning runs, MBA has very high computational demands. Consistency testing in MBA is carried out with the CMC algorithm that is based on LP-3, as explained earlier. Hence, fastcore’s search strategy differs to MBA in two key aspects: First, consistency testing in fastcore involves the maximization of flux cardinality (LP-7) instead of sum of fluxes (LP-3), which results in fewer LP iterations. Second, the search for compact solutions in fastcore involves L1 -norm minimization instead of pruning. The advantage of the former is that it can be encoded by a single LP, resulting in significant overall speedups (see Section 3.2). 12 Figure 2: Flowchart of the overall pipeline for generating consistent context-specific models. 3 Results Generic metabolic reconstructions like Recon 2 are inconsistent models as they contain reactions that are not able to carry nonzero flux due to gaps in the network (see next section). The first step towards obtaining a consistent context-specific reconstruction is therefore to extract the consistent part of a global generic model. This can be achieved by fastcc or other similar methods (see Section 2.2). The consistent global model serves then as input for the context-specific reconstruction with fastcore. In Figure 2 we show a flowchart of the overall pipeline. We report results on two sets of problems, the first involving consistency verification of an input model, and the second involving the reconstruction of a context-specific model from an input model and a core set of reactions. The fastcore algorithm was implemented in the COBRA toolbox [33], using Matlab 2013a and the IBM CPLEX solver (version 12.5.0.0). Test runs were performed on a standard 1.8 GHz Intel Core i7 laptop with 4 GB RAM running Mac OS X 10.7.5. In all experiments we used flux threshold ε =1e-4. The software is available from bio.uni.lu/systems_biology/software/ 3.1 Consistency testing In the first set of experiments we applied fastcc, the consistency testing variant of fastcore, for consistency verification of four input models, and compared it against the FastFVA algorithm of Gudmundsson and Thiele [17], and an own implementation (based on fastcc but with LP-3 replacing LP-7) of the CMC algorithm of Jerby et al. [22]. We also tested the FVA algorithm of the reduceModel function of the COBRA toolbox [33], and the MIRAGE algorithm of Vitkin and Shlomi [40], but we do not include them in the results as they performed worse than the reported ones. The input models were the following: • c-Yeast (#N = 1204), the consistent part of a yeast model [42]. 13 Table 2: Comparing fastcc to fastFVA [17] and CMC [22] on four input models. fastFVA CMC fastcc c-Yeast # LPs time∗ 2408 3 18 0.5 7 0.1 c-Ecoli # LPs time 3436 3 25 1 2 0.2 c-Recon1 # LPs time 4938 9 49 2 9 0.4 c-Recon2 # LPs time 11668 207 42 11 19 5 ∗ in seconds • c-Ecoli (#N = 1718), the consistent part of an E. coli model [29]. (Here we set to 1000 the upper bounds of all fluxes that were fixed to zero, and we multiplied all bounds by 1000 to avoid numerical issues.) • c-Recon1 (#N = 2469), the consistent part of Recon 1 [13]. (Recon 1 was found to contain 1273 blocked reactions.) • c-Recon2 (#N = 5834), the consistent part of Recon 2 [39]. (Recon 2 was found to contain 1606 blocked reactions.) The results are shown in Table 2. fastcc is faster and it uses much fewer LPs than the other two algorithms. We note that fastFVA is based on an optimized Matlab/C++ implementation with LP warm-starts, while fastcc is based on standard Matlab. These results confirm the appropriateness of flux cardinality (LP-7) as a metric for network consistency testing, in agreement with the theoretical analysis and the discussions above. 3.2 Reconstruction of a liver model In the second set of experiments, we used the fastcore algorithm to reconstruct a liver specific metabolic network model from the consistent part of Recon 1 (c-Recon1, #N = 2469), and we compared against an own implementation of the MBA algorithm of Jerby et al. [22]. We applied the two algorithms in two settings. The first setting involves the liver specific input reaction set of Jerby et al. [22], which is based on 779 ‘high’ core and 290 ‘medium’ core reactions (the latter set is supported by weaker biological evidence than the former). To allow a comparison with fastcore, we defined a single core set as the union of the high and medium core reaction sets, and we applied the two algorithms on this core set. The second setting uses the ‘strict’ liver model of Jerby et al. [22], which contains 1083 high core reactions and no medium core reactions, and therefore allows a direct comparison with fastcore. The results for the two settings are shown in Table 3. We note that for MBA, the reported number of LPs and the runtime refer to a single pruning iteration of the algorithm, whereas the size of each reconstruction refers to the final model after 1000 pruning iterations. In both settings, fastcore is several orders of magnitude faster than MBA, achieving a full reconstruction of a liver specific model in about one second, using a much smaller number of LPs. As MBA employs a greedy pruning strategy for optimization, the number of LPs 14 Table 3: Comparing fastcore to MBA [22] on liver model reconstruction from c-Recon1. MBA fastcore liver core set (#C = 1069) #A IR∗ #LPs time‡ 1826 1573 72279 7383 1746 1546 20 1 strict liver core set (#C = 1083) #A IR #LPs time 1888 1630 71546 6730 1818 1627 20 1 ∗ number of intracellular reactions ‡ the reported time (in seconds), as well as the number of LPs, refer to a single pruning step of MBA, whereas #A and IR refer to the full MBA. that it uses and its total runtime can be very high, as also indicated by Wang et al. [41] who reported runtime of a single pruning pass of MBA in the order of 10 hours on a 2.34 GHz CPU computer. The reconstructed models by fastcore are also more compact than those obtained by MBA, with a difference of 70-80 non-core reactions. For the standard liver model, 1687 out of the 1746 reactions (96%) of the fastcore reconstruction appear also in the MBA reconstruction, whereas for the strict liver model the common reactions are 1739 out of 1818 (95%). The two algorithms turned out to use alternative transporters to connect the core reactions: In the standard liver model, 46 out of 59 reactions that are present exclusively in the fastcore reconstruction are transporter reactions or other reactions which are not associated to a specific gene and thus are not sufficiently supported in the core set, whereas in MBA the corresponding numbers are 116 out of 139 reactions. Note that both MBA and fastcore try to minimize the number of added non-core reactions in order to obtain a compact consistent model. The above difference in the number of added non-core reactions between MBA and fastcore is the result of the different optimization approaches taken by the two algorithms, and no biological relevance should be attributed to each reconstruction other than the one implied by the makeup of the core set. From this point of view, fastcore performs in general better than MBA, as it tends to add fewer unnecessary reactions. We also compared the solutions of fastcore to those of MILP-9, using core sets that are randomly generated from a consistent subset of E. coli core [30]. This is a small model with #N = 53 and 414 elementary modes (unfortunately, the dependence of the MILP-9 solver to the number of elementary modes did not allow testing larger models). In Figure 3 we show the size of the reconstructed models (mean values) obtained with the exact MILP solver vs. fastcore, as a function of the size of the core set. fastcore is capable of obtaining very good approximations to the optimal solutions, which improve with the size of the core set. To evaluate fastcore’s performance in correctly identifying liver reactions, we performed repeated random sub-sampling validation in which fastcore was used to reconstruct the liver metabolism based on a reduced, randomly selected ‘subcore’ set of 80% of the original core reactions. As in [22], we wanted to test whether fastcore is able to recover a significant number of the 20% left-out core reactions. To test for the enrichment of the left-out core reactions in the reconstructed model, we used a hypergeometric test, in which the total 15 Figure 3: Comparing fastcore to an exact MILP solver on a small E. coli model [30]. Shown are mean values of sizes of reconstructed models (over 50 repetitions for each core set; standard deviations were small and are omitted to avoid clutter) as a function of the size of the core set. fastcore computes near-optimal reconstructions, which improve with the size of the core set. population is defined by all non-subcore reactions in the global network, the number of draws is defined as the number of non-subcore reactions included in the reconstruction, and the leftout core reactions are the ‘successes’. Under the null-hypothesis that there is no enrichment for the left-out core reactions when reconstructing the liver model based on the subcore set, we can compute a p-value for including at least the number of observed left-out core reactions in the reconstruction. We repeated this random sub-sampling procedure 500 times and computed the corresponding p-values. The median of these p-values was 0.0025, indicating the ability of fastcore to capture liver-specific reactions that were included in the original core set. As argued above, the reconstructions obtained by fastcore need not optimize for cellular functions other than the ones implied by the composition of the input core set, and it is an interesting research question how to modify fastcore so that it can explicitly capture functional requirements in its reconstructions. Nevertheless, it is of interest to test whether the current version of fastcore can produce reconstructions that are functionally relevant, perhaps for slight variations of the core set. To this end, as in [22], we checked whether the (standard) liver model reconstructed by fastcore can perform gluconeogenesis from glucogenic amino acids, glycerol, and lactate (altogether 21 metabolites). If not yet included, transporters from the extracellular medium to the cytosol were added to the model (glycerol, glutamate, glycine, glutamine, and serine). This was necessary as the transport reactions were not sufficiently supported in the core set. This ‘extended’ liver model was able to convert 17/21 metabolites (vs 12/21 metabolites of the non-extended model). The extended liver model was then used to simulate the liver disorders hyperammonemia and hyperglutamenia, which affect 16 Figure 4: Mean urea/glutamine ratio in the extended liver model obtained by fastcore. Healthy (normal homozygote), partial (heterozygote) and full knock-out cases. See text for details. the capacity to metabolize dietary amino acids into urea [22]. Loss of function mutations of three enzyme-coding genes, argininosuccinate synthetase (ASS), argininosuccinate lyase (ASL), and ornithine transcarbamylase (OTC) were identified in patients suffering from these disorders. The rates of the reactions controlled by the three genes were fixed to 500, 250, or zero, to mimic the healthy homozygote (no mutation), heterozygote (loss of one allele), and the complete loss of function, respectively. To allow for a comparison with the experimental study of Lee et al. [24] where labeled 15N-glutamine was administrated to patients suffering from inborn errors affecting the three genes, we explicitly shut down the influx of other potential nitrogen sources in the liver model, thereby simulating only the uptake and metabolism of glutamine. By allowing the influx of only one nitrogen source, the fate of the latter could be determined exactly in the model. The ratio of urea secretion level over glutamine absorption was computed by sampling over the feasible space [32]. In accordance with the wet lab observations [24], the severity of the disorders, characterized by the mean urea over glutamine ratio, increased with the level of loss of function of the three genes ASS, ASL, and OTC (see Figure 4). Null patients showed no native production of urea. Overall, the ratios predicted by the fastcore model faithfully match the experimentally observed ones [24]. (The corresponding ratios reported by Jerby et al. when using the MBA algorithm [22] matched less well the experimental observations, probably because of the cross-feeding of nitrogen to urea from multiple nitrogen sources. By running the above procedure on the MBA model, we noticed that both models attained comparable urea / glutamine flux ratios.) To summarize, the above experiments demonstrate that, by an informed choice of the core set and influx bounds, fastcore can indeed give rise to functionally relevant models. 17 3.3 Reconstruction of a murine macrophage model We also used the fastcore algorithm to build a cell-type specific murine macrophage model from the consistent part of Recon1bio (comprising #N = 2474 reactions). Recon1bio (#N = 3745) is a modified Recon 1 model that contains three extra reactions (biomass, NADPOX, and a sink reaction to balance the glycogenin self-glucosylation reaction) [5]. We used a core set comprising 300 (out of 382) proteomics derived Raw264.7 macrophage reactions, as described by Bordbar et al. [5]. (The remaining 82 reactions could not be added to the core set as they are situated in an inconsistent region of Recon 1 and therefore carry a permanent zero net flux.) For their macrophage reconstruction, Bordbar et al. used, among other methods, GIMMEp—a variant of the GIMME algorithm [3] that is similar to the MBA algorithm—and they obtained a network model containing 1026 intracellular reactions. Our main interest was to investigate whether fastcore can obtain a functional network that is at least as compact as the one obtained with GIMMEp. fastcore generated (in about one second and using 11 LPs) a consistent network model of 953 reactions, 831 of which are intracellular reactions. This is a much more compact model than the one obtained with GIMMEp. 4 Discussion fastcore is a generic algorithm for context-specific metabolic network reconstruction from genome-wide metabolic models, and it was motivated by requirements of fast computation and compactness of the output model. The key advantage of having a fast reconstruction algorithm is that it permits the execution of multiple runs in order to optimize for extra parameters or test different core sets extracted from the input data [15, 41]. For example, when working with gene expression data, the definition of the core set may depend on the threshold used to segregate between high expression genes (core reactions) and low expression genes (non-core reactions) [3]. As the choice of threshold is rather arbitrary, a practical approach could involve evaluating the robustness of the output model as a function of the chosen threshold. fastcore can perform this analysis in a few minutes, whereas for the same problem other algorithms would need hours or days. (Algorithms like GIMME or GIMMEp that require manual curation and assembly of subnetworks, would also fail in this kind of task.) Another example where fast computation is imperative is cross-validation. In the current study (see Section 3) we ran a random sub-sampling validation procedure 500 times, an operation that took a few minutes with fastcore but that would barely be manageable with other reconstruction algorithms. Other examples where fast computation is important are time-course experiments or experiments involving different patients or conditions [21]. There fastcore could more easily identify differential models over time and/or input conditions. Compactness is a key concept in various research areas of biology, such as the minimal genome [28, 27]. Notwithstanding, the requirement of model compactness seems to be in disagreement with the observation that biological systems are fairly redundant and this redundancy serves a specific purpose, namely, the fast adaptation to changes in the environment. Alternative pathways that perform similar functions are known to be expressed in different 18 environmental conditions, allowing for instance to metabolize another type of sugar when glucose is not available [37]. At any rate, the pursuit of compactness in metabolic network reconstruction need not be in conflict with the notion of redundancy. Alternative pathways will be included in a reconstructed model as long as ‘redundant’ reactions that are supported by biological evidence are included in the core set. Acknowledgments We would like to thank Ines Thiele, Ronan Fleming, Nils Christian, Evangelos Symeonidis, Nathan Price, and Rudi Balling for their feedback. References [1] V. Acuña, F. Chierichetti, V. Lacroix, A. Marchetti-Spaccamela, M. F. Sagot, and L. Stougie. Modes and cuts in metabolic networks: Complexity and algorithms. Biosystems, 95(1):51–60, 2009. [2] R. Agren, S. Bordel, A. Mardinoglu, N. Pornputtapong, I. Nookaew, and J. Nielsen. Reconstruction of genome-scale active metabolic networks for 69 human cell types and 16 cancer types using INIT. PLoS Computational Biology, 8(5):e1002518, 2012. [3] S. A. Becker and B. Ø. Palsson. Context-specific metabolic networks are consistent with experiments. PLoS computational biology, 4(5):e1000082, 2008. [4] A. S. Blazier and J. A. Papin. Integration of expression data in genome-scale metabolic network reconstructions. Frontiers in Physiology, 3:299, 2012. [5] A. Bordbar, M. L. Mo, E. S. Nakayasu, A. C. Schrimpe-Rutledge, Y. M. Kim, T. O. Metz, M. B. Jones, B. C. Frank, R. D. Smith, S. N. Peterson, et al. Model-driven multi-omic data analysis elucidates metabolic immunomodulators of macrophage activation. Molecular Systems Biology, 8(1), 2012. [6] S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press, Cambridge, UK, 2004. [7] S. Chandrasekaran and N. D. Price. Probabilistic integrative modeling of genome-scale metabolic and regulatory networks in Escherichia coli and Mycobacterium tuberculosis. Proceedings of the National Academy of Sciences, 107(41):17845–17850, 2010. [8] R. L. Chang, L. Xie, L. Xie, P. E. Bourne, and B. Ø. Palsson. Drug off-target effects predicted using structural analysis in the context of a metabolic network model. PLoS Computational Biology, 6(9):e1000938, 2010. [9] N. Christian, P. May, S. Kempa, T. Handorf, and O. Ebenhöh. An integrative approach towards completing genome-scale metabolic networks. Mol. BioSyst., 5(12):1889–1903, 2009. [10] V. Chvátal. A greedy heuristic for the set-covering problem. Mathematics of operations research, 4(3):233–235, 1979. [11] R. J. DeBerardinis and C. B. Thompson. Cellular metabolism and disease: what do metabolic outliers teach us? Cell, 148(6):1132–1144, 2012. 19 [12] J. M. Dreyfuss, J. D. Zucker, H. M. Hood, L. R. Ocasio, M. S. Sachs, and J. E. Galagan. Reconstruction and validation of a genome-scale metabolic model for the filamentous fungus Neurospora crassa using FARM. PLoS Comput Biol, 9(7):e1003126, 07 2013. [13] N. C. Duarte, S. A. Becker, N. Jamshidi, I. Thiele, M. L. Mo, T. D. Vo, R. Srivas, and B. Ø. Palsson. Global reconstruction of the human metabolic network based on genomic and bibliomic data. Proceedings of the National Academy of Sciences, 104(6):1777–1782, 2007. [14] R. M. T. Fleming, C. Maes, Y. Ye, M. A. Saunders, and B. Ø. Palsson. A variational principle for computing nonequilibrium fluxes and potentials in genome-scale biochemical networks. Journal of Theoretical Biology, 292:71–77, 2012. [15] O. Folger, L. Jerby, C. Frezza, E. Gottlieb, E. Ruppin, and T. Shlomi. Predicting selective drug targets in cancer through metabolic networks. Molecular systems biology, 7:501, 2011. [16] J. Gagneur and S. Klamt. Computation of elementary modes: a unifying framework and the new binary approach. BMC bioinformatics, 5(1):175, 2004. [17] S. Gudmundsson and I. Thiele. Computationally efficient flux variability analysis. BMC bioinformatics, 11(1):489, 2010. [18] T. Hao, H. W. Ma, X. M. Zhao, and I. Goryanin. Compartmentalization of the Edinburgh human metabolic network. BMC bioinformatics, 11(1):393, 2010. [19] K. Hiller and C. M. Metallo. Profiling metabolic networks to study cancer metabolism. Current Opinion in Biotechnology, 24:60–68, 2013. [20] P. A. Jensen and J. A. Papin. Functional integration of a metabolic network model and expression data without arbitrary thresholding. Bioinformatics, 27(4):541–547, 2011. [21] L. Jerby and E. Ruppin. Predicting drug targets and biomarkers of cancer via genome-scale metabolic modeling. Clinical Cancer Research, 18(20):5572–5584, 2012. [22] L. Jerby, T. Shlomi, and E. Ruppin. Computational reconstruction of tissue-specific metabolic models: Application to human liver metabolism. Molecular Systems Biology, 6:401, 2010. [23] A. A. Julius, M. Imielinski, and G. J. Pappas. Metabolic networks analysis using convex optimization. In 47th IEEE Conference on Decision and Control, pages 762–767, 2008. [24] Brendan Lee, Hong Yu, Farook Jahoor, William O’Brien, Arthur L. Beaudet, and Peter Reeds. In vivo urea cycle flux distinguishes and correlates with phenotypic severity in disorders of the urea cycle. Proceedings of the National Academy of Sciences, 97(14):8021–8026, 2000. [25] N. E. Lewis, G. Schramm, A. Bordbar, J. Schellenberger, M. P. Andersen, J. K. Cheng, N. Patel, A. Yee, R. A. Lewis, R. Eils, et al. Large-scale in silico modeling of metabolic interactions between cell types in the human brain. Nature biotechnology, 28(12):1279–1285, 2010. [26] R. Mahadevan and C. H. Schilling. The effects of alternate optimal solutions in constraint-based genome-scale metabolic models. Metabolic engineering, 5(4):264, 2003. [27] J. Maniloff. The minimal cell genome: “on being the right size”. Proceedings of the National Academy of Sciences, 93(19):10004, 1996. [28] H. J. Morowitz. The completeness of molecular biology. Israel journal of medical sciences, 20(9):750, 1984. 20 [29] J. D. Orth, T. M. Conrad, J. Na, J. A. Lerman, H. Nam, A. M. Feist, and B. Ø. Palsson. A comprehensive genome-scale reconstruction of Escherichia coli metabolism. Molecular systems biology, 7(1), 2011. [30] J. D. Orth, R. M. T. Fleming, and B. Ø. Palsson. Reconstruction and use of microbial metabolic networks: the core Escherichia coli metabolic model as an educational guide. In A. Böck, R. Curtiss III, J. B. Kaper, P. D. Karp, F. C. Neidhardt, T. Nystrm, J. M. Slauch, C. L. Squires, and D. Ussery, editors, Escherichia coli and Salmonella: Cellular and Molecular Biology. ASM Press, Washington, DC, 2010. [31] M. Pourfar, M. Niethammer, and D. Eidelberg. Metabolic networks in Parkinson’s disease. In G. Grimaldi and M. Manto, editors, Mechanisms and Emerging Therapies in Tremor Disorders, Contemporary Clinical Neuroscience, pages 403–415. Springer New York, 2013. [32] N. D. Price, J. L. Reed, and B. Ø. Palsson. Genome-scale models of microbial cells: evaluating the consequences of constraints. Nature Reviews Microbiology, 2(11):886–897, 2004. [33] J. Schellenberger, R. Que, R. M. T. Fleming, I. Thiele, J. D. Orth, A. M. Feist, D. C. Zielinski, A. Bordbar, N. E. Lewis, S. Rahmanian, J. Kang, D. R. Hyduke, and B. Ø Palsson. Quantitative prediction of cellular metabolism with constraint-based models: the COBRA Toolbox v2.0. Nat Protoc, 6(9):1290–1307, Sep 2011. [34] S. Schuster and C. Hilgetag. On elementary flux modes in biochemical reaction systems at steady state. Journal of Biological Systems, 2(2):165–182, 1994. [35] T. Shlomi, M. N. Cabili, M.J. Herrgård, B. Ø. Palsson, and E. Ruppin. Network-based prediction of human tissue-specific metabolism. Nature biotechnology, 26(9):1003–1010, 2008. [36] G. Stephanopoulos, A. A. Aristidou, and J. Nielsen. Metabolic engineering: principles and methodologies. Academic Press, 1998. [37] J. Suckow, P. Markiewicz, L. G. Kleina, J. Miller, B. Kisters-Woike, B. Müller-Hill, et al. Genetic studies of the Lac repressor. XV: 4000 single amino acid substitutions and analysis of the resulting phenotypes on the basis of the protein structure. Journal of molecular biology, 261(4):509, 1996. [38] I. Thiele and B. Ø. Palsson. A protocol for generating a high-quality genome-scale metabolic reconstruction. Nature protocols, 5(1):93–121, 2010. [39] I. Thiele, N. Swainston, R. M. T. Fleming, A. Hoppe, S. Sahoo, M. K. Aurich, H. Haraldsdottir, M. L. Mo, O. Rolfsson, M. D. Stobbe, et al. A community-driven global reconstruction of human metabolism. Nature biotechnology (doi:10.1038/nbt.2488), 2013. doi:10.1038/nbt.2488. [40] E. Vitkin and T. Shlomi. MIRAGE: a functional genomics-based approach for metabolic network model reconstruction and its application to cyanobacteria networks. Genome biology, 13(11):R111, 2012. [41] Y. Wang, J. A. Eddy, and N. D. Price. Reconstruction of genome-scale metabolic models for 126 human tissues using mCADRE. BMC Systems Biology, 6(1):153, 2012. [42] A. R. Zomorrodi and C. D. Maranas. Improving the iMM904 S.cerevisiae metabolic model using essentiality and synthetic lethality data. BMC systems biology, 4(1):178, 2010. [43] Hadas Zur, Eytan Ruppin, and Tomer Shlomi. imat: an integrative metabolic analysis tool. Bioinformatics, 26(24):3140–3142, 2010. 21
5cs.CE
Furthering Baseline Core Lucid Standard Specification in the Context of the History of Lucid, Intensional Programming, and Context-Aware Computing Paquet, Joey Mokhov, Serguei A. arXiv:1107.0940v4 [cs.PL] 21 Oct 2013 SIGLUCID Abstract This work is multifold. We review the historical literature on the Lucid programming language, its dialects, intensional logic, intensional programming, the implementing systems, and context-oriented and context-aware computing and so on that provide a contextual framework for the converging Core Lucid standard programming model. We are designing a standard specification of a baseline Lucid virtual machine for generic execution of Lucid programs. The resulting Core Lucid language would inherit the properties of generalization attempts of GIPL (1999–2013) and TransLucid (2008–2013) for all future and recent Lucidimplementing systems to follow. We also maintain this work across local research group in order to foster deeper collaboration, maintain a list of recent and historical bibliography and a reference manual and reading list for students. We form a (for now informal) SIGLUCID group to keep track of this standard and historical records with eventual long-term goal through iterative revisions for this work to become a book or an encyclopedia of the referenced topics, and perhaps, an RFC. We first begin small with this initial set of notes. Contents 1 Introduction 1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Proposed Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 SIGLUCID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 3 3 2 Historical Perspective, Context, Dialects, and Applications 2.1 Lucid Dialects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Incomplete Brief History and The Family . . . . . . . . 2.2 List of Tools and Implementing Systems . . . . . . . . . . . . . 2.3 Application Domains . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 5 6 6 7 . . . . . . . 19 20 20 20 21 23 24 24 . . . . . . . . . . . . . . . 3 Core Lucid Standard Specification Design 3.1 SIGLUCID Meetings . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 SECASA 2010 Meeting at SERA 2010, Montreal, Canada . . 3.1.2 SECASA 2009 Meeting at COMPSAC 2009, Seattle, USA . . 3.1.3 SECASA 2008 Meeting at COMPSAC 2008, Turku, Finland 3.1.4 PLC 2005 Meeting at WORLDCOMP 2005, Las Vegas, USA 3.1.5 ISLIP 1999 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.6 ISLIP 1995 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Core Lucid Standard Specification: SIGLUCID’s Contextual Design 3.2 3.3 3.4 TransLucid . . . . . . . . . . . . . . . . . . . . . GIPSY . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Hybrid Interaction with Other Languages 3.3.2 Introduction to the GIPSY Type System The Core Lucid Standard . . . . . . . . . . . . . 3.4.1 Syntax . . . . . . . . . . . . . . . . . . . . 3.4.2 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SIGLUCID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 25 25 28 32 32 32 4 Conclusion 32 5 Future Work 33 6 Acknowledgments 33 List of Figures 1 2 3 GIPC Framework with the Preprocessor . . . . . . . . . . . . . . . . . . . . . . . Example of Eductive Evaluation of Objective Lucid Progran . . . . . . . . . . . . GIPSY Type System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 27 30 Listings 1 Example of a hybrid GIPSY program. . . . . . . . . . . . . . . . . . . . . . . . . 29 List of Tables 1 1 Matching data types between Lucid and Java. . . . . . . . . . . . . . . . . . . . . 31 Introduction This work gears toward a generalization on a number of previous results by various authors in terms of context specification in the Lucid programming language and the Core Lucid dealing with data types and have a virtual machine standard agreed to by SIGLUCID. Aside from various data types (primarily to address the hybrid computing paradigms uniformly of Lucid integrating with imperative dialects), the context definition should also be hierarchical for certain application domains to allow for context nesting. The notion of context is central to Lucid as an explicit meaning component that is specified as a first class-value. Traditional Lucid’s context specification was assuming tags and the corresponding values were simple – i.e. a collection of dimension names and the value pairs would denote a point in the context space. Then, the notion of point was not sufficient for some Lucid dialects that needed higher-order contextual notions, such as context sets to denote a context area or field instead of a point, as it was done in Lucx. Another way to traverse a more complex notion of the context definition was done in iHTML and related tools where nesting of the tags would denote the nesting of contextual expressions forming a sort of contextual tree, where the actual tag values were at the leaves of the tree. Then, a similar need arose in Forensic Lucid and MARFL to specify higher-order contexts representing evidence and witness stories or configuration details, but allowing evaluation at any level of the context tree rather than just the leaves. Thus, this work aims at unifying and 2 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID standardizing various context specifications under one uniform intermediate form that all Lucid dialects can adhere to thereby making the community speak the same language and potentially bring interoperability between various Lucid implementations and incarnations across University groups working in the intensional programming domain. 1.1 Motivation Higher-order context specification is needed for nested-level context that traditionally decomposes a higher-order value into its components, and equivalently from the components get to the parent component. This is partitioned in any nested markup-like language, e.g. iHTML, any XML-based definitions and descriptions of data and databases, configuration management of a software system components, as well as domain-specific applications such as contextual specification of a cyberforensic case where evidential statement is comprised of observation sequences representing encoded stories told by evidence and witnesses, which in turn decompose into observations, and then into properties and duration components; which all-in-all comprise a context of evaluation of a cyberforensic case. Thus, the need for higher-order contexts is apparent as a fundamental pillar supporting higher-order intensional logic (HOIL). Types other than the context also should be exposed to the programmer when needed and allow for a wider range of data types and type systems to allow hybrid dialect interaction easier as well as compiler optimization and run-time system parallelizations. 1.2 Proposed Solution For the context specification, we propose to extend the notion of context to be a bi-directional tree with the operators from GIPL, Lucx, iHTML and MARFL to query, switch, and traverse the depth of the context hierarchy. The language that encompasses the new specification on the syntax and semantic level is proposed to be called Core Lucid or Standard Lucid or Nominal Lucid. The type specification and code segments are augmented as presented in possible specification from the SIGLUCID meetings and others in Section 3.1 and Section 3.3.1. 1.3 SIGLUCID SIGLUCID: Special Interest Group on Lucid, Ubiquity, Context, Intensionality, and multiDimensionality. SIGLUCID is a working group of researchers in Lucid, intensional programming, intensional logic, context-aware and context-oriented computing and the related application domains (see Figure 2.3. SIGLUCID currently is a loose affiliation of researchers, collaborators, and supporters in intensional logic, intensional programming, context-aware computing, etc. across Canada, Australia, and other places. Should you wish to be a part and contribute, contact the people listed at the title page. This is a running draft to fill in the missing information as it becomes possible. 2 Historical Perspective, Context, Dialects, and Applications The history of Lucid, multi-dimensional intensional programming and logic, context-orientation, parallel, concurrent, and distributed eductive evaluation aspects can be traced through different Lucid dialects, outlined in Section 2.1. 3 Core Lucid Standard Specification: SIGLUCID’s Contextual Design 2.1 SIGLUCID Lucid Dialects Here we enumerate the Lucid dialects that came to be from either practical implementations and/or theoretical frameworks to study the intensionality properties, context, and mathematical and intensional logic foundations. We plan to make the list into a table or other presentation means with the status of each language and the related citations. • Lucid • GIPL • TransLucid • Lucx • GLU • GLU# • Indexical Lucid • Tensor Lucid • Partial Lucid • JLucid • Objective Lucid • Onyx • Forensic Lucid • JOOIP • MARFL • IHTML • IHTML2 • iPerl • ISE • vmake • Lustre • pLucid • Luthid 4 Core Lucid Standard Specification: SIGLUCID’s Contextual Design 2.1.1 SIGLUCID Incomplete Brief History and The Family From 1974 to Lucid Today (taken from [64], incomplete, to be updated: 1. Lucid as a Pipelined Dataflow Language through 1974-1977. Lucid was introduced by Anchroft and Wadge in [7, 8]. Features: • A purely declarative language for natural expression of iterative algorithms. • Goals: semantics and verification of correctness of programming languages (for details see [7, 8]). • Operators as pipelined streams: one for initial element, and then all for the successor ones. 2. Intensions, Indexical Lucid, GRanular Lucid (GLU, [45, 46]), circa 1996. More details on these two dialects are provided further in the chapter as they directly relate to the theme of this thesis. Features: • Random access to streams in Indexical Lucid. • First working hybrid intensional-imperative paradigm (C/Fortran and Indexical Lucid) in the form of GLU. • Eduction or demand-driven execution (in GLU). 3. Partial Lucid, Tensor Lucid, 1999 [95]. • Partial Lucid is an intermediate experimental language used for demonstrative purposes in presenting the semantics of Lucid in [95]. • Tensor Lucid dialect was developed by Joey Paquet for plasma physics computations to illustrate advantages and expressiveness of Lucid over an equivalent solution written in Fortran. 4. GIPL, 1999 [95]. • All Lucid dialects can be translated into this basic form of Lucid, GIPL through a set of translation rules. (GIPL is in the foundation of the execution semantics of GIPSY and its GIPC and GEE because its AST is the only type of AST GEE understands when executing a GIPSY program). 5. RLucid, 1999, [34] • A Lucid dialect for reactive real-time intensional programming. 6. JLucid, Objective Lucid, 2003 - 2005 • These dialects introduce a notion of hybrid and object-oriented programming in the GIPSY with Java and Indexical Lucid and GIPL, and are discussed great detail in the follow up chapters of this thesis. 7. Lucx [149], 2003 - 2005 • Kaiyu Wan introduces a notion of contexts as first-class values in Lucid, thereby making Lucx the true intensional language. 5 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID 8. Onyx [39], April 2004. • Peter Grogono makes an experimental derivative of Lucid – Onyx to investigate on lazy evaluation of arrays. 9. GLU# [93], 2004 • GLU# is an evolution of GLU where Lucid is embedded into C++. 2.2 List of Tools and Implementing Systems 1. GIPSY [102] 2. GLU 3. TransLucid 4. pLucid 5. libintense 2.3 Application Domains 1. Context-Aware Computing 2. Scientific Computing 3. Distributed and Parallel Evaluation 4. Ubiquitous and Mobile Computing 5. Wiki 6. Forensic Computing 7. Multimedia and Configuration Management 8. Program Verification 9. Software Engineering 10. Aspect-Oriented Programming 11. Web OS 12. Reactive Computing 13. Pervasive Computing 14. Autonomic Computing 15. Modeling and Simulation 16. Model Checking 6 Core Lucid Standard Specification: SIGLUCID’s Contextual Design 2.4 SIGLUCID Related Work There is a vast amount of related and past work done. Over time we will provide brief historical description of each or a group of works clustered by a specific theme either in this section or relevant other sections. For now, however, we begin by citing them first, so anyone looking for the references can look them up in a jiffy and make their choice accordingly. This is ideal for graduate students and researchers starting in the subjects or looking for what’s been done that they can benefit from. Most recent on top: • 2013 – Serguei A. Mokhov. Intensional Cyberforensics. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, September 2013 – Sleiman Rabah, Serguei A. Mokhov, and Joey Paquet. An interactive graph-based automation assistant: A case study to manage the GIPSY’s distributed multi-tier run-time system. In Proceedings of the ACM Research in Adaptive and Convergent Systems (RACS 2013), pages 387–394, New York, NY, USA, October 2011–2013. ACM. ISBN 978-1-4503-2348-2. Pre-print: http://arxiv.org/abs/1212.4123 • 2012 – Yi Ji, Serguei A. Mokhov, and Joey Paquet. Unifying and refactoring DMF to support concurrent Jini and JMS DMS in GIPSY. In Bipin C. Desai, Sudhir P. Mudur, and Emil I. Vassev, editors, Proceedings of the Fifth International C* Conference on Computer Science and Software Engineering (C3S2E’12), pages 36–44, New York, NY, USA, June 2010–2013. ACM. ISBN 978-1-4503-1084-0. doi: 10.1145/2347583. 2347588. Online e-print http://arxiv.org/abs/1012.2860 • 2011 – John Plaice. Cartesian programming. Technical Report UNSW-CSE-TR-1101, University of Grenoble, France, January 2011. Habilitation Thesis, online at ftp://ftp. cse.unsw.edu.au/pub/doc/papers/UNSW/1101.pdf – Yi Ji. Scalability evaluation of the GIPSY runtime system. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, March 2011 – Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Reasoning about a simulated printer case investigation with Forensic Lucid. In Pavel Gladyshev and Marcus K. Rogers, editors, Proceedings of ICDF2C’11, number 0088 in LNICST, pages 282–296. Springer, October 2011. ISBN 978-3-642-35514-1. doi: 10.1007/978-3-642-35515-8\ 23. Submitted in 2011, appeared in 2012; online at http://arxiv.org/abs/0906. 5181 – Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. On the need for data flow graph visualization of Forensic Lucid programs and forensic evidence, and their evaluation by GIPSY. In Proceedings of the Ninth Annual International Conference on Privacy, Security and Trust (PST), 2011, pages 120–123. IEEE Computer Society, July 2011. ISBN 978-1-4577-0582-3. doi: 10.1109/PST.2011.5971973. Short paper; full version online at http://arxiv.org/abs/1009.5423 7 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID • 2010 – Serguei A. Mokhov and Joey Paquet. A type system for higher-order intensional logic support for variable bindings in hybrid intensional-imperative programs in GIPSY. In Tokuro Matsuo, Naohiro Ishii, and Roger Lee, editors, 9th IEEE/ACIS International Conference on Computer and Information Science, IEEE/ACIS ICIS 2010, pages 921–928. IEEE Computer Society, May 2010. ISBN 978-0-7695-4147-1. doi: 10.1109/ ICIS.2010.156. Presented at SERA 2010; online at http://arxiv.org/abs/0906. 3919 – Serguei A. Mokhov and Joey Paquet. Using the General Intensional Programming System (GIPSY) for evaluation of higher-order intensional logic (HOIL) expressions. In Proceedings of SERA 2010, pages 101–109. IEEE Computer Society, May 2010. ISBN 978-0-7695-4075-7. doi: 10.1109/SERA.2010.23. Online at http://arxiv.org/ abs/0906.3911 – Aihua Wu, Joey Paquet, and Serguei A. Mokhov. Object-oriented intensional programming: Intensional Java/Lucid classes. In Proceedings of SERA 2010, pages 158– 167. IEEE Computer Society, 2010. ISBN 978-0-7695-4075-7. doi: 10.1109/SERA. 2010.29. Online at: http://arxiv.org/abs/0909.0764 – Bin Han, Serguei A. Mokhov, and Joey Paquet. Advances in the design and implementation of a multi-tier architecture in the GIPSY environment with Java. In Proceedings of SERA 2010, pages 259–266. IEEE Computer Society, 2010. ISBN 978-0-7695-40757. doi: 10.1109/SERA.2010.40. Online at http://arxiv.org/abs/0906.4837 – Bin Han. Towards a multi-tier runtime system for GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2010 – Yi Ji, Serguei A. Mokhov, and Joey Paquet. Unifying and refactoring DMF to support concurrent Jini and JMS DMS in GIPSY. In Bipin C. Desai, Sudhir P. Mudur, and Emil I. Vassev, editors, Proceedings of the Fifth International C* Conference on Computer Science and Software Engineering (C3S2E’12), pages 36–44, New York, NY, USA, June 2010–2013. ACM. ISBN 978-1-4503-1084-0. doi: 10.1145/2347583. 2347588. Online e-print http://arxiv.org/abs/1012.2860 – Serguei A. Mokhov. Hybrid Intensional Computing in GIPSY: JLucid, Objective Lucid and GICF. LAP - Lambert Academic Publishing, March 2010. ISBN 978-38383-1198-2 – Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Towards automatic deduction and event reconstruction using Forensic Lucid and probabilities to encode the IDS evidence. In S. Jha, R. Sommer, and C. Kreibich, editors, Proceedings of RAID’10, LNCS 6307, pages 508–509. Springer, September 2010. doi: 10.1007/978-3-642-15512-3\ 36 – Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. The need to support of data flow graph visualization of Forensic Lucid programs, forensic evidence, and their evaluation by GIPSY. [online], September 2010. Poster at VizSec’10; online at http: //arxiv.org/abs/1009.5423 – Serguei A. Mokhov, Emil Vassev, Joey Paquet, and Mourad Debbabi. Towards a selfforensics property in the ASSL toolset. In Proceedings of C3S2E’10, pages 108–113. ACM, May 2010. ISBN 978-1-60558-901-5. doi: 10.1145/1822327.1822342 8 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID • 2009 – Joey Paquet. Distributed eductive execution of hybrid intensional programs. In Proceedings of the 33rd Annual IEEE International Computer Software and Applications Conference (COMPSAC’09), pages 218–224, Seattle, Washington, USA, July 2009. IEEE Computer Society. ISBN 978-0-7695-3726-9 – Serguei A. Mokhov, Joey Paquet, and Xin Tong. A type system for hybrid intensionalimperative programming support in GIPSY. In Proceedings of C3S2E’09, pages 101– 107, New York, NY, USA, May 2009. ACM. ISBN 978-1-60558-401-0. doi: 10.1145/ 1557626.1557642 – Ai Hua Wu. OO-IP Hybrid Language Design and a Framework Approach to the GIPC. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2009 – Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Towards automated deduction in blackmail case analysis with Forensic Lucid. In Joseph S. Gauthier, editor, Proceedings of the Huntsville Simulation Conference (HSC’09), pages 326–333. SCS, October 2009. ISBN 978-1-61738-587-2. Online at http://arxiv.org/abs/0906.0049 – Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Reasoning about a simulated printer case investigation with Forensic Lucid. In Joseph S. Gauthier, editor, Proceedings of the Huntsville Simulation Conference (HSC’09), page 45. SCS, October 2009. ISBN 978-1-61738-587-2. Abstract, fully online at http://arxiv.org/abs/ 0906.5181 – Serguei A. Mokhov and Emil Vassev. Self-forensics through case studies of small to medium software systems. In Proceedings of IMF’09, pages 128–141. IEEE Computer Society, September 2009. ISBN 978-0-7695-3807-5. doi: 10.1109/IMF.2009.19 – Serguei A. Mokhov. The role of self-forensics modeling for vehicle crash investigations and event reconstruction simulation. In Joseph S. Gauthier, editor, Proceedings of the Huntsville Simulation Conference (HSC’09), pages 342–349. SCS, October 2009. ISBN 978-1-61738-587-2. Online at http://arxiv.org/abs/0905.2449 – Serguei A. Mokhov. Enhancing the formal cyberforensic approach with observation modeling with credibility factors and mathematical theory of evidence. [online], also in ;login: vol. 34, no. 6, p. 101, December 2009. Presented at WIPS at USENIX Security’09, http://www.usenix.org/events/sec09/wips.html – Serguei A. Mokhov. Towards improving validation, verification, crash investigations, and event reconstruction of flight-critical systems with self-forensics. [online], June 2009. A white paper submitted in response to NASA’s RFI NNH09ZEA001L, http:// arxiv.org/abs/0906.1845, mentioned in http://ntrs.nasa.gov/archive/nasa/ casi.ntrs.nasa.gov/20100025593_2010028056.pdf – Manuel Peralta, Supratik Mukhopadhyay, and Ramesh Bharadwaj. Automatic synthesis and deployment of intensional kahn process networks. In Dominik Ślȩzak, Tai hoon Kim, Stephen S. Yau, Osvaldo Gervasi, and Byeong-Ho Kang, editors, Grid and Distributed Computing, volume 63 of Communications in Computer and Information Science, pages 73–87. Springer Berlin Heidelberg, 2009. ISBN 978-3-642-10548-7. doi: 10.1007/978-3-642-10549-4\ 10 • 2008 9 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Khaled M. Ben Hamed. Multidimensional Programs on Distributed Parallel Computers: Analysis and Implementation. PhD thesis, Computer Science, the University of New Brunswick, February 2008 – John Plaice, Blanca Mancilla, and Gabriel Ditu. From Lucid to TransLucid: Iteration, dataflow, intensional and Cartesian programming. Mathematics in Computer Science, 2(1):37–61, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0043-9 – Mehmet A. Orgun, Chuchang Liu, and Abhaya C. Nayak. Knowledge representation, reasoning and integration using temporal logic with clocks. Mathematics in Computer Science, 2(1):143–163, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0048-4 – Dominic A. Orchard and Steve Matthews. Integrating lucid’s declarative dataflow paradigm into object-orientation. Mathematics in Computer Science, 2(1):103–122, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0046-6 – Blanca Mancilla and John Plaice. Possible worlds versioning. Mathematics in Computer Science, 2(1):63–83, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0044-8 – Angelos Charalambidis, Athanasios Grivas, Nikolaos S. Papaspyrou, and Panos Rondogiannis. Efficient intensional implementation for lazy functional languages. Mathematics in Computer Science, 2(1):123–141, 2008. ISSN 1661-8270. doi: 10.1007/ s11786-008-0047-5 – Amir Hossein Pourteymour. Comparative study of Demand Migration Framework implementation using JMS and Jini. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, September 2008 – Xin Tong. Design and implementation of context calculus in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, April 2008 – Serguei A. Mokhov. Towards syntax and semantics of hierarchical contexts in multimedia processing applications using MARFL. In Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), pages 1288–1294, Turku, Finland, July 2008. IEEE Computer Society. doi: 10.1109/COMPSAC.2008.206 – Joey Paquet, Serguei A. Mokhov, and Xin Tong. Design and implementation of context calculus in the GIPSY environment. In Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), pages 1278–1283, Turku, Finland, July 2008. IEEE Computer Society. doi: 10.1109/ COMPSAC.2008.200 – John Plaice, Blanca Mancilla, Gabriel Ditu, and William W. Wadge. Sequential demand-driven evaluation of eager TransLucid. In Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), pages 1266–1271, Turku, Finland, July 2008. IEEE Computer Society. doi: 10.1109/ COMPSAC.2008.191 – Toby Rahilly and John Plaice. A multithreaded implementation for TransLucid. In Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), pages 1272–1277, Turku, Finland, July 2008. IEEE Computer Society. doi: 10.1109/COMPSAC.2008.191 10 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Amir Hossein Pourteymour, Emil Vassev, and Joey Paquet. Design and implementation of demand migration systems in GIPSY. In Proceedings of PDPTA 2009. CSREA Press, June 2008 – Emil Vassev and Joey Paquet. Towards autonomic GIPSY. In Proceedings of the Fifth IEEE Workshop on Engineering of Autonomic and Autonomous Systems (EASE 2008), pages 25–34. IEEE Computer Society, 2008. ISBN 978-0-7695-3140-3. doi: 10.1109/EASe.2008.9 – Serguei A. Mokhov and Joey Paquet. Formally specifying and proving operational aspects of Forensic Lucid in Isabelle. Technical Report 2008-1-Ait Mohamed, Department of Electrical and Computer Engineering, Concordia University, Montreal, Canada, August 2008. In Theorem Proving in Higher Order Logics (TPHOLs2008): Emerging Trends Proceedings. Online at: http://users.encs.concordia.ca/~tphols08/ TPHOLs2008/ET/76-98.pdf and http://arxiv.org/abs/0904.3789 – Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Formally specifying operational semantics and language constructs of Forensic Lucid. In Oliver Göbel, Sandra Frings, Detlef Günther, Jens Nedon, and Dirk Schadt, editors, Proceedings of the IT Incident Management and IT Forensics (IMF’08), LNI140, pages 197–216. GI, September 2008. ISBN 978-3-88579-234-5. Online at http://subs.emis.de/LNI/ Proceedings/Proceedings140/gi-proc-140-014.pdf – Serguei A. Mokhov. Encoding forensic multimedia evidence from MARF applications as Forensic Lucid expressions. In Tarek Sobh, Khaled Elleithy, and Ausif Mahmood, editors, Novel Algorithms and Techniques in Telecommunications and Networking, proceedings of CISSE’08, pages 413–416, University of Bridgeport, CT, USA, December 2008. Springer. ISBN 978-90-481-3661-2. doi: 10.1007/978-90-481-3662-9\ 71. Printed in January 2010 – Serguei A. Mokhov. Towards security hardening of scientific distributed demanddriven and pipelined computing systems. In Proceedings of the 7th International Symposium on Parallel and Distributed Computing (ISPDC’08), pages 375–382. IEEE Computer Society, July 2008. ISBN 978-0-7695-3472-5. doi: 10.1109/ISPDC.2008.52 • 2007 – Amir Hossein Pourteymour, Emil Vassev, and Joey Paquet. Towards a new demanddriven message-oriented middleware in GIPSY. In Proceedings of PDPTA 2007, pages 91–97. PDPTA, CSREA Press, June 2007 – Xin Tong, Joey Paquet, and Serguei A. Mokhov. Complete context calculus design and implementation in GIPSY. [online], 2007–2008. http://arxiv.org/abs/1002. 4392 – Gabriel Ditu. The Programming Language TransLucid. PhD thesis, University of New South Wales, Australia, 2007 • 2006 – Kaiyu Wan. Lucx: Lucid Enriched with Context. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2006 • 2005 11 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Kaiyu Wan, Vasu Alagar, and Joey Paquet. Real time reactive programming in lucid enriched with contexts. In Zhiming Liu and Keijiro Araki, editors, Theoretical Aspects of Computing - ICTAC 2004, volume 3407 of Lecture Notes in Computer Science, pages 387–402. Springer Berlin Heidelberg, 2005. ISBN 978-3-540-25304-4. doi: 10.1007/978-3-540-31862-0\ 28 – Kaiyu Wan, Vasu Alagar, and Joey Paquet. Lucx: Lucid enriched with context. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 48–14. CSREA Press, June 2005 – Serguei Mokhov and Joey Paquet. General imperative compiler framework within the GIPSY. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 36–42. CSREA Press, June 2005 – Serguei A. Mokhov. Towards hybrid intensional programming with JLucid, Objective Lucid, and General Imperative Compiler Framework in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, October 2005. ISBN 0494102934; online at http://arxiv.org/ abs/0907.2640 – Serguei Mokhov and Joey Paquet. Objective Lucid – first step in object-oriented intensional programming in the GIPSY. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 22–28. CSREA Press, June 2005 – Peter Grogono, Serguei Mokhov, and Joey Paquet. Towards JLucid, Lucid with embedded Java functions in the GIPSY. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 15–21. CSREA Press, June 2005 – Joey Paquet and Ai Hua Wu. GIPSY – a platform for the investigation on intensional programming languages. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 8–14. CSREA Press, June 2005 – Emil Vassev and Joey Paquet. A general architecture for demand migration in a demand-driven execution engine in a heterogeneous and distributed environment. In Proceedings of the 3rd Annual Communication Networks and Services Research Conference (CNSR 2005), pages 176–182. IEEE Computer Society, May 2005. doi: 10.1109/CNSR.2005.9 – Ai Hua Wu and Joey Paquet. Object-oriented intensional programming in the GIPSY: Preliminary investigations. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 43–47. CSREA Press, June 2005 – Emil Vassev and Joey Paquet. A generic framework for migrating demands in the GIPSY’s demand-driven execution engine. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 29–35. CSREA Press, June 2005 – Emil Iordanov Vassev. General architecture for demand migration in the GIPSY demand-driven execution engine. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, June 2005. ISBN 0494102969 12 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Kaiyu Wan, Vasu Alagar, and Joey Paquet. A context theory for intensional programming. In Workshop on Context Representation and Reasoning (CRR05), July 2005 – Melvin C. Fitting. FOIL axiomatized. [online], August 2005. http://comet.lehman. cuny.edu/fitting/bookspapers/pdf/papers/FOILAxioms.pdf • 2004 – Paul Swoboda. A Formalisation and Implementation of Distributed Intensional Programming. PhD thesis, The University of New South Wales, Sydney, Australia, 2004 – Bo Lu. Developing the Distributed Component of a Framework for Processing Intensional Programming Languages. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, March 2004 – Paul Swoboda and John Plaice. A new approach to distributed context-aware computing. In A. Ferscha, H. Hoertner, and G. Kotsis, editors, Advances in Pervasive Computing. Austrian Computer Society, 2004. ISBN 3-85403-176-9 – Paul Swoboda and John Plaice. An active functional intensional database. In F. Galindo, editor, Advances in Pervasive Computing, pages 56–65. Springer, 2004. LNCS 3180 – Peter Grogono. Intensional programming in Onyx. Technical report, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, April 2004 – Joey Paquet, Aihua Wu, and Peter Grogono. Towards a framework for the General Intensional Programming Compiler in the GIPSY. In Proceedings of the 19th Annual ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2004), pages 164–165, New York, NY, USA, October 2004. ACM. doi: 10.1145/1028664.1028731 – Lei Tao. Warehouse and garbage collection in the GIPSY environment. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2004 – Yimin Ding. Automated translation between graphical and textual representations of intensional programs in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, June 2004. http://newton.cs.concordia.ca/~paquet/filetransfer/publications/ theses/DingYiminMSc2004.pdf – Nikolaos S. Papaspyrou and Ioannis T. Kassios. GLU# embedded in C++: a marriage between multidimensional and object-oriented programming. Softw., Pract. Exper., 34(7):609–630, 2004. ISSN 0038-0644. doi: 10.1002/spe.582 – Vasu S. Alagar, Joey Paquet, and Kaiyu Wan. Intensional programming for agent communication. In Jo ao Leite, Andrea Omicini, Paolo Torroni, and Pinar Yolum, editors, Declarative Agent Languages and Technologies II, volume 3476 of Lecture Notes in Computer Science, pages 239–255. Springer Berlin Heidelberg, 2005. ISBN 978-3-540-26172-8. doi: 10.1007/11493402\ 14 • 2003 13 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Bo Lu, Peter Grogono, and Joey Paquet. Distributed execution of multidimensional programming languages. In Proceedings of the 15th IASTED International Conference on Parallel and Distributed Computing and Systems (PDCS 2003), volume 1, pages 284–289. International Association of Science and Technology for Development, November 2003 – Ai Hua Wu, Joey Paquet, and Peter Grogono. Design of a compiler framework in the GIPSY system. In Proceedings of the 15th IASTED International Conference on Parallel and Distributed Computing and Systems (PDCS 2003), volume 1, pages 320– 328. International Association of Science and Technology for Development, November 2003 – William W. Wadge. Hammings problem example. [online], December 2003. http: //i.csc.uvic.ca/home/hei/lup/contents.html – Anand Ranganathan and Roy H. Campbell. A middleware for context-aware agents in ubiquitous computing environments. In Markus Endler and Douglas Schmidt, editors, Proceedings of Middleware 2003, volume 2672 of Lecture Notes in Computer Science, pages 143–161. Springer Berlin Heidelberg, 2003. ISBN 978-3-540-40317-3. doi: 10.1007/3-540-44892-6\ 8 – Simon Gay and Rajagopal Nagarajan. Intensional and extensional semantics of dataflow programs. Formal Aspects of Computing, 15(4):299–318, 2003. ISSN 09345043. doi: 10.1007/s00165-003-0018-1 • 2002 – Peter Grogono. GIPC increments. Technical report, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, April 2002 – Ai Hua Wu. Semantic checking and translation in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2002 – Chun Lei Ren. General intensional programming compiler (GIPC) in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2002 • 2000 – Joey Paquet and Peter Kropf. The GIPSY architecture. In Proceedings of Distributed Computing on the Web, Quebec City, Canada, 2000 • 1999 – Peter Kropf and John Plaice. Intensional objects. In International symposium on Languages for Intensional Programming, pages 37–45, Athens, Greece, June 1999. Demokrits Institute – Panagiotis Rondogiannis. Adding multidimensionality to procedural programming languages. Software: Practice and Experience, 29(13):1201–1221, 1999. ISSN 1097024X. doi: 10.1002/(SICI)1097-024X(199911)29:13h1201::AID-SPE278i3.0.CO;2-0 – Joey Paquet. Scientific Intensional Programming. PhD thesis, Department of Computer Science, Laval University, Sainte-Foy, Canada, 1999 14 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Manolis Gergatsoulis and Panos Rondogiannis, editors. Proceedings of ISLIP’99, volume Intensional Programming II, June 1999. World Scientific. ISBN: 981-02-40953 – William W. Wadge. Intensional logic in context. In Gergatsoulis and Rondogiannis [37], pages 1–13. Tutorial – Thom Frühwirth. Constraint solving with constraint handling rules. In Gergatsoulis and Rondogiannis [37], pages 14–30. Tutorial – William W. Wadge and M. C. Schraefel. Putting the hyper back in hypertext. In Gergatsoulis and Rondogiannis [37], pages 31–39 – M. C. Schraefel, Blanca Mancilla, and John Plaice. Intensional hypertext. In Gergatsoulis and Rondogiannis [37], pages 40–54 – Yu Zhang and Kang Zhang. Associative query for multi-version web documents. In Gergatsoulis and Rondogiannis [37], pages 55–64 – Jiannong Cao, Alvin Chan, and Kang Zhang. Programming dynamically reconfigurable web server groups using the DyGOP model. In Gergatsoulis and Rondogiannis [37], pages 65–77 – Alessandra Raffaetà and Thom Frühwirth. Two semantics for temporal annotated constraint logic. In Gergatsoulis and Rondogiannis [37], pages 78–92 – Michael Fisher and Tony Kakoudakis. Flexible agent grouping in executable temporal logic. In Gergatsoulis and Rondogiannis [37], pages 93–105 – Costas D. Koutras and Christos Nomikos. On the computational complexity of stratified negation in linear-time temporal logic programming. In Gergatsoulis and Rondogiannis [37], pages 106–117 – Manolis Gergatsoulis. Extensions of the branching-time logic programming language Cactus. In Gergatsoulis and Rondogiannis [37], pages 118–132 – Themis Panayiotopoulos. Temporal reasoning with TRL. In Gergatsoulis and Rondogiannis [37], pages 133–148 – Loı̈c Besnard, Patricia Bourani, Thierry Gautier, Nicolas Halbwachs, Simin NadjmTehrani, and Annie Ressouche. Design of a multi-formalism application and distribution in a data-flow context: An example. In Gergatsoulis and Rondogiannis [37], pages 149–167 – Jean-Raymond Gagné and John Plaice. Demand-driven real-time computing. In Gergatsoulis and Rondogiannis [37], pages 168–181. ISBN: 981-02-4095-3 – Weiqiang Lin and Mehmet A. Orgun. Applied hidden periodicity analysis for mining descrete-valued time series databases. In Gergatsoulis and Rondogiannis [37], pages 182–196 – Ion Androutsopoulos. Temporal meaning representation in a natural language frontend. In Gergatsoulis and Rondogiannis [37], pages 197–213 – Win Maung, Chit Swe, and Mehmet A. Orgun. Statistical queries on historical relational databases. In Gergatsoulis and Rondogiannis [37], pages 214–228 – Themis Panayiyotopoulos and L. C. Baxevanaki. Statistical queries on historical relational databases. In Gergatsoulis and Rondogiannis [37], pages 229–243 15 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Weichang Du. Toward an intensional model for programming large scale distributed systems. In Gergatsoulis and Rondogiannis [37], pages 244–258 – Joey Paquet and John Plaice. The semantics of dimensions as values. In Gergatsoulis and Rondogiannis [37], pages 259–273 – Panos Rondogiannis. Adding multidimensionality to procedural programming languages. In Gergatsoulis and Rondogiannis [37], pages 274–291 – John Plaice and Peter G. Kropf. Intensional communities. In Gergatsoulis and Rondogiannis [37], pages 292–295 – Paul Swoboda and William W. Wadge. Vmake and ISE general tools for the intensionalization of software systems. In Gergatsoulis and Rondogiannis [37], pages 310–320. ISBN: 981-02-4095-3 • 1998 – William W. Wadge, G. Brown, M. C. Schraefel, and T. Yildirim. Intensional HTML. In 4th International Workshop PODDP’98, March 1998 • 1997 – Q. Zhao. Implementation of an object-oriented intensional programming system. Master’s thesis, Department of Computer Science, University of New Brunswick, Canada, 1997 – Raganswamy Jagannathan, Chris Dodd, and Iskender Agi. GLU: A high-level system for granular data-parallel programming. In Concurrency: Practice and Experience, volume 1, pages 63–83, 1997 – Mehmet A. Orgun and Weichang Du. Multi-dimensional logic programming: Theoretical foundations. Theoretical Computer Science, 185(2):319–345, 1997. ISSN 0304-3975. doi: 10.1016/S0304-3975(97)00048-0 • 1996 – Chris Dodd. Intensional Programming I, chapter Rank analysis in the GLU compiler, pages 76–82. Volume Intensional Programming I of Orgun and Ashcroft [87], May 1996. ISBN: 981-02-2400-1 – Raganswamy Jagannathan and Chris Dodd. GLU programmer’s guide. Technical report, SRI International, Menlo Park, California, 1996 • 1995 – Joey Paquet. Relational databases as multidimensional dataflows. Master’s thesis, Departement d’Informatique, Université Laval, Québec, Canada, 1995 – Edward A. Ashcroft, Anthony A. Faustini, Rangaswamy Jagannathan, and William W. Wadge. Multidimensional Programming. Oxford University Press, London, February 1995. ISBN: 978-0195075977 – Mehmet A. Orgun and Edward A. Ashcroft, editors. Proceedings of ISLIP’95, volume Intensional Programming I, May 1995. World Scientific. ISBN: 981-02-2400-1 – Paul Caspi and Pouzet. A functional extension to Lustre. In Orgun and Ashcroft [87], pages 15–29. Invited Contribution 16 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Edward A. Ashcroft. Multidimensional program verification: Reasoning about programs that deal with multidimensional objects. In Orgun and Ashcroft [87], pages 30–41. Invited Contribution – David Abramson and Rok Sosič. Relative debugging using multiple program versions. In Orgun and Ashcroft [87], pages 42–55. Invited Contribution – William W. Wadge. Possible WOOrlds. In Orgun and Ashcroft [87], pages 56–62. Invited Contribution – R. Jagannathan. Intensional and extensional graphical models for GLU programming. In Orgun and Ashcroft [87], pages 63–75 – Jiannong Cao, Lichucha Fernando, and Kang Zhang. Programming distributed systems based on graphs. In Orgun and Ashcroft [87], pages 83–95 – Yaowei Liu and John Staples. Building logic constructs into procedural programming languages. In Orgun and Ashcroft [87], pages 96–109 – Lorenzo Verdoscia. ALFA fine grain dataflow machine. In Orgun and Ashcroft [87], pages 110–134 – Iskender Agi. GLU for multidimensional signal processing. In Orgun and Ashcroft [87]. URL citeseer.ist.psu.edu/agi95glu.html. ISBN: 981-02-2400-1 – John Plaice. Particle in-cell simulation with Lucid. In Orgun and Ashcroft [87], pages 149–161 – Satoshi Yamane. Real-time object-oriented specification and verification. In Orgun and Ashcroft [87], pages 162–185 – Wanli Ma and Mehmet A. Orgun. Verifying MULTRAN programs with temporal logic. In Orgun and Ashcroft [87], pages 186–206 – William W. Wadge and Alan Yoder. The Possible-World Wide Web. In Orgun and Ashcroft [87], pages 207–213 – Joey Paquet and John Plaice. The intensional relation. In Orgun and Ashcroft [87], pages 214–227 – Panos Rondogiannis and William W. Wadge. Extending the intensionalization algorithm to a broader class of higher-order programs. In Orgun and Ashcroft [87], pages 228–233 – Padmanabhan Krishnan. An asynchronous calculus based on absence of actions. In Orgun and Ashcroft [87], pages 234–248 – Richard Buckland. Choice as a first class citizen. In Orgun and Ashcroft [87], pages 249–259 – Seiki Akama. A meta-level approach to modal logic programming. In Orgun and Ashcroft [87], pages 260–272 – Tu Van Le. Fuzzy temporal Prolog. In Orgun and Ashcroft [87], pages 273–280 – Chuchang Liu and Mehmet A. Orgun. Knowledge-based simulation with Chronolog. In Orgun and Ashcroft [87], pages 281–295 • 1994 – Panagiotis Rondogiannis. Higher-Order Functional Languages and Intensional Logic. PhD thesis, Department of Computer Science, University of Victoria, Victoria, Canada, 1994 17 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Joey Paquet and John Plaice. On the design of an indexical query language. In Proceedings of the Seventh International Symposium on Lucid and Intensional Programming, pages 28–36, 1994 – S. Tao. TLucid and Intensional Attribute Grammars. PhD thesis, Department of Computer Science, Victoria University, Canada, 1994 – Weichang Du. Object-oriented implementation of intensional language. In Proceedings of the 7th International Symposium on Lucid and Intensional Programming, pages 37–45, Menlo Park, California, USA, September 1994. SRI International • 1993 – John Plaice and William W. Wadge. A new approach to version control. IEEE Transactions on Software, 19(3):268–276, March 1993 – John Plaice, Ridha Khedri, and Ren’e Lalement. From abstract time to real time. In In Proceedings of the Sixth International Symposium on Lucid and Intensional Programming, pages 83–93, 1993 – Anthony A. Faustini and R. Jagannathan. Multidimensional problem solving in Lucid. Technical Report SRI-CSL-93-03, SRI International, 1993 • 1991 – Weichang Du. Indexical Parallel Programming. PhD thesis, Department of Computer Science, Victoria University, Canada, 1991 – B. Freeman-Benson. Lobjcid: Objects in Lucid. In Proceedings of the 1991 Symposium on Lucid and Intensional Programming, pages 80–87, Menlo Park, California, USA, April 1991. SRI International • 1990 – Weichang Du and William W. Wadge. The eductive implementation of a threedimensional spreadsheet. Software Practice and Experience, 20(11):1097–1114, November 1990. ISSN 0038-0644 – Weichang Du and William W. Wadge. A 3D spreadsheet based on intensional logic. IEEE Software, 7(3):78–89, June 1990. doi: 10.1109/52.55232 • 1989 – Anthony A. Faustini and E. B. Lewis. Towards a Real-Time Dataflow Language. IEEE Computer Society, Los Alamitos, CA, USA, 1989. ISBN 0-8186-0819-6 • 1988 – J. van Benthem. A Manual of Intensional Logic. CSLI Publications, Stanford and The University of Chicago Press, 1988. ISBN 0-937073-29-6 • 1987 – Sally C. Johnson. A strategy for automatically generating programs in the Lucid programming language (NASA technical memorandum). Technical report, NASA, Scientific and Technical Information Office, 1987. ASIN: B000711R3Q 18 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID – Antony A. Faustini and William W. Wadge. An eductive interpreter for the language Lucid. SIGPLAN Not., 22(7):86–91, 1987. ISSN 0362-1340. doi: 10.1145/960114. 29659 • 1985 – William W. Wadge and Edward A. Ashcroft. Lucid, the Dataflow Programming Language. Academic Press, London, 1985 • 1982 – Anthony A. Faustini. The Equivalence of a Denotational and an Operational Semantics of Pure Dataflow. PhD thesis, University of Warwick, Computer Science Department, Coventry, United Kingdom, 1982 – Edward A. Ashcroft and William W. Wadge. R for semantics. ACM Transactions on Programming Languages and Systems, 4(2):283–294, April 1982 • 1981 – C. B. Ostrum. The Luthid 1.0 Manual. Department of Computer Science, University of Waterloo, Ontario, Canada, 1981 • 1977 – Edward A. Ashcroft and William W. Wadge. Lucid, a nonprocedural language with iteration. Communications of the ACM, 20(7):519–526, July 1977. ISSN 0001-0782. doi: 10.1145/359636.359715 – Edward A. Ashcroft and William W. Wadge. Erratum: Lucid – a formal system for writing and proving programs. SIAM J. Comput., 6(1):200, 1977 • 1976 – Edward A. Ashcroft and William W. Wadge. Lucid – a formal system for writing and proving programs. SIAM J. Comput., 5(3), 1976 Wikipedia and other Wiki entries: • http://en.wikipedia.org/wiki/Lucid_(programming_language) • http://en.wikipedia.org/wiki/Category:Intensional_programming_languages • http://en.wikipedia.org/wiki/Intensional_logic • http://www.haskell.org/haskellwiki/Lucid 3 Core Lucid Standard Specification Design The Core Lucid standard design and specification is an ongoing process influenced by the two core proposals: GIPL and TransLucid developed in 1999 and 2008 respectively. 19 Core Lucid Standard Specification: SIGLUCID’s Contextual Design 3.1 SIGLUCID SIGLUCID Meetings Here’s the brief summary of the SIGLUCID meetings at various workshops and conferences, attendees, and works contributing to the collaboration and developing the Core Lucid standard. 3.1.1 SECASA 2010 Meeting at SERA 2010, Montreal, Canada Works The following works were presented: 1. [43] 2. [75] 3. [155] 4. [74] T ODO Attendees 1. Serguei A. Mokhov 2. Joey Paquet 3. Emil Vassev 4. Bin Han T ODO 3.1.2 SECASA 2009 Meeting at COMPSAC 2009, Seattle, USA Works The following works were presented: 1. [96] T ODO 20 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID Attendees 1. Joey Paquet 2. John Plaice T ODO 3.1.3 SECASA 2008 Meeting at COMPSAC 2008, Turku, Finland The first discussion about standardizing the types, evaluation, and overview of the current candidates for the Lucid Core from different research groups, such as GIPL, TransLucid. The needs of various in-progress Lucid dialects were discussed to be accommodated in the core, such as MARFL, Forensic Lucid. Below are the points from the meeting minutes. Works The following works were presented: 1. [104] 2. [112] 3. [118] 4. [67] Attendees 1. Weichang Du 2. Blanca Mancilla 3. Serguei A. Mokhov 4. Joey Paquet 5. John Plaice 6. Toby Rahilly 7. William W. Wadge Notes 1. Constants appearing in the expressions: type<string> (const type -- int8<42> != int16<42>) [| string |] 12 true false 21 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID 2. header – default types for integers, etc. 3. #parens – see the sections on the GIPSY type system and a hybrid program example Section 3.3.1 and Section 3.3.2 4. Proposal of type (’type’ is a keyword). • type<float 32> • uchar<> uchar<> • shorthand syntactical sugar: [||| 1.2 |||] – 64 bit IEEE float {{{ 1.2 }}} – 32 bit float 5. special<...> – correspond to exceptions and error situations for handling later on 6. Joey: Dimensions syntactically are allowed to taken on default values other than always implicit default of zero. • special<undecl> special¡arith¿ = special¡undecl¿+ – lose details, e.g. where it happened in the code or even within the imperative code? • if(isspecial<undecl> E) then ... 7. Bill has done something like that with someone in pLucid, with well defined semantics, etc. 8. Bill complained about eagerness: {E1 : E2 , ..., En : En2 } eager: only lefts (multithreaded [118]), else all —, but right-hand-sides are lazy. 9. Q: How to stop people from producing recursive/infinite contexts? 10. Bill: risky: \# a@{a:P, E:Q} != P ??? If E does not terminate or special – can’t prove it’s constant. 11. Toby: threading, sequential scheduling 12. Audience concluded: GIPL context-eager, TransLucid dimension-eager (LHS) 13. Variables variable x dimension d type of x is context-dependent. Future: id<x> dimension<d> expr<E> 22 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID 14. Dynamic ranks analysis (Tony Faustini and Bill in the ’80) (X, C)? ? = eduction evaluation engine W?(X, {}) ->42 ->{d1,....,dn}? v1=C(d1) vn=C{dn} v’1=C(d1’) v’m=C{dm’} W?(X, {d1:v1, ....}) ->42 -> {d’2,...,d’n}? x, W, C, Cs, Ci # 3 W’ = W U {(X, Cs) |-> {3}?} Ci – current internal context 15. Toby: optimization: demand grouping demands as early as possible, lifting up 16. optimization for constant vs. run-time dimensions thus dimension d is an optimization hint. 17. Binary representation (portable) ??? a-la Java byte-code 3.1.4 PLC 2005 Meeting at WORLDCOMP 2005, Las Vegas, USA Works The following works were presented: 1. [40] 2. [63] 3. [62] 4. [136] 5. [153] 6. [101] 7. [149] T ODO 23 Core Lucid Standard Specification: SIGLUCID’s Contextual Design Attendees 1. Weichang Du 2. Serguei A. Mokhov 3. Joey Paquet 4. Emil Vassev 5. William W. Wadge 6. Kaiyu Wan 7. Aihua Wu T ODO 3.1.5 ISLIP 1999 Works The following works were presented: 1. [37] T ODO Attendees 1. William W. Wadge 2. John Plaice 3. Joey Paquet 4. ... T ODO 3.1.6 ISLIP 1995 Works The following works were presented: 1. [87] T ODO 24 SIGLUCID Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID Attendees 1. William W. Wadge 2. John Plaice 3. Joey Paquet 4. ... T ODO 3.2 TransLucid T ODO 3.3 3.3.1 GIPSY Hybrid Interaction with Other Languages GIPC Preprocessor The Preprocessor [64, 62] is something that is invoked first by the GIPC (see Figure 1) on incoming GIPSY program’s source code stream. The Preprocessor’s role is to do preliminary program analysis, processing, and splitting the source GIPSY program into “chunks”, each written in a different language and identified by a language tag. In a very general view, a GIPSY program is a hybrid program consisting of different languages in one or more source file; then, there has to be an interface between all these code segments. Thus, the Preprocessor after some initial parsing (using its own preprocessor syntax) and producing the initial parse tree, constructs a preliminary dictionary of symbols used throughout the program. This is the basis for type matching and semantic analysis applied later on. This is also where the first step of type assignment occurs, especially on the boundary between typed and typeless parts of the program, e.g. Java and a specific Lucid dialect. The Preprocessor then splits the code segments of the GIPSY program into chunks preparing them to be fed to the respective concrete compilers for those chunks. The chunks are represented through the CodeSegment class that the GIPC collects. GIPSY Program Segments There are four baseline types of segments defined to be used in a GIPSY program. These are: • #funcdecl program segment declares function prototypes written as imperative language functions defined later or externally from this program to be used by the intensional language part. The syntactical form of these prototypes is particular to GIPSY programs and need not resemble the actual function prototype declaration they describe in their particular programming language. They serve as a basis for static and dynamic type assignment and checking within the GIPSY type system with regards to procedural functions called by other parts of the GIPSY program, e.g. the Lucid code segments. 25 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID Figure 1: GIPC Framework with the Preprocessor • #typedecl segment lists all user-defined data types that can potentially be used by the intensional part; usually objects. These are the types that do not explicitly appear in the matching table in Table 1 describing the basic data types allowed in GIPSY programs. • #<IMPERATIVELANG> segment declares that this is a code segment written in whatever IMPERATIVELANG may be, for example #JAVA for Java, #CPP for C++, #FORTRAN for Fortran, #PERL for Perl, #PYTHON for Python, etc. • #<INTENSIONALLANG> segment declares that this is a code segment written in whatever INTENSIONALLANG may be, for example #GIPL, #LUCX, #JOOIP, #INDEXICALLUCID, 26 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID Figure 2: Example of Eductive Evaluation of Objective Lucid Progran 27 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID #JLUCID, #OBJECTIVELUCID, #TENSORLUCID, #ONYX [39], #FORENSICLUCID [73], and #TRANSLUCID, etc. as specified by the available GIPSY implementations and stubs. An example of a hybrid program is presented in Listing 1. The preamble of the program with the type and function declaration segments are the main source of type information that is used at compile time to annotate the nodes in the tree to help both static and semantic analysis. 3.3.2 Introduction to the GIPSY Type System The introduction of JLucid, Objective Lucid, and GICF [64, 63, 62, 40] prompted the development of the GIPSY Type System as implicitly understood by the Lucid language and its incarnation within the GIPSY to handle types in a more general manner as a glue between the imperative and intensional languages within the system. Further evolution of Lucx introducing contexts as first-class values and JOOIP highlighted the need of the further development of the type system to accommodate the more general properties of the intensional and hybrid languages. Matching Lucid and Java Data Types Here we present a case of interaction between Lucid and Java. Allowing Lucid to call Java methods brings a set of issues related to the data types, especially when it comes to type checks between Lucid and Java parts of a hybrid program. This is pertinent when Lucid variables or expressions are used as parameters to Java methods and when a Java method returns a result to be assigned to a Lucid variable or used in an intensional expression. The sets of types in both cases are not exactly the same. The basic set of Lucid data types as defined by Grogono [38] is int, bool, double, string, and dimension. Lucid’s int is of the same size as Java’s long. GIPSY and Java double, boolean, and String are roughly the same. Lucid string and Java String are simply mapped internally through StringBuffer; thus, one can think of the Lucid string as a reference when evaluated in the intensional program. Based on this fact, the lengths of a Lucid string and Java String are the same. Java String is also an object in Java; however, at this point, a Lucid program has no direct access to any String’s properties (though internally we do and we may expose it later to the programmers). We also distinguish the float data type for single-precision floating point operations. The dimension index type is said to be an integer or string (as far as its dimension tag values are concerned), but might be of other types eventually, as discussed in [133]. Therefore, we perform data type matching as presented in Table 1. Additionally, we allow void Java return type which will always be matched to a Boolean expression true in Lucid as an expression has to always evaluate to something. As for now our types mapping and restrictions are as per Table 1. This is the mapping table for the Java-to-IPL-to-Java type adapter. Such a table would exist for mapping between any imperative-to-intensional language and back, e.g. the C++-to-IPL-to-C++ type adapter. Overview of the Design and Implementation of the Type System. While the main language of GIPSY, Lucid, is polymorphic and does not have explicit types, co-existing with other languages necessitates definition of GIPSY types and their mapping to a particular language being embedded. Figure 3 presents the detailed design of the GIPSY Type System. Each class is prefixed with GIPSY to avoid possible confusion with similar definitions in the java.lang package. The GIPSYVoid type always evaluates to the Boolean true, as described earlier in Section 3.3.2. The other types wrap around the corresponding Java object wrapper 28 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID /∗ ∗ ∗ Language−mix GIPSY program . ∗ @author S e r g u e i Mokhov ∗/ #t y p e d e c l myclass ; #f u n c d e c l m y c l a s s f o o ( int , double ) ; f l o a t bar ( int , i n t ) : ” f t p : / / newton . c s . c o n c o r d i a . ca / c o o l . c l a s s ” : baz ; int f 1 ( ) ; #JAVA m y c l a s s f o o ( i n t a , double b ) { return new m y c l a s s (new I n t e g e r ( ( i n t ) ( b + a ) ) ) ; } class myclass { public m y c l a s s ( I n t e g e r a ) { System . out . p r i n t l n ( a ) ; } } #CPP #i n c l u d e <i o s t r e a m > i n t f 1 ( void ) { c o u t << ” h e l l o ” ; return 0 ; } #OBJECTIVELUCID A + bar (B, C) where A = f o o (B, C) . i n t V a l u e ( ) ; B = f1 () ; C = 2.0; end ; /∗ ∗ i n t h e o r y we c o u l d w r i t e more than one i n t e n s i o n a l chunk , ∗ t h e n t h o s e chunks would e v a l u a t e as s e p a r a t e p o s s i b l y ∗ t o t a l l y i n d e p e n d e n t e x p r e s s i o n s i n p a r a l l e l t h a t happened ∗ t o u s e t h e same s e t o f i m p e r a t i v e f u n c t i o n s . ∗/ // EOF Listing 1: Example of a hybrid GIPSY program. 29 Core Lucid Standard Specification: SIGLUCID’s Contextual Design Figure 3: GIPSY Type System. 30 SIGLUCID Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID Table 1: Matching data types between Lucid and Java. Return Types of Java Methods Types of Lucid Expressions Internal GIPSY Types int, byte, long float double boolean char String Method Method [] Object Object void int, dimension float double bool char string, dimension function operator [] class URL bool::true GIPSYInteger GIPSYFloat GIPSYDouble GIPSYBoolean GIPSYCharacter GIPSYString GIPSYFunction GIPSYOperator GIPSYArray GIPSYObject GIPSYEmbed GIPSYVoid Parameter Types Used in Lucid Corresponding Java Types Internal GIPSY Types string float double int dimension bool class URL [] operator function String float double int int, String boolean Object Object [] Method Method GIPSYString GIPSYFloat GIPSYDouble GIPSYInteger Dimension GIPSYBoolean GIPSYObject GIPSYEmbed GIPSYArray GIPSYOperator GIPSYFunction classes for the primitive types, such as Long, Float, etc. Every class keeps a lexeme (a lexical representation) of the corresponding type in a GIPSY program and overrides toString() to show the lexeme and the contained value. These types are extensively used by the Preprocessor, imperative and intensional (for constants) compilers, the SequentialThreadGenerator, and SemanticAnalyzer for the general type of GIPSY program processing, and by the GEE’s Executor. The other special types that have been created are either experimental or do not correspond to a wrapper of a primitive type. GIPSYIdentifier type case corresponds to a declaration of some sort of an identifier in a GIPSY program to be put into the dictionary, be it a variable or a function name with the reference to their definition. Constants and conditionals may be anonymous and thereby not have a corresponding identifier. GIPSYEmbed is another special type that encapsulates embedded code via the URL parameter and later is exploded into multiple types corresponding to procedural demands (Java or any other language methods or functions) [64, 40]. GIPSYFunction and its descendant GIPSYOperator correspond to the function types for regular operators and user-defined functions. A GIPSYFunction can either encapsulate an ordinary Lucid function (which is immutable as in functional programming) or a procedure (e.g. a Java method), which may often be mutable (i.e. with side effects). These four types (identifier, embed, function, and operator) are not directly exposed to a GIPSY programmer and at this point are managed internally. By the latter we mean we have not reached the stage when we 31 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID can provide them for explicit use by programmers; however, the semantics of is still defined and specified at the requirements, design, and implementation levels. GIPSYContext and Dimension are a new addition to the type system implementation since [64]. They represent context-asfirst-class-values in the context calculus defined by Wan in [147] and refined and implemented by Tong [132]. The rest of the type system is exposed to the GIPSY programmer in the preamble of a GIPSY program, i.e., the #funcdecl and #typedecl segments, which result in the embryo of the dictionary for linking, semantic analysis, and execution. Once imperative compilers of procedural demands return, the type data structures (return and parameter types) declared in the preamble are matched against what was discovered by the compilers and if the match is successful, the link is made. By capturing the types such as identifier, embed, function, operator and context, dimension, the GIPSY type system lays down fundamentals the higher-order intensional logic (HOIL) support that combines functional programming, intensional logic, context calculus, and in some instances hybrid paradigm support, and the corresponding types. We describe various properties of the concrete GIPSY types and their more detailed specification in Appendix ?? and Appendix ??. There we detail the inner workings of each type in more detail as well describe some of the properties through the notions of existential, union, intersection, and linear types. They have been excluded from the main body of the article due to size limitations. 3.4 The Core Lucid Standard The Core Lucid standard specification, syntax, semantics, translation rules, type system, and verifications are to be placed in this section upon consensus of the SIGLUCID members. T ODO 3.4.1 Syntax T ODO 3.4.2 Semantics T ODO 4 Conclusion We have layed out the first foundational notions of a practical Lucid standard at the 1st SECASA in 2008 in Turku, Finland, associated with COMPSAC 2008. Since then two (3) more SECASA’s happened: in 2009 in Seattle, 2010 in Montreal, and another one is planned in 2011. Prior that we are producing this first set of notes from the meeting and related work. 32 Core Lucid Standard Specification: SIGLUCID’s Contextual Design 5 SIGLUCID Future Work We plan on further meet and refine these notes and the standards and further accrete the related work. Our eventual goal after the standard draft is complete publish it along with a comprehensive survey of the recent related work as well as historical review. 6 Acknowledgments This research work was funded by the respective grants, faculties and departments of the authors. Acknowledgment also goes to the former and present colleagues collaborated with us in the past. References [1] David Abramson and Rok Sosič. Relative debugging using multiple program versions. In Orgun and Ashcroft [87], pages 42–55. Invited Contribution. [2] Iskender Agi. GLU for multidimensional signal processing. In Orgun and Ashcroft [87]. URL citeseer.ist.psu.edu/agi95glu.html. ISBN: 981-02-2400-1. [3] Seiki Akama. A meta-level approach to modal logic programming. In Orgun and Ashcroft [87], pages 260–272. [4] Vasu S. Alagar, Joey Paquet, and Kaiyu Wan. Intensional programming for agent communication. In Jo ao Leite, Andrea Omicini, Paolo Torroni, and Pinar Yolum, editors, Declarative Agent Languages and Technologies II, volume 3476 of Lecture Notes in Computer Science, pages 239–255. Springer Berlin Heidelberg, 2005. ISBN 978-3-540-26172-8. doi: 10.1007/11493402\ 14. [5] Ion Androutsopoulos. Temporal meaning representation in a natural language front-end. In Gergatsoulis and Rondogiannis [37], pages 197–213. [6] Edward A. Ashcroft. Multidimensional program verification: Reasoning about programs that deal with multidimensional objects. In Orgun and Ashcroft [87], pages 30–41. Invited Contribution. [7] Edward A. Ashcroft and William W. Wadge. Lucid – a formal system for writing and proving programs. SIAM J. Comput., 5(3), 1976. [8] Edward A. Ashcroft and William W. Wadge. Erratum: Lucid – a formal system for writing and proving programs. SIAM J. Comput., 6(1):200, 1977. [9] Edward A. Ashcroft and William W. Wadge. Lucid, a nonprocedural language with iteration. Communications of the ACM, 20(7):519–526, July 1977. ISSN 0001-0782. doi: 10.1145/359636.359715. [10] Edward A. Ashcroft and William W. Wadge. R for semantics. ACM Transactions on Programming Languages and Systems, 4(2):283–294, April 1982. [11] Edward A. Ashcroft, Anthony A. Faustini, Rangaswamy Jagannathan, and William W. Wadge. Multidimensional Programming. Oxford University Press, London, February 1995. ISBN: 978-0195075977. 33 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [12] Loı̈c Besnard, Patricia Bourani, Thierry Gautier, Nicolas Halbwachs, Simin NadjmTehrani, and Annie Ressouche. Design of a multi-formalism application and distribution in a data-flow context: An example. In Gergatsoulis and Rondogiannis [37], pages 149–167. [13] Richard Buckland. Choice as a first class citizen. In Orgun and Ashcroft [87], pages 249–259. [14] Jiannong Cao, Lichucha Fernando, and Kang Zhang. Programming distributed systems based on graphs. In Orgun and Ashcroft [87], pages 83–95. [15] Jiannong Cao, Alvin Chan, and Kang Zhang. Programming dynamically reconfigurable web server groups using the DyGOP model. In Gergatsoulis and Rondogiannis [37], pages 65–77. [16] Paul Caspi and Pouzet. A functional extension to Lustre. In Orgun and Ashcroft [87], pages 15–29. Invited Contribution. [17] Angelos Charalambidis, Athanasios Grivas, Nikolaos S. Papaspyrou, and Panos Rondogiannis. Efficient intensional implementation for lazy functional languages. Mathematics in Computer Science, 2(1):123–141, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0047-5. [18] Yimin Ding. Automated translation between graphical and textual representations of intensional programs in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, June 2004. http://newton.cs.concordia.ca/~paquet/filetransfer/publications/ theses/DingYiminMSc2004.pdf. [19] Gabriel Ditu. The Programming Language TransLucid. PhD thesis, University of New South Wales, Australia, 2007. [20] Chris Dodd. Intensional Programming I, chapter Rank analysis in the GLU compiler, pages 76–82. Volume Intensional Programming I of Orgun and Ashcroft [87], May 1996. ISBN: 981-02-2400-1. [21] Weichang Du. Indexical Parallel Programming. PhD thesis, Department of Computer Science, Victoria University, Canada, 1991. [22] Weichang Du. Object-oriented implementation of intensional language. In Proceedings of the 7th International Symposium on Lucid and Intensional Programming, pages 37–45, Menlo Park, California, USA, September 1994. SRI International. [23] Weichang Du. Toward an intensional model for programming large scale distributed systems. In Gergatsoulis and Rondogiannis [37], pages 244–258. [24] Weichang Du and William W. Wadge. A 3D spreadsheet based on intensional logic. IEEE Software, 7(3):78–89, June 1990. doi: 10.1109/52.55232. [25] Weichang Du and William W. Wadge. The eductive implementation of a three-dimensional spreadsheet. Software Practice and Experience, 20(11):1097–1114, November 1990. ISSN 0038-0644. [26] Anthony A. Faustini. The Equivalence of a Denotational and an Operational Semantics of Pure Dataflow. PhD thesis, University of Warwick, Computer Science Department, Coventry, United Kingdom, 1982. 34 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [27] Anthony A. Faustini and R. Jagannathan. Multidimensional problem solving in Lucid. Technical Report SRI-CSL-93-03, SRI International, 1993. [28] Anthony A. Faustini and E. B. Lewis. Towards a Real-Time Dataflow Language. IEEE Computer Society, Los Alamitos, CA, USA, 1989. ISBN 0-8186-0819-6. [29] Antony A. Faustini and William W. Wadge. An eductive interpreter for the language Lucid. SIGPLAN Not., 22(7):86–91, 1987. ISSN 0362-1340. doi: 10.1145/960114.29659. [30] Michael Fisher and Tony Kakoudakis. Flexible agent grouping in executable temporal logic. In Gergatsoulis and Rondogiannis [37], pages 93–105. [31] Melvin C. Fitting. FOIL axiomatized. [online], August 2005. http://comet.lehman. cuny.edu/fitting/bookspapers/pdf/papers/FOILAxioms.pdf. [32] B. Freeman-Benson. Lobjcid: Objects in Lucid. In Proceedings of the 1991 Symposium on Lucid and Intensional Programming, pages 80–87, Menlo Park, California, USA, April 1991. SRI International. [33] Thom Frühwirth. Constraint solving with constraint handling rules. In Gergatsoulis and Rondogiannis [37], pages 14–30. Tutorial. [34] Jean-Raymond Gagné and John Plaice. Demand-driven real-time computing. In Gergatsoulis and Rondogiannis [37], pages 168–181. ISBN: 981-02-4095-3. [35] Simon Gay and Rajagopal Nagarajan. Intensional and extensional semantics of dataflow programs. Formal Aspects of Computing, 15(4):299–318, 2003. ISSN 0934-5043. doi: 10.1007/s00165-003-0018-1. [36] Manolis Gergatsoulis. Extensions of the branching-time logic programming language Cactus. In Gergatsoulis and Rondogiannis [37], pages 118–132. [37] Manolis Gergatsoulis and Panos Rondogiannis, editors. Proceedings of ISLIP’99, volume Intensional Programming II, June 1999. World Scientific. ISBN: 981-02-4095-3. [38] Peter Grogono. GIPC increments. Technical report, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, April 2002. [39] Peter Grogono. Intensional programming in Onyx. Technical report, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, April 2004. [40] Peter Grogono, Serguei Mokhov, and Joey Paquet. Towards JLucid, Lucid with embedded Java functions in the GIPSY. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 15–21. CSREA Press, June 2005. [41] Khaled M. Ben Hamed. Multidimensional Programs on Distributed Parallel Computers: Analysis and Implementation. PhD thesis, Computer Science, the University of New Brunswick, February 2008. [42] Bin Han. Towards a multi-tier runtime system for GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2010. 35 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [43] Bin Han, Serguei A. Mokhov, and Joey Paquet. Advances in the design and implementation of a multi-tier architecture in the GIPSY environment with Java. In Proceedings of SERA 2010, pages 259–266. IEEE Computer Society, 2010. ISBN 978-0-7695-4075-7. doi: 10.1109/SERA.2010.40. Online at http://arxiv.org/abs/0906.4837. [44] R. Jagannathan. Intensional and extensional graphical models for GLU programming. In Orgun and Ashcroft [87], pages 63–75. [45] Raganswamy Jagannathan and Chris Dodd. GLU programmer’s guide. Technical report, SRI International, Menlo Park, California, 1996. [46] Raganswamy Jagannathan, Chris Dodd, and Iskender Agi. GLU: A high-level system for granular data-parallel programming. In Concurrency: Practice and Experience, volume 1, pages 63–83, 1997. [47] Yi Ji. Scalability evaluation of the GIPSY runtime system. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, March 2011. [48] Yi Ji, Serguei A. Mokhov, and Joey Paquet. Unifying and refactoring DMF to support concurrent Jini and JMS DMS in GIPSY. In Bipin C. Desai, Sudhir P. Mudur, and Emil I. Vassev, editors, Proceedings of the Fifth International C* Conference on Computer Science and Software Engineering (C3S2E’12), pages 36–44, New York, NY, USA, June 2010–2013. ACM. ISBN 978-1-4503-1084-0. doi: 10.1145/2347583.2347588. Online e-print http://arxiv.org/abs/1012.2860. [49] Sally C. Johnson. A strategy for automatically generating programs in the Lucid programming language (NASA technical memorandum). Technical report, NASA, Scientific and Technical Information Office, 1987. ASIN: B000711R3Q. [50] Costas D. Koutras and Christos Nomikos. On the computational complexity of stratified negation in linear-time temporal logic programming. In Gergatsoulis and Rondogiannis [37], pages 106–117. [51] Padmanabhan Krishnan. An asynchronous calculus based on absence of actions. In Orgun and Ashcroft [87], pages 234–248. [52] Peter Kropf and John Plaice. Intensional objects. In International symposium on Languages for Intensional Programming, pages 37–45, Athens, Greece, June 1999. Demokrits Institute. [53] Tu Van Le. Fuzzy temporal Prolog. In Orgun and Ashcroft [87], pages 273–280. [54] Weiqiang Lin and Mehmet A. Orgun. Applied hidden periodicity analysis for mining descrete-valued time series databases. In Gergatsoulis and Rondogiannis [37], pages 182– 196. [55] Chuchang Liu and Mehmet A. Orgun. Knowledge-based simulation with Chronolog. In Orgun and Ashcroft [87], pages 281–295. [56] Yaowei Liu and John Staples. Building logic constructs into procedural programming languages. In Orgun and Ashcroft [87], pages 96–109. 36 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [57] Bo Lu. Developing the Distributed Component of a Framework for Processing Intensional Programming Languages. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, March 2004. [58] Bo Lu, Peter Grogono, and Joey Paquet. Distributed execution of multidimensional programming languages. In Proceedings of the 15th IASTED International Conference on Parallel and Distributed Computing and Systems (PDCS 2003), volume 1, pages 284–289. International Association of Science and Technology for Development, November 2003. [59] Wanli Ma and Mehmet A. Orgun. Verifying MULTRAN programs with temporal logic. In Orgun and Ashcroft [87], pages 186–206. [60] Blanca Mancilla and John Plaice. Possible worlds versioning. Mathematics in Computer Science, 2(1):63–83, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0044-8. [61] Win Maung, Chit Swe, and Mehmet A. Orgun. Statistical queries on historical relational databases. In Gergatsoulis and Rondogiannis [37], pages 214–228. [62] Serguei Mokhov and Joey Paquet. General imperative compiler framework within the GIPSY. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 36–42. CSREA Press, June 2005. [63] Serguei Mokhov and Joey Paquet. Objective Lucid – first step in object-oriented intensional programming in the GIPSY. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 22–28. CSREA Press, June 2005. [64] Serguei A. Mokhov. Towards hybrid intensional programming with JLucid, Objective Lucid, and General Imperative Compiler Framework in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, October 2005. ISBN 0494102934; online at http://arxiv.org/abs/0907.2640. [65] Serguei A. Mokhov. Towards security hardening of scientific distributed demand-driven and pipelined computing systems. In Proceedings of the 7th International Symposium on Parallel and Distributed Computing (ISPDC’08), pages 375–382. IEEE Computer Society, July 2008. ISBN 978-0-7695-3472-5. doi: 10.1109/ISPDC.2008.52. [66] Serguei A. Mokhov. Encoding forensic multimedia evidence from MARF applications as Forensic Lucid expressions. In Tarek Sobh, Khaled Elleithy, and Ausif Mahmood, editors, Novel Algorithms and Techniques in Telecommunications and Networking, proceedings of CISSE’08, pages 413–416, University of Bridgeport, CT, USA, December 2008. Springer. ISBN 978-90-481-3661-2. doi: 10.1007/978-90-481-3662-9\ 71. Printed in January 2010. [67] Serguei A. Mokhov. Towards syntax and semantics of hierarchical contexts in multimedia processing applications using MARFL. In Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), pages 1288–1294, Turku, Finland, July 2008. IEEE Computer Society. doi: 10.1109/COMPSAC.2008.206. [68] Serguei A. Mokhov. Enhancing the formal cyberforensic approach with observation modeling with credibility factors and mathematical theory of evidence. [online], also in ;login: vol. 34, no. 6, p. 101, December 2009. Presented at WIPS at USENIX Security’09, http://www.usenix.org/events/sec09/wips.html. 37 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [69] Serguei A. Mokhov. The role of self-forensics modeling for vehicle crash investigations and event reconstruction simulation. In Joseph S. Gauthier, editor, Proceedings of the Huntsville Simulation Conference (HSC’09), pages 342–349. SCS, October 2009. ISBN 978-1-61738-587-2. Online at http://arxiv.org/abs/0905.2449. [70] Serguei A. Mokhov. Towards improving validation, verification, crash investigations, and event reconstruction of flight-critical systems with self-forensics. [online], June 2009. A white paper submitted in response to NASA’s RFI NNH09ZEA001L, http://arxiv.org/ abs/0906.1845, mentioned in http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa. gov/20100025593_2010028056.pdf. [71] Serguei A. Mokhov. Hybrid Intensional Computing in GIPSY: JLucid, Objective Lucid and GICF. LAP - Lambert Academic Publishing, March 2010. ISBN 978-3-8383-1198-2. [72] Serguei A. Mokhov. Intensional Cyberforensics. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, September 2013. [73] Serguei A. Mokhov and Joey Paquet. Formally specifying and proving operational aspects of Forensic Lucid in Isabelle. Technical Report 2008-1-Ait Mohamed, Department of Electrical and Computer Engineering, Concordia University, Montreal, Canada, August 2008. In Theorem Proving in Higher Order Logics (TPHOLs2008): Emerging Trends Proceedings. Online at: http://users.encs.concordia.ca/~tphols08/TPHOLs2008/ET/76-98. pdf and http://arxiv.org/abs/0904.3789. [74] Serguei A. Mokhov and Joey Paquet. Using the General Intensional Programming System (GIPSY) for evaluation of higher-order intensional logic (HOIL) expressions. In Proceedings of SERA 2010, pages 101–109. IEEE Computer Society, May 2010. ISBN 978-0-76954075-7. doi: 10.1109/SERA.2010.23. Online at http://arxiv.org/abs/0906.3911. [75] Serguei A. Mokhov and Joey Paquet. A type system for higher-order intensional logic support for variable bindings in hybrid intensional-imperative programs in GIPSY. In Tokuro Matsuo, Naohiro Ishii, and Roger Lee, editors, 9th IEEE/ACIS International Conference on Computer and Information Science, IEEE/ACIS ICIS 2010, pages 921–928. IEEE Computer Society, May 2010. ISBN 978-0-7695-4147-1. doi: 10.1109/ICIS.2010.156. Presented at SERA 2010; online at http://arxiv.org/abs/0906.3919. [76] Serguei A. Mokhov and Emil Vassev. Self-forensics through case studies of small to medium software systems. In Proceedings of IMF’09, pages 128–141. IEEE Computer Society, September 2009. ISBN 978-0-7695-3807-5. doi: 10.1109/IMF.2009.19. [77] Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Formally specifying operational semantics and language constructs of Forensic Lucid. In Oliver Göbel, Sandra Frings, Detlef Günther, Jens Nedon, and Dirk Schadt, editors, Proceedings of the IT Incident Management and IT Forensics (IMF’08), LNI140, pages 197–216. GI, September 2008. ISBN 978-3-88579-234-5. Online at http://subs.emis.de/LNI/Proceedings/ Proceedings140/gi-proc-140-014.pdf. [78] Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Towards automated deduction in blackmail case analysis with Forensic Lucid. In Joseph S. Gauthier, editor, Proceedings of the Huntsville Simulation Conference (HSC’09), pages 326–333. SCS, October 2009. ISBN 978-1-61738-587-2. Online at http://arxiv.org/abs/0906.0049. 38 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [79] Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Reasoning about a simulated printer case investigation with Forensic Lucid. In Joseph S. Gauthier, editor, Proceedings of the Huntsville Simulation Conference (HSC’09), page 45. SCS, October 2009. ISBN 978-1-61738-587-2. Abstract, fully online at http://arxiv.org/abs/0906.5181. [80] Serguei A. Mokhov, Joey Paquet, and Xin Tong. A type system for hybrid intensionalimperative programming support in GIPSY. In Proceedings of C3S2E’09, pages 101–107, New York, NY, USA, May 2009. ACM. ISBN 978-1-60558-401-0. doi: 10.1145/1557626. 1557642. [81] Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. The need to support of data flow graph visualization of Forensic Lucid programs, forensic evidence, and their evaluation by GIPSY. [online], September 2010. Poster at VizSec’10; online at http://arxiv.org/abs/ 1009.5423. [82] Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Towards automatic deduction and event reconstruction using Forensic Lucid and probabilities to encode the IDS evidence. In S. Jha, R. Sommer, and C. Kreibich, editors, Proceedings of RAID’10, LNCS 6307, pages 508–509. Springer, September 2010. doi: 10.1007/978-3-642-15512-3\ 36. [83] Serguei A. Mokhov, Emil Vassev, Joey Paquet, and Mourad Debbabi. Towards a selfforensics property in the ASSL toolset. In Proceedings of C3S2E’10, pages 108–113. ACM, May 2010. ISBN 978-1-60558-901-5. doi: 10.1145/1822327.1822342. [84] Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. On the need for data flow graph visualization of Forensic Lucid programs and forensic evidence, and their evaluation by GIPSY. In Proceedings of the Ninth Annual International Conference on Privacy, Security and Trust (PST), 2011, pages 120–123. IEEE Computer Society, July 2011. ISBN 978-14577-0582-3. doi: 10.1109/PST.2011.5971973. Short paper; full version online at http: //arxiv.org/abs/1009.5423. [85] Serguei A. Mokhov, Joey Paquet, and Mourad Debbabi. Reasoning about a simulated printer case investigation with Forensic Lucid. In Pavel Gladyshev and Marcus K. Rogers, editors, Proceedings of ICDF2C’11, number 0088 in LNICST, pages 282–296. Springer, October 2011. ISBN 978-3-642-35514-1. doi: 10.1007/978-3-642-35515-8\ 23. Submitted in 2011, appeared in 2012; online at http://arxiv.org/abs/0906.5181. [86] Dominic A. Orchard and Steve Matthews. Integrating lucid’s declarative dataflow paradigm into object-orientation. Mathematics in Computer Science, 2(1):103–122, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0046-6. [87] Mehmet A. Orgun and Edward A. Ashcroft, editors. Proceedings of ISLIP’95, volume Intensional Programming I, May 1995. World Scientific. ISBN: 981-02-2400-1. [88] Mehmet A. Orgun and Weichang Du. Multi-dimensional logic programming: Theoretical foundations. Theoretical Computer Science, 185(2):319–345, 1997. ISSN 0304-3975. doi: 10.1016/S0304-3975(97)00048-0. [89] Mehmet A. Orgun, Chuchang Liu, and Abhaya C. Nayak. Knowledge representation, reasoning and integration using temporal logic with clocks. Mathematics in Computer Science, 2(1):143–163, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0048-4. 39 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [90] C. B. Ostrum. The Luthid 1.0 Manual. Department of Computer Science, University of Waterloo, Ontario, Canada, 1981. [91] Themis Panayiotopoulos. Temporal reasoning with TRL. In Gergatsoulis and Rondogiannis [37], pages 133–148. [92] Themis Panayiyotopoulos and L. C. Baxevanaki. Statistical queries on historical relational databases. In Gergatsoulis and Rondogiannis [37], pages 229–243. [93] Nikolaos S. Papaspyrou and Ioannis T. Kassios. GLU# embedded in C++: a marriage between multidimensional and object-oriented programming. Softw., Pract. Exper., 34(7): 609–630, 2004. ISSN 0038-0644. doi: 10.1002/spe.582. [94] Joey Paquet. Relational databases as multidimensional dataflows. Master’s thesis, Departement d’Informatique, Université Laval, Québec, Canada, 1995. [95] Joey Paquet. Scientific Intensional Programming. PhD thesis, Department of Computer Science, Laval University, Sainte-Foy, Canada, 1999. [96] Joey Paquet. Distributed eductive execution of hybrid intensional programs. In Proceedings of the 33rd Annual IEEE International Computer Software and Applications Conference (COMPSAC’09), pages 218–224, Seattle, Washington, USA, July 2009. IEEE Computer Society. ISBN 978-0-7695-3726-9. [97] Joey Paquet and Peter Kropf. The GIPSY architecture. In Proceedings of Distributed Computing on the Web, Quebec City, Canada, 2000. [98] Joey Paquet and John Plaice. On the design of an indexical query language. In Proceedings of the Seventh International Symposium on Lucid and Intensional Programming, pages 28–36, 1994. [99] Joey Paquet and John Plaice. The intensional relation. In Orgun and Ashcroft [87], pages 214–227. [100] Joey Paquet and John Plaice. The semantics of dimensions as values. In Gergatsoulis and Rondogiannis [37], pages 259–273. [101] Joey Paquet and Ai Hua Wu. GIPSY – a platform for the investigation on intensional programming languages. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 8–14. CSREA Press, June 2005. [102] Joey Paquet, Serguei A. Mokhov, Emil I. Vassev, Xin Tong, Yi Ji, Amir H. Pourteymour, Kaiyu Wan, Aihua Wu, Sleiman Rabah, Bin Han, Bo Lu, Lei Tao, Yimin Ding, Chun Lei Ren, and The GIPSY Research and Development Group. The General Intensional Programming System (GIPSY) project. Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2002–2013. http://newton.cs.concordia.ca/~gipsy/, last viewed April 2012. [103] Joey Paquet, Aihua Wu, and Peter Grogono. Towards a framework for the General Intensional Programming Compiler in the GIPSY. In Proceedings of the 19th Annual ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2004), pages 164–165, New York, NY, USA, October 2004. ACM. doi: 10.1145/1028664.1028731. 40 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [104] Joey Paquet, Serguei A. Mokhov, and Xin Tong. Design and implementation of context calculus in the GIPSY environment. In Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), pages 1278–1283, Turku, Finland, July 2008. IEEE Computer Society. doi: 10.1109/COMPSAC.2008.200. [105] Manuel Peralta, Supratik Mukhopadhyay, and Ramesh Bharadwaj. Automatic synthesis and deployment of intensional kahn process networks. In Dominik Ślȩzak, Tai hoon Kim, Stephen S. Yau, Osvaldo Gervasi, and Byeong-Ho Kang, editors, Grid and Distributed Computing, volume 63 of Communications in Computer and Information Science, pages 73–87. Springer Berlin Heidelberg, 2009. ISBN 978-3-642-10548-7. doi: 10.1007/978-3-642-10549-4\ 10. [106] John Plaice. Particle in-cell simulation with Lucid. In Orgun and Ashcroft [87], pages 149–161. [107] John Plaice. Cartesian programming. Technical Report UNSW-CSE-TR-1101, University of Grenoble, France, January 2011. Habilitation Thesis, online at ftp://ftp.cse.unsw. edu.au/pub/doc/papers/UNSW/1101.pdf. [108] John Plaice and Peter G. Kropf. Intensional communities. In Gergatsoulis and Rondogiannis [37], pages 292–295. [109] John Plaice and William W. Wadge. A new approach to version control. IEEE Transactions on Software, 19(3):268–276, March 1993. [110] John Plaice, Ridha Khedri, and Ren’e Lalement. From abstract time to real time. In In Proceedings of the Sixth International Symposium on Lucid and Intensional Programming, pages 83–93, 1993. [111] John Plaice, Blanca Mancilla, and Gabriel Ditu. From Lucid to TransLucid: Iteration, dataflow, intensional and Cartesian programming. Mathematics in Computer Science, 2 (1):37–61, 2008. ISSN 1661-8270. doi: 10.1007/s11786-008-0043-9. [112] John Plaice, Blanca Mancilla, Gabriel Ditu, and William W. Wadge. Sequential demanddriven evaluation of eager TransLucid. In Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), pages 1266–1271, Turku, Finland, July 2008. IEEE Computer Society. doi: 10.1109/COMPSAC.2008.191. [113] Amir Hossein Pourteymour. Comparative study of Demand Migration Framework implementation using JMS and Jini. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, September 2008. [114] Amir Hossein Pourteymour, Emil Vassev, and Joey Paquet. Towards a new demanddriven message-oriented middleware in GIPSY. In Proceedings of PDPTA 2007, pages 91–97. PDPTA, CSREA Press, June 2007. [115] Amir Hossein Pourteymour, Emil Vassev, and Joey Paquet. Design and implementation of demand migration systems in GIPSY. In Proceedings of PDPTA 2009. CSREA Press, June 2008. [116] Sleiman Rabah, Serguei A. Mokhov, and Joey Paquet. An interactive graph-based automation assistant: A case study to manage the GIPSY’s distributed multi-tier run-time 41 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID system. In Proceedings of the ACM Research in Adaptive and Convergent Systems (RACS 2013), pages 387–394, New York, NY, USA, October 2011–2013. ACM. ISBN 978-1-45032348-2. Pre-print: http://arxiv.org/abs/1212.4123. [117] Alessandra Raffaetà and Thom Frühwirth. Two semantics for temporal annotated constraint logic. In Gergatsoulis and Rondogiannis [37], pages 78–92. [118] Toby Rahilly and John Plaice. A multithreaded implementation for TransLucid. In Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference (COMPSAC), pages 1272–1277, Turku, Finland, July 2008. IEEE Computer Society. doi: 10.1109/COMPSAC.2008.191. [119] Anand Ranganathan and Roy H. Campbell. A middleware for context-aware agents in ubiquitous computing environments. In Markus Endler and Douglas Schmidt, editors, Proceedings of Middleware 2003, volume 2672 of Lecture Notes in Computer Science, pages 143–161. Springer Berlin Heidelberg, 2003. ISBN 978-3-540-40317-3. doi: 10.1007/3-540-44892-6\ 8. [120] Chun Lei Ren. General intensional programming compiler (GIPC) in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2002. [121] Panagiotis Rondogiannis. Higher-Order Functional Languages and Intensional Logic. PhD thesis, Department of Computer Science, University of Victoria, Victoria, Canada, 1994. [122] Panagiotis Rondogiannis. Adding multidimensionality to procedural programming languages. Software: Practice and Experience, 29(13):1201–1221, 1999. ISSN 1097-024X. doi: 10.1002/(SICI)1097-024X(199911)29:13h1201::AID-SPE278i3.0.CO;2-0. [123] Panos Rondogiannis. Adding multidimensionality to procedural programming languages. In Gergatsoulis and Rondogiannis [37], pages 274–291. [124] Panos Rondogiannis and William W. Wadge. Extending the intensionalization algorithm to a broader class of higher-order programs. In Orgun and Ashcroft [87], pages 228–233. [125] M. C. Schraefel, Blanca Mancilla, and John Plaice. Intensional hypertext. In Gergatsoulis and Rondogiannis [37], pages 40–54. [126] Paul Swoboda. A Formalisation and Implementation of Distributed Intensional Programming. PhD thesis, The University of New South Wales, Sydney, Australia, 2004. [127] Paul Swoboda and John Plaice. An active functional intensional database. In F. Galindo, editor, Advances in Pervasive Computing, pages 56–65. Springer, 2004. LNCS 3180. [128] Paul Swoboda and John Plaice. A new approach to distributed context-aware computing. In A. Ferscha, H. Hoertner, and G. Kotsis, editors, Advances in Pervasive Computing. Austrian Computer Society, 2004. ISBN 3-85403-176-9. [129] Paul Swoboda and William W. Wadge. Vmake and ISE general tools for the intensionalization of software systems. In Gergatsoulis and Rondogiannis [37], pages 310–320. ISBN: 981-02-4095-3. 42 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [130] Lei Tao. Warehouse and garbage collection in the GIPSY environment. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2004. [131] S. Tao. TLucid and Intensional Attribute Grammars. PhD thesis, Department of Computer Science, Victoria University, Canada, 1994. [132] Xin Tong. Design and implementation of context calculus in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, April 2008. [133] Xin Tong, Joey Paquet, and Serguei A. Mokhov. Complete context calculus design and implementation in GIPSY. [online], 2007–2008. http://arxiv.org/abs/1002.4392. [134] J. van Benthem. A Manual of Intensional Logic. CSLI Publications, Stanford and The University of Chicago Press, 1988. ISBN 0-937073-29-6. [135] Emil Vassev and Joey Paquet. A general architecture for demand migration in a demanddriven execution engine in a heterogeneous and distributed environment. In Proceedings of the 3rd Annual Communication Networks and Services Research Conference (CNSR 2005), pages 176–182. IEEE Computer Society, May 2005. doi: 10.1109/CNSR.2005.9. [136] Emil Vassev and Joey Paquet. A generic framework for migrating demands in the GIPSY’s demand-driven execution engine. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 29–35. CSREA Press, June 2005. [137] Emil Vassev and Joey Paquet. Towards autonomic GIPSY. In Proceedings of the Fifth IEEE Workshop on Engineering of Autonomic and Autonomous Systems (EASE 2008), pages 25–34. IEEE Computer Society, 2008. ISBN 978-0-7695-3140-3. doi: 10.1109/EASe. 2008.9. [138] Emil Iordanov Vassev. General architecture for demand migration in the GIPSY demanddriven execution engine. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, June 2005. ISBN 0494102969. [139] Lorenzo Verdoscia. ALFA fine grain dataflow machine. In Orgun and Ashcroft [87], pages 110–134. [140] William W. Wadge. Possible WOOrlds. In Orgun and Ashcroft [87], pages 56–62. Invited Contribution. [141] William W. Wadge. Intensional logic in context. In Gergatsoulis and Rondogiannis [37], pages 1–13. Tutorial. [142] William W. Wadge. Hammings problem example. [online], December 2003. http://i. csc.uvic.ca/home/hei/lup/contents.html. [143] William W. Wadge and Edward A. Ashcroft. Lucid, the Dataflow Programming Language. Academic Press, London, 1985. [144] William W. Wadge and M. C. Schraefel. Putting the hyper back in hypertext. In Gergatsoulis and Rondogiannis [37], pages 31–39. 43 Core Lucid Standard Specification: SIGLUCID’s Contextual Design SIGLUCID [145] William W. Wadge and Alan Yoder. The Possible-World Wide Web. In Orgun and Ashcroft [87], pages 207–213. [146] William W. Wadge, G. Brown, M. C. Schraefel, and T. Yildirim. Intensional HTML. In 4th International Workshop PODDP’98, March 1998. [147] Kaiyu Wan. Lucx: Lucid Enriched with Context. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2006. [148] Kaiyu Wan, Vasu Alagar, and Joey Paquet. A context theory for intensional programming. In Workshop on Context Representation and Reasoning (CRR05), July 2005. [149] Kaiyu Wan, Vasu Alagar, and Joey Paquet. Lucx: Lucid enriched with context. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 48–14. CSREA Press, June 2005. [150] Kaiyu Wan, Vasu Alagar, and Joey Paquet. Real time reactive programming in lucid enriched with contexts. In Zhiming Liu and Keijiro Araki, editors, Theoretical Aspects of Computing - ICTAC 2004, volume 3407 of Lecture Notes in Computer Science, pages 387–402. Springer Berlin Heidelberg, 2005. ISBN 978-3-540-25304-4. doi: 10.1007/978-3-540-31862-0\ 28. [151] Ai Hua Wu. Semantic checking and translation in the GIPSY. Master’s thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2002. [152] Ai Hua Wu. OO-IP Hybrid Language Design and a Framework Approach to the GIPC. PhD thesis, Department of Computer Science and Software Engineering, Concordia University, Montreal, Canada, 2009. [153] Ai Hua Wu and Joey Paquet. Object-oriented intensional programming in the GIPSY: Preliminary investigations. In Proceedings of the 2005 International Conference on Programming Languages and Compilers (PLC 2005), pages 43–47. CSREA Press, June 2005. [154] Ai Hua Wu, Joey Paquet, and Peter Grogono. Design of a compiler framework in the GIPSY system. In Proceedings of the 15th IASTED International Conference on Parallel and Distributed Computing and Systems (PDCS 2003), volume 1, pages 320–328. International Association of Science and Technology for Development, November 2003. [155] Aihua Wu, Joey Paquet, and Serguei A. Mokhov. Object-oriented intensional programming: Intensional Java/Lucid classes. In Proceedings of SERA 2010, pages 158–167. IEEE Computer Society, 2010. ISBN 978-0-7695-4075-7. doi: 10.1109/SERA.2010.29. Online at: http://arxiv.org/abs/0909.0764. [156] Satoshi Yamane. Real-time object-oriented specification and verification. In Orgun and Ashcroft [87], pages 162–185. [157] Yu Zhang and Kang Zhang. Associative query for multi-version web documents. In Gergatsoulis and Rondogiannis [37], pages 55–64. [158] Q. Zhao. Implementation of an object-oriented intensional programming system. Master’s thesis, Department of Computer Science, University of New Brunswick, Canada, 1997. 44 Index API [], 31 bool, 28, 31 bool::true, 31 boolean, 28, 31 byte, 31 char, 31 CodeSegment, 25 Dimension, 31, 32 dimension, 28, 31 double, 28, 31 Executor, 31 Float, 31 float, 28, 31 GIPC, 25 GIPSYArray, 31 GIPSYBoolean, 31 GIPSYCharacter, 31 GIPSYContext, 32 GIPSYDouble, 31 GIPSYEmbed, 31 GIPSYFloat, 31 GIPSYFunction, 31 GIPSYIdentifier, 31 GIPSYInteger, 31 GIPSYObject, 31 GIPSYOperator, 31 GIPSYString, 31 GIPSYVoid, 28, 31 int, 28, 31 java.lang, 28 Long, 31 long, 28, 31 Method, 31 Object, 31 Preprocessor, 25, 31 SemanticAnalyzer, 31 SequentialThreadGenerator, 31 special, 22 String, 28, 31 string, 28, 31 StringBuffer, 28 toString(), 31 true, 28 type, 22 void, 28, 31 AST, 5 C, 5 C++, 6, 26, 28 data types matching Lucid and Java, 28 Forensic Lucid, 2, 4, 21 Fortran, 5, 26 Frameworks GEE, 5 GICF, 28 GIPC, 5 GIPSY Type System, 28 GEE, 5 GICF, 28 GIPC, 5 Preprocessor, 25 GIPL, 1, 3–5, 19, 21, 22 GIPSY, 5, 6, 25, 28 Type System, 28 Types, 28 GIPSY Program Segments, 25 GIPSY Type System, 28 GLU, 4–6 GLU#, 4, 6 Indexical Lucid, 4, 5 Java, 5, 25, 26, 28 JLucid, 4, 5, 28 JOOIP, 4, 28 Lucid, 1–6, 28 Family, 5 History, 5 Pipelined Dataflows, 5 Lucx, 2–5, 28 Lustre, 4 MARFL, 2–4, 21 Onyx, 4, 6 45 Core Lucid Standard Specification: SIGLUCID’s Contextual Design Partial Lucid, 4, 5 Perl, 26 Preprocessor, 25 GIPC, 25 Python, 26 Segments #<IMPERATIVELANG>, 26 #<INTENSIONALLANG>, 26 #CPP, 26 #FORENSICLUCID, 28 #FORTRAN, 26 #GIPL, 26 #INDEXICALLUCID, 26 #JAVA, 26 #JLUCID, 28 #JOOIP, 26 #LUCX, 26 #OBJECTIVELUCID, 28 #ONYX, 28 #PERL, 26 #PYTHON, 26 #TENSORLUCID, 28 #TRANSLUCID, 28 #funcdecl, 25, 32 #typedecl, 26, 32 Tensor Lucid, 4, 5, 27, 28 Tools libintense, 6 TransLucid, 1, 4, 6, 19, 21, 22, 25 Types, 28 46 SIGLUCID
6cs.PL
arXiv:cs/0307053v1 [cs.CE] 23 Jul 2003 Preprint typeset in JHEP style - HYPER VERSION Hamevol1.0: a C++ code for differential equations based on Runge-Kutta algorithm. An application to matter enhanced neutrino oscillation P. Aliania,b , V. Antonellib,c , M. Picariellob,c , Emilio Torrente-Lujand,e a b c d e Dept. de Physique, Université Libre de Bruxelles, Bruxelles, Belgium Dip. di Fisica, Università degli Studi di Milano, Milano, Italy I.N.F.N., Sezione di Milano, Milano, Italy Departamento de Fisica, Grupo de Fisica Teorica, Universidad de Murcia, Murcia, Spain CERN-TH, CH-1211 Geneve 23, Switzerland Abstract: We present a C++ implementation of a fifth order semi-implicit Runge-Kutta algorithm for solving Ordinary Differential Equations. This algorithm can be used for studying many different problems and in particular it can be applied for computing the evolution of any system whose Hamiltonian is known. We consider in particular the problem of calculating the neutrino oscillation probabilities in presence of matter interactions. The time performance and the accuracy of this implementation is competitive with respect to the other analytical and numerical techniques used in literature. The algorithm design and the salient features of the code are presented and discussed and some explicit examples of code application are given. e-mail addresses: [email protected]; [email protected]; [email protected]; [email protected] Submitted to Comput. Phys. Commun. Contents 1. Program Summary 1 2. Introduction. The mathematical problem. 2 3. The Physical motivations. 3 4. Code Structure 4.1 Algorithmics 4.2 The distribution 4.3 The RK algorithm. Main Subroutines 4.4 Sample Program and Inputs 6 6 7 8 10 5. Conclusions 10 6. Acknowledgments 11 7. Appendices 7.1 Using Hamevol 7.2 Example of Hamiltonian definition 7.3 Sample outputs 12 12 14 15 1. Program Summary • Title of the program: Hamevol • Version number: 1.0 • Avaible at: http://wwwteor.mi.infn.it/ antonell/programs/RKutta , and mirrors • Programming language: C++ • Platform: any platform supporting a C++ compiler (examples: Linux, Unix, Windows) • Tested on:Pentium PC, AMD PC • Memory requirements for execution: Standard application: 40 Kbytes • No. of bytes in distributed program, including test data, etc: 235.000 • Keywords: Numerical algorithms, Differential equations, Hamiltonian evolution, Oscillation, • Nature of physical problem: Numerical solution of Hamiltonian differential equations. Application to the numerical calculation of the oscillation probability for a quantum system (like, for instance, neutrinos of any kind propagating in a medium) • Method of solution: Algorithm based on fifth order semi-implicit Runge-Kutta method • Typical running time: ≃ 30 seconds for every single point on a Penthium IV PC 2. Introduction. The mathematical problem. The use of numerical algorithms and suitable computational techniques has often been very useful to find the solution of difficult problems which are of interest for mathematics and other applied science. This is particularly true in our days, when the relationships between information technology and other sciences are becoming closer and closer. In this paper we discuss the adaptation of well known numerical techniques to a general class of problems which are described by ordinary differential equations and we present some examples taken from physics. The numerical code and algorithm we are presenting in this work is based on the implementation of the Runge-Kutta method and it can find significant applications in the study of different physical systems. In fact the evolution of every system can be fully described once we are able to solve the differential equations that drive this evolution. The typical example is the case in which one wants to study a linear quantum system that is described by a vector X ≡ (Xi , i = 1..N ), where Xi are the elements of an appropriate basis decribing the system. The system of linear differential equations we are interested in can be put in the simple form: i dX = H(t)X, dt (2.1) where H is a matrix determining the evolution of the system. In the language of physics H is the Hamiltonian of the system and Equation (2.1) is the corresponding Schroedinger equation. It is clear, however, that the system of differential equations (2.1) is very general and they can describe also problems of different nature in fields that are completely different from physics. Depending on the kind of problems one has to solve, the requirements which are fundamental for the solutions can be different. This can suggest the choice of a particular algorithm in order to fulfill these requirements in the best possible way. For instance, as we are going to discuss later, in the physical problems we are intersted in, the delicate point is efficiency more than accuracy and this justifies the choiche of a particular version of adaptive Runge-Kutta method that, if properly adapted to our purpose, enable us to obtain satisfactory results. The solution of equation (2.1) can be written in terms of the fundamental system of solutions, or equivalently called evolution operator U (t, t0 ), defined by the expression: U (t, t0 ) = exp [−iH (t − t0 )], (2.2) where t0 is the initial time at which we know the state of the system. The simple formula given above is valid for a time independent Hamiltonian. In the case in which the Hamiltonian of the system is changing in the time (like, for instance, in presence of matter effects), formula (2.2) must be replaced by path-ordered exponential  Z t  U (t, t0 ) = P exp −i dτ H[τ ] . (2.3) t0 The code we are presenting here can be used to solve in an iterative way the system of differential equations appearing in Equation (2.1). This is particularly important in the case of Hamiltonians which are explicitly time dependent or which contain terms fastly oscillating in time. The structure of this paper is the following. We start discussing in section 3 some concrete examples, taken from physics, of situations in which the application of the algorithm presented here is particularly suited. In the next section we present the algoritmic structure and salient aspects of the code we developed. This section includes a presentation of the algorithm, all the essential informations about the distribution, the main subroutines and functions and about the way of working of a sample program. In section 5 we draw our final conclusions. An example of a sample program, with some specific Hamiltonian set up and the relative outputs are presented in the Appendices. 3. The Physical motivations. A very interesting example is given by the study of neutrino physics, which has been one of the central topics of elementary particle physics in the last years. A detailed discussion about the main properties of neutrinos and the relevance of their study for our knowledge of the intimate structure of matter is beyond the scope of this work. Therefore we refer the interested reader to the many reviews one can find in literature [1]. Here we just recall that during the last years the answer has been given to the central question of neutrino physics, which puzzled physicists for more than seventy years, that is to discriminate whether this particle is massive or massless. We know by now that neutrinos are massive and oscillating particles and the proof of this has been given by the important results obtained mainly in the last decade (and especially in the very last years) by the experiments looking for oscillation signals of neutrinos from different sources: solar [2, 3], reactor [4] and atmospheric [5] neutrinos. The great relevance of these results is confirmed by the fact that this is up to now the strongest indication of oscillation we have in the leptonic sector and it is impossible to accomodate it in the usual “minimal version” of the Standard Model (the theory describing very well the electroweak interactions of elementary particles). One can say that neutrino oscillations is a hint for physical phenomena beyond to what is presently known. All these experimental evidences in favors of the oscillation hypothesis have proved that the flavor eigenstates of neutrinos, that is the ones entering in the weak processes, are in fact quantum superspositions of different mass eigenstates (at least three different mass eigenstates are needed to explain the full set of experimental data, if one doesn’t take into account the controversial results of the LSND experiment). During the evolution the composition of this quantum system can change giving rise to the oscillation phenomenon detected in the experiments. Any study of neutrino oscillation is necessarily based on the calculation of the so called neutrino survival (or transition) probability. This is the probability that a neutrino emitted by a source with a certain flavor, for instance an electronic neutrino emitted in the solar fusion processes, remains with the same flavour (or is converted into a different flavor neutrino) before reaching the detector. Hence the basic quantity to compute is the survival probability in matter for a neutrino of a certain flavor: P (νi → νi ; t, Eν ) = |hνi (t0 ) |U (t, t0 ) |νi (t0 )i |2 (3.1) where t0 is the inital time at which the neutrino is assumed to be in the flavour eigenstate νi (with i = e, µ, τ ) and U (t, t0 ) is the evolution operator given by Equation (2.3). In absence of matter the basis in which the Hamiltonian is diagonal is simply the mass basis, whose eigenstates να are connected to the neutrino flavor eigenstates νi by means of the mixing matrix U : X νi = Uiα να , i = e, µ, τ and α = 1, 2, 3 . (3.2) α Using the same compact notation of Equation (2.1), we denote the set of the three neutrino mass eigenstates with the vector ν, where ν ≡ (να , α = 1, 2, 3). This notation can be simply extended to the case in which one has more than three neutrinos 1 . The Schroedinger equation describing the evolution of the system in vacuum under the relativistic approximation and in the hypothesis of equal momentum for different mass eigenstates is: i where H 0 = DiagEα = p dν = H 0ν dt   p2 + m2 ≃ Eν +  (3.3)  m21 /2Eν m22 /2Eν m23 /2Eν   (3.4) The last experimental data (both for atmospheric and solar neutrinos) have proved that to describe neutrino evolution one has to take into account also the modification of the oscillation pattern due to the very important effects of interaction with matter. This gives rise to the well known MSW effect [6]. The problem of calculating neutrino oscillation probability in presence of matter effects has been faced by many authors with different approaches, both numerical and analytical, in the case of two neutrino flavors [7, 8, 9]. Exact solutions to the three neutrino MSW equations were derived [10, 11] for simple matter densities. Numerical algorithms for direct computation of the solar neutrino survival probability with all three active neutrinos have been presented in [12, 13, 14] . The purpose of our code Hamevol is to calculate the electron-neutrino survival probability for a given neutrino energy, a given density profile, given neutrino masses and mixing matrix. This set of (three) oscillation probabilities will be used subsequently by other (Fortran) programs to calculate expected signals from diverse neutrino experiments. Due to the fact that both the mixing matrix and the density function are considered input parameters of Hamevol , all kinds of neutrino oscillation problems may be tackled, including those relevant to anti-neutrinos only. In presence of standard matter with arbitrary electron number density, the propagation is usually well described by the following system of differential equations: 1 This is the case if one introduces also sterile neutrinos in the analysis   dν (3.5) = H 0 + ρ(t)U V U † ν, dt where V is a matrix with V11 as only non-zero element, ρ(t), essentially a forward scattering amplitude, is proportional to the electron number density of the medium Ne (t) √ ρ(t) = ± 2GF Ne (t) (3.6) i and U is the mixing matrix connecting the neutrino flavor eigenstates with the mass eigenstates. In the case of three neutrino generations, adopting the Particle Data Group [15] convention for the mixing matrix, one gets:       νe c1 c3 s1 c3 s3 ν1       (3.7)  νµ  =  −s1 c2 − c1 s3 s2 c1 c2 − s1 s3 s2 c3 s2  ×  ν2  ντ s1 s2 − c1 s3 c2 −c1 s2 − s1 s3 c2 c3 c2 ν3 where ci ≡ cos θi and si ≡ sin θi and the three mixing angles θ1 = θ12 , θ2 = θ23 , and θ3 = θ13 roughly measure mixing between mass eigenstates (1-2), (2-3), and (1-3) respectively. We have neglected the CP violating phase, which is irrelevant in this problem. The plus/minus sign in formula of Equation (3.6) is for neutrinos/antineutrinos respectively. The time dependence of the electron density Ne is a crucial factor involved in solving the evolution equation. The difference of the eigenvalues of H 0 ( the inverse of the usually defined oscillation length) is typically considered to be, in the solar case, of the order m2i − m2j 10−4 − 10−5 eV 2 ≈ ≈ 10−10 − 10−11 eV 2E 1 M eV In [10] an analytical solution of the problem has been found for the case in which the electron number density is parametrized (data taken from [16]) , for sufficiently far distances from the solar core as: Ne (r) = N0 exp(−λr) ; λ ≃ 10.6 r r0 (3.8) with r, r0 the distance from the center and solar radius respectively. An important peculiarity of neutrino propagation in matter with respect to vacuum is that for a certain value of the parameters a resonance appears at a certain point along the neutrino trajectory. This resonance takes place if the following condition is satisfied: ρ(tres ) = ∆m2 cos 2θ , E (3.9) where θ is the mixing angle between the 2 neutrino flavors taking part to the oscillation phenomenon. Apart from this approximate results, exact solutions have appeared for particular forms of the function ρ: for linear densities, in terms of Weber-Hermite functions ([17, 18]); for functions of the form ρ(t) = C(1 + tanh(λt)) in [19], and for exponentially decaying densities ρ(t) = ce−λt in [7, 8]. The parametrization of Equation (3.8) is the one used also in the sample program we present as an example in subsection 4.4. In any case our numerical alghorithm enables us to find a solution of the problem for every expression one chooses for the electron density number. The capability of solving the system of Equations (3.5) and, therefore, of computing the neutrino survival (or transition) probabilities as a function of the mixing parameters is an essential ingredient in every analysis of neutrino data. The theoretical expected signal in every experiment is obtained by convoluting neutrino fluxes, oscillation probabilities, neutrino cross sections and detector energy response functions. The comparison of these expected signal as a function of the mixing parameters with the experimental results is then usually performed by means of a χ2 statistical analysis. The outcome of this kind of analyses is typically the production of exclusion plots selecting the regions of the mixing parameter plan which are in agreement with the data at a certain confidence level. The algorithm we are presenting in this work enables us to numerically solve the neutrino evolution equations for all the oscillation parameter space, without the need to introduce the approximation which are required in different approaches based on the use of semi-analytical expressions in portions of the parameter space. For a more detailed description of the full procedure we adopted for a phenomenological analysis of solar and reactor neutrino data we refer the interested reader to [20]. The numerical alghoritm we are presenting here finds also other relevant applications. Some significant examples are: a)the study of the neutrino evolution inside stochastic media and neutrino propagation in solar magnetic field [21]. In these cases one has to solve systems of differential equations where, respectively, (2N )2 and (2N ) equations appear (N is the number of neutrino species); b) solution of the renormalization group equation for the Minimal Supersymmetric Standard Model in a Supergravity scenario. Here the number of differential equations in the systems that have to be solved simultaneously (with a complicated mixture of initial and boundary conditions) is typically between thirty and one hundred. [22] 4. Code Structure 4.1 Algorithmics There are different ways of solving a possibly stiff set of equations and the advantages and drawbacks of each of them must be evaluated keeping in mind the kind of problem one wants to study. In our case we aim for efficiency rather than precision (a relative precision of 10−3 −10−5 in conversion probabilities for example would be sufficient in a typical application in particle physics propagation problems). Therefore we opted for an adaptive Runge-Kutta (RK) algorithm. The Runge-Kutta method [23] is particularly suitable for solving differential equations, starting from the knowledge of the function at the a fixed intial point X and advancing the solution from X to X + h, by using the evaluation of the function at intermediate points inside the interval h . By properly combining these evaluations one can reduce the error in the final  output. The method is conventionally denoted of order n if its error term is O hn+1 An essential characteristic of a good Ordinary Differential Equations integrator is the capability of having an adaptive control over its progress and a mechanism for adapting its stepsize, in such a way to obtain the required accuracy with the minimal possible computational effort. This property is possessed by the algorithm we implemented. Although an implicit RK would be advised for stiff equations, there are several alternatives, such as the semi-implicit fifth-order RK routine we have chosen. This routine requires the determination of the function at five different points in the interval between the chosen steps. They are k1 = hf (xn , yn ) k2 = hf (xn + a2 h, yn + b21 k1 ) ... (4.1) k6 = hf (xn + a6 h, yn + b61 k1 + . . . b65 k5 ) 6 X ci ki yn+1 = yn + i=1 where the coefficients ai , bij and ci must satisfy certain constraints in order to ensure stability and convergence. This algorithm is well suited for adaptive stepping, due to the fact that among the six evaluations in Eq. (4.1) there is an embedded fourth-order combination, which, although redundant, gives us an estimate of the error at each evaluation thereby allowing us to adjust the step size. Table (1) gives a list of ai , bij and ci as determined by Cash and Karp [23]. i ai bij 1 4 1 5 3 10 3 5 5 1 6 7 8 2 3 1 5 3 40 3 10 11 − 54 1631 55296 9 40 9 − 10 5 2 175 512 6 5 − 70 27 575 13824 35 27 44275 110592 253 4096 1 2 3 4 5 j= ci c∗i 37 378 2825 27648 0 0 250 621 125 594 18575 48384 13525 55296 277 14336 1 4 0 512 1771 Table 1: Cash-Karp coefficients for our RK routines, taken from Ref.[23]. 4.2 The distribution The distribution of the program is contained in the tarred gzipped file hamevol1.0.tar.gz. In any Linux or Unix system, unpacking and untarring this distribution file will produce a local directory called Hamevol1.0 containing the following ascii files: hamevol-rungekutta.hpp hamevol-util.hpp hamevol-sample.hpp hamevol-sample.cpp Makefile The file with the main routines. Some auxiliary utilities. The sample program header. The sample program. A simple compiling make example. In the same Linux or Unix system the execution of the command ./make or directly the explicit call to the C++ compiler g++ -O3 -o hamevol.x hamevol-sample.cpp should produce an executable file from our sample program dedicated to solve some particular neutrino propagation problem. To run the executable the following command should be typed ./hamevol.x OPTION where in our sample program OPTION=1,0 depending on whether full Sun+Earth or only Sun propagation is demanded. As a consequence, some brief ouput will appear on the standard ouput, mainly information about parameter settings and options. In addition, as a result of the execution our sample program writes an output file runge.out with the neutrino conversion probabilities along the neutrino trajectory. In our distribution, we have well separated the code corresponding to the general routines implementing the Runge-Kutta algorithm from those corresponding to a particular application (the “sample” files) of interest to us and that are presented here: the computation of oscillation neutrino probabilities. Within our sample programs, it is also well differentiated the driver code which calls the RK routines from the part where a concrete hamiltonian is built. In the most basic case, a general user should be able to use our program as a black box for his own purposes simply plugging his own definition for the hamiltonian. In the following we will first describe the main routines included in file hamevol-rungekutta.hpp and then those contained in the sample programs. 4.3 The RK algorithm. Main Subroutines The kern code is built up with five main subroutines. They correspond to procedures and methods well known in the literature. We have improved and adapted them for our purposes. The following classes are located in file hamevol-rungekutta.hpp. Here it follows a brief description of any of them together with its calling sequence. For brevity, arguments which are also referenced somewhere else are omitted here. • void runge(CNumber y[], CNumber dydx[], CNumber (*H)(...), int n, Number x, Number h, CNumber yout[], void (*derivs)(...)) Given the value y[1,..,n] of the vector state describing a phyisical system made up with n components and evolving according to Schroedinger equation and knowing the Hamiltonian H of the system, the subroutine produces the advanced solution as the function at the incremented variables yout[1..n]. • void odeint(CNumber ystart[], int nvar, Number x1, Number x2, Number eps, Number h1, Number hmin, CNumber (*H)(...), void (*derivs)(...), void (*rkqs)(...)) This is a Runge-Kutta driver with adaptive stepsize control. It Integrates the starting values ystart[1..nvar] from x1 to x2 with accuracy eps, storing the intermediate results in global variables. A value h1 should be set as a guessed first stepsize, hmin as the minimum allowed stepsize (it can be zero). On output nok and nbad are the number of good and bad (but retried and fixed) steps taken, and ystart is replaced by values at the end of the integration interval. • void rkqs(CNumber y[], CNumber dydx[], int n, Number *x, Number htry, Number eps, CNumber yscal[], Number *hdid, Number *hnext, CNumber (*H)(...), void (*derivs)(...)). This routine rkqs is implemented in order to perform an adaptive 5th order Runge-Kutta integration. The method enables to have a monitoring of local truncation error, in order to ensure the required accuracy and adjust the stepsize. The inputs are the independent variable vector y[1..n] and its derivative dydx[1..n] at the starting value of the independent variable x. Other inputs are the stepsize htry, the required accuracy eps, and the vector yscal[1..n] against which the error is scaled. On output, y and x are replaced by their new values, hdid is the stepsize that was actually accomplished, and hnext is the estimated next stepsize. • void rkck(CNumber y[], CNumber dydx[], int n, Number x, Number h, CNumber yout[], CNumber yerr[], CNumber (*H)(...), void (*derivs)(...)) Used in adaptive size Runge-Kutta integration. Given values for the variables y[1..n] and their derivatives dydx[1..n] known at x, advance solution over an interval h and return the incremented variables as yout[1..n]. Also returns an estimate of the local truncation error in yout using embedded fourth-order method. The user supplies the routine H(x,i,j), which returns the element (i,j) of the hamiltonian of the evolution. • void deriv(Number x, CNumber y[], CNumber dy[], int n, CNumber (*H)(...)). The user-supplied routine derivs is used for calculating the right-hand side derivative. The user supplies the routine derivs(x,y,dydx,n,H), which returns the derivatives dydx of the many variable function y with respect to the vector x at the point x. The following Auxiliary functions which will allocate the following data structures are included in the auxiliary distribution file hamevol-util.hpp. CNumber *Cvector(long nh): Number *vector(long nh): int *ivector(long nh): unsigned long *lvector(long nh): unsigned char *cvector(long nh): template <class Type> Type **matrix(...) allocate a CNumber vector with subscript range v[1..nh] a vector with subscript range v[1..nh]. a vector with subscript range v[1..nh]. a vector with subscript range v[1..nh]. a vector with subscript range v[1..nh]. allocate a Type matrix with a subscript range. 4.4 Sample Program and Inputs The void main routine in hamevol-sample.cpp file takes the values of the neutrino wave functions at initial starting points for physical initial conditions which are standard for solar neutrino physics (νe (0) = 1, νµ (0) = 0, ντ (0) = 0) and calculates the final wave function and corresponding probabilities at the target final points. The algorithm includes the following steps: • It takes from the command line the user argument “1” (Sun) or “0” (Earth) propagation. • It performs argument validation, set internal flags and writes to the standard output a list of current values of diverse parameters. • It declares the output file stream out ‘‘runge.dat’’, class ofstream included within <fstream.h>. • It declares the Cvector objects nu,dnu, respectively instances of the neutrino wave function and their vector derivative. It performs diverse other initializations. • Finally functions odeint and evolve are repeteadly called until the desired final point or the maximum number of steps is reached. Different parameters, for example the number of equations, or in this physical case the number of neutrino species (N = 2, 3), have to be set in the header file hamevol-sample.hpp . We run the RK algorithm to obtain the transition probabilites of neutrinos produced at the sun center with a given energy and mixing angle as a function to its position along the trajectory sun-earth. The user should provide routines for computing the electron densities at Sun and the Earth along the neutrino trajectory. They appear in the matter part of the neutrino hamiltonian. We include examples of the main program and other smaller routines as appendices. 5. Conclusions A new code based on a semi-implicit fifth order adaptive Runge-Kutta algorithm has been developed by us. It can be used as solver for many systems of differential equations, like, for instance, the ones that usually describe the evolution of a system in physics and in other fields. This algorith is particularly suited for the solution of differential equations in which the operator driving the evolution of the system is changing in time. Here we focus our attention to the application of this code to the study of physical problems, like solving the Schroedinger equation for a system that is a quantum superposition of different possible states. The explicit example we present is the study of the evolution and calculation of transition probabilty for neutrinos emitted by a source and travelling in a medium. This code has been already applied by us as a useful tool to obtain a check with respect to other possible numerical algorithms (like the ones based on the evolution operator formalism) in our phenomenological analysis of different neutrino oscillation experiments. This analysis has confirmed the validity of neutrino oscillation hypothesys and enabled us to determine the allowed region for mixing parameters, a topic of great relevance in Elementary Particle Physics. In this paper we discuss the structure of the algorithm we developed and the main features of our code. We also present a sample program and give some typical outputs, as a concrete example of application of our algorithm. 6. Acknowledgments We are really grateful to R. Ferrari for many useful discussions and suggestions and for the continuos support given to our work. One of us (V. A.) would like to thank S. Petcov for very useful discussions about the analytical study of the neutrino progragation in matter. One of us (E.T) would like to thank the hospitality of CERN-TH division, the department of physics of University of Milan, and financial support of INFN-CICYT grant. The computations presented here have been all performed on the computer farm of the Theoretical group of Milano University. 7. Appendices 7.1 Using Hamevol Here we present the main sample program, corresponding to the file hamevol-sample.cpp, where we show explicitly the use of the main routines. #include "hamevol.hpp" #include <string.h> /* Inizialize the vacuum values /* #define parameters (.......)*/ (.......)*/ Number Var; CNumber **HH0; // is the vacuum Hamiltonian in the flavour eingenstates struct mix{ // contains the mixing matrix Number mass[N + 1]; CNumber U[N + 1][N + 1]; } mixing; /* nu are the wave functions, dnu their derivative */ CNumber *nu, *dnu; int main(int arg, char** argv){ Number x1=0.; Number x2; /* /* Argument and parameter validation (............) */ Information output (.............)*/ time_t ti, tf; CNumber *onu; nu = Cvector (N); dnu = Cvector (N); onu = Cvector (N); ofstream out ("runge.dat"); /* save data in runge.dat */ srand (time (&ti)); time (&ti); Var = VarI; Number VarO = Var; Number h = (VarF - VarI) / INIT_STEPS; Number eps = Eps_Error; vacuum_values (); /* Main Routines */ odeint (nu, N, x1, x2, eps, dist, dist_min, H, deriv, rkqs); evolute (nu, &out, VarO); for (int nstp = 1; nstp <= MAX_STEPS; nstp++) { /* Take at most MAXSTP steps */ for (int i = 1; i <= N; i++) onu[i] = nu[i]; vacuum_values (); if ((VarO + h - VarF) * (VarF - VarI) > 0.0) /* Are we done? */ h = VarF - VarO; Var = VarO + h; odeint (nu, N, x1, x2, eps, dist, 0.0, H, deriv, rkqs); if (distance (nu, onu, N) > Prob_Error) { //cout << "DECREASE: h=" << h << endl; h *= DECREASE; Number htemp = ((h < 0) ? FMIN (h, -abs ((VarI - VarF) / MAX_STEPS)) : FMAX (h, abs ((VarI - VarF) / MAX_STEPS))); if (htemp != h) { evolute (nu, &out, Var); VarO = Var; } h = htemp; } else { evolute (nu, &out, Var); h *= INCREASE; Number htemp = ((h < 0) ? FMAX (h, -abs ((VarI - VarF) / MIN_STEPS)) : FMIN (h, abs ((VarI - VarF) / MIN_STEPS))); if (htemp != h) h = htemp; VarO = Var; } if ((Var - VarF) * (VarF - VarI) > 0.0) { /* Are we done? */ cout << "t=" << time (&tf) - ti << endl; return 0; /* normal exit */ } } cout << "Too many steps in routine evolution_matter!" << endl; return -1; } 7.2 Example of Hamiltonian definition Here is the hamiltonian we use in our sample program: /************************************************************************/ /* The Hamiltonian */ /************************************************************************/ inline CNumber V(int i, int j){ return (i == j == 1) ? 1. : 0.; } inline CNumber U(int i, int j){ return mixing.U[i][j]; } CNumber H(Number r, int i, int j){ CNumber HH = 0; return HH0[i][j] + V (i, j) * rho (r) * sqrt (2.) * Gf; } void vacuum_values(){ mixing.mass[1] = 1.e-2; mixing.mass[2] = 1.e-1; Number th12 = M_PI / 3.; Number th13 = M_PI / 3.; Number th23 = M_PI / 3.; nu[1] = 1.; nu[2] = 0.; CNumber H0[N + 1][N + 1]; HH0 = matrix Number sth12 Number cth12 Number sth13 Number cth13 Number sth23 Number cth23 /* ((CNumber) 1, N, 1, N); = sin (th12); = cos (th12); = sin (th13); = cos (th13); = sin (th23); = cos (th23); Three neutrinos (mixing.U)[1][1] (mixing.U)[1][2] (mixing.U)[1][3] (mixing.U)[2][1] = = = = */ CNumber CNumber CNumber CNumber (cth12 * cth13); (sth12 * cth13); (sth13); (-sth12 * cth23 - cth12 * sth23 * sth13); (mixing.U)[2][2] = CNumber (cth12 * cth23 - sth12 * sth23 * sth13); (mixing.U)[2][3] = CNumber (sth23 * cth13); (mixing.U)[3][1] = CNumber (sth12 * sth23 - cth12 * cth23 * sth13); (mixing.U)[3][2] = CNumber (-cth12 * sth23 - sth12 * cth23 * sth13); (mixing.U)[3][3] = CNumber (cth23 * cth13); break; default: cerr << "Number of neutrina (" << N << ") not implemented!" << endl; exit (-1); } /* cout << "Vacuum values:\n"; cout << "- Hamiltonian:\n"; Hamiltonian HH = H0(); cout << HH; cout << "- Mixing matrix:\n"; cout << *(mixing.U); */ for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) { HH0[i][j] = 0; /* H0 is the vacuum Hamiltonian in the mass eingenstates */ if ((i == 1) && (j == 1)) H0[i][i] = 1. / pow (10, Var); // This is OK for two neutrina else H0[i][j] = 0; /* HH0 is the vacuum Hamiltonian in the flavour eingenstates */ for (int k = 1; k < N; k++) for (int l = 1; l < N; l++) HH0[i][j] += conj (U (k, i)) * H0[k][l] * U (l, j); } return; } The user should provide routines for computing the electron densities at Sun and the Earth along the neutrino trajectory. They appear in the matter part of the neutrino hamiltonian. 7.3 Sample outputs The following is the verbatim output of our program hamevol.x 0 for the values of the parameters which appears in the first information lines (included by default in the sample program). ./hamevol.x 0 Starting evolution in the Sun Used parameters: MAX_STEPS 100000 INIT_STEPS DECREASE 0.1 INCREASE 5 VarI -2.39794 VarF Eps_Error 1e-08 Prob_Error x2/VarI 0.00881916 x2/VarF -2.3979 -2.4979 -2.5979 -2.6979 -2.7979 -2.8979 -2.9979 -3.0979 -3.1979 1 1 1 1 1 1 1 1 1 0.00382 0.00382 0.00481 0.00605 0.00762 0.00959 0.0121 0.0152 0.0191 4.62e-44 4.62e-44 4.62e-44 4.62e-44 4.62e-44 4.62e-44 4.62e-44 4.62e-44 4.62e-44 10000 -12.3979 0.01 8.81916e+07 4e-08 4e-08 -1.4e-08 -8.5e-08 1.5e-09 -1.7e-08 3.6e-08 -2.8e-08 7.8e-08 (......................) References [1] See, for instance : M. C. Gonzalez-Garcia and Y. Nir, Rev. Mod. Phys. 75 (2003) 345; A. Y. Smirnov, arXiv:hep-ph/0306075; S. M. Bilenky, C. Giunti and W. Grimus, Prog. Part. Nucl. Phys. 43, 1 (1999); P. Aliani, V. Antonelli, R. Ferrari, M. Picariello and E. Torrente-Lujan, AIP Conf. Proc. 655 (2003) 103 [arXiv:hep-ph/0211062]; P. Aliani, V. Antonelli, R. Ferrari, M. Picariello and E. Torrente-Lujan, Les Rencontres de Physique de la Vallee d’Aoste: Results and Perspectives in Particle Physics. (Vol. 28,Frascati Physics Series), pp. 151-163 [arXiv:hep-ph/0206308] ; A. Strumia and F. Vissani, Int. J. Mod. Phys. A 17 (2002) 1755 [2] Q. R. Ahmad et al. [SNO Collaboration], Phys. Rev. Lett. 89 (2002) 011301 ; Q. R. Ahmad et al. [SNO Collaboration], Phys. Rev. Lett. 89 (2002) 011302 [3] Y. Koshio, arXiv:hep-ex/0306002; S. Fukuda et al. [Super-Kamiokande Collaboration], Phys. Lett. B 539 (2002) 179 [4] K. Eguchi et al. [KamLAND Collaboration], Phys. Rev. Lett. 90 (2003) 021802 [5] G. L. Fogli, E. Lisi and A. Marrone, Nucl. Instrum. Meth. A 503 (2003) 179. [6] L. Wolfenstein, Phys. Rev. D 17, 2369 (1978); S.P. Mikheyev and A. Yu. Smirnov, Yad. Fiz. 42, 1441 (1985) [Sov. H. Nucl. Phys. 42, 913 (1985)] [7] S. T. Petcov. Phys. Lett. B 200,3 373 (1988) [8] U. Toshev. Phys. Lett. B 196 170 (1987) [9] S. Parke, Phys. Rev. Lett. 57, 1275 (1986); P.I. Krastev and S.T. Petcov, Phys. Lett. B 207, 64 (1988); S.T. Petcov, Phys. Lett. B 406, 355 (1997); M. Bruggen, W.C. Haxton, and Y-Z Qian, Phys. Rev. D 51, 4028 (1995); A.B. Balantekin, J.F. Beacom, and J.M. Fetter, Phys. Lett. B 427, 317 (1998); G. Fiorentini, M. Lissia, G. Mezzorani, M. Moretti, and D. Vignaud, Phys. Rev. D 49, 6298 (1994). [10] E. Torrente Lujan, Phys. Rev. D 53, 4030 (1996) See also: E. Torrente-Lujan, Phys. Rev. D 60 (1999) 085003; V. Antonelli and E. Torrente Lujan, Phys. Rev. A 58 (1998) 1980 [11] T. Ohlsson and H. Snellman, hep-ph/9910546; P. Osland and T.T. Wu, hep-ph/9912540 [12] J.S. Kim, Y.S. Chae and J.D. Kim, Comp. Phys. Comm. 120, 41 (1999). [13] J.S. Kim and C.W. Kim, hep-ph/9909428. [14] J. S. Kim and K. Lee, Comput. Phys. Commun. 135, 176 (2001) [15] K. Hagiwara et al. [Particle Data Group Collaboration], Phys. Rev. D 66, 010001 (2002) [16] J.N. Bahcall, R. Ulrich. Rev. Mod. Phys. 60 (1988) 267 [17] S. T. Petcov. Phys. Lett. B Vol.191 (1987) p.299 [18] W.C. Haxton, Phys. Rev. D 35 (1987) 2352 [19] D. Notzold, MPI-PAE/Pth 08/87 (Munich 87) [20] P. Aliani, V. Antonelli, M. Picariello and E. Torrente-Lujan, Nucl. Phys. B 634 (2002) 393; P. Aliani, V. Antonelli, R. Ferrari, M. Picariello and E. Torrente-Lujan, Phys. Rev. D 67 (2003) 013006; P. Aliani, V. Antonelli, M. Picariello and E. Torrente-Lujan, arXiv:hep-ph/0212212; P. Aliani, V. Antonelli, M. Picariello and E. Torrente-Lujan, JHEP 0302 (2003) 025; P. Aliani, V. Antonelli, M. Picariello and E. Torrente-Lujan, New J. Phys. 5 (2003) 2 [21] E. Torrente-Lujan, Phys. Rev. D 59 (1999) 073001. E. Torrente-Lujan, JHEP 0304 (2003) 054 E. Torrente-Lujan, Phys. Lett. B 389 (1996) 557. V. B. Semikoz and E. Torrente-Lujan, Nucl. Phys. B 556 (1999) 353. E. Torrente-Lujan, Phys. Rev. D 59 (1999) 093006. [22] S. Khalil, C. Munoz and E. Torrente-Lujan; New J. Phys. 4 (2002) 27; D. G. Cerdeno, E. Gabrielli, S. Khalil, C. Munoz, E. Torrente-Lujan and E. Torrente-Lujan, Nucl. Phys. B 603 (2001) 231; E. Gabrielli, S. Khalil and E. Torrente-Lujan, Nucl. Phys. B 594 (2001) 3 [23] W. H. Press, et al.,”Numerical Recipes in C++”, Cambridge University Press, Cambridge, 2002 Variable default description hamevol-rungekutta.hpp 1000000 1.0 × 10−10 0.9 -0.2 -0.25 1.89 × 10−4 MAXSTP TINY SAFETY PGROW PSHRNK ERRCON hamevol-sample.cpp MAX-STEPS MIN-STEPS INIT-STEPS DECREASE INCREASE 1.0 × 105 10000 10000 0.1 5.0 RK algorithm internal parameter id. id. id. id. id. Steeper method id. id. id. id. id. hamevol-sample.hpp fermi-MeV m-eV Gf Na RSun REarth Eps-Error Prob-Error N dist dist-min EARTH SUN 1.0/197.326 15 fermi-MeV × 10 106 1.66 × 10−23 6.022 × 1023 6.961 × 108 × m-eV 6.378 × 106 × m-eV 1.0 × 10−8 1.0 × 10−2 2 0.00001 0.0000001 0 1 conversion f → 1/M eV conversion m → 1/eV The Fermi constant in 1/eV 2 Avogadro number Radius of the Sun ( 1/eV) Radius of the Earth (1/eV) number of equations initial stepsize for Runge-Kutta minimal stepsize for Runge-Kutta Program option flag Program option flag Table 2: Here is a list of the most important switches and constants Subroutine Purpose derivs runge odeint Computes the derivatives dy/dx Given the functions y and their derivatives dy/dx, it returns the advanced solution RK driver with adaptive stepsize control. Integrates the starting value over an interval with a required accuracy Used to monitor accuracy and adjust stepsize during RK integration Returns advanced solution over an interval together with the estimate of truncation error rkqs rkck Table 3: The main subroutines and functions used in the code are reported together with a brief explanation of their meaning.
5cs.CE
FRACTIONAL BROWNIAN MARKETS WITH TIME-VARYING VOLATILITY AND HIGH-FREQUENCY DATA arXiv:1707.06416v1 [math.ST] 20 Jul 2017 1 Ananya Lahiri1,† and Rituparna Sen2 Chennai Mathematical Institute, Chennai, India 2 Indian Statistical Institute, Chennai, India Abstract. Diffusion processes driven by Fractional Brownian motion (FBM) have often been considered in modeling stock price dynamics in order to capture the long range dependence of stock price observed in reality. Option prices for such models had been obtained by Necula (2002) under constant drift and volatility. We obtain option prices under time varying volatility model. The expression depends on volatility and the Hurst parameter in a complicated manner. We derive a central limit theorem for the quadratic variation as an estimator for volatility for both the cases, constant as well as time varying volatility. That will help us to find estimators of the option prices and to find their asymptotic distributions. Keywords: asymptotic normality, fractional Black Scholes model, Malliavin calculus, option price, volatility, Wick financing, Wick Ito Skorohod integration, Wiener chaos. 1. Introduction It has been proposed to model stock prices as a diffusion driven by fractional Brownian motion (fBm) in order to capture long range dependence of stock price in reality. See Cont (2005) for evidence of long memory in finance and relation to fractional Brownian motion. Cheridito (2003) has shown that the solution of the diffusion equation driven by fBm with suitably time lag will lead to an arbitrage-free model. Guasoni (2006) has shown no arbitrage under transaction cost for fBm model. Elliott and Van der Hoek (2003), Biagini et al. (2004) have shown under Wick Ito Skorohod notion of integration one can get arbitrage free market with fBm in some sense. Option prices for such models are obtained by Necula (2002) under constant drift and volatility. One of the aims of this paper is to obtain estimator for some functional of volatility which can be used to price option under time varying volatility model. For Brownian motion (Bm) setup, the estimation of one of the important functional of volatility appeared in option price formula, called integrated volatility, is performed using sum of frequently sampled squared data. For high frequency data with equal interval this estimator is essentially quadratic variation. FBm is long memory process for Hurst parameter H ∈ ( 12 , 1). It is well established result that for pure fBm with H ∈ ( 12 , 43 ) quadratic variation is asymptotically normal. Using that result we will show that in the diffusion driven by fBm with H < 34 with constant volatility, quadratic variation is asymptotically normal. For similar model and low frequency data with fixed time gap asymptotic normality for volatility estimator was obtained by Xiao et al.(2013). In our paper we consider the estimator for high frequency data with time intervals decreasing to zero and show the asymptotic normality for the estimator. Confidence intervals for volatility can now be translated to confidence intervals for option prices as the expression for option price involve the quantity volatility. For diffusion driven by fBm with H ∈ ( 21 , 34 ) and time varying bounded volatility case also we will show the asymptotic normality of the estimator from high frequency data. The objective of this paper is two fold. Firstly for the diffusion driven by fBm with time varying volatility we will find the option price in terms of some functional of volatility and the Hurst parameter. Secondly we will show the asymptotic normality property for the estimator for such parametric †Corresponding author, E-mail: [email protected]. 1 2 function. The estimator requires the prior knowledge of Hurst parameter. Once the estimate of functional of volatility is found one can apply the estimate to get the option price. The rest of the paper is organized as follows. In section 2 we describe the diffusion model for the stock price. In section 3 we introduce the proper notion of integration required to obtain an arbitrage-free solution of the diffusion equation. In section 4 we present the option pricing results. The central limit theorems for the proposed estimator are obtained in section 5. We conclude and summarize the current and future research directions in section 6. 2. Model The introduction of the fractional Black-Scholes model, where the Bm in the classical Black-Scholes model is replaced by a fBm, have been motivated by empirical studies (see for example Mandelbrot (1997), Shiryaev (1999)). The risk free asset equation is dPt = rt Pt dt, P0 = 1, 0≤t≤T (2.1) The risky asset equation is dSt = µt St dt + σt St dBtH , S0 = S > 0, 0≤t≤T (2.2) where BtH is FBM with initial condition S0 = S > 0. Here H is Hurst parameter, for 0 < H < 1. µt is real valued deterministic function of time t, called drift and σt2 is positive real valued deterministic function of t, called volatility. BtH is a continuous and centered Gaussian process starting at 0 with covariance and variance functions as follows: ∀H ∈ (0, 1), s, t > 0 BtH 1 E(BtH BsH ) = (t2H + s2H − | t − s |2H ) 2 (2.3) E(BtH )2 = t2H , (2.4) H Bt+s − BsH BtH has homogeneous increments, i.e., has same law as for all s, t > 0. Increments are H H H dependent and correlation between the increments Bt+h − Bt and Bs+h − BsH with s + h ≤ t and t − s = nh is as follows: 1 2H [(n + 1)2H + (n − 1)2H − 2n2H ] (2.5) ρH n = h 2 Firstly we will find the European call option price for this model. Secondly we try to provide an estimator for option price. In this process we see that it is enough to study the quadratic variation of this process for given high frequency data 0 = t0 < t1 < · · · < tN = 1 with Stj , j = 0, · · · , N and 1 tj+1 − tj = ∀ j = 0, · · · , N − 1. We will propose suitable estimator with this data and see where N it converges and how that is useful for estimating option price. We observe that the analysis is based on high frequency data, as sample size increases the time difference between two consecutive data point decreases. We also note that through out our analysis we know H, we do not estimate H from data. 3. Regarding the solution of the SDE, Wick Ito Skorohod Integral, H ∈ (0, 1) In order to find the solution of the diffusion equation (2.2), we need to note that the whole analysis depends on how we interpret the term dBtH . For H 6= 1/2, BtH is not a semimartingale. There are different notions of integration with respect to BtH , out of which we choose Wick Ito Skorohod (WIS) integral notion to solve equation (2.2), for H ∈ (0, 1), due to financial reason outlined in, for example, see Elliot and Van der Hoek (2003) and Biagini et.al. (2004),(2008). Rogers (1997) explains why other common notions of integral are inappropriate. Following the WIS notion of integration the solution of the stochastic differential equation (2.2) is  Z t Z Z t 1 2 H (M(σs χ[0,t] )) ds (3.1) St = S0 exp σs dBs + µs ds − 2 R 0 0 3 where M is an operator acting on s and depends on H; χ[0,t] is the indicator function. See Biagini et Rt al. (2004, 2008). We will discuss about the operator M in next subsection and meaning of 0 σs dBsH in following subsection. 3.1. The integral operator M. Let us elaborate about the operator M which will be needed in future sections, See Biagini et al. (2004). Let S(R) denote the Schwartz space of smooth rapidly decreasing functions on R. M is defined on S(R) to L2 (R) as follows: Z 3 d Mf (x) = − CH (t − x)|t − x|H− 2 f (t)dt (3.2) dx R CH is constant. 1 with Fourier transform fˆ defined as Mf (y) = |y| 2 −H fˆ(y), y ∈ R fˆ(y) = Z e−ixy f (x)dx. (3.3) (3.4) R 1 [Γ(2H + 1) sin(πH)] 2 , Γ(.) is gamma function and explicit expression It turns out that CH = [2Γ(H − 12 ) cos( 12 π(H − 21 ))] for M is as follows: Z 1 f (x − t) − f (x) for H ∈ (0, ), Mf (x) = CH dt (3.5) 3 2 |t| 2 −H R 1 for H = , Mf (x) = f (x) 2 Z f (t) 1 dt for H ∈ ( , 1), Mf (x) = CH 3 −H 2 R |t − x| 2 (3.6) (3.7) M extends S(R) to L2H where 1 L2H (R) = {f : R → R(deterministic); |y| 2 −H fˆ(y) ∈ L2 (R)} = {f : R → R; Mf (x) ∈ L2 (R)} = {f : R → R; kf kL2H < ∞}, wherekf kL2H = kMf kL2 } We also have for f ∈ L2H (R) hf, giL2H = hMf, MgiL2 (3.8) d , ĝiL2 = hMf, giL2 d L2 = hMf hf, MgiL2 = hfˆ, Mgi (3.9) and for f, g ∈ L2 (R) ∩ L2H (R) 3.2. Wiener Integral with respect to FBM, H ∈ (0, 1). Let f ∈ L2H (R), deterministic. Then Mf ∈ L2 (R). The Wiener integral with respect to fractional Brownian motion is defined as Z Z H f (s)dBs = (Mf )(s)dBs (3.10) R R For detail see Appendix. 4. On the way to calculate European call option price In this section we follow similar line of argument in that of Elliot and Van der Hoek (2003). 4 4.1. Risk-neutral measure. Let us write equation (2.2) with the notion if Wick product. Now following Elliott and Van der Hoek (2003) we rewrite equation (2.2) as follows: dSt = St ⋄ [µt + σt WtH ]dt (4.1) dBtH where ⋄ is the Wick product for two processes and = . For meaning of Wick product and dt H Wt see Appendix (8.2). From theorem of “Wick Ito integral” Biagini et al. (2008) or (Appendix (8.2)) we note that St dBtH = St ⋄ WtH dt. We denote trading strategy or portfolio as θ(t, ω) = θ(t) = (u(t), v(t)) = (ut , vt ) where u(t) and v(t) are the number of units of bond and stock respectively in the portfolio at time t and the processes are adaptive. The value process is defined as WtH ztθ = ut Pt + vt St (4.2) Definition: The concept analogous to self-financing in the fractional Brownian setting is Wickfinancing. Elliott and Van der Hoek mention it as self financing but Wick financing strategy is not usual buy and hold strategy. A portfolio is Wick-financing if dztθ = ut dPt + vt dSt = ut dPt + vt St ⋄ [µt + σt WtH ]dt (4.3) dztθ = ut dPt + vt St ⋄ (µt + σt WtH )dt = ut rt Pt dt + vt St ⋄ µt dt + σt vt St ⋄ WtH dt = (zt − vt St )rt dt + µt vt St dt + σt vt St ⋄ WtH dt   µ t − rt H = zt rt dt + σt vt St ⋄ + Wt dt σt From the Girsanov theorem in Elliott and Van der Hoek (2003) the translated process B̂tH as Z t µ s − rs H B̂t = ds + BtH (4.4) σ s 0 Z 1 dP̂ 2 = exp(hω, φi− kφkL2 ) = exp( φ(s)dBs − is fBm with respect to new measure P̂ defined on F by dP 2 R   1 r(s) − µ(s) −1 2 1 2 I[0,t] (s). For notation exp(hω, φi − 2 kφkL2 ) see Appendix kφkL2 ) where φ(s) = M 2 σ(s) (8.1). We note that φ(s) has to be in L2 R. Now we can rewrite 4.3 as dzt = rt zt dt + σt vt St ⋄ ŴtH dt (4.5) Z t dB̂tH where, ŴtH = . Multiplying both sides with exp(r̃t ) with r̃t = rs ds and integrating, we get dt 0 Z t −r̃t e zt − z0 = e−r̃s σs vs Ss ⋄ ŴsH ds (4.6) 0 and   Ê e−r̃T zT = z0 where Ê is expectation under measure P̂ . Thus there exists a risk-neutral measure. We note that under risk neutral measure P̂ we have dSt = rt St dt + σt St dB̂tH which will be useful for calculating option price. (4.7) 5 4.2. Complete Market. Let Ft = σ{BsH , 0 ≤ s ≤ t} be the filtration. The market is complete if ∀ FT measurable bounded random variable F , ∃ z ∈ R and portfolio (ut , vt ) such that F = zT almost surely P̂ , where zT is given by 4.2. We now proceed to verify this. By fractional Clark-Ocone theorem in Elliott and Van der Hoek (2003) applied to F , we have, Z T h i  −r̃  −r̃T e F = Ê e T F + (4.8) ẼP̂ D̂t (e−r̃T F ) | Ft ⋄ ŴtH dt 0 Here ẼP̂ denotes the quasi-conditional expectation and D̂t is the fractional Hida Malliavin derivative with respect to B̂tH . For detail see Elliot and van der Hoek (2003)and Biagini et. al. (2008). We take z = Ê e−r̃T F . Now comparing equations (4.6) and (4.8) we get h i ẼP̂ D̂t (F ) | Ft = er̃T −r̃t σt vt St This is the condition for completeness of the market. Here we note that there is criticism about this notion of completeness with Wick financing instead of self financing, see Bjrk and Hult (2005). Fractional Black Scholes market has weak arbitrage but no strong arbitrage, see Biagini et al.(2008). In the context of quasi conditional expectation we require following lemma which will be useful for calculating option price in next section. Z t Z  1 H Lemma 4.1. a) If gt = exp σs dB̂s − (M(σs χ[0,t] ))2 ds then for T > t, ẼP̂ [gT |Ft] = gt . 2 R 0 1,2 Z b) If F ∈ L (P̂ ) (similar to Definition A4 of Elliott and Van der Hoek (2003)), and Gt = t 0 Ft dB̂tH , then for T > t, ẼP̂ [GT |Ft ] = Gt . Proof. Proof can be done by direct calculation.  4.3. Price of European Call Option. We next will find the European call option price ẼP̂ [(ST − K)+ |Ft ] for this model. When µt = µ and σt = σ, Necula (2008) obtains the price C at every t ∈ (0, T ) of an European call option with strike price K and maturity T as C(t, St ) = St Φ(d1 ) − Ke−r(T −t) Φ(d2 ) where d1 = 2 S log( Kt )+r(T −t)+ σ2 (T 2H −t2H ) σ T 2H −t2H √ and (4.10) 2 S d2 = (4.9) log( Kt )+r(T −t)− σ2 (T 2H −t2H ) σ √ T 2H −t2H (4.11) and Φ() is the cumulative probability of the standard normal distribution. The confidence intervals for σ 2 obtained in section 5 can be translated to prediction intervals for C as in Mykland (2000) or Avellaneda et al (1995). Next for time varying µt and σt let us calculate option price. We need the following lemma. Lemma 4.2. The price at every t ∈ [0, T ] of bounded FT measurable function F ∈ L2 (P̂ ) is given by F (t) = exp(−r̃T + r̃t )ẼP̂ [F |Ft ]. Proof. Proof can be followed in similar line as in Theorem 4.1 from Necula (2008) and using part b) of lemma 4.1.  For European call option price F will be F (ω) = (S(T, ω) − K)+ where K is the strike price. Now following similar line of approach from Theorem 3.1 of Necula (2008) and using part a) of lemma 4.1 we get  Z T   Z t  Z Z 1 1 H H 2 2 ẼP̂ exp σs dB̂s |Ft = exp σs dB̂s − (M(σs χ[0,t] )) ds + (M(σs χ[0,T ] )) ds 2 R 2 R 0 0 (4.12) Equation (4.12) will be used for proving next theorem. 6 Theorem 4.1. The price at every T ∈ [0, T ] of an European call option with strike price K and maturity T is given by St Φ(d1 ) − K exp(−r̃T + r̃t )Φ(d2 ) where R R ln(St /K) + r̃T − r̃t + R (M(σs χ[0,T ] ))2 ds − R (M(σs χ[0,t] ))2 ds qR d1 = R 2 ds − (M(σ χ )) (M(σs χ[0,t] ))2 ds s [0,T ] R R and R R ln(St /K) + r̃T − r̃t − R (M(σs χ[0,T ] ))2 ds + R (M(σs χ[0,t] ))2 ds qR d2 = R (M(σs χ[0,T ] ))2 ds − R (M(σs χ[0,t] ))2 ds R . Proof. Proof is in similar line as that of given in Necula (2008).  5. Estimation of volatility from discrete observations Assume that the process is observed at discrete-time instants 0 = t0 < t1 < t2 < · · · < tN = T . Thus the observation vector is S = (St1 , St2 , · · · , StN ). We note that this is high frequency data. In 1 > 0. In section 5.1 we present particular, we assume tk = kh, k = 1, 2, · · · , N for a step size, h = N the results when σt is constant and in section 5.3 when σt is time varying. In section 5.2 and 5.4 we present simulation studies. 5.1. Constant σ. Let us start with the estimator of σ 2 as N −1 2 1 X ˆ 2 σ = log(S ) − log(S ) t t k+1 k Nh2H k=0 (5.1) We shall prove a central limit theorem for σˆ2 . The main component of the proof is central limit theorem for quadratic variations of fractional Brownian motion. We also need to bound the additional terms that comes from the geometric nature of our process. Some of these arguments are similar to those of Nourdin (2008, 2009). The main theorem for this section is given below. Theorem 5.1. Assume that the stock price follows the diffusion model specified by equation (4.4) with no drift and constant volatility σ. Also assume that H ∈ (0, 3/4). N → ∞ with the observation interval Nh = T remaining constant. Without loss of generality we can assume T = 1. Then √ 2 N(σˆ2 − σ 2 ) =⇒ N (0, σH,2 ) (5.2) 2 where σH,2 is a constant that can be computed explicitly, X k 1 (1 − )[(k + 1)2H + (k − 1)2H − 2k 2H ]2 ). = 2σ lim (1 + 2(1 − )(22H − 1)2 + N →∞ N N k=2 N 2 σH,2 4 Proof. Under the condition of µ = 0 and σt = σ, the solution (3.1) of the stochastic differential equation (4.2) simplifies to   1 2 2H H St = S0 exp σdBt − σ t . (5.3) 2 Putting this solution in the definition of σˆ2 in equation (5.1), we get,  N −1  X  σ2  2 1 H H 2H 2H σ B(k+1)h − Bkh − {(k + 1)h} − {kh} σˆ2 = Nh2H k=0 2  2  P  N −1 H H B − B kh (k+1)h  k=0 n  1 o  P 2  N −1 H H 2H 2H = (5.4) σ B(k+1)h − Bkh {(k + 1)h} − {kh}  Nh2H  −σ k=0  2 PN −1 2 2H − {kh}2H + σ4 k=0 {(k + 1)h} 7 It is already known, for example putting κ = 2 in equation (1.5) of Nourdin(2008), that if H ∈ (0, 3/4), N −1 i  1 X h −2H H H 2 2 h B(k+1)h − Bkh − 1 =⇒ N (0, σH,2 ) (5.5) XN := √ N k=0 Combining (5.4) and (5.5), we have √ N −1 X  H   σ3 H 2 2 ˆ B(k+1)h − Bkh {(k + 1)h}2H − {kh}2H N ( σ − σ ) = XN − √ N h2H k=0 N −1 X 2 σ4 + √ {(k + 1)h}2H − {kh}2H . 4 N h2H k=0 (5.6) It is shown in lemma 5.1 that the second term converges to zero in L2 as N → ∞. In lemma 5.2 it is shown that the third term converges to zero. The theorem now follows by applying Chebyshev’s inequality to get convergence in L2 implies convergence in probability and Slutsky’s theorem to get final asymptotic normality.  Lemma 5.1. Under the assumptions of theorem 5.1, √ Proof. As h = N −1 X  H   L2 σ3 H B(k+1)h − Bkh {(k + 1)h}2H − {kh}2H −→ 0 N h2H k=0 (5.7) 1 l.h.s of (5.7) is N 3 U1 = σ N N −1 X 2H− 21 k=0 H 2 Now we have E(B H k+1 − B k ) = N N H (B H k+1 − B k )(( N N k + 1 2H k ) − ( )2H ) N N (5.8) 1 , N 2H H H H E(B H k+1 − B k )(B k+2 − B k+1 ) = N N N N 22H − 1 1 ∼ 2H 2H N N k − j − 1 2H k − j 2H i 1 h k − j + 1 2H | | +| | − 2| | for |k − j| > 1. N N N N 2 N N N Then second moment of (5.8) becomes H H H E(B H k+1 − B k )(B j+1 − B j ) = σ 6 N 4H−1 N −1 N −1 X X k=0 j=0 = σ6 N N −1 N −1 X X ((  k + 1 2H k j + 1 2H j H H H ) − ( )2H ) ( ) − ( )2H E(B H k+1 − B k )(B j+1 − B j ) N N N N N N N N (2H(k + 1)2H−1 )(2H(j + 1)2H−1 ) × [ k=0 j=0 k=j,|k−j|=1 1 ] N 2H N −1 N −1 σ6 X X (2H(k + 1)2H−1 )(2H(j + 1)2H−1 ) + N j=0 k=0 |k−j|>1 k − j − 1 2H k − j 2H i 1 h k − j + 1 2H | +| | − 2| | × | 2 N N N 8 ≤ σ6 2 N 2H+1 4H [N 4H−1 + 2N 4H−1 N −1 N −1 σ6 X X (2H(k + 1)2H−1 )(2H(j + 1)2H−1 ) ]+ N k=0 j=0 |k−j|>1 h 1 k − j 2H−2 i × 2 2 2H(2H − 1)| | N N N −1 N −1 16σ 6 H 3 (2H − 1) X X ≤ 12σ 6 H 2 [N 2H−2 ] + (k + 1)2H−1 (j + 1)2H−1 |k − j|2H−2 N 2H+1 j=0 k=0 |k−j|>1 = 12σ 6 H 2 [N 2H−2 ] + 16σ 6 H 3 (2H − 1) T1 N 2H+1 Now, T1 = N −1 X k 2H−2 ≤ = k 2H−2 k 2H−2 ≤ ≤ k 2H−2 N X (2Hj 2H−1 )2 N X (2Hj 2H−1 )2 j=1 k=1 N −1 X (2H(k + j)2H−1 )2 j=k+1 k=1 N −1 X N −k X j=1 k=1 N −1 X (2Hj 2H−1 )(2H(k + j)2H−1 ) j=1 k=1 N −1 X N −k X k 2H−2 (4H 2 N 4H−1 ) k=1 2H−1 ≤ N 4H 2 N 4H−1 = 4H 2N 6H−2 So, we get E(U12 ) < 12σ 6 H 2 N 2H−2 + 16σ 6 H 3 (2H − 1)N 4H−3 → 0 as N → ∞ if H < 43 . Hence the result.  Lemma 5.2. Under the assumptions of theorem 5.1, N −1 X 2 σ4 √ {(k + 1)h}2H − {kh}2H → 0 4 N h2H k=0 (5.9) N −1 1 σ 4 2H− 1 X k + 1 2H k 2 Proof. Again putting h = l.h.s of (5.9) is U2 = N | − | |2H )2 (| N 4 N N k=0 U2 N −1 1 3 σ4 σ 4 −2H− 1 X 2 4H 2 [(k + 1)2H−1 ]2 ≤ N −2H− 2 4H 2 N 4H−1 = σ 4 H 2 N 2H− 2 ≤ N 4 4 k=0 So, U2 → 0 as n → ∞ if 2H − 3 2 < 0 that is H < 43 . Hence the result. X k 1 (1 − )[(k + 1)2H + (k − 1)2H − 2k 2H ]2 ). = 2σ lim (1 + 2(1 − )(22H − 1)2 + N →∞ N N N We note that 2 σH,2  4 k=2 9 Table 1. The MEAN, VAR, MSE, ASYV of the estimators when σ 2 = 0.4 σ 2 =0.4 H 0.55 0.65 0.74 MEAN 0.399936 0.3986239 0.4016842 VAR 0.0002994642 0.00044069611 0.0007573279 MSE 0.0002994683 0.0004088546 0.0007601643 Table 2. The MEAN, VAR, MSE, ASYV of the estimators when σ 2 = 1.6 σ 2 =1.6 H 0.55 0.65 MEAN 1.601847 1.605567 VAR 0.00456971 0.008053313 MSE 0.004573123 0.008084309 Table 3. The MEAN, VAR, MSE, ASYV of the 0.74 1.607953 0.01498881 0.01505207 estimators when σ 2 = 6.4 σ 2 =6.4 H 0.55 0.65 0.74 MEAN 6.401082 6.450209 6.720847 VAR 0.08589091 0.1253994 0.4416412 MSE 0.08589208 0.1279204 0.5445839 5.2. Simulation Studies for fixed σ. In this section we present the simulation result for FBM driven model and it’s estimator. We use somebm packages from R to simulate fractional Brownian motion. We keep drift parameter µ = 0. We generate each sample paths with N = 1000 points and replicate with replication number, say r =, 200 times to find the mean, variance and mean squared 1 3 error. We repeat the simulation for different values of σ 2 and for H ∈ ( , ). Simulation shows that 2 4 1 3 estimators are excellent when H > and H < for high frequency data with 1000 values in the 2 4 time interval 0 to 1. 5.3. Time varying σt . In this section we will prove the result for long memory process only, i.e. Z 1 H > . Our parameter of interest would be θ = (M(σs χ[0,1] ))2 ds. 2 R To get the properties of time varying volatility estimator we need some Mathematical foundation. Readers are referred to Appendix for background for time varying volatility estimator before starting of this section. We denote Z Z H ηk := σs χ[ k , k+1 ] dBs = fk (s)dBsH = I1 (fk ) R N N R where fk (s) = σs χ[ k , k+1 ] (s) and I1 is Wiener integral with respect to fBm BtH so ηk is same as the N N Wiener integral discussed before. Define ! N −1 X √ −2H+1 2 h ηk − θ̃N (5.10) XN = N k=0 where θ̃N = N −1 X h−2H+1 E(ηk2 ). k=0 Theorem 5.2. Assume that the stock price follows the diffusion model specified by equation (4.4) with no drift (µ = 0) and time varying volatility σt . Also assume that H ∈ (1/2, 3/4). N → ∞ 10 with the observation interval Nh = T remaining constant. Without loss of generality we can assume T = 1. Then, 2 XN =⇒ N (0, σH,2,∗ ) (5.11) 2 where σH,2,∗ can be computed explicitly given the form of σ(t) with the formula 2 σH,2,∗ = lim N 4H−1 N →∞ 2 N −1 N −1 X X ( Proof. r.h.s. of 5.10 can be rewritten as XN = √ Mfk (s)Mfk′ (s)ds)2 R k=0 k ′ =0 . Z N 2H−1 N N −1 X k=0 Z ! ηk2 − θ̃N . Let us introduce some notations. Z 2 Let us denote E(ηk ) = θk . We get θk = (M(σs χ[ k , k+1 ] ))2 ds as expectation of Wiener integral N R R N σs χ[ k , k+1 ] dBsH . Now N N E(N 2H−1 N −1 X ηk2 ) =N 2H−1 k=0 N −1 X θk = N 2H−1 k=0 N 2H−1 N −1 Z X k=0 R N −1 Z X k=0 R (M(σs χ[ k , k+1 ] ))2 ds N N (M(σs χ[ k , k+1 ] ))2 ds = θ̃N N N If H > 1/2 and σ(s) < Σ ∀ s then Z R Mfk (s)Mfj (s)ds ≤ Σ2 H(2H − 1) |k − j|2H−2 for |k − j| > 1 N 2H 1 c for |k − j| = 1, c = (22H − 1) a constant 2N 2H Σ2 for k = j ≤ N 2H ≤ Σ2 Using product formula for Wiener chaos integrals (8.7) we get ηk2 = I12 (fk (s)) = I2 (fk ⊗0 fk ) + I0 (fk ⊗1 fk ) Z = I2 (fk ⊗0 fk ) + (M(σs χ[ k , k+1 ] ))2 ds R N N and ηk2 − θk = I2 (fk ⊗0 fk ) R We note that I0 (fk ⊗1 fk ) = hfk , fk iH = R (M(σs χ[ k , k+1 ] ))2 ds. N N Z 2 Then E(ηk ) = EI2 (fk ⊗0 fk ) + (M(σs χ[ k , k+1 ] ))2 ds. So, we get EI2 (fk ⊗0 fk ) = 0. R N Let us now calculate the second moment of N N −1 X k=0 ηk2 . 11 E N −1 X ηk2 k=0 !2 = N −1 N −1 X X k=0 = k ′ =0 N −1 N −1 X X k=0 k ′ =0 E ((I2 (fk ⊗0 fk ) + θk )(I2 (fk′ ⊗0 fk′ ) + θk )) [E(I2 (fk ⊗0 fk )I2 (fk′ ⊗0 fk′ )) +θk EI2 (fk′ ⊗0 fk′ ) + θk′ EI2 (fk ⊗0 fk ) + θk θk′ ] = A1 + A2 + A3 + A4 Where A1 , A !2 , A3 , A4 are respective terms in the summation. Now A2 = A3 = 0. We observe that N −1 X Var ηk2 = A1 . k=0 A1 = 2 N −1 N −1 X X k ′ =0 k=0 = 2 N −1 N −1 X X k=0 k ′ =0 = 2 hfk ⊗0 fk , fk′ ⊗0 fk′ iH⊗2 hfk , fk′ i2H⊗1 N −1 N −1 X X (E(I1 (fk )I1 (fk′ ))2 k=0 k ′ =0 = 2 N −1 N −1 X X (E(ηk ηk′ ))2 k=0 k ′ =0 = 2 N −1 N −1 X X ( k=0 k ′ =0 A1 ≈ 2(N 1−4H = 2(N 1−4H = 2(N = 2N + N −1 N −1  X X k=0 k ′ =0 k6=k ′ 1−4H 1−4H 4 2 Z Mfk (s)Mfk′ (s)ds)2 R k ′ − k 2H−2 1 Σ H(2H − 1) | | N N2 2 2 + Σ H (2H − 1) N 4 2 2 + Σ H (2H − 1) N 4 2 2 −4H N −1 N −1 X X k=0 k ′ =0 k6=k ′ N −1 X −4H + 4Σ H (2H − 1) N NX −1+k (N − 1) Then N 4H−1 A1 < ∞ if H < 43 . So, we can see N 4H−1 E N −1 X k=0 ) | k ′ − k |4H−4 ) k=−N +1 k ′ =k k6=0 −4H 2 N −1 X | k |4H−4 ) k 4H−4 for H > 1/2 k=1 ηk2 !2 = N 4H−1 A1 . 12 Let us write XN in terms of multiple Wiener Ito integral. ! N −1 X √ XN = N N 2H−1 (I1 (fk ))2 − θ̃N k=0 = √ N 2H−1 N N −1 X k=0 = N 2H− 21 I2 ( N −1 X k=0 = YN + √ (I2 (fk ⊗0 fk ) + θk ) − θ̃N −1  X √  2H−1 N θk − θ̃N (fk ⊗0 fk )) + N N k=0 N(N 2H−1 N −1 X k=0 Now √ N (N 2H−1 N −1 X k=0 ! θk − θ̃N ) θk − θ̃N ) = 0 for all N. Observe that E(YN2 ) = N 4H−1 A1 = SN . Define YN GN = √ . SN To prove asymptotic normality we will use the two theorems (8.1) and (8.2). Using the theorems we want to show that kDGN k2H → 2 in L2 . For that matter we first show lim E[kDGN k2H ] = 2 and N →∞ then lim E[kDGN k2H − 2]2 = 0. Now, N →∞ [kDGN k2H − 2]2 = [kDGN k2H − E[kDGN k2H ] + E[kDGN k2H ] − 2]2 = [kDGN k2H − E[kDGN k2H ]2 + [E[kDGN k2H ] − 2]2 + 2[kDGN k2H − E[kDGN k2H ][E[kDGN k2H ] − 2] = A + B + 2C where A, B, C are respective terms. Now EC = 0, B → 0 as N → ∞. We will be interested in A for further analysis. Using (8.11) we get N −1 X 1 fj (t)I1 (fj ). Dt YN = 2N 2H− 2 j=0 So kDYN k2H = 4N 4H−1 k=0 j=0 Now E[kDYN k2H ] N −1 N −1 X X 4H−1 = 4N I1 (fj )I1 (fk )hfj , fk iH . N −1 N −1 X X k=0 j=0 (hfj , fk iH )2 = 4N 4H−1 A1 = 2SN 2 We note that E[kDYN k2H ] = 2E[YN2 ]. So E[kDGN k2H ] → 2 as N → ∞. Let us calculate the following kDYN k2H − E[kDYN k2H ] N −1 N −1 X X 4H−1 [(I2 (fj ⊗0 fk ) + I0 (fk ⊗1 fk )hfj , fk iH − hfj , fk i2H ] = 4N k=0 j=0 = 4N 4H−1 N −1 N −1 X X k=0 j=0 [I2 (fj ⊗0 fk )hfj , fk iH ] 13 And then E[kDYN k2H − E[kDYN k2H ]]2 = 16N 8H−2 N −1 N −1 X X E[ k=0 j=0 [I2 (fj ⊗0 fk )hfj , fk iH ]]2 ≤ constant N 8H−6 → 0 For last part of the calculation see lemma 5.2 of Tudor (2013). as N → ∞ and H < 43 . Hence the proof.  Theorem 5.3. Under the conditions of theorem 5.2, √ 2 ) N (σˆ2 − θ̃N ) =⇒ N (0, σH,2,∗ (5.12) 2 where σH,2,∗ is a constant that can be computed explicitly, given the form of σ(t). Proof. Under the condition of µ = 0, the solution (3.1) of the stochastic differential equation (4.2) simplifies to Z t  Z 1 H 2 St = S0 exp σs dBs − (M(σs χ[0,t] )) ds . (5.13) 2 R 0 Z Z k X 2 ˜ ˜ Let us denote fk (s) = fk (s) and δk = (M fk+1 (s)) − (M f˜k (s))2 . Putting the solution (5.13) R j=0 R in the definition of σˆ2 in equation (5.1), we get, 2 N −1  1 1 X ηk − δk Nh2H 2 k=0 # "N −1 N −1 N −1 X X X 1 δk2 = N 2H−1 ηk2 − ηk δk + 4 k=0 k=0 k=0 σˆ2 = (5.14) Combining (5.14) and (5.11), we have √ 1 N(σˆ2 − θ̃N ) = XN − N 2H− 2 N −1 X k=0 N −1 X 1 1 ηk δk + N 2H− 2 δk2 . 4 (5.15) k=0 where XN is defined in theorem 5.2. It is shown in lemma 5.3 that the second term converges to zero in L2 as N → ∞. In lemma 5.4 it is shown that the third term converges to zero. The theorem now follows by applying Chebyshev and Slutsky with theorem 5.2 as before.  Lemma 5.3. Under the assumptions of theorem 5.2, G=N 2H− 12 N −1 X k=0 Proof. Let us recall Eηk ηk′ = δk = Z R Z L2 ηk δk −→ 0 Mfk (s)Mfk′ (s)ds R [(M f˜k+1 (s))2 − (M f˜k (s))2 ]ds (5.16) 14 For H > 1 2 δk = H(2H − 1)[ Z = H(2H − 1)[ k+1 N 0 Z Z k+1 N 0 k+1 N k N Z k+1 N σ(s)σ(t)|s − t| +2 k N Z k N 0 Z k+1 N 2H−2 dsdt − Z 0 k N Z k N 0 σ(s)σ(t)|s − t|2H−2 dsdt] ] k N So Σ2 [1 + (k + 1)2H − (k)2H − 1] N 2H Σ2 ≈ (k + 1)2H−1 N 2H |δk | ≤ We look at the L2 norm of G. 2 E(G ) = N 4H−1 N −1 N −1 X X k=0 → 0. using estimates for δk and estimates of Z δk δk′ Z Mfk (s)Mfk′ (s)ds R k ′ =0 Mfk (s)Mfk′ (s)ds.  R Lemma 5.4. Under the assumptions of theorem 5.2, then N 2H− 12 N −1 X k=0 Proof. Again using the estimates of δk we have N 2H− 12 N −1 X k=0 δk2 ≤ N 2H− 21 4 = ΣN δk2 → 0 N −1  X k=0 −2H− 12 Σ2 (k + 1)2H−1 N 2H (5.17) 2 N 4H−1 3 1 as well as H < .  2 4 5.4. Simulation studies (time varying volatility). InRthis section we did simulation studies to see the difference between our actual parameter of interest R (M(σ(s)χ[0,1] ))2 ds and what we achieve θ̃N for sample size N, for different Hurst parameter with different σ(s) function. We have chosen different functions σ(t), necessarily bounded, on the interval [0, 1], calculate θ̃N and report the results. We take N = 1000 and compute θ̃N and θ and note the difference. Let us consider σ(t) a sub linear function of the form σ(t) = σtα , t ∈ (0, 1), 21 < H < 43 , σ > 0, 0 < α < 1. Next we consider functions of the form σ(t) = σ(tα + tβ ) for t ∈ (0, 1), 0 < α < 1 and β > 1, i.e. polynomial with positive fraction and integer powers. We note that θ̃N may not converge as N → ∞ and it will indeed not converges. So the simulation result is only for N = 1000. This proves the lemma for H > For practical purpose the sub linear functions seems best. 6. Conclusions In this paper we sketch the way to obtain the option price for fBm driven model with time varying volatility. We identify the parameter of interest for calculating option price. Next we have proposed estimator from high frequency data for parameter similar to so called ”integrated volatility”, in case of constant volatility and time varying volatility model driven by fBm. We have shown that estimators are asymptotically normally distributed for H < 34 . For time varying volatility model, the 15 Table 4. The comparison of θ̃N and θ H θ̃N θ H θ̃N θ σ=0.4, α = 0.3 0.55 0.65 0.74 0.1000039 0.1000005 0.09992656 0.09962605 0.09868432 0.09770835 σ=6.4, α = 0.3 0.55 0.65 0.74 25.60027 25.60061 25.6002 25.50445 25.2632 25.01328 Table 5. The comparison of θ̃N and θ H θ̃N θ H θ̃N θ σ=0.4, 0.55 0.1777476 0.1705813 σ=6.4, 0.55 45.50396 43.66903 α = 0.8, β = 2 0.65 0.74 0.1777324 0.1776835 0.1579971 0.1482963 α = 0.8, β = 2 0.65 0.74 45.50438 45.5041 40.44747 37.96394 estimator will not asymptotically unbiased for our parameter of interest. Through some simulation study we showed how close of the parameter of interest can be achieved by the estimators under consideration. 6.1. Future directions. (1) In all these we assume H as a known quantity. The estimation for H also exists separately. See Prakasa Rao (2010), Breton et al. (2009). Is there any way to combine? (2) Following Zhang et al (2005) we want to develop method of inferring volatility when the process is observed discretely with noise. (3) Following Barndorff-Nielsen and Shephard (2004) we want to consider estimators for jump process. 6.2. Comments. • Why consider fBM driven models? Non-stationary time series will also take care of thick-tails and long-range dependence in returns. But it is not easy to put them in an option pricing framework. • Why do we have confidence intervals for option prices, when looked at as solution of an optimization problem? There is uncertainty in utility/preferences. 7. Acknowledgement First author wants to acknowledge Department of Science and Technology, India, for financial support to conduct this research work. 8. Appendix 8.1. Wiener integral . Ω := S ′ (R), dual of the space of Schwartz class functions S, is tempered distributions with sigma algebra F . hω, f i is the random variable by action of ω ∈ Ω on f ∈ S(R). 1 2 Bochnor Minlos probability measure P on (Ω, F ) is such that E[exp ihω, f i] = e− 2 kf k , kf k2 = 16 Z R f 2 (x)dx. We also have expectation E[hω, f i] = 0 and variance E[hω, f i]2 = kf k2 under P . Let I(0, t) is indicator function. Then B̃t (ω) = hω, I(0, t)i ∈ L2 (P ) and B̃t is Gaussian random variable for each t. Using Kolmogorov’s continuity theorem B̃t has continuous version as Bt and Bt is standard 2 Brownian motion. Z This duality can be extended for f ∈ L (R) approximating f by step functions we get hω, f i = f (t)dBt (ω). R H H Let M(0, t) = MI(0, t) ∈ L2 (R). Z Then B̃t (ω) = hω, M(0, t)i. B̃t is Gaussian random variable 1 M(0, t)(x)M(0, s)(x)dx = (t2H + s2H − |t − s|2H ). Again take with E B̃tH = 0 and E B̃tH B̃sH = 2 R Z continuous version of B̃tH as BtH . So we get BtH = (MI(0, t)(s)dBs . R Let f ∈ L2H (R), deterministic. Then Mf ∈ L2 (R). The Wiener integral with respect to fractional Brownian motion is defined as Z Z H f (s)dBs = (Mf )(s)dBs (8.1) R R Take f ∈ S. Construct Bochnor MinlosZ probability measure P H on (Ω, F ) is such that E[exp ihω, f iH ] = 1 2 e− 2 kf kH , kf k2H = kf kL2H = kMf kL2 = R (Mf )2 (x)dx. We also have expectation E H [hω, f iH ] = 0 and variance E H [hω, f iH ]2 = kf k2H under P H . Let I(0, t) is indicator function. Then B̃tH (ω) = hω, I(0, t)iH ∈ L2 (P H ) and B̃tH is Gaussian random variable for each t. Using Kolmogorov’s continuity theorem B̃tH has continuous version as BtH and ZBtH is fractional Brownian motion. This duality can be extended for f ∈ L2H (R) we get hω, f iH = f (t)dBtH (ω). So, we note that the term R Z t H σs dBs appears in solution of the SDE (3.1) is a Wiener integral with respect to Brownian motion. 0 The first two moments of Wiener integral with respect to fractional Brownian motion are as follows Z E( f (s)dBsH ) = 0 R and Z E[ f (s)dBsH ]2 = kf kL2H = kMf kL2 R Z Z H E[ f (s)dBs g(s)dBsH ] = hf, giL2H R R 8.2. Wick product and related topics . This section consists of background material required for section 4. Chaos expansion Theorem Let X F ∈ L2 (P ). Then there exists a unique family cα , α ∈ I of constants, cα ∈ R such that F (ω) = cα Hα (ω), Hα is multi indexed Hermite polynomial of Bm α∈I X (convergence in L2 (P )). Moreover, we have the isometry E(F 2 ) = c2α α!. α∈I Let us define (S) as space of stochastic test functions and (S ∗ ) as space of stochastic distributions. X (S) is collection of all F ∈ L2 (P ) such that it’s expansion is F (ω) = cα Hα (ω) where kF k2k = X α α∈I α!c2α (2N)kα < ∞ for all integer k = 1, 2, · · · with (2N)kγ m Y = (2j)γj , γ = (γ1 , · · · , γm ) ∈ I. j=1 17 (S ∗ ) is collection of all G ∈ L2 (P ) such that it’s expansion is G(ω) = X β!c2β (2N)−qβ < ∞ for some integer q < ∞. β X β∈I cβ Hβ (ω) where kGk2q = (S ∗ ) is dual X of (S) with duality relation as follows: X If F (ω) = aα Hα (ω) ∈ (S) and G(ω) = bα Hα (ω) ∈ (S ∗ ) then action of G on F is α∈I α∈I X hG, F i(S ∗ ),(S) = α!aα bα . α∈I If L2 (P ) ⊂ (S ∗ ) and (S) ⊂ L2 (P ) then action of G on F is hG, F i(S ∗ ),(S) = hG, F iL2(P ) = E(GF ). X X If F (ω) = aα Hα (ω) ∈ (S ∗ ) and G(ω) = bβ Hβ (ω) ∈ (S ∗ ) then Wick product ⋄ is defined α∈I as (F ⋄ G)(ω) = X α,β∈I β∈I ∗ aα bβ Hα+β (ω) ∈ (S ). Fractional white noise WtH dBtH = is an element of (S ∗ ) see Elliott and Van der Hoek (2003), dt Biagini et al. (2004) for detail. Wick Ito Skorohod integral with respect to BtH : If Y : R → (S ∗ ) is such that Yt ⋄ WtH is integrable in (S ∗ ) then we define Z Z H Yt dBt = Yt ⋄ WtH dt. (8.2) R If f ∈ L2H (R) then Z f (s)dBsH R = R Z R f (s) ⋄ WsH ds = Z (Mf )(s)dBs . R 8.3. Background to deal with time varying volatility estimator . In this section we introduce some notations and established results which will be needed for our future calculation. Our fractional Brownian motion BtH is centered, continuous, mean zero Gaussian processes with covariance functions H as RB = cov(BsH , BtH ) = 12 [t2H + s2H − |t − s|2H ]. Let E be the set of real valued step functions. H For φP= I[0, t], ψ = I[0, s] ∈ EPlet us define inner P product hφ, ψiE = hI[0,s] , I[0,t] iE = RB . For H H H H φ = j aj I[0, tj ], set B (φ) = j aj Btj . Let ψ = j bj I[0, tj ]. So, E(B (φ)B (ψ)) = hφ, ψiE . Next for φ ∈ H, there are φn ∈ E such that φn → φ in H then B H (φ) is the L2 limit of B H (φn ). So we get hφ, ψiH = EB H (φ)B H (ψ). {B H (φ), φ ∈ H} is called isonormal Gaussian process. Let Hn be n th Hermite polynomial satisfying d Hn (x) = Hn−1 (x), n ≥ 1. dx (8.3) Take φ ∈ H such that kφkH = 1. Consider random variables Hn (B H (φ)) and take the closure of the span of these random variables. This is the n th order Wiener chaos Wn . In , the multiple stochastic (Wiener Ito) integral with respect to isonormal Gaussian process B H , 1 is a map from H⊙n to Wn , H⊙n being symmetric tensor product of H. H⊙n has norm √ k.kH⊗n , n! H⊗n is tensor product of H. Then for f ∈ H⊙n , we also have In (f ) = In (f˜), f˜ is symmetrization of f . For φ ∈ H, In (φ⊗n ) = n!Hn (I1 (φ)) = n!Hn (B H (φ)) is linear isometry between H⊙n and Wn . Now for f ∈ H⊙n and g ∈ H⊙m we have followings: E(In (f )Im (g)) = n!hf˜, g̃iH⊗n if m = n E(In (f )Im (g)) = 0 if m 6= n (8.4) (8.5) 18 Let {ei , i ≥ 1} be an orthonormal basis of H, m, n ≥ 1, r = 0, · · · , n ∧ m. f ⊗r g ∈ H⊗(m+n−2r) is contraction is defined as ∞ X (8.6) f ⊗r g = hf, ei1 ⊗ · · · ⊗ eir iH⊗r hg, ei1 ⊗ · · · ⊗ eir iH⊗r . i1,··· ,ir=1 This definition does not depend on the choice of orthonormal basis and hf, ei1 ⊗· · ·⊗eir iH⊗r ∈ H⊙(n−r) , ˜ r g is symmetrization hg, ei1 ⊗ · · · ⊗ eir iH⊗r ∈ H⊙(m−r) . f ⊗r g is not necessarily symmetric. Let f ⊗ of f ⊗r g. Then m∧n X nm ˜ r g). In (f )Im (g) = r! I (f ⊗ (8.7) r r n+m−2r r=0 Also for n = m = r we have I0 (f ⊗r g) = hf, giH⊗r . (8.8) H H 2 Let F be a functional of the isonormal Gaussian process B such that E(F (B ) ) < ∞ then thereX is unique sequence fn ∈ H⊙n and F can be written as sum of multiple stochastic integrals as F = In (fn ) with and I0 (f0 ) = E(F ) where the series converges in L2 n≥0 For φ1 , · · · , φn ∈ H, let F = g(B H (φ1 ), · · · , B H (φn )) with g smooth compactly supported. Then Malliavin derivative D is H valued random variable defined as follows: n X ∂g H DF = (B (φ1 ), · · · , B H (φn ))φi . (8.9) ∂x i i=1 If H is L2 (R) for some non atomic measure then DF can be identified as follows: DF = (Dt F )t∈R n X ∂g H Dt F = (B (φ1 ), · · · , B H (φn ))φi (t), t ∈ R ∂x i i=1 (8.10) If F = In (f ), f ∈ H⊙n , for every t ∈ R, then Dt F = Dt In (f ) = nIn−1 f (., t). (8.11) In−1 (f (., t)) means n − 1 multiple stochastic integral is taken with respect to first n − 1 variables t1 , · · · , tn−1 of f (t1 , · · · , tn−1 , t), t is kept fixed. For Malliavin calculus details, see Nualart (1995), Nourdin (2012). To prove asymptotic normality we will use the following two theorems [5.1] and [5.2] taken from Tudor C.A. (2008): Theorem 8.1. Let In (f ) be a multiple integral of order n ≥ 1 with respect to an isonormal process M. Then 1 d(L(In (f )), N (0, 1)) ≤ cn [E(|DIn (f )|2H − n)2 ] 2 where D is the Malliavin derivative with respect to B H and H is the canonical Hilbert space associated to B H . Here d can be any of the distances like Kolmogorov Smirnov distance, or total variation distance etc. and depending upon d and the order n one will end up a constant cn . L(B H ) stands for law of B H . Theorem 8.2. Fix n ≥ 2 and let (Fk , k > 1), Fk = In (fk ) (with fk ∈ H⊙n , for every k ≥ 1) be a sequence of square integrable random variables in the nth Wiener chaos of an isonormal process B H such that E[Fk2 ]2 → 1 as k → ∞. Then the following are equivalent: (i) The sequence (Fk )k≥0 converges in distribution to the normal law N (0, 1). (ii) One has E[Fk4 ] → 3 as k → ∞. (iii) For all 1 ≤ l ≤ n − 1 it holds that lim |fk ⊗l fk |H⊗2(n−l) = 0. (iv) |DFk |2H → n in L2 as k → ∞, where k→∞ D is the Malliavin derivative with respect to B H . The above theorems we will use to prove asymptotic normality for our proposed estimator. 19 References [1] Avellaneda, M., Levy, A. and Pars, A. (1995), “Pricing and hedging derivative securities in markets with uncertain volatilities” Applied Mathematical Finance, 2(2), 73-88. [2] Barndorff-Nielsen, O. E. and Shephard, N. (2004), “Power and Bipower Variation with Stochastic Volatility and Jumps”, Journal Of Financial Econometrics, 2 (1), 1-37. [3] Biagini, F., ksendal, B., Sulem, A. and Wallner, N. (2004), “An introduction to white-noise theory and Malliavin calculus for fractional Brownian motion”, Proc. Royal Society London, 460, 347-372. [4] Biagini, F., Hu,Y., Oksendal,B. and Zhang, T. (2008), “Stochastic Calculus for Fractional Brownian Motion and Applications , Springer. [5] Bjrk, T. and Hult, H. (2005), “A note on Wick products and the fractional Black-Scholes model”, Finance and Stochastics, 9(2), 197-209. [6] Breton, J. et al. (2009), “Exact confidence intervals for the Hurst parameter of a fractional Brownian motion”, Electronic Journal of Statistics 3, 416–425. [7] Cheridito, P. (2003), “Arbitrage in fractional Brownian motion models” Finance and Stochastics 7 (4), 533-553. [8] Cont, R. (2005), “Long range dependence in financial markets”, In J. Lvy-Vhel & E. Lutton (Eds.), Fractals in engineering: New trends in theory and applications (pp. 159-180): Springer [9] Elliott, R.J., van der Hoek, J. (2003), “A general White noise theory and applications to finance”, Mathematical Finance 13, 301330. [10] Guasoni, P. (2006), “No arbitrage under transaction costs, with fractional Brownian motion and beyond”, Mathematical Finance 16 (3), 569-582. [11] Mandelbrot, B. B. (1997), “Fractals and scaling in finance, discontinuity, concentration, risk”, Springer. [12] Mykland, P. A. (2000), “Conservative delta hedging”, Annals of Applied Probability, 10(2), 664-683. [13] Necula,C. (2008), “Option Pricing in a Fractional Brownian Motion Environment”, Advances in Economic and Financial Research - DOFIN Working Paper Series 2, Bucharest University of Economics, Center for Advanced Research in Finance and Banking - CARFIB. [14] Nourdin, I. (2008), “Asymptotic behavior of weighted quadratic and cubic variations of fractional brownian motion”, Annals of probability, 36(6), 2159-2175. [15] Nourdin, I. and Reveillac, A. (2009), “Asymptotic Behavior Of Weighted Quadratic Variations Of Fractional Brownian Motion: The Critical Case H = 1/4”, Annals of Probability, 37(6), 2200-2230. [16] Nourdin, I., (2012), “Selected aspects of fractional Brownian motion”, Springer. [17] Nualart, D., (1995), “Malliavin calculus and related topics”, Springer. [18] Prakasa Rao, B.L.S. (2010), “Statistical Inference for Fractional Diffusion Processes”, Wiley. [19] Rogers, L.C.G. (1997), ”Arbitrage with fractional Brownian motion”, Mathematical Finance, 7, 95-105. [20] Shiryaev, A. N. (1999), “Essentials of stochastic finance: facts, models, theory”, World Scientific. [21] Tudor, C. A., (2008), “Analysis of variance for self-similar processes”, Springer. [22] Xiao,W., Zhang, W. and Zhang, X. (2013), “Parameter identification for the discretely observed geometric fractional Brownian motion”, Journal of Statistical Computation and Simulation, 85(2), 269-283. [23] Zhang, L. et al. (2005), “A tale of two scales: determining integrated volatility with noisy high frequency data”, Journal of American Statistical Association , 100(472), 1394-1411.
10math.ST
Parallel Tempering for the planted clique problem Angelini Maria Chiara1 arXiv:1802.05903v1 [cond-mat.dis-nn] 16 Feb 2018 1 Dipartimento di Fisica, Ed. Marconi, ”Sapienza” Università di Roma, P.le A. Moro 2, 00185 Roma Italy The theoretical information threshold for the planted clique problem is 2 log2 (N ), however no polynomial algorithm is known to recover a planted clique of size O(N 1/2−ǫ ), ǫ > 0. In this paper we will apply a standard method for the analysis of disordered models, the Parallel-Tempering (PT) algorithm, to the clique problem, showing numerically that its time-scaling in the hard region is indeed polynomial for the analyzed sizes. We also apply PT to a different but connected model, the Sparse Planted Independent Set problem. In this situation thresholds should be sharper and finite size corrections should be less important. Also in this case PT shows a polynomial scaling in the hard region for the recovery. 2 The planted clique problem is the following [1]: we extract a random graph with N nodes, each node is connected to another one with probability p. Then, we plant a clique C, imposing K nodes among the N ones to be connected to each other with probability q = 1. Given the resulting graph, we search for an algorithm able to identify the elements of the planted clique. The problem can be studied for all the values of the probabilities p and q, but in the following we will focus on the values p = 12 , q = 1. Given a random graph with probability p = 12 to have a link between two nodes, one can easily show that the largest purely random clique is of size Kran ≃ 2 · log2 (N ) for N large [2]. As a consequence, an exhaustive search for a clique of size K returns the planted clique if K > Kran . However, it has long been conjectured that no polynomial-time algorithm can find cliques of size N 1/2−ǫ , ǫ > 0. In Ref. [3] this has been proved for the class of sum-of-squares algorithms. In Ref. [4], a message passing algorithm has been constructed that q fails unless K > KBP = Ne . In Ref. [5], an analogous gap between the threshold for exhaustive and polynomial algorithms has been found in the sparse clique problem. In this case, it is shown how the problem undergoes two phase transitions: the first one is a dynamical one, and below that threshold no local algorithm is able to find the planted clique. The second transition is a static transition that identifies the threshold for exhaustive search. The existence of such kind of gaps is common in recovery problems, however the clique problem is in a certain manner special because for this problem the two thresholds scale differently with N . Some recent works prove hardness in other problems assuming the hardness of planted clique (in the corresponding region) [6],[7],[8],[9]. For this reason, there is a lot of current interest in the planted clique problem. In the first part of this paper we will show that also in this dense limit, the clique problem undergoes a static and a dynamic phase transition, as demonstrated in [5] in the sparse case. Then applying standard methods for the analysis of disordered models, and in particular a Parallel Tempering (PT) algorithm, we will see how to find the planted clique down to Kran . The thermal algorithms are not easy to be analyzed: in particular, the challenge is to understand how the time of convergence scales with N . We show that data from PT are in very good agreement with a polynomial scaling. However, for the clique problem an exhaustive search algorithm can find the planted clique of size K > 2 log2 (N ) in a time O(exp(c log2 (N ))): It is sufficient to find a clique of size k0 = 2 log2 (N ), that takes a time kN0 and then to expand starting from that one. Thus it is quite difficult to distinguish between a polynomial or a non-polynomial O(exp(c log2 (N ))) behavior. For this reason, in the second part of this paper we move to a different but connected model: the planted Independent Set (IS) model. Being this problem sparse, the thresholds are sharper: the exhaustive algorithm can find solutions in time O(exp(N )). For this problem in the hard region we numerically show that for the analyzed sizes the PT algorithm can find solutions in polynomial time. This gives good reasons to believe that also in the case of the planted clique problem the PT algorithm finds solutions in polynomial time. To be concrete, we construct a graph of N nodes with a planted clique C of size K. On each node there is a variable vi , vi = 1 if node i ∈ C, vi = 0 if node i ∈ / C. On each edge between nodes i and j we put a variable Aij . The edge variables are 0 or 1 with the following probabilities: ( 1 if vi vj = 1 (1) p(Aij = 1|{v}) = 1 otherwise 2 Given a realization of the graph we want to estimate the variables vi . We will call our estimation xi . We introduce a Belief-Propagation (BP) algorithm that is essentially the one proposed in ref. [4]. Following the Bayes formula, the posterior probability for xi given the graph is P (xi |{Aij }) = P (Aij |{xi })P (xi ), (2) where the likelihood P (Aij |{xi }) is the one of eq. (1) and P (x) is the prior probability. The original problem has a global constraint on the size of the clique to be recovered (we are treating the case of known K): P ({x}) should P be zero if i xi 6= K. However we are using local algorithms, that cannot implement global constraints. Thus we x 1−x 1− K . The BP algorithm is a way to extract the marginal choose a local prior on the single node: P (x) = K N N probabilities for each node from Eq. (2). We introduce cavity messages ψi→j (xi ) proportional to the probability that node i takes value xi , conditioned on the absence of edge (ij). Iterative equations on the messages read: 3  N −1 N −K 1 ψi→j (xi = 0) = N 2  N −1 Y K 1 ψi→j (xi = 1) = [1 + (2Aij − 1)ψk→i (1)] N 2 k\j ψ (x ) i Cavity probabilities are obtained from the normalization of the cavity messages: ηi→j (xi ) = i→j zi→j , with zi→j = ψi→j (0) + ψi→j (1). Once the iteration of the cavity messages has reached a fixed point, marginal probabilities are obtained as:  N N −K 1 N 2  N Y K 1 ψi (xi = 1) = [1 + (2Aij − 1)ψk→i (1)] N 2 ψi (xi = 0) = (3) (4) k ηi (xi ) = ψiz(xi i ) , with zi = ψi (0) + ψi (1). i hP P − N1 ij log(zij ) , with zij = i log(zi ) − The Bethe free energy associated to the reached solution is f = zi zi→j . We then assume the elements of the clique to be the first K p elements with largest ηi (1). In the thermodynamic limit the recovery is possible if K > KBP = N/e [4]. Let us emphasize the difference in the Fixed Point of BP when the algorithm finds and does not find the planted clique: If the planted clique is recovered, the BP messages are completely polarized: ηi (1) = 0 (if i ∈ / C) or ηi (1) = 1 (if i ∈ C). If the planted clique is not recovered, messages that are not completely polarized: ηi (1) = ηi∗ (1) 6= 0, 1 ∀i. We will call this solution the paramagnetic solution. First of all, we study the stability of the planted solution. To do this, we initialize the BP messages near enough to the planted solution and we look to the solution reached after iteration. The planted solution is reached well below the threshold Kran = 2 · log2 (N ), until the threshold Ksp ≃ 1.3 · log2 (N ) (computed up to N = 10000): We know that there exist other random cliques of size K ≤ Kran , however for Ksp < K < Kran the planted solution is still locally stable under small perturbations: Speaking in terms of the free energy, the planted solution represents a local minimum, well separated from the paramagnetic one. In the statistical physics language, Ksp corresponds to the spinodal point for the existence of the planted solution. Below the spinodal of the planted solution, in general the recovery in the non-planted ensemble is easy [11]. This should imply that for K < Ksp there should exist a polynomial algorithm able to find a random clique of size K. However, the threshold for the polynomial algorithms in the non-planted case is believed to be KKarp = log(N ) in the large N limit [10]. Whether the difference between Ksp and KKarp is just due to finite size effects or has a deeper meaning should be better analyzed and will be the subject of a subsequent work. Then, we compare the Bethe free energy fplan and fran of the solutions found respectively from planted and random initialization. We name as Ks the threshold at which fran = fplan ; it corresponds to a static phase transition, at which the global minimum of the free energy changes from the planted to the paramagnetic solution. For large N , it is known that Ks = 2 log2 (N ) [12]. Finite size corrections however are huge and for finite N , Ks (N ) is quite different from its large N limit: Ks (10000) ≃ 1.6 log2 (N ). The values found for Ks (N ) are in good agreement with the finite size estimate for the largest size kmax (N ) of a random clique in a random graph of size N . kmax (N ) can be obtained by the following probabilistic argument: The expected number of cliques of size k in an E-R graph of size N with  (k) 2 . We define k bonds present with probability p is given by E(N, k) = N max (N ) as the largest integer k for which k p E(N, k) > 1. The largest naturally occurring clique is shown to have with high probability size kmax or kmax + 1 in graphs with N large [13–15]. Summarizing: • For K > KBP there is just one minimum of the free energy, that is the one corresponding to the planted clique, found by randomly initialized BP. We will call this phase an easy phase for the recovery. • For Ks < K < KBP there are two local minima of f : the global one corresponds to the planted clique, and it is reached by BP with planted initialization; the other local minimum corresponds to a paramagnetic solution, that is the one where BP stops if randomly initialized. If we know how to nucleate the planted solution, it is still possible to find it. We will call this phase a hard phase. 4 • For Ksp < K < Ks the planted solution is still a local minimum of the free energy, that can be found if BP is initialized around the planted solution. However, the global minimum of f is the paramagnetic one. This phase corresponds to an impossible phase. • For K < Ksp the number of random cliques is large and the planted solution is no more stable, it is no more a minimum of the free energy: even starting near to the planted solution, the algorithm will flow to the unique paramagnetic minimum. A similar analysis was performed in ref. [16] for the so-called stochastic block model and in Ref. [5] for the problem of finding a highly connected subset of vertices in a sparse graph. From the results p of ref. [5], the dynamical threshold associated with the failure of BP in the sparse case is shown to reduce to K = N/e in the dense planted √ clique case, while the thresholds associated with the static and the spinodal phase transition are located at K ∗ = o( N ) in the dense limit. In statistical physics such a situation is called a first order transition: there are two competing minima of f ; varying the parameters of the problem, the global one changes from one to another. Such a situation is present in other recovery problems, a well-known example is the compressed sensing [18]. We will now look to the statistical mechanical model constructed introducing a Hamiltonian associated to the Bayes probability for the clique problem, following an approach similar to ref. [17]. In statistical physics, the appearance of metastable minima is encountered in a large number of problems. In these cases, the more efficient algorithm for the research of the true minimum is the so-called Parallel Tempering (PT) [19], that we will apply to the clique problem. We define an Hamiltonian associated to the posterior probability of eq. (2) as: P ({x}|{A}) ≡ e−βH , where the Hamiltonian has the form: H({x}) = − X log(P (xi ))+ i −  X (1 + xi xj ) (1 − xi xj ) + Aij log (1 − Aij ) log 2 2 ij The energy assumes the value H = ∞ if Aij = 0 and xi xj = 1, preventing from having configurations without links between two elements of a clique. We have introduced an additional parameter, the inverse temperature β = T1 , that takes the value β = 1 in the original problem. Given a realization of the graph {A}, we introduce n = 19 replicas of the system with the same graph, each replica i is at a different inverse temperature: βi = 1 − i · 0.05, i ∈ [0, 18]. The i = 0 replica is the original system. For each replica we perform a standard Metropolis Monte Carlo (MC) simulation. After 5 MC steps for each replica, we try to flip the configuration of the i-th and (i + 1)-th replicas with probability   p = min 1, e(βi −βi+1 )(Ei −Ei+1 ) , (5) where Ei is the P actual energy value of the i-th replica. We then measure the magnetization M of the original replica i = 0: M ≡ j xj . When M = K we stop our simulation, having identified the planted clique. If K < KBP , the original system will be firstly attracted to the secondary minimum of the free energy and should overcome a barrier to reach the true minimum. However at β < 1, this barrier lowers or eventually it disappears. Replicas at higher temperature are free to explore a larger part of the phase space in less time. Flipping replicas thus permits to the original system to reach the true minimum in a smaller time. Being the system fully connected, one could naively think that the MC algorithm takes O(N 2 ) time: an iteration step is intended as the attempt to flip each of the N variables, and the computation of the new energy is of order O(N ). However, the proposal to flip a spin is accepted only O(K) times, because if xi = 0 and we propose to flip it, the flip is accepted only if Aij = 1 for all spins j with xj = 1, while if xi = 1 it is always possible to flip it. The whole algorithm thus is O(K · N ). In Ref. [5] it is stated that no local algorithm can find the planted solution for K < KBP . PT is not local because of the flipping procedure between replicas. It finds the planted solution for K > Ks . As in all first-order phase transitions, the time for convergence is diverging at the static transition point Ks . The time of convergence seems to diverge as Nν t(N, K) ∝ ((K−Ks )/ log2 (N ))a , as shown in Fig. 1. The value for the exponents are ν = 5.78(4), a = 3.64(12). In the right part of fig. 1 we show the collapse of the data for the convergence time as a function of K for different sizes N once the proper scaling variables are used. Summarizing, the time of convergence grows as a power law with N and diverges with a power law at the static threshold Ks . The value for the critical exponents a and ν is not optimal. In fact, the parameters of PT (number of replicas, spacing in temperature...) can be modified leading probably to a changing in the exponents. However our purpose is not to optimize the PT but only to show that it is indeed a polynomial algorithm. For the clique problem, an exhaustive search algorithm can find the planted clique in a time O(exp(c log2 (N ))). Even if we showed that the collapse of the data with a polynomial scaling is very good, one could always criticize that the analyzed sizes are too small to capture the difference between a polynomial and 5 1e+12 1000 a b/(x-x0) N=2000 N=3000 N=4000 N=5000 1e+11 1e+10 100 t ν t/(bN ) 1e+09 1e+08 1e+07 1e+06 N=5000 N=4000 N=3000 N=2000 10 1 0.1 100000 10000 0.01 1.6 1.8 2 2.2 2.4 2.6 2.8 K/log2(N) 3 3.2 3.4 3.6 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 (K-Ks)/log2(N) 2 FIG. 1: Left: Time of convergence for PT changing the size K of the planted clique, and the size of the graph. Each point is the average over 20 realizations of the graph. The time of convergence diverges as a power-law at Ks . Right: Collapse of data for the convergence time once proper rescaled variables are used. The time of convergence grows as a power law with N . an exponential O(exp(c log2 (N ))) behavior. For this reason, now we move to a different but connected model: the planted Independent Set model. Being this problem sparse, the thresholds are sharper. We will show that also for this problem in the hard region the scaling of the PT time to find solutions is well-fitted by a power-law for the analyzed sizes. This gives indications to believe that also in the case of the planted clique problem the PT algorithm really finds solutions in polynomial time. An Independent Set (IS) is a subset of vertices of a graph that are not connected. It is clear that a clique becomes an Independent Set on the complementar graph. The IS problem can be safely defined on a sparse graph of degree d. We define the density of the IS ρ = K N . For d > 30, one can show that the paramagnetic solution of the BP equations to find a random IS of size ρ is stable up to density ρl (d) well above the density ρmax (d) of the largest random IS [21]. This means that if we study the planted problem, we expect the existence of a region in the density of the planted IS ρmax (d) < ρ(d) < ρl (d) where it will be hard to find the planted IS even if we are above the theoretical threshold for the recovery: We are in a situation analogous to the case of the planted clique of size Ks < K < KBP . The thresholds for the IS problem as a function of d has been computed in ref. [21]. To be concrete, we plant a IS I of size K on a graph of size N with average degree d in the following way: we extract link Aij = 1 between nodes i, j ∈ / I with probability cin , and links between i ∈ I, j ∈ / I with probability cout . We do not put links between i, j ∈ I. Imposing that all elements have average degree d (in this way a generic d algorithm cannot classify elements on the basis of their degree), we find cin = Nd(1−2ρ) (1−ρ)2 , cout = N (1−ρ) . The thresholds, in this case, are slightly different from the ones in ref. [21] that were for graphs of fixed degree, however the behavior is the same. We restrict ourselves to the case of average degree d = 40. In this case, for fixed degree, following ref. [21], the thresholds are ρl (40) = 0.138, ρmax (40) = 0.1273, ρs (40) = 0.1231. We write the BP equations following the same reasoning of the ones for the clique problem, practically the equations are those in Eqs. (26),(27) of ref. [16] for the general case of clustering. We numerically extract the threshold ρl as the limit for the convergence of the BP equations to the planted solution once they are randomly initialized: ρl (40) = 0.135(1). Analogously to the clique problem, we identify the static transition as the threshold at which the free energy of the planted solution, reached by BP initialized near enough to the planted solution, is equal to the free energy of the paramagnetic solution, reached by randomly initialized BP, finding ρs (40) = 0.1218. Please note that in the case of sparse IS the static threshold ρs does not corresponds to the threshold ρmax for the maximal density of random IS, as in the clique problem. We have that ρs < ρmax . Even if for ρs < ρ < ρmax there exist random ISs, in this region the planted IS dominates the measure and can be reconstructed. In the limit of d → ∞, ρmax = ρs [21], as happens for the clique problem. Having identified the important transitions, we run PT in the hard region for the recovery of the planted solution. As for the clique problem, we write the Hamiltonian associated to the posterior Bayes probability that is essentially the one in Eq. (8) of ref. [16]. A MC step takes time O(dN ). We introduce n replicas at different inverse temperatures β: βi = 1 − i · 0.02, i ∈ [0, 18]. We run PT at two different densities: ρ = 0.14 that is in the easy phase, and ρ = 0.13 that is in the hard phase for the reconstruction of the planted solution. PT succeeds to find the planted solution, and 6 1e+07 1e+08 b ax ρ=0.13 ρ=0.14 1e+07 PT steps PT steps 1e+06 100000 10000 b ax ρ=0.13 ρ=0.14 1e+06 100000 10000 1000 1000 1000 10000 N 1000 10000 N FIG. 2: Average time of convergence (left) and 90th percentile time of convergence (right) for PT changing N for d = 40 and planted IS of density ρ = 0.13 and ρ = 0.14. Times grow as a power-law with N . Each point is the average over ∼ 103 − 104 realization of the graph. the times are reported in Fig. 2 as a function of N . For both ρ = 0.13 and ρ = 0.14 we have tried to fit data both with a polynomial f (x) = axb and an exponential function g(x) = c exp(dx). In both cases, the exponential fit has to be excluded, while times are well fitted with a polynomial growth. The best-fit parameters for the exponent b are: b(ρ = 0.14) = 2.5(1), b(ρ = 0.13) = 3.15(9). Also the time of convergence of the 90% of samples grows as a power-law with N (see Fig. 2). Concluding, we have applied a standard method for the analysis of disordered models in statistical physics, the Parallel Tempering algorithm, to the planted clique problem. The performances are quite surprising: it succeeds in finding the planted solution down to the information Theoretical threshold in a time numerically compatible with a power-law in the size of the system. Moving to the planted IS sparse problem, that should be harder because thresholds become sharper, the performances of PT still remains really good, succeeding in finding the correct solution in the hard region in polynomial time. The PT algorithm is a non-local algorithm because replicas of the system at different effective temperatures are flipped during the simulation. When looking to the associated statistical mechanical problem, the hardness of the planted clique or planted IS problems relies on the presence of an extensive barrier in the free energy landscape between the correct planted solution and a wrong paramagnetic solution. However, when the temperature is added, this barrier can become smaller and eventually disappears. For this reason, in the PT algorithm, replicas at higher temperature can explore rapidly a larger space of configurations preventing from being trapped by the paramagnetic solution. This paper just shows numerical evidence that there could exist a polynomial algorithm for the clique problem and related problems. A crucial point in the PT algorithm is the choice of the number of replicas that should satisfy two important properties: • The β associated to the last replica should be low enough to allow the system to explore the whole phase space, without trapping barriers. • The spacing in β should be not so large: in this way, the difference in the energy associated to two near replicas could be small enough to permit the flipping with a non-null probability in Eq. (5). For the analyzed sizes we have seen that n = 19 is a good number to have both these properties. One could criticize that n could grow with N . It could be possible, however for the analyzed sizes n ≃ O(log(N )), that will, however, lead to a polynomial scaling for the time of convergence of the algorithm. An analytical study of the performance of thermic algorithms is quite difficult. However, we think it could be of crucial importance for the determination of the real scaling of PT, and its application also for other optimization problems. The application of PT algorithm to the largest clique (and largest IS) problem on a Random Regular Graph is currently under study. I thank Andrea Montanari for introducing me to the planted clique problem and for the suggestion to look at the sparse Independent Set problem. I thank also Scott Kirkpatrick, Raffaele Marino, Federico Ricci-Tersenghi for very interesting discussions. 7 [1] M. Jerrum, Random Struct. Algorithms 3 (1992) p.347. [2] Geoffrey R Grimmett and Colin JH McDiarmid,On coloring random graphs, Mathematical Proceedings of the Cambridge Philosophical Society, vol. 77, Cambridge Univ. Press, 313–324 (1975). [3] Barak, Boaz, et al. ”A nearly tight sum-of-squares lower bound for the planted clique problem.” Foundations of Computer Science (FOCS), 2016 IEEE 57th Annual Symposium on. IEEE, p 2016. [4] Y. Deshpande, A. Montanari, ”Finding hidden cliques of size N/e in nearly linear time.” Foundations of Computational Mathematics 15.4 (2015): 1069-1128. [5] A. Montanari, J. Stat. Phys. 161, 273 (2015). [6] Q. Berthet and P. Rigollet, arXiv preprint, arXiv:1304.0828 (2013). [7] Bruce E. Hajek, Yihong Wu, and Jiaming Xu. Computational lower bounds for community detection on random graphs. In COLT, 899–928, (2015). [8] Z. Ma and Y. Wu, Ann. Stat. 43 (2015) p.1089. [9] T.T. Cai, T. Liang and A. Rakhlin, Ann. Statist. 45, 1403 (2017). [10] Karp, ”Probabilistic Analysis of Some Combinatorial Search Problems.”, in Algorithms and Complexity: New Directions and Recent Results, Academic Press, NY 1976. [11] Florent Krzakala and Lenka Zdeborova, PRL 102, 238701 (2009). [12] Arias-Castro, Ery, and Nicolas Verzelen. ”Community detection in dense random networks.” The Annals of Statistics 42.3 (2014): 940-969. [13] D. Matula, On the complete subgraphs of a random graph, Combinatory Mathematics and its. Applications (Chapel Hill, 1970) 356–369 [14] D. W. Matula. The largest clique size in a random graph. Technical report, Department of Computer Science, Southern Methodist University, 1976 [15] B. Bollobas and P. Erdos, Cliques in random graphs, Math. Proc. Camb. Phil. Soc. 80, 419 (1976). [16] Decelle, A., Krzakala, F., Moore, C., Zdeborová, L., Asymptotic analysis of the stochastic block model for modular networks and its algorithmic applications. Phys. Rev. E 84(6), 066106 (2011). [17] D. Hu, P. Ronhovde and Z. Nussinov, Philosophical Magazine 92, 406 (2012). [18] F. Krzakala, M. Mézard, F. Sausset, Y. Sun, L. Zdeborová, Phys. Rev. X 2, 021005 (2012). [19] K. Hukushima and K. Nemoto, J. Phys. Soc. Jpn. 65, 1604 (1996). [20] A. Braunstein, R. Zecchina, Phys. Rev. Lett. 96, 030201 (2006). [21] J. Barbier, F. Krzakala, L. Zdeborova, and P. Zhang, The hard-core model on random graphs revisited, J. Phys.: Conf. Series 473, 012021 (2013)
8cs.DS
Compositional Invariant Generation via Linear Recurrence Analysis arXiv:1502.00138v1 [cs.PL] 31 Jan 2015 Azadeh Farzan and Zachary Kincaid University of Toronto Abstract. This paper presents a new method for automatically generating numerical invariants for imperative programs. Given a program, our procedure computes a binary input/output relation on program states which over-approximates the behaviour of the program. It is compositional in the sense that it operates by decomposing the program into parts, computing an abstract meaning of each part, and then composing the meanings. Our method for approximating loop behaviour is based on first approximating the meaning of the loop body, extracting recurrence relations from that approximation, and then using the closed forms to approximate the loop. Our experiments demonstrate that on verification tasks, our method is competitive with leading invariant generation and verification tools. 1 Introduction Compositional program analyses operate by decomposing a program into parts, computing an abstract meaning of each part, and then composing the meanings. Compositional analyses have a number of desirable properties, including scalability, parallelizability, and applicability to incomplete programs. However, compositionality comes with a price: since each program fragment is analyzed independently of its context, the analysis cannot benefit from contextual information. This paper presents a compositional method for numerical invariant generation which, despite loss of contextual information, compares favourably with leading (non-compositional) verification techniques. The analysis proposed in this paper aims to compute a transition relation which over-approximates the behaviour of a given program. The use of transition relations in compositional analysis (e.g., [23,25,1,21,17,5]) stems from the fact that they can be composed: for example, consider a program P = P1 ; P2 which consists of two sub-programs P1 and P2 which are executed in sequence. A transition invariant JP K for P can be computed by computing transition invariants JP1 K and JP2 K for the subprograms and then taking JP K to be the relational composition: JP K = {(s, s′′ ) : ∃s′ .(s, s′ ) ∈ JP1 K ∧ (s′ , s′′ ) ∈ JP2 K}. A crucial question is how to compute abstractions of loops (i.e., loop summaries [17]). Our analysis is based on a classical idea: find recurrence relations for variables modified in the body of a loop, and then use the closed forms for these recurrences as the abstraction of the loop. The focus of research on recurrence analysis has mainly been on computing the exact behaviour of a (necessarily) limited class loops, e.g. loops where the body is a sequence of affine assignments (see Section 6 for a discussion of related literature). We shift the goal to computing over-approximate behaviour of arbitrary loops. The main novelty of our approach is to make synergistic use of recurrence analysis and compositionality: on one hand, recurrence analysis can be used to compute accurate transition formulas for loops; on the other hand, transition formulas for loop bodies can be mined for recurrence relations to enable recurrence analysis. Compositionality enables using recurrence analysis for arbitrary loops in two ways. First, the fact that the transition formula for a loop is computed from a transition formula for its body makes the control structure of the loop irrelevant (e.g., whether it is a sequence of assignments or contains branching or nested loops – its transition formula is just a formula). Second, having access to a loop body formula when computing a loop summary opens the door to using Satisfiability Modulo Theories (SMT) solvers to extract a broad range semantic recurrences. In particular, our analysis is able to exploit approximate recurrences (inequations over linear terms) to compute interesting loop invariants even for variables which do not satisfy recurrence equations in the classical sense, thus extending the applicability of recurrence-based invariant generation and overcoming a major barrier in its practical use. In summary, this paper presents a compositional method for generating numerical invariants (polynomial inequalities of unbounded degree among integer and rational variables) for programs. The main technical contributions are as follows. 1. We give a method for computing abstractions of loops using summaries for their bodies. This allows our analysis to apply to arbitrary code (with nested loops, unstructured loops, and arbitrary branching). It also makes it possible to use SMT solvers to extract semantic recurrence relations rather than syntactic recurrences obtained by pattern-matching source code. 2. We identify a class recurrence (in)equations that can be efficiently extracted from loop bodies using SMT solving technology and solved using simple linear algebra. 3. We give a linearization algorithm which enables tractable (but necessarily approximate) reasoning about non-linear formulas over rationals and integers (Section 4). 4. We collect ideas from a diverse range of sources (including algebraic program analysis [10], recurrence analysis [1,15,2], linearization [20], and symbolic abstraction [26,22,19]), and synthesize them into a cohesive presentation which can be used as a foundation for futher research on recurrence analysis. We implemented linear recurrence analysis and used it to verify assertions for a suite of benchmarks. Linear recurrence analysis is able to prove the correctness of more benchmarks in this suite than any of the leading verification tools for integer programs. r := x // remainder q := 0 // quotient while(r >= y): // subtract y from r t := y while(t != 0) r := r - 1 t := t - 1 q := q + 1 assert(x = q*y + r) v entry r := x v1 q := 0 v2 [r < y] assert(x = q*y+r) v exit q := q + 1 [r >= y] v3 v8 t := y v4 [t != 0] v7 [t = 0] t := t - 1 v5 v6 r := r - 1 (a) Program text (b) Flow graph Fig. 1. An integer division program, computing a quotient and remainder. Statements of the form [ψ] represent assumptions; i.e., statements which block if ψ does not hold. 2 Overview We will adopt a simple intraprocedural model in which a program is represented by a control flow automaton (CFA) where edges are labeled by program statements. Figure 1 depicts such a CFA for a program which computes the quotient and remainder of division of a variable x by a variable y. We use this model for the sake of simplicity and to help keep the presentation of our analysis short and self-contained. We hope that the basic idea behind the extension to procedures (implemented in the tool), using the analysis to compute procedure summaries [29], is clear without formal explanation. Our analysis, linear recurrence analysis (LRA), is presented in the algebraic framework described in [10]. Suppose that we wish to prove that the assertion assert(x = q*y + r) always succeeds. We begin by computing the set of paths from v entry to v8 (the location corresponding to the assert statement in the CFA). This set of paths is represented by a path expression for the vertex v8 , which is a regular expression over an alphabet of control flow edges. In principle, this can be accomplished by Kleene’s well-known algorithm for converting a finite automaton into a regular expression [14] (but more efficient algorithms exist [30]). For example, the following is a path expression for v8 : Inner loop hv entry z }| { ∗ , v1 i·hv1 , v2 i· hv2 , v3 i·hv3 , v4 i· (hv4 , v5 i·hv5 , v6 i·hv6 , v4 i)∗ ·hv4 , v7 i·hv7 , v2 i ·hv2 , v8 i | {z } Outer loop Once we have a path expression representing the paths to v8 , we compute an over-approximation of the executions to v8 by evaluating the path expression in some abstract domain. The main benefit of this algebraic framework is that an analysis is defined simply by providing an interpretation for each of the regular expression operators (sequencing, choice, and iteration, corresponding to the control structures of structured programs), and then we may rely on a path expression algorithm ([14,30]) to efficiently “lift” the analysis to programs with arbitrary control flow. Formally, a program analysis (in the framework of [10]) is defined by an interpretation, which consists of a semantic algebra and a semantic function. A semantic algebra consists of a universe which defines the space of possible program meanings, and sequencing, choice, and iteration operators, which define how to compose program meanings. A semantic function is a mapping from control flow edges to elements of the universe which defines the meaning of each control flow edge. A path expression is evaluated by interpreting the individual edges using the semantic function, and interpreting the regular expression operators using the corresponding operators of the semantic algebra (to compose the interpretations of individual edges into interpretations of sets of program paths). Keeping this overall algorithm in mind, we proceed to describe the interpretation which defines linear recurrence analysis. LRA Universe. The semantic universe of LRA (i.e., the space of program meanings) is the set of (not necessarily linear) arithmetic transition formulas. If we let Var denote the set of program variables and Var′ the set of “primed” copies of program variables, then a transition formula is an arithmetic formula with free variables in Var ∪ Var′ . Such a formula represents an input/output relation between program states. LRA Semantic Function. The semantic function J·K is a function that maps each edge of a control flow automaton to its interpretation as a transition formula. For example (again, considering Figure 1), we have Jhv entry , v1 iK = r′ = x ∧ stable({q, t, x, y}) Jhv1 , v2 iK = q ′ = 0 ∧ stable({r, t, x, y}) Jhv2 , v3 iK = r > y ∧ stable({q, r, t, x, y}) V ′ where for X ⊆ Var, we have stable(X) , x∈X x = x ; we use this to factor out equalities from the formulas and make them more legible. Boxes around formulas have no meaning, and are used only to make it easier to distinguish between equalities in formulas and the meta-language. LRA Operators. The sequencing and choice operators of our analysis are defined as follows: ϕ ⊙ ψ = ∃x′′ .ϕ[x′′ /x′ ] ∧ ψ[x′′ /x] Sequencing ϕ⊕ψ =ϕ∨ψ Choice (where ϕ[x′′ /x′ ] denotes ϕ with each primed variable x′ replaced by its doubleprimed counterpart x′′ , and ψ[x′′ /x] similarly replaces unprimed variables with double-primed variables). The semantic function, sequencing, and choice operators are sufficient to analyze loop-free code. For example, we may consider how LRA computes a transition invariant for the body of the inner loop of Figure 1: Jhv4 , v5 i · hv5 , v6 iK = Jhv4 , v5 iK ⊙ Jhv5 , v6 iK = t > 0 ∧ r′ = r − 1 ∧ stable({q, t, x, y}) Jhv4 , v5 i · hv5 , v6 i · hv6 , v4 iK = Jhv4 , v5 i·hv5 , v6 iK ⊙ Jhv6 , v4 iK = t > 0 ∧ r′ = r − 1 ∧ t′ = t − 1 ∧ stable({q, x, y}) The final step in describing our analysis is to provide a definition of the iteration operator (⍟) of LRA. The idea behind the definition of the iteration operator is to use an SMT solver to extract recurrence relations from the loop body, and then use the closed form of these recurrences for the abstraction of the loop. We explain this in detail in Section 3. Here, we illustrate how LRA works on the running example to provide some intuition on the analysis. After computing a formula ϕinner representing Recurrence Closed form the body of the inner loop (as given above), we r′ = r − 1 r(k) = r(0) − k apply the iteration operator ⍟ to compute a for- t′ = t − 1 t(k) = t(0) − k mula representing any number of executions of the inner loop. The iteration operator begins by extracting the recurrence equations shown to the right. It then computes closed forms for these recurrences, also shown to the right (where x(k) denotes the value that the variable x takes on the kth iteration of the loop). Note that this table omits “uninteresting” recurrences (such as q ′ = q + 0) which indicate that a variable does not change in a loop. These closed forms are used to abstract the loop as follows: ′ ′ ϕ⍟ inner = ∃k.k ≥ 0 ∧ r = r − k ∧ t = t − k ∧ stable({q, x, y}) = r′ = r + t′ − t ∧ t′ ≤ t ∧ stable({q, x, y}) We may use this summary ϕ⍟ inner for the inner loop to compute a transition formula representing the body of the outer loop: ϕouter = Jhv2 , v3 iK ⊙ Jhv3 , v4 iK ⊙ ϕ⍟ inner ⊙ Jhv4 , v7 iK ⊙ Jhv7 , v2 iK = q ′ = q + 1 ∧ r′ = r + t′ − y ∧ t′ = 0 ∧ r ≥ y ∧ stable({x, y}) We then apply the iteration operator to Recurrence Closed form compute a transition formula for the outer q ′ = q + 1 q (k) = q (0) + k loop. The recurrences found for the outer loop r′ = r − y r(k) = r(0) − y (0) k and their closed forms are shown to the right (again, with “uninteresting” recurrences omitted). We note that our algorithm extracts these recurrences from ϕouter using only semantic operations: the fact that ϕouter is an abstraction of a looping computation is completely transparent to the analysis. Using the closed forms of the recurrences to the right, we compute the following transition formula for the outer loop: ′ ′ ϕ⍟ outer = ∃k.k ≥ 0 ∧ q = q + k ∧ r = r − ky ∧ stable({x, y}) = q ′ ≥ q ∧ r′ = r − (q ′ − q)y ∧ stable({x, y}) Finally, we compute a transition formula which approximates all executions which end at v8 as follows: ϕP = Jhv entry , v1 i · hv1 , v2 iK ⊙ ϕ⍟ outer ⊙ Jhv2 , v8 iK = q ′ ≥ 0 ∧ r′ = x − q ′ y ∧ r ≤ y ∧ stable({x, y}) This formula is strong enough to imply that assertion x′ = q ′ ∗ y ′ + r′ holds at v8 . This is particularly interesting because it requires proving a non-linear transition invariant for the loop, which is out of scope for many state-of-the-art program analyzers. 3 Abstracting Loops with Linear Recurrence Analysis In this section, we describe the iteration operator of linear recurrence analysis. Suppose that we have a formula ϕbody which approximates the behaviour of the body of a loop. Our goal is to compute a formula ϕ⍟ body which represents the effect of zero or more executions of the loop body. Our iteration operator works by extracting recurrence relations from the formula ϕbody and then computing closed forms for these relations. We present our iteration operator in three stages, based on the types of recurrence relations being considered: simple recurrence equations, stratified recurrence equations, and linear recurrence (in)equations. Simple and stratified recurrences are classical classes of recurrence equations. Linear recurrence (in)equations generalize the class of inequations presented in [2] by using stratified recurrences to generate polynomial (rather than just linear) inequations. The main conceptual contribution of this section is the idea to use SMT solvers to extract recurrences (and other relevant information) from a loop body formula. In the remainder of this section, we fix a formula ϕbody representing the body of a loop. We assume that ϕbody is expressed in linear (rational and integer) arithmetic; our strategy for dealing with non-linear arithmetic is described in Section 4. We that ϕbody is satisfiable (if it is not, then we can take V also assume ′ x = x, which represents zero iterations of the loop). ϕ⍟ to be x∈Var body 3.1 Simple recurrence equations We start by defining simple recurrences and induction variables. Definition 1. A simple recurrence for a formula ϕ is an equation of the form x′ = x + c (for a constant c) such that ϕ |= x′ = x + c. If x′ = x + c is a simple recurrence for ϕ, we say that x satisfies the recurrence x′ = x + c, and if there is some c such that x satisfies the recurrence x′ = x + c, we say that x is an induction variable. Simple recurrences can be detected by first querying an SMT solver for a model m of ϕbody , and then asking whether ϕbody implies x′ = x + Jx′ − xKm (where Jx′ − xKm denotes the interpretation of the term x′ − x in the model m). This implication holds iff x is an induction variable. If x is an induction variable that satisfies the recurrence x′ = x + c, then the closed form for x is x(k) = x(0) + kc (writing x(k) for the value that x obtains on the kth iteration of the loop). To provide some early intuition on the iteration operator to be developed in the remainder of this section, let us suppose that we are only interested in simple recurrences. Then a possible definition for the iteration operator is V ′ ′ ϕ⍟ body , ∃k ≥ 0. {x = x + kc : x = x + c ∈ SR(ϕbody )} where SR(ϕbody ) is the set of simple recurrences satisfied by ϕbody . The iteration operator defined above is sound (it over-approximates the behaviour of any number of iterations of the loop, since each variable is either described exactly by a recurrence or is not constrained at all), but it is imprecise. The remainder of this section discusses more general recurrence equations which can be used to compute more precise transition invariants for loops. 3.2 Stratified recurrences equations Consider the loop shown to the right. We can see that while(x ≤ 10): x := x + 1 x satisfies a simple recurrence equation x′ = x + 1, and y := y + x that y satisfies a (non-simple) recurrence equation y′ = z := 2 * x y + x + 1. A closed form for y’s recurrence is y (k) = y(0) + Pk−1 (i) ′ (x +1). Since x satisfies a simple recurrence (x = x+1), we have a closed i=0 form for x(i) , so we may simplify this recurrence and remove the summation: y(k) = y(0) + k−1 k−1 X X k(k + 1) i = y(0) + kx(0) + (x(0) + i + 1) = y(0) + kx(0) + k + . 2 i=0 i=0 Stratified recurrence equations generalize this idea: starting from simple recurrence equations, we solve more and more complicated recurrences using the closed forms for simpler ones. As with the example above, stratified recurrences have non-linear closed forms. Non-linear invariant generation is not the main focus of our work, but it is sometimes a necessary intermediate step for proving linear invariants in a compositional setting: since our analysis cannot take advantage of contextual information when analyzing a loop, we generate a nonlinear invariant and then, after the analysis has examined more context, simplify it (using the linearization algorithm from Section 4). Definition 2. Let ϕ be a formula. The stratified recurrence equations (and stratified induction variables) of ϕ are defined inductively as: – A simple recurrence equation which is satisfied by ϕ is a stratified recurrence equation of ϕ (and a simple induction variable is a stratified induction variable) at stratum 0. – Let y denote a vector of the stratified induction variables of strata ≤ N . A recurrence of the form x′ = x + cy (where c is a vector of constants) is a stratified recurrence at stratum N + 1 (and if x satisfies such a recurrence, it is a stratified induction variable at stratum N + 1). We use siv(ϕ) to denote the set of all stratified induction variables of ϕ. Let us now discuss how stratified recurrences are detected from a loop body formula ϕbody . We begin by computing the affine hull aff(ϕbody ) of ϕbody (Algo- Algorithm 1: Affine hull. Input : Satisfiable formula ϕbody Output: Affine hull of ϕbody H ← ⊥; ψ ← ϕbody ; while there V exists a model m of ψ do H ′ ← {x = JxKm : x ∈ Var ∪ Var′ }; H ← H ⊔= H ′ ; /*Join in the domain of linear equalities*/ ψ ← ψ ∧ ¬H; end return H rithm 1).1 Definition 3. The affine hull aff(ϕ) of a formula ϕ is the smallest affine set which contains ϕ, represented as (the set   of solutions to) a system of equations Ax = b, where x = x1 · · · xn x′1 · · · x′n . Logically, aff(ϕ) is a system of equations which satisfies the following three properties: (1) ϕ |= aff(ϕ), (2) every linear equation over Var ∪ Var′ which is implied by ϕ is also implied by aff(ϕ), and (3) no equation in aff(ϕ) is implied by the others. Our strategy for detecting stratified recurrences is based on the following lemma. Combined with property (2) of aff(ϕbody ) above, this lemma implies that any equation implied by ϕbody can be expressed as a linear combination of the equations in aff(ϕbody ). Lemma 1 ([28], Corollary 3.1d). Let A be a matrix, b be a column vector, c be a row vector, and d be a constant. Assume that the system Ax = b has a solution. Then Ax = b implies cx = d iff there is a row vector λ such that λA = c and λb = d. Let us write aff(ϕbody ) as Ax = b. Suppose that we have detected all recurrences of strata < N , and that we want to determine whether a variable xi (0 ≤ i ≤ n) is an induction variable at stratum N . Then we ask whether there exists λ, c, and d such that: – λA = c and λb = d (i.e, cx = d is implied by aff(ϕbody ) and thus by ϕbody ) – ci = 1 and ci+n = −1 (the coefficients of xi and x′i are 1 and -1, respectively) – For all j such that j 6= i + n and n ≤ j ≤ 2n, cj = 0 (except for x′i , all coefficients of primed variables are 0). – For all j such that j 6= i such that xj is not an induction variable of strata < N and n ≤ j ≤ 2n, cj = 0 (except for xi and induction variables of strata < N , all coefficients for unprimed variables are 0). Thus, after computing the affine hull of ϕbody , determining whether a given variable satisfies a stratified recurrence is simply a matter of solving a system of linear equations (e.g., using Gaussian elimination). 1 This algorithm is a specialization of the one in [26] to the abstract domain of linear equalities. Closed forms for stratified recurrences. We first state a lemma: Lemma 2. The closed form for a stratified induction variable of strata N is of the form (0) x(k) = p0 (k) + p1 (k)y1 +· · · + pn (k)yn(0) where each yi is a stratified induction variable of strata < N and each pi (k) ∈ Q[k] is a polynomial of one variable with rational coefficients. Our algorithm for solving stratified recurrences is based on a constructive proof for this lemma. We proceed by induction on strata. The base case is trivial. Suppose that we have a recurrence at strata N (and all y1 , ..., yn are of strata Pk−1 (i) < N ): x′ = x+c1 y1 +· · ·+cn yn +b. Then we may write x(k) = x(0) + i=0 c1 y1 +  (i) (i) · · · + cn yn + b . By our induction hypothesis, each yj can be written as a linear term with coefficients from Q[k]. It follows that there exists p0 , ..., pn ∈ Q[k] so that (i) (0) c1 y1 +· · · + cn yn(i) + b = p0 (i) + p1 (i)y1 +· · · + pn (i)yn(0) Thus we have x(k) = x(0) + k−1 X (0) p0 (i) + p1 (i)y1 +· · · + pn (i)yn(0) i=0 = x(0) + k−1 X i=0 (0) p0 (i) + y1 k−1 X i=0 p1 (i) +· · · + yn(0) k−1 X pn (i) i=0 The closed form of a summation of a polynomial of degree m is a polynomial of degree m + 1. We can find this polynomial via curve fitting (i.e., we compute the first m + 1 terms of the summation and then solve the corresponding linear system of equations for the coefficients of the polynomial). 3.3 Linear recurrence (in)equations Recurrence equations (such as the simple and while(x ≥ 0 ∧ y ≥ 0): stratified varieties) yield very accurate approxiif (*): x := x - 1 mations for some variables, but what about varielse: y := y - 1 ables which do not satisfy any recurrence equation? For example, consider that neither x nor y satisfy a recurrence equation in the loop to the right. However, they do satisfy recurrence inequations: x−1 ≤ x′ , x′ ≤ x, y − 1 ≤ y′ , and y′ ≤ y. These inequations can be closed to yield x(0) −k ≤ x(k) and x(k) ≤ x(0) , y (0) −k ≤ y (k) , and y (k) ≤ y (0) . In this section, we discuss linear recurrence (in)equations, which allow us to compute good approximations for loops that cannot be completely described by recurrence equations. Definition 4. A linear recurrence (in)equation of a formula ϕ is an (in)equation which is implied by ϕ and which is of the form cx′ ⊲⊳ cx + by + d where ⊲⊳ ∈ {<, ≤, =}, x is any vector of variables, y is a vector of stratified induction variables in ϕbody , c, b are constant vectors, and d is a constant. Linear recurrence (in)equations generalize recurrence equations in two ways: first, they allow for inequalities rather than equations. Second, they allow recurrences for linear terms, rather than just variables. For example, the linear recurrence equation (x′ + y′ ) = (x + y) + 1 is satisfied by the body of the loop above, which can be closed to yield (x(k) + y(k) ) = (x(0) + y(0) ) + k. We now describe our method for detecting and solving linear recurrence (in)equations. We begin by introducing a set of difference variables δx , one for each variable x ∈ / siv(ϕbody ) (variables which do belong to siv(ϕbody ) are already precisely described by recurrence equations, so we need not approximate them). We then compute (via Algorithm 2) the convex hull of the formula ψ defined as: ^ ψ , ∃X.ϕbody ∧ {δx = x′ − x : x ∈ Var \ siv(ϕbody )} where X is Var′ ∪ (Var \ siv(ϕbody )). Algorithm 2: Convex hull. Input : Satisfiable formula ψ, set of variables X Output: Convex hull of ∃X.ψ P ← ⊥; while there exists a model m of ψ do Let Q be a cube of the DNF of ψ s.t. m |= Q; Q ← project(Q, X) ; /*Polyhedral projection*/ P ←P ⊔Q ; /*Polyhedral join*/ ψ ← ψ ∧ ¬P ; end return P Geometrically, the convex hull hull(ϕbody ) is the smallest convex polyhedron which contains ϕbody . Logically, it is a set of (in)equations such that (1) every (in)equation in hull(ϕbody ) is implied by ϕbody , and (2) any linear (in)equation (over Var ∪ Var′ ) which is implied by ϕbody is also implied by hull(ϕbody ). For example, hull(ϕbody ) for the loop above is: 0 ≤ δx ∧ δx ≤ 1 ∧ 0 ≤ δy ∧ δy ≤ 1 ∧ δx + δy = 1 We note that the only variables which appear in the (in)equations in hull(ϕbody ) are (stratified) induction variables and difference variables. Thus, we may write any (in)equation in hull(ϕbody ) as cδ ⊲⊳ by +d (where δ is the vector of difference variables, y is the vector of stratified induction variables, c and b are constant vectors, and d is a constant). Recalling the definition of the difference variables, we may rewrite such an inequation as c(x′ − x) ⊲⊳ by + d and then rewrite again as cx′ ⊲⊳ cx + by + d, which matches the definition of linear recurrence (in)equations given in Definition 4. We may close such a linear recurrence (in)equation as follows: k−1 X by (i) + d cx(k) ⊲⊳ cx(0) + i=0 We can compute a closed form for the summation preceding section. 3.4 Pk−1 i=0 by (i) + d as in the Loop guards A loop body typically contains crucial information about the execution of the loop that cannot be captured by recurrence relations. For example, consider the loop in Section 3.2. Supposing that the loop executes n times, we must have that x(k) ≤ 10 for each k < n. Further, consider that the variable z is a function of the simple induction variable x, and so z(k) can be described precisely in terms of the pre-state variables (even though it does not itself satisfy any recurrence): ( z(0) if k = 0 (k) z = 2(x(0) + k + 1) otherwise. The question is: how can we recover this type of information from a loop body formula? We define the guard of a transition formula ϕ as follows: guard(ϕ) , (∃Var.ϕ) ∧ (∃Var′ .ϕ) If ϕ is a loop body formula, then guard(ϕ) is a formula which over-approximates the effect of executing at least one execution of the loop. Intuitively, (∃Var.ϕ) as a precondition that must hold before every iteration of the loop and (∃Var′ .ϕ) as a post-condition of the loop that must hold after each iteration. Consider again the example loop in Section 3.2, we have the following loop body formula ϕbody = x ≤ 10 ∧ x′ = x + 1 ∧ y ′ = y + x′ ∧ z ′ = 2x′ We compute guard(ϕbody ) as follows: guard(ϕbody ) = (∃x, y, z.ϕbody ) ∧ (∃x’, y’, z’.ϕbody ) ≡ (x ≤ 10) ∧ (x’ ≤ 11 ∧ z = 2x’) , and thereby recover the desired information about x and z. Since loop body formulas may be large, it may be adventageous in practice to simplify the guard formula by eliminating the quantifiers (as we did above). A second option, which is more efficient but less precise, is to over-approximate quantifier elimination. Two possibilities are to use Algorithm 2 to compute the convex hull of guard(ϕbody ), or to use optimization modulo theories [19] to compute intervals for each pre- and post-state variable in ϕbody . 3.5 Bringing it all together We close this section by describing how the pieces defined in this section fit into the iteration operator of linear recurrence analysis. We let CR(ϕbody ) denote the set of closed linear recurrence (in)equations (including simple and stratified recurrence equations) satisfied by ϕbody . Each such (in)equation is of the form cx(k) ⊲⊳ t, where the free variables of t are drawn from {x(0) : x ∈ Var} and a distinguished variable k ∈ / Var indicating the loop iteration. We define V ϕ+ {cx′ ⊲⊳ t[x(0) 7→ x] : cx′ ⊲⊳ t ∈ CR(ϕbody )} body , ∃k.k ≥ 1 ∧ where t[x(0) 7→ x] denotes the term t with every variable of the form x(0) is replaced by the corresponding variable x. Finally, our iteration operator is defined as: V + ′ ϕ⍟ body , (ϕbody ∧ guard(ϕbody )) ∨ x∈Var x = x. 4 Linearization The iteration operator presented in the previous section relies heavily on using an SMT solver to extract information from loop body formulas. This strategy requires that loop body formulas are expressed in a decidable theory which is supported by SMT solvers (in particular, linear arithmetic). However, a program may contain non-linear instructions, and even if it does not, our iteration operator may introduce non-linearity (consider Example 1, where the transition ′ ′ formula for the outer loop ϕ⍟ outer contains the non-linear proposition r = x−q y). Our solution to this problem is to linearize non-linear formulas before passing them to the iteration operator. Linearization is an operation that, given an (arbitrary) arithmetic formula ϕ, computes a formula lin(ϕ) which over-approximates ϕ (i.e., ϕ ⇒ lin(ϕ)), but which is expressed in linear arithmetic. There is generally no best approximation of a non-linear formula as a linear formula, so our method is (necessarily) a heuristic. We explain our linearization algorithm informally using an example. Consider the following non-linear formula (where w, x, y, z are integers): ψ ,1≤w =x<y <5∧w∗y ≤z ≤x∗y Our algorithm begins by normalizing ψ, separating it into a linear part and a set of non-linear equations (introducing existentially quantified temporary variables as necessary). For example, the result of normalizing ψ is:   1 ≤ w = x < y < 5∧ ≤ γ0 ≤ z ≤ γ1 ∧ γ0 = w ∗ y ∧ γ1 = x ∗ y The left conjunct is a linear over-approximation of ψ, but it is very imprecise: semantically equal (but syntactically distinct) non-linear terms become semantically unequal in the over-approximation, and all information about the magnitude of non-linear terms is lost. To increase precision of this approximation, we use two strengthening steps. 1. We replace the non-linear operations with uninterpreted function symbols and then compute the affine hull of the resulting formula to infer equalities between non-linear terms. For our example ψ, the we discover that γ0 = γ1 . 2. We compute concrete and symbolic intervals for non-linear terms. Consider γ0 = x ∗ y from our example ψ. We first compute concrete (x ∈ [1, 3] and y ∈ [2, 4]) and symbolic (x ∈ [x, x] and y ∈ [y, y]) intervals for the operands x and y, using symbolic optimization [19] to compute the concrete intervals. We obtain a concrete interval for x ∗ y (x ∗ y ∈ [2, 12]) by multiplying the concrete intervals of its operands. We obtain symbolic intervals for x ∗ y (x ∗ y ∈ [y, 3y] and x ∗ y ∈ [2x, 4x]) by multiplying the concrete interval for x by the symbolic interval for y and vice-versa. As a result of interval computation, we discover: 2 ≤ γ1 ≤ 12 ∧ y ≤ γ1 ≤ 3y ∧ 2x ≤ γ1 ≤ 4x Finally, we take lin(ψ) to be the initial coarse linear approximation of ψ conjoined with the facts discovered by the two strengthening steps. We expect linearization to have broad applications outside of the context in which we presented it, particularly in program analysis, where over-approximation can be tolerated but non-linear terms cannot. Finding improved linearization heuristics is an interesting direction of future work. 5 Experiments We wrote a tool which implements LRA and analyzes C code (using the CIL [24] frontend).2 We use Z3 [9] to resolve SMT queries that result from applying the iteration operator and checking assertion violations. Polyhedra operations are passed to the New Polka library implemented in Apron [4]. The quantifier elimination algorithm from [22] is used to compute loop guards. We tested two different configurations of LRA: one which is fully compositional (LRA-Comp) and does not take advantage of contextual information, and one (LRA) which uses an intraprocedural polyhedron analysis [8] to gain some contextual information, but which is otherwise compositional. We compare LRA’s performance against the state-of-the-art invariant generation and verification tools CPAChecker (overall winner of the 2015 Software Verification Competition) and SeaHorn (winner of the loops category among tools which are sound for verification). To evaluate the precision of LRA we used it to verify the correctness of a suite of 119 small loop benchmarks of varying difficulty. Our benchmark suite was drawn from the loops category of the 2015 Software Verification Competition (SVComp-15), as well as a set of non-linear benchmarks (Non-linear), such as the one in Figure 1. The results for the 81 safe, integer-only benchmarks from these suites are shown in Table 1. The suite also contains 38 unsafe benchmarks: LRA and LRA-Comp have no false negatives on these benchmarks; CPAChecker has 3 and SeaHorn has 2. Our results demonstrate that LRA is an effective invariant generation algorithm. Even the fully compositional variant of LRA (LRA-Comp) is able to prove safety for 80% of the benchmarks we considered). We also note that there are 8 benchmarks for which LRA can prove safety but which CPAChecker and SeaHorn cannot. 2 The tool and benchmarks are available at http://cs.toronto.edu/~ zkincaid/lra. Benchmark suite # Bench LRA LRA-Comp CPAChecker SeaHorn SVComp-15 74 65 60 37 65 Non-linear 7 6 5 1 3 Total 81 71 (88%) 65 (80%) 38 (47%) 68 (85%) Running time across all benchmark suites Mean 5.4s 3.0s 42.4s 37.7s Median 0.8s 0.8s 1.6s 0.2s Table 1. Experimental results. 6 Related work There is a great deal of work on compositional invariant generation and acceleration which is related to the technique described in this paper. In this section, we compare our technique to a sampling of this work. Recurrence analysis. The idea of using closed forms of recurrence relations to approximate loops has appeared in a number of other papers. Generally speaking, our work differs from previous work in two essential ways: first, we use an SMT solver to extract semantic recurrences, rather than syntactic recurrences. Second, we consider approximate recurrences (inequations over linear terms) rather than exact recurrences (equations over variables). A survey of some of this work follows. Ammarguellat and Harrison present a method for detecting induction variables which is compositional in the sense that it uses closed forms for inner loops in order to recognize nested recurrences [1]. Maps from variables to symbolic terms (effectively a symbolic constant propagation domain) is used as the abstract domain. Kovács presents a technique for discovering invariant polynomial equations based on solving recurrence relations [15]. The simple and stratified recurrence equations considered in this paper are a strict subset of the recurrences considered in [15], but our algorithm for solving recurrences is simpler. Kroening et al. [16] presents a technique for computing under -approximations of loops which uses polynomial curve-fitting to directly compute closed forms for recurrences rather than extracting recurrences and then solving them in a separate step. Ancourt et al. present a method for computing recurrence inequations for while loops with affine bodies [2]. Like the method we present on Section 3.3, their method is based on using difference variables and polyhedral projections. Our method generalizes this work by (1) extending it to arbitary control flow, with (possibly non-linear) formulas as bodies rather than affine transformations, (2) integrating recurrence inequations with stratified induction variables, thereby allowing enabling the computation of invariant polynomial inequations. Ancourt et al. briefly discuss a method for computing invariant polynomial inequations, but it is based on higher-order differences rather than stratified recurrence inequations. For example, in Figure 1, the analysis discussed in [2] would be able to prove that r is decremented by a constant amount at every loop iteration, but could not prove that the constant amount is exactly y. Acceleration. Acceleration is a technique closely related to recurrence analysis that was pioneered in infinite-state model checking [6,11,3], and which has recently found use in program analysis [12,18,13]. Given a set of reachable states and an affine transformation describing the body of a loop, acceleration computes an exact post-image which describes the set of reachable states after executing any number of iterations of the loop (although there is recent work on abstract acceleration uses computes over-approximate post-images [12,13]). In contrast, our technique is approximate rather than exact, and computes loop summaries rather than post-images. A result of these two features is that our analysis to be applied to arbitrary loops, while acceleration is classically limited to simple loops where the body consists of a sequence of assignment statements. Compositional program analysis. Compositional program analysis has a long history. Particular examples are interprocedural analyses based on summarization [29] and elimination-style dataflow analyses (a good overview of which can be found in [27]). The following surveys recent work on compositional analysis for numerical invariants. Kroening et al. [17] and Biallas et al. [5] present compositional analysis techniques based on predicate abstraction. In addition to predicate abstraction, there are a few papers which use numerical abstract domains for compositional analysis. These include an algorithm for detecting affine equalities between program variables [23], an algorithm for detecting polynomial equalities between program variables [7], a disjunctive polyhedra analysis which uses widening to compute loop summaries [25], and a method for automatically synthesizing transfer functions for template abstract domains using quantifier elimination [21]. Our abstract domain is the set of arbitrary arithmetic formula, which is more expressive than these domains, but which (as usual) incurs a price in performance. It would be interesting to apply abstractions to our formulas to improve the performance of our analysis. Linearization. Our linearization algorithm was inspired by Miné’s procedure for approximating non-linear abstract transformers [20]. Miné’s procedure abstracts non-linear terms by linear terms with interval coefficients using the abstract value in the pre-state to derive intervals for variables. Our algorithm abstracts non-linear terms by sets of symbolic and concrete intervals, and applies to the more general setting of approximating arbitrary formulas. 7 Conclusion This paper presents a fully compositional algorithm for generating numerical invariants of imperative programs. Our method for abstracting loops makes essential use of compositionality: we assume that we are given a formula which approximates the body of a loop, and we use an SMT solver to extract recurrence relations and then use the closed forms of these recurrences to approximate the loop. We have demonstrated experimentally that our method is competitive with leading invariant generation and verification tools. References 1. Z. Ammarguellat and W. L. Harrison, III. Automatic recognition of induction variables and recurrence relations by abstract interpretation. PLDI, pages 283– 295, 1990. 2. C. Ancourt, F. Coelho, and F. Irigoin. A modular static analysis approach to affine loop invariants detection. Electron. Notes Theor. Comput. Sci., 267(1):3–16, Oct. 2010. 3. S. Bardin, A. Finkel, J. Leroux, and P. Schnoebelen. Flat acceleration in symbolic model checking. In ATVA, pages 474–488. 2005. 4. J. Bertrand and A. Miné. Apron: A library of numerical abstract domains for static analysis. In CAV, pages 661–667, 2009. 5. S. Biallas, J. Brauer, A. King, and S. Kowalewski. Loop leaping with closures. In SAS, pages 214–230, 2012. 6. B. Boigelot and P. Wolper. Symbolic verification with periodic sets. In CAV, pages 55–67. 1994. 7. M. A. Colón. Approximating the algebraic relational semantics of imperative programs. In SAS, pages 296–311. 2004. 8. P. Cousot and N. Halbwachs. Automatic discovery of linear restraints among variables of a program. In POPL, pages 84–96, 1978. 9. L. De Moura and N. Bjørner. Z3: an efficient SMT solver. TACAS, pages 337–340, 2008. 10. A. Farzan and Z. Kincaid. An algebraic framework for compositional program analysis. CoRR, abs/1310.3481, 2013. 11. A. Finkel and J. Leroux. How to compose Presburger-accelerations: Applications to broadcast protocols. In FST TCS, pages 145–156, 2002. 12. L. Gonnord and N. Halbwachs. Combining widening and acceleration in linear relation analysis. In SAS, pages 144–160. 2006. 13. B. Jeannet, P. Schrammel, and S. Sankaranarayanan. Abstract acceleration of general linear loops. In POPL, pages 529–540, 2014. 14. S. Kleene. Representation of events in nerve nets and finite automata. In C. Shannon and J. Mccarthy, editors, Automata Studies, pages 3–42. Princeton University Press, Princeton, N.J., 1956. 15. L. Kovács. Reasoning algebraically about P-solvable loops. In TACAS, pages 249–264. 2008. 16. D. Kroening, M. Lewis, and G. Weissenbacher. Under-approximating loops in C programs for fast counterexample detection. In CAV, pages 381–396. 2013. 17. D. Kroening, N. Sharygina, S. Tonetta, A. Tsitovich, and C. Wintersteiger. Loop summarization using abstract transformers. In ATVA, pages 111–125. 2008. 18. J. Leroux and G. Sutre. Accelerated data-flow analysis. In SAS, pages 184–199, 2007. 19. Y. Li, A. Albarghouthi, Z. Kincaid, A. Gurfinkel, and M. Chechik. Symbolic optimization with SMT solvers. In POPL, pages 607–618, 2014. 20. A. Miné. Symbolic methods to enhance the precision of numerical abstract domains. In VMCAI, pages 348–363, 2006. 21. D. Monniaux. Automatic modular abstractions for linear constraints. In POPL, pages 140–151, 2009. 22. D. Monniaux. Quantifier elimination by lazy model enumeration. In CAV, pages 585–599, 2010. 23. M. Müller-Olm and H. Seidl. Precise interprocedural analysis through linear algebra. POPL, pages 330–341, 2004. 24. G. C. Necula, S. McPeak, S. P. Rahul, and W. Weimer. CIL: Intermediate language and tools for analysis and transformation of C programs. In CC, pages 213–228, 2002. 25. C. Popeea and W.-N. Chin. Inferring disjunctive postconditions. ASIAN, pages 331–345, 2007. 26. T. W. Reps, S. Sagiv, and G. Yorsh. Symbolic implementation of the best transformer. In VMCAI, pages 252–266, 2004. 27. B. G. Ryder and M. C. Paull. Elimination algorithms for data flow analysis. ACM Comput. Surv., 18(3):277–316, Sept. 1986. 28. A. Schrijver. Theory of Linear and Integer Programming. John Wiley & Sons, Inc., New York, NY, USA, 1986. 29. M. Sharir and A. Pnueli. Two approaches to interprocedural data flow analysis, chapter 7, pages 189–234. Prentice-Hall, Englewood Cliffs, NJ, 1981. 30. R. E. Tarjan. Fast algorithms for solving path problems. J. ACM, 28(3):594–614, July 1981.
6cs.PL
Representing Extended Finite State Machines for SDL by A Novel Control Model of Discrete Event Systems Peng Wang and Kai-Yuan Cai Department of Automatic Control Beijing University of Aeronautics and Astronautics Beijing 100083, China [email protected] [email protected] Abstract This paper discusses EFSM for SDL and transforms EFSM into a novel control model of discrete event systems. We firstly propose a control model of discrete event systems, where the event set is made up of several conflicting pairs and control is implemented to select one event of the pair. Then we transform EFSM for SDL to the control model to clarify the control mechanism functioning in SDL flow graphs. This work views the EFSM for SDL in the perspective of supervisory control theory, and this contributes to the field of software cybernetics, which explores the theoretically justified interplay of software and the control. system (DES) by an automaton, and control is implemented by another automaton called supervisor. This control structure has been widely accepted and followed up by many other advanced models in this field, such as the partially observable DES, the decentralized control approach and so forth. Nowadays it has formed a theoretical framework, named by RW Framework [9]. Considering the inherent connection of automata and computer science, the supervisory control theory has been introduced into the computer science these years in order to design and analyze the computer program more formally and safely. Some approaches have be explored, and some topics have been discussed with respect to the programming in robotics [10], the software design for the power transformer station [11] as well as developing software by the polynomial dynamic system approach [12]. 1. Introduction Extended Finite State Machines (EFSMs) are widely used in computer science and software engineering [1, 2, 3], especially in the field of program analysis and testing. This model typically simulates flow graphs of software programs, and can be conditionally specified to be the computing model in Specification and Description Language (SDL) [3, 4]. As well known in computer science and engineering, SDL is a language to specify the communication of several processes, where each process is modeled by an EFSM, and the whole communicating system is modeled and computed by CEFSMs, namely Communicating Extended Finite State Machines [5, 6]. This provides one of the backgrounds of our research work. Another background of this paper refers to the supervisory control theory of discrete event systems, firstly proposed by P. J. Ramadge and W. M. Wonham in 1980s [7, 8]. This theory represents a discrete event Fig. 1. Represent EFSM for SDL by control model of DES. In this paper we propose a new control model of discrete event systems on the basis of RW Framework in order to analyze EFSM for the computing model in SDL. This new model is different from that in RW Framework because the new model does not partition the event set by the controllable and uncontrollable subsets. Rather, the event set in the new model is composed of several conflicting pairs. Then the supervisor, which is defined in a similar manner as that in RW Framework, implements control by selecting one event of the conflicting pair. By the new control model, we represent the EFSM for SDL from the perspective of supervisory control theory. The main idea of our research work is illustrated in Fig. 1. To bridge the gap between EFSM and supervisory control theory, a topic has been introduced as “embedded supervisory control of discrete event systems” in [13]. That is, given a controlled object in terms of a finite automaton and a supervisor in the sense of the RW framework, an equivalent EFMS of a special form can be obtained. In other words, a discrete event system coupled with a supervisor can be transformed to an EFMS in [13], and this also contributes to bridging the same gap. However, we study the topic in the opposite course, that is, we analyze the given EFSM by decomposing it to a novel control model of discrete event systems, and this control model is different from the classic one in RW Framework. Besides this, the EFSM discussed in this paper is more generalized in some aspects than that discussed in [13], and is more applicable to practical problems because it is specified as the computing model of SDL. One point to be emphasized is, the work of this paper is fundamentally inspired by the thoughts of software cybernetics [14, 15], a new field which studies the theoretically justified interplay between software and the control. And the main result of this paper also contributes to this fields concerning that EFSM, a computing model in computer science, is analyzed from the perspective of supervisory control theory in this paper. The rest of this paper is organized as follows. Section 2 derives the new control model of discrete event systems. Section 3 introduces EFSM and specifies the general EFSM model to be a special one for SDL. In Section 4 we transform the EFSM for SDL to the new control models via two algorithms. Section 5 concludes this paper and prospects the following research topics. 2. Control Model Systems of Discrete Event This section proposes a new control model of discrete event systems. The new model continues to use the same supervisor/controller structure as that in RW Framework. However, the two models have different partitions on the event sets. That is, the classic model in RW Framework partitions the event set as the controllable and uncontrollable subsets while the new model composes the event set by several conflicting pairs. Based on these pairs supervisory control is implemented by supervisor. 2.1 Discrete Event Systems A discrete event system is modeled by a Mealy finite deterministic automaton G = (Q, Σ, Ζ, δ , λ , q0 ) where Q is the state set, Σ is the input event set, Ζ is the output event set, δ : Q × Σ → Q is the transition function, λ : Q × Σ → Ζ is the output function, q0 ∈ Q is the initial state. In general, δ and λ are partial functions on the domain, and λ (q,σ ) is defined if and only if δ (q, σ ) is defined. Here the transition function can be extended to δ : Q × Σ* → Q as below. (1) δ (q, ε ) = q (2) δ (q, sσ ) = δ (δ (q, s ),σ ) And similarly the output function can be extended to λ : Q × Σ* → Ζ* as below. (1) λ (q, ε ) = ε (2) λ ( q , sσ ) = λ ( q , s )λ (δ ( q, s ),σ ) . It is well known that languages can be used to identify the behaviors of discrete event systems. And as for the Mealy Automaton, it has both input sequences and output sequences. Thus its behavior should naturally be represented by the two sequences combined together. Hence, Given a Mealy Automaton, we define the input language by Linput (G) = {s ∈ Σ * | δ (q0 , s ) is defined} , and accordingly define the output language by Loutput (G ) = {t ∈ Ζ * | ∃s ∈ Σ ∗ s.t . λ (q0 , s) = t} . However, it is noted that there exists the situation that more than one input sequence are respondent to a same output sequence. Therefore, it is also necessary to reflect the inherent connection of the input and output sequences in the defined language. So we further give the following definition. s Σ L(G ) = { ∈ ( )* | δ (q0 , s ) is defined and λ (q0 , s ) = t} t Ζ And for ( s / t ) ∈ L(G ) , it is easily checked that s and t belong to input and output languages respectively, and s is definitely connected to t by λ (q0 , s ) = t . And therefore this language can completely identify the behavior of the Mealy Automaton. And we also note that the regular expression can be applied here to represent the language especially when the Mealy Automaton is finite. In this paper the input event set is especially composed of several conflicting pairs. This can be represented by Σ = I ∪ I . Consider I = {a, b, c} for example, then we have I = {a , b , c} , and this yields the event set Σ = {a, b, c, a , b , c} , where a and a , b and b , c and c are the given conflicting event pairs. Here we note that this event set can also be represented by Σ = I × {true, false} , or be interpreted by a relation defined on the event set. 2.2 Supervisor Let Σ = I ∪ I , define the control pattern γ by γ ⊆ Σ and (∀σ ∈ Σ)(σ ∈ γ ⇒ σ ∉ γ ) Then all control patterns compose the set Γ = {γ ∈ 2 Σ | (∀σ ∈ Σ)(σ ∈ γ ⇒ σ ∉ γ )} . Event σ is said to be enabled by γ if σ ∈ γ ; or disabled by γ if σ ∉ γ . And it is easily checked that control pattern γ satisfies (∀σ ∈ Σ)(σ ∈ γ ⇒ σ ∉ γ ) . Besides, it is also noted that this definition permits the situation that σ ∉ γ ∧ σ ∉ γ . The supervisor is a pair Φ = (S ,ψ ) , where S = ( X , Σ, ξ , x0 ) is a deterministic automaton and ψ : X → Γ is a state feedback map. Couple Φ to G and this yields the supervised discrete event system by (Φ / G ) = A( X × Q, Σ, Ζ, δˆ, λˆ, < x , q >) 0 0 where the transition function δˆ : X × Q × Σ → X × Q is defined by < ξ ( x, σ ), δ ( q, σ ) > if σ ∈ψ ( x ) and  ˆ δ ( x, q , σ ) =  ξ ( x, σ ), δ (q , σ ) are defined undefined otherwise  and the output function λ̂ : X × Q × Σ → Ζ is defined by λ (q, σ ) if δˆ( x, q, δ ) is defined λˆ ( x, q, σ ) =  undefined otherwise Let L(Φ / G) denote the language generated by Φ / G . And one point to be emphasized is that, if ξ ( x, σ ) is defined implies σ ∈ψ (x ) , then we have δˆ( x, q, σ ) is defined ⇔ ξ ( x, σ ) is defined ∧ δ (q, σ ) is defined Therefore the supervised system is equivalent to the synchronized product [9] of S and G , namely Φ /G = S ×G . Thereby given a complete supervisor [9] in the form of Φ = ( S ,ψ ) , we can always reduce it via the automaton S . Specifically speaking, we firstly reduce S by eliminating ξ ( x, σ ) for σ ∉ψ (x ) , then we further eliminate the inaccessible states and then obtain S mod ify . Thereby the supervisory control can be equivalently achieved by G × S mod ify . Here we note that automaton S mod ify corresponds to the supervisor mentioned in [13]. 3. Extended Finite State Machines for Computing Model of SDL In this section we firstly introduce the general model of EFSM. Then the general model of EFSM is specilized to be the computing model in SDL. An example is given along with the formal explanation. 3.1 General Model of EFSM. According to [1] we gives the definition of EFSM as follows. An extended finite state machine is structured by a five-tuple EFSM = (Y , I , O,V , T ) where Y , I , O represent the state set, the input event set and the output event set, respectively. V is the variable set, composed of several variables, namely V = {v1, v2 ""vn } . And each variable vi has its G domain, denoted by dom(vi ) . Let V denote the vector composed by all the variables in V , namely G V =< v1, v2 "vn > . Then accordingly we have G dom(V ) = dom(v1) × dom(v2 )" × dom(vn ) . T is the transition set. For a transition t ∈ T , t is denoted by t = ( yt _ src , yt _ dest , it , ot , Pt , At ) where yt _ src ∈ Y and yt _ dest ∈ Y represent the source state and destination state respectively. it ∈ I and ot ∈ O of the transition, represent the input G event and the output event, respectively. Pt (V ) is the predicate of the transition, which is defined on the G variable set V . At (V ) is the update function, which updates the values of the variables. By the definition as above, static structure of EFSM is illustrated. And to make the system dynamic, there are two other points to be mentioned: (1) The initial condition for EFSM. The initial condition includes the initial state y0 ∈ Y and the initial values of the variables, namely G V0 =< v10 , v20 "vn 0 > . (2) The dynamic rule for EFSM. This rule regulates the dynamic behavior of the system. For the transition t = ( yt _ src , yt _ dest , it , ot , Pt , At ) , the rule is explained as follows: when event it is imported to state yt _ src , if the current value of G G V makes Pt (V ) true, then the transition is enabled, the current state turns to yt _ dest , export G the event ot and the value of V is updated by G At (V ) ; otherwise the transition is disabled, the G current state and the value of V remain unchanged. Here we note that an EFSM can be nonG deterministic if the current value of V enables more than one transition with the one definite input imported. However, this paper only discusses the deterministic EFSM where only one transition is enabled with the one input event at anytime of the system evolvement. Besides, it is also reasonable to use languages to identify the behavior of the EFSM. And by the similar manners as introduced in Mealy Automata, we can also prefigure the input and output languages as well as the combined language to depict the evolvement behavior of the EFSM model. Here we do not give the formal definition of languages for EFSMs, but corresponding concepts about the languages can be well sensed in the following section. Fig. 2 EFSM for example. Based on the aforementioned explanation, an example of EFSM is presented in Fig. 2, where the state set is Y = {I , II } , the input event set is I = {a} and the output event set is O = {m, n} . The variable set is given by V = {v} , and dom(v ) = {0,1,2"9} . The predicates on variable v are given as Fig. 2 shows, namely v > 7 , v ≤ 7 , v > 3 and v ≤ 3 . The update functions on variable v consist of v := v + 1 and v := v − 1 . The initial state of EFSM is I , and the initial value of v is v0 = 0 . Then the EFSM can evolve by the dynamic rule as mentioned above, and this EFSM is definitely deterministic. 3.2 EFSM model for SDL. In this paper, we focus on a special model of EFSM, which functions as the computing model in Specification and Description Language. And we note that SDL specifies the predicate function as Fig. 3 shows. false G Pt (V ) true Fig. 3 Predicates in SDL flow graphs. For an input event, the predicate decides where the system goes by its Boolean values. That is, if the current values of variables make the predicate true, then the system runs to one state; otherwise the system runs to another state. G ¬Pt (V ) G Pt (V ) Fig. 4. Predicates in EFSM for SDL. Therefore the predicate in SDL can be interpreted as a special case of the predicate in general EFSM, as shown in Fig. 4. That is, for the computing model of SDL, the EFSM is characterized by several transition pairs, and each pair consists of two conflicting G transitions, of which one is marked by predicate Pt (V ) and the other one is marked by the contrary predicate G ¬Pt (V ) . Then the transition pair is denoted by t = ( yt _ src , yt _ dest , it , ot , Pt , At ) and t = ( yt _ src , yt _ dest , it , ot , ¬Pt , At ) . Therefore the EFSM for the computing model of SDL is formularized by G EFSM SDL = (Y , I , O, V , T , y0 ,V0 ) where Y , I , O , V have the same meanings as the counterparts in general EFSM. To incorporate the initial conditions and the dynamic rules in EFSM SDL , G let y0 and V0 =< v10 , v20 "" vn 0 > denote the initial state and initial values of variables, and the transition set of the EFSM for SDL is defined by G G T : Y × I × P (V ) × {true, false} → Y × O × A(V ) , where G P (V ) × {true, false} denotes the conflicting predicates in transition pairs. Here we note that the EFSM for the computing model of SDL must be deterministic because the SDL flow graphs as well as the programming code cannot run ambiguously, but be definitely explained to be deterministic. 4. Representing EFSM for SDL by the Control Model of DES Based on the work of previous sections this section discusses the connection between EFSM and control models of DES. We transform EFSM for SDL to the control model of discrete event systems. Especially, the update function and the predicate together act as a supervisor to control where program flow goes. Here the update function acts as the automaton of the supervisor, and the predicate in EFSM plays the role of state feedback map. The basic idea of this section is shown in Fig. 6. G G T : Q × I × P(V ) × {true, false} → Q × O × A(V ) Fig. 5. SDL flow graph. Then we transform the EFSM given in Fig. 2 to the SDL flow graph in Fig. 5. And the programming code can be further derived from of the SDL flow graph as follows. enum State {I, II}; static State s; enum Input {a}; enum Output {m,n}; static Input i; static Output o; static int v; void Initialization() { s=I; v=0; } void Transition (Input i) { switch(s) { case I: switch(i) { case a: if(v>7) {s=II; o=n; v=v+1;} else {s=I; o=m; v=v+1;} break; } break; case II: switch(i) { case a: if(v<=3) {s=I; o=m; v=v-1;} else {s=II; o=n; v=v-1;} break; } break; } } ξ : X ×Σ → X ψ :X →Γ Φ =< S ,ψ > Fig. 6. Extract the supervisor from EFSM for SDL. This section represents the EFSM for SDL by the control model proposed in Section 1. By this approach we highlight the control functioning in the general program flows, and study the inherent control mechanism in program flow graphs. This work contributes to the field of software cybernetics, which explores the theoretically justified interplay of the software and the control. In the rest of this section we firstly specify the problem formally, and the solution to the problem is given via two algorithms. G Problem: Give an EFSM SDL = (Y , I , O, V , T , y0 ,V0 ) , transform this computing model to the control model of DES proposed in Section 1, namely a DES coupled with a supervisor. 4.1 Controlled DES Firstly we extract a controlled DES from EFSM of the computing model in SDL. Consider that the output event set and the output function are defined in EFSM, the controlled DES is extracted as a Mealy Automaton. G Algorithm 1: Give EFSM SDL = (Y , I , O, V , T , y0 ,V0 ) . Extract controlled DES G . Step 1. Structure G by G = (Y , Σ, O, δ , λ , y0 ) , where Σ := I × {true, false} ; Step 2. Let i ∈ I and bin ∈{true, false} . Construct transition function δ : Y × Σ → Y by G  y dest if T(y src , i , Pt (V ), bin)  G δ ( y src , < i, bin >) =  =< y dest , o, At (V ) > undefined otherwise  Construct the output function λ : Y × Σ → O by G o if T(y src , i , Pt (V ), bin)  G λ ( y src , < i , bin >) =  =< y dest , o, At (V ) > undefined otherwise  Two points should be emphasized here. Firstly we construct the input event set by Σ = I × {true, false} , and this yields the conflicting event pairs as introduced in Section 1. Secondly, if the transition function δ : Y × Σ → Y and the output function λ : Y × Σ → O combine together and additionally consider Σ = I × {true, false} , then it yields Y × I × {true, false} → Y × O And this corresponds to the transition of EFSM SDL by G G eliminating P (V ) and A(V ) from G G T : Y × I × P (V ) × {true, false} → Y × O × A(V ) . Recalling the example given in Section 3, we extract the Mealy Automaton to be the controlled DES as shown in Fig. 7. And the conflicting event pair is obtained by < a, true > and < a, false > . G construct automaton S by the update function A(V ) ; (2) construct state feedback map ψ by the predicate G P (V ) . G Algorithm 2: Give EFSM SDL = (Y , I , O, V , T , y0 ,V0 ) . Extract supervisor Φ = ( S ,ψ ) . Step 1. Structure automaton S = ( X , Σ, ξ , x0 ) , where G X := dom(V ) × Y ; Σ := I × {true, false} ; G x0 :=< V0 , y0 > . Step 2. Let bin ∈{true, false} . Construct transition ξ : X × Σ → X as follows: G ξ (< V , y src >, < i , bin >) , if consider G G T ( ysrc , i, Pt (V ), bin) =< y dest , o, At (V ) > is G G defined and At (V ) ∈ dom(V ) , then G G ξ (< V , y src >, < i, bin >) =< At (V ), y dest > ; G otherwise ξ (< V , y src >, < i , bin >) is undefined. Step 3. Let bin ∈ {true, false} . Let projVG ( x ) and G projy ( x ) denote the segments V and y subject to state x . Namely, G x =< V , y >=< v1 , v2 " vn , y > , we G projVG ( x) = V =< v1 , v2 " vn > given have and projy ( x) = y . Construct state feedback map ψ : X → Γ as follows: < i,bin >∈ψ (x ) if and only if G T (proj y ( x ), i, Pt (V ), bin) G Pt (V ) |VG =proj G ( x ) = bin . is defined and V Considering the classical logic system, G G V = projVG ( x) can only make Pt (V ) to be true or false. And note that only deterministic EFSMs are discussed, it is easily checked that the state feedback map follows the definition given in Section 1. That is, < i,true >∈ψ (x) implies < i,false >∉ψ (x) . Recalling the example presented in Section 3, we construct the state set by X = dom(v) × {I , II } . The initial state for automaton S is obtained by x0 = 0 I . Fig. 7. Controlled DES extracted from EFSM. 4.2 Supervisor Secondly we extract the supervisor from EFSM. To obtain the supervisor, two steps should be taken: (1) And the event set for automaton S is Σ = {< a, true >, < a, false >} . Apply Step 2 in Algorithm 2, and we construct the transition function of automaton S . And automaton S is illustrated in Fig. 8. Fig. 8. Automaton of the supervisor. Apply Step 3 in Algorithm 2, and we construct the state feedback map by the predicates in the EFSM. And the supervisor is finally obtained as shown below. derived is I × {true, false} , we can actually extract the first sub-element from it, and this makes the two models comparable with respect to input events. And thereby it is checked that the two models have the same set of the input sequences as well as the corresponding the output sequences, that is, the two models follow the same disciplines during evolvement. Consider the forgoing example, and we illustrate the input and output sequences of the control model by the diagram as below. Fig. 11. The input and output sequences of the control model. Fig. 9. Supervisor extracted from EFSM. According to Section 1 the supervisory control implemented by Φ = ( S ,ψ ) can be equivalently implemented by an automaton S mod ify . Then the supervised system can be achieved by the synchronized product of the controlled DES and the automaton, namely G × S mod ify . Here we illustrate S mod ify in Fig. 10. Here regular expressions can be derived to represent the sequences as shown in Fig. 11. And we extract the first sub-elements of the control model’s events. Then < a, true > and < a, false > are simplified as a . And if we mark state I and v = 2 , Then the input language is formulated by a 2 (a 14 )* , and the output language is given by m 2 (m 6 n 7 m )* . Consequently we can formulate the combined sequences by the language as below. a a a a ( ) 2 (( ) 6 ( ) 7 )* m m n m Consider the EFSM presented in Section 3, we illustrate its input and output sequences by the diagram in Fig. 12. Fig. 10. Supervisor modified. After introducing the algorithms we give explanation as follows. It is noted that the evolvement of state-transition systems can be represented by the event sequences, and both of the EFSM and the control model of DES have the input sequences and output sequences, where each input sequence corresponds to an output sequence definitely. So the question is whether the algorithms keep the sequences fixed between the two models. The answer is affirmative. Although the input event set of the control model Fig. 12. The input and output sequences of EFSM. Then it is easily checked that the EFSM above has the same input and output sequences as the derived control model. Specifically speaking, from the diagram in Fig. 12 we can exactly deduce the same input and output languages as the derived control model. Furthermore, if we also mark state I and v = 2 , then the same regular expression can be formulated to denote the combined sequence as the same as that of the control model. 5. Concluding Remarks This paper refers to two research topics, the control model of DES and the EFSM for SDL, and bridges the gap between the two topics via the given algorithms. We firstly propose a novel control model of DES, which is characterized by selecting one event of the conflicting event pair. Then we focus on EFSM, and specify the general EFSM to be the computing model for SDL. Then the connection between these two models is studied and the algorithms are given to transform the EFSM for SDL to the control model of DES. The work of this paper highlights the control mechanism functioning in flow graphs of SDL, and contributes to the field of software cybernetics, which explores the theoretically justified interplay between software and the control. Based on the work of this paper, some follow-up topics can be approached. And one topic refers to Communicating Extended Finite State Machines, which functions as the communicating model in SDL. We can analyze CEFSM based on the work of this paper and further propose a novel approach to verify the communicating system modeled by SDL from the perspective of supervisory control theory. References [1] C. Bourhfir, E. Aboulhamid, F. Khendek, R. Dssouli, “Test Cases Selection from SDL Specifications”, Computer Networks, 2001, Vol. 35, pp.693-708. [2] A. Petrenko, S. Boroday, R. Groz, “Confirming Configurations in EFSM Testing”, IEEE Transaction on Software Engineering, 2004, Vol. 30, No. 1, pp. 29-42. [3] R.E. Miller, Y. Xue, “Bridging the Gap between Formal Specification and Analysis of Communication Protocols”, Proceedings of the 1996 IEEE Fifteenth Annual International Phoenix Conference on Computers and Communications, March 1996, pp. 225-231. [4] “Introduction to SDL 88”. http://www.sdl-forum.org/ sdl88tutorial/index.html, 2002. [5] C. Bourhfir, E. Aboulhamid, R. Dssouli, N. Ricob, “A Test Case Generation Approach for Conformance Testing of SDL Systems”, Computer Communications, 2001, Vol. 24, pp. 319-333. [6] J. J. Li, W. E. Wong, “Automation Test Generation from Communicating Extended Finite State Machine (CEFSM)Based Model”, Proceedings of the fifth IEEE International Symposium on Object-Oriented Real-Time Distributed Computing, 2002, pp. 181-185. [7] P. J. Ramadge and W. M. Wonham, “Supervisory Control of a Class of Discrete Event Processes”, SIAM Journal of Control and Optimization, 1987, Vol. 25, No. 1, pp. 206-230. [8] W. M. Wonham and P. J. Ramadge, “On the Supremal Controllable Sublanguage of a Given Language”, SIAM Journal of Control and Optimization, 1987, Vol. 25, No. 3, pp. 637-659. [9] W.M. Wonham, “Supervisory Control of Discrete-Event Systems”, Dept. of Electrical & Computer Engineering, University of Toronto, ECE 1636F/1637S 2004-05, Revised 2004.07.01. [10] E. Rutten and H. Marchand, “Task-Level Programming for Control Systems Using Discrete Control Synthesis”, February 2002, Research Report INRIA, No. 4389. [11] H. Marchand and M. Samaan, “Incremental Design of a Power Transformer Station Controller Using a Controller Synthesis Methodology”, IEEE Transactions on Software Engineering, August 2000, Vol.26, No.8, pp. 729-741. [12] X. Y. Wang, Y. C. Li and K. Y. Cai, “On the Polynomial Dynamic System Approach to Software Development”, Science in China (series F), 2004, Vol. 46, No. 4, pp. 437-457. [13] Y. Yang, R. Gohari, “Embedded Supervisory Control of Discrete-Event Systems”, IEEE International Conference on Automation Science and Engineering, 2005, pp. 410-415. [14] K. Y. Cai, J. W. Cangussu, R. A. DeCarlo, A. P. Mathur, “An Overview of Software Cybernetics”, Proceedings of the 11th Annual International Workshop on Software Technology and Engineering Practice, IEEE Computer Society Press, 2004, pp. 77-86. [15] K. Y. Cai, “Optimal Software Testing and Adaptive Software Testing in the Context of Software Cybernetics”, Information and Software Technology, 2002, Vol. 44, pp. 841-855.
3cs.SY
FAST L EARNING R ATE OF D EEP L EARNING Fast learning rate of deep learning via a kernel perspective arXiv:1705.10182v1 [math.ST] 29 May 2017 Taiji Suzuki TAIJI @ MIST. I . U - TOKYO . AC . JP Department of Mathematical Informatics The University of Tokyo 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-8656, Japan, PRESTO, Japan Science and Technology Agency, Center for Advanced Integrated Intelligence Research, RIKEN Abstract We develop a new theoretical framework to analyze the generalization error of deep learning, and derive a new fast learning rate for two representative algorithms: empirical risk minimization and Bayesian deep learning. The series of theoretical analyses of deep learning has revealed its high expressive power and universal approximation capability. Although these analyses are highly nonparametric, existing generalization error analyses have been developed mainly in a fixed dimensional parametric model. To compensate this gap, we develop an infinite dimensional model that is based on an integral form as performed in the analysis of the universal approximation capability. This allows us to define a reproducing kernel Hilbert space corresponding to each layer. Our point of view is to deal with the ordinary finite dimensional deep neural network as a finite approximation of the infinite dimensional one. The approximation error is evaluated by the degree of freedom of the reproducing kernel Hilbert space in each layer. To estimate a good finite dimensional model, we consider both of empirical risk minimization and Bayesian deep learning. We derive its generalization error bound and it is shown that there appears bias-variance trade-off in terms of the number of parameters of the finite dimensional approximation. We show that the optimal width of the internal layers can √ be determined through the degree of freedom and the convergence rate can be faster than O(1/ n) rate which has been shown in the existing studies. Keywords: Deep Learning, Fast Learning Rate, Kernel Method, Degree of Freedom, Generalization Error Bounds, Empirical Risk Minimizer, Bayesian Deep Learning 1. Introduction Deep learning has been showing great success in several applications such as computer vision, natural language processing, and many other area related to pattern recognition. Several highperformance methods have been developed and it has been revealed that deep learning possesses great potential. Despite the development of practical methodologies, its theoretical understanding is not satisfactory. Wide rage of researchers including theoreticians and practitioners are expecting deeper understanding of deep learning. Among theories of deep learning, a well developed topic is its expressive power. It has been theoretically shown that deep neural network has exponentially large expressive power against the number of layers. For example, Montufar et al. (2014) showed that the number of polyhedral regions created by deep neural network can exponentially grow as the number of layers increases. Bianchini and Scarselli (2014) showed that the Betti numbers of the level set of a function created 1 T. S UZUKI by deep neural network grows up exponentially against the number of layers. Other researches also concluded similar facts using different notions such as tensor rank and extrinsic curvature (Cohen et al., 2016; Cohen and Shashua, 2016; Poole et al., 2016). Another important issue in neural network theories is its universal approximation capability. It is well known that 3-layer neural networks have the ability, and thus the deep neural network also does (Cybenko, 1989; Hornik, 1991; Sonoda and Murata, 2015). When we discuss the universal approximation capability, the target function that is approximated is arbitrary and the theory is highly nonparametric in its nature. Once we knew the expressive power and universal approximation capability of deep neural network, the next theoretical question naturally arises in its generalization error. The generalization ability is typically analyzed by evaluating the Rademacher complexity. Bartlett (1998) studied 3layer neural networks and characterized its Rademacher complexity using the norm of weights. Koltchinskii and Panchenko (2002) studied deep neural network and derived its Rademacher complexity under norm constraints. More recently, Neyshabur et al. (2015) analyzed the Rademacher complexity based on more generalized norm, and Sun et al. (2015) derived a generalization error √ bound with a large margine assumption. As a whole, the studies listed above derived O(1/ n) convergence of the generalization error where n is the sample size. One concern in this line of √ convergence analyses is that the convergence of the generalization error is only O(1/ n) where n is the sample size. Although this is minimax optimal, it is expected that we could show faster convergence rate with some additional assumptions such as strong convexity of the loss function. Actually, in a regular parametric model, we have O(1/n) convergence of the generalization error (Hartigan et al., 1998). Moreover, the generalization error bound has been mainly given in finite dimensional models. As we have observed, the deep neural network possesses exponential expressive power and universal approximation capability which are highly nonparametric characterizations. This means that the theories are developed separately in the two regimes; finite dimensional parametric model and infinite dimensional nonparametric model. Therefore, theories that connect these two regimes are expected to comprehensively understand statistical performance of deep learning. In this paper, we consider both of empirical risk minimization and Bayesian deep learning and analyze the generalization error using the terminology of kernel methods. Consequently, (i) we de√ rive a faster learning rate than O(1/ n) and (ii) we connect the finite dimensional regime and the infinite dimensional regime based on the theories of kernel methods. The empirical risk minimization is a typical approach to learn the deep neural network model. It is usually performed by applying stochastic gradient descent with the back-propagation technique (Widrow and Hoff, 1960; Amari, 1967; Rumelhart et al.). To avoid over-fitting, such techniques as regularization and dropout have been employed (Srivastava et al., 2014). Although the practical techniques for the empirical risk minimization have been extensively studied, there is still much room for improvement in its generalization error analysis. Bayesian deep learning has been recently gathering more attentions mainly because it can deal with the estimation uncertainty in a natural way. Examples of Bayesian deep learning researches include probabilistic backpropagation (Hernandez-Lobato and Adams, 2015), Bayesian dark knowledge (Balan et al., 2015), weight uncertainty by Bayesian backpropagation (Blundell et al., 2015), dropout as Bayesian approximation (Gal and Ghahramani, 2016). To analyze a sharper generalization error bound, we utilize the so-called local Rademacher complexity technique for the empirical risk minimization method (Mendelson, 2002; Bartlett et al., 2005; Koltchinskii, 2006; Giné and Koltchinskii, 2006), and, as for the Bayesian method, we employ the theoretical techniques developed to analyze nonparametric Bayes methods (Ghosal et al., 2000; 2 FAST L EARNING R ATE OF D EEP L EARNING Table 1: Summary of derived bounds for the generalization error kfb − f o k2L2 (P (X)) where n is the sample size, R is the norm of the weight in the internal layers, R̂∞ is an L∞ -norm bound of the functions in the model, σ is the observation noise, dx is the dimension of the input, mℓ is the width of the ℓ-th internal layer and Nℓ (λℓ ) for (λℓ > 0) is the degree of freedom (Eq. (5)). Error bound PL 2 2 P General setting L ℓ=2 RL−ℓ+1 λℓ + σ +nR̂∞ L ℓ=1 mℓ mℓ+1 log(n) under an assumption that mℓ & Nℓ (λℓ ) log(Nℓ (λℓ )). σ2 +R̂2∞ PL ∗ ∗ Finite dimensional model ℓ=1 mℓ mℓ+1 log(n) n where m∗ℓ is the true width of the ℓ-th internal layer. 1 2 P L−ℓ+1 n− 1+2sℓ log(n) + dx log(n) Polynomial decay eigenvalue L L ℓ=2 (R ∨ 1) n where sℓ is the decay rate of the eigenvalue of the kernel function on the ℓ-th layer. van der Vaart and van Zanten, 2008, 2011). These analyses are quite advantageous to the typical Rademacher complexity analysis because we can obtain convergence rate between O(1/n) and √ √ O(1/ n) which is faster than that of the standard Rademacher complexity analysis O(1/ n). As for the second contribution, we first introduce an integral form of deep neural network as performed in the research of the universal approximation capability of 3-layer neural networks (Sonoda and Murata, 2015). This allows us to have a nonparametric model of deep neural network as a natural extension of usual finite dimensional models. Afterward, we define a reproducing kernel Hilbert space (RKHS) corresponding to each layer like in Bach (2017, 2015). By doing so, we can borrow the terminology developed in the kernel method into the analysis of deep learning. In particular, we define the degree of freedom of the RKHS as a measure of complexity of the RKHS (Caponnetto and de Vito, 2007; Bach, 2015), and based on that, we evaluate how large a finite dimensional model should be to approximate the original infinite dimensional model with a specified precision. These theoretical developments reveal that there appears bias-variance trade-off. That is, there appears trade-off between the size of the finite dimensional model approximating the nonparametric model and the variance of the estimator. We will show that, by balancing the trade-off, a fast convergence rate is derived. In particularly, the optimal learning rate of the kernel method is reproduced from our deep learning analysis due to the fact that the kernel method can be seen as a 3-layer neural network with an infinite dimensional internal layer. A remarkable property of the derived generalization error bound is that the error is characterized by the complexities of the RKHSs defined by the degree of freedom. Moreover, the notion of the degree of freedom gives a practical implication about determination of the width of the internal layers. The obtained generalization error bound is summarized in Table 11 . 1. a ∨ b indicates max{a, b}. 3 T. S UZUKI 2. Integral representation of deep neural network Here we give our problem settings and the model that we consider in this paper. Suppose that n input-output observations Dn = (xi , yi )ni=1 ⊂ Rdx × R are independently identically generated from a regression model yi = f o (xi ) + ξi (i = 1, . . . , n) where (ξi )ni=1 is an i.i.d. sequence of Gaussian noises N (0, σ 2 ) with mean 0 and variance σ 2 , and (xi )ni=1 is generated independently identically from a distribution P (X) with a compact support in Rdx . The purpose of the deep learning problem we consider in this paper is to estimate f o from the n observations Dn . To analyze the generalization ability of deep learning, we specify a function class in which the true function f o is included, and, by doing so, we characterize the “complexity” of the true function in a correct way. In order to give a better intuition, we first start from the simplest model, the 3-layer neural network. Let η be a nonlinear activation function such as ReLU (Nair and Hinton, 2010; Glorot et al., 2011); η(x) = (max{xi , 0})di=1 for a d-dimensional vector x ∈ Rd . The 3-layer neural network model is represented by f (x) = W (2) η(W (1) x + b(1) ) + b(2) where we denote by m2 the number of nodes in the internal layer, and W (2) ∈ R1×m2 , W (1) ∈ Rm2 ×dx , b(1) ∈ Rm2 and b(2) ∈ R. It is known that this model is universal approximator and it is important to consider its integral form Z f (x) = h(w, b)η(w⊤ x + b)dwdb + b(2) . (1) where (w, b) ∈ Rdx × R is a hidden parameter, h : Rdx × R → R is a function version of the weight matrix W (2) , and b(2) ∈ R is the bias term. This integral form appears in many places to analyze the capacity of the neural network. In particular, through the ridgelet analysis, it is shown that there exists the integral form corresponding to any f ∈ L1 (Rdx ) which has an integrable Fourier transform for an appropriately chosen activation function η such as ReLU (Sonoda and Murata, 2015). Motivated by the integral form of the 3-layer neural network, we consider a more general representation for deeper neural network. To do so, we define a feature space on the ℓ-th layer. The feature space is a a probability space (Tℓ , Bℓ , Qℓ ) where Tℓ is a Polish space, Bℓ is its Borel algebra, and Qℓ is a probability measure on (Tℓ , Bℓ ). This is introduced to represent a general (possibly) continuous set of features as well as a discrete set of features. For example, if the ℓ-th internal layer is endowed with a dℓ -dimensional finite feature space, then Tℓ = {1, . . . , dℓ }. On the other hand, the integral form (1) corresponds to a continuous feature space T2 = {(w, b) ∈ Rdx × R} in the second layer. Now the input x is a dx -dimensional real vector, and thus we may set T1 = {1, . . . , dx }. Since the output is one dimensional, the output layer is just a singleton TL+1 = {1}. Based on these feature spaces, our integral form of the deep neural network is constructed by stacking the map on the ℓ-th layer fℓo : L2 (Qℓ ) → L2 (Qℓ+1 ) given as Z (2a) hoℓ (τ, w)η(g(w))dQℓ (w) + boℓ (τ ), fℓo [g](τ ) = Tℓ 4 FAST L EARNING R ATE OF D EEP L EARNING where hoℓ (τ, w) corresponds to the weight of the feature w for the output τ and hoℓ ∈ L2 (Qℓ+1 × Qℓ ) and hoℓ (τ, ·) ∈ L2 (Qℓ+1 ) for all τ ∈ Tℓ+1 2 . Specifically, the first and the last layers are represented as f1o [x](τ ) = dx X ho1 (τ, j)xj Q1 (j) + bo1 (τ ), (2b) hoL (w)η(g(w))dQL (w) + boL , (2c) j=1 fLo [g](1) = Z TL where we wrote hoL (w) to indicate hoL (1, w) for simplicity because TL+1 = {1}. Then the true function f o is given as o ◦ · · · ◦ f1o (x). f o (x) = fLo ◦ fL−1 (3) Since, the shallow 3-layer neural network is a universal approximator, and so is our generalized deep neural network model (3). It is known that deep neural network tends to give more efficient representation of a function than the shallow network. Actually, Eldan and Shamir (2016) gave an example of a function that the 3-layer neural network cannot approximate under a precision unless its with is exponential in the input dimension but the 4-layer neural network can approximate with polynomial order widths (see Safran and Shamir (2016) for other examples). In other words, each layer of a deep neural network can be much “simpler” than one of a shallow network (more rigorous definition of complexity of each layer will be given in the next section). Therefore, it is quite important to consider the integral representation of a deep neural network rather than a 3-layer network. The integral representation is natural also from the practical point of view. Indeed, it is well known that the deep neural network learns a simple pattern in the early layers and it gradually extracts more complicated features as the layer is going up. The trained feature is usually continuous one. For example, in computer vision tasks, the second layer typically extracts gradients toward several degree angles (Krizhevsky et al., 2012). The angle is a continuous variable and thus the feature space should be continuous to cover all angles. On the other hand, the real network discretize the feature space because of limitation of computational resources. Our theory introduced in the next section offers a measure to evaluate this discretization error. 3. Finite approximation of the integral form The integral form is a convenient way to describe the true function. However, it is not useful to estimate the function. When we estimate that, we need to discretize the integrals by finite sums due to limitation of computational resources as we do in practice. In other word, we consider the usual finite sum deep learning model as an approximation of the integral form. However, the discrete approximation induces approximation error. Here we give an upper bound of the approximation error. Naturally, there arises the notion of bias and variance trade-off, that is, as the complexity of the finite model increases the “bias” (approximation error) decreases but the “variance” for finding the best parameter in the model increases. Afterwards, we will bound the variance for estimating 2. Note that, for g ∈ L2 (Qℓ ), fℓ [g] is also square integrable with respect to L2 (Qℓ+1 ) if η is Lipschitz continuous because h ∈ L2 (Qℓ+1 × Qℓ ). 5 T. S UZUKI the finite approximation in Section 4.3. Combining these two notions, it is possible to quantify the bias-variance trade-off and find the best strategy to minimize the entire generalization error. The approximation error analysis of the deep neural network can be well executed by utilizing notions of the kernel method. Here we construct RKHS for each layer in a way analogous to Bach (2015, 2017) who studied shallow learning and the kernel quadrature rule. Let the output of the ℓ-th layer be Fℓo (x, τ ) := (fℓo ◦ · · · ◦ f1o (x))(τ ). We define a reproducing kernel Hilbert space (RKHS) corresponding to the ℓ-th layer (ℓ ≥ 2) by introducing its associated kernel function kℓ : Rdx × Rdx → R. We define the positive definite kernel kℓ as Z o o ′ (x′ , τ ))dQℓ (τ ). (x, τ ))η(Fℓ−1 η(Fℓ−1 kℓ (x, x ) := Tℓ It is easy to check that kℓ is actually symmetric and positive definite. It is known that there exists a unique RKHS Hℓ corresponding the kernel kℓ (Aronszajn, 1950). Close investigation of the RKHS for several examples for shallow network has been given in (Bach, 2017). Under this setting, all arguments at the ℓ-th layer can be carried out through the theories of kernel methods. Importantly, for g ∈ Hℓ , there exists h ∈ L2 (Qℓ ) such that Z o (x, τ ))dQℓ (τ ). h(τ )η(Fℓ−1 g(x) = Tℓ Moreover, the norms of g and h are connected as kgkHℓ = khkL2 (Qℓ ) , (4) (Bach, 2015, 2017). Therefore, the function Z o (x, w))dQℓ (w), hoℓ (τ, w)η(Fℓ−1 x 7→ Tℓ representing the magnitude of a feature τ ∈ Tℓ+1 for the input x is included in the RKHS and its RKHS norm is equivalent to that of the internal layer weight kho (τ, ·)kL2 (Qℓ ) because of Eq. (4). To derive the approximation error, we need to evaluate the “complexity” of the RKHS. Basically, the complexity of the ℓ-th layer RKHS Hℓ is controlled by the behavior of the eigenvalues of the kernel. To formally state this notion, we introduce the integral operator associated with the kernel kℓ defined as Z kℓ (·, x)g(x)dP (x), Tℓ :g 7→ X L2 (P (X)) → L2 (P (X)). If the kernel function admits an orthogonal decomposition kℓ (x, x′ ) = ∞ X (ℓ) (ℓ) (ℓ) µj φj (x)φj (x′ ), j=1 (ℓ) in L2 (P (X) × P (X)) where (µj )∞ j=1 is the sequence of the eigenvalues ordered in decreasing orP (ℓ) ∞ (ℓ) der, and (φj )j=1 forms an orthonormal system in L2 (P (X)), then for g(x) = ∞ j=1 αj φj (x), the 6 FAST L EARNING R ATE OF D EEP L EARNING integral operation is expressed as Tℓ g = P∞ (ℓ) (ℓ) j=1 αj µj φj (see Steinwart and Christmann (2008); (ℓ) Steinwart and Scovel (2012) for more details). Therefore each eigenvalue µj plays a role like a “fil(ℓ) ter” for each component φj . Here it is known that for all g ∈ Hℓ , there exists h̄ ∈ L2 (P (X)) such that g = Tℓ h̄ and kgkHℓ = kh̄kL2 (P (X)) (Caponnetto and de Vito, 2007; Steinwart et al., 2009). Combining this with Eq. (4), we have kgkHℓ = khkL2 (Qℓ ) = kh̄kL2 (P (X)) Based on the integral operator Tℓ , we define the degree of freedom Nℓ (λ) of the RKHS as Nℓ (λ) = Tr[(Tℓ + λ)−1 Tℓ ] for λ > 0. The degree of freedom can be represented as Nℓ (λ) = (5) P∞ (ℓ) µj j=1 µ(ℓ) +λ j by using the eigenvalues of the kernel. Now, we assume that the true function f o satisfies a norm condition as follows. Assumption 1 For each ℓ, hoℓ and boℓ satisfy that khoℓ (τ, ·)kL2 (Qℓ ) ≤ R (∀τ ∈ Tℓ ), |boℓ (τ )| ≤ Rb (∀τ ∈ Tℓ ). By Eq. (4), the first assumption khoℓ (τ, ·)kL2 (Qℓ ) ≤ R is interpreted as Fℓo (τ, ·) ∈ Hℓ and kFℓo (τ, ·)kHℓ ≤ R. This means that the feature map Fℓo (τ, ·) in each internal layer is well regulated by the RKHS norm. Moreover, we also assume that the activation function is scale invariant. Assumption 2 We assume the following conditions on the activation function η. • η is scale invariant: η(ax) = aη(x) for all a > 0 and x ∈ Rd (for arbitrary d). • η is 1-Lipschitz continuous: |η(x) − η(x′ )| ≤ kx − x′ k for all x, x′ ∈ Rd . The first assumption on the scale invariance is essential to derive tight error bounds. The second one ensures that deviation in each layer does not affect the output so much. The most important example of an activation function that satisfies these conditions is ReLU activation. Another one is the identity map η(x) = x. Finally we assume that the input distribution has a compact support. Assumption 3 The support of P (X) is compact and it is bounded as kxk∞ := max |xi | ≤ Dx (∀x ∈ supp(P (X))). 1≤i≤dx We consider a finite dimensional approximation f ∗ given as follows: let mℓ be the number of nodes in the ℓ-th internal layer (we set the dimensions of the output and input layers to mL+1 = 1 and m1 = dx ) and consider a model fℓ∗ (g) = W (ℓ) η(g) + b(ℓ) (g ∈ Rmℓ , ℓ = 2, . . . , L), f1∗ (x) = W (1) x + b(1) , ∗ f ∗ (x) = fL∗ ◦ fL−1 ◦ · · · ◦ f1∗ (x), where W (ℓ) ∈ Rmℓ+1 ×mℓ and b(ℓ) ∈ Rmℓ+1 . 7 T. S UZUKI Theorem 1 (Finite approximation error bound of the nonparametric model) For any 1 > δ > 0 and λℓ > 0, suppose that mℓ ≥ 5Nℓ (λℓ ) log (32Nℓ (λℓ )/δ) (ℓ = 2, . . . , L), then there exist W (ℓ) ∈ Rmℓ+1 ×mℓ and b(ℓ) ∈ Rmℓ+1 such that, by letting ĉδ = kW (ℓ) k2F ≤ ĉδ R2 (ℓ = 1, . . . , L), kb(ℓ) k ≤ Rb /(1 − δ) (ℓ = 1, . . . , L), 4 1−δ , (6a) (6b) and kf o − f ∗ kL2 (P (X)) ≤ ∗ kf k∞ q L X p 2 ĉδL−ℓ RL−ℓ+1 λℓ , (7) ℓ=2 L p X p Rb L . ≤ ( ĉδ R) Dx + ( ĉδ R)L−ℓ 1−δ (8) ℓ=1 The proof is given in Appendix A. This theorem is proven by borrowing the theoretical technique recently developed for the kernel quadrature rule (Bach, 2015). We also employed some techniques analogous to the analysis of the low rank tensor estimation (Suzuki, 2015; Kanagawa et al., 2016; Suzuki et al., 2016). Intuitively, the degree of freedom Nℓ (λℓ ) is the intrinsic dimension of √ the ℓ-th layer to achieve the λℓ approximation error. Indeed, we show √ in the proof that the ℓ-th layer is approximated by the mℓ dimensional nodes with the precision λℓ under the condition mℓ = Ω(Nℓ (λℓ ) log(Nℓ (λℓ ))). The error bound (7) indicates that the total approximation error of √ λ of each layer the whole network is basically obtained by summing up the approximation error ℓ q where the factor ĉδL−ℓ RL−ℓ+1 is a Lipschitz constant for error propagation. We would like to emphasize that the approximation error bound (7) and the norm bounds (6) of W (ℓ) and b(ℓ) are independent of the dimensions (mℓ )L ℓ=1 of the internal layers. This is due to the scale invariance property of the activation function. This is quite beneficial to derive a tight generalization error bound. Indeed, invariance, we only have a much looser bound q without the scale √ P L L−ℓ RL−ℓ+1 λℓ , and kW (ℓ) k2F ≤ mℓ+1 ĉδ R2 , kb(ℓ) k2 ≤ kf o − f ∗ kL2 (P (X)) ≤ ℓ=2 2 mℓ+1 ĉδ mℓ+1 Rb2 which depend on the dimensions (mℓ )L ℓ=1 and could be huge for small λℓ . This would support the practical success of using the ReLU activation. Let the norm bounds shown in Theorem 1 be p R̄ = ĉδ R, R̄b = Rb /(1 − δ). Remind that Theorem 1 gives an upper bound of the infinity norm of f ∗ , that is, kf ∗ k∞ ≤ R̂∞ where L X R̂∞ = R̄L Dx + R̄L−ℓ R̄b . ℓ=1 Let the set of finite dimensional functions with the norm constraint (6) be F = {f (x) = (W (L) η(·)+b(L) )◦· · ·◦(W (1) x+b(1) ) | kW (ℓ) kF ≤ R̄, kb(ℓ) k ≤ R̄b (ℓ = 1, . . . , L)}. Then, we can show that the infinity norm of F is also uniformly bounded as the following lemma. 8 FAST L EARNING R ATE OF D EEP L EARNING Lemma 1 For all f ∈ F, it holds that kf k∞ ≤ R̂∞ . The proof is given in Appendix A.2. Because of this, we can derive the generalization error bound with respect to the population L2 -norm instead of the empirical L2 -norm. One can check that kf k∞ ≤ R̂∞ for all f ∈ F by Lemma 1 or Lemma 3. 4. Generalization error bounds In this section, we define the two estimators in the finite dimensional model introduced in the last section: the empirical risk minimizer and the Bayes estimator. The generalization error bounds for both of these estimators are derived. We also give some examples in which the generalization error is analyzed in details. 4.1 Notations Before we state the generalization error bounds, we prepare some notations. Let Ĝ = LR̄L−1 Dx + P L L−ℓ , and define δ̂ 3 1,n , δ̂2,n as ℓ=1 R̄ δ̂1,n = q L X p 2 ĉδL−ℓ RL−ℓ+1 λℓ , ℓ=2 2 δ̂2,n  L 2X mℓ mℓ+1 log+ 1 + = n ℓ=1  √ √ 4 2Ĝ max{R̄,R̄b } n √PL . σ ℓ=1 mℓ mℓ+1 Note that δ̂1,n is the finite approximation error given in Theorem 1. Roughly speaking, δ̂2,n corresponds to the amount of deviation of the estimators in the finite dimensional model. 4.2 Empirical risk minimization In this section, we define the empirical risk minimizer and investigate its generalization error. Let the empirical risk minimizer be fb: fb := argmin f ∈F n X (yi − f (xi ))2 . i=1 Note that there exists at least one minimizer because the parameter set corresponding to F is a compact set and η is a continuous function. fb needs not necessarily be the exact minimizer but it could be an approximated minimizer. We, however, assume fb is the exact minimizer for theoretical simplicity. In practice, the empirical risk minimizer is obtained by using the back-propagation technique. The regularization for the norm of the weight matrices and the bias terms are implemented by using the L2 -regularization and the drop-out techniques. The generalization error of the empirical risk minimizer is bounded as in the following theorem. Theorem 2 For any δ > 0 and λℓ > 0, suppose that mℓ ≥ 5Nℓ (λℓ ) log (32Nℓ (λℓ )/δ) (ℓ = 2, . . . , L). 3. We define log+ (x) = max{1, log(x)}. 9 (9) T. S UZUKI Then, there exists universal constants C1 such that, for any r > 0 and r̃ > 1, " ( ! #) √ 2 + σ2) ( R̂ n ∞ 2 2 2 2 o 2 log+ kfb − f kL2 (P (X)) ≤C3 r̃δ̂1,n + (σ + R̂∞ )δ̂2,n + +r n min{σ/R̂∞ , 1}  with probability 1 − exp − 2 (r̃−1)2 nδ̂1,n 11R̂2∞  − 2 exp(−r) for every r > 0 and r̃ ′ > 1. The proof is given in Appendix C. This theorem can be shown by evaluating the covering number of the model F and applying the local Rademacher complexity technique (Mendelson, 2002; Bartlett et al., 2005; Koltchinskii, 2006; Giné and Koltchinskii, 2006).   √  2 2  It is easily checked that the third term of the right side ( (R̂∞n+σ ) log+ min{σ/nR̂ ,1} + r ) is ∞ smaller than the first two terms, therefore the generalization error bound can be simply evaluated as Based on a rough evaluation 2 2 kfb − f o k2L2 = Op (δ̂1,n + δ̂2,n ). 2 δ̂1,n ≃L L X ℓ=1 2 λℓ , δ̂2,n ≃ L X mℓ mℓ+1 ℓ=1 n log(n), and the constraint mℓ & Nℓ (λℓ ) log(Nℓ (λℓ )), we can observe the bias-variance trade-off for the generalization error bound because, as λℓ decreases, the required width of the internal layer mℓ increases by the condition (9) and thus the deviation δ̂2,n in the finite dimensional model should increase. In other words, if we want to construct a finite dimensional model which well approximates the true function, then a more complicated model is required and we should pay larger variance of the estimator. A key notion for the bias-variance trade-off is the degree of freedom Nℓ (λℓ ) which expresses the “complexity” of the RKHS Hℓ in each layer. The degree of freedom of a complicated RKHS grows up faster than a simpler one as λ goes to 0. This is also informative in practice because, to determine the width of each layer, the degree of freedom gives a good guidance. That is, if the degree of freedom is small compared with the sample size, then we may increase the width of the layer. An estimate of the degree of freedom can be computed from the trained network by computing the Gram matrix corresponding to the kernel induced from the trained network (where the kernel is defined by the finite sum instead of the integral form) and using the eigenvalue of the Gram matrix. To obtain the best generalization error bound, (λℓ )L ℓ=1 should be tuned to balance the biasvariance terms (and accordingly (mℓ )L should also be fine-tuned). The examples of the best ℓ=2 achievable generalization error will be shown in Section 4.4. 4.3 Bayes estimator In this section, we formulate a Bayes estimator and derive its generalization error. To define the Bayes estimator, we just need to specify the prior distribution. Let Bd (C) be the ball in the Euclidean space Rd with radius C > 0 (Bd (C) = {x ∈ Rd | kxk ≤ C}), and U(Bd (C)) be the uniform distribution on the ball Bd (C). Since Theorem 1 ensures the norms of W (ℓ) and b(ℓ) are bounded above by R̄ and R̄b , it is natural to employ a prior distribution that possesses its support on the set of 10 FAST L EARNING R ATE OF D EEP L EARNING parameters with norms not greater than those norm bounds. Based on this observation, we employ uniform distributions on balls with the radii indicated above as a prior distribution: W (ℓ) ∼ U(Bmℓ+1 ×mℓ (R̄)), b(ℓ) ∼ U(Bmℓ+1 (R̄b )). In practice, the Gaussian distribution is also employed instead of the uniform distribution. However, the Gaussian distribution does not give good tail probability bound for the infinity norm of the deep neural network model. That is crucial to develop the generalization error bound. For this reason, we decided to analyze the uniform prior distribution. The prior distribution on the parameters (W (ℓ) , b(ℓ) )L ℓ=1 induces the distribution of the function f in the space of continuous functions endowed with the Borel algebra corresponding to the L∞ (Rdx )norm. We denote by Π the induced distribution. Using the prior, the posterior distribution is defined via the Bayes principle: Π(df |Dn ) = R Pn (yi −f (xi ))2 )Π(df ) i=1 2σ2 . Pn (yi −f ′ (xi ))2 ′) exp(− i=1 )Π(df 2 2σ exp(− Since the purpose of this paper is to give a theoretical analysis for the generalization error, we do not pursue the computational issue of the Bayesian deep learning. See, for example, Hernandez-Lobato and Adams (2015); Blundell et al. (2015) for practical algorithms. The following theorem gives how fast the Bayes posterior contracts around the true function. Theorem 3 Fix arbitrary δ > 0 and λℓ > 0 (ℓ = 1, . . . , L), and suppose that the condition (9) on mℓ is satisfied. Then, for all r ≥ 1, the posterior tail probability can be bounded as   q R̂2∞ o EDn Π(f : kf − f kL2 (P (X)) ≥ (δ̂1,n + σ δ̂2,n )r max{12, 33 σ2 }|Dn ) " #   2 2 r2 2 (r − 1) ≤ exp −nδ̂1,n + 12 exp −n(δ̂1,n + σ δ̂2,n )2 2 . 2 8σ 11R̂∞ The proof is given in Appendix B. The proof is accomplished by using the technique for non-parametric Bayes methods (Ghosal et al., 2000; van der Vaart and van Zanten, 2008, 2011). Roughly speaking this theorem indicates that the posterior distribution concentrates in the distance δ̂1,n + σ δ̂2,n from the true function f o . The tail probability is sub-Gaussian and thus the posterior mass outside the distance δ̂1,n + σ δ̂2,n from the true function rapidly decrease. Here we again observe that there appears bias-variance trade-off between δ̂1,n and δ̂2,n . This can be understood essentially in the same way as the empirical risk minimization. From the posterior contraction rate, we can derive the generalization error bound of the posterior mean. Corollary 1 Under the same setting as in Theorem 3, there exists a universal constant C1 such that the generalization error of the posterior mean fb is bounded as    h o i n 2 2 R̂∞  2 σ 2 EDn kfb − f o k2L2 (P (X)) ≤ C1 max 12, 33σR̂2∞ 1 + q (δ̂1,n + σ 2 δ̂2,n )+ . n nδ̂2 1,n 11 T. S UZUKI 2 /R̂2 ≥ 1 (which is the regime of our interest), Therefore, for sufficiently large n such that nδ̂1,n ∞ the generalization error is simply bounded as   2 2 2 2 kfb − f o k2L2 (P (X)) = Op max{1, R̂σ∞ }( δ̂ + σ δ̂ ) . 2 1,n 2,n 4.4 Examples Here, we give some examples of the generalization error bound. We have seen that both of the empirical risk minimizer and the Bayes estimators have a simplified generalization error bound as 2 2 kfb − f o k2L2 (P (X)) = Op (δ̂1,n + δ̂2,n ) = Op L L X R̄L−ℓ+1 λℓ + ℓ=2 L X mℓ mℓ+1 ℓ=1 n ! log(n) , q L by supposing σ, R̂∞ and ĉL δ R are in constant order. We evaluate the bound under the best choice of mℓ balancing the bias-variance trade-off. One way to balance the terms is to set λℓ so that L X λℓ = ℓ=2 L X mℓ mℓ+1 ℓ=1 n where the log(n)-factor and L are dropped for simplicity. Since the inequality of arithmetic sum P P m2ℓ mℓ mℓ+1 ≤ L+1 geometric mean gives L ℓ=1 n , we may set mℓ to satisfy ℓ=1 n λℓ = m2ℓ (ℓ = 2, . . . , L). n (10) Considering this relation and the constraint mℓ & Nℓ (λℓ ) log(Nℓ ) (Eq. (9)), we can estimate the best width mℓ that minimizes the upper bound of the generalization error. 4.4.1 F INITE DIMENSIONAL INTERNAL LAYER If all RKHSs are finite dimensional, say m∗ℓ -dimensional. Then Nℓ (λ) ≤ m∗ℓ for all λ ≥ 0. Therefore, by setting λℓ = 0 (∀ℓ), the generalization error bound is obtained as kfb − f o k2L2 (P (X)) . L 2 X σ 2 + R̂∞ m∗ℓ m∗ℓ+1 log(n), n (11) ℓ=1 where we omitted the factors depending only on log(R̄R̄b Ĝ). Note that, although there appears the L∞ -norm bound R̂∞ , this convergence rate is independent of the Lipschitz constant R̄L−ℓ+1 and R̄b up to log-order but is solely dependent on the number of parameters. Moreover, the convergence rate is O(log(n)/n) in terms of the sample size n. This is much faster than the existing bounds that √ utilize the Rademacher complexity because their bounds are O(1/ n). This result matches more precise arguments for a finite dimensional 3-layer neural network based on asymptotic expansions (Fukumizu, 1999; Watanabe, 2001) which also showed the generalization error of the 3-layer neural network can be evaluated as O((m∗1 m∗2 + m∗2 m∗3 )/n). 12 FAST L EARNING R ATE OF D EEP L EARNING 4.4.2 P OLYNOMIAL DECREASING RATE OF EIGENVALUES (ℓ) We assume that the eigenvalue µj decays in polynomial order as (ℓ) µ j ≤ aℓ j − s1 ℓ , (12) for a positive real 0 < sℓ < 1 and aℓ > 0. This is a standard assumption in the analysis of kernel methods (Caponnetto and de Vito, 2007; Steinwart and Christmann, 2008), and it is known that this assumption is equivalent to the usual covering number assumption (Steinwart et al., 2009). For small sℓ , the decay rate is fast and it is easy to approximate the kernel by another one corresponding to a finite dimensional subspace. Therefore small sℓ corresponds to a simple model and large sℓ corresponds to a complicated model. In this setting, the degree of freedom is evaluated as Nℓ (λℓ ) . (λℓ /aℓ )−sℓ . (13) This can be shown as follows: for any positive integer M , the degree of freedom can be bounded as Nℓ (λℓ ) = ∞ X j=1 (ℓ) ∞ X µj (ℓ) µj (ℓ) µj + λℓ ≤M+ j=M +1 aℓ ≤M+ λℓ λℓ Z ∞ x−1/sℓ dx M ≤ M + (aℓ /λℓ )(1 − 1/sℓ )−1 M 1−1/sℓ .  s Letting M = (aℓ /λℓ )(1 − 1/sℓ )−1 ℓ to balance the first and the second term, we obatain the evaluation (13). Hence, we can show that, according to Eq. (10), 2sℓ 1+2sℓ λℓ = aℓ n 1 − 1+2s ℓ gives the optimal rate, and we obtain the generalization error bound as kfb − f o k2L2 (P (X)) . L L 2sℓ X 1 d2 2(L−ℓ+1) 1+2sℓ − 1+2sℓ (R̄ ∨ 1) aℓ log (n) + x log(n), n n (14) ℓ=2 where we omitted the factors depending on sℓ , log(R̄R̄b Ĝ), σ 2 and R̂∞ . This indicates that the complexity sℓ of the RKHS affects the convergence rate directly. As expected, if the RKHSs are simple (that is, (sℓ )L ℓ=2 are small), we obtain faster convergence. 4.4.3 O NE INTERNAL LAYER : KERNEL METHOD Finally, we consider a simple but important situation in which there is only one internal layer (L = 2). In this setting, we only need to adjust m2 because the dimensions of input and output are fixed as m1 = dx and m3 = 1. We assume that the same condition (12) for ℓ = 2. Then, applying the condition (10), − 1 s2  1+s2 (dx + 1)m2 n 1+s2 λ2 = ⇒ λ2 ≃ a2 log(n) n dx + 1 gives the optimal convergence rate. Actually, we obtain s2 1+s2 kfb − f o k2L2 (P (X)) . ((R̄ ∨ 1)2 a2 13 1 )(dx + 1) 1+s2 n 1 − 1+s 2 log(n). T. S UZUKI This convergence rate is equivalent to the minimax optimal convergence rate of the kernel ridge regression (Caponnetto and de Vito, 2007; Steinwart et al., 2009) (up to constant and log(n) factors). It is known that the kernel method corresponds to the 3-layer neural network with an infinite dimensional internal layer. In that sense, our analysis includes that of kernel methods. In particular, the finite dimensional approximation we performed in Section 3 can be seen as the kernel quadrature rule (Bach, 2015). Thus, the analysis here ensures that the kernel quadrature rule can achieve the optimal rate as a byproduct of the neural network analysis. In that sense, we can say that the deep neural network is a method that constructs an optimal kernel in a layer-wise manner using a kernel quadrature rule. Some concrete examples have bee investigated in Bach (2017) for the three layer neural network. However, the analysis does not assume that the loss function is strongly convex, and thus the local Rademacher complexity analysis is not applied. Consequently, the convergence rate is slower than √ O(1/ n). 1 − 1+s ) when L = 2, but we have already observed that the conver1 P − 1+2s ℓ : The sample complexity in gence rate (14) of the deep neural network is basically L ℓ=2 n each layer is slow for deep neural network (there is a factor 2 before sℓ ). This is because we need to estimate a matrix in each layer for deep neural network and the number of output grows up as the sample size increases, and as a result, the number of parameters that should be estimated is much larger than the 3-layer neural network in which the dimensions of the input and output are fixed. The convergence rate is O(n 2 5. Relations to existing work In this section, we describe the relation of our work to existing works The sample complexity of deep neural network has been extensively studied by analyzing its Rademacher complexity. For example, Bartlett (1998) characterized the generalization error of a 3-layer neural network by the norm of the weight vectors instead of the number of parameters. Koltchinskii and Panchenko (2002) studied more general deep neural network and derived its generalization error bound of deep neural network under a norm constraint. They showed the Rademacher complexity of the deep neural network is bounded by the sum of those of single layer neural networks. This is similar to our generalization error bound obtained in Eqs.(14) and (11). More recently, Neyshabur et al. (2015) analyzed the Rademacher complexity of the deep neural network based on the norms of the weight matrix ({W (ℓ) }L ℓ=1 in our paper). Sun et al. (2015) also derived the Rademacher complexity and showed the generalization error under a large margin assumption. As consequences of these studies, they derived the following type of inequalities: n CR2L 1X b l(f (xi ), yi ) + √ EX,Y [l(fb(X), Y )] ≤ n n i=1 with high probability where l is a loss function, fb is the empirical risk minimizer with or without regularization and R is a norm bound of the internal layers (the definition of the norm differs between papers). Basically, these studies considered the finite dimensional situation which was studied in Section 4.4.1 as a special case of our analysis, and a connection to an infinite dimensional model has not been closely discussed. In particular, the bias-variance trade-off has not been √ analyzed. Moreover, the generalization error is O(1/ n) which is much slower dependency on the sample size than that of our rate O(1/n). This is a big difference from the existing analysis. To 14 FAST L EARNING R ATE OF D EEP L EARNING improve the convergence rate to faster one for empirical risk minimization approaches, so called local Rademacher complexity was important in our analysis. Moreover, we have observed that the Bayesian analysis also gave faster convergence rate. Analysis of the bias-variance trade-off in three layer neural network from the kernel point of view has been investigated by Bach (2017). The analysis is given for several concrete examples. However, the loss function is not assumed to be strongly convex, and thus the obtained rate is not √ faster than O(1/ n). Another important topic for the analysis of the generalization ability is VC-dimension analysis. VC-dimension of the deep neural network has been studied by, for example, Bartlett et al. (1998); Karpinski and Macintyre (1997); Goldberg and Jerrum (1995). However, VC-dimension is a notion independent of the input distributions. On the other hand, the degree of freedom considered in our paper depends on the input distribution and is more data specific. Hence, our analysis gives tighter bound and could be practically more useful. In our analysis, the kernel formulation of deep neural network model was the key ingredient for the analysis. Some authors have proposed methods that utilize the representation in the internal layers as a feature map into some RKHS as in our formulation. For example, Cho and Saul (2009); Mairal et al. (2014); Mairal (2016) have proposed novel methods to construct a kernel via deep learning. Their purpose is to suggest a new hierarchical method to construct a kernel, and their proposed methods are different from the ordinary deep learning model. On the other hand, our theoretical approach states that deep learning itself can be interpreted as a kind of kernel learning. Moreover, their studies are not for theories but for methodologies. Hence, our analysis and their studies are in complementary relationship, and our analysis would give theoretical support for their methods. 6. Conclusion and future work In this paper, we proposed to use the integral form of deep neural network for generalization error analysis, and based on that, we derived the generalization error bound of the empirical risk minimizer and the Bayes estimator. The integral form enabled us to define an RKHS in each layer, and import the theoretical techniques developed in kernel methods into the analysis of deep learning. In particular, we defined the degree of freedom of each RKHS and showed that the approximation error between a finite dimensional model and the integral form can be characterized by the degree of freedom. In addition to the approximation error, we also derived the estimation error in the finite dimensional model. We have observed that there appears bias-variance trade-off depending on the size of the finite dimensional model. Based on the analysis, we also derived generalization error bounds of some examples including the situation where the eigenvalues of the kernel function decay in a polynomial order, the one where the true model is finite dimensional, and the one where there is only one internal layer. We have observed that the analysis of the 3-layer neural network reproduces the optimal learning rate of the kernel method up to log(n)-order. Our theoretical frame-work offered a clear description of the bias-variance trade-off for deep learning. This was particularly useful to determine the optimal widths of the internal layers. We believe this study opens up a new direction of a series of theoretical analyses of deep learning. There remain several topics to be studied. One is characterization of the space of the deep neural network described by the integral form. The integral form can approximate arbitrary function, but 15 T. S UZUKI under the norm constraints as we have assumed, it is unclear how large the function class is. Solving this issue is interesting future work. Acknowledgment This work was partially supported by MEXT kakenhi (25730013, 25120012, 26280009, 15H01678 and 15H05707), JST-PRESTO and JST-CREST (JPMJCR1304 and JPMJCR14D7). Appendix A. Proof of Theorem 1 A.1 Approximation error bound for the finite dimensional model To derive the approximation error bound, we utilize the following proposition that was proven by Bach (2015). Proposition 1 For λ > 0, there exists a probability density qℓ (τ ) with respect to the measure Qℓ such that, for any δ ∈ (0, 1), i.i.d. sample v1 , . . . , vm from qℓ satisfies that sup kf kHℓ inf 4 ≤1 β∈Rm :kβk22 ≤ m with probability 1 − δ, if f− m X 2 βj qℓ (vj )−1/2 η(Fℓ−1 (·, vj )) j=1 ≤ 4λ, L2 (P (X)) m ≥ 5Nℓ (λ) log(16Nℓ (λ)/δ). By the scale invaliance of η, η(ax) = aη(x) (a > 0), we have the following proposition based on Proposition 1. Proposition 2 For λ > 0, and any 1/2 > δ > 0, if m ≥ 5Nℓ (λ) log(16Nℓ (λ)/δ), then there exist v1 , . . . vm ∈ Tℓ , w1 , . . . , wm > 0 such that sup inf 2 kf kHℓ ≤R β∈Rm :kβk22 ≤ 4R m and f− m X 2 ≤ 4λR2 , βj η(wj Fℓ−1 (·, vj )) j=1 L2 (P (X)) m 1 X 2 wj ≤ (1 − 2δ)−1 . m j=1 R 1 Pm −1 −1 Proof Notice that E[ m = = E[qℓ (v)−1 ] = j=1 qℓ (vj ) ] Tℓ qℓ (v) qℓ (v)dQℓ (v) R P m 1 −1 ≤ 1/(1 − 2δ) j=1 qℓ (vj ) Tℓ 1dQℓ (v) = 1, thus an i.i.d. sequence {v1 , . . . , vm } satisfies m with probability 2δ by the Markov’s inequality. Combining this with Proposition 1, the i.i.d. sequence {v1 , . . . , vm } and wj = qℓ (vj )−1/2 satisfies the condition in the statement with probability m 1 − (δ + 1 − 2δ) = δ > 0. This ensures the existence of sequences {vj }m j=1 and {wj }j=1 that satisfy the assertion. 16 FAST L EARNING R ATE OF D EEP L EARNING From now on, we define c0 = 4, c1 = 4, cδ = (1 − 2δ)−1 . The next theorem gives the proof of the approximation error bound in Theorem 1. The L∞ -norm bound of f o is given later in Lemma 3. Substituting δ ← δ/2 into the statement in the following Lemma 2 and letting ĉδ = c1 cδ/2 , we obtain Theorem 1. Lemma 2 (Approximation error bound of the nonparametric model) For any 1/2 > δ > 0 and given λℓ > 0, let mℓ ≥ 5Nℓ (λℓ ) log(16Nℓ (λℓ )/δ). Then there exist W (ℓ) ∈ Rmℓ+1 ×mℓ and b(ℓ) ∈ Rmℓ+1 (ℓ = 1, . . . , L) where mL+1 = 1 and m1 = dx such that kW (ℓ) k2F ≤ c1 cδ R2 , kb(ℓ) k2 ≤ √ cδ Rb (ℓ = 1, . . . , L − 1), kW (L) k2F ≤ c1 R2 , kb(L) k2 ≤ Rb , and kf o − f ∗ kL2 (P (X)) ≤ L q X (c1 cδ )L−ℓ c0 RL−ℓ+1 ℓ=2 p λℓ . Proof We construct the asserted finite dimensional network recursively from ℓ = L to ℓ = 1. Let (ℓ) (ℓ) mℓ (ℓ) mℓ ℓ b {vj }m j=1 and {wj }j=1 be the sequences given in Proposition 2. Let Tℓ = {vj }j=1 . With slight abuse of notation, we identify fℓ∗ : Rmℓ → Rmℓ+1 to a function fℓ∗ : Tbℓ → Tbℓ+1 in a (ℓ+1) ) to express canonical way. For a function F : Rdx × Tbℓ → R, we denote by fℓ∗ [F ](x, vi P (ℓ+1) (ℓ) (ℓ) (ℓ) (ℓ+1) mℓ ∗ f [F (x, ·)](v ) = W F (x, v ) + b for v ∈ Tbℓ+1 . When we write f ∗ [F ] for ℓ i j=1 i,j j i i ℓ × Tbℓ . We define × Tℓ → R ((x, v) 7→ F (x, v)), we deal with F as a restriction of F on F : ∗ ∗ the output from the ℓ-th layer of the approximated network f as Fℓ (x, v) for v ∈ Tbℓ and x ∈ Rdx . ∗ ](x, v). More precisely, it is recursively defined as Fℓ∗ (x, v) = fℓ∗ [Fℓ−1 We use an analogous notation for other networks such as fℓo . That is, Fℓo (x, v) = (fℓo ◦ · · · ◦ o ](x, v). o f1 (x))(v) for v ∈ Tℓ and x ∈ Rdx , and Fℓo (x, v) = fℓo [Fℓ−1 Step 1 (the last layer, ℓ = L). We consider the following approximation of the L-th layer (the last layer): Remember that mL+1 = 1 and thus the output from the L-th layer is just one dimensional. We denote by TL+1 = {1} which is the index set of the output (which is just a singleton consisting of an element 1). As a candidate of a good approximation to the true L-th layer, define Rdx Rdx f˜L∗ [FL−1 ](x, 1) =   mL X √ 1 (L) (L) (L) mL βj η √ w FL−1 (x, vj ) + bL mL j (15) j=1 by β (L) ∈ RmL and w(L) ∈ RmL satisfying kβ (L) k22 ≤ m1L c1 R2 and kw(L) k22 ≤ mL cδ . Here, define that √ ⊤ (L) W1,: = mL β (L) , b(L) = (boL (1)). 17 T. S UZUKI Note that the model (15) can be rewritten as f˜L∗ [FL−1 ](x, 1) = mL X (L) (L) (L) (L) √ W1,j η( mL −1 wj FL−1 (x, vj )) + b1 . j=1 Because of Proposition 2 and Assumption 1, the norms of the weight W (L) and the bias b(L) are bounded as (L) kW (L) kF = kW1,: k2 ≤ √ c1 R, kb(L) k2 = |bL | ≤ Rb . (16) By the Cauchy-Schwartz inequality and the Lipschitz continuity of η, we have that ′ |f˜L∗ [FL−1 ](x, 1) − f˜L∗ [FL−1 ](x, 1)| m L X (L) √ −1 (L) √ (L) (L) (L) ′ ≤| W1,j (η( mL wj FL−1 (x, vj )) − η( mL −1 wj FL−1 (x, vj )))| j=1 (L) (L) (L) (L) √ ′ L (x, vj )))m ≤ kW1,: k2 mL −1 k(wj (FL−1 (x, vj ) − FL−1 j=1 k2 (L) √ (L) (L) ′ L ≤ kW1,: k2 mL −1 kw(L) k2 k(FL−1 (x, vj ) − FL−1 (x, vj ))m j=1 kmax p p (L) (L) ′ L ≤ c1 R2 cδ mL /mL k(FL−1 (x, vj ) − FL−1 (x, vj ))m j=1 kmax √ (L) (L) ′ L = c1 cδ Rk(FL−1 (x, vj ) − FL−1 (x, vj ))m j=1 kmax , ′ for FL−1 , FL−1 : TbL × Rdx → R. Moreover, Proposition 2 ensures that β (L) and w(L) can be taken so that o o kf˜L∗ [FL−1 ](·, 1) − fLo [FL−1 ](·, 1)k2L2 (P (X)) ≤ c0 λL R2 . Hereinafter, we fix β (L) and w(L) so that this inequality and the norm bound (16) are satisfied. Step 2 (internal layers for ℓ = 2, . . . , L−1). As for the ℓ-th internal layer, we consider the following approximation: (ℓ+1) )= f˜ℓ∗ [g](vi mℓ X √ (ℓ+1) (ℓ) √ (ℓ) (ℓ) ), mℓ βi,j η( mℓ −1 wj g(vj )) + boℓ (vi j=1 (ℓ) for g : Tbℓ → R with β (ℓ) ∈ Rmℓ+1 ×mℓ and w(ℓ) ∈ Rmℓ satisfying kβj,: k22 ≤ m1ℓ c1 R2 (∀j = 1, . . . , mℓ+1 ) and kw(ℓ) k22 ≤ mℓ cδ . Then, the Lipschitz continuity of f˜ℓ∗ can be shown as (ℓ+1) |f˜ℓ∗ [Fℓ−1 ](x, vi ≤ mℓ X √ j=1 (ℓ) (ℓ+1) ′ ) − f˜ℓ∗ [Fℓ−1 ](x, vi )| √ √ (L) (ℓ) (ℓ) (ℓ) (ℓ) ′ (x, vj ))) mℓ βi,j (η( mℓ −1 wj Fℓ−1 (x, vj )) − η( mℓ −1 wj Fℓ−1 (ℓ) (ℓ) ′ ℓ (x, vj ))m ≤ kβi,: k2 kw(ℓ) k2 k(Fℓ−1 (x, vj ) − Fℓ−1 j=1 kmax r c1 √ (ℓ) (ℓ) ′ ℓ R cδ mℓ k(Fℓ−1 (x, vj ) − Fℓ−1 (x, vj ))m ≤ j=1 kmax mℓ 18 FAST L EARNING R ATE OF D EEP L EARNING = √ (ℓ) (ℓ) ′ L (x, vj ))m c1 cδ Rk(Fℓ−1 (x, vj ) − Fℓ−1 j=1 kmax , (ℓ+1) ∈ Tb(ℓ+1) . Proposition 2 asserts that there exit β (ℓ) and w(ℓ) that give an upper bound for any vi of the approximation error of the ℓ-th layer as o o max kf˜ℓ∗ [Fℓ−1 ](·, vjℓ+1 ) − fℓo [Fℓ−1 ](·, vjℓ+1 )k2L2 (P (X)) ≤ c0 λℓ R2 . j=1,...,mℓ Finally, let (ℓ) Wij = r 1 mℓ (ℓ) (ℓ+1) (ℓ) (ℓ+1) o (ℓ+1) (ℓ+1) o (ℓ+1) ⊤ b (vmℓ+1 )) , ), . . . , wm βij wi , b =√ (w bℓ (v1 ℓ+1 ℓ mℓ+1 mℓ+1 1 then, by Assumption 1 and Proposition 2, the norms of these quantities can be bounded as kW (ℓ) k2F mℓ+1 mℓ mℓ X X (ℓ)2 (ℓ+1)2 = βij wi mℓ+1 ≤ i=1 j=1 mℓ+1 mℓ X (ℓ+1)2 c1 R2 wi mℓ+1 mℓ i=1 ≤ c1 cδ R2 , and kb(ℓ) k22 mℓ+1 1 X (ℓ+1) 2 2 Rb ≤ cδ Rb2 . w ≤ mℓ+1 j=1 Step 3 (the first layer, ℓ = 1). For the first layer, let (2) f˜∗ (x, vi ) = dx X (2) (2) ho1 (vi , j)Q1 (j)xj + bo1 (vi ) j=1 (2) for vi ∈ Tb2 . By the definition of f o , it holds that (2) (2) f˜∗ (x, vi ) = f o (x, vi ). (2) (2) √1 (Q1 (j)w ho (v , j))i,j 1 i i m2 (2) (2) √1 (w bo (1), . . . , wm2 bo (m2 ))⊤ ∈ Rm2 . Then, by 1 1 1 m2 Let W (1) = ∈ Rm2 ×dx and dx m2 X X 1 (2) 2 o (2) 2 w h1 (vi , j) Q1 (j)2 = m2 i i=1 j=1   ! m2 dx X X 1 (2) 2 (2) ≤ max  ho1 (vi , j)2 Q1 (j)2  w 1≤i≤m2 m2 i i=1 j=1 19 = Assumption 1 and Proposition 2, it holds that kW (1) k2F b(1) T. S UZUKI  ≤cδ max  1≤i≤m2 and kb(1) k22 dx X j=1  (2) ho1 (vi , j)2 Q1 (j) ≤ cδ R2 , m2 1 X (2) 2 wi Rb2 ≤ cδ Rb2 . ≤ m1 i=1 Step 4. Finally, we combine the results we have obtained above. Note that o ∗ kfLo ◦ fL−1 ◦ · · · ◦ f1o − f˜L∗ ◦ f˜L−1 ◦ · · · ◦ f˜1∗ kL2 (P (X)) =kf o ◦ f o ◦ · · · ◦ f o − f˜∗ ◦ f o ◦ · · · ◦ f o L L−1 1 L L−1 1 .. . ∗ o ∗ o + f˜L∗ ◦ · · · ◦ f˜ℓ+1 ◦ fℓo ◦ fℓ−1 ◦ · · · ◦ f1o − f˜L∗ ◦ · · · ◦ f˜ℓ+1 ◦ f˜ℓ∗ ◦ fℓ−1 ◦ · · · ◦ f1o .. . ∗ ˜ + f ◦ · · · f˜∗ ◦ f o − f˜∗ ◦ · · · f˜∗ ◦ f˜∗ kL (P (X)) L ≤ L X ℓ=1 2 1 L 2 1 2 o ∗ ∗ o ◦ · · · ◦ f1o kL2 (P (X)) . ◦ f˜ℓ∗ ◦ fℓ−1 ◦ · · · ◦ f1o − f˜L∗ ◦ · · · ◦ f˜ℓ+1 kf˜L∗ ◦ · · · ◦ f˜ℓ+1 ◦ fℓo ◦ fℓ−1 Then combining the argument given above, we have o ∗ o ∗ ◦ · · · ◦ f1o kL2 (P (X)) ◦ f˜ℓ∗ ◦ fℓ−1 ◦ · · · ◦ f1o − f˜L∗ ◦ · · · ◦ f˜ℓ+1 ◦ fℓo ◦ fℓ−1 kf˜L∗ ◦ · · · ◦ f˜ℓ+1 q p p √ ≤( c1 cδ R)L−ℓ ( c0 λℓ R) = (c1 cδ )L−ℓ c0 RL−ℓ+1 λℓ , for ℓ = 2, . . . , L. And the right hand side is 0 for ℓ = 1. This yields that kf − f˜∗ kL2 (P (X)) ≤ o L X R L−ℓ+1 ℓ=2 q (c1 cδ )L−ℓ c0 p λℓ . By substituting W (ℓ) and b(ℓ) for ℓ = 1, . . . , L defined above into the definition of f ∗ , then it is easy to see that f ∗ = f˜∗ as a function. Then, we obtain the assertion. A.2 Bounding the L∞ -norm The next lemma shows the L∞ -norm of the true function f o and that of f ∈ F. This gives the L∞ -norm bound of every f ∈ F in Lemma 1 and thus that of f ∗ in Theorem 1 because f ∗ ∈ F. 20 FAST L EARNING R ATE OF D EEP L EARNING Lemma 3 Under Assumptions 1, 2 and 3, the L∞ -norms of f o and that of f ∈ F are bounded as o L kf k∞ ≤ R Dx + L X RL−ℓ Rb , ℓ=1 L X√ √ kf k∞ ≤ ( c1 cδ )L RL Dx + ( c1 cδ R)L−ℓ R̄b . ℓ=1 Proof Suppose that o kFℓ−1 (x, ·)kL2 (Qℓ ) ≤ G. Then, Fℓo can be bounded inductively: for all τ ∈ Tℓ+1 |Fℓo (x, τ )| = ≤ Z o h◦ℓ (τ, w)η(Fℓ−1 (x, w))dQℓ (w) + boℓ (τ ) Tℓ o (x, ·)kL2 (Qℓ ) + |boℓ (τ )| kh◦ℓ (τ, ·)kL2 (Qℓ ) kFℓ−1 ≤ RG + Rb , by Assumption 1. Similarly, as for ℓ = 1, it holds that, for all τ ∈ T2 and x ∈ Rdx , |f1o (x, τ )| = | ≤| ≤ dx X i=1 dx X h◦1 (τ, i)xi Q1 (i) + bo1 (τ )| h◦1 (τ, i)xi Q1 (i)| + |bo1 (τ )| i=1 kh◦1 (τ, ·)kL2 (Q1 ) kxkL2 (Q1 ) + Rb ≤ RDx + Rb . Applying the same argument recursively, we have kf o k∞ ≤ RL Dx + L X RL−ℓ Rb . ℓ=1 We can bound the L∞ -norm of any f ∈ F through a similar argument. Note that W (ℓ) satisfies √ √ kW (ℓ) kF ≤ c1 cδ R for ℓ = 1, . . . , L − 1, W (L) satisfies kW (L) kF ≤ c1 R, and b(ℓ) satisfies √ kb(ℓ) k2 ≤ cδ Rb by its construction. Therefore, though a similar argument to the bound for f o , we have that "L−1 # Y √ √ √ kf k∞ ≤ c1 R cδ RDx ( c1 cδ R) ℓ=2 + L−2 X ℓ=1 √ c1 R " L−1 Y ℓ′ =ℓ+1 # ! √ √ √ √ √ cδ Rb + c1 R cδ Rb + cδ Rb ( c1 cδ R) 21 T. S UZUKI ≤ (c1 cδ )L/2 RL Dx + L X √ ( c1 cδ R)L−ℓ R̄b . ℓ=1 Appendix B. Bounding the posterior contraction rate In this section, we prove Theorem 3. The proof is divided into two parts: posterior pPn contraction 2 rate with respect to the in-sample error (i.e., the empirical L2 -norm kf kn = i=1 f (xi ) /n) and that with respect to the out-of-sample error (i.e., the population L2 -norm kf kL2 (P (X)) = qR f (X)2 dP (X)). Here, let ǫn = δ̂1,n + σ δ̂2,n , ǫ̃n = δ̂1,n + δ̂2,n . B.1 In-sample error Here we show the in-sample error bound. Let Xn = (x1 , . . . , xn ), Yn = (y1 , . . . , yn ) and Dn = (Xn , Yn ). For given Xn , the probability distribution of Yn associated with a function f (i.e., yi = f (xi ) + ǫi ) is denoted by Pn,f . The expectation of a function h of Yn with respect to Pn,f is denoted by Pn,f (h). The density function of Pn,f with respect to Yn is denoted by pn,f . For r̃ ≥ 1, let Ar̃ be the event such that Z pn,f (Yn ) Π(df ) ≥ exp(−nǫ̃2n r̃ 2 /σ 2 )Π(f : kf − f ∗ k∞ ≤ δ̂2,n r̃). pn,f o (Yn ) The probability of this event is bounded by Lemma 4. Using a test function φn defined later (here, a test function is a measurable function of Dn that takes its value in [0, 1]), we decompose the expected posterior mass as h i √ E Π(kf − f o kn ≥ 2ǫn r|Dn ) ≤E [φn ] + P (Ar̃c ) + E[(1 − φn )1Ar̃ Π(f ∈ F c |Dn )] + E[(1 − φn )1Ar̃ Π(f ∈ F : kf − f o k2n ≥ 2ǫr 2 |Dn )] =:An + Bn + Cn + Dn , (17) for ǫn > 0 where the expectation is taken with respect to Dn = (Xn , Yn ) distributed from the true distribution. We give an upper bound of An , Bn , Cn and Dn in the following. Step 1. √ For arbitrary r ′ > 0, define Cr′ = {f ∈ F | r ′ ≤ nkf − f o kn /σ}. We construct a maximum √ cardinality set Θr′ ⊂ Cr′ such that each f, f ′ ∈ Θr′ satisfies nkf − f ′ kn /σ ≥ r ′ /2. Here we denote by D(ǫ, F, k · k) the ǫ-packing number of a normed space F attached with a norm k · k. 22 FAST L EARNING R ATE OF D EEP L EARNING √ Then, the cardinality of Θr′ is equal to D(r ′ /2, Cr′ , nk · kn /σ). Then, following Lemma 13 of van der Vaart and van Zanten (2011), one can construct a test φ̃r′ such that √ √ 1 ′2 1 ′2 Pn,f o φ̃r′ ≤ 9D(r ′ /2, Cr′ , nk · kn /σ)e− 8 r ≤ 9D(r ′ /2, F, nk · kn /σ)e− 8 r , 1 ′2 sup Pn,f (1 − φ̃r′ ) ≤ e− 8 r , f ∈Cr ′ for any r ′ > 0. √ √ Substituting 2 nǫn r/σ into r ′ and denoting φn = φ̃√2√nǫn r/σ , we obtain 1 2 2 +log(D(r ′ /2,F , Pn,f o φn ≤ 9e− 4σ2 nǫn r sup f ∈C2√2√nǫn r − 12 nǫ2n r 2 4σ Pn,f (1 − φn ) ≤ e √ nk·kn /σ)) . (18) (19) √ Hence, we just need to evaluate the (log-)packing number log(D(r ′ /2, F, nk · kn /σ)) where √ r ′ = 2nǫn r/σ. It is known that the packing number is bounded from above by the internal covering number4 , and the packing number of unit ball in d-dimensional Euclidean space and that of the covering number is bounded as D(ǫ, Bd (1), k · k) ≤ N (ǫ, Bd (1), k · k) ≤  4+ǫ ǫ d . Based on this we evaluate the packing number of F. Let f, f ′ ∈ F be two functions corresponding to parameters (W (ℓ) , b(ℓ) )L ℓ=1 and ′(ℓ) ′(ℓ) L (ℓ) ′(ℓ) (ℓ) ′(ℓ) (W , b )ℓ=1 . Notice that if kW − W kF ≤ ǫ and kb − b k ≤ ǫ, then kf − f ′ k∞ ≤ LǫR̄L−1 Dx + L X ǫR̄L−ℓ = ǫ(LR̄L−1 Dx + ℓ=1 L X R̄L−ℓ ). (20) ℓ=1 Therefore, if ǫ ≤ δ/Ĝ where Ĝ = (LR̄L−1 Dx + L X R̄L−ℓ ), ℓ=1 then kf − f ′ k∞ ≤ δ. Hence, the packing number of the function space F can be bounded by using that of the parameter space as √ √ √ log(D(r ′ /2, F, nk · kn /σ)) = log(D(r ′ /2, F, nk · kn /σ)) ≤ log(D(σr ′ /(2 n), F, k · k∞ )) √ ≤ log(N (σr ′ /(2 n), F, k · k∞ )) ≤ L X ℓ=1 L X √ √ log(N (σr /(2 nĜ), Bmℓ+1 ×mℓ (R̄), k · k)) + log(N (σr ′ /(2 nĜ), Bmℓ (R̄b ), k · k)) ′ ℓ=1 4. The ǫ-internal covering number of a (semi)-metric space (T, d) is the minimum cardinality of a finite set such that every element in T is in distance ǫ from the finite set with respect to the metric d. We denote by N (ǫ, T, d) the ǫ-internal covering number of (T, d). 23 T. S UZUKI ≤ L X ℓ=1  mℓ+1 mℓ log   σr ′ √ 2 nĜR̄  σr ′ √ 2 nĜR̄ 4+ + L X ℓ=1  mℓ log  σr ′ √ 2 nĜR̄b σr ′ √ 2 nĜR̄b 4+   ! ! √ √ L L X X 4 2ĜR̄ 4 2ĜR̄b = mℓ+1 mℓ log 1 + + . mℓ log 1 + ǫn r ǫn r ℓ=1 (21) ℓ=1 Therefore, by Eq. (18), we have that " ! !# √ √ L L X X 1 4 4 2 Ĝ R̄ 2 Ĝ R̄ b An ≤ 9 exp − 2 nǫ2n r 2 + + . mℓ log 1 + mℓ+1 mℓ log 1 + 4σ ǫn r ǫn r ℓ=1 ℓ=1 Step 2. Here, we evaluate Bn . It can be evaluated by Lemma 4 as 2 2 Bn ≤ exp(−nǫ̃2n r̃ 2 /(8σ 2 )) + exp(−nδ̂1,n (r̃ 2 − 1)2 /(11R̂∞ )). Step 3. Since F is the support of the prior distribution, it is obvious that Cn = 0. Step 4. Here, we evaluate Dn . Remind that Dn is defined as i h √ Dn = EXn Pn,f o [Π(f ∈ F : kf − f o kn > 2ǫr|Yn )(1 − φn )1Ar̃ ] . Define Ξn (r̃) := − log(Π(f : kf − f ∗ k∞ ≤ δ̂2,n r̃)) for r̃ > 0. Then, Dn can be bounded as ( "R #) √ 1{f : kf − f o kn > 2ǫr}pn,f dΠ(f ) F R Dn = EXn Pn,f o (1 − φn )1Ar̃ F pn,f dΠ(f ) √ ( "R #) pn,f o dΠ(f ) 2ǫr} pn,f o F 1{f : kf − f kn > R pn,f = EXn Pn,f o (1 − φn )1Ar̃ F pn,f o dΠ(f ) #) ( "Z 2 2 2 pn,f /pn,f o dΠ(f ) exp(nǫ̃n r̃ /σ + Ξn (r̃))(1 − φn )1Ar̃ ≤ EXn Pn,f o √ = E Xn ≤ exp (Z  f ∈F :kf −f o kn > 2ǫr √ f ∈F :kf −f o kn > 2ǫr Pn,f [(1 − nǫ2n r 2 nǫ̃2n r̃ 2 + Ξ (r̃) − n σ2 4σ 2  φn )1Ar̃ ] exp(nǫ̃2n r̃ 2 /σ 2 . By using the relation (20), the prior mass Ξn (r̃) can be bounded as Ξn (r̃) = − log(Π(f : kf − f ∗ k∞ ≤ δ̂2,n r̃)) 24 ) + Ξn (r̃))dΠ(f ) FAST L EARNING R ATE OF D EEP L EARNING ≤ − log(Π(f : kf − f ∗ k∞ ≤ δ̂2,n )) ≤− − ≤ L X ℓ=1 L X ℓ=1 L X log(Π(W (ℓ) : kW (ℓ) − W ∗(ℓ) kF ≤ δ̂2,n /Ĝ)) log(Π(b(ℓ) : kb(ℓ) − b∗(ℓ) k2 ≤ δ̂2,n /Ĝ)) mℓ mℓ+1 log(R̄Ĝ/(δ̂2,n /2)) + L X mℓ log(R̄b Ĝ/(δ̂2,n /2)). (22) ℓ=1 ℓ=1 Step 5. Finally, we combine the results obtained above. h i √ E Π(kf − f o kn ≥ 2ǫn r|Yn ) " ! !# √ √ L L X X 1 4 2ĜR̄b 4 2ĜR̄ 2 2 ≤9 exp − 2 nǫn r + mℓ log 1 + + mℓ+1 mℓ log 1 + 4σ ǫn r ǫn r ℓ=1 ℓ=1 2 2 + exp(−nǫ̃2n r̃ 2 /(8σ 2 )) + exp(−nδ̂1,n (r̃ 2 − 1)2 /(11R̂∞ ))   nǫ2n r 2 n 2 2 ǫ̃ r̃ + Ξ (r̃) − . + exp n n σ2 4σ 2 (23) Now, let 1 ≤ r̃ ≤ r. Then, since ǫn ≥ δ̂2,n and r ≥ 1, we have that ! ! ( !) √ √ 4 2ĜR′ 4 2ĜR′ 2ĜR′ , log 1 + , max log ≤ log 1 + ǫn r δ̂2,n δ̂2,n for all R′ > 0. Now, we set δ̂2,n to satisfy ! ! √ √ L L 2 X X nδ̂2,n 4 2ĜR̄ 4 2ĜR̄b ≥ mℓ mℓ+1 log 1 + + (≥ Ξn (r̃)), mℓ log 1 + σ2 δ̂ δ̂ 2,n 2,n ℓ=1 ℓ=1 which can be satisfied by 2 δ̂2,n  √ √ 4 2Ĝ max{R̄, R̄b } n  qP = . mℓ mℓ+1 log+ 1 + n L σ m m ℓ=1 ℓ=1 ℓ ℓ+1 2σ 2 L X  2 ≤ nǫ̃2 and Eq. (22), the RHS of Eq. (23) is upper bounded by Then, by noticing nδ̂2,n n   n 2 2 nǫ2n r 2 2 2 2 2 2 2 2 exp(−nǫ̃n r̃ /(8σ )) + exp(−nδ̂1,n (r̃ − 1) /(11R̂∞ )) + 10 exp 2 2 ǫ̃n r̃ − . σ 4σ 2 Here, by setting r 2 = 12r̃ 2 ≥ 12, then the RHS is further bounded as 2 2 exp(−nδ̂1,n (r̃ 2 − 1)2 /(11R̂∞ )) + exp(−nǫ̃2n r̃ 2 /(8σ 2 )) + 10 exp(−nǫ2n r̃ 2 /σ 2 ) h i 2 2 ≤ exp −nδ̂1,n (r̃ 2 − 1)2 /(11R̂∞ ) + 11 exp(−nǫ2n r̃ 2 /(8σ 2 )). 25 (24) T. S UZUKI Lemma 4 Then, for any r̃ > 1, it holds that PDn Z  pn,f (Yn ) Π(df ) ≥ exp(−nǫ̃2n r̃ 2 /σ 2 )Π(f : kf − f ∗ k∞ ≤ δ̂2,n r̃) pn,f o (Yn ) 2 2 ≥ 1 − exp(−nǫ̃2n r̃ 2 /(8σ 2 )) − exp(−nδ̂1,n (r̃ 2 − 1)2 /(11R̂∞ )). Proof Note that Lemma 14 of van der Vaart and van Zanten (2011) showed that PYn |Xn Z  pn,f (Yn ) 2 2 2 o Π(df ) ≥ exp(−nǫ̃n r̃ /σ )Π(f : kf − f kn ≤ ǫ̃n r̃) ≥ 1−exp(−nǫ̃2n r̃ 2 /(8σ 2 )). pn,f o (Yn ) where PYn |Xn represents the conditional distribution of Yn = (yi )ni=1 conditioned by Xn = (xi )ni=1 . Therefore the proof is reduced to show kf − f o kn ≤ δ̂1,n r̃ + kf − f ∗ k∞ with high probability. Note that kf − f o kn ≤ kf − f ∗ kn + kf ∗ − f o kn ≤ kf − f ∗ k∞ + kf ∗ − f o kn . Hence, we just need to show kf ∗ − f o kn ≤ r̃kf ∗ − f o kL2 (P (X)) ≤ r̃δ̂1,n with high probability. This can be shown by Bernstein’s inequality: P √  1 + r̃ ′ kf ∗ − f o kL2 (P (X)) ≤ kf ∗ − f o kn ≤ exp − nr̃ ′2 kf ∗ − f o k4L2 (P (X)) 2(v + kf ∗ − f o k2∞ kf ∗ − f o k2L2 (P (X)) /3) where v = EX [((f ∗ (X) − f o (X))2 − kf ∗ − f o k2L2 (P (X)) )2 ]. Now v ≤ EX [(f ∗ (X) − f o (X))4 ] ≤ kf ∗ − f o k2∞ kf ∗ − f o k2L2 (P (X)) = kf ∗ − f o k2∞ kf ∗ − f o k2L2 (P (X)) . This yields that P √ ∗ o ∗ o 1 + r̃ ′ kf − f kL2 (P (X)) ≤ kf − f kn  " 3nr̃ ′2 ≤ exp − 8  kf ∗ − f o kL2 (P (X)) kf ∗ − f o k∞ 2 # . (25) Since kf ∗ − f o k∞ ≤ 2R̂∞ and kf ∗ − f o kL2 (P (X)) ≤ δ̂1,n , the RHS is further bounded by   2 3nr̃ ′2 δ̂1,n exp − 32R̂2 . ∞   2 r̃ ′2 3nδ̂1,n , it holds that Therefore, with probability 1 − exp − 32R̂2 ∞ kf − f o kn ≤ kf − f ∗ k∞ + √ 1 + r̃ ′ kf ∗ − f o kL2 (P (X)) ≤ kf − f ∗ k∞ + for all f such that kf k∞ < ∞. Thus by setting r̃ ′ so that r̃ = 26 √ √ 1 + r̃ ′ δ̂1,n 1 + r̃ ′ , we obtain the assertion. ! , FAST L EARNING R ATE OF D EEP L EARNING B.2 Out of sample error Now, we are going to show the posterior contraction rate with respect to the out-of-sample predictive error:   EDn Π(f : kf − f o kL2 (P (X)) ≥ ǫn r|Dn ) , (26) for sufficiently large r ≥ 1. To bound the posterior tail, we divide that into four parts:   I = EDn 1Ar̃c , i h √ II = EDn 1Ar̃ Π(f : 2kf − f o kn > ǫn r, kf k∞ ≤ R̂∞ | Dn ) , h i √ III = EDn 1Ar̃ Π(f : kf − f o kL2 (P (X)) > ǫn r ≥ 2kf − f o kn , kf k∞ ≤ R̂∞ | Dn ) , h i IV = EDn 1Ar̃ Π(f : kf k∞ > R̂∞ | Dn ) . The term I and II are already evaluated in Section B.1, that is, I + II is bounded by the right hand side of Eq. (17) which is what we have upper bounded in Section B.1. The term III is bounded as follows. To bound this, we need to evaluate the difference between the empirical norm kf − f o kn and the expected norm kf − f o kL2 (P (X)) , which can be done by Bernstein’s inequality. Following the same argument to derive Eq. (25), it holds that  o P kf − f kL2 (P (X)) ≥ √ o  2kf − f kn ≤ exp − nkf − f o k2L2 (P (X)) 2 11R̂∞ ! . Therefore, we arrive at the following bound of III: " III ≤ EXn Pn,f o ≤ "Z exp(nǫ̃2n r̃ 2 /σ 2 ≤ exp ≤ exp √ f ∈F :kf −f o kL2 (P (X)) >ǫn r≥ 2kf −f o kn + Ξn (r̃)) Z f ∈F :kf −f o kL2 (P (X)) >ǫn r nǫ̃2n r̃ 2 nǫ2n r 2 + Ξ (r̃) − n 2 σ2 11R̂∞ ! 2nǫ̃2n r̃ 2 nǫ2n r 2 . − 2 σ2 11R̂∞ ! # pn,f /pn,f o dΠ(f ) exp(nǫ̃2n r̃ 2 /σ 2 + Ξn (r̃))1Ar̃ P (kf − f o kL2 (P (X)) ≥ √ # 2kf − f o kn )dΠ(f ) Finally, since all f ∈ F satisfies kf k∞ ≤ R̂∞ , IV = 0. Combining the results we arrive at h i    2 2 EDn Π(f : kf − f o kL2 (P (X)) ≥ ǫn r|Dn ) ≤ exp −nδ̂1,n (r̃ 2 − 1)2 /(11R̂∞ ) + 12 exp −nǫ̃2n r̃ 2 /(8σ 2 ) , 2 /σ 2 }r̃ 2 . This concludes the proof of Theorem 3. for all r̃ ≥ 1 and r ≥ max{12, 33R̂∞ 27 T. S UZUKI Appendix C. Convergence rate for the empirical risk minimizer Proposition 3 (Gaussian concentration inequality (Theorem 2.5.8 in Giné and Nickl (2015))) Let (ξi )ni=1 be i.i.d. Gaussian sequence with mean 0 and variance σ 2 , and (xi )ni=1 ⊂ X be a given set of input variables. Then, Pn for1 a set F̃ of functions from X to R which is separable with respect to L∞ -norm and supf ∈F̃ i=1 n ξi f (xi ) < ∞ almost surely, it holds that for every r > 0, P # ! " n n X 1 1X ξi f (xi ) ≥ E sup ξi f (xi ) + r ≤ exp[−nr 2 /2(σkF̃ kn )2 ] sup n n f ∈F̃ f ∈F̃ i=1 i=1 where kF̃k2n = supf ∈F̃ 1 n Pn 2 i=1 f (xi ) . Here the probability is taken with respect to (ξi )ni=1 . Remind that every f ∈ F satisfies kf kn ≤ kf k∞ ≤ R̂∞ . Hence kFkn ≤ R̂∞ . For an observation (xi )ni=1 , let Gδ = {f − f ∗ | kf − f ∗ kn ≤ δ, f ∈ F}. It is obvious that Gδ is separable with respect to L∞ -norm. Then, by the Gaussian concentration inequality, we have that # ! " n n X 1 1X P sup ξi f (xi ) ≥ E sup ξi f (xi ) + r ≤ exp[−nr 2 /2(σδ)2 ] n f ∈Gδ f ∈Gδ n i=1 i=1 √ √ for every r > 0. By applying this inequality for δj = 2j−1 σ/ n for j = 1, . . . , ⌈log 2 (R̂∞ n/σ)⌉ and using the uniform bound, we can show that, for every r > 0, with probability √ ⌈log2 (R̂∞ n/σ)⌉ exp[−nr 2 /2σ 2 ], it holds that any f ∈ Gδ uniformly satisfies # " n n X 1 1X ξi (f (xi ) − f ∗ (xi )) ≥ E sup ξi f (xi ) + 2δr n f ∈G2δ n i=1 i=1 √ where δ is any positive real satisfying δ ≥ σ/ n and f ∈ Gδ . Lemma 5 There exists a universal constant C such that for any δ it holds that v # ! " u PL n u 4Ĝ max{R̄, R̄b } 1X ℓ=1 mℓ mℓ+1 t . ξi f (xi ) ≤ Cσδ log+ 1 + E sup n δ f ∈G2δ n i=1 P Proof Since f 7→ √1n ni=1 ξi f (xi ) is a sub-Gaussian process relative to the metric k · kn . By the chaining argument (see, for example, Theorem 2.3.6 of Giné and Nickl (2015)), it holds that " # n √ σ Z 2δ p 1X E sup ξi f (xi ) ≤ 4 2 √ log(2N (ǫ, G2δ , k · kn ))dǫ. n 0 f ∈G2δ n i=1   PL m m R̄,R̄b } , the Since log N (ǫ, G2δ , k · kn ) ≤ log N (ǫ, F, k · k∞ ) ≤ 2 ℓ=1 n ℓ ℓ+1 log 1 + 4Ĝ max{ ǫ right hand side is bounded by v ! PL Z 2δ u Z 2δ p u m m 4 Ĝ max{ R̄, R̄ } ℓ ℓ+1 b tlog(2) + 2 ℓ=1 log(2N (ǫ, F, k · kn ))dǫ ≤ dǫ log 1 + n ǫ 0 0 28 FAST L EARNING R ATE OF D EEP L EARNING v u PL u mℓ mℓ+1 log+ ≤ Cδt ℓ=1 n ! 4Ĝ max{R̄, R̄b } 1+ , δ where C is a universal constant. This gives the assertion. Therefore, by substituting δ ← lowing inequality holds:  kf − f ∗ kn ∨σ q PL ℓ=1 mℓ mℓ+1 n  √ and r ← σr/ n, the fol- n 1X − ξi (f (xi ) − f ∗ (xi )) n i=1 s  v   uP PL √ u L 2 σ mℓ mℓ+1 4 nĜ max{R̄, R̄b }  ℓ=1 mℓ mℓ+1  u log+ 1 + qP ≤ Cσ kf − f ∗ kn ∨ t ℓ=1 n n L σ ℓ=1 mℓ mℓ+1 s   P σ2 L ∗ ℓ=1 mℓ mℓ+1  √r  + 2 kf − f kn ∨ σ n n s  2 PL 2 σ m m 1 ℓ=1 ℓ ℓ+1  kf − f ∗ kn ∨ ≤ 4 n ! ! PL √ 2 m m r 4 n Ĝ max{ R̄, R̄ } b ℓ=1 ℓ ℓ+1 +4 , log+ 1 + + 2C 2 σ 2 n σ n √ uniformly for all f ∈ F with probability 1 − ⌈log2 (R̂∞ n/σ)⌉ exp[−r 2 /2]. Here let     PL √ 2 mℓ mℓ+1 r 4 nĜ max{R̄, R̄b }  Ψr,n := 2C 2 σ 2  ℓ=1 log+ 1 + qP + 4 . n n L σ ℓ=1 mℓ mℓ+1 Remind that the empirical risk minimizer in the model F is denoted by fb: fb := argmin f ∈F n X (yi − f (xi ))2 . i=1 Since fb minimizes the empirical risk, it holds that n n i=1 i=1 1X 1X (yi − fb(xi ))2 ≤ (yi − f ∗ (xi ))2 n n n 2X yi (f ∗ (xi ) − fb(xi )) + kfbk2n − kf ∗ k2n ≤ 0 ⇒ n i=1 n 2X (ξi + f o (xi ))(f ∗ (xi ) − fb(xi )) + kfbk2n − kf ∗ k2n ≤ 0 ⇒ n i=1 29 T. S UZUKI n n i=1 i=1 2X 2X o ⇒ ξi (f ∗ (xi ) − fb(xi )) + f (xi )(f ∗ (xi ) − fb(xi )) + kfbk2n − kf ∗ k2n ≤ 0 n n n 2X ξi (f ∗ (xi ) − fb(xi )) + kfb − f o k2n ≤ kf ∗ − f o k2n . ⇒ n i=1 Therefore, we have s  2 PL 2 σ m m 1 b ℓ=1 ℓ ℓ+1  − kf − f ∗ kn ∨ − Ψr,n + kfb − f o k2n ≤ kf ∗ − f o k2n . 4 n Let us assume kfb − f ∗ k2n ≥ σ2 PL ℓ=1 mℓ mℓ+1 n . Then, by Eq. (27), we have 1 − kfb − f ∗ k2n − Ψr,n + kfb − f o k2n ≤ kf ∗ − f o k2n 4 1 1 b ⇒ − kf − f ∗ k2n − Ψr,n + kfb − f ∗ k2n − kf ∗ − f o k2n ≤ kf ∗ − f o k2n 4 2 1 b ∗ 2 ∗ o 2 ⇒ kf − f kn ≤ 2kf − f kn + Ψr,n . 4 σ2 Otherwise, we trivially have kfb − f ∗ k2n < Combining the inequalities, it holds that (27) PL (28) mℓ mℓ+1 . n ℓ=1 kfb − f ∗ k2n ≤ 8kf ∗ − f o k2n + 4Ψr,n + σ2 PL ℓ=1 mℓ mℓ+1 n . (29) Based on this inequality, we derive a bound for kfb − f ∗ kL2 (P (X)) instead of the empirical L2 -norm kfb − f ∗ kn . Proposition 4 (Talagrand’s concentration inequality (Talagrand, 1996; Bousquet, 2002)) Let (xi )ni=1 be an i.i.d. sequence of input variables in X . Then, for a set F̃ of functions from X to R which is separable with respect to L∞ -norm and kf k∞ ≤ R̃ for all f ∈ F̃, it holds that for every r > 0,   "  # s 2 2 n n  2 X X k F̃ k r 1 1 r R̃  L2 (P (X)) P  sup f (xi )2 − E[f 2 ] ≥ C E sup f (xi )2 − E[f 2 ] + +  f ∈F̃ n n n  f ∈F̃ n i=1 i=1 ≤ exp(−r) where kF̃ 2 k2L2 (P (X)) = supf ∈F̃ E[f (X)4 ]. Let Gδ′ = {f − f ∗ | kf − f ∗ kL2 (P (X)) ≤ δ, f ∈ F}. By the bound kf k∞ ≤ R̂∞ for all f ∈ F 2 δ 2 . Hence, (Lemma 3), kgk∞ ≤ 2R̂∞ for all g ∈ Gδ′ . Therefore, we have kGδ′2 k2L2 (P (X)) ≤ 4R̂∞ Talagrand’s concentration inequality yields that   " # s n n  2 2 2 X X 1 1 δ R̂∞ r r R̃  sup f (xi )2 − E[f 2 ] ≥ C1 E sup f (xi )2 − E[f 2 ] + +  f ∈G ′ n n n  f ∈Gδ′ n δ i=1 i=1 (30) with probability 1 − exp(−r) where C1 is a universal constant. 30 FAST L EARNING R ATE OF D EEP L EARNING Lemma 6 There exists a universal constant C > 0 such that, for all δ > 0, " # n 1X 2 2 E sup f (xi ) − E[f ] f ∈Gδ′ n i=1 v " ! u PL u m m 4 Ĝ max{ R̄, R̄ } ℓ ℓ+1 b ≤ C δR̂∞ t ℓ=1 log+ 1 + n δ !# PL 4 Ĝ max{ R̄, R̄ } m m b ℓ ℓ+1 2 ℓ=1 . log+ 1 + ∨ R̂∞ n δ Proof Let (ǫi )ni=1 be i.i.d. Rademacher sequence. Then, by the standard argument of Rademacher complexity, we have " # " # n n X 1 1X E sup f (xi )2 − E[f 2 ] ≤ 2E sup ǫi f (xi )2 f ∈Gδ′ n f ∈Gδ′ n i=1 i=1 (see, for example, Lemma 2.3.1 in van der Vaart and Wellner (1996)). Since kf k∞ ≤ 2R̂∞ for all f ∈ Gδ′ , the contraction inequality (Ledoux and Talagrand, 1991, Theorem 4.12) gives an upper bound of the RHS as # # " " n n X 1 1X ǫi f (xi )2 ≤ 4(2R̂∞ )E sup ǫi f (xi ) . 2E sup f ∈Gδ′ n f ∈Gδ′ n i=1 i=1 We further bound the RHS. By Theorem 3.1 in Giné and Koltchinskii (2006) or Lemma 2.3 of Mendelson (2002) with the covering number bound (21), there exists a universal constant C ′ such that " # n 1X E sup ǫi f (xi ) f ∈Gδ′ n i=1 " v ! u PL u m m 4 Ĝ max{ R̄, R̄ } ℓ ℓ+1 b ≤ C ′ δt ℓ=1 log+ 1 + n δ !# PL 4Ĝ max{R̄, R̄b } ℓ=1 mℓ mℓ+1 ∨ R̂∞ . log+ 1 + n δ This concludes the proof. Let Φn := PL mℓ mℓ+1 n  √ 4 nĜ max{R̄,R̄b } √PL R̂∞ ℓ=1 mℓ mℓ+1  . Then, applying the inequality (30) for log+ 1 + √ √ δ = 2j−1 R̂∞ / n for j = 1, . . . , ⌈log2 ( n)⌉, it is shown that there exists an event with probability √ 1 − ⌈log2 ( n)⌉ exp(−r) such that, uniformly for all f ∈ F, it holds that s   n 2 2 X p 1 R̂∞ r r R̂∞  2 (f (xi ) − f ∗ (xi ))2 − E[(f − f ∗ )2 ] ≤ C1 C(2δR̂∞ Φn ) ∨ (R̂∞ + Φn ) + δ n n n ℓ=1 i=1 31 T. S UZUKI δ2 R̂2 r 2 + 2C12 (2C 2 + 1)R̂∞ Φn + (C12 + C1 ) ∞ , 2 n P L 2 where δ is any positive real such that δ2 ≥ E[(f − f ∗ )2 ] and δ2 ≥ R̂∞ ℓ=1 mℓ mℓ+1 /n. The right hand side can be further bounded by ≤  r δ2 2 + C2 R̂∞ Φn + 2 n for an appropriately defined universal constant C2 . Applying this inequality for f = fb to Eq. (29) gives that  r 1 b 2 + 8kf ∗ − f o k2n + 4Ψr,n + Φn + kf − f ∗ k2L2 (P (X)) ≤ C2 R̂∞ 2 n 2 σ 2 + R̂∞ n ! L X mℓ mℓ+1 . ℓ=1 Finally, by the Bernstein’s inequality (25), the term kf ∗ − f o k2n is bounded as 2 kf ∗ − f o k2n ≤ (1 + r̃ ′ )kf ∗ − f o k2L2 (P (X)) ≤ (1 + r̃ ′ )δ̂1,n  with probability 1 − exp − 2 r̃ ′2 3nδ̂1,n 32R̂2∞  for every r̃ ′ > 0. Combining all inequalities, we obtain that L  2 )X r 2(σ 2 + R̂∞ ∗ 2 2 ′ 2 b kf − f kL2 (P (X)) ≤ 2C2 R̂∞ Φn + + 16(1 + r̃ )δ̂1,n + 4Ψr,n + mℓ mℓ+1 . n n ℓ=1 This gives a bound for the distance between fb and f ∗ . However, what we want is a bound on the distance from the true function f o to fb. This can be accomplished by noticing that 2 , kfb − f o k2L2 (P (X)) ≤ 2(kfb − f ∗ k2L2 (P (X)) + kf o − f ∗ k2L2 (P (X)) ) ≤ 2kfb − f ∗ k2L2 (P (X)) + 2δ̂1,n and conclude that L  2 )X 4(σ 2 + R̂∞ r ′ 2 o 2 2 b + (34 + 32r̃ )δ̂1,n + 8Ψr,n + mℓ mℓ+1 . kf − f kL2 (P (X)) ≤ 4C2 R̂∞ Φn + n n ℓ=1 More concisely, letting α(U ) := U 2 PL ℓ=1 mℓ mℓ+1 n   √ Ĝ max{R̄,R̄b } log+ 1 + 4 √nP , L U the right side is further upper bounded as ( " 2 + σ2) ( R̂ ∞ o 2 kfb − f kL2 (P (X)) ≤C3 α(R̂∞ ) + α(σ) + log+ n  with probability 1 − exp − 2 r̃ ′2 3nδ̂1,n 32R̂2∞  ℓ=1 mℓ mℓ+1 √ n min{σ/R̂∞ , 1} − 2 exp(−r) for every r > 0 and r̃ ′ > 0. 32 ! # + r + (1 + r̃ ′ 2 )δ̂1,n ) FAST L EARNING R ATE OF D EEP L EARNING References S. Amari. A theory of adaptive pattern classifiers. IEEE Transactions on Electronic Computers, (3):299–307, 1967. N. Aronszajn. Theory of reproducing kernels. Transactions of the American Mathematical Society, 68:337–404, 1950. F. Bach. On the equivalence between kernel quadrature rules and random feature expansions. arXiv preprint arXiv:1502.06800, 2015. F. Bach. Breaking the curse of dimensionality with convex neural networks. Journal of Machine Learning Research, 18(19):1–53, 2017. A. K. Balan, V. Rathod, K. P. Murphy, and M. Welling. Bayesian dark knowledge. In Advances in Neural Information Processing Systems 28, pages 3438–3446, 2015. P. Bartlett, O. Bousquet, and S. Mendelson. Local Rademacher complexities. The Annals of Statistics, 33:1487–1537, 2005. P. L. Bartlett. The sample complexity of pattern classification with neural networks: the size of the weights is more important than the size of the network. IEEE transactions on Information Theory, 44(2):525–536, 1998. P. L. Bartlett, V. Maiorov, and R. Meir. Almost linear VC-dimension bounds for piecewise polynomial networks. Neural Computation, 10(8):2159–2173, 1998. M. Bianchini and F. Scarselli. On the complexity of neural network classifiers: A comparison between shallow and deep architectures. IEEE transactions on neural networks and learning systems, 25(8):1553–1565, 2014. C. Blundell, J. Cornebise, K. Kavukcuoglu, and D. Wierstra. Weight uncertainty in neural network. In Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 1613–1622, 2015. O. Bousquet. A Bennett concentration inequality and its application to suprema of empirical process. Comptes Rendus de l’Académie des Sciences -Series I- Mathematics, 334:495–500, 2002. A. Caponnetto and E. de Vito. Optimal rates for regularized least-squares algorithm. Foundations of Computational Mathematics, 7(3):331–368, 2007. Y. Cho and L. K. Saul. Kernel methods for deep learning. In Advances in Neural Information Processing Systems 22, pages 342–350, 2009. N. Cohen and A. Shashua. Convolutional rectifier networks as generalized tensor decompositions. In Proceedings of the 33th International Conference on Machine Learning, volume 48 of JMLR Workshop and Conference Proceedings, pages 955–963, 2016. N. Cohen, O. Sharir, and A. Shashua. On the expressive power of deep learning: A tensor analysis. In Proceedings of the 29th Annual Conference on Learning Theory, pages 698–728, 2016. 33 T. S UZUKI G. Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of Control, Signals, and Systems (MCSS), 2(4):303–314, 1989. R. Eldan and O. Shamir. The power of depth for feedforward neural networks. In Proceedings of the 29th Annual Conference on Learning Theory, pages 907–940, 2016. K. Fukumizu. Generalization error of linear neural networks in unidentifiable cases. In International Conference on Algorithmic Learning Theory, pages 51–62. Springer, 1999. Y. Gal and Z. Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In Proceedings of the 33nd International Conference on Machine Learning, volume 48 of JMLR Workshop and Conference Proceedings, pages 1050–1059, 2016. S. Ghosal, J. K. Ghosh, and A. W. van der Vaart. Convergence rates of posterior distributions. The Annals of Statistics, 28(2):500–531, 2000. E. Giné and V. Koltchinskii. Concentration inequalities and asymptotic results for ratio type empirical processes. The Annals of Probability, 34(3):1143–1216, 2006. E. Giné and R. Nickl. Mathematical Foundations of Infinite-Dimensional Statistical Models. Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge University Press, 2015. X. Glorot, A. Bordes, and Y. Bengio. Deep sparse rectifier neural networks. In Proceedings of the 14th International Conference on Artificial Intelligence and Statistics, volume 15 of Proceedings of Machine Learning Research, pages 315–323, 2011. P. W. Goldberg and M. R. Jerrum. Bounding the Vapnik-Chervonenkis dimension of concept classes parameterized by real numbers. Machine Learning, 18(2-3):131–148, 1995. J. Hartigan et al. The maximum likelihood prior. The Annals of Statistics, 26(6):2083–2103, 1998. J. M. Hernandez-Lobato and R. Adams. Probabilistic backpropagation for scalable learning of bayesian neural networks. In Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 1861–1869, 2015. K. Hornik. Approximation capabilities of multilayer feedforward networks. Neural networks, 4(2): 251–257, 1991. H. Kanagawa, T. Suzuki, H. Kobayashi, N. Shimizu, and Y. Tagami. Gaussian process nonparametric tensor estimator and its minimax optimality. In Proceedings of the 29th International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pages 1632–1641, 2016. M. Karpinski and A. Macintyre. Polynomial bounds for VC dimension of sigmoidal and general pfaffian neural networks. Journal of Computer and System Sciences, 54(1):169–176, 1997. V. Koltchinskii. Local Rademacher complexities and oracle inequalities in risk minimization. The Annals of Statistics, 34(6):2593–2656, 2006. V. Koltchinskii and D. Panchenko. Empirical margin distributions and bounding the generalization error of combined classifiers. The Annals of Statistics, 30(1):1–50, 2002. 34 FAST L EARNING R ATE OF D EEP L EARNING A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems 25, pages 1097–1105, 2012. M. Ledoux and M. Talagrand. Probability in Banach Spaces. Isoperimetry and Processes. Springer Berlin Heidelberg, 1991. J. Mairal. End-to-end kernel learning with supervised convolutional kernel networks. In Advances in Neural Information Processing Systems 29, pages 1399–1407. 2016. J. Mairal, P. Koniusz, Z. Harchaoui, and C. Schmid. Convolutional kernel networks. In Advances in Neural Information Processing Systems 27, pages 2627–2635, 2014. S. Mendelson. Improving the sample complexity using global data. IEEE Transactions on Information Theory, 48(7):1977–1991, 2002. G. F. Montufar, R. Pascanu, K. Cho, and Y. Bengio. On the number of linear regions of deep neural networks. In Advances in Neural Information Processing Systems 27, pages 2924–2932. 2014. V. Nair and G. E. Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th International Conference on Machine Learning, pages 807–814, 2010. B. Neyshabur, R. Tomioka, and N. Srebro. Norm-based capacity control in neural networks. In Proceedings of the 28th Conference on Learning Theory, volume 40 of Proceedings of Machine Learning Research, pages 1376–1401, 2015. B. Poole, S. Lahiri, M. Raghu, J. Sohl-Dickstein, and S. Ganguli. Exponential expressivity in deep neural networks through transient chaos. In Advances in Neural Information Processing Systems 29, pages 3360–3368. 2016. D. E. Rumelhart, G. E. Hinton, and R. J. Williams. Learning representations by back-propagating errors. Cognitive modeling, 5(3):1. I. Safran and O. Shamir. Depth separation in ReLU networks for approximating smooth non-linear functions. arXiv preprint arXiv:1610.09887, 2016. S. Sonoda and N. Murata. Neural network with unbounded activation functions is universal approximator. Applied and Computational Harmonic Analysis, 2015. N. Srivastava, G. E. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1): 1929–1958, 2014. I. Steinwart and A. Christmann. Support Vector Machines. Springer, 2008. I. Steinwart and C. Scovel. Mercer’s theorem on general domains: On the interaction between measures, kernels, and rkhss. Constructive Approximation, 35(3):363–417, 2012. I. Steinwart, D. Hush, and C. Scovel. Optimal rates for regularized least squares regression. In Proceedings of the 22nd Annual Conference on Learning Theory, pages 79–93, 2009. 35 T. S UZUKI S. Sun, W. Chen, L. Wang, and T.-Y. Liu. Large margin deep neural networks: theory and algorithms. arXiv preprint arXiv:1506.05232, 2015. T. Suzuki. Convergence rate of Bayesian tensor estimator and its minimax optimality. In Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 1273–1282, 2015. T. Suzuki, H. Kanagawa, H. Kobayashi, N. Shimizu, and Y. Tagami. Minimax optimal alternating minimization for kernel nonparametric tensor learning. In Advances In Neural Information Processing Systems 29, pages 3783–3791, 2016. M. Talagrand. New concentration inequalities in product spaces. Inventiones Mathematicae, 126 (3):505–563, 1996. A. W. van der Vaart and J. H. van Zanten. Rates of contraction of posterior distributions based on Gaussian process priors. The Annals of Statistics, 36(3):1435–1463, 2008. A. W. van der Vaart and J. H. van Zanten. Information rates of nonparametric Gaussian process methods. Journal of Machine Learning Research, 12:2095–2119, 2011. A. W. van der Vaart and J. A. Wellner. Weak Convergence and Empirical Processes: With Applications to Statistics. Springer, New York, 1996. S. Watanabe. Learning efficiency of redundant neural networks in bayesian estimation. IEEE Transactions on Neural Networks, 12(6):1475–1486, 2001. B. Widrow and M. E. Hoff. Adaptive switching circuits. In IRE WESCON convention record, pages 96–104. Institute of Radio Engineers, 1960. 36
10math.ST
Object-Oriented Knowledge Extraction using Universal Exploiters Dmytro Terletskyi Faculty of Computer Science and Cybernetics Taras Shevchenko National University of Kyiv Kyiv, Ukraine [email protected] Abstract — This paper contains analysis and extension of exploiters-based knowledge extraction methods, which allow generation of new knowledge, based on the basic ones. The main achievement of the paper is useful features of some universal exploiters proof, which allow extending set of basic classes and set of basic relations by finite set of new classes of objects and relations among them, which allow creating of complete lattice. Proposed approach gives an opportunity to compute quantity of new classes, which can be generated using it, and quantity of different types, which each of obtained classes describes; constructing of defined hierarchy of classes with determined subsumption relation; avoidance of some problems of inheritance and more efficient restoring of basic knowledge within the database. Keywords — knowledge extraction; object-oriented dynamic networks; universal exploiters; lattice; semilattice; inheritance; hierarchies of classes. I. INTRODUCTION During recent years application of knowledge-based systems has extremely increased, therefore variety of systems and knowledge bases for different domains were developed. In spite of this, the invention of efficient methods for knowledge representation (KR), inference and extraction is still topical issue. Nowadays there are many knowledge representation formalisms (KRFs), which are used for knowledge-based systems (KBSs) development. Currently the most commonlyused approaches are semantic networks, ontologies, logical and rule-based formalisms. However, the certain programming paradigm, language and some stack of programming technologies should be chosen for development of a KBS. This choice is very important, because each programming paradigm and language provides certain tools for system development and determined mechanisms of interaction among its modules, in particular interaction with database. Thus, chosen KRF and programming technologies for its implementation, should be at least compatible with respect to each other. Otherwise, developed KBS will have complicated interaction between the level of KRF and the level of its implementation. Consequently it can decrease the efficiency of such system. Despite this, chosen formalism should provide efficient representation of hierarchically-structured knowledge about particular domain, because concepts hierarchy makes KR more compact and allows performing of reasoning over itself. Furthermore, the hierarchy should be stored in the database in such way, that KBS can be able to extract the knowledge efficiently and represent them in terms of programming language, using which the system was developed. However, the representation of hierarchies is possible, only if chosen KRF and programming language support mechanism of inheritance. Currently, the most commonly used programming paradigm is an object-oriented programming (OOP). All OOP-languages and many KRFs support single inheritance. However, as it was shown in [1]–[3], inheritance mechanism causes problem of exceptions, redundancy and ambiguity, which usually arise during construction of hierarchies and reasoning over them. II. KNOWLEDGE EXTRACTION According to [4]–[7], knowledge extraction is defined as creation or acquiring of knowledge from structured (e.g. relational databases, object-oriented database models, UML, XML and their fuzzy extensions, proposed in [8], [9]), semistructured (e.g. infoboxes) and unstructured (e.g. text, documents, images) data sources. In addition, the extracted knowledge should be represented in machine-processable format that enables inference. According to [6], there are two main paradigms of KE: ontology-based and open domain. They also can be called as close world knowledge extraction and open world knowledge extraction. The idea of first approach is to use ontology as vocabulary, which defines the types of concepts used in the knowledge base. It means that knowledge base contains defined number of types of entities and relationships. Thus, only relations included in the vocabulary can be extracted from the knowledge base. In the second approach, knowledge-based system does not have any vocabulary and pre-specified relationship types in the knowledge base. It means that each entity or relation in knowledge base can be considered as a candidate. Therefore, any possible relation or assertion in the knowledge base can be extracted. However, Unbehauen, Hellmann, Auer, Stadler et al. in [4], [5] argued about absence of clear definition of what extracted knowledge is and paid attention to the fact, that mere usage such KRFs as RDF/OWL can not sufficiently define the notion of «knowledge». They have formulated two important questions: 1. What is the result of data representation in terms of RDF/OWL (triplification process)? Structured data or represented knowledge? 2. When does structured data became knowledge? Analyzing these questions, it is possible to conclude that result of such knowledge extraction, first of all, will be structured data, which then can be interpreted as some knowledge. However, such interpretation can be performed only using particular KRF, where notion of knowledge is defined in a proper way. Therefore, any KRF can be considered as interpreter of data, according to its own specifics and specifics of particular domain, for representation of which the formalism was developed. One of attempts to solve earlier mentioned problems is such KRF as object-oriented dynamic networks (OODN), which was proposed in [10]. It provides representation of knowledge in OOP-like style and is compatible with respect to many OOPlanguages. In addition, as it was demonstrated in [3], OODN allow constructing of polyhierarchies and avoiding, in many cases, problems of inheritance, which were mentioned above. Moreover, OODN have fuzzy extension, proposed in [11], [12], which provides representation of vague and imprecise knowledge, using the same structure as for the crisp case. One more feature of OODN is exploiters-based knowledge extraction (KE) methods, which provide generating of finitely defined set of new classes of objects and finitely set of new relations among them, based on the set of basic classes and relations among them. It allows calculation of quantity of new classes, which can be extracted, and quantity of different types, which each obtained class describes. Furthermore, according to [13], the set of basic classes of any OODN, extended by extracted classes, together with union exploiter, create upper semilattice. Constructed upper semilattice forms a hierarchy of classes, where each class satisfies subsumption relation defined over the hierarchy that makes it possible to find more general class for arbitrary pair of classes. Such approach allows extracting of new knowledge from the basic ones and provides an ability to reconstruct the knowledge base for increasing its compactness. III. UNIVERSAL EXPLOITERS AND KNOWLEDGE EXTRACTION As it was shown in [12], some universal exploiters can be efficiently used for KE. According to [12, Th. 1], all possible applications of union exploiter, including all its possible superpositions, to homogeneous classes of objects, which do not have common properties and methods, always generate finite quantity of new classes of objects, which can be precisely calculated. However, there are situations when homogeneous classes of objects can have common properties and (or) methods. Before we start to consider them, let us make clear what we mean by type, subtype and subclass. As it was mentioned in [13], inhomogeneous class of objects describes at least two different types of objects within one class, where type is defined as follows. Definition 1. Type of objects t i of arbitrary inhomogeneous class of objects T  (Core(T ), pr1 (T ),..., prn (T )) , which describes types t1 ,..., t n , is a homogeneous class of objects ti  (Core(T ), pri (ti )) , where i  1, n . Consequently, each homogeneous class of objects describes particular type of objects. The definition shows that type and class of objects does not always mean the same, more precisely, homogeneous class of objects is equivalent to type of objects, however inhomogeneous class of objects is not equivalent to type of objects, because it describes some set of types. Now let us define notion of subtype. Definition 2. Arbitrary type of objects arbitrary type of objects t1 is a subtype of t2 , i.e. t1  t2 if and only if Pt1   Pt2   F t1   F t2  , where P t1  , P t 2  are specifications of types F t1  , F t2  are their signatures. t1 , t2 and This definition actually defines the notion of subclass for the case of homogeneous classes, however it is not enough for the inhomogeneous classes of objects. The notion of subclass for inhomogeneous classes was introduced in [13], nevertheless it is restricted and does not take into account some cases, when classes of objects have common properties and methods. Let us consider an example for clear understanding. Suppose we have three homogeneous classes of objects T1   p1 T1 ,..., pn T1 , f1 T1 ,..., f m T1  , T2   p1 T2 ,..., pk T2 , f1 T2 ,..., f w T2  , T3   p1 T3 ,..., pv T3 , f1 T3 ,..., f r T3  . Let us assume that p1 T1   p1 T2   p1 T3  ; p2 T1   p2 T2   p2 T3  , p3 T1   p3 T2   p3 T3  ; p4 T1   p4 T2  . Using union exploiter, let us compute T1  T2 , T1  T3 and T1  T2  T3 , i.e. T1  T2  T12  CoreT12 , pr1 t1 , pr2 t2     p1 T12 , p2 T12 , p3 T12 , p4 T12  ,  p1 t2 ,..., pk t2 , f1 t2 ,..., f w t2  ,  p5 t1 ,..., pn t1 , f1 t1 ,..., f m t1  ,  p1 t3 ,..., pv t3 , f1 t3 ,..., f r t3  .  p5 t2 ,..., pk t2 , f1 t2 ,..., f w t2  . According to [13, Def. 12], T13  T123 and T12  T123 , T1  T3  T13  CoreT13 , pr1 t1 , pr2 t3   therefore all results, which were presented in [13] are correct. That is why, let us extend the notion of subclass given in [13], using Def. 1 and Def. 2.   p1 T13 , p2 T13 , p3 T13  ,  p4 t1 ,..., pn t1 , f1 t1 ,..., f m t1  ,  p4 t3 ,..., pv t3 , f1 t3 ,..., f r t3  . T1  T2  T3  T123   CoreT123 , pr1 t1 , pr2 t 2 , pr3 t3     p1 T123 , p2 T123 , p3 T123  ,  p4 t1 ,..., pn t1 , f1 t1 ,..., f m t1  ,  p4 t2 ,..., pk t2 , f1 t2 ,..., f w t2  ,  p4 t3 ,..., pv t3 , f1 t3 ,..., f r t3  . According to [13, Def. 12], T13  T123 , however T12  T123 . Nevertheless, according to Def. 1 and Def. 2, T1  CoreT123 , pr1 t1  , T2  CoreT123 , pr1 t1  . T1 , which describes is a subclass of arbitrary class of objects T2 , Definition 3. Arbitrary class of objects 1 1 t ,..., t types 1 n, which describes types t12 ,..., tm2 , i.e. T1  T2 if and only if ti1t 2j | ti1  t 2j , where i  1, n , j  1, m and n, m  1 . T12 , T13 and T123 from Example 1, we can conclude that T12  T123 and T13  T123 for both cases, when classes T1 , T2 and T3 have Now, using this definition for classes common properties and methods and when they do not have them. Let us consider homogeneous classes of objects T1 ,..., Tn , which describes types of objects t1 ,..., t n . Let us assume that t , that t  t1 , t  t2 ,..., t  tn . It means that classes of objects T1 ,..., Tn have some common properties there is such type and (or) methods. It is clearly, that the application of union exploiter to them will produce a set of new classes of objects. Using this idea, let us formulate and prove the following theorem. Despite this, [13, Def. 12] is correct for the case when classes of objects have no common properties and methods. Let us assume that classes T1 , T2 and T3 do not have common Theorem 1. For any properties and methods, then we have where T1 ,..., Tn are homogeneous classes, which describe T1  T2  T12   pr1 t1 , pr2 t2     p1 t1 ,..., pn t1 , f1 t1 ,..., f m t1  ,  p1 t2 ,..., pk t2 , f1 t2 ,..., f w t2  . T1  T3  T13   pr1 t1 , pr2 t3     p1 t1 ,..., pn t1 , f1 t1 ,..., f m t1  ,  p1 t3 ,..., pv t3 , f1 t3 ,..., f r t3  . T1  T2  T3  T123    pr1 t1 , pr2 t 2 , pr3 t3     p1 t1 ,..., pn t1 , f1 t1 ,..., f m t1  , OODN  O, C  T1 ,..., Tn , R, E  {}, M  , types of objects t1 ,..., t n and there is a type t , such that t  t1 , t  t 2 ,..., t  t n , all possible applications of union exploiter, including all possible its superpositions, to classes of objects from the set C and obtaining classes of objects using union exploiter, always generate finite quantity of new classes of objects, which can be precisely calculated by the following formula: q CE   2n  n  1 , where n C . Proof: According to definition of union exploiter for classes of objects [13, Def. 14], the result of union of two arbitrary nonequivalent classes of objects T1 and T2 , which describe type of objects t1 and t2 respectively, is inhomogeneous class of objects T , which describes both these types. If there is a type t , such that t  t1 , t  t 2 ,..., t  t n , then class T will have the following structure T  Core(T ), pr1 (t1 ), pr2 (t2 ) . from the set k  2, n different classes C . It is known that k C k n  2n . However, we cannot create classes of objects, which describe 1 and 0 different types, applying union exploiter to the 0 n C , i.e. we do not count C and 1 n. C Therefore, we can conclude that n n q CE    C  C  C   C  2  n  1 . ■ k n 1 n 3. T1  T2  T3   T1  T2   T3 , that T1  TJSL  TJSL , where TJSL  it follows  T1  ...  Tn . C is a poset. For this we  T2  T1  T2  T2 and show that  is a relation of partial order under the set C . Now we need to prove that should define T1 , T2 C | T1 Taking into account that we have two types of classes, we need to define three kinds of  relation, i.e. n 0 classes of objects from the set T1  T2  T2  T1 , where T1 , T2 , T3 C . From the definition of According to proof of [13, Th. 1], the number of all possible unique classes of objects created from the basic set of classes C  T1 ,..., Tn  using union exploiter can be represented as a combination of 2. 0 n k n k 0 1. homogeneous  homogeneous, 2. homogeneous  inhomogeneous, 3. inhomogeneous It was done in Def. 2 and Def. 3. Now let us prove reflexivity, anti-symmetry and transitivity of these relations. 1. Reflexivity: T1  T1 idempotency of  ; 2. Anti-symmetry: n k 2  inhomogeneous.  T1  T1  T1 follows from Similarly to [13, Th. 2], we can formulate and prove the following theorem. T1  T2  T1  T2  T2 , Theorem 2. Set of classes of objects T2  T1  T2  T1  T1 C  T1 ,..., Tn , Tn1 ,..., T2n 1 of any OODN, extended according to Th. 1, with union exploiter create the join-semilattice JSL  (C , E  {,1}) , where class TJSL  T1  ...  Tn is its greatest upper bound, and from commutativity of T1  T2 ; 3. Transitivity: T1  T2  T1  T2  T2 , T2  T3  T2  T3  i.e. 1 . Proof: According to the definition of join-semilattice given in [14], [15], it is a system JSL  ( A,   {,1}) , where A is a poset,  is a binary, idempotent, commutative and associative operation and 1 is an unary operation, which are defined over the set A . In addition a  A , 1 satisfies L1  : a 1  1 (identity law). According to the theorem, carrier of join-semilattice is the set of classes C , set of exploiters E contains binary operation  and unary operation 1 , which are defined over the set C . Therefore JSL  (C , E  {,1}) , where C  T ,..., T , T 1 n n 1 ,..., T2n 1 . From the [13, Def. 14] it follows, that mentioned properties of  are also true for  , i.e. 1. T1  T1  T1 ,  , we can conclude that  T3  T1  T2   T3  T1  T2  T3    T1  T3  T3  T1  T3  T3  T1  T3 . Therefore,   JSL  C  T1 ,..., Tn , Tn1 ,..., T2n 1, E  {,1} is a join-semilattice, where class TJSL  T1  ...  Tn is its greatest upper bound, i.e. 1 . ■ Now let us define intersection exploiter for classes of objects, using Def. 1. Definition 4. Intersection of two arbitrary nonequivalent classes of objects T1  T2 , which describe types of objects t11 ,..., tn1 and t12 ,..., tm2 , respectively, where n, m  1 , is inhomogeneous class of objects T , which describes types of 3 3 objects t1 ,..., t w , where w  1, such that t , t 3 k 1 i       t   t   t   t  , 1 i l where  C  T1 ,..., Tn , Tn1 ,..., T2n 1   t 2j | tk3  ti1  tk3  t 2j  tl | tk3  tl  2 j l k  1, w , i  1, n , j  1, m . Using this definition, let us formulate and prove the following theorem. Theorem 3. For any OODN  O, C  T1 ,..., Tn , R, E  {}, M  , of any OODN, extended according to Th. 3, with exploiter  create the meet-semilattice MSL  (C , E  {,0}) , where class TMSL  T1  ...  Tn is its least lower bound, i.e. Proof: According to definition of meet-semilattice given in [14], [15], it is a system MSL  ( A,   {,0}) , where A is a poset,  is binary, idempotent, commutative and associative operation and 0 is unary operation, which are defined over the set A . In addition, a  A , 0 satisfies L1  : a  0  0 (identity law). where T1 ,..., Tn are homogeneous classes, which describe types of objects t1 ,..., t n and there is a type t , such that t  t1   ...  t  tn   t  | t  t    t   t1   ...  t   t n  , all possible applications of intersection exploiter, including all possible its superpositions, to classes of objects from the set C and obtaining classes of objects, using intersection exploiter, always generate finite quantity of new classes of objects, which can be precisely calculated by the following formula: q CE   2n  n  1 , where n C . Proof: According to Def. 4, the result of intersection of two arbitrary nonequivalent classes of objects T1 and T2 is inhomogeneous class of objects T that describes subtypes, which are common for all types of class T1 and T2 simultaneously. It is known that the number of all possible unique classes of objects created from the basic set of classes C  T1 ,..., Tn  using intersection exploiter can be represented as a combination of known that k  2, n different classes from the set C . It is k C k n 2 . However, intersection exploiter is a binary operation, that is why we cannot count According to the theorem, carrier of meet-semilattice is the set of classes C , set of exploiters E contains binary operation  and unary operation 0 , which are defined over the set C . Therefore, MSL  (C , E  {,0}) , where C  T1 ,..., Tn , Tn1 ,..., T2n 1 . From the Def. 4 it follows, that all mentioned properties of are also true for  , i.e. 1. T1  T1  T1 , 2. T1  T2  T2  T1 , 3. T1  T2  T3   T1  T2   T3 , Cn0 and Cn1 , therefore n n k 0 k 2 q CE    Cnk  Cn1  Cn0   Cnk  2n  n  1 . ■ Similarly to [13, Th. 2] and Th. 2, we can formulate and prove the following theorem. Theorem 4. Set of classes of objects  where T1 , T2 , T3 C . From the definition of that, T1  TMSL  TMSL , where TMSL  it follows  T1  ...  Tn . C is a poset. For this we T1 , T2 C | T1  T2  T1  T2  T1 and show that  is a relation of partial order under the set C . Now we need to prove that should define Taking into account that we have two types of classes, we need to define three kinds of  relation, i.e. 1. homogeneous  homogeneous, 2. homogeneous  inhomogeneous, 3. inhomogeneous n n 0 0.  inhomogeneous. It was done in Def. 2 and Def. 3. Now let us prove reflexivity, anti-symmetry and transitivity of these relations. 1. Reflexivity: T1  T1 idempotency of  ; 2. Anti-symmetry:  T1  T1  T1 follows from T1  T2  T1  T2  T1 , and T2  T1  T2  T1  T2 and from commutativity of  , we can conclude that T1  T2 ; 3. i.e. 1 and class TMSL  T1  ...  Tn is its least lower bound, Transitivity: T2  T1  T1  T2  T2 , T3  T2  T2  T3  i.e. 0.  T3  T1  T2   T3  T1  T2  T3   Proof: According to definition of complete lattice given in [14], [15], it is a system L  ( A,   {,,1,0}) , where A  T1  T3  T3  T1  T3  T3  T3  T1 . is a poset and Therefore,    L1  : (a  b)  c  a  (b  c) (associative laws)  MSL  C  T1 ,...,Tn , Tn 1 ,...,T2n 1 , E  {,0} (a  b)  c  a  (b  c) is a meet-semilattice, where class TMSL  T1  ...  Tn is its least lower bound, i.e.  ,  , 1 and 0 satisfy, for all a, b, c  A : L2  : a  b  b  a (commutative laws) ■ 0. a b  b  a Using Th. 1 and Th. 3, let us formulate and prove the following theorem. L3  : a  a  a Theorem 5. For any OODN  (O, C , R, E , M ) , where aa  a C  T1 ,..., Tn , Tn1 ,..., T2n 1 , E  {,} , and T1 ,..., Tn are homogeneous classes, which describe types of objects t1 ,..., t n and there is a type t , such that t  t1   ...  t  tn   t  | t  t   L4  : a  (a  b)  a L5  : a  0  a (identity laws) a 1  a all possible applications of union and intersection exploiters, including all possible their superpositions, to classes of objects from the set C and obtaining classes of objects, using these exploiters respectively, always generate finite quantity of new classes of objects, which can be precisely calculated by the following formula: q CE   2 n 1  2(n  1) , a 1  1 According to the theorem, carrier of the lattice is the set of classes C , set of exploiters E contains two binary operations  ,  and two unary operations 1 and 0 , which are defined over the set C . Therefore, L  (C , E  {,,1,0}) , where  C  T1 ,..., Tn , Tn 1 ,..., T2n 1 , T2n ,..., T2n1  2 ( n 1) Proof: Proof of the theorem follows from proofs of Th. 1 and Th. 3, i.e. n k 0 k 2 q CE   2 Cnk  Cn1  Cn0  2 Cnk  2n 1  2(n  1) , where a 0  0 n C . n n C . ■ Similarly to Th. 2 and Th. 4, we can formulate and prove the following important theorem. Theorem 6. Set of classes of objects  C  T1 ,..., Tn , Tn 1 ,..., T2n 1 , T2n ,..., T2n1  2 ( n 1) (absorption laws) a  ( a  b)  a  t   t1   ...  t   t n  , where (idempotency laws)  of any OODN, extended according to Th. 5, with exploiters  ,  create the complete lattice L  (C , E  {,,1,0}) , where class TJSM  T1  ...  Tn is the greatest upper bound,  Facts that 1. (C , ) is a poset, 2.  and  satisfy the laws  L1    L3  , 3. TJSL  T1  ...  Tn is 1 of join-semilattice, 4. TMSL  T1  ...  Tn is 0 of meet-semilattice, were shown in the proves of Th. 2 and Th. 4. From the [13, Def. 14] and Def. 4 it follows, that T1  TMSL  T1 , T1  TJSL  T1 , T1  TMSL  TMSL , and T1  TJSL  TJSL , where T1 C , TJSL  T1  ...  Tn , TMSL  T1  ...  Tn . Therefore, L  (C , E  {,,1,0}) is a complete lattice, where   C  T1 ,..., Tn , Tn 1 ,..., T2n 1 , T2n ,..., T2n1  2 ( n 1) ,  v4 ( p4 (S ))  360) , and TJSL  T1  ...  Tn is its greatest upper bound, i.e. 1 and p6 ( S ) – verification function, which defines property «all TMSL  T1  ...  Tn is its least lower bound, i.e. 0 . IV. ■ EXPLOITERS-BASED KNOWLEDGE EXTRACTION Let us consider classes of objects, which describe such types of convex polygons as square (S ) , rhombus (Rb) , parallelogram (P ) , and rectangle (Rt ) . Let us define for them an OODN Quadrangle (O, C , R, E , M ) . For this purpose, we need to define set of classes of objects C  {S , Rb, P, Rt} and set of exploiters E  {,} . Sets sides are equal», i.e. vf6 ( S ) : p6 ( S )  {0,1} , where p6 ( S )  (v1 ( p3 ( S ))  v2 ( p3 ( S ))  v3 ( p3 ( S ))   v4 ( p3 ( S ))) , p7 ( S ) – verification function, which defines property «all angles are equal to 90 », i.e. vf7 ( S ) : p7 ( S )  {0,1} , o where p7 ( S )  (v1 ( p4 ( S ))  v4 ( p4 ( S ))  v3 ( p4 ( S ))   v4 ( p4 (S ))  90) , O and R will be undefined, because of the lack of information. In addition, we do not define the set of modifiers M , because it is not necessary within consideration of exploiters-based KE. Suppose classes from the set C have following structures f1 ( S ) – method for perimeter computing, and method for area computing; f 2 (S ) – Rb  ( p1 ( Rb)  (4, sides), p2 ( Rb)  (4, angles), S  ( p1 (S )  (4, sides), p3 ( Rb)  ((v1 ( p3 ( Rb)), cm), (v2 ( p3 ( Rb)), cm), p2 (S )  (4, angles) p3 ( S )  ((v1 ( p3 ( S )), cm), (v2 ( p3 ( S )), cm), (v3 ( p3 ( Rb)), cm), (v4 ( p3 ( Rb)), cm)), p4 ( Rb)  ((v1 ( p4 ( Rb)),o ), (v2 ( p4 ( Rb)),o ), (v3 ( p3 ( S )), cm), (v4 ( p3 ( S )), cm)), p4 ( S )  (90o ,90o ,90o ,90o ), (v3 ( p4 ( Rb)),o ), (v4 ( p4 ( Rb)),o )), p5 ( S )  vf5 ( S )  1, p5 ( Rb)  vf5 ( Rb)  1, p6 ( S )  vf6 ( S )  1, p6 ( Rb)  vf6 ( Rb)  1, p7 ( S )  vf7 ( S )  1, f1 ( Rb)  (v1 ( p3 ( Rb)) 4, cm), f1 ( S )  (v1 ( p3 ( S )) 4, cm), f 2 ( Rb)  v1 ( p3 ( Rb))2 sin(v1 ( p4 ( Rb))),cm2 ,    f 2 (S )  v1 ( p3 (S ))2 , cm2 ,  p1 ( Rb) – quantity of sides, p2 ( Rb) – quantity of angles, p3 ( Rb) – sizes of sides, p4 ( Rb) – measures of internal angles, p5 ( Rb) – verification function, which defines where p1 (S ) – quantity of sides, p2 ( S ) – quantity of angles, p3 ( S ) – sizes of sides, p4 ( S ) – measures of internal angles, p5 ( S ) – verification function, which defines property where o property «sum of internal angles is equal to 360 », i.e. vf5 ( Rb) : p5 ( Rb)  {0,1} , o «sum of internal angles is equal to 360 », i.e. vf5 ( S ) : p5 ( S )  {0,1} , where p5 ( S )  (v1 ( p4 ( S ))  v2 ( p4 ( S ))  v3 ( p4 ( S ))  where p5 ( Rb)  (v1 ( p4 ( Rb))  v2 ( p4 ( Rb))  v3 ( p4 ( Rb))   v4 ( p4 ( Rb))  360) ,  v4 ( p4 ( P))) , p6 ( Rb) – verification function, which defines property «all sides are equal», i.e. vf6 ( Rb ) : p6 ( Rb )  {0,1} , where p7 ( P) – verification function, which defines property «opposite sides are equal», i.e. vf7 ( P) : p7 ( P)  {0,1} , p6 ( Rb)  (v1 ( p3 ( Rb))  v2 ( p3 ( Rb))  v3 ( p3 ( Rb))  where  v4 ( p3 ( Rb))) , p7 ( P)  (v1 ( p3 ( P))  v3 ( p3 ( P)))  (v2 ( p3 ( P))  f1 ( Rb) – method for perimeter computing, and method for area computing; f 2 ( Rb) – P  ( p1 ( P)  (4, sides),  v4 ( p3 ( P))) , f1 ( P) – method for perimeter computing, and f 2 ( P) – method for area computing; p2 ( P)  (4, angles), p3 ( P)  ((v1 ( p3 ( P)), cm), (v2 ( p3 ( P)), cm), Rt  ( p1 ( Rt )  (4, sides), p2 ( Rt )  (4, angles), (v3 ( p3 ( R)), cm), (v4 ( p3 ( R)), cm)), p3 ( Rt )  ((v1 ( p3 ( Rt )), cm), (v2 ( p3 ( Rt )), cm), p4 ( P)  ((v1 ( p4 ( P)), ), (v2 ( p4 ( P)), ), o o o (v3 ( p3 ( Rt )), cm), (v3 ( p3 ( Rt )), cm)), o (v3 ( p4 ( P)), ), (v4 ( p4 ( P)), )), p4 ( Rt )  ((90,o ), (90,o ), (90,o ), (90,o )), p5 ( P)  vf5 ( P)  1, p5 ( Rt )  vf5 ( Rt )  1, p6 ( P)  vf6 ( P)  1, p6 ( Rt )  vf6 ( Rt )  1, p7 ( P)  vf7 ( P)  1, f1 ( Rt )  (2 (v1 ( p3 ( Rt ))  v2 ( p3 ( Rt ))),cm)), f1 ( P)  (2 (v1 ( p3 ( P))  v2 ( p3 ( P))),cm), f 2 ( P)  (v1 ( p3 ( P)) v2 ( p3 ( P))   sin(v1 ( p4 ( P))),cm , 2 p1 ( P) – quantity of sides, p2 ( P) – quantity of angles, p3 ( P ) – sizes of sides, p4 ( P) – measures of internal angles, p5 ( P ) – verification function, which defines property where   f 2 ( Rt )  v1 ( p3 ( Rt )) v2 ( p3 ( Rt )), cm2 , p1 ( Rt ) – quantity of sides, p2 ( Rt ) – quantity of angles, p3 ( Rt ) – sizes of sides, p4 ( Rt ) – measures of internal angles, p5 ( Rt ) – verification function, which defines where o property «sum of internal angles is equal to 360 », i.e. vf5 ( Rt ) : p5 ( Rt )  {0,1} , o «sum of internal angles is equal to 360 », i.e. vf5 ( P) : p5 ( P)  {0,1} , where p5 ( Rt )  (v1 ( p4 ( Rt ))  v2 ( p4 ( Rt ))  v3 ( p4 ( Rt ))  where p5 ( P)  (v1 ( p4 ( P))  v2 ( p4 ( P))  v3 ( p4 ( P))   v4 ( p4 ( P))  360) , p6 ( P) – verification function, which defines property «opposite sides are parallel», i.e. vf6 ( P) : p6 ( P)  {0,1} , where p6 ( P)  (v1 ( p4 ( P))  v3 ( p4 ( P)))  (v2 ( p4 ( P))   v4 ( p4 ( Rt ))  360) , p6 ( Rt ) – verification function, which defines property «opposite sides are equal», i.e. vf6 ( Rt ) : p6 ( Rt )  {0,1} , where p6 ( Rt )  (v1 ( p3 ( Rt ))  v3 ( p3 ( Rt )))  (v2 ( p3 ( Rt ))   v4 ( p3 ( Rt ))) , f1 ( Rt ) – method for perimeter computing, and f 2 ( Rt ) – method for area computing. We have defined OODN for early mentioned types of convex polygons. It is clear, that all elements of the set C represent basic knowledge. Let us apply union and intersection exploiters to them and obtain all possible new classes of objects. According to [13, Def. 14], S  Rb  SRb  CoreSRb , pr1 (S ), pr2 ( Rb) , where CoreSRb    p1 SRb , p2 SRb , p3 SRb , p4 SRb , f1 SRb  , p1 SRb  – quantity of sides, p2 SRb  – quantity of angles, p3 SRb  – verification function, which defines Structure of the equalities p1 (S )  p1 ( Rb) , p2 (S )  p2 ( Rb) , p5 ( S )  p5 ( Rb) , p6 ( S )  p6 ( Rb ) , f1 (S )  f1 ( Rb) . Indeed, according to [13, Def 4], o vf3 SRb  : p3 SRb   {0,1} , where p3 SRb   (v1 ( p4 (ti ))  v2 ( p4 (ti ))  v3 ( p4 (ti ))   v4 ( p4 (ti ))  360) , i {S , Rb} , p4 SRb  – verification function, which defines property «all sides are equal», i.e. vf4 SRb  : p4 SRb   {0,1} , (v1 ( p1 (S )),u1 ( p1 (S )))  (v1 ( p1 ( Rb)),u1 ( p1 ( Rb)))   (4, sides) , (v1 ( p2 (S )),u1 ( p2 (S )))  (v1 ( p2 ( Rb)),u1 ( p2 ( Rb)))   ( 4, angles) . Form the [13, Def. 5] it follows that p5 ( S )  p5 ( Rb) and p6 ( S )  p6 ( Rb ) , i.e. vf S 5  v4 ( p3 (ti ))) , i {S , Rb} , f1 SRb  – method for perimeter computing, which is defined as follows f1 SRb   (4 v1 ( p3 (ti )), cm) , where i {S , Rb} . Projections structure pr1 ( S ) and pr2 ( Rb) have the following pr1 ( S )  ( p5 ( S ), p6 ( S ), p7 ( S ), f 2 ( S )) , pr2 ( Rb)  ( p5 ( Rb), p6 ( Rb), f 2 ( Rb)) , where p5 ( S ) – sizes of sides, p6 ( S ) – measures of internal angles, p7 ( S ) – verification function, which defines property o «all angles are equal to 90 », f 2 (S ) – method for area computing, p5 ( Rb) – sizes of sides, p6 ( Rb) – measures of internal angles, f 2 ( Rb) – method for area computing.    (S )  vf5Rb (S )  vf5S ( Rb)  vf5Rb ( Rb) , that can be computed in the following way vf5S (S )  v1 ( p4 (S ))  v2 ( p4 (S ))  v3 ( p4 (S ))   v4 ( p4 (S ))  360 , vf5Rb (S )  v1 ( p4 (S ))  v2 ( p4 (S ))  v3 ( p4 (S ))   v4 ( p4 (S ))  360 , where p4 SRb   (v1 ( p3 (ti ))  v2 ( p3 (ti ))  v3 ( p3 (ti ))  p1 (S )  p1 ( Rb) and p2 (S )  p2 ( Rb) , i.e. where property «sum of internal angles is equal to 360 », i.e. CoreSRb  follows from the following vf5S ( Rb)  v1 ( p4 ( Rb))  v2 ( p4 ( Rb))  v3 ( p4 ( Rb))   v4 ( p4 ( Rb))  360, vf5Rb ( Rb)  v1 ( p4 ( Rb))  v2 ( p4 ( Rb))  v3 ( p4 ( Rb))  vf S 6  v4 ( p4 ( Rb))  360 ;   (S )  vf6Rb (S )  vf6S ( Rb)  vf6Rb ( Rb)  vf6S (S )  (v1 ( p3 (S ))  v2 ( p3 (S ))  v3 ( p3 (S ))   v4 ( p3 ( S ))) , vf6Rb (S )  (v1 ( p3 (S ))  v2 ( p3 (S ))  v3 ( p3 (S ))   v4 ( p3 ( S ))) , vf6S ( Rb)  (v1 ( p3 ( Rb))  v2 ( p3 ( Rb))  v3 ( p3 ( Rb))   v4 ( p3 ( Rb))) , vf6Rb ( Rb)  (v1 ( p3 ( Rb))  v2 ( p3 ( Rb))  v3 ( p3 ( Rb))   v4 ( p3 ( Rb))) . As the result, in both cases we have (1  1)  (1  1) , i.e. 1 1  1 . From the [13, Def. 7] it follows that f S 1   f1 (S )  f1 ( Rb) , i.e.  ( S )  f1Rb ( S )  f1S ( Rb)  f1Rb ( Rb) , that can be calculated in the following way f1S (S )  (v1 ( p3 (S )) 4, cm) , f1Rb (S )  (v1 ( p3 (S )) 4, cm) , f1S ( Rb)  (v1 ( p3 ( Rb)) 4, cm) , Rb 1 f Fig. 1. Complete lattice created by the set of classes and set of exploiters. ( Rb)  (v1 ( p3 ( Rb)) 4, cm) , C  S , Rb, P, Rt , SRb ,..., PRt  , SRbP ,..., RbPRt , as the result we have (v1 ( p3 (S )) 4, cm)  (v1 ( p3 (S )) 4, cm)  SRbPRt , SRb ,..., PRt  ,.., SRbP ,..., RbPRt , SRbPRt  .  (v1 ( p3 ( Rb)) 4, cm)  (v1 ( p3 ( Rb)) 4, cm) , According to Th. 6, the set C together with exploiters  and  create the complete lattice L  (C , E  {,,1,0}) , i.e. 1  1  1 . According to [13, Def. 14], the class of objects SRb is the result of application of union exploiter to classes of objects S and Rb . From the Def. 4, we can conclude, that the result of application of intersection exploiter to these classes is equal to the core of their union, i.e. S  Rb  SRb  CoreSRb  . In the result of all possible applications of union and intersection exploiters we obtained such 6 classes, that each class describes 2 different types of objects SRb , SP , SRt , RbP , RbRt , PRt  such 4 classes, that each class describes 3 different types of objects SRbP , SRbRt , SPRt , RbPRt and 1 class, that describes 4 different types of objects SRbPRt . In addition, we obtained such 6 classes, that each class describes intersection of 2 different types of objects SRb , SP , SRt , RbP , RbRt , PRt  , such 4 classes, that each class describes intersection of 3 different types of objects SRbP , SRbRt , SPRt , RbPRt , and 1 class, that describes intersection f 4 different types of objects SRbPRt . Using exploiters  and  , we have extended the set by adding 22 new classes of objects, i.e. C SRbPRt is its greatest upper bound, i.e. 1 and SRbPRt is its least lower bound, i.e. 0 . This lattice can be where graphically represented as it is shown on Fig. 1. In addition, we define the set of relations R , by adding new relations, namely 56 relations for classes S,..., Rt , 96 32 SRb ,..., PRt  and SRb ,..., PRt  , 8 for classes SRbP ,..., RbPRt  and SRbP ,..., RbPRt  . for classes Analyzing Fig. 1, we can see that obtained lattice defines hierarchy of classes with determined subsumption relation  . It allows performing of subsumption reasoning for information classifying and retrieving. Moreover, obtained hierarchy is protected from ambiguity problem, because all classes, except basic ones, are inhomogeneous. Join-semilattice of the lattice L contains inhomogeneous classes of objects, which define all possible sets of objects of different types, which can be obtained from the basic classes of objects S , Rb , P and Rt . Meet-semilattice of the lattice L contains inhomogeneous classes of objects, which define common subtypes for basic classes. The greatest upper bound SRbPRt of the lattice L gives an opportunity to represent and to store the knowledge in the database in more efficient way by storing only one class SRbPRt instead of four basic classes of objects. Moreover, such storing requires less memory resources then storing of S , Rb , P and Rt , because instead of storing of 26 properties and 8 methods, it is possible to store only 17 properties and 5 methods. We can conclude that during KE using universal exploiters we have obtained 22 new classes of objects, 96 new relations among them, defined hierarchy of classes with determined subsumption relation  . Using obtained knowledge it is possible to restore basic knowledge in database more efficiently and perform subsumption reasoning within the constructed hierarchy of classes. V. CONCLUSIONS AND OUTLOOK Invention of KE techniques is very crucial for future development of KRFs and area of KR in general. In this paper the main attention was paid to consideration and extension of KE method within such object-oriented KRF as object-oriented dynamic networks. The main idea of proposed approach is usage of universal exploiters, which allow generation of new classes of objects and relations among them. The main achievement of the paper is proof of useful features of union and intersection exploiters, which allow extending set of basic classes and create complete lattice. Proposed approach has the following features:  REFERENCES [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] ability to calculate before the generation: o quantity of new classes, which can be generated, using proposed approach, [12] o quantity of different types, which each of obtained classes describes; [13]  extension of the sets of basic classes and relations by adding new classes of objects and relations among them;  construction of defined hierarchy of classes with determined subsumption relation  , which allows performing of subsumption reasoning for information classifying and retrieving;  more efficient restoring of basic knowledge within the database;  avoidance of inheritance problems, in particular ambiguity problem in the case of multiple inheritance. However, despite all noted advantages, proposed approach requires further research, at least in the following directions:  using of useful properties of complete lattices;  adaptation to different kinds of knowledge sources;  extension to the case of fuzzy knowledge;  adaptation and usage in other known object-oriented knowledge representation formalisms. [14] [15] D. S. Touretzky, The mathematics of inheritance systems. Los Altos, CA, USA: Morgan Kaufmann Publishers, 1986. R. Al-Asady, Inheritance theory: an artificial intelligence approach. Norwood, NJ, USA: Ablex Publishing Corporation, 1995. D. Terletskyi, “Inheritance in object-oriented knowledge representation,” in Inform. and Software Techn., Commun. in Comput. and Inform. Sci., vol. 538, G. Dregvaite and R. Damasevicius Eds., AG, Switzerland: Springer, 2015, pp. 293–305. S. Hellmann, J. Unbehauen et al., “Report on knowledge extraction from structured sources,” Technical Report LOD2 D3.1.1, 2011 J. Unbehauen, S. Hellmann, S. Auer and C. Stadler, “Knowledge extraction from structured sources,” in Search Computing: Broadening Web Search, Lecture Notes in Comput. Sci., vol. 7538, S. Ceri and M. Brambilla Eds. Berlin, Germany: Springer, 2012, pp. 34–52. N. Takhirov, “Extracting knowledge for cultural heritage knowledge base population,” Ph.D. dissertation, Dept. Comput. and Inform. Sci., Norwegian Univ. of Sci. and Technol., Trondheim, Norway, 2013. J. Polpinij, “Ontology-based knowledge discovery from unstructured and semi-structured text,” Ph.D. dissertation, School of Comput. Sci. and Software Eng., Univ. of Wollongong, Wollongong, NSW, Australia, 2014. Z. Ma, F. Zhang, L. Yan and J. Cheng, Fuzzy knowledge management for the semantic web. Berlin, Germany: Springer, 2014. L. Yan, Z. Ma and F. Zhang, Fuzzy XML data management. Berlin, Germany: Springer, 2014. D. Terletskyi and A. Provotar, “Object-oriented dynamic networks,” in Computational Models for Bus. and Eng. Domains, Int. Book Series Inform. Sci. & Computing, vol. 30, G. Setlak and K. Markov Eds. Rzeszow, Poland: ITHEA, 2014, pp. 123–136. D. A. Terletskyi and A. I. Provotar, “Fuzzy object-oriented dynamic networks. I,” Cybern. and Syst. Anal., vol. 51, no. 1, pp. 34–40, Jan. 2015. D. A. Terletskyi and A. I. Provotar, “Fuzzy object-oriented dynamic networks. II,” Cybern. and Syst. Anal., vol. 52, no. 1, pp. 38–45, Jan. 2016. D. Terletskyi, “Exploiters-based knowledge extraction in objectoriented knowledge representation,” in Proc. 24th Int. Workshop Concurrency, Specification & Programming, Rzeszow, 2015, vol. 2, pp. 211–221. G. Birkhoff, Lattice theory. 3rd revised ed. New York, NY, USA: American Mathematical Society Colloquium Publications, 1967. B. A. Davey and H. A. Priestley, Introduction to lattices and order. 2nd ed. New York, NY, USA: Cambridge University Press, 2002.
2cs.AI
UAI 2009 MOSTAFAVI & MORRIS 419 Using the Gene Ontology Hierarchy when Predicting Gene Function Sara Mostafavi Quaid Morris Department of Computer Science, Banting and Best Department of Medical Research and University of Toronto Departments of Computer Science and Molecular Genetics, University of Toronto Abstract The problem of multilabel classification when the labels are related through a hierarchical categorization scheme occurs in many application domains such as computational biology. For example, this problem arises naturally when trying to automatically assign gene function using a controlled vocabularies like Gene Ontology. However, most existing approaches for predicting gene functions solve independent classification problems to predict genes that are involved in a given function category, independently of the rest. Here, we propose two simple methods for incorporating information about the hierarchical nature of the categorization scheme. In the first method, we use information about a gene’s previous annotation to set an initial prior on its label. In a second approach, we extend a graph-based semi-supervised learning algorithm for predicting gene function in a hierarchy. We show that we can efficiently solve this problem by solving a linear system of equations. We compare these approaches with a previous label reconciliation-based approach. Results show that using the hierarchy information directly, compared to using reconciliation methods, improves gene function prediction. 1 Introduction We are interested in the problem of multilabel classification when the labels are related through a hierarchical categorization scheme and the input data is represented as a similarity metric between objects. This problem arises naturally when trying to automatically assign gene function, using controlled vocabularies like Gene Ontology (GO) (Ashburner et al., 2000), En- zyme Commission (EC) number (Bairoch, 2000), and Structural Classification of Protein (SCOP) categories (Murzin et al., 1995). The hierarchical multilabel classification problem, as we have posed it, arises in other application domains including automatic image segmentation and automatic web-page annotation. In the domain of gene and protein function prediction, the input data is most naturally represented using a network whose nodes represent genes (or proteins) and whose edges are positively weighted according to the biological evidence for shared function of the connected genes. Such networks, which are called functional association or function linkage networks, can be derived from a variety of genomics and proteomics data sources, including gene expression and genetic interaction data, by using an appropriate similarity metric. For example, Pearson correlation coefficient is often used to measure similarity between gene expression profiles. Although genes have multiple functions, existing approaches for predicting gene function typically solve a binary classification problem to identify positive genes for each function category independently (Pavlidis et al., 2002; von Mering et al., 2003; Lanckriet et al., 2004; Tsuda et al., 2005; Myers et al., 2005; Mostafavi et al., 2008). However, hierarchical gene classification schemes, such as GO, organize gene function categories as a directed acyclic graph (DAG) in which categories describing broader functions (e.g. eye development) are ancestors of those describing more specific functions (e.g. eye photoreceptor cell differentiation). Annotations, i.e., assignments of genes to a given category, satisfy the “true path” rule: genes annotated to a given category are also assigned to all of its ancestors; for example, an annotation in the category photoreceptor cell differentiation implies annotation in eye development. When making an annotation, curators place genes in the most specific category supported by the available data. Often genes are annotated in internal nodes of 420 MOSTAFAVI & MORRIS the DAG because there is insufficient evidence to annotate genes in the most specific, i.e., leaf, categories. For example, a mouse gene can be annotated as being involved in development if mice with defective copies of that gene die as embryos. Further investigations may determine whether the gene functions in eye, heart, or brain development, warranting a more specific annotation. These internal node annotations can provide helpful hints when classifying genes in descendent categories, so long as the classification algorithm incorporates prior knowledge about the hierarchy. Here, we introduce two new classification methods that leverage DAG-based categorization hierarchies. Both of our algorithms extend the Gaussian random fields (GRF) algorithm (Zhou et al., 2004; Zhu et al., 2003). Our interest in this algorithm stems from its success at predicting gene function compared with other binary and hierarchy-based classification schemes (PenaCastillo et al., 2008; Mostafavi et al., 2008; Tsuda et al., 2005). Intuitively, the GRF algorithm takes as input a similarity network (here a functional linkage network) and a set of real-valued label biases and assigns real-valued discriminant scores to each node; these scores are assigned so that the linked nodes have similar discriminant scores and the discriminant score of each node is not too different from its initial label bias. Our first method, which we call Hierarchical label propagation (HLProp), replicates the similarity network for each category and then links the nodes representing the same gene in parent and child categories, thus ensuring that the discriminant scores of a gene in related function categories also remain close. By applying the GRF algorithm to this new (much larger though sparsely-connected) network, we can perform multilabel classification efficiently by solving a linear system of equations. We also describe a second method, Hierarchical label bias (HLBias), that uses the GO hierarchy to set label biases of genes with annotations in internal category nodes. This second approach builds on the previous work of (Eisner et al., 2005) which used the structure of the GO hierarchy to define positive and negative examples for a given category of interest. In Section 3, we briefly review the GeneMANIA version of the GRF algorithm (Mostafavi et al., 2008); show the relationship between GRF label propagation and Gaussian inference; and then use that relationship to justify our two extensions: HLBias and HLProp. In Sections 4 and 5, we compare these two methods, and two simplifications of HLProp, a reconciliation method called Isotonic Regression (Obozinski et al., 2008), and unaugmented binary classification using GeneMANIA GRF (Mostafavi et al., 2008). We evaluate performance in two settings, test and novel settings, using UAI 2009 the data from the MouseFunc challenge (Pena-Castillo et al., 2008). The test setting evaluates each classifier in a cross-validation framework in which the GO annotations of test genes are completely hidden. The novel setting evaluates the performance in the task of predicting new annotations given the state of the GO annotation database from the previous year. Many annotations in the updated GO database are refinements of pre-existing internal node annotations. 2 Previous Work To date, most classification algorithms that make use of the GO hierarchy have built on top of binary classification schemes; standard structured output classification algorithms (Taskar et al., 2003) are difficult to employ here due to the size the classification problem and the non-trivial tree-width of the GO hierarchy. Augmented binary classification schemes include cascaded classification (Kiritchenko et al., 2004) which trains one binary classifier for each category to predict whether annotation in the child category is warranted given annotation in the parent category (or categories). Annotation predictions are made by querying classifiers in a cascade from the root down. An alternative approach is to independently train binary classifiers for each category and then to reconcile their predictions so that the true path rule is enforced. For example, (Barutcuoglu et al., 2008) reconciled predictions of binary SVMs for 100 GO categories (a subset of about 2,000 well-annotated GO categories) by using a Bayesian network to model the GO hierarchy over the considered categories, (Obozinski et al., 2008) extended this approach to the entire GO hierarchy using approximate inference. Obozinski and colleagues (Obozinski et al., 2008) compared ten reconciliation methods including reconciliation with a Bayesian networks (as done in (Barutcuoglu et al., 2008)), Isotonic Regression, and a cascade of classifiers approach (Cascade Logistics Regression) on the MouseFunc benchmark. Surprisingly, many reconciliation methods did not significantly improve prediction accuracy, however, the performance of Isotonic Regression was better than that of Cascade Logistic Regression and other reconcilation methods. As such, in this report, we restrict our comparisons to Isotonic Regression. Other hierarchy-aware gene function prediction schemes that have only been applied to tree-structured hierarchies, e.g. (Shahbaba & Neal, 2006), will not be considered here. UAI 2009 3 MOSTAFAVI & MORRIS Algorithm We assume that we are given as input a weighted, undirected network represented as a positive, symmetric affinity matrix W = W T , wij ≥ 0, where wij indicates the strength of the evidence of co-functionality between genes i and j; a classification hierarchy over d categories denoted by Hd×d , where hmc = 1 indicates that category c is a child of category of m; and a label bias matrix Y = [y~1 , ..., y~d ], where ~yc ∈ {+1, k, −1}n×1 consists of the label biases of all genes in the category c. As we will show later, the parameter k is set to a scalar between -1 and +1 and reflects our prior bias on the mean of the labels of unlabeled genes. We consider a transductive setting, i.e., we assume that all input vectors are available during training; this is a natural assumption since the known gene complement of genomes is relatively stable. Below, we first describe how to predict gene function using the GRF algorithm; we then show how to use the GO hierarchy to derive more informative label biases. Next, we show how to extend GRF when a classification hierarchy is available. Finally, we describe other approaches for making gene function predictions with a classification hierarchy. 3.1 Predicting a single gene function To predict gene function, we use the Gaussian random fields algorithm (Zhu et al., 2003; Zhou et al., 2004) to assign a discriminant score fi ∈ [−1, 1] to each node (protein) i in the network. These discriminant scores can then be thresholded to classify the genes. Below, we write the Gaussian random fields algorithm in the following general form: f~∗ = arg min f~ n X σi (yi − fi )2 + i=1 n X wij (fi − fj )2 i,j=1 = arg min (f~ − ~y ) Σ(f~ − ~y ) + f~Lf~ = (Σ + L)−1 Σ~y T f~ (1) where ~σ = [σ1 , ..., σn ]T are model parameters, Σ is a diagonal matrix with Σii = σi , L = D − W is the graph P Laplacian and D is a diagonal matrix with Dii = j wij . The above objective ensures that the discriminant scores remain close to their initial labels (first term in (1)) and that the discriminant scores of linked genes (as indicated by wij > 0) are similar to each other (second term in (1)). To ensure that Σ + L is invertible, we can set σi > 0 and thus ensure that Σ + L is diagonally dominant. However, to solve for f~, we only need to solve a linear 421 system of equations (Σ + L)f~ = Σ−1 ~y , which we can do with various existing fast iterative solvers (Nocedal & Wright, 2006). Here, we use the conjugate gradient (CG) algorithm which is well-suited to this problem because our coefficient matrix is very sparse and the CG iterations only require us to take matrix-vector products with the coefficient matrix. The solution to (1) can also be interpreted as the maximum a posteriori (MAP) estimate of f~, where the observations ~y ∼ N (f~, Σ−1 ) with a prior on f~, namely f~ ∼ N (~0, L−1 ) where N (~ µ, K) is the normal distribution with mean µ ~ and covariance matrix K (Shental et al., 2008). This relationship suggests that the label bias yi can be viewed as a noisy estimate of a soft label fi with the regularization parameter σi as the precision of the estimate and the weights wij as inverse prior covariance between fi and fj . This interpretation suggests that a node’s label bias should reflect our prior beliefs about its label. We have previously shown (Mostafavi et al., 2008) in unbalanced problems, we can achieve a large gain in classification performance by setting the + − label bias k of unlabeled nodes to be the k = nn+ −n +n− , the mean of the labels of the labelled nodes. In the following section, we describe how we use the GO hierarchy to set the label bias for nodes which we have previously labelled as negative. 3.2 Hierarchical label bias In Hierarchical label bias (HLBias), we use the GO hierarchy directly to set the initial label bias of nonpositive genes. HLBias builds on the previous work of (King et al., 2003) and (Eisner et al., 2005). In particular, King and colleagues (King et al., 2003) used a gene’s annotations as a feature vector for predicting additional annotations for the given gene. Eisner and colleagues (Eisner et al., 2005), used the structure of the GO hierarchy to define appropriate negative examples for predicting a given gene function: they used as negatives all genes with initial annotation (i.e., before calculating the transitive closure using the true path rule) in neither descendant nor ancestral categories. In our approach, we use a gene’s previous annotations to estimate our prior bias that it will be annotated to a given category of interest. To do so, when predicting category c, we first use as negatives all genes that are annotated in any sibling category of c. We assign this negative label because genes are rarely annotated in more than one child of the same parent category. For other genes i with an annotation in an ancestral n+ + category a of c, we set yic = 2 × nac + − 1 where na a is the number of positive examples in category a and 422 MOSTAFAVI & MORRIS n+ ac is the number of positive examples in category a that were also annotated in category c; this initial label bias is proportional to the probability of a gene being annotated to category c given its annotation in category a. For a gene i with multiple annotations, we set yic to its mean value. Having set these label biases, we then solve for discriminant values independently. 3.3 Given a matrix of label biases Yn×d and a hierarchical classification scheme represented by Hd×d , we solve for discriminant values for all d classes simultaneously. To do so, we solve the following problem: F ∗ = arg min n X d X fic d X n X c σi (yic − fic )2 + (2) c i wij (fic − fjc )2 + λ i,j d n X X i hmc (fim − fic )2 c,m where F = [f~1 , ..., f~d ] and hmc denotes the relationship between category m and c, and λ, σi ’s are the regularization constants. Without the third term (by setting λ = 0), equation (2) corresponds to solving d independent binary classification problems. The third term encourages the discriminant values of a gene in two related function categories to be similar to each other (see Figure 1 for an example). In this work, we use the GO hierarchy to define H. GO is a DAG (directed acyclic graph), however, as we will discuss later, to ensure that problem (2) is convex, we treat GO as an undirected graph. In particular, hcm ∈ {0, +1} represent the parent child relationships in GO: we set hcm = hmc = 1 if m is a parent of c in the GO hierarchy and 0 otherwise. In addition, in our experiments we set λ and each σi to a fixed value of 1 and so we drop these constants from our subsequent equations. 3.3.1 Optimization ∗ We can solve for F by solving the following problem: F∗ = arg min trace(F T F − 2F T Y ) + trace(F T LF ) + trace(F GF T ) yi,1 F (3) where G is the graphP Laplacian of H, G = V −H, V = d diag(vcc ), and vcc = m hmc . Differentiating equation (3) with respect to F , we get the matrix equation (I + L)F + F G = Y . Equivalently, we can find F by solving a large sparse linear system: A(vec(F )) = vec(Y ), where vec(Y ) is an operator that stacks the columns of Y atop of each other, Gene Ontology (GO) Categories Sensory organ development: y1 Sensory organ development: y1 Eye development: y2 fj,4 h2,4 Lens development: y3 Hierarchical label propagation UAI 2009 Retinal development: y4 Eye development: y2 Lens development: y3 Retinal development: y4 Figure 1: A graphical example of our model. On the left figure, there are four identical networks over four genes (nodes); the association between different genes is shown in black edges. The color of the smaller nodes attached to each gene represents the initial label of the gene. If we wish to predict which genes are involved in eye development, we need to consider other related categories (as shown on the right). In our modification, we introduce an edge between the same gene (blue edges) in the different networks (in this figure, we have only shown blue edges for one gene); these edges will encourage the discriminant value of the same gene (depicted as the color of the bigger nodes) in related categories to be similar. A(n×d)×(n×d) = (Id×d ⊗ (I + L) + G ⊗ In×n ), and ⊗ denotes the Kronecker matrix product. As an example, the matrix A that corresponds to the example in Figure 1 can be represented as:   (2I + L) −I 0 0  −I (3I + L) −I −I   A=   0 −I (2I + L) 0 0 −I 0 (2I + L) In general, A can be represented as a block matrix with diagonal blocks Aii = (I + L + vii I) and non-diagonal blocks −hij I. When H is symmetric, then A is also symmetric. Furthermore, since A is diagonally dominant with positive diagonals, A is symmetric positive definite (SPD) and thus invertible. However, with large d (number of gene function categories) and n (number of genes), constructing A may be infeasible. Instead, we can solve for the f~c ’s iteratively: given all f~c ’s for c 6= m, we can solve for f~m by solvingPthe system of linear equations: d (I + L + vmm I)f~m = c hcm f~m + ~ym . In our setting, problem (3) is convex and we can calculate F ∗ by iteratively updating f~m ’s; we have empirically observed ∗ that we need 10 or fewer iterations to solve each f~m when there are approximately 50 GO categories that are related to each other. UAI 2009 3.4 MOSTAFAVI & MORRIS Other approaches for using the GO hierarchy Here, we compare gene function prediction using HLBias, HLProp, two heuristics approaches based on HLProp (Down- and Up- propagation), and Isotonic regression, a method for reconciling the predictions of independent classifiers to satisfy the true-path rule. Down- or Up-propagation. Both of our heuristics are inspired by the observation that if the classification hierarchy were a polytree, then we would be able to solve for F* using a belief propagation-like message passing algorithm which passes a single message in each direction along parent and child category link and these messages are used to calculate the label biases for the message recipient. In Up-progation, these messages are only passed from child categories to parent categories and in Down-propagation, messages are only passed from parents to their children. In particular, in Down-propagation, we first calculate f~r∗ , the vector of discriminant scores for genes in the root category using equation (1), then the root passes f~r∗ as a message to each of its child categories c who set their label biases to be ~yc + f~r∗ , where ~yc is the vector of initial label biases for category c. We then apply this procedure recursively from parent to child, summing together all parent messages before calculating label biases whenever a node has multiple parents. Up-propagation is similar though messages are passed from child nodes to parent nodes. Isotonic Regression (IR). Given a set of independent predictions for a gene i in d categories ~xi = [x1 , ..., xd ], xc ∈ <, IR (Barlow et al., 1972) solves the following problem: arg min zc d X (xc − zc )2 qc c subject to zm ≥ zc ∀(m, c) ∈ H where qc ’s are the parameters. We apply IR to the discriminant values obtained using Gaussian random fields algorithm to each function category independently. In our experiment, as done in (Obozinski et al., 2008), we set qc = 1 for c = 1, ..., d and solve IR heuristically, using the generalized PAV algorithm (GPAV) (Burdakov et al., 2006). 4 Methods Regularization parameters In our experiments, we set all of the precisions σi = 1, i ∈ {1, ..., n}, i.e. Σ = I and we set the regularization constant in equation (2) to λ = 1. 423 Benchmark data We use the mouse benchmark data of (Pena-Castillo et al., 2008) which consists of ten genomics and proteomics datasets. We first represent each data source as a similarity network using Pearson correlation coefficient (r ) and sparsify each network by setting to zero any interaction that is not among the top 50 highest r values for either gene. To ensure that all interactions are positive (i.e. wij ≥ 0), we only consider positive interactions (r > 0) and set to zero all the negative interactions. We normalize each network: W̃ = D−1/2 W D−1/2 . We then combine all the networks, by simply adding them together to obtain a single functional linkage network and re-normalize this composite network. Gene Ontology To evaluate gene function prediction we use GO function categories for M. musculus. We use the true-path rule to associate each gene with all of its functions, i.e. if a gene is annotated in a child category, we consider it to be annotated in all of its ancestor categories. In addition, we remove all annotations that were only supported with “inferred from electronic annotation” (IEA) evidence code; IEA annotations are the only annotations made based on previous computational predictions which have not been reviewed by a curator (Ashburner et al., 2000). Evaluation As in (Pena-Castillo et al., 2008), we evaluate our predictions based on two sets of genes: (a) test genes (i.e. cross-validation) and (b) novel genes. For predicting test genes, we perform 3-fold crossvalidation on 2,634 GO biological process categories which have between 3 and 300 annotations (GO association file download on September 1, 2007). Note that when constructing our hierarchy from which we derive the HLbias, only GO categories in this set are included. For predicting novel genes, we train on the 2007 GO association file and then we evaluate our performance in a “real-life” setting by comparing our predictions to the updated GO association file (GO association file download on September 1, 2008). In particular, for predicting novel genes, we restrict our evaluation to 903 GO categories that obtained three or more new annotations since 2007. We report the performance on predicting test and novel genes in terms of error as measured by 1-area under the ROC (Receiver Operating Characteristic) curve (1-AUC). The AUC under the ROC curve (Fawcett, 2006) corresponds to the probability that a random positive instance will be scored higher than a random negative instance. In addition to AUC of ROC, we investigate the performance in predicting novel genes as measured by AUC of precision recall curve. 424 MOSTAFAVI & MORRIS Hierarchical label bias (HLBias) 0.6 Error (1−AUC) 0.5 0.4 UAI 2009 HLBias HLProp Down−Propagation Up−Propagation IR GRF Hierarchical label propagation (HLProp) yi,1 initial labels bias -1 ? +1 GO category 1 ? 0.3 GO category 2 ? 0.2 0.1 0 yi,2 500 1000 1500 number of GO categories 2000 2500 Figure 2: Cumulative performance (error) of various methods in predicting the function of test genes in 2,634 GO categories (i.e. using 3-fold cross-validation on 2008 GO annotation file). 5 Experimental Results We first show the performance on test genes and then focus our analysis in predicting novel genes. 5.1 Figure 3: An example illustrating the difference between HLBias and HLProp in assigning discriminant scores to a test gene. The test gene is depicted by the node whose initial label bias is a question mark. On the right figure, the nodes in the same column depict the same gene in different categories; only one of the five blue edge representing the edges ha,c ’s is shown. In HLBias, when predicting GO category 2, the two neighbouring nodes of the test gene have a more positive label bias. In HLProp, the previous annotations needs to be propagated through more edges to effect the discriminant score of the test gene. Predicting test genes Figure 2 shows the cumulative distribution of the error (1-AUC of ROC) of the Hierarchical label bias, HLProp, Down- and Up-propagation, Isotonic Regression (IR) and Gaussian random fields (GRF) algorithms. Table 1 summarizes the mean and median error of each method. Table 1: Mean and median error in predicting test genes in 2,634 GO categories. The last column shows the standard error in the estimate of the mean error. Approach mean median SE Hierarchical label bias HLProp Down-Propagation Up-Propagation IR GRF 0.1035 0.1382 0.1282 0.1735 0.1745 0.1760 0.0881 0.1200 0.1109 0.1405 0.1438 0.1464 0.0016 0.0020 0.0019 0.0028 0.0028 0.0028 HLProp, HLBias, and Down-propagation considerably reduce the error in gene function prediction. Specifically, despite being the simplest method, Hierarchical label bias achieves the best overall performance in terms of 1-AUC of ROC curve (Table 1). Note that in the cross-validation setting, for the Hierarchical label bias method, the test genes are labeled as unknowns and the initial label of other non-positive genes is set according to their previous annotations in the GO hier- archy (see Section 3.4). One explanation for the better performance of HLBias compared to HLProp is that, in using HLBias, genes that have an incomplete annotation in an ancestral category more directly influence the discriminant scores of their linked genes. This is because the initial label bias of a gene essentially needs to be propagated through a minimum of two edges to effect the label bias of a test gene; in HLProp the incomplete annotation information needs to be propagated through a minimum of three edges to effect the discriminant score of a test gene (see Figure 3 for a pictoral description). This explanation may also offer an insight into why Down-Propagation performs better than Up-Propagation. In addition, we observed that IR and Up-propagation do not significantly improve the performance. This result is consistent with the observations in (Obozinski et al., 2008) that most reconciliation methods often perform similar to the baseline of independent predictions. 5.2 Predicting novel genes Here we report the performance in predicting novel gene function; in particular, to evaluate the performance on a given category, we use newly annotated genes as positives and all other genes (excluding previously annotated genes, that is, those annotated in the 2007 GO file) as negatives. In predicting novel genes UAI 2009 MOSTAFAVI & MORRIS 1 True Positive Rate (TPR) Table 2: Mean and median error in predicting novel genes in 903 GO categories. The last column shows the standard error. Approach mean median SE HLBias HLProp IR GRF 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 False Positive Rate (FPR) Figure 4: The ROC curve for predicting the GO category “Osteoblast Differentiation” which had 26 annotations in the 2007 GO association file and 9 new annotations in the 2008 version. 0.5 HLBias HLProp Down−Propagation Up−Propagation IR GRF 0.45 0.4 0.35 Error (1−AUC) 425 0.3 Hierarchical label bias HLProp Down-Propagation Up-Propagation IR GRF 0.1367 0.1404 0.1415 0.1767 0.1768 0.1772 0.1249 0.1262 0.1305 0.1671 0.1672 0.1673 0.0025 0.0032 0.0032 0.0031 0.0031 0.0031 one newly annotated gene had a previous annotation in one of the sibling categories. The performance of HLBias (mean error of 0.1406) was worse than HLProp in these 13 categories (mean error of 0.1091) and similar to the baseline (mean error of 0.1469). In addition, some of the newly annotated genes had no previous annotations in ancestral categories with less than 300 annotations; as we discuss later, the performance of HLBias was degraded in predicting these categories. 0.25 0.2 HLBias HLProp Down−Propagation Up−Propagation IR GRF 0.25 0.15 0.1 0.2 0 0 100 200 300 400 500 600 700 number of GO categories 800 900 1000 Figure 5: Comparison of performance in terms of error in predicting novel genes in 903 GO categories that acquired three or more annotations in a span of one year. with the HLBias method, for a given GO category, we adjust the initial label of all except the positive genes (which have an initial label bias of +1 according to the 2007 GO file) by using the incomplete annotation information in GO. Figure 4 shows a typical set of ROC curves; these curves were generating for predicting GO category “Osteoblast Differentiation”. Figure 5 shows the cumulative performance of each method in predicting novel genes in 903 categories as measured by error (1AUC of ROC). Table 2 shows the mean and median error. As shown in Figure 5, unlike the cross-validation setting, the performance of HLProp at high percentiles (e.g. greater than 75% percentile) is better that that of HLBias. In particular, we found that our assumption about using genes that are annotated in siblings’ categories as negative example may not always hold. For example, in 13 of the 903 GO categories, at least Mean error (1−AUC) 0.05 0.15 0.1 0.05 0 [3−10] [11−30] [31−100] number of annotations [101−300] Figure 6: Comparison of performance in terms of error (1-AUC of ROC) in predicting novel genes. The performance is measured in predicting GO categories with [3-10] (136 categories), [11-30] (350 categories), [31100] (314 categories), and [101-300] (101 categories) positive annotations in the 2008 GO file. To better understand the difference between the various methods, we measured the mean performance in predicting GO categories at four different specificity levels; those with 3-10, 11-30, 31-100, and 101-300 annotations in the 2008 GO file. As shown in Figure 6, HLBias performs better than the others in predicting GO categories with 3 to 10 and 101 to 300 annotations whereas the performance of HLProp, Downpropagation, and GO label bias is similar when predicting GO categories with 11 to 100 annotations. Furthermore, using hierarchical information yields the 426 MOSTAFAVI & MORRIS 0 10 HLBias HLProp Down−Propagation Up−Propagation IR GRF −1 Average precision 10 −2 10 −3 10 −4 10 0 100 200 300 400 500 600 number of GO categories 700 800 900 Figure 7: Comparison of performance in terms of average under the precision-recall curve when predicting novel genes in 903 GO categories that acquired three or more annotations in a span of one year. most improvement on GO categories with a very few positive examples. In addition to measuring performance in terms of 1AUC of ROC, we also investigated the performance in predicting novel gene functions in terms of area under the precision recall curve. As shown in Figure 7, the performance of HLProp in terms of average precision, is better than all other methods. Interestingly, in contrast to the ROC measure, we observed that on average, the performance of HLBias is not significantly different than the baseline approach (t-test with α=0.05). However, the cumulative performance of HLBias follows the same trend as measured in error or average precision (compare Figure 5 and 7); HLBias has a lower precision at high percentile but higher precision at lower percentiles. The lower performance of HLBias, as measured in terms of precision, can be explained by our observation that genes with new annotations in 338 of the 903 novel categories had no previous annotation in the corresponding ancestral categories and were therefore deemed negatives and given a highly negative label bias: the performance of HLBias in terms of precision at lower recalls (e.g. recall of 10%) was specifically degraded in these categories. 6 Discussion Here we have shown that by using the GO hierarchy information directly, either by setting initial label biases using GO or using our formulation of hierarchical Gaussian random fields (HLProp), we can significantly improve gene function prediction. On the other hand, our results are consistent with the previous report that reconciliation methods may rarely improve the performance of independent classifiers (Obozinski et al., UAI 2009 2008). In contrast, in our setting, reconciliation of independent GO category results in a performance very similar to the baseline of un-corrected classifications obtained by GRF. In order to be able to solve HLProp efficiently, we ignored the directionality of the GO hierarchy. To do so, we set pmc = pcm if category c is a child of category m. In contrast, the two heuristics variants (Up- and Down-propagation) only propagate information about discriminant scores in one direction. Our results indicate that propagating information down the hierarchy results in most gain whereas Up-Propagation does not significantly effect the performance. This result is consistent with that of (Obozinski et al., 2008) which found that reconciliation with a Bayesian network model of GO hierarchy where the arrows are directed from parents to the children classes performs better than the opposite model where the arrows are directed from children to the parents. In its most general form, the GRF and the HLProp algorithms contain a number of regularization parameters. We have had general success by setting all these parameters to one though we have not rigorously investigated the effect of changing them because performing cross-validation on genome scale datasets is computationally costly and sometimes infeasible. However, a future area of improvements may be to find an optimal setting for these parameters. Acknowledgements We would like to thank David Warde-Farley for helpful comments. This work was supported by an NSERC operating grant, a Genome Canada grant administered by OGI and a CFI/MRI-LOF equipment grant to QM. SM was partially supported by an OGS fellowship. References Ashburner, M., Ball, CA., Blake, JA., Botstein, D., Butler, H., & et. al. 2000. Gene Ontology: tool for unification of biology. Nature Genetics, 25, 25–29. Bairoch, A. 2000. The Enzyme database in 2000. Nucleic Acids Research, 28, 304–305. Barlow, R.E., Bartholomew, D.J., Bremmer, J.M., & Brunk, H.D. 1972. Statistical inference under order restrictions; the theory and application of isotonic regression. New York. ISBN 0-4-71-04970-0: Wiley. Barutcuoglu, Z., Schapire, R.E., & Troyanskaya, O.G. 2008. Hierarchical multi-label prediction of gene function. Bioinformatics, 22(7), 830–836. UAI 2009 MOSTAFAVI & MORRIS Burdakov, O., Sysoeve, O., Grimvall, A., & Hussain, M. 2006. Large-Scale Nonlinear Optimization. In Nonconvex Optimization and Its Application. Berlin: Springer-Verlag. Pages 25–33. 427 Pena-Castillo, L., Tasan, M., Myers, CL., Lee, H., Joshi, T., & et. al. 2008. A critical assessment of Mus musculus gene function prediction using integrated genomic evidence. Genome Biology, 9(Suppl 1), S2. Eisner, R., Poulin, B., Szafron, D., Lu, P., & Greiner, R. 2005. Improving Protein Function Prediction Using the Hierarchical Structure of the Gene Ontology. CIBCB Conference, 354–363. Shahbaba, B., & Neal, R. 2006. Gene function prediction with hierarchical models with hierarchybased prior. BMC Bioinformatics, 7, 448. Fawcett, T. 2006. An introduction to ROC analysis. Pattern Recognition Letters, 27, 861–874. Shental, O., Siegel, P., Wolf, J., Bickson, D., & Dolve, D. 2008. Gaussian Belief Propagation Solver for Systems of Linear Equations. arXiv:0810.1736. King, O., Foulger, R., Dwight, S., White, J., & Roth, F. 2003. Predicting Gene Function From Patterns of Annotations. Genome Research, 13. Kiritchenko, S., Matwin, S., & Famili, A. Fazel. 2004. Hierarchical Text Categorization as a Tool of Associating Genes with Gene Ontology Codes. European Workshop on Data Mining and Text Mining for Bioinformatics at ECML, 26–30. Lanckriet, G.R.G, Bie, T. De, N.Cristianini, Jordan, M.I., & Noble, W.S. 2004. A statistical framework for genomic data fusion. Bioinformatics, 20, 2626–2635. Mostafavi, S., Ray, D., Warde-Farley, D., Grouios, C., & Morris, Q. 2008. GeneMANIA: a real-time Multiple Association Network Integration Algorithm for predicting gene function. Genome Biology, 9(Suppl 1), S4. Murzin, A., Brenner, S., Hubbard, T., & Chothia, C. 1995. SCOP: a structural classification of proteins database for the investigation of sequences and structures. Journal of Molecular Biology, 247, 536–540. Myers, C.L., Robson, D., Wible, A., Hibbs, M., Chiriac, C., Theesfeld, C.L., Dolinski, K., & Troyanskaya, O.G. 2005. Discovery of biological networks from diverse functional genomic data. Genome Biology, 6, R114. Nocedal, J., & Wright, S.J. 2006. Numerical Optimization. Springer. Obozinski, G., Lanckriet, G., Grant, C., Jordan, M.I., & Noble, W.S. 2008. Consistent probabilistic outputs for protein function prediction. Genome Biology, 9(Suppl 1), S6. Pavlidis, P., Weston, J., Cai, J., & Noble, W.S. 2002. Learning gene functional classification from multiple data types. Journal of Computational Biology, 9, 401–411. Taskar, B., Guestrin, C., & Koller, D. 2003. Max Margin Markov Networks. Advances in Neural Information Processing Systems (NIPS). Tsuda, K., Shin, H.J., & Schoelkopf, B. 2005. Fast protein classification with multiple networks. Bioinformatics, 21(Suppl 2), ii59–ii65. von Mering, C., Huynen, M., Jaeggi, D., Schmidt, S., Bork, P., & Snel, B. 2003. STRING: a database of predicted functional associations between proteins. Nucleic Acids Research, 31(1), 258–261. Zhou, D., Bousquet, O., Weston, J., & Scholkopf, B. 2004. Learning with local and global consistency. Advances in Neural Information Processing Systems (NIPS), 16, 321–328. Zhu, X., Ghahramani, Z., & Lafferty, J. 2003. SemiSupervised Learning Using Gaussian Fields and Harmonic Functions. International Conference on Machine Learning (ICML), 912–919.
5cs.CE
Finding Subcube Heavy Hitters in Analytics Data Streams arXiv:1708.05159v2 [cs.DS] 20 Feb 2018 Branislav Kveton∗ Adobe Research [email protected] S. Muthukrishnan Rutgers University [email protected] Hoa T. Vu† University of Massachusetts [email protected] Yikun Xian Rutgers University [email protected] Abstract Modern data streams typically have high dimensionality. For example, digital analytics streams consist of user online activities (e.g., web browsing activity, commercial site activity, apps and social behavior, and response to ads). An important problem is to find frequent joint values (heavy hitters) of subsets of dimensions. Formally, the data stream consists of d-dimensional items and a k-dimensional subcube T is a subset of k distinct coordinates. Given a theshold γ, a subcube heavy hitter query Query(T, v) outputs YES if fT (v) ≥ γ and NO if fT (v) < γ/4 where fT is the ratio of the number of stream items whose coordinates T have joint values v. The all subcube heavy hitters query AllQuery(T ) outputs all joint values v that return YES to Query(T, v). The problem is to answer these queries correctly for all T and v. We present a simple one-pass sampling algorithm to solve the subcube heavy hitters problem in Õ(kd/γ) space. Õ(·) suppresses polylogarithmic factors. This is optimal up to polylogarithmic factors based on the lower bound of Liberty et al. [13] In the worst case, this bound becomes Θ(d2 /γ) which is prohibitive for large d. Our main contribution is to circumvent this quadratic bottleneck via a model-based approach. In particular, we assume that the dimensions are related to each other via the Naive Bayes model. We present a new two-pass, Õ(d/γ)-space algorithm for our problem, and a fast algorithm for answering AllQuery(T ) in Õ((k/γ)2 ) time. We demonstrate the effectiveness of our approach on a synthetic dataset as well as real datasets from Adobe and Yandex. Our work shows the potential of model-based approach to data streams. ∗ The † Part authors are listed alphabetically. of this work was done at Adobe Research. 1 1 Introduction We study the problem of finding heavy hitters in high dimensional data streams. Most companies see transactions with items sold, time, store location, price, etc. that arrive over time. Modern online companies see streams of user web activities that typically have components of user information including ID (e.g. cookies), hardware (e.g., device), software (e.g., browser, OS), and contents such as web properties, apps. Activity streams also include events (e.g., impressions, views, clicks, purchases) and event attributes (e.g., product id, price, geolocation, time). Even classical IP traffic streams have many dimensions including source and destination IP addresses, port numbers and other features of an IP connection such as application type. Furthermore, in applications such as Natural Language Processing, streams of documents can be thought of as streams of a large number of bigrams or multi-grams over word combinations [8]. As these examples show, analytics data streams with 100’s and 1000’s of dimensions arise in many applications. Motivated by this, we study the problem of finding heavy hitters on data streams focusing on d, the number of dimensions, as a parameter. Given d one sees in practice, d2 in space usage is prohibitive, for solving the heavy hitters problem on such streams. Formally, let us start with a one-dimensional stream of items x1 , . . . xm where each xi ∈ [n] := {1, 2, . . . , n}. We can look at the count c(v) = |{i : xi = v}| or the frequency ratio f (v) = c(v)/m. A heavy hitter value v is one with c(v) ≥ γm or equivalently f (v) ≥ γ, for some constant γ. The standard data stream model is that we maintain data structures of size polylog(m, n) and determine if v is a heavy hitter with probability of success at least 3/4, that is, if f (v) ≥ γ output YES and output NO if f (v) < γ/4 for all v.1 We note that if γ/4 ≤ f (v) < γ, then either answer is acceptable. Detecting heavy hitters on data streams is a fundamental problem that arises in guises such as finding elephant flows and network attacks in networking, finding hot trends in databases, finding frequent patterns in data mining, finding largest coefficients in signal analysis, and so on. Therefore, the heavy hitters problem has been studied extensively in theory, databases, networking and signal processing literature. See [4] for an early survey and [19] for a recent survey. Subcube heavy hitter problems Our focus is on modern data streams such as in analytics cases, with d dimensions, for large d. The data stream consists of d-dimensional items x1 , · · · , xm . In particular, xi = (xi,1 , . . . , xi,d ) and each xi,j ∈ [n] . A k-dimensional subcube T is a subset of k distinct coordinates {T1 , · · · , Tk } ⊆ [d]. We refer to the joint values of the coordinates T of xi as xi,T . The number of items whose coordinates T have joint values v is denoted by cT (v), i.e., cT (v) = |{i : xi,T = v}| . Finally, we use XT to denote the random variable of the joint values of the coordinates T of a random item. We have the following relationship cT (v) . fT (v) := Pr [XT = v] = m For a single coordinate i, we slightly abuse the notation by using fi and f{i} interchangeably. For example, fTi (v) is the same as f{Ti } (v). Similarly, Xi is the same as X{i} . We are now ready to define our problems. They take k, γ as parameters and the stream as the input and build data structures to answer: • Subcube Heavy Hitter: Query(T, v), where |T | = k, and v ∈ [n]k , returns an estimate if fT (v) ≥ γ. Specifically, output YES if fT (v) ≥ γ and NO if fT (v) < γ/4. If γ/4 ≤ fT (v) < γ, then either output is acceptable. The required success probability for all k-dimensional subcubes T and v ∈ [n]k is at least 3/4. • All Subcube Heavy Hitters: AllQuery(T ) outputs all joint values v that return YES to Query(T, v). This is conditioned on the algorithm used for Query(T, v). It is important to emphasize that the stream is presented (in a single pass or constant passes) to the algorithm before the algorithm receives any query. 1 The gap constant 4 can be narrowed arbitrarily and the success probability can be amplified to 1 − δ as needed, and we omit these factors in the discussions. 1 Subcube heavy hitters are relevant wherever one dimensional heavy hitters have found applications: combination of source and destination IP addresses forms the subcube heavy hitters that detect network attacks; combination of stores, sales quarters and nature of products forms the subcube heavy hitters that might be the pattern of interest in the data, etc. Given the omnipresence of multiple dimensions in digital analytics, arguably, subcube heavy hitters limn the significant data properties far more than the single dimensional view. Related works The problem we address is directly related to frequent itemset mining studied in the data mining community. In frequent itemset mining, each dimension is binary (n = 2), and we consider Query(T, v) where v = (1, . . . , 1) := Uk . It is known that counting all maximal subcubes T that have a frequent itemset, i.e., fT (Uk ) ≥ γ, is #P -complete [21]. Furthermore, finding even a single T of maximal size such that fT (Uk ) ≥ γ is NP-hard [9, 13]. Recently, Liberty et al. showed that any constant-pass streaming algorithm answering Query(T, Uk ) requires Ω(kd/γ · log(d/k)) bits of memory [13]. In the worst case, this is Ω(d2 /γ) for large k, ignoring the polylogarithmic factors. For this specific problem, sampling algorithms will nearly meet their lower bound for space. Our problem is more general, with arbitrary n and v. Our contributions Clearly, the case k = 1 can be solved by building one of the many known single dimensional data structures for the heavy hitters problem on each of the d dimension; the k = d case can be thought  of as a giant single dimensional problem by linearizing the space of all values in [n]k ; for any other k, there are kd distinct choices for subcube T , and these could be treated as separate one-dimensional problems by linearizing each of the  subcubes. In general, this entails kd and log(nd ) cost in space or time bounds over the one-dimensional case, which we seek to avoid. Also, our problem can be reduced to the binary case by unary encoding each dimension by n bits, and solving frequent itemset mining: the query then has kn dimensions. The resulting bound will have an additional n factor which is large. First, we observe that the reservoir sampling approach [18] solves subcube heavy hitters problems more efficiently compared to the approaches mentioned above. Our analysis shows that the space we use is within polylogarithmic factors of the lower bound shown in [13] for binary dimensions and query vector Uk , which is a special case of our problem. Therefore, the subcube heavy hitters problem can be solved using Õ(kd/γ) space. However, this is Ω(d2 ) in worst case. Our main contribution is to avoid this quadratic bottleneck for finding subcube heavy hitters. We adopt the notion that there is an underlying probabilistic model behind the data, and in the spirit of the Naive Bayes model, we assume that the dimensions are nearly (not exactly) mutually independent given an observable latent dimension. This could be considered as a low rank factorization of the dimensions. In particular, one could formalize this assumption by bounding the total variational distance between the data’s joint distribution and that derived from the Naive Bayes formula. This assumption is common in statistical data analysis and highly prevalent in machine learning. Following this modeling, we make two main contributions: • We present a two-pass, Õ(d/γ)-space streaming algorithm for answering Query(T, v). This improves upon the kd factor in the space complexity from sampling, without assumptions, to just d with the Naive Bayes assumption, which would make this algorithm practical for large k. Our algorithm uses sketching in each dimension in one pass to detect heavy hitters, and then needs a second pass to precisely estimate their frequencies. • We present a fast algorithm for answering AllQuery(T ) in Õ((k/γ)2 ) time. The naive procedure would take exponential time Ω((1/γ)k ) by considering the Cartesian product of the heavy hitters in each dimension. Our approach, on the other hand, uses the structure of the Naive Bayes assumption to iteratively construct the subcube heavy hitters one dimension at a time. Our work develops the direction of model-based data stream analysis. Model-based data analysis has been effective in other areas. For example, in compressed sensing, realistic signal models that include dependencies between values and locations of the signal coefficients improve upon unconstrained cases [7]. In statistics, using tree constrained models of multidimensional data sometimes improves point and density estimation. In high dimensional distribution testing, model based approach has also been studied to overcome the curse of dimensionality [6]. In the data stream model, [10, 2, 3] studied the problem of testing independence. McGregor and Vu [15] studied the problem of evaluating Bayesian Networks. In another work, Kveton et al. [11] assumed a tree graphical model and designed a one-pass algorithm that estimates the joint frequency; their work however only solved the k = d case for the joint frequency estimation problem. Our model is a bit different and more importantly, we solve the 2  subcube heavy hitters problem (addressing all the kd subcubes) which prior work does not solve. In following such a direction, we have extended the fundamental heavy hitters problem to higher dimensional data. Given that many implementations already exist for the sketches we use for one-dimensional heavy hitters as a blackbox, our algorithms are therefore easily implementable. Background on the Naive Bayes model and its use in our context. The Naive Bayes Model [17] is a Bayesian network over d features X1 , . . . , Xd and a class variable Y . This model represents a joint probability distribution of the form Pr [X1 = x1 , . . . , Xd = xd , Y = y] = Pr [Y = y] d Y Pr [Xj = xj | Y = y] , j=1 which means that the values of the features are conditionally independent given the value of the class variable. The simplicity of the Naive Bayes model makes it a popular choice in text processing and information retrieval [12, 14], with state-of-the-art performance in spam filtering [1], text classification [12], and others. Empirical study. We perform detailed experimental study of subcube heavy hitters. We use a synthetic dataset where we generate data that confirms to the Naive Bayes model. We then experiment with real data sets from Yandex (Search) and Adobe (Marketing Cloud) which give multidimensional analytics streams. We experiment with the reservoir sampling based algorithm as a benchmark that works without modeling assumptions, and our two-pass subcube heavy hitters algorithm that improves upon it for data that satisfies the model. We also adopt our approach to give a simpler one-pass algorithm for which theoretical guarantees is weaker. Our experiments show substantial improvement of the model-based algorithms over the benchmark for synthetic as well as real data sets, and further show the benefits of the second pass. 2 The Sampling Algorithm In this section, we show that sampling solves the problem efficiently compared to running one-dimensional heavy  hitters algorithms for each of kd k-dimensional subcubes independently. It also matches the lower bound in [13] up to polylogarithmic factors. Algorithm details. The algorithm samples m0 = Õ(γ −1 kd) random items z1 , . . . , zm0 from the stream using Reservoir sampling [18]. Let S = {z1 , . . . , zm0 } be the sample set. Given Query(T, v), we output YES if and only if the sample frequency of v, denoted by fˆT (v), is at least γ/2. Specifically, |{xi : xi ∈ S and xi,T = v}| . fˆT (v) := m0 For all subcubes T and joint values v of T , the expected sample frequency fˆT (v) is fT (v). Intuitively, if v is a frequent joint values, then its sample frequency fˆT (v) ≈ fT (v); otherwise, fˆT (v) stays small. Let us fix a k-dimensional subcube T and suppose that for all v ∈ [n]k , we have max{γ, fT (v)} fˆT (v) = fT (v) ± . 4 (1) It is then straightforward to see that if fT (v) < γ/4, then fˆT (v) < γ/4 + γ/4 = γ/2. Otherwise, if fT (v) ≥ γ, then fˆT (v) ≥ 3fT (v)/4 ≥ 3γ/4 > γ/2. Hence, we output YES for all v where fˆT (v) ≥ γ/2, and output NO otherwise. Lemma Pn2.1. (Chernoff bound) Let X1 , · · · , Xn be independent or negatively correlated binary random variables. Let X = i=1 Xi and µ = E [X]. Then, Pr [|X − µ| ≥ µ] ≤ exp(− min{2 , }µ/3) . 3 Recall that S = {z1 , z2 , . . . , zm0 } is the sample set returned by the algorithm. For a fixed v ∈ [n]k , we use Zi as the indicator variable for the event zi,T = v. Since we sample without replacement, the random variables Zi are negatively correlated. The following lemma shows that Eq. 1 holds for all v and k-dimensional subcubes T via Chernoff bound. Lemma 2.2. For all k-dimensional subcubes T and joint values v ∈ [n]k , with probability at least 0.9, max{γ, fT (v)} . fˆT (v) = fT (v) ± 4 Proof. Let m0 = cγ −1 log(dk · nk ) for some sufficiently large constant c. We first consider a fixed v ∈ [n]k and define the random variables Zi as above, i.e., Zi = 1 if zi,T = v. Suppose fT (v) ≥ γ. Appealing to Lemma 2.1, we have    0 m X fT (v)  Zi  − fT (v) ≥ Pr   0 m 4 i=1   fT (v) = Pr fˆT (v) − fT (v) ≥ 4   fT (v)m0 1 ≤ exp − ≤ . 3 × 16 10dk nk On the other hand, if fT (v) < γ/4, then     h γi γ m0 ˆ Pr fT (v) − fT (v) ≥ ≤ exp − fT (v) 4 4fT (v) 3 1 ≤ . 10dk nk  Therefore, by taking the union bound over all kd · nk ≤ dk · nk possible combinations of k-dimensional subcubes and the corresponding joint values v ∈ [n]k , we deduce the claim. We therefore could answer all Query(T, v) correctly with probability at least 0.9 for all joint values v ∈ [n]k and k-dimensional subcubes T . Because storing each sample zi requires Õ(d) bits of space, the algorithm uses Õ(dkγ −1 ) space. We note that answering Query(T, v) requires computing fˆT (v) which takes O(|S|) time. We can answer AllQuery(T ) by computing fˆT (v) for all joint values v of coordinates T that appear in the sample set which 2 will take O(|S| ) time. We summarize the result as follows. Theorem 2.3. There exists a 1-pass algorithm that uses Õ(dkγ −1 ) space  and solves k-dimensional subcube heavy   −1 2 −1 hitters. Furthermore, Query(T, v) and AllQuery(T ) take Õ(dkγ ) and Õ dkγ time respectively. 3 The Near-Independence Assumption The near-independence assumption. Suppose the random variables representing the dimensions X1 , X2 , . . . , Xd are near independent. We show that there is a 2-pass algorithm that uses less space and has faster query time. At a high level, we make the assumption that the joint probability is approximately factorized f{1,...,d} (v) ≈ f1 (v1 )f2 (v2 ) · · · fd (vd ) . More formally, we assume that the total variation distance is bounded by a small quantity α. Furthermore, we assume that α is reasonable with respect to γ that controls the heavy hitters. For example, α ≤ γ/10 will suffice. The formal near-independence assumption is as follows: There exists α ≤ γ/10 such that for all subcubes T , max v∈[n]|T | fT (v) − |T | Y i=1 We observe that: 4 fTi (vi ) < α . • If fT (v) ≥ γ, then |T | Y fTi (vi ) ≥ fT (v) − γ/10 > γ/2 . i=1 • If fT (v) < γ/4, then |T | Y fTi (vi ) ≤ fT (v) + γ/10 < γ/2 . i=1 Thus, it suffices to output YES to Query(T, v) if and only if the marginals product nience, let λ := γ/2 . Q|T | i=1 fTi (vi ) ≥ γ/2. For conve- Algorithm details. We note that simply computing fi (x) for all coordinates i ∈ [d] and x ∈ [n] will need Ω(dn) space. To over come this, we make following simple but useful observation. We observe that if v is a heavy hitter in the subcube T and if T 0 is a subcube of T , then vT 0 is a heavy hitter in the subcube T 0 . Lemma 3.1. For all subcubes T , |T | Y fTi (vi ) ≥ λ implies i=1 Y fTi (vi ) ≥ λ i∈V for all V ⊆ [|T |] (i.e., {Ti : i ∈ V} is a subcube of T ). The proof is trivial since all fTi (vi ) ≤ 1. Therefore, we have the following corollary. Corollary 3.2. For all subcubes T , |T | Y fTi (vi ) ≥ λ implies fTi (vi ) ≥ λ for all i ∈ [|T |] . i=1 We therefore only need to compute fi (x) if x is a heavy hitter in coordinate i. To this end, for each coordinate i ∈ [d], by using (for example) Misra-Gries algorithm [16] or Count-Min sketch [5], we can find a set Hi such that if fi (x) ≥ λ/2, then x ∈ Hi and if fi (x) < λ/4, then x ∈ / Hi . In the second pass, for each x ∈ Hi , we compute fi (x) exactly to obtain Si := {x ∈ [n] : fi (x) ≥ λ} . Q|T | We output YES to Query(T, v) if and only if all vi ∈ STi and i=1 fTi (vi ) ≥ λ. Note that if v ∈ Si , then fi (v) is available to the algorithm since it is computed exactly in the second pass. The detailed algorithm is as follows. 1. First pass: For each coordinate i ∈ [d], use Misra-Gries algorithm to find Hi . 2. Second pass: For each coordinate i ∈ [d], compute fi (x) exactly for each x ∈ Hi to obtain Si . 3. Output YES to Query(T, v) if and only if vi ∈ STi for all i ∈ [|T |] and |T | Y fTi (vi ) ≥ λ . i=1 Theorem 3.3. There exists a 2-pass algorithm that uses Õ(dγ −1 ) space and solves subcube heavy hitters under the near-independence assumption. The time to answer Query(T, v) and AllQuery(T ) are Õ(k) and Õ(kγ −1 ) respectively where k is the dimensionality of T . 5 Proof. The first pass uses Õ(dλ−1 ) space since Misra-Gries algorithm uses Õ(λ−1 ) space for each coordinate i ∈ [d]. Since the size of each Hi is O(λ−1 ), the second pass also uses Õ(dλ−1 ) space. Recall that λ = γ/2. We then conclude that the algorithm uses Õ(dγ −1 ) space. For an arbitrary Query(T, v), the algorithm’s correctness follows immediately from Corollary 3.2 and the observation that if vi ∈ STi , then fTi (vi ) is available since it was computed exactly in the second pass. Specifically, if |T | Y (2) fTi (vi ) ≥ λ , i=1 then vi ∈ STi for all i ∈ [|T |] and we could verify the inequality and output YES. On the other hand, suppose Eq. 2 does not hold. Then, if vi ∈ / STi for some i, we correctly output NO. But if all vi ∈ STi , then we are able to verify that the inequality does not hold (and correctly output NO). The parameter k only affects the query time. We now analyze the time to answer Query(T, v) and AllQuery(T ) for a k-dimensional subcube T . We can easily see that Query(T, v) takes Õ(k) time as we need to check if all vi ∈ STi (e.g., using binary Qk searches) and compute i=1 fTi (vi ). Next, we exhibit a fast algorithm to answer AllQuery(T ). We note that naively checking all combinations (v1 , · · · , vk ) in ST1 × ST2 × · · · × STk takes exponential Ω(γ −k ) time in the worst case. Our approach figures out the heavy hitters gradually and takes advantage of the near-independence assumption. In particular, define Wj := {v ∈ [n]j : fT1 (v1 ) · · · fTj (vj ) ≥ λ} . Recall that the goal is to find Wk . Note that W1 = S1 is obtained directly by the algorithm. We now show that it is possible to construct Wj+1 from Wj in Õ(λ−1 ) time which in turn means that we can find Wk in Õ(kλ−1 ) time. We use the notation T[j] := {T1 , . . . , Tj } and v[j] := (v1 , v2 , . . . , vj ). Qj We note that |Wj | ≤ 5/(4λ). This holds since if y ∈ Wj , then i=1 fTi (yi ) ≥ λ. Appealing to the nearindependence assumption, we have fT[j] (y) ≥ j Y fTi (yi ) − α ≥ λ − α ≥ 4/5 · λ . i=1 For each y ∈ Wj , we collect all x ∈ Sj+1 such that j Y ! fTi (yi ) fTj+1 (x) ≥ λ i=1 and put (y1 , · · · , yj , x) into Wj+1 . Since |Wj | ≤ 5/4 · λ−1 and |Sj+1 | ≤ λ−1 , this step obviously takes O(λ−2 ) Qj time. However, by observing that there could be at most λ−1 i=1 fTi (yi ) such x for each y ∈ Wj , the upper bound for the number of combinations of x and y is j X 1 X 1Y fTi (yi ) ≤ (fT (y) + α) λ i=1 λ [j] y∈Wj y∈Wj = X α X fT[j] (y) + λ λ y∈Wj y∈Wj 1 3 ≤ |Wj | + ≤ . λ λ P The last inequality follows from the assumption that α ≤ λ/5 and y∈Wj fT[j] (y) ≤ 1. Thus, the algorithm can find Wj+1 given Wj in Õ(λ−1 ) time. Hence, we obtain Wk in Õ(kλ−1 ) = Õ(kγ −1 ) time. The correctness of this procedure follows directly from Lemma 3.1 and induction since v = (v1 , . . . , vj+1 ) ∈ Wj+1 implies that v[j] ∈ Wj and vj+1 ∈ Sj+1 . Thus, by checking all combinations of y ∈ Wj and x ∈ Sj+1 , we can construct Wj+1 correctly. 6 4 The Naive Bayes Assumption The Naive Bayes assumption. In this section, we focus on the data streams inspired by the Naive Bayes model which is strictly more general than the near-independence assumption. In particular, we assume that the coordinates are near-independent given an extra (d+1)th observable class coordinate that has a value in {1, . . . , `}. The (d+1)th coordinate is also often referred to as the latent coordinate. As in typical in Naive Bayes analysis, we assume ` is a constant but perform the calculations in terms of ` so its role in the complexity of the problem is apparent. Informally, this model asserts that the random variables representing coordinates X1 , . . . , Xd are near independent conditioning on a the random variable Xd+1 that represents the class coordinate. We introduce the following notation {xi : xi,T = v ∧ xi,{d+1} = z} {xi : xi,{d+1} = z} fT | d+1 (v | z) := = Pr [XT = v | Xd+1 = z] . In other words, fT | d+1 (v | z) is the frequency of the joint values v in the T coordinates among the stream items where the class coordinate d + 1 has value z. The formal Naive Bayes assumption is as follows: There exists α ≤ γ/10 such that for all subcubes T , max v∈[n]|T | X fT (v) − fd+1 (z) |T | Y fTi | d+1 (vi | z) < α . i=1 z∈[`] Algorithm details. As argued in the previous section, it suffices to output YES to Query(T, v) if and only if X fd+1 (z) |T | Y fTi | d+1 (vi | z) ≥ γ/2 = λ . i=1 z∈[`] However, naively computing all fi | d+1 (v|z) uses Ω(`dn) space. We circumvent this problem by generalizing Lemma 3.1 as follows. If a joint values v is a heavy hitter in a subcube T in the Naive Bayes formula and T 0 is a subcube of T , then vT 0 is a heavy hitter in the subcube T 0 . Lemma 4.1. For all subcubes T , q(v) := X fd+1 (z) X fTi | d+1 (vi | z) ≥ λ i=1 z∈[`] implies |T | Y fd+1 (z) Y fTi | d+1 (vi | z) ≥ λ i∈V z∈[`] for all V ⊆ [|T |] (i.e., {Ti : i ∈ V} is a subcube of T ). Proof. For a fixed z, observe that X fTj | d+1 (yj | z) = 1 . yj ∈[n] 7 Suppose q(v) ≥ λ and consider an arbitrary V ⊆ [|T |]. We have X Y fd+1 (z) fTi | d+1 (vi | z) z∈[`] i∈V X Y  = ≥ fd+1 (z) i∈V j ∈V / X Y Y fd+1 (z) X fTi | d+1 (vi | z) i∈V fd+1 (z) |T | Y  X  z∈[`] z∈[`] = fTi | d+1 (vi | z) Y fTj | d+1 (yj | z) yj ∈[n] fTj | d+1 (vj | z) j ∈V / fTi | d+1 (vi | z) = q(v) ≥ λ . i=1 z∈[`] An alternative proof is by noticing that q(v) is a valid probability density function of |T | variables. The claim follows by marginalizing over the the variables that are not in V. Setting V = {i} for each i ∈ [|T |] and appealing to the fact that X X fd+1 (z)fTi | d+1 (vi | z) = f{Ti ,d+1} ((vi , z)) = fTi (vi ) , z∈[`] z∈[`] we deduce the following corollary. Corollary 4.2. For all subcubes T , X z∈[`] fd+1 (z) |T | Y fTi | d+1 (vi | z) ≥ λ implies fTi (vi ) ≥ λ i=1 for all i ∈ [|T |]. Therefore, we only need to compute fi | d+1 (x | z) for all coordinates i ∈ [d], values z ∈ [`] if x is a heavy hitter of coordinate i. Similar to the previous section, for each dimension i ∈ [d], we find Hi in the first pass and use Hi to find Si in the second pass. Appealing to Corrollary 4.2, we deduce that if q(v) := X fd+1 (z) z∈[`] |T | Y fTi | d+1 (vi | z) ≥ λ i=1 then for all i = 1, 2, . . . , |T |, we have fTi (vi ) ≥ λ which in turn implies that vi ∈ STi . Therefore, we output YES to Query(T, v) if and only if all vi ∈ STi and q(v) ≥ λ. To this end, we only need to compute fi | d+1 (x | z) and fd+1 (z) for all x ∈ Hi , z ∈ [`], and i ∈ [d]. The detailed algorithm is as follows. 1. First pass: (a) For each value z ∈ [`], compute fd+1 (z) exactly. (b) For each coordinate i ∈ [d], use Misra-Gries algorithm to find Hi . 2. Second pass: (a) For each coordinate i ∈ [d] and each value x ∈ Hi , compute fi (x) exactly to obtain Si . (b) For each value z ∈ [`], coordinate i ∈ [d], and x ∈ Hi , compute fi | d+1 (x | z) exactly. 3. Output YES to Query(T, v) if and only if vi ∈ STi for all i ∈ [|T |] and X z∈[`] fd+1 (z) |T | Y fTi | d+1 (vi | z) ≥ λ . i=1 8 Theorem 4.3. There exists a 2-pass algorithm that uses Õ(`dγ −1 ) space and solves subcube heavy hitters under the Naive Bayes assumption. The time to answer Query(T, v) and AllQuery(T ) are Õ(`k) and O(`(k/γ)2 ) respectively where k is the dimensionality of T . Proof. The space to obtain Hi and Si over the two passes is Õ(dλ−1 ). Additionally, computing fi | d+1 (x | z) for all i ∈ [d], z ∈ [`], and x ∈ Hi requires Õ(`dλ−1 ) bits of space. The overall space we need is therefore Õ(`dλ−1 ) = Õ(`dγ −1 ). The correctness of answering an arbitrary Query(T, v) follows directly from Corollary 4.2. Specifically, if X fd+1 (z) |T | Y fTi | d+1 (vi | z) ≥ λ , (3) i=1 z∈[`] then, vi ∈ STi ⊆ HTi for all i ∈ [|T |] as argued. Hence, fTi | d+1 (vi | z) is computed exactly in the second pass for all z ∈ [`]. As a result, we could verify the inequality and output YES. On the other hand, if Eq. 3 does not hold. Then, if some vi ∈ / STi , we will correctly output NO. Otherwise if all vi ∈ STi , then we can compute the left hand side and verify that Eq. 3 does not hold (and correctly output NO). Obviously, Query(T, v) takes Õ(`k) time for a k-dimensional subcube T . We now exhibit a fast algorithm to answer AllQuery(T ) for a k-dimensional subcube T . Define Wj := {v ∈ [n]j : X fd+1 (z) j Y fTi | d+1 (vi | z) ≥ λ} . i=1 z∈[`] Recall that the goal is to find Wk . We note that W1 = S1 is obtained directly by the algorithm. Next, we show how to obtain Wj+1 in Õ(λ−2 ) time from Wj . Note that |Wj | ≤ 5/(4λ) because if y ∈ Wj , then X fT1 | d+1 (y1 | z) · · · fTj | d+1 (yj | z)fd+1 (z) ≥ λ z∈[`] and hence fT[j] (y) ≥ λ − α = 4/5 · λ−1 according to the Naive Bayes assumption. This implies that |Wj | ≤ 5/(4λ). For each (v1 , · · · , vj ) in Wj , we collect all vj+1 ∈ Sj+1 such that X fT1 | d+1 (v1 | z) · · · fTj+1 | d+1 (vj+1 | z)fd+1 (z) ≥ λ z∈[`] and put (v1 , · · · , vj+1 ) to Wj+1 . Since |Wj | ≤ 5/(4λ) and |Sj+1 | ≤ 1/λ, this step obviously takes Õ(`kλ−2 ) time. Since we need to do this for j = 2, 3, . . . , k, we attain Wk in Õ(`(k/γ)2 ) time. The correctness of this procedure follows directly from Lemma 4.1 and induction since (v1 , . . . , vj+1 ) ∈ Wj+1 implies that (v1 , . . . , vj ) is in Wj and vj+1 is in Sj+1 . Since we check all possible combinations of (v1 , . . . , vj ) ∈ Wj and vj+1 ∈ Sj+1 , we guarantee to construct Wj+1 correctly. 5 Experimental study Overview. We experiment with our algorithms on a synthetic dataset generated from a Naive Bayes model, and two real-world datasets from Adobe Marketing Cloud2 and Yandex. We thoroughly compare the following approaches: • The sampling method (Sampling) in Section 2. • The 2-pass algorithms (TwoPassAlg) described in Section 3 and 4 depending on the context of the experiment. • The Count-Min sketch heuristic (Heuristic): this heuristic uses Count-Min sketch’s point query estimation (see [5]) to estimate the frequencies given by the near-independence formula (instead of making a second pass through the stream to compute their exact values). We note that this approach has no theoretical guarantee. 2 http://www.adobe.com/marketing-cloud.html 9 We highlight the main differences between the theoretical algorithms in Sections 3 and 4 and the actual implementation: • Instead of running our algorithms with the theoretical memory bounds, we run and compare them for different memory limits. This approach is more practical and natural from the implementation perspective. • In theory, Sampling and TwoPassAlg use a fixed threshold γ ∗ = γ/2 to decide between outputting YES or NO. We however experiment with different values of γ ∗ which is helpful when the memory is more limited or when the assumptions are not perfect in real data. The heavy hitters threshold γ is carefully chosen so that the proportion of the number of heavy hitters to the total number joint values to be reasonably small, i.e., approximately at most 1% in this paper. Therefore, we use different values of γ for each dataset (see Table 1 for the actual parameter values). 5.1 Synthetic dataset The synthetic dataset is sampled from a pre-trained Naive Bayes model that is used to estimate the probability of a page view. The model was provided by [11] and built on the same Clickstream dataset that we used in Section 5.2. The coordinates consist of one class variable Z and five feature variables (X1 , . . . , X5 ) with high cardinalities. The dataset strongly follows the property that X1 , . . . , X5 are conditionally independent given Z. Specifically, the variables and their corresponding approximate cardinalities are: country (7), city (10,500), page name (8,500), starting page name (6,400), campaign (3,500), browser (300) where country is the class variable. Warm up experiment We first evaluate Sampling and Heuristic on this synthetic dataset. As mentioned earlier, we compare the performance of the two approaches for each fixed memory size.3 We take a subset of approximately 135, 000 records conditioned on a fixed and most frequent value of Z so that X1 , . . . , X5 are independent in this subset. We then run experiments on three different subcubes: {X1 , X2 , X3 }, {X2 , X3 , X4 }, and {X3 , X4 , X5 }. In this warm up experiment, the main goal is not to find the heavy hitters but to compare the accuracy of the heavy hitters frequency estimations given by Heuristic and Sampling. We measure the performance via the mean square error (MSE), the mean absolute error (MAE), and the mean absolute percentage error (MAPE). To do this, the true frequencies were pre-computed. We use the frequencies of the top 10 heavy hitters in each of the above subcubes. The results (see Figure 1) indicate that Heuristic outperforms Sampling when restricted to small memory. This warm up experiment gives evidence that knowing the underlying distribution structure helps improving small space heuristic’s performance in estimating the heavy hitters frequencies. 6 Sampling Heuristic 2 Sampling Heuristic 4 14 16 0.00 0.02 0.04 0.06 Memory size 0.08 0.10 log(MAPE) 12 Sampling Heuristic 1 5 10 log(MAE) log(MSE) 8 6 0 1 7 2 8 3 0.00 0.02 0.04 0.06 Memory size 0.08 0.10 0.00 0.02 0.04 0.06 Memory size 0.08 0.10 Figure 1: Warm up experiment on synthetic data. Memory size ranges from 0.1% to 10% of data size. We report the error as a function of memory size. Experiment with the near-independence assumption. We compare performance of the three aforementioned methods on finding heavy hitters under the near-independence assumption. In this experiment, we use the same subset of data and subcubes as in the previous experiment. We fix the memory to be 2% of data size. 3 We compute the memory use by the Sampling as the product of dimension and the sample size. The memory used by Heuristic is computed as the product of dimension and the Count-Min sketch’s size. 10 Dataset Synthetic (fixed Z) Synthetic (whole) Clickstream Yandex Mem. 2% 2% 10% 0.2% #Subcubes 3 3 4 8 γ 0.002 0.002 0.002 0.1 #HH 29.7 28.7 42.0 2.2 HH ratio 0.079% 0.054% 0.165% 1.65% Table 1: Parameter values for each experiment. (The columns correspond to memory size relative to the dataset, number of the experimented subcubes, average number of heavy hitters, average percentage of heavy hitters.) We measure the performance, for different values of γ ∗ , based on the number of true positives and false positives. As shown in Figure 2, for small memory, both Heuristic and TwoPassAlg manage to find more heavy hitters than Sampling. In terms of false positives, TwoPassAlg beats both Heuristic and Sampling for smaller space. One possible explanation is that when γ ∗ is small (close to γ), TwoPassAlg, with the advantage of the second pass, accurately estimates frequencies of potential heavy hitters whereas the other two methods, especially Heuristic, overestimate the frequencies and therefore report more false positives. For larger γ ∗ , false positives become less likely and all three approaches achieve similar performances. In general, TwoPassAlg obtains the best performance as seen in the ROC curve. Sampling Heuristic TwoPassAlg 70 60 50 40 90 Sampling Heuristic TwoPassAlg 1000 800 False Positives(s) True Positive(s) 80 80 True Positive(s) 90 600 400 0.006 * 0.008 0.010 50 Sampling Heuristic TwoPassAlg 30 0 0.004 60 40 200 30 70 0.004 0.006 * 0.008 0.010 0 200 400 600 800 False Positive(s) 1000 Figure 2: Near-independence experiment on synthetic dataset. We measure the performance based on the number of true and false positives (as a function of γ ∗ ), and the ROC curve. Experiment with the Naive Bayes assumption We use the whole dataset of approximately 168, 000 records without fixing Z and keep other settings unchanged. We only compared the performance of TwoPassAlg and Sampling because the conditional probabilities cannot be directly derived from Heuristic. In Figure 3, we observe that when restricted to small memory, TwoPassAlg attains a better performance by reporting more true heavy hitters and fewer false heavy hitters. As we allow more space, the performance of Sampling improves as predicted by our theoretical analysis. Sampling TwoPassAlg 80 50 40 800 600 400 30 200 20 0 0.002 0.004 0.006 * 0.008 0.010 70 True Positive(s) False Positive(s) 60 Sampling TwoPassAlg 80 1000 70 True Positive(s) Sampling TwoPassAlg 1200 60 50 40 30 0.002 0.004 0.006 * 0.008 0.010 20 0 200 Figure 3: Naive Bayes experiment on synthetic dataset. 11 400 600 800 1000 1200 False Positive(s) 5.2 Clickstream dataset To evaluate TwoPassAlg on real data, we use an advertising dataset called Clickstream Data Feeds from Adobe Marketing Cloud. The approximate dataset size is 168, 000 and all values have been anonymized in advance. There are 19 high cardinality variables grouped by categories as follows: geography info (city, region, country, domain, carrier), page info (page name, start page name, first-hit page name), search info (visit number, referrer, campaign, keywords, search engine), external info (browser, browser width/height, plugins, language, OS). We avoid obvious correlated features in the query subcubes, e.g., “search engine” and “keywords” are highly correlated. For example, some highly correlated variables and their correlations are: start page name & first-hit page name (0.67), browser & OS (0.40), region & country (0.32), search engine & country (0.27). We carefully select a subset of coordinates that may follow the near independence assumption to query on. For instance, we show our experiment results for the following subcubes, along with the number of heavy hitters recorded: {region, page name , language}, {region, campaign, plugins}, {carrier, first-hit page name, plugins}, {carrier, keywords, OS }. Since strong independence property is not guaranteed in this real dataset, we increase memory size to 10% of the data size in order to obtain better estimation for all methods. Recall that the memory used by Sampling and TwoPassAlg is partially determined by the number of dimensions and therefore it is reasonable to use a relatively larger memory size. In this experiment, all three algorithms are able to find most true heavy hitters (see Figure 4), but TwoPassAlg returns far fewer false positives than the other two methods when γ ∗ is small. In addition, TwoPassAlg reaches zero false positive for reasonably large γ ∗ . We can see in the ROC curve that TwoPassAlg performs slightly better than Heuristic and much better than Sampling for small space. Sampling Heuristic TwoPassAlg 1000 False Positives(s) True Positive(s) 160 140 120 180 Sampling Heuristic TwoPassAlg 1200 800 160 True Positive(s) 180 600 400 200 100 0.004 0.006 * 0.008 0.010 120 Sampling Heuristic TwoPassAlg 100 0 0.002 140 0.002 0.004 0.006 * 0.008 0.010 0 200 400 600 800 1000 1200 False Positive(s) Figure 4: Near-independence experiment with Clickstream dataset. Sampling TwoPassAlg 16 14 12 10 True Positive(s) 20 False Positive(s) True Positive(s) 25 Sampling TwoPassAlg 16 15 10 0.2 * 0.3 0.4 0.5 Sampling TwoPassAlg 8 0 0.1 12 10 5 8 14 0.1 0.2 * 0.3 0.4 0.5 0 5 10 15 False Positive(s) 20 25 Figure 5: Naive Bayes experiment with Yandex dataset. 5.3 Yandex dataset Finally, we consider the Yandex dataset [20] which is a web search dataset (with more than 167 millions data points). Each record in the dataset contains a query ID, the corresponding date, the list of 10 displayed items, and the corresponding click indicators of each displayed item. In the pre-processing step, we extracted 10 subsets from the whole dataset according to top 10 frequent user queries. The sizes of subsets range from 61, 000 to 454, 000. In each subset, 12 we treat the first 10 search results as variables X1 , .., X10 and “day of query” as the latent variable Z. We conjecture that the search results X1 , .., X10 are approximately independent conditioned on a given day Z. We observe that web patterns typically experience heavy weekly seasonality and these search results largely depend on user query time for some fixed query. We proceed to evaluate TwoPassAlg under the Naive Bayes assumption on this dataset. We consider 8 subcubes in the form {Xi , Xi+1 , Xi+2 } and deliberately set a smaller memory size for this experiment because the cardinality of this dataset is relatively low. We note that different subsets of data may have different number of heavy hitters, so we take the average over 10 subsets as the final result. We report the results in Figure 5. We observe that both Sampling and TwoPassAlg are able to find most true heavy hitters. However, TwoPassAlg performs significantly better in terms of false positives. 6 Concluding Remarks Our work demonstrates the power of model-based approach for analyzing high dimensional data that abounds in digital analytics applications. We exhibit algorithms, with fast query time, that overcome worst case space lower bound under the classical Naive Bayes assumption. Our approach to subspace heavy hitters opens several directions for further study. For example, • Can heavy hitters be detected efficiently under more general models? • Can these models be learned or fitted over data streams with polylogarithmic space? We believe this is an algorithmic problem of great interest and will have applications in machine learning beyond the context here. • We assumed that we observe the latent dimension. Can this be learned from the data stream? • Can the model-based approach be extended to other problems besides heavy hitters, including clustering, anomaly detection, geometric problems and others which have been studied in the streaming literature. References [1] Ion Androutsopoulos, Georgios Paliouras, Vangelis Karkaletsis, Georgios Sakkis, Constantine D. Spyropoulos, and Panagiotis Stamatopoulos. Learning to filter spam e-mail: A comparison of a naive bayesian and a memorybased approach. CoRR, cs.CL/0009009, 2000. [2] Vladimir Braverman, Kai-Min Chung, Zhenming Liu, Michael Mitzenmacher, and Rafail Ostrovsky. AMS without 4-wise independence on product domains. In STACS, volume 5 of LIPIcs, pages 119–130. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2010. [3] Vladimir Braverman and Rafail Ostrovsky. Measuring independence of datasets. In STOC, pages 271–280. ACM, 2010. [4] Graham Cormode. Finding frequent items in data streams. http://dmac.rutgers.edu/ Workshops/WGUnifyingTheory/Slides/cormode.pdf, 2008. DIMACS Workshop. [5] Graham Cormode and S. Muthukrishnan. An improved data stream summary: The count-min sketch and its applications. In LATIN, volume 2976 of Lecture Notes in Computer Science, pages 29–38. Springer, 2004. [6] Constantinos Daskalakis, Nishanth Dikkala, and Gautam Kamath. Testing ising models. CoRR, abs/1612.03147, 2016. [7] Marco F. Duarte, Volkan Cevher, and Richard G. Baraniuk. Model-based compressive sensing for signal ensembles. In Communication, Control, and Computing, 2009. Allerton 2009. 47th Annual Allerton Conference on, pages 244–250. IEEE, 2009. [8] Amit Goyal, Hal Daumé III, and Suresh Venkatasubramanian. Streaming for large scale NLP: language modeling. In Human Language Technologies: Conference of the North American Chapter of the Association of Computational Linguistics, Proceedings, May 31 - June 5, 2009, Boulder, Colorado, USA, pages 512–520. The Association for Computational Linguistics, 2009. 13 [9] Matthew Hamilton, Rhonda Chaytor, and Todd Wareham. The parameterized complexity of enumerating frequent itemsets. In IWPEC, volume 4169 of Lecture Notes in Computer Science, pages 227–238. Springer, 2006. [10] Piotr Indyk and Andrew McGregor. Declaring independence via the sketching of sketches. In SODA, pages 737–745. SIAM, 2008. [11] Branislav Kveton, Hung Hai Bui, Mohammad Ghavamzadeh, Georgios Theocharous, S. Muthukrishnan, and Siqi Sun. Graphical model sketch. In ECML/PKDD (1), volume 9851 of Lecture Notes in Computer Science, pages 81–97. Springer, 2016. [12] David D. Lewis, Yiming Yang, Tony G. Rose, and Fan Li. RCV1: A new benchmark collection for text categorization research. Journal of Machine Learning Research, 5:361–397, 2004. [13] Edo Liberty, Michael Mitzenmacher, Justin Thaler, and Jonathan Ullman. Space lower bounds for itemset frequency sketches. In PODS, pages 441–454. ACM, 2016. [14] Christopher D. Manning, Prabhakar Raghavan, and Hinrich Schütze. Introduction to Information Retrieval. Cambridge University Press, 2008. [15] Andrew McGregor and Hoa T. Vu. Evaluating bayesian networks via data streams. In COCOON, volume 9198 of Lecture Notes in Computer Science, pages 731–743. Springer, 2015. [16] Jayadev Misra and David Gries. Finding repeated elements. Sci. Comput. Program., 2(2):143–152, 1982. [17] Stuart J. Russell and Peter Norvig. Artificial Intelligence - A Modern Approach. Pearson Education, 2010. [18] Jeffrey Scott Vitter. Random sampling with a reservoir. ACM Trans. Math. Softw., 11(1):37–57, 1985. [19] David P. Woodruff. New algorithms for heavy hitters in data streams (invited talk). In ICDT, volume 48 of LIPIcs, pages 4:1–4:12. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2016. [20] Yandex personalized web search challenge. challenge, 2013. https://www.kaggle.com/c/yandex-personalized-web-search- [21] Guizhen Yang. The complexity of mining maximal frequent itemsets and maximal frequent patterns. In KDD, pages 344–353. ACM, 2004. 14
8cs.DS
arXiv:1610.03729v1 [cs.SY] 12 Oct 2016 Scheduling of Event-Triggered Networked Control Systems using Timed Game Automata Dieky Adzkiya1 and Manuel Mazo, Jr.2 1 Department of Mathematics, Institut Teknologi Sepuluh Nopember, Indonesia. Part of this work was done in the Delft Center for Systems and Control, TU Delft, The Netherlands. (e-mail: [email protected]) 2 Delft Center for Systems and Control, TU Delft - Delft University of Technology, The Netherlands. (e-mail: [email protected]). Abstract We discuss the scheduling of a set of networked control systems implemented over a shared communication network. Each control loop is described by a linear-time-invariant (LTI) system with an event-triggered implementation. We assume the network can be used by at most one control loop at any time instant and after each controller update, a predefined channel occupancy time elapses before the network is available. In our framework we offer the scheduler two options to avoid conflicts: using the event-triggering mechanism, where the scheduler can choose the triggering coefficient; or forcing controller updates at an earlier pre-defined time. Our objective is avoiding communication conflict while guaranteeing stability of all control loops. We formulate the original scheduling problem as a control synthesis problem over a network of timed game automata (NTGA) with a safety objective. The NTGA is obtained by taking the parallel composition of the timed game automata (TGA) associated with the network and with all control loops. The construction of TGA associated with control loops leverages recent results on the abstraction of timing models of event-triggered LTI systems. In our problem, the safety objective is to avoid that update requests from a control loop happen while the network is in use by another task. We showcase the results in some examples. 1 Introduction Networked control systems (NCSs) are spatially distributed systems in which the communication between sensors, actuators and controllers occurs through a shared band-limited digital communication network, as shown in Fig. 1. Such 1 Sensor 1 Plant 1 Actuator 1 ... Sensor N Plant N Actuator N Network Scheduler Controller N Controller 1 Figure 1: Topology of a set of N networked control systems. structures bring many advantages, for instance reduced wiring and maintenance costs as well as an increased flexibility and reconfigurability. NCSs occur in numerous applications, including power systems [1], aircrafts and automobiles [2], and process control [3]. Notice that NCSs are implemented over shared communication resources, most often over digital channels. The impact of such communication infrastructures on control systems has been studied in the last decade [4, 5, 6, 7]. In particular the applicability of wireless communications in NCSs has been discussed in [8, 9, 10] among others. The delays introduced by these shared resources on the feedback loops are critical to guarantee stability and performance. Furthermore, when several control loops are implemented over a shared communication channel, bandwidth becomes a scarce resource, the usage of which needs to be minimized by each controller. For these reasons, the traditional time-triggered controller implementations, i.e. based on periodic sampling, are not suitable anymore. With the objective of minimizing the bandwidth usage, event-based approaches resulting in aperiodic controller updates have been proposed in [11, 12, 13, 14, 15, 16]. These aperiodic paradigms introduce a new challenge in the design: the scheduling of transmissions. A communication network has finitely many channels. The number of channels represents the maximum number of messages that can be sent simultaneously over the network. If the number of channels equals the number of control loops, we do not need any scheduler because every control loop has its own communication channel. However in practice, the number of channels is smaller than the number of control loops. Thus we need a scheduler to decide which control loop has access to the network at any time instant while guaranteeing stability of all control loops. Additionally the scheduler can optimize a certain combination of control performance and bandwidth usage. In the context of periodic traffic sources, or aperiodic with known deadlines a-priori, there are well-studied scheduling techniques that are capable of guaranteeing certain delay bounds for the traffic [17, 18, 19]. In the event-based context, i.e. sporadic traffic with unknown deadlines, the problem has been less studied and becomes more challenging [20, 21, 22, 23]. In [21, 22, 23], the authors propose a joint design (codesign) of a control law and a scheduling law for several types of NCSs. Although the co-design strategy can improve the control performance signifi- 2 cantly, if a new control loop is introduced to the NCSs, the whole co-design procedure has to be executed again, which can be extremely time consuming. In order to mitigate this issue, we propose an approach that separates the design of controllers and schedulers. In this paper, we design a scheduler for a set of NCSs over a shared communication network (cf. Fig. 1). Our objective is avoiding communication conflict while guaranteeing stability of all NCSs. Each NCS is a linear-time-invariant (LTI) system. The controllers are implemented in an event-triggered fashion where the delays between reading the state and updating the actuators are ignored [12]. With respect to the shared communication network, we assume it has a single communication channel. Furthermore after each controller update, a pre-defined channel occupancy time elapses before the network is available. We consider schedulers that after each transmission of measurements, decide the policy for the next update. These policies can be to either let the next update be decided based on a triggering mechanism (to be chosen among a set of them guaranteeing different performances) or forced to be at an earlier pre-defined time. If we do not allow the scheduler to force earlier controller updates, the bandwidth usage is decreased at the cost of worse control performance (or slower convergence). On the other hand if we allow the scheduler to force earlier controller updates, we obtain a better control performance (or faster convergence) at the cost of increased bandwidth usage. In this case, nothing prevents the scheduler from always using earlier updates and never use the event-triggering mechanism. This may result in an undesired over-use of the communication channel, and could be prevented by introducing costs to the model, which would result in priced timed game automata (PTGA). Unfortunately to the best of our knowledge, no results are available in the literature allowing the synthesis of strategies over PTGA with safety objectives. Only the synthesis of strategies over PTGA with a reachability objective are available [24, 25]. Thus we propose an alternative approach to prevent the undesired schedule by limiting the consecutive earlier updates. The scheduling problem can be formulated as a timed safety game: given a model and a set of bad states, we seek to construct a strategy such that the model supervised by the strategy constantly avoids the bad states. In our problem, the safety problem at hand is to avoid that update requests from a control loop happen while the network is in use by another task. We focus our attention to the design of a scheduler by leveraging techniques originally developed for network of timed game automata (NTGA) [26]. An NTGA is the parallel composition of timed game automata (TGA), which are timed safety automata (TSA) in with the set of actions is partitioned into controllable and uncontrollable actions. We choose NTGA modeling framework because of the following two reasons. First of all, it allows us to extend the methods in [27]. The authors of [27] discuss formal abstraction of the timing behavior of LTI systems with event-triggered implementation as TSA. The second reason is that the solution of timed safety game over NTGA can be computed by using backward algorithms [28, 26] or on-the-fly algorithms [29]. Moreover the algorithms have been implemented in some freely available software tools [30, 29]. The 3 procedure to generate the scheduler (or the strategy) is as follows. First, we construct an NTGA from a set of NCSs. The NTGA is obtained by taking the parallel composition of the TGA associated with the network and with all control loops. Then we characterize the bad states, i.e. states corresponding to a communication conflict. Finally the scheduler is defined as the solution of timed safety game over the NTGA. Timed automata (TA) [31] are a general modeling framework for a wide range of real-time systems, such as in web services [32], audio/video protocols [33], bounded retransmission protocols [34], collision avoidance protocols [35, 36] and commercial field bus protocols [37]. Timed safety automata (TSA) [38] are a simplified version of TA. In order to enforce progress properties, TSA use local invariant conditions whereas TA use Büchi or Muller accepting conditions. The scheduling problem over TA and its variants has been already studied in the literature e.g. applied to the scheduling of a steel plant, a job shop and a task graph in [39], [40], and [41], respectively. Furthermore the optimal scheduling of a production w.r.t. a predefined cost for a finite time horizon has been investigated in [42, 43]. In this case, the models are TA with weights (or costs) on both locations and edges, so called priced timed automata in [44] and weighted timed automata in [45]. Finally the optimal scheduling for infinite time horizon is discussed in [46]. The rest of this manuscript is structured as follows. Section 2 recalls some modeling frameworks and preliminaries. Section 3 proposes a procedure to synthesize a conflict-free scheduler. Two experimental results are discussed in Section 4. The first experiment allows the scheduler to force earlier controller updates where the number of consecutive earlier updates is limited to 4. The second experiment does not allow the scheduler to force earlier controller updates. In this experiment, the scheduler can choose the triggering coefficient among three choices. Finally the conclusions and possible future research directions are summarized in Section 5. 2 2.1 Models and Preliminaries Timed Automata A timed automaton (TA) [31] is a finite automaton (namely, a directed graph containing finitely many nodes and finitely many labeled edges) extended with real-valued variables, which is usually employed to model real-time systems. The real-valued variables model logical clocks, that are initialized to zero when the system is started and thereafter increase synchronously at the same rate. We shall refer to these variables as simply “clocks”. Clock constraints are used to restrict the behavior of the automaton. An edge transition can be taken when the edge is enabled. Edges are enabled if the values of the clocks satisfy the guard conditions associated with the edge. Additionally, some clocks may be reset to zero when an edge is taken. Originally, Büchi and Muller accepting conditions are used to enforce progress properties [31]. A simplified version called 4 timed safety automata [38] uses local invariant conditions to specify progress properties. In this work, we focus on timed safety automata and refer them as timed automata for simplicity. We define C as the set of finitely many clocks, Act as the set of finitely many actions and N0 as the set of natural numbers including zero {0, 1, . . . }. A clock constraint is a conjunctive formula of atomic constraints of the form x ⊲⊳ n or x − y ⊲⊳ n for x, y ∈ C, ⊲⊳∈ {≤, <, =, >, ≥} and n ∈ N0 . Clock constraints will be used as guards on edges and location invariants. We use B(C) to denote the set of clock constraints. Definition 1 (Timed Automaton). A timed automaton TA is a sextuple (L, ℓ0 , Act, C, E, Inv) where • L is a set of finitely many locations (or nodes); • ℓ0 ∈ L is an initial location; • Act is a set of finitely many actions; • C is a set of finitely many real-valued clocks; • E ⊆ L × B(C) × Act × 2C × L is a set of edges; • Inv : L → B(C) assigns invariants to locations.1 Location invariants are restricted to constraints that are downwards closed, in the form: c ≤ n or c < n where c is a clock and n ∈ N0 . g,a,r Sometimes we write ℓ ✲ ℓ′ when (ℓ, g, a, r, ℓ′ ) ∈ E. Furthermore we write ℓ ✲ ℓ′ to denote the existence of an edge from ℓ to ℓ′ with arbitrary labels. The semantics of a TA are defined as a transition system where a state consists of the current location and the current value of clocks. There are two types of transitions between states depending on whether the automaton: delays for some time (a delay transition), or takes an enabled edge (a discrete transition). To keep track of clock values, we use functions known as clock assignments u : C → R≥0 and we employ u  g (u satisfies g) to denote that the clock values of u satisfy the guard g. For d ∈ R≥0 , let u + d denote the clock assignment that maps all c ∈ C to u(c) + d. For a set of clocks c ⊆ C, let u[c] denote the clock assignment that maps all clocks in c to 0 and agrees with u for the rest of clocks in C \ c. Definition 2 (Operational Semantics). The semantics of a timed automaton is a transition system (also known as a timed transition system) in which states are pairs of location ℓ and clock assignment u, and transitions are defined by the rules: d ✲ (ℓ, u + d) if u  Inv(ℓ) and (u + d)  Inv(ℓ) • Delay transition: (ℓ, u) TS for a non-negative real number d ∈ R≥0 ; 1 Recall that 2C denotes the power set of C. 5 • Discrete transition: (ℓ, u) a ✲ (ℓ′ , u′ ) if ℓ TS g,a,r ✲ ℓ′ , u  g, u′ = u[r] and u′  Inv(ℓ′ ). A run of a timed automaton is a sequence of alternating delay and discrete transitions in the transition system. We denote by Runs(TA) the set of runs of timed automaton TA starting from the initial state (ℓ0 , u0 ) where u0 is a clock assignment that maps all c ∈ C to 0. Additionally, if ρ is a finite run, the last state of the run is denoted by last (ρ). The set of actions Act (cf. Definition 1) is assumed to consists of symbols for input actions a?, output actions a! and internal actions ∗. Synchronous communication between different TA is done by hand-shake synchronization using input and output actions. To model concurrent systems, several TAs can be extended with parallel composition that takes into account the synchronous communication. Parallel composition of TAs is also called network of timed automata (NTA). Essentially the parallel composition of a set of TAs is the product of the TAs. Building the product timed automaton is an entirely syntactical but computationally expensive operation. The reader is referred to [47, Sec. 5] for an example on the composition of two TAs. The semantics of an NTA are defined as a transition system where a state consists of a vector of current locations and the current value of clocks in all TAs [48]. 2.2 Timed Game Automata A timed game automaton is a timed automaton in which the set of actions is partitioned into controllable and uncontrollable actions. The former are actions that can be triggered by the controller, whereas the latter only by the environment/opponent. Definition 3 (Timed Game Automaton). A timed game automaton TGA is a septuple (L, ℓ0 , Actc , Actu , C, E, Inv) where • (L, ℓ0 , Actc ∪ Actu , C, E, Inv) is a timed automaton; • Actc is a set of controllable actions; • Actu is a set of uncontrollable actions; • Actc ∩ Actu = ∅. Similar to TA, TGA can also be extended with parallel composition (essentially the synchronized cartesian product of TGA). The parallel composition of TGAs is called a “network of timed game automata” (NTGA) which is formally defined as: 6 Definition 4 (Parallel Composition). Let TGAi = (Li , ℓi0 , Actic , Actiu , C i , E i , Invi ) be a timed game automaton for i ∈ {1, . . . , n}. The parallel composition of TGA1 , . . . , TGAn denoted by TGA1 | · · · | TGAn is a timed game automaton TGA = (L, ℓ0 , Actc , Actu , C, E, Inv) where • L = L1 × · · · × Ln ; • ℓ0 = (ℓ10 , . . . , ℓn0 ); Sn • Actc = {∗} ∪ i=1 {a ∈ Actic | a is an internal action}; Sn • Actu = {⊛} ∪ i=1 {a ∈ Actiu | a is an internal action}; • C = C1 ∪ · · · ∪ Cn; • E is defined according to the following two rules: – a TA makes a move on its own via its internal action: the edge is controllable iff the internal action is controllable; – two TAs move simultaneously via a synchronizing action: the edge is controllable iff both input and output actions are controllable (i.e. the environment has priority over the controller); • Inv((ℓ1 , . . . , ℓn )) = Inv1 (ℓ1 ) ∧ · · · ∧ Invn (ℓn ). In the parallel composition of TGAs, a pair of input and output actions is denoted as a single action. Thus the sets Actc and Actu do not contain any input and output actions. A synchronizing action should be defined as an element of Actc if it is controllable and an element of Actu if it is not controllable. In Definition 4, let us remark that both Actc and Actu do not contain synchronizing actions for simplicity. Any controllable synchronizing action is denoted by ∗, whereas any uncontrollable synchronizing action is denoted by ⊛. Given an NTGA, we are interested in solving the following safety objective: is it possible to find a strategy for the triggering of controllable actions guaranteeing that a set of pre-specified bad states are never reached regardless of what and when uncontrollable actions take place? More formally given an NTGA and a set of bad states A, we seek to construct a strategy f such that the NTGA supervised by f constantly avoids A. A strategy [26] is a function that during the course of a game constantly gives information about what the controller should do in order to win the game. At any given situation, the strategy could suggest the controller to either “take a particular controllable action” or “do nothing at this point in time”, i.e. delay, which will be denoted by the symbol (controllable action) λ. Definition 5 (Strategy [29, Definition 3]). Let TGA = (L, ℓ0 , Actc , Actu , C, E, Inv) be a timed game automaton. We define TA = (L, ℓ0 , Actc ∪ Actu , C, E, Inv) as the timed automaton derived from the timed game automaton. A strategy f over TGA is a partial function from Runs(TA) to Actc ∪ {λ} s.t. for every finite run f (ρ) ρ, if f (ρ) ∈ Actc then last (ρ) ✲ (ℓ′ , u′ ) for some (ℓ′ , u′ ). TS 7 A strategy f over TGA is called state-based or memoryless whenever last (ρ) = last (ρ′ ) implies f (ρ) = f (ρ′ ), for each ρ, ρ′ ∈ Runs(TA). The restricted behavior of an NTGA controlled with some strategy f is defined by the notion of outcome [28]. A strategy f is winning from a state if all maximal runs [29, p. 70] in the outcome originated from that state are winning. A state is winning if there exists a winning strategy f from that state. The winning states can be computed by using backward algorithms [28, 26] or on-the-fly algorithms [29]. Software tools are also available that solve safety control problems, e.g. the implementation from Verimag [30] or UPPAAL-Tiga [29], which implement the backward and on-the-fly algorithms respectively. 2.3 Event Triggered Control Systems We consider linear-time-invariant (LTI) systems of the form ˙ = Aξ(t) + Bυ(t), ξ(t) ξ(t) ∈ Rn , υ(t) ∈ Rm (1) where A and B are matrices of appropriate dimensions. We assume the existence of linear state-feedback laws υ(t) = Kξ(t) rendering the closed-loop system globally asymptotically stable, where K is a matrix of appropriate dimensions. Assume a sample-and-hold implementation of the control law is in place keeping the input signal constant between update times, i.e. t ∈ [tk , tk+1 [, υ(t) = Kξ(tk ), (2) where t0 , t1 , . . . is a divergent sequence of update times. For simplicity of presentation, we ignore the presence of delays between reading the state and updating the actuators. The interested reader is referred to [12] for more details, including accounting for delays. In event-triggered implementations, the sequence of update times is decided on run-time based on the state of the plant [12]. Let ξ(t) represent the solution of (1)-(2). We define an auxiliary variable e(t) representing the difference between the sampled state ξ(tk ) and the current state ξ(t) of the system: e(t) = ξ(tk ) − ξ(t), t ∈ [tk , tk+1 [, k ∈ N0 . The event-triggering approach in [12], proposes the following sampling triggering law: tk+1 = min{t | t > tk and |e(t)|2 ≥ σ|ξ(t)|2 }, (3) where σ ∈]0, σ̄[⊂ R+ is the triggering coefficient, which establishes a trade off between quality of control (convergence rate to the equilibrium) and the amount of transmissions triggered. The inter-sample time of the state x, denoted by τσ (x), is defined as the time between consecutive updates when the sampled state is x: τσ (x) = min{t | |e(t)|2 ≥ σ|ξ(t)|2 and ξ(0) = x}. 8 (4) 2.4 Abstraction of Event Triggered Control Systems as Timed Automata In [27], the authors propose an approach to characterize the sampling behavior of LTI systems with event-triggered implementation as TAs. The approach abstracts the spatial and temporal dependencies of the original system. The following definitions summarize the approach. Definition 6 (Flow Pipe). The set of reachable states or the flow pipe at the time interval [t1 , t2 ] from a set of initial states X0 is denoted by [ {ξ(t) | ξ(0) ∈ X0 }. X[t1 ,t2 ] (X0 ) = t∈[t1 ,t2 ] Definition 7 ([27]). A timed automaton abstracting the triggering timing behavior of system (1)-(2) with triggering coefficient σ is given by TAσ = (Lσ , ℓσ0 , Actσ , C σ , E σ , Invσ ) where • Lσ = {Rσ1 , . . . , Rσq }; • ℓσ0 = Rσs such that ξ(0) ∈ Rσs ; • Actσ = {∗}; • C σ = {c}; • (Rσs , τ σs ≤ c ≤ τ̄sσ , ∗, {c}, Rσt ) ∈ E σ if X[τ σs ,τ̄sσ ] (Rσs ) ∩ Rσt 6= ∅; ¯ ¯ • Invσ (Rσs ) = {c | 0 ≤ c ≤ τ̄sσ } for all s ∈ {1, . . . , q}. Each location Rσs of this TA, is associated with a set of possible states x of the system (1). We abuse slightly notation denoting both the location and the associated region with the same symbol Rσs . The suggestion in [27] is to partition the state space of the control system in conic regions pointed at the origin, each of which would be associated to a location of the TA. The TA has one clock variable c that represents the time elapsed since the last update. According to [12], given a fixed sampled state, the inter-sample time is uniquely defined, i.e. it is deterministic. In general, when the sampled state is different, the inter-sample time is also different. The notation τ σs and τ̄sσ represents the ¯ lower and upper bounds of the inter-sample time for sampled states in Rσs . In [27] it is shown formally that the TA abstracts the timing behavior of the event-triggered system, implying that: ∀s ∈ {1, . . . , q}, ∀x ∈ Rσs : τσ (x) ∈ [τ σs , τ̄sσ ]. ¯ Remark 1. In principle it could happen that τσ (x) = ∞ for some states x of the system. In practice, one would always impose a maximum time between transmissions to maintain a minimum level of feedback. This practical solution is suggested in [27] to guarantee having always τ̄sσ < ∞, as otherwise the TA model would become useless for scheduling purposes. 9 τ σ1 ≤ c ≤ τ̄1σ ¯ c := 0 τ σ1 ≤ c ≤ τ̄1σ ¯ c := 0 Rσ1 0 ≤ c ≤ τ̄1σ τ σ2 ≤ c ≤ τ̄2σ ¯ c := 0 Rσ2 τ σ2 ≤ c ≤ τ̄2σ ¯ c := 0 0 ≤ c ≤ τ̄2σ Figure 2: A timed automaton modeling a control loop with event-triggered implementation. The unsourced arrow indicates the initial location. The internal action ∗ is omitted in the figure. From Definition 7 it is also trivial to see that if ξ(t) = x ∈ Rσs then ξ(t + τσ (x)) ∈ Rσj , with Rσj being one of the end locations in the set of edges with starting location Rσs . The outgoing edges of Rσs are enabled if the time elapsed since the last update is between τ σs and τ̄sσ . Only one action denoted by ∗ is ¯ present in this model, and since taking any edge is interpreted as updating the input value, all edges are labeled with action ∗ and reset the clock variable. Note that the system may remain in location Rσs for at most τ̄sσ time units, as a triggering event is guaranteed to happen before that instant. A graphical representation of a simple TA of the form of those from Definition 7 is shown in Fig. 2. 3 Scheduling of Event-Triggered Control Systems Consider a set of event-triggered networked control systems (NCSs) sharing a common communication channel (cf. Fig. 1). Each control loop consists of a sensor, a plant, an actuator, and a controller, interconnected through the shared communication network. Assume that the network can be used by at most one control loop at any time instant. If several control loops request access to the channel while the network is in use a conflict arises, and at most one control loop will be chosen nondeterministically to access the network. While in time-triggered control systems these type of problems can be prevented by appropriate scheduling, when one or several control-loops are event-triggered a-priori scheduling is a much more challenging task because of the unknown update times. In this section, we propose an approach based on NTGA to avoid such conflicts. We consider schedulers that after each update of a control loop (transmission of measurements, computation of control and transmission of actuation signal to actuators) decide whether the next update time of each control loop should: • be based on a triggering mechanism selected from a set of finitely many triggering coefficients {σ1 , . . . , σp }; or 10 • forced to be at a pre-defined time (earlier than the minimum expected inter-sample time). We synthesize scheduling strategies by: constructing an NTGA from a set of NCSs (cf. Section 3.1), characterizing the bad states, i.e. states corresponding to a communication conflict (cf. Section 3.2), and finally synthesizing a supervising strategy ensuring that the NTGA avoids the bad states. 3.1 Model: Network of Timed Game Automata In what follows, we describe the procedure employed to construct an NTGA from a given set of event-based NCSs. We start constructing a TGA associated with the shared communication network. Next, for each event-triggered control loop, we generate a TGA as a modification of the TA described in Section 2.4. Finally, the NTGA is obtained by taking the parallel composition of the TGA associated with the network and with all control loops. 3.1.1 Communication Network Denote the TGA corresponding to the shared communication network by TGAnet (cf. Definition 8). TGAnet has three locations Idle, InUse and Bad , where the initial location is Idle (cf. Fig. 3). The location Idle represents the network being available, InUse represents the network being used by a control loop and Bad represents a conflict occured. The active location changes from Idle to InUse when a control loop requests access to the channel to perform an update, which also forces the reset of the clock variable c. The channel is occupied for ∆ time units before the network is freed again to service the control tasks. During this time, the active location is InUse, and after that time the active location changes to Idle. When the active location is InUse and another control loop requests access then the active location changes to Bad . Once the network enters the location Bad , the network cannot leave the location, i.e. Bad is an absorbing location. Notice that this is a somewhat conservative model, as we consider every control loop occupies the channel the whole time ∆. One could trivially adjust this simple model, and the subsequent work, to associate different occupancy times to different control loops. Definition 8. Let ∆ represent the maximum channel occupancy time, a timed game automaton associated with the communication network is given by TGAnet = net net net (Lnet , ℓnet , E net , Invnet ) where 0 , Actc , Actu , C • Lnet = {Idle, InUse, Bad }; • ℓnet = Idle; 0 • Actnet = {∗}; c • Actnet u = {up?}; • C net = {c}; 11 up? c := 0 up? up? Idle InUse c == ∆ Bad 0≤c≤∆ Figure 3: A timed game automaton modeling the shared communication network. The solid and dashed arrows represent controllable and uncontrollable edges, respectively. • E net = {(Idle, true, up?, {c}, InUse), (InUse, c = ∆, ∗, ∅, Idle), (InUse, true, up?, ∅, Bad ), (Bad , true, up?, ∅, Bad )}; • Invnet (InUse) = {c | 0 ≤ c ≤ ∆}, Invnet (Idle) = {c | c ≥ 0}, Invnet (Bad ) = {c | c ≥ 0}. The guard true represents a condition that is always satisfied, for example c ≥ 0. 3.1.2 Control Loops Given a control loop, we construct the timed game automata TGAcl allowing a supervisor (scheduler) to either: force earlier controller updates than those dictated by the event-triggering mechanism, or choose a triggering coefficient for the event-triggering mechanism. σ Definition 9. Consider a set of timed automata TAσj = (Lσj , ℓ0 j , Actσj , C σj , E σj , Invσj ) generated from an event-triggered control loop with triggering coefficient σj ∈ σ ]0, σ̄[ for j ∈ {1, . . . , p} and assume that Rsσ1 = · · · = Rs p for all s ∈ {1, . . . , q}. Consider also a set of earlier update time parameters {d1 , d¯1 , . . . , dq , d¯q }, such ¯ ¯ that σj ¯ ∀s ∈ {1, . . . , q} ∃ j ∈ {1, . . . , p} : ds ≤ τ s . ¯ Then, the timed game automata TGAcl is given by cl cl cl cl cl TGAcl = (Lcl , ℓcl 0 , Actc , Actu , C , E , Inv ) where Sq Sp • Lcl = j=1 Lσj ∪ s=1 {Rs , Ear s }; σ1 • ℓcl 0 = Rs such that ξ(0) ∈ Rs ; Sp σ1 • Actcl ∪ j=1 {acl c = Act j }; • Actcl u = {up!}; • C cl = C σ1 ; Sq Sp Sq S σj • E cl = s=1 t∈Es {(Ear s , c = 0, up!, ∅, Rt )}∪ s=1 j=1 {(Rs , c = 0, acl j , ∅, Rs ), S S S σ (Rs j , ds ≤ c ≤ d¯s , ∗, {c}, Ear s )} ∪ qs=1 pj=1 {t|(Rs →Rt )∈E σj } σ¯ σ σ {(Rs j , τ s j ≤ c ≤ τ̄s j , up!, {c}, Rt )}; ¯ 12 Rσ1 R1 Ear2 Ear1 R2 Rσ2 Figure 4: A timed game automaton modeling a control loop with an eventtriggered implementation. The labels over edges and location invariants are not shown for simplicity. σ σ • Invcl (Rs j ) = {c | c ≤ τ̄s j }, Invcl (Rs ) = {c | c = 0}, Invcl (Ear s ) = {c | c = 0}. In model just introduced, we use separate locations associated to each triggering coefficient and introduce the additional locations Rs and Ear s for s ∈ σ {1, . . . , q}. Both the locations Rs and Rs j represent that the sampled state is in Rσs 1 . In location Rs the scheduler has not chosen the triggering coefficient, σ whereas in location Rs j the scheduler has chosen triggering coefficient σj . Since σ the scheduler can choose the triggering coefficient, the edges from Rs to Rs j are labeled with the controllable action aj . After choosing the triggering coefficient, the scheduler is allowed to either: force earlier controller updates, or use the event-triggering mechanism (based on the chosen triggering coefficient). If the scheduler decides to use the event-triggering mechanism, while staying σ in location Rs j , the strategy is “do nothing”. This ensures that the outgoing σ σ edge to Ear s is not taken. When the value of c is between τ s j and τ̄s j , the eventσj ¯ triggering mechanism is activated. In this case, the edges from Rs to Rt labeled with the uncontrollable action up! are enabled. Recall that the scheduler cannot choose the exact update time when using the event-triggering mechanism. This also implies that the scheduler cannot choose the region containing the next sampled state. If the scheduler decides to force earlier controller updates, the scheduler will take the edge to Ear s when that edge is enabled. In this case, the scheduler is σ able to choose the exact update time. Thus, the edges from Rs j to Ear s are labeled with the controllable action ∗. In location Ear s , the time cannot elapse and one of the outgoing edges has to be taken immediately. Since the scheduler cannot choose the region containing the next sampled state, the outgoing edges of Ear s are labeled with the uncontrollable action up!. The outgoing edges are defined as follows: there exists an edge from Ear s to Rt if t ∈ Es := {t | X[ds ,d̄s ] (Rσs 1 ) ∩ Rσt 1 6= ∅}. A graphical representation of a TGA generated by ¯ Definition 9 is shown in Fig. 4. In this subsection, we assume the initial conditions of the LTI system are a subset of a region. If the initial conditions are intersected with a set of regions Rinit ⊆ {Rσ1 1 , . . . , Rσq 1 }, we can modify the TGA generated by Definition 9 as follows. Introduce a new location called R0 with invariant {c = 0} and define 13 Rσ1 R1 Ear2 R0 Ear1 R2 Rσ2 Figure 5: A timed game automaton modeling a control loop where the initial states are intersected with both conic regions. The labels over edges and location invariants are not shown for simplicity. R0 as the initial location. Then, define edges from R0 to every location in Rinit with guard c = 0, action ⊛ and without resetting the clock. Finally, action ⊛ is defined as an uncontrollable action. In the above modification, the environment has to choose one of the locations corresponding to initial conditions when the system is started. A graphical representation of the TGA representing this situation is depicted in Fig. 5. Proposition 1. Switching between different triggering coefficients or triggering earlier does not hinder stability. Proof. Consider Lyapunov function V : Rn → R≥0 satisfying V̇ (ξ(t)) ≤ −λc V (ξ(t)), with λc > 0 for the system (1) with continuous feedback u(t) = Kξ(t). It has been shown in [12] that selecting a triggering coefficient 0 < σ < σ̄, with σ̄ an appropriate constant depending on the LTI dynamics and the state-feedback gain, the event-triggered controller implementation (2)-(3) satisfies ∀t : V̇ (ξ(t)) ≤ −λe (σ)V (ξ(t)), with λc > λe (σ1 ) > λe (σ2 ) > 0 for 0 < σ1 < σ2 < σ̄. In fact, the triggering mechanism guarantees that V̇ (ξ(t)) ≤ −λe (σ)V (ξ(t)) in the interval t ∈ [tk , tk + τσ (x)], for all x = ξ(tk ). Since σj < σ̄ for all j ∈ {1, . . . , p}, switching between different triggering coefficients guarantees that ∀t : V̇ (ξ(t)) ≤ −λe σ̃V (ξ(t)), with σ̃ := maxj∈{1,...,p} σj . Finally, if the system is forced to employ earlier triggering the assumption: σ ∀s ∈ {1, . . . , q} ∃ j ∈ {1, . . . , p} : d¯s ≤ τ s j guarantees that the update occurs ¯ in the interval [tk , tk + τσ̃ (x)], and thus ∀t : V̇ (ξ(t)) ≤ −λe σ̃V (ξ(t)), which concludes the proof. As it was mentioned in the beginning of Section 3.1, the NTGA associated with a set of NCSs, denoted by TGANCSs , is obtained by taking the parallel composition of the TGA associated with the network and with all control loops. In other words, TGANCSs := TGAnet | TGAcl1 | · · · | TGAclN where TGAcli , i ∈ {1, . . . , N }, represents the TGA associated with the i-th control loop. The state of TGANCSs is described by a (2N + 2)-tuple (ℓnet , ℓ1 , . . . , ℓN , unet , u1 , . . . , uN ) where ℓnet is the location of TGAnet , ℓi is the location of TGAcli , unet is the 14 clock assignment of TGAnet and ui is the clock assignment of TGAcli , for i ∈ {1, . . . , N }. 3.2 Specification: Safety We are interested in finding a strategy such that the trajectories of the NTGA never enter the states corresponding to a conflict. Recall that a conflict corresponds to the following situation: a control loop is requesting updates when the communication network is busy. In our NTGA model, conflicts are captured by the active location of TGAnet becoming Bad . Thus the set of states we aim at avoiding A contains all states such that the location of TGAnet is Bad , i.e. A = {(ℓnet , ℓ1 , . . . , ℓN , unet , u1 , . . . , uN ) | ℓnet = Bad }. 3.3 Limiting the Consecutive Earlier Updates If we allow the scheduler to force earlier controller updates, nothing prevents the scheduler from always using such type of updates and never employ the eventtriggering mechanism. In this section, we discuss an approach to prevent the undesired schedule by limiting the consecutive earlier updates. In this approach, once a pre-specified limit has been reached, the scheduler is forced to use an event-triggering mechanism. For this purpose we employ global integer variables, which are an extended feature of UPPAAL-Tiga modeling language to ease the modeling task but not part of the standard definition of TGA (cf. Definition 3). We define a global integer constant earMax representing the maximum consecutive earlier updates, and a global integer variable earNum to be used as a counter of consecutive earlier updates. A variable is global if it can be accessed by all TGAs. Finally, the resulting TGA is defined as follows. σ Definition 10. Consider a set of timed automata TAσj = (Lσj , ℓ0 j , Actσj , C σj , E σj , Invσj ) generated from an event-triggered control loop with triggering coefficient σj ∈ σ ]0, σ̄[ for j ∈ {1, . . . , p} and assume that Rσs 1 = · · · = Rs p for all s ∈ {1, . . . , q}. Consider also some constant earMax and a set of earlier update time parameters {d1 , d¯1 , . . . , dq , d¯q }, such that ¯ ¯ ∀s ∈ {1, . . . , q} ∃ j ∈ {1, . . . , p} : d¯s ≤ τ σs j . ¯ Then, the timed game automata with options for earlier update, choice of triggering coefficients and limiting the consecutive earlier updates is given by TGAclim = (Lclim , ℓclim , Actclim , Actclim , C clim , E clim , Invclim ) where 0 c u Sq Sp • Lclim = j=1 Lσj ∪ s=1 {Rs , Ear s }; • ℓclim = Rs such that ξ(0) ∈ Rσs 1 ; 0 Sp • Actclim = {up!} ∪ Actσ1 ∪ j=1 {aclim }; c j 15 • Actclim = ∅; u • C clim = C σ1 ; S S • E clim = qs=1 t∈Es {(Ear s , c = 0, up!, ∅, Rt )}∪ Sq Sp σ clim , ∅, Rs j ), s=1 j=1 {(Rs , c = 0, aj σ (Rs j , (ds ≤ c ≤ d¯s ) ∧ (earNum < earMax), S∗, Sp S ¯ q {c} ∧ (earNum := earNum + 1), Ear s )} ∪ s=1 j=1 {t|(Rs →Rt )∈E σj } σ σ σ {(Rs j , τ s j ≤ c ≤ τ̄s j , up!, {c} ∧ (earNum := 0), Rt )}; ¯ σ σ • Invclim (Rs j ) = {c | c ≤ τ̄s j }, Invclim (Rs ) = {c | c = 0}. There are two differences between Definition 10 and Definition 9. First, in σ the edges from Rs j to Ear s , we add condition earNum < earMax to the guard and add statement earNum := earNum + 1 to the reset. The additional condition is used to guarantee that the counter of consecutive earlier updates is always smaller than or equal to its maximum. The statement on the reset is used to increase the counter variable by one, once an earlier update happens. Recall that an earlier update happens when one of these edges is taken (cf. Section 3.1.2). σ Second, in the edges from Rs j to Rt , we add the statement earNum := 0 to the reset. Recall that taking these edges represents the event-triggering mechanism is used (cf. Section 3.1.2). Thus the counter of consecutive earlier updates is reset to zero. Notice that the variable earNum takes values in {0, 1, . . . , earMax}. Remark 2. Note that with the presented implementation, either of the control loops may exhibit an arbitrary number of consecutive earlier triggerings. This is because the maximum number of consecutive earlier triggerings being a global counter. The counter is reset to zero whenever any of the control loops runs in event-triggered fashion. By employing more counters, one could easily generalize this idea to limit the number of consecutive earlier triggerings for each loop. After these modifications, the NTGA associated to the set of NCSs becomes TGANCSs := TGAnet | TGAclim1 | · · · | TGAclimN where TGAclimi represents the TGA associated with the i-th control loop for i ∈ {1, . . . , N }. In this new NTGA, the state of TGANCSs is described by a (2N + 3)-tuple (ℓnet , ℓ1 , . . . , ℓN , unet , u1 , . . . , uN , earNum) which includes the additional counter earNum. It follows that the bad states A are now given by {(ℓnet , ℓ1 , . . . , ℓN , unet , u1 , . . . , uN , earNum) | ℓnet = Bad }. 3.4 Scheduler Operation Formally, a scheduler implements a strategy f , see Definition 5, for the NTGA TGANCSs . The strategy f is applied to TGANCSs providing, based on the run ρ of TGANCSs up to that time instant the controllable action f (ρ) that guarantees the satisfaction of the desired specification. This means in practice that after each discrete transition of the NTGA, i.e. every time a transmission is placed on the network, first the strategy chooses a 16 triggering coefficient. Then the strategy decides which control loop is updated and also its update mechanism: early or event triggered. After such a transition, and possibly after some time elapses, the environment chooses the conic region containing the next sampled state, which results in a discrete transition of the NTGA, and the procedure is repeated. Example 1. Let us illustrate the use of strategies on an example consisting of two control loops, two triggering coefficients {σ1 , σ2 } and an option for earlier updates. The initial location of the first and second control loop is R1 and R2 , respectively. Initially the run of TGANCSs is ρ0 = (Idle, R1 , R2 , 0, 0, 0). After each update, the scheduler selects a triggering coefficient, according to the strategy f . Suppose that the scheduler chooses σ2 for the first control loop, i.e. f (ρ0 ) = acl1 2 . The resulting run is acl1 2 ✲ (Idle, Rσ2 , R2 , 0, 0, 0). 1 ρ1 = ρ0 TS If the scheduler chooses σ1 for the second control loop, i.e. f (ρ1 ) = acl2 1 , the run becomes 0 acl2 1 TS TS ✲ (Idle, Rσ2 , R2 , 0, 0, 0) 1 ρ2 = ρ1 ✲ (Idle, Rσ2 , Rσ1 , 0, 0, 0). 1 2 Then the scheduler follows the strategy to decide which control loop is updated and also its update mechanism: early or event triggered. Suppose that the strategy decides to update the first control loop earlier at time d1 . First, the scheduler ¯ delays the system ρ3 = ρ2 d1 ¯✲ TS (Idle, Rσ1 2 , Rσ2 1 , d1 , d1 , d1 ). ¯ ¯ ¯ Then an earlier update is performed, i.e. f (ρ3 ) = ∗. Notice that action ∗ is the internal action associated with the first control loop. We have run ρ4 = ρ3 ∗ ✲ (Idle, Ear 1 , Rσ1 , d1 , 0, d1 ). 2 ¯ ¯ TS Since time cannot elapse in Ear 1 , the environment has to choose the conic region containing the next sampled state immediately. If the environment chooses R3 , the result is run ρ5 = ρ4 0 up TS TS ✲ (Idle, Ear 1 , Rσ1 , d1 , 0, d1 ) 2 ¯ ¯ ✲ (InUse, R3 , Rσ1 , 0, 0, d1 ). 2 ¯ Notice that TGAnet and the TGA associated with the first control loop move simultaneously via synchronizing action up. Input action up? belongs to TGAnet , whereas output action up! belongs to the TGA corresponding to the first control loop. Then the scheduler follows the strategy to select a triggering coefficient for 17 the first control loop, for example σ1 , i.e. f (ρ5 ) = acl1 1 . The network is available again after ∆ time units, resulting in the runs: cl1 0 ✲ (InUse, R3 , Rσ1 , 0, 0, d1 ) a1✲ 2 TS TS ¯ ∆ σ1 σ1 (InUse, R3 , R2 , 0, 0, d1 ) ✲ (InUse, Rσ3 1 , Rσ2 1 , ∆, ∆, d1 + ∆), TS ¯ ¯ ρ6 = ρ5 while the network is being used, and ρ7 = ρ6 ∗ ✲ (Idle, Rσ1 , Rσ1 , ∆, ∆, d + ∆) 3 2 ¯1 TS once the network is released. Notice that action ∗ is the internal action associated with TGAnet . Note that this kind of scheduler is a centralized scheduler that needs to have a perfect overview of the transmissions placed on the network, and the control loop responsible for it. Furthermore, given that the locations of TGANCSs are related to the actual sampled states transmitted through the network, the scheduler also needs to be able to read the content of the transmitted data. 4 Case Study We showcase the results in an example comprising two event-triggered NCSs sharing the same communication network. The first control loop is given by [12, p. 1683]     ˙ξ = 0 1 ξ + 0 υ, −2 3 1 (5)   υ = 1 −4 ξ. The second control loop is given by [49, p. 1699]     −0.5 0 1 ξ̇ = ξ+ υ, 0 3.5 1   υ = 1.02 −5.62 ξ. (6) In the sequel, we discuss two experimental results for the above example. Each experiment is characterized by four parameters: the number of conic regions q, the set of triggering coefficients {σ1 , . . . , σq }, the set of earlier update parameters {d1 , d¯1 , . . . , dq , d¯q } and maximum consecutive earlier triggering ¯ ¯ earMax. 4.1 Limiting the Consecutive Earlier Updates In this experiment, the minimum channel occupancy time is ∆ = 0.005, the number of conic regions is q = 200 and there is one triggering coefficient σ1 = 0.05. The input value can be updated 0.005 time units before the lower bound 18 0 2 4 6 8 10 0 2 4 6 8 10 Figure 6: Status of the shared communication network up to 10 time units. The bars on the top and on the bottom of the x axis represent the network is being used by (6) and (5), respectively. The top and bottom plots represent the result of experiments discussed in Sections 4.1 and 4.2, respectively. in all regions, i.e. ds = τ s − 0.005 and d¯s = τ s for all s ∈ {1, . . . , q}. The ¯ ¯ ¯ maximum consecutive earlier triggering is earMax = 4. We create a model in UPPAAL-Tiga according to Definition 10: the TGA for (5), (6) and the shared communication network are denoted tgaT, tgaH and net, respectively. The specification is given by control: A[] not( net.Bad ) A strategy is generated with UPPAAL-Tiga to satisfy this specification. To illustrate the type of strategies synthesized, we show in the following a fragment of the strategy generated by UPPAAL-Tiga for the situation in which the locations of tgaT, tgaH and net are R1σ1 , Rσ1 1 and Idle, respectively. State: ( tgaT.R1a1 tgaH.R1a1 net.Idle ) earNum=3 When you are in (25<=tgaH.c && tgaT.c<65 && tgaH.c-tgaT.c<=-35) || (85<tgaT.c && 25<=tgaH.c && tgaT.c<105 && tgaH.c<=30) || (38<tgaT.c && 25<=tgaH.c && tgaT.c-tgaH.c<=30 && tgaH.c<=30) || (25<=tgaH.c && tgaT.c<31 && tgaH.c-tgaT.c<=-5) || (25<=tgaH.c && tgaT.c-tgaH.c<=-5 && tgaH.c<=30), take transition tgaH.R1a1->tgaH.Ear1 { c >= 25 && c <= 30 && earNum < earMax, up!, 1 } net.Idle->net.InUse { 1, up?, c := 0 } When you are in (105<=tgaT.c && tgaT.c <=111 && tgaH.c<25), take transition tgaT.R1a1->tgaT.Ear1 { c >= 105 && c <= 111 && earNum < earMax, up!, 1 } net.Idle->net.InUse { 1, up?, c := 0 } As shown above, two different conditions, based on the clock values of tgaT, clock values of tgaH and the difference of clock values in tgaT and tgaH, can be appreciated: if the first one is satisfied, an early update is forced for tgaH where the inter-sample time is between 25 and 30; if the second condition is satisfied, an early update is forced for tgaT where the inter-sample time is between 105 and 111. If none of the conditions are satisfied, no early update is forced, i.e. the strategy is to let time elapses for both loops. 19 ξ1 t 2 4 6 8 10 −100 100 ξ2 50 t 2 −50 400 200 −200 4 6 8 10 υ t 2 4 6 8 10 Figure 7: The state and input trajectories for the experiment in Section 4.1. The solid and dashed lines are the trajectories of (6) and (5), respectively. The strategy generated by UPPAAL-Tiga was applied to the two NCSs (5)(6), with both systems initialized at the state [1, 100]T , corresponding to R1 in both of the timing abstractions for the systems. The network status is shown in Fig. 6 (top), where long and short bars represent event-triggered and earlier update mechanisms, respectively. Note that while either of the control loops may exhibit an arbitrary number of consecutive triggerings, the maximum number of consecutive earlier triggerings is respected to be below 4 as this counter is a shared (global) one that is reset to zero whenever any of the two loops run in event-triggered fashion. During the time horizon of 10, the input of (5) is updated 63 times consisting of 50 earlier updates and 13 event-triggering mechanisms. For (6), the input is updated 152 times consisting of 121 earlier updates and 31 event-triggering mechanisms. The state and input trajectories are shown in Fig. 7. 4.2 Choice of Triggering Coefficients In this experiment, the minimum channel occupancy time is ∆ = 0.005, the number of conic regions is q = 200 and there are three triggering coefficients σ1 = 0.01, σ2 = 0.03 and σ3 = 0.09. We create again a model in UPPAAL-Tiga according to Definition 9: the TGA for (5), (6) and the shared communication network are denoted tgaT, tgaH and net, respectively. The specification is the same as in Section 4.1 and again we generate a strategy using UPPAAL-Tiga. The following is a fragment of the strategy generated by UPPAAL-Tiga when the location of tgaT, tgaH and net is R37 , Rσ381 and Idle, respectively. 20 ξ1 t 2 4 6 8 10 −100 100 ξ2 50 t 2 −50 400 200 −200 4 6 8 10 υ t 2 4 6 8 10 Figure 8: The state and input trajectories for the experiment in Section 4.2. The solid and dashed lines are the trajectories of (6) and (5), respectively. State: ( tgaT.R37 tgaH.R38a1 net.Idle ) When you are in (tgaT.c==0 && 145<tgaH.c && take transition tgaT.R37->tgaT.R37a1 { c == When you are in (tgaT.c==0 && 65<=tgaH.c && take transition tgaT.R37->tgaT.R37a2 { c == When you are in (tgaT.c==0 && 102<tgaH.c && || (tgaT.c==0 && 5<=tgaH.c && tgaH.c<65), take transition tgaT.R37->tgaT.R37a3 { c == tgaH.c<=154), 0, tau, 1 } tgaH.c<=102), 0, tau, 1 } tgaH.c<=145) 0, tau, 1 } Notice that now there are three conditions: if the i-th condition is satisfied, the location of tgaT is forced to transit to Rσ37i for i ∈ {1, 2, 3}. The strategy generated by UPPAAL-Tiga is applied to the NCSs (5)-(6), both with the state initialized at [1, 100]T , corresponding in both cases with the initial location is R1 . The network status is shown in Fig. 6 (bottom). Short, medium and long bars represent event-triggered with triggering coefficient equals σ1 , σ2 and σ3 , respectively. During the first 10 time units, the input of (5) is updated 84 times consisting of 56 updates using σ1 , 6 updates using σ2 and 22 updates using σ3 . For (6), the input is updated 182 times consisting of 106 updates using σ1 , 26 updates using σ2 and 50 updates using σ3 . The state and input trajectories are shown in Fig. 8. 5 Discussion and Future Work We have provided an approach to synthesize conflict-free scheduling policies for sets of networked control systems (NCSs) with the possibilities of updating the 21 input value according to an event-triggering mechanism, selectable from a set of them, or earlier than the time dictated by such an event-triggering rule. As indicated in Section 3.3 the main limitations of this proposed scheduling scheme is its centralized nature, and the fact that the scheduler needs to be able to read the content of the messages sent through the network. The approach is nonetheless applicable to many setups encountered in practice in which different control systems are interconnected through a bus, e.g. CAN, EtherCAT or FlexRay. In such systems, every element connected to the bus can see the traffic flowing through the network. While it may be the case that the precise content of messages is not available (e.g. for potential security reasons), it is worth noting that for the scheduler only the abstracted state, i.e. the region Rs , is relevant. Therefore we can envisage implementations or practical applications in which this sort of scheduling could be easily adopted. In wireless settings, the event-triggered paradigm offers great benefits for energy consumption reduction, but network topologies can be in general more complex than a simple bus type of configuration. Therefore, interesting extensions of this work to allow decentralized scheduling, possibly including network topological constraints, would enable broader applicability of these techniques. Current and future work is focusing on these issues, extensions of the abstraction of the timing of event-triggered systems beyond LTI systems with statefeedback, and on the implementation of a tool-box automating the whole timing abstraction and scheduler synthesis proposed in [27] and the current paper respectively. References [1] J. Liu, A. Gusrialdi, D. Obradovic, and S. Hirche, “Study on the effect of time delay on the performance of distributed power grids with networked cooperative control,” in Proceedings of the 1st IFAC Workshop on Estimation and Control of Networked Systems, 2009, pp. 168–173. [2] H. A. Thompson, “Wireless and internet communications technologies for monitoring and control,” Control Engineering Practice, vol. 12, no. 6, pp. 781–791, 2004. [3] D. Lehmann and J. Lunze, “Extension and experimental evaluation of an event-based state-feedback approach,” Control Engineering Practice, vol. 19, no. 2, pp. 101–112, 2011. [4] P. Antsaklis and J. Baillieul, “Special issue on technology of networked control systems,” Proceedings of the IEEE, vol. 95, no. 1, pp. 5–8, Jan. 2007. [5] G. Nair, F. Fagnani, S. Zampieri, and R. Evans, “Feedback control under data rate constraints: An overview,” Proceedings of the IEEE, vol. 95, no. 1, pp. 108–137, Jan. 2007. 22 [6] J. P. Hespanha, P. Naghshtabrizi, and Y. Xu, “A survey of recent results in networked control systems,” Proceedings of the IEEE, vol. 95, pp. 138–162, Jan. 2007. [7] D. Hristu-Varsakelis and W. S. Levine, Eds., Handbook of networked and embedded control systems, ser. Control Engineering. Boston, MA: Birkhäuser Boston Inc., 2005. [8] K.-E. Årzén, A. Bicchi, S. Hailes, K. Johansson, and J. Lygeros, “On the design and control of wireless networked embedded systems,” in IEEE Computer Aided Control System Design,, Oct. 2006, pp. 440–445. [9] M. Rabi and K. H. Johansson, “Event-triggered strategies for industrial control over wireless networks,” in Proc. 4th Annual Int. Conf. Wireless Internet. ICST (Institute for Computer Sciences, Social-Informatics and Telecommunications Engineering), 2008, p. 34. [10] M. Mazo Jr. and P. Tabuada, “Decentralized event-triggered control over wireless sensor/actuator networks.” IEEE Transactions on Automatic Control, Special issue on Wireless Sensor Actuator Networks, vol. 56, no. 10, pp. 2456–2461, Oct. 2011. [11] K. Åström and B. Bernhardsson, “Comparison of Riemann and Lebesgue sampling for first order stochastic systems,” in Proceedings of the 41th IEEE Conference on Decision and Control (CDC’02), vol. 2, Dec. 2002, pp. 2011– 2016. [12] P. Tabuada, “Event-triggered real-time scheduling of stabilizing control tasks,” IEEE Transactions on Automatic Control, vol. 52, no. 9, pp. 1680– 1685, Sep. 2007. [13] M. Velasco, J. Fuertes, and P. Marti, “The self triggered task model for realtime control systems,” in Proceedings of the 24th IEEE Real-Time Systems Symposium (Work in Progress), 2003, pp. 67–70. [14] W. Heemels, J. Sandee, and P. van den Bosch, “Analysis of event-driven controllers for linear systems,” International Journal of Control, vol. 81, no. 4, pp. 571–590, 2008. [15] A. Anta and P. Tabuada, “To sample or not to sample: Self-triggered control for nonlinear systems,” IEEE Transactions on Automatic Control, vol. 55, pp. 2030–2042, Sep. 2010. [16] M. Mazo Jr., A. Anta, and P. Tabuada, “An ISS self-triggered implementation of linear controller,” Automatica, vol. 46, pp. 1310–1314, Aug. 2010. [17] B. Sprunt, L. Sha, and J. Lehoczky, “Aperiodic task scheduling for hardreal-time systems,” Real-Time Systems, vol. 1, no. 1, pp. 27–60, 1989. 23 [18] G. C. Buttazzo, Hard real-time computing systems: predictable scheduling algorithms and applications. Springer, 2011, vol. 24. [19] G. C. Walsh and H. Ye, “Scheduling of Networked Control Systems,” IEEE Control Systems Magazine, 2001. [20] A. Cervin and T. Henningsson, “Scheduling of event-triggered controllers on a shared network,” in Proceedings of the 47th IEEE Conference on Decision and Control (CDC’08), Dec. 2008, pp. 3601–3606. [21] S. Al-Areqi, D. Gorges, S. Reimann, and S. Liu, “Event-based control and scheduling codesign of networked embedded control systems,” in Proceedings of the 32nd American Control Conference (ACC’13), Jun. 2013, pp. 5299–5304. [22] S. Al-Areqi, D. Gorges, and S. Liu, “Stochastic event-based control and scheduling of large-scale networked control systems,” in Proceedings of the European Control Conference, Jun. 2014, pp. 2316–2321. [23] S. Reimann, S. Al-Areqi, and S. Liu, “An event-based online scheduling approach for networked embedded control systems,” in Proceedings of the 32nd American Control Conference (ACC’13), Jun. 2013, pp. 5326–5331. [24] P. Bouyer, F. Cassez, E. Fleury, and K. Larsen, “Optimal strategies in priced timed game automata,” in Foundations of Software Technology and Theoretical Computer Science (FSTTCS’04), ser. Lecture Notes in Computer Science, K. Lodaya and M. Mahajan, Eds. Springer, Heidelberg, 2005, vol. 3328, pp. 148–160. [25] ——, “Synthesis of optimal strategies using HyTech,” Electronic Notes in Theoretical Computer Science, vol. 119, no. 1, pp. 11–31, 2005. [26] O. Maler, A. Pnueli, and J. Sifakis, “On the synthesis of discrete controllers for timed systems,” in Proc. 12th Symp. on Theoretical Aspects of Computer Science (STACS’95), ser. Lecture Notes in Computer Science, E. Mayr and C. Puech, Eds. Springer, Heidelberg, 1995, vol. 900, pp. 229–242. [27] A. Sharifi Kolarijani and M. Mazo Jr., “A formal traffic characterization of LTI event-triggered control systems,” CoRR, vol. abs/1503.05816, 2015. [28] L. De Alfaro, T. Henzinger, and R. Majumdar, “Symbolic algorithms for infinite-state games,” in Concurrency Theory (CONCUR’01), ser. Lecture Notes in Computer Science, K. Larsen and M. Nielsen, Eds. Springer, Heidelberg, 2001, vol. 2154, pp. 536–550. [29] F. Cassez, A. David, E. Fleury, K. Larsen, and D. Lime, “Efficient on-thefly algorithms for the analysis of timed games,” in Concurrency Theory (CONCUR’05), ser. Lecture Notes in Computer Science, M. Abadi and L. de Alfaro, Eds. Springer, Heidelberg, 2005, vol. 3653, pp. 66–80. 24 [30] E. Asarin, O. Maler, A. Pnueli, and J. Sifakis, “Controller synthesis for timed automata,” in Proc. IFAC Symp. on System Structure & Control, 1998, pp. 469–474. [31] R. Alur and D. Dill, “A theory of timed automata,” Theoretical Computer Science, vol. 126, no. 2, pp. 183–235, 1994. [32] A. Ravn, J. Srba, and S. Vighio, “Modelling and verification of web services business activity protocol,” in Tools and Algorithms for the Construction and Analysis of Systems (TACAS’11), ser. Lecture Notes in Computer Science, P. Abdulla and K. Leino, Eds. Springer, Heidelberg, 2011, vol. 6605, pp. 357–371. [33] K. Havelund, A. Skou, K. Larsen, and K. Lund, “Formal modeling and analysis of an audio/video protocol: an industrial case study using UPPAAL,” in Proceedings of the 18th IEEE Real-Time Systems Symposium (RTSS’97), Dec. 1997, pp. 2–13. [34] P. D’Argenio, J.-P. Katoen, T. Ruys, and J. Tretmans, “The bounded retransmission protocol must be on time!” in Tools and Algorithms for the Construction and Analysis of Systems (TACAS’97), ser. Lecture Notes in Computer Science, E. Brinksma, Ed. Springer, Heidelberg, 1997, vol. 1217, pp. 416–431. [35] L. Aceto, A. Burgueño, and K. Larsen, “Model checking via reachability testing for timed automata,” in Tools and Algorithms for the Construction and Analysis of Systems (TACAS’98), ser. Lecture Notes in Computer Science, B. Steffen, Ed. Springer, Heidelberg, 1998, vol. 1384, pp. 263–280. [36] H. Jensen, K. Larsen, and A. Skou, “Modelling and analysis of a collision avoidance protocol using SPIN and UPPAAL,” BRICS Report Series, vol. 3, no. 24, 1996. [37] A. David and W. Yi, “Modelling and analysis of a commercial field bus protocol,” in 12th Euromicro Conference on Real-Time Systems, 2000, pp. 165–172. [38] T. Henzinger, X. Nicollin, J. Sifakis, and S. Yovine, “Symbolic model checking for real-time systems,” Information and Computation, vol. 111, no. 2, pp. 193–244, 1994. [39] A. Fehnker, “Scheduling a steel plant with timed automata,” in Proc. 6th Int. Conf. Real-Time Computing Systems and Applications (RTCSA’99), 1999, pp. 280–286. [40] Y. Abdeddaı̈m and O. Maler, “Job-shop scheduling using timed automata?” in Computer Aided Verification (CAV’01), ser. Lecture Notes in Computer Science, G. Berry, H. Comon, and A. Finkel, Eds. Springer, Heidelberg, 2001, vol. 2102, pp. 478–492. 25 [41] Y. Abdeddaı̈m, A. Kerbaa, and O. Maler, “Task graph scheduling using timed automata,” in Proc. Int. Parallel and Distributed Processing Symposium (IPDPS’03), Apr. 2003, pp. 8 pp.–. [42] G. Behrmann, E. Brinksma, M. Hendriks, and A. Mader, “Scheduling lacquer production by reachability analysis – a case study,” in Proceedings of the 16th IFAC World Congress. Elsevier, 2005. [43] ——, “Production scheduling by reachability analysis - a case study,” in Proc. 19th IEEE Int. Parallel and Distributed Processing Symposium (IPDPS’05), Apr. 2005, pp. 140a–140a. [44] G. Behrmann, A. Fehnker, T. Hune, K. Larsen, P. Pettersson, J. Romijn, and F. Vaandrager, “Minimum-cost reachability for priced time automata,” in Hybrid Systems: Computation and Control (HSCC’01), ser. Lecture Notes in Computer Science, M. Di Benedetto and A. SangiovanniVincentelli, Eds. Springer, Heidelberg, 2001, vol. 2034, pp. 147–161. [45] R. Alur, S. La Torre, and G. Pappas, “Optimal paths in weighted timed automata,” in Hybrid Systems: Computation and Control (HSCC’01), ser. Lecture Notes in Computer Science, M. Di Benedetto and A. SangiovanniVincentelli, Eds. Springer, Heidelberg, 2001, vol. 2034, pp. 49–62. [46] P. Bouyer, E. Brinksma, and K. Larsen, “Optimal infinite scheduling for multi-priced timed automata,” Formal Methods in System Design, vol. 32, no. 1, pp. 3–23, 2008. [47] J. Bengtsson and W. Yi, “Timed automata: Semantics, algorithms and tools,” in Lectures on Concurrency and Petri Nets, ser. Lecture Notes in Computer Science, J. Desel, W. Reisig, and G. Rozenberg, Eds. Springer, Heidelberg, 2004, vol. 3098, pp. 87–124. [48] G. Behrmann, A. David, and K. Larsen, “A tutorial on Uppaal,” in Formal Methods for the Design of Real-Time Systems (SFM-RT’04), ser. Lecture Notes in Computer Science, M. Bernardo and F. Corradini, Eds., vol. 3185. Springer, Heidelberg, Sep. 2004, pp. 200–236. [49] L. Hetel, A. Kruszewski, W. Perruquetti, and J.-P. Richard, “Discrete and intersample analysis of systems with aperiodic sampling,” IEEE Transactions on Automatic Control, vol. 56, no. 7, pp. 1696–1701, Jul. 2011. 26
3cs.SY
IEICE TRANS. ??, VOL.Exx–??, NO.xx XXXX 200x 1 LETTER Local Modules in Imperative Languages arXiv:1701.05034v4 [cs.PL] 19 Oct 2017 Keehang KWON† , Member and Daeseong KANG†† , Nonmember SUMMARY We propose a notion of local modules for imperative langauges. To be specific, we introduce a new implication statement of the form D ⊃ G where D is a module (i.e., a set of procedure declarations) and G is a statement. This statement tells the machine to add D temporarily to the program in the course of executing G. Thus, D acts as a local module and will be discarded after executing G. It therefore provides efficient program management. In addition, we describe a new constructive module language to improve code reuse. Finally, we describe a scheme which improves the heap management in traditional languages. We illustrate our idea via Cmod , an extension of the core C with the new statement. key words: local modules, program management, memory management. 1. by its most recent declaration. On the other hand, most modern languages allow local procedures within nested procedures. These approaches are based on static scoping in granting access and requires no run-time loading and unloading. The main advantages of our approach is the following: (1) It allows local procedures at the statement level, whereas other languages allow local procedures only at the procedural level. Thus our langauge provides the programmer more flexibility. (2) It leads to efficient program/memory management due to loading and unloading. This is not negligible when local procedures are big. (3) It has a simple, natural syntax and semantics due to dynamic scoping of local procedures. In contrast, it is well-known that other systems have awkward and complicated semantics mainly due to static scoping. Consequently, these systems are very difficult to read, write, implement and reason about. Introduction Efficient program management in imperative programming – C, its extension [4] and Java – is an important issue. Yet this has proven a difficult task, relying on adhoc techniques such as various cache/page replacement algorithms. An analysis shows that this difficulty comes from the fact that the machine has no idea as to which modules are to be used in the near future. Therefore module management can be made easier by making the programmer specify which modules are to be used. Toward this end, inspired by [5]–[7], we propose a new implication statement D ⊃ G, where D is a set of procedure declarations and G is a statement. This has the following execution semantics: add D temporarily to the current program in the course of executing G. In other words, the machine loads D to the current program, executes G, and then unloads D from the current program. This implication statement is closely related to the let-expression in functional languages and the implication goals in logic languages [6], [7]. Thus D acts as local procedures to G in that D is hidden from the rest. Our approach calls for a new runtime stack called program stack, as it requires run-time loading and unloading. It follows that local procedures in our language is (stack) dynamic scoped in the sense that the meaning of a procedure is always determined Manuscript received January 1, 2003. Manuscript revised January 1, 2003. Final manuscript received January 1, 2003. † The authors are with Computer Eng., DongA University. email:[email protected] †† The author is with Electronics Eng., DongA University. On the negative side, it requires a little run-time overhead for loading and unloading. In the sequel, a module is nothing but a set of procedures with a name. Our notion of local procedures extends to a notion of local (occurrences of ) modules in a straightforward way. That is, we propose a new module implication statement /m ⊃ G, where m is a module name and G is a statement. This has the following execution semantics: add a (local occurrence of) module m temporarily to the current program in the course of executing G. Note that our modules are stack dynamic in the sense that they are loaded/unloaded in the program in a stack fashion. This leads naturally to the dynamic scoping for procedure names. In contrast, most imperative languages have a module language which is typically based on the notion of static modules with no run-time loading and unloading, leading naturally to static scoping. It is well-known that static scoping causes the naming problem among procedures across independent modules. Our module system has some advantages over other popular module systems in imperative languages. (1) It allows the programmer to load and unload other IEICE TRANS. ??, VOL.Exx–??, NO.xx XXXX 200x 2 modules due to the module implication statement. This leads to the dynamic scoping for procedure names. In contrast, this is traditionally impossible in other languages, leading to the static scoping and the naming problem. (2) Dynamic scoping leads to a simple, natural syntax and semantics, as there is no naming problem. (3) As we shall see later, it allows mutually recursive modules thanks to dynamic scoping. In addition, we add a novel module language to improve code reuse. Finally, we propose a variant of the implication statement which considerably simplifies the heap management. This paper extends a C-like language with the new implication statement. We focus on the minimum core of C. The remainder of this paper is structured as follows. We describe Cmod , an extension of C with a new statement in Section 2. In Section 3, we present an example of Cmod . In Section 4, we describe a constructive module language for enhancing code reuse. In Section 5, we propose a scheme that improves the heap management. Section 6 concludes the paper. 2. the interpreter tries to find a matching procedure for a procedure call A inside the module D by decomposing D into a smaller unit (via rule (4)-(5)) and reducing D to its instance (via rule (2)) and then backchaining on the resulting definition (via rule (1)). To be specific, the rule (2) basically deals with argument passing: it eliminates the universal quantifier x in ∀xD by picking a value t for x so that the resulting instantiation, [t/x]D, matches the procedure call A. The notation S seqand R denotes the sequential execution of two tasks. To be precise, it denotes the following: execute S and execute R sequentially. It is considered a success if both executions succeed. Similarly, the notation S parand R denotes the parallel execution of two tasks. To be precise, it denotes the following: execute S and execute R in any order. It is considered a success if both executions succeed. The notation S ← R denotes reverse implication, i.e., R → S. Definition 1. Let G be a statement and let P be the program. Then the notion of executing hP, Gi and producing a new program P ′ – ex(P, G, P ′ ) – is defined as follows: (1) bc((A = G1 ), P, A, P1 ) ← ex(P, G1 , P1 ). % A matching procedure for A is found. (2) bc(∀xD, P, A, P1 , ) ← bc([t/x]D, P, A, P1 ). % argument passing (3) bc(D1 ∧ D2 , P, A, P1 ) ← bc(D1 , P, A, P1 ). % look for a matching procedure in D1 . (4) bc(D1 ∧ D2 , P, A, P1 ) ← bc(D2 , P, A, P1 ). % look for a matching procedure in D2 (5) ex(P, A, P1 ) ← (Di ∈ P) parand bc(Di , P, A, P1 ), provided that Di is the first module in the stack, which contains a declaration of A. % A is a procedure call (6) ex(P, true, P). % True is always a success. (7) ex(hS, θi, x = E, hS, θ⊎{(x, E ′ )}i) ← eval(P, E, E ′ ). % evaluate E to get E ′ . Here, ⊎ denotes a set union but (x, V ) in θ will be replaced by (x, E ′ ). (8) ex(P, G1 ; G2 , P2 ) ← ex(P, G1 , P1 ) seqand ex(P1 , G2 , P2 ). % a sequential composition (9) ex(hS, θi, D ⊃ G1 , P1 ) ← ex((hD :: S, θi, G1 , P1 ). % add D to the top of the program stack S. The Core Language The language is core C with procedure definitions. It is described by G- and D-formulas given by the BNF syntax rules below: G ::= true | A | x = E | G; G | D ⊃ G D ::= A = G | ∀x D | D ∧ D In the above, A represents a head of a procedure declaration p(x1 , . . . , xn ) where x1 , . . . , xn are parameters. A D-formula is a set of procedure declarations. In the transition system to be considered, a G-formula will function as a statement and a list of D-formulas enhanced with the machine state (a set of variablevalue bindings) will constitute a program. Thus, a program is a pair of two disjoint components, i.e., hD1 :: . . . :: Dn :: nil, θi where D1 :: . . . :: Dn :: nil is a stack of D-formulas and θ represents the machine state. θ is initially empty and will be updated dynamically during execution via the assignment statements. We will present an interpreter for our language via natural semantics [3]. Note that our interpreter alternates between the execution phase and the backchaining phase. In the execution phase (denoted by ex(P, G, P ′ )), it executes a statement G with respect to P and produce a new program P ′ by reducing G to simpler forms. The rules (6)-(9) deal with this phase. If G becomes a procedure call, the machine switches to the backchaining mode. This is encoded in the rule (5). In the backchaining mode (denoted by bc(D, P, A, P ′ )), (10) ex(hS, θi, /m ⊃ G1 , P1 ) ← ex((hD :: S, θi, G1 , P1 ). % add D to the top of the program stack S. LETTER 3 If ex(P, G, P1 ) has no derivation, then the interpreter returns the failure. The rule (9) deals with the new feature. 3. Examples In our language, a module is simply a set of procedures associated with a name. Below the keyword module associates a name to a D-formula. The following module Emp has a procedure Age which sets the variable named age, whose value represents the employee’s age. Similarly, the module Bank is defined with the procedures Deposit, Withdraw, Balance. module Emp. Age(emp) = switch (emp) { case tom: age = 31; break; case kim: age = 40; break; case sue: age = 22; break; default: age = 0; break; } module Bank. Deposit(name,amount) = . . . Withdraw(name,amount) = . . . Balance(name) = . . . Now consider executing the following main statement G from an empty program. % first task using module EmpAge ( Emp ⇒ (Age(tom); print(age); Age(kim); print(age); Age(sue); print(age))) ; % second task using module Bank ( Bank ⇒ deposit(tom,$100)) Execution proceeds as follows: Initially the program is empty. Then, the machine loads the module Emp to the program, printing the ages of three employees – Tom, Kim and Sue –, and then unloads the module Emp. Then, the machine loads the module Bank to the program, deposits $100 to Tom’s account, and then unloads the module Bank. Note that the module Emp is available to the first task only, while Bank to the second task only. As the second example, let us consider two mutually recursive modules Ev and Od. The module Ev has a procedure Even(x) which returns true if x is even. Similarly, the module Od is defined with the procedure Odd(x). module Ev. Even(x) = if x == 0, true else Od ⇒ Odd(x-1); module Od. Odd(x) = if x == 1, true else Ev ⇒ Even(x-1); Now consider executing even(9) from the module Ev. Execution proceeds as follows: Initially the program is empty. Then, the machine loads the module Emp to the program, printing the ages of three employees – Tom, Kim and Sue –, and then unloads the module Emp. Then, the machine loads the module Bank to the program, deposits $100 to Tom’s account, and then unloads the module Bank. Note that the module Emp is available to the first task only, while Bank to the second task only. 4. A Constructive Module Langauge Modern languages typically support code reuse via inheritance. We propose a constructive approach to code reuse as an alternative to inheritance. To begin with, our language provides a special macro function / which binds a name to a set of method (and constant) declarations. This macro function serves to represent programs in a concise way. For example, given two macro definitions /p = f (x) = x and /q = g(x) = 0, the notation /p ∧ /q represents f (x) = x ∧ g(x) = 0. Here ∧ means the accumulation of two modules. In addition to ∧, our module language provides a IEICE TRANS. ??, VOL.Exx–??, NO.xx XXXX 200x 4 renaming operation of the form ren(b, a)D which replaces b by a in a module D and ∀xD for universal generalization. There are other useful operations such as private f D (reuse D with making f private) and shareD (reuse D via sharing, not copying) but we will not discuss them further here. Now let us consider macro processing. Macro definitions are typically processed before the execution but in our setting, it is possible to process macros and execute regular programs in an interleaved fashion. We adopt this approach below. We reconsider the language in Section 2. (7) ex(P, A, P1 ) ← (Di ∈ P) parand bc(Di , P, A, P1 ), provided that Di is the first module in the stack, which contains a declaration of A. % A is a procedure call (8) ex(P, true, P). % True is always a success. (9) ex(hS, M, θi, x = E, hS, M, θ ⊎ {(x, E ′ )}i) ← eval(P, E, E ′ ). % evaluate E to get E ′ . Here, ⊎ denotes a set union but (x, V ) in θ will be replaced by (x, E ′ ). (10) ex(P, G1 ; G2 , P2 ) ← ex(P, G1 , P1 ) seqand ex(P1 , G2 , P2 ). % a sequential composition G ::= true | A | x = E | G; G | D ⊃ G | /n : M ⊃ G D ::= A = G | /n | ren(a, b)D | ∀x D | D ∧ D (11) ex(hS, M, θi, D ⊃ G1 , P1 ) ← M ::= /n = D | M ∧ M ex((hD :: S, M, θi, G1 , P1 ). % add D to the top of the program stack S. In the above, n is a name and A represents a head of a procedure declaration p(x1 , . . . , xn ) where x1 , . . . , xn are parameters. A D-formula is a set of procedure declarations. An M -formula is called macro definitions and M is a list of M -formulas. In the transition system to be considered, a G-formula will function as a statement and a list of D-formulas, a list of M -formulas and the machine state (a set of variable-value bindings) will constitute a program. Thus, a program is a pair of three disjoint components, i.e., hD1 :: . . . :: Dn :: nil, M, θi where θ represents the machine state. θ is initially empty and will be updated dynamically during execution via the assignment statements. Definition 2. Let G be a statement and let P be the program. Then the notion of executing hP, Gi and producing a new program P ′ – ex(P, G, P ′ ) – is defined as follows: (1) bc((A = G1 ), P, A, P1 ) ← ex(P, G1 , P1 ). % A matching procedure for A is found. (2) bc(∀xD, P, A, P1 , ) ← bc([t/x]D, P, A, P1 ). % argument passing (3) bc(D1 ∧ D2 , P, A, P1 ) ← bc(D1 , P, A, P1 ). % look for a matching procedure in D1 . (4) bc(D1 ∧ D2 , P, A, P1 ) ← bc(D2 , P, A, P1 ). % look for a matching procedure in D2 (5) bc(ren(a, b)D, P, A, P1 ) ← bc([b/a]D, P, A, P1 ). % renaming operation (6) bc(/n, P, A, P1 ) if bc(D, P, A, P1 ) and (/n = D) ∈ M. % we assume it chooses the most recent macro definition. (12) ex(hS, M, θi, /n : M ⊃ G1 , P1 ) if ex(h/n :: S, M :: M, θi, G1 , P1 ) % Add new macros to the front of M. Here :: is a list constructor. If ex(P, G, P1 ) has no derivation, then the interpreter returns the failure. 5. Improving Heap Management Our earlier discussions in Section 2 are based on dynamic procedure binding. More interestingly, our notion of implication statements can be applied equally well to static procedure/data binding. To be specific, allocation and deallocation of (heap) objects – and accessing them through pointers – occur frequently in traditional imperative languages with static procedure/data binding. This includes malloc-free for memory management, new-dispose for objects, new-delete for heap objects (arrays, records, etc). Unfortunately, allocation and deallocation constructs are unstructured. Using allocation and deallocation carelessly leads to serious problems. Towards an efficient yet robust memory management, we need to impose some restrictions on the use of allocation and deallocation by providingng a highlevel statement. To be specific, we propose to use the following pointer-implication statement of the form (p = new obj) ⊃ G where p is a pointer and obj is a program object or a data object (arrary, record, etc). This is a variant of the implication statement in Section 1 with the following semantics: It creates an object obj with p being a pointer to obj, executes the statement G and then deallocate obj and p. To avoid additional complications, we assume that pointers can only be initialized but not manipulated. The following code is an example where arrayptr1 LETTER 5 and int[100] are available in both the statements S1 and S2 , while arrayptr2 and int[1000] are available only in S2 . % heap allocation (arrayptr1 = new int[100] ⊃ (arrayptr2 = new int[1000] ⊃ S1 ) S2 ) Our system requires considerable change to memory management: it needs to maintain three different categories of memory: program/data stack, run-time stack and the heap. Program/data stack is a new component and it – instead of the heap – is used to maintain program/data objects created via the new construct. Thus it replaces most of the works done by the heap. Program/data stack has considerable advantages over the heap: it is more efficient and can simplify several complications caused by the heap including garbage collection, heap fragmentation, and dangling pointers. 6. Conclusion In this paper, we have proposed a simple extension to imperative languages. This extension introduced an implication statement D ⊃ G where D is a module and G is a statement. This statement makes D local to G. It therefore maintains only the active modules in the current program context. 7. Acknowledgements This work was supported by Dong-A University Research Fund. References [1] J. Alglave and L. Maranget and M. Tautschnig, “Herding cats: Modelling, simulation, teating and data mining for weak memory”, ACM Transactions on Programming Languages and Systems, vol.36, no.2, pp.1–74, 2014. [2] G. Boudol and G. Petri, “Relaxed memory models: an operational approach”, In POPL, pp.392–403, ACM, 2009. [3] G. Kahn, “Natural Semantics”, In the 4th Annual Symposium on Theoretical Aspects of Computer Science, LNCS vol. 247, 1987. [4] K. Kwon, S. Hur and M. Park, “Improving Robustness via Disjunctive Statements in Imperative Programming”, IEICE Transations on Information and Systems, vol.E96-D,No.9, pp.2036-2038, September, 2013. [5] J. Hodas and D. Miller, “Logic Programming in a Fragment of Intuitionistic Linear Logic”, Information and Computation, vol.110, No.2, pp.327-365, 1994. [6] D. Miller, G. Nadathur, F. Pfenning, and A. Scedrov, “Uniform proofs as a foundation for logic programming”, Annals of Pure and Applied Logic, vol.51, pp.125–157, 1991. [7] D. Miller, G. Nadathur, Programming with higher-order logic, Cambridge University Press, 2012.
6cs.PL
Good Code Sets from Complementary Pairs via Discrete Frequency Chips Ravi Kadlimatti 1,*and Adly T. Fam 2 Advanced Wireless Systems Research Center, State University of New York at Oswego, Oswego, NY 13126, USA; [email protected] 2 Department of Electrical Engineering, University at Buffalo, The State University of New York, Buffalo, NY 14260, USA; [email protected] * Correspondence: [email protected]; Tel.: +1-716-491-8985 1 Abstract: It is shown that replacing the sinusoidal chip in Golay complementary code pairs by special classes of waveforms that satisfy two conditions, symmetry/anti-symmetry and quazi-orthogonality in the convolution sense, renders the complementary codes immune to frequency selective fading and also allows for concatenating them in time using one frequency band/channel. This results in a zero-sidelobe region around the mainlobe and an adjacent region of small cross-correlation sidelobes. The symmetry/anti-symmetry property results in the zero-sidelobe region on either side of the mainlobe, while quasi-orthogonality of the two chips keeps the adjacent region of cross-correlations small. Such codes are constructed using discrete frequency-coding waveforms (DFCW) based on linear frequency modulation (LFM) and piecewise LFM (PLFM) waveforms as chips for the complementary code pair, as they satisfy both the symmetry/anti-symmetry and quasi-orthogonality conditions. It is also shown that changing the slopes/chirp rates of the DFCW waveforms (based on LFM and PLFM waveforms) used as chips with the same complementary code pair results in good code sets with a zero-sidelobe region. It is also shown that a second good code set with a zero-sidelobe region could be constructed from the mates of the complementary code pair, while using the same DFCW waveforms as their chips. The cross-correlation between the two sets is shown to contain a zero-sidelobe region and an adjacent region of small cross-correlation sidelobes. Thus, the two sets are quasi-orthogonal and could be combined to form a good code set with twice the number of codes without affecting their cross-correlation properties. Or a better good code set with the same number codes could be constructed by choosing the best candidates form the two sets. Such code sets find utility in multiple input-multiple output (MIMO) radar applications. Keywords: discrete frequency-coding waveform; linear FM; chirp; piecewise LFM; complementary code pair; symmetry; anti-symmetry; good code sets; MIMO radar 1. Introduction 1.1. Background Good aperiodic codes are characterized by a narrow mainlobe and small sidelobes. Smaller autocorrelation peak sidelobes reduce the probability of false alarm, while a narrower mainlobe enhances the range resolution. Such properties are desirable in certain communications applications like preamble synchronization and in most radar applications. Let 𝑥[𝑛] be a code of length 𝑁. Its aperiodic autocorrelation (ACF) can be represented by, 𝑁−1 𝑅[𝑛] = ∑ 𝑥[𝑘]𝑥 ∗ [𝑛 + 𝑘] 𝑘=0 𝑍 In the 𝑍-domain, if 𝑥[𝑛] ⇔ 𝑋(𝑧) then, its ACF can be represented by, (1) 𝑍 𝑅[𝑛] ⇔ 𝑅(𝑧) = 𝑋(𝑧)𝑋(𝑧 −1 ) = 𝑁 + 𝑆(𝑧) (2) where 𝑁 and 𝑆(𝑧) represent the mainlobe/peak and the sidelobes respectively. Let 𝑝(𝑡) = 𝑒 𝑗2𝜋𝑓𝑝 𝑡 , 0 ≤ 𝑡 ≤ 𝑇, represent a sinusoidal chip. 𝑥[𝑛] modulates 𝑝(𝑡) resulting in 𝑥𝑝 (𝑡). 𝑁−1 𝑥𝑝 (𝑡) = ∑ 𝑥[𝑛] 𝑝(𝑡 − 𝑛𝑇) (3) 𝑛=0 Its ACF can be represented by, 𝑅𝑥 (𝑡) = ∫ 𝑡+𝑇 𝑡 If 𝑥𝑝 (𝑡) is sampled at intervals of 𝑇𝑠 = 0, 1, 2, … , (𝑁 − 1)𝑁𝑠 , can be represented by, 1 𝑓𝑠 𝑥𝑝 (𝜏)𝑥𝑝∗ (𝑡 + 𝜏)𝑑𝜏 (4) , then in the 𝑍 -domain, 𝑥𝑝 (𝑚𝑇𝑠 ) for 𝑚 = 𝑍 𝑥𝑝 (𝑚𝑇𝑠 ) ⇔ 𝑋𝑝 (𝑧) = 𝑋(𝑧 𝑁𝑠 )𝑃(𝑧) (5) 𝑍 where 𝑝(𝑚𝑇𝑠 ) ⇔ 𝑃(𝑧) and 𝑁𝑠 represents the number of samples in 𝑃(𝑧). ACF of 𝑋𝑝 (𝑧) can be represented by, 𝑅𝑥 (𝑧) = 𝑋𝑝 (𝑧)𝑋𝑝 (𝑧 −1 ) (6) 𝑅𝑥 (𝑧) = 𝑋(𝑧 𝑁𝑠 )𝑃(𝑧)𝑋(𝑧 −𝑁𝑠 )𝑃(𝑧 −1 ) (7) 𝑅𝑥 (𝑧) = 𝑅(𝑧 𝑁𝑠 )𝑅𝑝 (𝑧) (8) 𝑅𝑥 (𝑧) = 𝑁𝑅𝑝 (𝑧) + 𝑆(𝑧 𝑁𝑠 )𝑅𝑝 (𝑧) (9) where 𝑅𝑝 (𝑧) = 𝑃(𝑧)𝑃(𝑧 −1 ) represents the ACF of the highly sampled chip and 𝑅(𝑧) is given in Equation (2). It can be observed that the mainlobe and the sidelobes are spread by the ACF of the chip (𝑅𝑝 (𝑧)). Some of the well-known good aperiodic codes are the Barker codes, Frank codes [1] and waveforms based on Costas arrays [2–4]. Barker codes are biphase codes that have unity magnitude peak sidelobes. However, the longest known Barker code of odd length is of length 13 which gives a 1 peak sidelobe ratio of . Frank codes are polyphase codes obtained by concatenating the rows of a 13 discrete Fourier transform (DFT) matrix. Thus, Frank codes are available for a variety of code lengths and achieve high peak sidelobe ratios for long code lengths. However, as the code length increases the number of distinct phases also increases. Costas arrays are completely classified to date up to order 27, and are known to exist of orders up to 200. They are widely used in radar and sonar applications because of their thumbtack ambiguity function. The codes presented in this paper are based on biphase complementary code pair that are available at a variety of code lengths. One of the widely used approaches to suppress the ACF sidelobes of a waveform/code is via windowing whereby the peak sidelobe level is reduced, but at the cost of increasing the mainlobe width. Mismatched filters like the ones introduced in [5–8] could also be used to reduce ACF sidelobes at the cost of a small loss in signal-to-noise ratio. In [9], it is shown that complete sidelobe cancellation for a class of aperiodic codes is possible using additive-multiplicative processing of the matched filter (MF) output. However, the non-linear processing involved in these mismatched filters incurs additional computational cost and suffer from degraded performance in high noise environments. Although it is impossible for individual aperiodic codes to have zero sidelobes, Golay complementary code pair [10], polyphase complementary codes [11] and complementary code sequences [12] achieve complete sidelobe cancellation via addition of their autocorrelations. Figure 1 shows the transmission and reception of a Golay complementary code pair (say 𝑎[𝑛] and 𝑏[𝑛], of length 𝑁𝑔 ). 𝑎[𝑛] is transmitted at frequency 𝑓1 (using 𝑐1 (𝑡) = 𝑒 𝑗2𝜋𝑓1 𝑡 ) and 𝑏[𝑛] at 𝑓2 (using 𝑐2 (𝑡) = 𝑒 𝑗2𝜋𝑓2 𝑡 ). At the receiver, the code pair are received in their own matched filters. Addition of their MF outputs (𝑅𝑎 (𝑡) and 𝑅𝑏 (𝑡)) results in complete cancellation of the sidelobes. However, frequency selective fading results in unequal attenuation of the two codes. This results in reemerging sidelobes due to inexact cancellation of the non-zero sidelobes of the code pair, as shown in Figure 2 for 𝑁𝑔 = 8. Since the sidelobes of the code pair are not small, any inexact cancellation results in reemerging sidelobes which is highly undesirable. In Figure 2, 𝑅𝑎 (𝑡), 𝑅𝑏 (𝑡) and 𝑅(𝑡) represent the fading absent case and 𝑅𝑎 ′(𝑡), 𝑅𝑏 ′(𝑡) and 𝑅′(𝑡) represent the fading present case. For the fading present case, 𝑎(𝑡) and 𝑏(𝑡) are attenuated by 0.95 and 0.85 respectively. Galati et al. [13] also discusses in detail this effect of unequal attenuation on the complementary code pairs. Liu et al. [14] describes z-complementary code pairs that achieve a zero-correlation zone around the mainlobe and minimum possible sidelobe peaks outsize the zero domain. However, these codes also require two frequencies or channels which makes them vulnerable to the aforementioned effects of fading. Tang et al. [15] and Li [16] describe (loosely synchronized) LS and (large area) LA codes for (quasi-synchronous code division multiple access) QS-CDMA systems. These codes also achieve a zero interference zone in both the autocorrelation and the cross-correlations, but the peak sidelobes outside the zero-sidelobe region are not small. In this paper, we introduce codes constructed from biphase Golay complementary code pairs that are available at a variety of lengths. These codes have a zero-sidelobe domain on either side of the mainlobe, while the sidelobe peaks outside the zero domain are very small. Since these codes use the same frequency band, they are not affected by the effects of fading. Ng 0 a (t ) a [n ] e j 2πf1 t e am (t ) 2N g a* (T - t ) am (t )+n (t ) e j 2πfc t - j 2πfc t BPF1 R a (t ) Matched filter 0 R (t ) Ng 0 b [n ] bm (t ) b (t ) b* (T - t ) bm (t )+n (t ) e j 2πf2 t e j 2πfc t e - j 2πfc t BPF2 Channel Tx R b (t ) Matched filter Rx Figure 1. Transmitter (Tx) and receiver (Rx) of a Golay complementary code pair. N N 2N 0 0 0 g g (a) R (t) g (b) R (t) a (c) R(t) b Ng Ng 2Ng 0 0 0 (d) Ra'(t) (e) Rb'(t) (f) R'(t) Figure 2. (a–c) Plots of matched filter outputs in the absence of frequency selective fading; and (d–f) plots of matched filter outputs in the presence of fading. 1.2. The Proposed Codes Based on Complementary Pairs via Discrete Frequency Chips Given any complementary code pair 𝑎[𝑛] and 𝑏[𝑛] , 𝑎[𝑛] + 𝑏[𝑛 − 𝑁𝐷 ] is constructed by concatenating 𝑎[𝑛] and 𝑏[𝑛] in the time domain using one frequency band/channel. The chips used for 𝑎[𝑛] and 𝑏[𝑛] satisfy the following two conditions: 1. 2. They are symmetrical/anti-symmetrical mirror images of each other, i.e., 𝑐(𝑡) with 𝑎[𝑛] and 𝑐(−𝑡)/−𝑐(−𝑡) (or 𝛾𝑐(−𝑡), where 𝛾 = 1 or −1) with 𝑏[𝑛]. They are quasi-orthogonal in the convolution sense. This concatenated code has a region of zero-sidelobes on either side of the mainlobe and an adjacent region of small cross-correlations. Due to the symmetry/anti-symmetry property, the two chips have identical ACF. This results in exact sidelobe cancellation of the complementary code pair, creating a zero-sidelobe region on either side of the mainlobe. The cross-correlation peak (𝐶𝐶𝑃) between 𝑐(𝑡) and 𝛾𝑐(−𝑡) is represented by, 𝑡+𝑇 𝐶𝐶𝑃 = max | ∫𝑡 𝛾𝑐(𝜏)𝑐 ∗ (−𝑡 + 𝜏)𝑑𝜏 2𝑁𝑔 𝑡 | (10) Since 𝑐(𝑡) and 𝛾𝑐(−𝑡) are quazi-orthogonal in the convolution, 𝐶𝐶𝑃 is small compared to the mainlobe peak 2𝑁𝑔 . This property makes the adjacent region of cross-correlation sidelobes small. Discrete frequency-coding waveforms (DFCW) based on linear frequency modulation (LFM, also known as a chirp signal) and piecewise LFM (PLFM) [17] waveforms satisfy both the symmetry/anti-symmetry and quasi-orthogonality conditions. Hence, they are used as chips for the complementary code pair. A discrete frequency-coding waveform, say 𝑐(𝑡), is the sum of 𝑁 contiguous sub-pulses of the same duration Δ𝑇, but not necessarily the same frequency. 𝑐(𝑡) = 1 𝑁−1 ∑ 𝑒 𝑗2𝜋𝑓[𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 (11) where Δ𝑊 is the smallest possible frequency offset between two frequencies, 𝑓[𝑛]Δ𝑊 is the frequency of the nth sub-pulse and 𝑓[𝑛] ∈ {0, 1, 2, … , 𝑁 − 1}. DFCW sets find utility in MIMO radars [18] and Orthogonal Netted Radar Systems (ONRS) [19,20] that improve radar performance through spatial diversity. Several good DFCW sets have been proposed, such as the ones in [20–22]. In this paper, it is also shown that a quasi-orthogonal set of symmetrical/anti-symmetrical DFCW waveforms could be used as chips with the same complementary code pair to result in a good code set with a zero-sidelobe region. Several good code sets are constructed by changing the slopes/chirp rates of the DFCW chips based on LFM and PLFM waveforms. The code sets constructed with DFCW chips based on LFM waveforms occupy different bandwidths but have smaller peak cross-correlations, while the code sets constructed with DFCW chips based on PLFM waveforms occupy the same bandwidth but have slightly larger peak cross-correlations. 1.3. Construction of a Good Code Set from the Mates of the Compelemntary Code Pair Resulting in Doubling the Number of Codes in the Set or a Better Good Code Set with Significaltly Smaller Cross-Correlations Given a complementary code pair, 𝑎[𝑛] and 𝑏[𝑛], there exists the complementary code pair: 𝑏[−𝑛 + 𝑁𝑔 ] and −𝑎[−𝑛 + 𝑁𝑔 ], such that sum of the cross-correlation of 𝑎[𝑛] with 𝑏[−𝑛 + 𝑁𝑔 ] and that of 𝑏[𝑛] with −𝑎[−𝑛 + 𝑁𝑔 ] results in complete sidelobe cancellation. The code pair: 𝑏[−𝑛 + 𝑁𝑔 ] and −𝑎[−𝑛 + 𝑁𝑔 ], are called as the mates [23,24] of the complementary code pair: 𝑎[𝑛] and 𝑏[𝑛]. Thus, two good code sets could be constructed from the complementary code pair and their mates using the same DFCW waveforms as chips. Since these two good code sets will be quasi-orthogonal to each other, they could be combined to form a larger good code set with double the number of codes in the set without affecting the cross-correlation properties. Instead of using all the codes in the two sets, it is shown that a better good code set with significantly reduced cross-correlation peaks could be constructed by choosing the best candidates form the two sets. 1.4. Previous Research In [25,26], continuous frequency LFM and PLFM waveforms were used as chips for 𝑎[𝑛] and 𝑏[𝑛]. The current manuscript uses the same code structure as in [25,26], but DFCW waveforms based on LFM and PLFM waveforms are used as chips for the complementary code pair. These codes find utility in more modern digital radar systems like the ones discussed in [17–19]. In addition, this paper also introduces a method of doubling the number of codes in the set without affecting the cross-correlation properties or constructing a better good code set with significantly smaller cross-correlations than the ones introduced in [25,26]. This is achieved by constructing good code sets from a complementary code pair and their mates, while using the same DFCW waveforms as chips. This is explained in detail in Section 7. 1.5. Paper Structure Section 2 explains the two properties of symmetry/anti-symmetry and quasi-orthogonality for the discrete frequency-coding waveform chips based on LFM and PFLM waveforms. Construction of the proposed codes using DFCW chips is explained in Section 3. Doppler properties of the proposed codes are discussed in Section 4. Invariance of the zero-sidelobe region under frequency selective fading is demonstrated in Section 5. Section 6 shows the construction of good code sets. Section 7 shows the method of doubling the number of codes in the set or constructing a better good code set followed by conclusion in Section 8. 2. Symmetrical/Anti-Symmetrical DFCW Chips That Are Quasi-Orthogonal Let 𝑎(𝑡) and 𝑏(𝑡) be constructed by using 𝑐(𝑡), for 0 ≤ 𝑡 ≤ 𝑇, and 𝛾𝑐(−𝑡) (where 𝛾 = 1 or −1) as chips for the Golay complementary code pair {𝑎[𝑛], 𝑏[𝑛]} of length 𝑁𝑔 , respectively. 𝑎(𝑡) and 𝑏(𝑡) can be represented as shown in Equation (3). 𝑍 𝑍 If 𝑎[𝑛] ⇔ 𝐴(𝑧) and 𝑏[𝑛] ⇔ 𝐵(𝑧), then 𝑍 𝑎(𝑚𝑇𝑠 ) ⇔ 𝐴𝑐 (𝑧) = 𝐴(𝑧 𝑁𝑐 )𝐶(𝑧) 𝑍 𝑏(𝑚𝑇𝑠 ) ⇔ 𝐵𝑐 (𝑧) = 𝛾𝐵(𝑧 𝑁𝑐 )𝐶(𝑧 −1 ) (12) (13) where 𝑎(𝑚𝑇𝑠 ) and 𝑏(𝑚𝑇𝑠 ) represent the sampled versions of 𝑎(𝑡) and 𝑏(𝑡), respectively, 𝑁𝑐 is 𝑍 the number of samples in 𝐶(𝑚𝑇𝑠 ) ⇔ 𝐶(𝑧) and 𝑚 ∈ {0, ±1, ±2, … , ±∞}. 𝐴𝑐 (𝑧) + 𝑧 −𝐷 𝐵𝑐 (𝑧) represents a code constructed by concatenating 𝐴𝑐 (𝑧) and 𝐵𝑐 (𝑧) with a gap 𝐷 in between. At the receiver, this code is passed into two matched filters: 𝐴𝑐 (𝑧 −1 ) which is the matched filter of 𝐴𝑐 (𝑧), and 𝐵𝑐 (𝑧 −1 ) which is the MF of 𝐵𝑐 (𝑧). The cross-correlation of 𝐴𝑐 (𝑧) + 𝑧 −𝐷 𝐵𝑐 (𝑧) with 𝐴𝑐 (𝑧 −1 ) results in, 𝑅𝐴𝑐 (𝑧) = (𝐴𝑐 (𝑧) + 𝑧 −𝐷 𝐵𝑐 (𝑧))𝐴𝑐 (𝑧 −1 ) (14) 𝑅𝐴𝑐 (𝑧) = 𝐴(𝑧 𝑁𝑐 )𝐶(𝑧)𝐴(𝑧 −𝑁𝑐 )𝐶(𝑧 −1 ) + 𝛾𝑧 −𝐷 𝐵(𝑧 𝑁𝑐 )𝐶(𝑧 −1 )𝐴(𝑧 −𝑁𝑐 )𝐶(𝑧 −1 ) (15) 𝑅𝐴𝑐 (𝑧) = 𝑅𝐴 (𝑧 𝑁𝑐 )𝑅𝑐 (𝑧) + 𝛾𝑧 −𝐷 𝑅𝐵,𝐴 (𝑧 𝑁𝑐 )𝐶 2 (𝑧 −1 ) (16) where 𝑅𝐴 (𝑧) = 𝐴(𝑧)𝐴(𝑧 −1 ) represents the autocorrelation of 𝑎[𝑛], 𝑅𝑐 (𝑧) = 𝐶(𝑧)𝐶(𝑧 −1 ) represents the chip ACF (𝐶(𝑧 −1 ) is the MF of 𝐶(𝑧)), 𝑅𝐵,𝐴 (𝑧) = 𝐵(𝑧)𝐴(𝑧 −1 ) represents the cross-correlation of 𝑏[𝑛] with 𝑎[𝑛] and 𝛾𝐶 2 (𝑧 −1 ) represents the cross-correlation of 𝛾𝐶(𝑧 −1 ) with 𝐶(𝑧 −1 ). Similarly, the cross-correlation of 𝐴𝑐 (𝑧) + 𝑧 −𝐷 𝐵𝑐 (𝑧) with 𝐵𝑐−1 (𝑧) can be represented by, 𝑅𝐵𝑐 (𝑧) = 𝛾𝑅𝐴,𝐵 (𝑧 𝑁𝑐 )𝐶 2 (𝑧) + 𝛾 2 𝑧 −𝐷 𝑅𝐵 (𝑧 𝑁𝑐 )𝑅𝑐 (𝑧) (17) where 𝑅𝐴,𝐵 (𝑧) = 𝐴(𝑧)𝐵(𝑧 −1 ) represents the cross-correlation of 𝑎[𝑛] with 𝑏[𝑛] , 𝑅𝐵 (𝑧) = 𝐵(𝑧)𝐵(𝑧 −1 ) represents the ACF of 𝑏[𝑛] and 𝛾𝐶 2 (𝑧) is the cross-correlation of 𝐶(𝑧) with 𝛾𝐶(𝑧). Delaying 𝑅𝐴𝑐 (𝑧) by 𝐷 and adding it to 𝑅𝐵𝑐 (𝑧) results in, 𝑅𝑠 (𝑧) = 𝑧 −𝐷 𝑅𝐴𝑐 (𝑧) + 𝑅𝐵𝑐 (𝑧) (18) Since 𝛾 2 = 1 and 𝑅𝐴 (𝑧) + 𝑅𝐵 (𝑧) = 2𝑁𝑔 , 𝑅𝐴 (𝑧 𝑁𝑐 )𝑅𝑐 (𝑧) + 𝛾 2 𝑅𝐵 (𝑧 𝑁𝑐 )𝑅𝑐 (𝑧) = 2𝑁𝑔 𝑅𝑐 (𝑧), Equation (17) becomes 𝑅𝑠 (𝑧) = 𝛾𝑅𝐴,𝐵 (𝑧 𝑁𝑐 )𝐶 2 (𝑧) + 2𝑁𝑔 𝑧 −𝐷 𝑅𝑐 (𝑧) + 𝛾𝑧 −2𝐷 𝑅𝐵,𝐴 (𝑧 𝑁𝑐 )𝐶 2 (𝑧 −1 ) (19) 𝑅𝑠 (𝑧) contains the mainlobe ( 2𝑁𝑔 𝑅𝑐 (𝑧) ) that is spread by the chip ACF (i.e., 𝑅𝑐 (𝑧) ), a zero-sidelobe region on either side of the mainlobe and an adjacent region of cross-correlation sidelobes (i.e., the first and the last terms in Equation (19)). If 𝛾 = 1, then 𝐶(𝑧) and 𝛾𝐶(𝑧 −1 ) = 𝐶(𝑧 −1 ) represent symmetrical waveforms. If 𝛾 = −1, then 𝐶(𝑧) and 𝛾𝐶(𝑧 −1 ) = −𝐶(𝑧 −1 ) represent anti-symmetrical waveforms. For both the symmetry ( 𝛾 = 1 ) and anti-symmetry ( 𝛾 = −1 ) conditions, ACF of 𝐶(𝑧), i.e., 𝑅𝑐 (𝑧) = 𝐶(𝑧)𝐶(𝑧 −1 ) is identical to the ACF of 𝛾𝐶(𝑧), i.e., 𝑅𝛾𝑐 (𝑧) = 𝛾 2 𝐶(𝑧 −1 )𝐶(𝑧) = 𝑅𝑐 (𝑧). As a result, exact sidelobe cancellation of the complementary code pair is achieved resulting in the zero-sidelobe region on either side of the mainlobe as shown in Equation (19). If 𝐶(𝑧) and 𝛾𝐶(𝑧 −1 ) are also quasi-orthogonal in the convolution sense, i.e., their cross-correlation peak (as defined in Equation (10)) is small compared to the mainlobe peak (2𝑁𝑔 ), then the first and the last terms in Equation (19) are small. It should be noted that using a sinusoidal chip for the complementary code pair will also result in a zero-sidelobe region around the mainlobe as it satisfies the symmetry/anti-symmetry condition. However, a sinusoidal chip is not quasi-orthogonal to its symmetrical/anti-symmetrical mirror image. Thus, the proposed codes with sinusoidal chip achieves zero-sidelobe region but the cross-correlation sidelobes outside the zero domain are large which is undesirable. Hence, any waveform that satisfies the two conditions, symmetry/anti-symmetry and quasi-orthogonality, could be used as chips for the complementary code pair in the proposed code design. DFCWs based on LFM and PLFM waveforms are constructed by discretizing their instantaneous frequencies. These will be referred to as Discrete Frequency LFM (DF-LFM) and Discrete Frequency PLFM (DF-PLFM) waveforms, respectively. The DF-LFM and DF-PLFM waveforms satisfy the symmetry/anti-symmetry and the quasi-orthogonality conditions required for the chips in the proposed code design. The following three types of DFCWs are used as chips for the complementary code pair in the proposed code design: 1. 2. 3. DF-LFM waveforms. DF-PLFM waveforms comprised of two up-chirp segments. DF-PLFM waveforms comprised of an up-chirp followed by a down-chirp as in [21]. Let 𝑢(𝑡) and 𝑑(𝑡) = 𝑢∗ (−𝑡) represent a DF-LFM/DF-PLFM waveform and its symmetrical mirror image respectively. The DF-LFM waveforms can be represented by, 𝑢(𝑡) = 𝑑(𝑡) = where 𝑓[𝑛] = 𝑛 , Δ𝑊 = 1 Δ𝑇 𝑇 𝑁−1 1 ∑ 𝑒 𝑗2𝜋𝑓[𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 (20) 𝑁−1 1 ∑ 𝑒 𝑗2𝜋𝑓[𝑁−1−𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 (21) , Δ𝑇 = , 𝑛Δ𝑇 ≤ 𝑡𝑛 ≤ (𝑛 + 1)Δ𝑇 and 𝑇 is the time-duration of the 𝑁 DFCW chip. The DF-PLFM waveforms comprised of two up-chirp segments can be represented by, 1 𝑁 −1 2 ∑ 𝑒 𝑗2𝜋𝑓1[𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑢(𝑡) = 1 { √Δ𝑇 𝑁−1 ∑𝑒 𝑛= 𝑁 2 𝑗2𝜋𝑓2 [𝑁−1−𝑛]Δ𝑊𝑡𝑛 (22) 1 ∑ 𝑒 𝑗2𝜋𝑓2 [𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑑(𝑡) = (1−𝑘)2𝑛 𝑁−1 2𝑘(𝑁−1)𝑛 𝑁 (23) 𝑁−1 1 { where 𝑓1 [𝑛] = 𝑟𝑜𝑢𝑛𝑑 ( 𝑁 −1 2 √Δ𝑇 ∑𝑒 𝑗2𝜋𝑓1 [𝑁−1−𝑛]Δ𝑊𝑡𝑛 𝑁 𝑛= 2 𝑁 ) for 𝑛 = 0, 1, … , − 1, 0 < 𝑘 ≤ 0.5 and 𝑓2 [𝑛] = 𝑟𝑜𝑢𝑛𝑑 ((𝑁 − 1)(1 − 2 𝑁 𝑁 )) for 𝑛 = , + 1, … , 𝑁 − 1. 2 2 The DF-PLFM waveforms comprised of an up-chirp and a down-chirp segment can be represented by, 1 ∑ 𝑒 𝑗2𝜋𝑓1[𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑢(𝑡) = 1 { √Δ𝑇 1 𝑑(𝑡) = 𝑁 −1 2 (24) 𝑁−1 ∑𝑒 𝑛= 𝑗2𝜋𝑓2 [𝑛]Δ𝑊𝑡𝑛 𝑁 2 𝑁 −1 2 𝑁 ∑ 𝑒 𝑗2𝜋𝑓2 [ 2 −1−𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 1 √Δ𝑇 (25) 𝑁−1 ∑𝑒 𝑗2𝜋𝑓1 [𝑁−1−𝑛]Δ𝑊𝑡𝑛 𝑁 𝑛= { 2 Figure 3. shows the plots of instantaneous frequencies of the aforementioned DFCW chips. Let 𝑓𝑢 (𝑡) and 𝑓𝑑 (𝑡) represent the instantaneous frequencies of 𝑢(𝑡) and 𝑑(𝑡) , respectively. 𝑅𝑢 (𝑡) , 𝑅𝑑 (𝑡) and 𝑅𝑢,𝑑 (𝑡) represent the ACF of 𝑢(𝑡), ACF of 𝑑(𝑡) and cross-correlation between 𝑢(𝑡) and 𝑑(𝑡) respectively. They can be represented as shown in Equation (4). Since 𝑢(𝑡) and 𝑑(𝑡) are symmetrical mirror images of each other, their ACFs are identical, i.e., 𝑅𝑢 (𝑡) = 𝑅𝑑 (𝑡), as shown in the plots in Figure 4. Since 𝑢(𝑡) and 𝑑(𝑡) are also quasi-orthogonal, max |𝑅𝑢,𝑑 (𝑡)| is very small as 𝑡 shown in their plots in Figure 4. For these plots, 𝑘 = 0.24 and 𝑁 = 32. 𝑘 closes to 0 results in a DF-LFM/DF-PLFM waveform that is close to a pure sinusoid, while 𝑘 close to 0.5 results in a very sharp slope. (N-1)W (N-1)W Instantaneous frequency [Hz] (N-1)W 0 0 0 NT (a) Time [s] 0 (N/2)T (b) Time [s] NT 0 0 (N/2)T (c) Time [s] Figure 3. Plots of instantaneous frequencies of (a) discrete frequency linear frequency modulation (DF-LFM) chips, (b) discrete frequency piecewise linear frequency modulation (DF-PLFM) chips comprised of two up-chirp segments and (c) DF-PLFM chips comprised of an up-chirp and a down-chirp segment. NT DF-LFM waveform 0 -20 |Ru(t)| -60 -0.5T 0 0 (a) Time [s] 0.5T -20 |Rd(t)| -60 -0.5T 0 0 (b) Time [s] 0.5T |Ru,d(t)| -20 -60 -0.5T 0 (c) Time [s] 0.5T DF-PLFM waveform comprised of two up-chirp segments 0 |Ru(t)| -20 -60 -0.5T 0 0 (a) Time [s] 0.5T |Rd(t)| -20 -60 -0.5T 0 0 (b) Time [s] 0.5T |Ru,d(t)| -20 -60 -0.5T 0 (c) Time [s] 0.5T DF-PLFM waveform comprised of an up-chirp and a down-chirp 0 |Ru(t)| -20 -60 -0.5T 0 0 (a) Time [s] 0.5T |Rd(t)| -20 -60 -0.5T 0 0 (b) Time [s] 0.5T |Ru,d(t)| -20 -60 -0.5T 0 (c) Time [s] 0.5T Figure 4. (a) and (b) Autocorrelation and (c) cross-correlation of the discrete frequency linear frequency modulation (DF-LFM) and discrete frequency piecewise linear frequency modulation (DF-PLFM) waveforms. 3. The Proposed Code Based on Complementary Pair Using DF-LFM and DF-PLFM Waveforms as Chips Let 𝑎[𝑛] and 𝑏[𝑛] represent a Golay complementary code pair of length 𝑁𝑔 . Let 𝑎(𝑡) and 𝑏(𝑡) represent the waveforms obtained by modulating 𝑢(𝑡) (Equation (20), (22) or (24)) with 𝑎[𝑛] and 𝑑(𝑡) (Equation (21), (23) or (25)) with 𝑏[𝑛], respectively. 𝑁𝑔 𝑎(𝑡) = ∑ 𝑎[𝑛]𝑢(𝑡 − (𝑛 − 1)𝑇) 𝑛=1 (26) 𝑁𝑔 𝑏(𝑡) = ∑ 𝑏[𝑛]𝑑(𝑡 − (𝑛 − 1)𝑇) (20) 𝑛=1 where 𝑇 = 𝑁Δ𝑇 is the duration of 𝑢(𝑡) and 𝑑(𝑡). A new code, 𝑠(𝑡) = 𝑎(𝑡) + 𝑏(𝑡 − 2𝑁𝑔 𝑇), is constructed by concatenating 𝑎(𝑡) and 𝑏(𝑡) with a delay of 2𝑁𝑔 𝑇 between them, as shown in Figure 5. 𝑠(𝑡) is then carrier (𝑓𝑐 ) modulated before transmission, resulting in 𝑠𝑚 (𝑡), as shown in Figure 5. The transmitted signal can be represented by, 𝑠𝑚 (𝑡) = (𝑎(𝑡) + 𝑏(𝑡 − 2𝑁𝑔 𝑇)) 𝑒 𝑗2𝜋𝑓𝑐 𝑡 (21) Figure 6 shows the block diagram of the receiver. The received signal, 𝑥(𝑡) = 𝑠𝑚 (𝑡) + 𝑛(𝑡), is first carrier demodulated and then bandpass filtered (BPF), giving 𝑥 ′ (𝑡) as shown in Figure 6. Since both 𝑎(𝑡) and 𝑏(𝑡) occupy the same bandwidth, only one BPF is used. 𝑛~𝑁(0, 𝜎 2 ) represents additive white Gaussian noise. 𝑥 ′ (𝑡) = 𝑎(𝑡) + 𝑏(𝑡 − 2𝑁𝑔 𝑇) + +𝑛(𝑡)𝑒 −𝑗2𝜋𝑓𝑐𝑡 (22) In one path, 𝑥 ′ (𝑡) is passed into the matched filter (MF) of 𝑎(𝑡) implemented as a cascade of two MFs, one for the digital code (𝑎[𝑛]) and the other for the chip (𝑢(𝑡)), as shown in Figure 6. 𝑅𝑥 ′ ,𝑎 (𝑡) = 𝑅𝑎 (𝑡) + 𝑅𝑏,𝑎 (𝑡 − 2𝑁𝑔 𝑇) + 𝑛𝑎 (𝑡) (30) where 𝑅𝑎 (𝑡) represents the ACF of 𝑎(𝑡), 𝑅𝑏,𝑎 (𝑡) represents the cross-correlation of 𝑏(𝑡) with 𝑎(𝑡) and 𝑛𝑎 (𝑡) represents the filtered noise process, 𝑛𝑎 ~𝑁(0, 𝑁𝑔 𝜎 2 ). 𝑁𝑔 𝑁𝑔 𝑅𝑎 (𝑡) = ∑ ∑ 𝑎[𝑛]𝑎 ∗ [𝑁𝑔 − 𝑚] ∫ 𝑢(𝜏 − (𝑛 − 1)𝑇)𝑢∗ (𝑡 + 𝜏 + (𝑚 − 1)𝑇)𝑑𝜏 (31) 𝑡 𝑛=1 𝑚=1 𝑁𝑔 𝑡+𝑇 𝑁𝑔 𝑅𝑏,𝑎 (𝑡) = ∑ ∑ 𝑏[𝑛]𝑎∗ [𝑁𝑔 − 𝑚] ∫ 𝑡+𝑇 𝑑(𝜏 − (𝑛 − 1)𝑇)𝑢∗ (𝑡 + 𝜏 + (𝑚 − 1)𝑇)𝑑𝜏 (32) 𝑡 𝑛=1 𝑚=1 ′ In another path, 𝑥 (𝑡) is passed into the MF of 𝑏(𝑡) which is also implemented as a cascade of MF of 𝑏[𝑛] and that of 𝑑(𝑡). 𝑅𝑥 ′ ,𝑏 (𝑡) = 𝑅𝑎,𝑏 (𝑡) + 𝑅𝑏 (𝑡 − 2𝑁𝑔 𝑇) + 𝑛𝑏 (𝑡) (33) where 𝑅𝑎,𝑏 (𝑡) represents the cross-correlation of 𝑎(𝑡) with 𝑏(𝑡), which can be represented as shown in Equation (17), 𝑅𝑏 (𝑡) represents the ACF of 𝑏(𝑡) and 𝑛𝑎 (𝑡) represents the filtered noise process, 𝑛𝑏 ~𝑁(0, 𝑁𝑔 𝜎 2 ). u (t ) a (t ) a [n ] b (t ) NgT a (t ) NgT NgT s (t ) b (t ) b [n ] d (t ) z - 2NgT sm (t ) e j 2πfc t Delay block Figure 5. Block diagram showing the construction of the proposed code using Golay complementary code pair with DFCW chips. (a ) Rx',a(t-2NgT) 1 x (t ) e - j 2πfc t BPF 1 (c ) x' (t ) a* [Ng-n ] u* (T - t ) z - 2 N gT Digital code MF DFCW chip MF Delay block 0.1 1 1 R x ,a (t ) 1 0.1 0.1 0 (b ) R (t ) 1 0.1 b* [Ng-n ] d* (T - t ) Digital code MF DFCW chip MF R x ,b (t ) Figure 6. Receiver block diagram. Delaying 𝑅𝑥 ′ ,𝑎 (𝑡) by 2𝑁𝑔 𝑇 (as shown in Figure 6) and adding it to 𝑅𝑥 ′ ,𝑏 (𝑡) results in, 𝑅(𝑡) = 𝑅𝑎,𝑏 (𝑡) + 𝑅𝑎 (𝑡 − 2𝑁𝑔 𝑇) + 𝑅𝑏 (𝑡 − 2𝑁𝑔 𝑇) + 𝑅𝑏,𝑎 (𝑡 − 4𝑁𝑔 𝑇) + 𝑛𝑎 (𝑡 − 2𝑁𝑔 𝑇) + 𝑛𝑏 (𝑡) (34) Since, 2𝑁 𝑅 (𝑡), −𝑇 ≤ 𝑡 ≤ 𝑇 𝑅𝑎 (𝑡) + 𝑅𝑏 (𝑡) = { 𝑔 𝑢 0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 (35) where 𝑅𝑢 (𝑡) = 𝑅𝑑 (𝑡) represents the ACF of the DFCW chip. 𝑅(𝑡) = 𝑅𝑎,𝑏 (𝑡) + 2𝑁𝑔 𝑅𝑢 (𝑡 − 2𝑁𝑔 𝑇) + 𝑅𝑏,𝑎 (𝑡 − 4𝑁𝑔 𝑇) + 𝑛𝑎 (𝑡 − 2𝑁𝑔 𝑇) + 𝑛𝑏 (𝑡) (36) Thus, the final output, 𝑅(𝑡), (excluding the noise terms) consists of, 𝑅𝑎,𝑏 (𝑡), 0 ≤ 𝑡 < 2𝑁𝑔 𝑇 0, 2𝑁𝑔 𝑇 ≤ 𝑡 < 3𝑁𝑔 𝑇 − 𝑇 𝑅(𝑡) = 2𝑁𝑔 𝑅𝑢 (𝑡), 3𝑁𝑔 𝑇 − 𝑇 ≤ 𝑡 < 3𝑁𝑔 𝑇 + 𝑇 0, 3𝑁𝑔 𝑇 + 𝑇 ≤ 𝑡 < 4𝑁𝑔 𝑇 𝑅 { 𝑏,𝑎 (𝑡), 4𝑁𝑔 𝑇 ≤ 𝑡 < 6𝑁𝑔 𝑇 (37) In Equation (37), 2𝑁𝑔 𝑅𝑢 (𝑡) is the mainlobe of 𝑅(𝑡) (𝑅𝑢 (𝑡) is the ACF of the DFCW chip, as shown in the plots in Figure 4). 2𝑁𝑔 𝑇 ≤ 𝑡 ≤ 3𝑁𝑔 𝑇 − 𝑇 and 3𝑁𝑔 𝑇 + 𝑇 ≤ 𝑡 ≤ 4𝑁𝑔 𝑇 are the zero-sidelobe regions on either side of the mainlobe. 𝑅𝑎,𝑏 (𝑡) and 𝑅𝑏,𝑎 (𝑡) (defined in Equation (32)), respectively, represent the small cross-correlation sidelobes. Let 𝐶𝐶𝑃 represent the peak cross-correlation sidelobe. Since, 𝑅𝑎,𝑏 (𝑡) and 𝑅𝑏,𝑎 (𝑡) are mirror images of each other, 𝐶𝐶𝑃 = max | 𝑡 𝑅𝑎,𝑏 (𝑡) | 2𝑁𝑔 (38) The table in Figure 7 shows the plots of |𝑅𝑥 ′ ,𝑎 (𝑡 − 2𝑁𝑔 𝑇)|, |𝑅𝑥 ′ ,𝑏 (𝑡)| and |𝑅(𝑡)|, all normalized by 2𝑁𝑔 and in the absence of noise, for 𝑁𝑔 = 8 and 𝑁 = 16 for the three DFCW chips in Column 1. 3D-plots of the corresponding cross-correlation peaks (𝐶𝐶𝑃) for a range of 𝑁𝑔 and 𝑁 are shown in Column 2. Clearly, the ACF plots show the zero-sidelobe region around the mainlobe and the adjacent region of small cross-correlation sidelobes. From the 3D-plots of 𝐶𝐶𝑃 it can be observed that 𝐶𝐶𝑃 values are very small, and decrease in magnitude as the code length 𝑁𝑔 and the number of discrete frequencies 𝑁 in the DF-LFM/DF-PLFM chips increase. In addition, the 𝐶𝐶𝑃 values are slightly larger for the codes constructed using the DFCW chips based on PLFM waveforms compared to the 𝐶𝐶𝑃 values for the codes constructed using DFCW chips based on LFM waveform, but still very small (≈ −30 dB). If −𝑎(𝑡) and 𝑏(𝑡) are concatenated and transmitted at a second frequency band and received using a receiver similar to the one described in Figure 6, then the final output of this code can be represented by, −𝑅𝑎,𝑏 (𝑡), 0 ≤ 𝑡 < 2𝑁𝑔 𝑇 0, 2𝑁𝑔 𝑇 ≤ 𝑡 < 3𝑁𝑔 𝑇 − 𝑇 𝑅′(𝑡) = 2𝑁𝑔 𝑅𝑢 (𝑡), 3𝑁𝑔 𝑇 − 𝑇 ≤ 𝑡 < 3𝑁𝑔 𝑇 + 𝑇 0, 3𝑁𝑔 𝑇 + 𝑇 ≤ 𝑡 < 4𝑁𝑔 𝑇 −𝑅𝑏,𝑎 (𝑡), 4𝑁𝑔 𝑇 ≤ 𝑡 < 6𝑁𝑔 𝑇 { Column 1 (39) Column 2 DF-LFM Chips 0 |Rx',a(t-2NgT)| -20 -35 0 2NgT 0 3NgT (a) Time [s] 4NgT |Rx',b(t)| -20 -70 2NgT 0 3NgT (b) Time [s] -40 -10 CCPa,b [dB] -70 4NgT -20 -45 -30 -40 -50 -50 |R(t)| -60 16 -20 64 32 -70 2NgT 3NgT (c) Time [s] 8 128 N 4NgT -55 32 64 16 N g DF-PLFM chips comprised of two up-chirp segments 0 |Rx',a(t-2NgT)| -20 -28 -30 -32 2NgT 0 3NgT (a) Time [s] 4NgT |Rx',b(t)| -20 -70 2NgT 0 3NgT (b) Time [s] 4NgT CCPa,b [dB] -70 -34 -10 -36 -20 -38 -30 -40 -40 -42 -50 |R(t)| -20 0 -60 16 64 -46 32 32 64 -70 2NgT 3NgT (c) Time [s] -44 N 4NgT 128 8 -48 Ng 16 DF-PLFM chips comprised of an up-chirp and a down-chirp 0 -28 |Rx',a(t-2NgT)| -20 -30 -32 0 2NgT 0 3NgT (a) Time [s] -10 |Rx',b(t)| -20 -70 2NgT 0 3NgT (b) Time [s] -34 4NgT 4NgT CCPa,b [dB] -70 -36 -20 -38 -30 -40 -40 -42 -50 |R(t)| -20 -60 16 64 -46 32 32 64 -70 2NgT 3NgT (c) Time [s] 4NgT -44 N 128 8 16 Ng -48 Figure 7. Column 1. (a), (b) and (c) Plots in dB of the normalized matched filter (MF) outputs. Column 2. Plots of the corresponding cross-correlation sidelobe peaks (𝐶𝐶𝑃) vs. code length (𝑁𝑔 ) vs. number of discrete frequencies in the DF-LFM/DF-PLFM chips (𝑁). Clearly, adding Equations (37) and (39) results in complete cancellation of the cross-correlation sidelobes. Thus, achieving complete zero-sidelobes on either side of the mainlobe. This is shown in the plots of 𝑅(𝑡), 𝑅′(𝑡) and 𝑅(𝑡) + 𝑅′(𝑡) for 𝑁𝑔 = 8 and 𝑁 = 16 in Figure 8. Frequency selective fading between the two bands could result in inexact cancellation of the cross-correlation sidelobes that are adjacent to the zero-sidelobe region. However, since the cross-correlation sidelobes are very small, any inexact cancellation due to fading will not create undesirable high magnitude sidelobes. 0 |R(t)| -20 -70 2NgT 0 3NgT (a) Time [s] 4NgT |R'(t)| -20 -70 2NgT 0 3NgT (b) Time [s] 4NgT -20 -70 |R(t)+R'(t)| 2NgT Figure 8. Plots in dB of: (a) 3NgT (c) Time [s] |𝑅(𝑡)| 𝑁𝑔 ; (b) 4NgT |𝑅′(𝑡) | |𝑅(𝑡)+𝑅′(𝑡)| 𝑁𝑔 2𝑁𝑔 ; and (c) . 𝑡 The complementary code pair could also be interlaced in the time domain (i.e., 𝑎 ( ) + 𝑇 𝑡 𝑏 ( − 𝑇)). This scheme results in a transmission without gaps, while still using the same frequency 𝑇 band as in the previous scheme. Fishler et al. [18] and Deng [19] describe this scheme using continuous LFM and PLFM chips. However, for this interlaced code, the zero-sidelobes and the small cross-correlation sidelobes in the final output are interlaced as well. 4. Doppler Properties Figure 9a,b shows the 3D ambiguity function (AF) of the proposed code constructed using DF-LFM chips for 𝑁𝑔 = 8 and 𝑁 = 16 as a function of the normalized Doppler frequency 𝑓𝑑 𝑇. The AF can be represented by, ∞ 𝑅(𝑡, 𝑓) = ∫ 𝑠𝑓 (𝜏)𝑠 ∗ (𝑡 − 𝜏)𝑑𝜏 −∞ (40) where 𝑠𝑓 (𝑡) = 𝑠(𝑡)𝑒 𝑗2𝜋𝑓𝑑 𝑡 , for 0 ≤ 𝑡 ≤ 3𝑁𝑔 𝑇, is the transmitted code Doppler shifted by 𝑓𝑑 , 𝑇 is the duration of the DF-LFM/DF-PLFM chips and 𝑠(𝑡) is the proposed code. Figure 9. Plots of 3D-ambiguity function in (a) linear scale and (b) in dB scale of the proposed codes constructed using DF-LFM chips. It can be observed that Doppler shift adversely affects the cancellation of the sidelobes of the complementary code pair, resulting in the disappearance of the zero-sidelobe domain on either side of the mainlobe. The ACF mainlobes of the symmetrical chips shift in opposite directions under Doppler shift. As a result, ACF of the complementary code pair do not align with each other. Thus, the proposed codes do not have good Doppler properties. One way to improve the Doppler properties could be to use triangular FM based waveforms as chips for the complementary code pair in the proposed code structure. Another method to improve the Doppler properties could be to use the approach discussed in [27] to construct Doppler resilient Golay complementary code pairs. 5. Effect of Frequency Selective Fading In the presence of frequency selective fading, the higher frequencies within the frequency sweep (𝑊 = 𝑁(𝑁 − 1)Δ𝑊Δ𝑇) of the DF-LFM/DF-PLFM waveforms could be slightly attenuated compared to the lower frequencies. However, autocorrelations of the DF-LFM/DF-PLFM waveforms remain identical, since they are symmetrical. Hence, the zero-sidelobe region is not affected. However, the adjacent region of small cross-correlation sidelobes could vary slightly depending on the attenuation due to fading. However, its effect on the error in the location of the mainlobe is negligible as will be shown in the simulation results later in this section. In the presence of frequency selective fading, let the lower and the higher frequency components of the DF-LFM/DF-PLFM chips be attenuated by 𝛼1 and 𝛼2 respectively, where 𝛼2 < 𝛼1 . The DF-LFM chips (𝑢𝑓 (𝑡) and 𝑑𝑓 (𝑡)) in the presence of fading can be represented by, 𝛼1 √Δ𝑇 𝑢𝑓 (𝑡) = 𝛼2 𝑁1 −1 ∑ 𝑒 𝑗2𝜋𝑓[𝑛]Δ𝑊𝑡𝑛 𝑛=0 𝑁−1 (41) ∑ 𝑒 {√Δ𝑇 𝑛=𝑁1 𝑁−1−𝑁1 𝛼2 𝑑𝑓 (𝑡) = 𝑗2𝜋𝑓[𝑛]Δ𝑊𝑡𝑛 ∑ 𝑒 𝑗2𝜋𝑓[𝑁−1−𝑁1−𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑁−1 𝛼1 (42) 𝑗2𝜋𝑓[𝑁−1−𝑛]Δ𝑊𝑡𝑛 ∑ 𝑒 { √Δ𝑇 𝑛=𝑁−𝑁1 The DF-PLFM chips comprised of two up-chirp segments in the presence of fading can be represented by, 𝛼1 𝑁 −1 2 ∑ 𝑒 𝑗2𝜋𝑓1 [𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑢𝑓 (𝑡) = 𝑁−1 𝛼2 { √Δ𝑇 (43) ∑ 𝑒 𝑗2𝜋𝑓2[𝑁−1−𝑛]Δ𝑊𝑡𝑛 𝑁 𝑛= 2 𝑁 −1 2 𝛼2 ∑ 𝑒 𝑗2𝜋𝑓2 [𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑑𝑓 (𝑡) = 𝑁−1 𝛼1 √Δ𝑇 ∑𝑒 (44) 𝑗2𝜋𝑓1 [𝑁−1−𝑛]Δ𝑊𝑡𝑛 𝑁 𝑛= { 2 The DF-PLFM chips comprised of an up-chirp and a down-chirp segment in the presence of fading can be represented by, 𝛼1 𝑁 −1 2 ∑ 𝑒 𝑗2𝜋𝑓1 [𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑢𝑓 (𝑡) = 𝛼2 { √Δ𝑇 (45) 𝑁−1 ∑𝑒 𝑁 𝑛= 2 𝑗2𝜋𝑓2 [𝑛]Δ𝑊𝑡𝑛 𝑁 −1 2 𝛼2 𝑑𝑓 (𝑡) = 𝑁 ∑ 𝑒 𝑗2𝜋𝑓2[ 2 −1−𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 (46) 𝑁−1 𝛼1 √Δ𝑇 ∑𝑒 𝑗2𝜋𝑓1 [𝑁−1−𝑛]Δ𝑊𝑡𝑛 𝑁 𝑛= { 2 For the DF-LFM waveforms, all the discrete frequencies 0 ≤ 𝑛 ≤ 𝑁1 − 1, are considered as the lower frequency component which are attenuated by 𝛼1 , while the discrete frequencies 𝑁1 ≤ 𝑛 ≤ 𝑁 − 1 will be considered as the higher frequency component which are attenuated by 𝛼2 . For the 𝑁 DF-PLFM waveforms, all the discrete frequencies 0 ≤ 𝑛 ≤ − 1 are considered as the lower frequency component and 𝑁 2 2 ≤ 𝑛 ≤ 𝑁 − 1, the higher frequency component. Figure 10 shows the autocorrelations of the DF-LFM chips with and without fading, i.e., 𝑢𝑓 (𝑡) and 𝑑𝑓 (𝑡) and 𝑢(𝑡) and 𝑑(𝑡) for 𝑁 = 16 , 𝑁1 = 12 , 𝑁𝑔 = 16 , 𝛼1 = 0.9792 and 𝛼2 = 0.8470 ( 𝛼1 and 𝛼2 are randomly generated). Although, fading results in reducing the mainlobe peaks of the autocorrelations, |𝑅𝑢𝑓 (𝑡)| and |𝑅𝑑𝑓 (𝑡)| (as seen in the plots), they remain identical. 0 0 -20 |Ru(t)| -60 -20 |Ru (t)| f -60 -0.5T 0 0 0.5T (a) Time [s] -20 -0.5T 0 |Rd(t)| -60 0 0.5T (c) Time [s] -20 |Rd (t)| f -60 -0.5T 0 0.5T (b) Time [s] -0.5T 0 0.5T (d) Time [s] Figure 10. (a,b) Plots in dB of |𝑅𝑢 (𝑡)| and |𝑅𝑑 (𝑡)|; and (c,d) plots of |𝑅𝑢𝑓 (𝑡)| and |𝑅𝑑𝑓 (𝑡)|. Figure 11 shows the matched filter outputs, 𝑅𝑥 ′ ,𝑎 (𝑡) and 𝑅𝑥 ′ ,𝑏 (𝑡), and their sum 𝑅(𝑡) (given by Equations (30), (33) and (37), respectively), in the presence of frequency selective fading. Clearly, the zero-sidelobe region on either side of the mainlobe is not affected by fading. 0 |Rx',a(t-2NgT)| -20 -70 2NgT 3NgT (a) Time [s] 0 4NgT |Rx',b(t)| -20 -70 2NgT 3NgT (b) Time [s] 0 4NgT |R(t)| -20 -70 Figure 11. Plots in dB of: (a) 2NgT 3NgT (c) Time [s] 4NgT 𝑅𝑥′ ,𝑎 (𝑡−2𝑁𝑔 𝑇) 𝑅𝑥′ ,𝑏 (𝑡) |𝑅(𝑡)| 𝑁𝑔 𝑁𝑔 2𝑁𝑔 ; (b) ; and (c) , in the presence of frequency selective fading. Root mean square error (𝑅𝑀𝑆𝐸) in the location of the mainlobe is used as a metric to measure of effectiveness in sidelobe cancellation in the presence of frequency selective fading and noise. Location of the mainlobe of 𝑅(𝑡) is given by, 𝑅(𝑡) 𝑡̂ = argmax | | (47) 2𝑁𝑔 𝑡 where 𝑅(𝑡) is the final output, given by Equation (37). 𝑅𝑀𝑆𝐸 in the location of the mainlobe can be represented by, 𝐾 1 1 𝑅𝑀𝑆𝐸 = ( ∑(𝑡̂𝑖 − 𝑡)2 ) 𝑇 𝐾 0.5 (48) 𝑖=1 where 𝐾 is the number of trials, 𝑡 is the actual timing of the mainlobe, 𝑡𝑖̂ is the estimated timing of the mainlobe for the ith trial in the presence of noise and 𝑇 is the chip duration. 𝑅𝑀𝑆𝐸 vs. signal-to-noise ratio (SNR) plots for the proposed codes are shown in Figure 12. DF-LFM chips under frequency selective fading 10 10 RMSE 10 10 10 10 10 1 Ng=16, N=32, Without fading Ng=16, N=32, With fading 0 -1 -2 -3 -4 -5 -4 -2 0 2 4 SNR [dB] 6 8 10 12 DF-PLFM chips comprised of two up-chirp segments under frequency selective fading 10 10 RMSE 10 10 10 10 10 10 1 0 Ng=16, N=32, Without fading -1 Ng=16, N=32, With fading -2 -3 -4 -5 -6 -4 -2 0 2 4 SNR [dB] 6 8 10 12 DF-PLFM chips comprised of an up-chirp and a down-chirp segment under frequency selective fading 10 10 RMSE 10 10 10 10 10 10 1 Ng=16, N=32, Without fading 0 Ng=16, N=32, With fading -1 -2 -3 -4 -5 -6 -4 -2 0 2 4 SNR [dB] 6 8 10 12 Figure 12. Plots of root mean square error (𝑅𝑀𝑆𝐸) vs. SNR for the proposed codes. SNR is given by 20 log10 2𝑁𝑔 𝜎2 , where 2𝑁𝑔 is the code energy and 𝜎 2 represents the noise power. SNR is varied by changing 𝜎 2 and 𝐾 = 1000 iterations are performed for each SNR value. 𝛼1 and 𝛼2 are randomly chosen such that 0.6 ≤ 𝛼1 , 𝛼2 ≤ 1. From these plots it can be observed that the RMSE curve with fading stays very close to the 𝑅𝑀𝑆𝐸 in the absence of fading. This is true for the DF-LFM and the DF-PLFM chips. As discussed in the Introduction, complete sidelobe cancellation can be achieved using a complementary code pair. However, it requires transmission and reception of the complementary code pair at two frequencies/channels as shown in Figure 1. In the presence of frequency selective fading, the cancellation of sidelobes is inexact which results in increasing the probability of false alarm. This can be seen in the plots of 𝑅𝑀𝑆𝐸 vs. SNR in Figure 13 for a Golay complementary code pair (𝐴, 𝐵) of length 𝑁𝑔 = 16 and 64. 𝐴 is attenuated by 𝛼1 and 𝐵 is attenuated by 𝛼2 such that 0.6 ≤ 𝛼1 , 𝛼2 ≤ 1. It can be observed that frequency selective fading results in increasing the RMSE in the location of the mainlobe. The proposed codes are resistant to the effect of frequency selective fading, as shown in the 𝑅𝑀𝑆𝐸 plots in Figure 12. 10 1 Without fading, Ng=16 10 0 With fading, Ng=16 Without fading, Ng=64 RMSE 10 10 10 10 10 -1 With fading, Ng=64 -2 -3 -4 -5 -4 -2 0 2 4 6 8 SNR [dB] 10 12 14 16 Figure 13. Plot of root mean square error (𝑅𝑀𝑆𝐸) vs. signal-to-noise ratio (SNR) for complementary code pair using sinusoidal chip. 6. Good Code Sets from Complementary Pair Using DF-LFM and DF-PLFM Waveforms as Chips A good code set is constructed by changing the slopes of the instantaneous frequency (shown in the plots in Figure 3) of the DF-LFM/DF-PLFM waveforms used as chips for the same complementary code pair. The parameter 𝛾𝑙 , as shown in the Equations (20)-(25), is varied carefully to result in DF-LFM and DF-PLFM chips with different slopes. The resulting good code set has a zero domain on either side of the mainlobe and an adjacent region of small sidelobes. The cross-correlation between any code pair in the set is very small. The lth code in the set can be represented by, 𝑠𝑙 (𝑡) = 𝑎𝑙 (𝑡) + 𝑏𝑙 (𝑡 − 2𝑁𝑔 𝑇) 𝑁𝑔 ∑𝑛=1 𝑎[𝑛]𝑢𝑙 (𝑡 (49) 𝑁𝑔 ∑𝑛=1 𝑏[𝑛]𝑑𝑙 (𝑡 where 𝑎𝑙 (𝑡) = − (𝑛 − 1)𝑇) , 𝑏𝑙 (𝑡) = − (𝑛 − 1)𝑇) , and 𝑢𝑙 (𝑡) and 𝑑𝑙 (𝑡) represent the two symmetrical DF-LFM/DF-PLFM waveforms. 𝑢𝑙 (𝑡) and 𝑑𝑙 (𝑡) for the good code sets from complementary pairs using DF-LFM chips can be represented by, 𝑢𝑙 (𝑡) = 𝑑𝑙 (𝑡) = 1 𝑁−1 ∑ 𝑒 𝑗2𝜋𝑓𝑙[𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 1 (50) 𝑁−1 ∑ 𝑒 𝑗2𝜋𝑓𝑙 [𝑁𝑙 −1−𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 (51) where 𝑓𝑙 [𝑛] = 𝑟𝑜𝑢𝑛𝑑 ( 𝑘 ∈ (0, 0.5], Δ𝑊 = 1 Δ𝑇 2𝛾𝑙 (𝑁−1)𝑛 𝑁 ) for 𝑛 = 0, 1, 2, … , 𝑁 − 1 , 𝛾𝑙 = 𝑘 + (𝑙−1)(1−3𝑘) 𝐿−1 , 𝑙 = 0, 1, 2, … , 𝐿 − 1 , and 𝑛Δ𝑇 ≤ 𝑡𝑛 ≤ (𝑛 + 1)Δ𝑇. 𝑢𝑙 (𝑡) and 𝑑𝑙 (𝑡) for the good code sets from complementary pairs using DF-PLFM chips comprised of two up-chirps can be represented by, 𝑁 −1 2 1 ∑ 𝑒 𝑗2𝜋𝑓𝑙,1[𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑢𝑙 (𝑡) = { √Δ𝑇 ∑𝑒 𝑛= 1 1)(1 − (1−𝛾𝑙 )2𝑛 𝑁−1 𝑁 𝑁 𝑁 𝑁 2 𝑁 −1 2 (53) 𝑁−1 1 { 2𝛾𝑙 (𝑁−1)𝑛 𝑗2𝜋𝑓𝑙,2 [𝑁−1−𝑛]Δ𝑊𝑡𝑛 ∑ 𝑒 𝑗2𝜋𝑓𝑙,2[𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑑𝑙 (𝑡) = where 𝑓𝑙,1 [𝑛] = 𝑟𝑜𝑢𝑛𝑑 ( (52) 𝑁−1 1 √Δ𝑇 ∑𝑒 𝑗2𝜋𝑓𝑙,1 [𝑁−1−𝑛]Δ𝑊𝑡𝑛 𝑁 𝑛= 2 𝑁 (𝑙−1)(1−2𝑘) 2 𝐿−1 ) for 𝑛 = 0, 1, 2, … , − 1, 𝛾𝑙 = 𝑘 + , 𝑓𝑙,2 [𝑛] = 𝑟𝑜𝑢𝑛𝑑 ((𝑁 − )) for 𝑛 = , + 1, … , 𝑁 − 1 and 𝑘 ∈ (0, 0.5]. 2 2 𝑢𝑙 (𝑡) and 𝑑𝑙 (𝑡) for the good code sets from complementary pairs using DF-PLFM chips comprised of an up-chirp and a down-chirp are given by, 𝑁 −1 2 1 ∑ 𝑒 𝑗2𝜋𝑓𝑙,1[𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 𝑢𝑙 (𝑡) = { √Δ𝑇 1 𝑑𝑙 (𝑡) = 𝑁−1 1 ∑𝑒 𝑛= 𝑁 2 𝑁 −1 2 ∑ 𝑒 𝑗2𝜋𝑓𝑙,2[𝑁𝑙−1−𝑛]Δ𝑊𝑡𝑛 √Δ𝑇 𝑛=0 1 √Δ𝑇 (54) 𝑗2𝜋𝑓𝑙,2 [𝑛]Δ𝑊𝑡𝑛 𝑁−1 ∑𝑒 (55) 𝑗2𝜋𝑓𝑙,1 [𝑁−1−𝑛]Δ𝑊𝑡𝑛 𝑁 𝑛= { 2 The receiver for each code is as shown in Figure 6. The ACFs of all the codes in the set are as shown in the plots in Figure 7. Thus, the autocorrelation sidelobe peak (𝐴𝑆𝑃𝑙 ) of the 𝑙𝑡ℎ code in the set is given by, 𝐴𝑆𝑃𝑙 = 𝐶𝐶𝑃𝑎𝑙,𝑏𝑙 (56) where 𝐶𝐶𝑃𝑎𝑙 ,𝑏𝑙 is the same as 𝐶𝐶𝑃𝑎,𝑏 which is defined in Equation (38) and shown in the plots in Figure 7. Maximum cross-correlation peak (𝑀𝐶𝐶𝑃) and average cross-correlation peak (𝐴𝐶𝐶𝑃) are used as measures to compare the different good code sets introduced in this paper. 𝑀𝐶𝐶𝑃 = 𝐴𝐶𝐶𝑃 = max {max|𝑅𝑠𝑙,𝑠𝑘 (𝑡)|} 𝑙,𝑘=1,2,..,𝐿 𝑡 ∑𝐿𝑙=1 ∑𝐿𝑘=𝑙 max|𝑅𝑠𝑙 ,𝑠𝑘 (𝑡)| 𝑡 (𝐿2) (57) (58) where 𝑅𝑠𝑙,𝑠𝑘 (𝑡) is the normalized cross-correlation between the code pair {𝑙, 𝑘} in the set. The table (Column 2) in Figure 14 shows the plots of 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 for each set for different values of 𝑁, 𝑁𝑔 and 𝐿. (Column 1) Plots of 𝑓𝑢𝑙 (𝑡), 𝑓𝑑𝑙 (𝑡) vs. time (Column 2) Plots of 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 vs. 𝐿 for (𝑓𝑢𝑙 (𝑡) are shown in solid lines and𝑓𝑑𝑙 (𝑡) in different values of 𝑁𝑔 and 𝑁 lines with dashes) Good code sets from complementary pairs using DF-LFM waveforms as chips 0 0 N=64, Ng=8 -10 -20 -30 -40 4 5 0 0 NT MCCP [dB] 0 -10 7 5 6 (c) L 0 -20 -30 6 (b) L -30 -40 4 N=64, Ng=16 5 N=128, Ng=8 -20 8 N=128, Ng=16 -40 4 𝑘 = 0.24 and 𝑁 = 32 6 (a) L N=64, Ng=8 -10 ACCP [dB] N=128, Ng=8 ACCP [dB] MCCP [dB] Instantaneous frequency [Hz] (N-1)W 7 8 N=64, Ng=16 -10 N=128, Ng=16 -20 -30 -40 4 8 7 5 6 (d) L 7 8 Good code sets from complementary pairs using DF-PLFM waveforms comprised of two up-chirps as chips -20 -30 -40 4 0 (N/2)T NT MCCP [dB] 0 0 -10 5 6 (a) L 7 -30 5 6 (c) L 7 8 N=64, Ng=16 N=128, Ng=16 -30 6 (b) L N=128, Ng=8 -20 0 N=64, Ng=16 5 N=64, Ng=8 -10 -40 4 8 -20 -40 4 𝑘 = 0.24 and 𝑁 = 32. N=128, Ng=8 ACCP [dB] MCCP [dB] Instantaneous frequency [Hz] -10 0 N=64, Ng=8 ACCP [dB] 0 (N-1)W 7 -10 -30 -40 4 8 N=128, Ng=16 -20 5 6 (d) L 7 8 Good code sets from complementary pairs using DF-PLFM waveforms comprised of an up-chirp and a down-chirp as chips 0 -10 -10 -20 N=64, Ng=8 -30 -40 4 N=128, Ng=8 5 0 (N/2)T 𝑘 = 0.24 and 𝑁 = 32 NT MCCP [dB] 0 0 ACCP [dB] 0 6 (a) L 7 -20 -40 4 N=64, Ng=16 N=128, Ng=16 5 6 (b) L N=128, Ng=8 -30 5 0 -10 -30 N=64, Ng=8 -20 -40 4 8 ACCP [dB] MCCP [dB] Instantaneous frequency [Hz] (N-1)W 7 8 6 (c) L 7 8 N=64, Ng=16 -10 N=128, Ng=16 -20 -30 -40 4 5 6 (d) L 7 8 Figure 14. Plots of instantaneous frequencies, i.e., 𝑓𝑢𝑙 (𝑡) and 𝑓𝑑𝑙 (𝑡) vs. time in column 1; and (a), (b) plots of maximum cross-correlation peaks (𝑀𝐶𝐶𝑃) and (c), (d) average cross-correlation peaks (𝐴𝐶𝐶𝑃) vs. number of codes (𝐿), for various values of code length (𝑁𝑔 ) and number of discrete frequencies (𝑁) in column 2. From the plots in Figure 14 it can be observed that the good code sets constructed using DF-LFM chips have better 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 properties compared to those constructed using DF-PLFM chips. However, the time bandwidth products of all the codes in the sets constructed using DF-PLFM chips is the same (i.e., 𝑁(𝑁 − 1)Δ𝑊Δ𝑇 ), while those of the codes in the set constructed using DF-LFM chips are different. In addition, for a given complementary code pair code length (𝑁𝑔 ), the cross-correlation sidelobe peaks could be reduced by increasing the number of discrete frequencies (𝑁) in the chips. 7. Construction of a Good Code Set from the Mates of a Complementary Code Pair Consider the complementary code pair: 𝐵(𝑧 −1 ) and −𝐴(𝑧 −1 ). The sum of the cross-correlation of 𝐴(𝑧) with 𝐵(𝑧 −1 ) and that of 𝐵(𝑧) with −𝐴(𝑧 −1 ) will be, 𝐴(𝑧)𝐵(𝑧) − 𝐵(𝑧)𝐴(𝑧) = 0 (59) Thus, the code pair: 𝐵(𝑧 −1 ) and −𝐴(𝑧 −1 ), are orthogonal to the complementary code pair: 𝐴(𝑧) and 𝐵(𝑧). Such code pairs are called complementary code pair mates, as described in [23,24]. Let 𝑆1 (𝑧) = 𝐴(𝑧 𝑁𝑐 )𝐶(𝑧) + 𝑧 −𝐷 𝐵(𝑧 𝑁𝑐 )𝛾𝐶(𝑧 −1 ) and 𝑆2 (𝑧) = 𝐵(𝑧 −𝑁𝑐 )𝐶(𝑧) − 𝑧 −𝐷 𝐴(𝑧 −𝑁𝑐 )𝛾𝐶(𝑧 −1 ) be the codes constructed by concatenating the complementary code pair mates (𝐴(𝑧), 𝐵(𝑧) and 𝐵(𝑧 −1 ), −𝐴(𝑧 −1 )) using 𝐶(𝑧) and its symmetrical/anti-symmetrical mirror image (𝛾𝐶(𝑧 −1 ), where 𝛾 = ±1) as chips, as described in Section 2. Their autocorrelations can be represented by, 𝑅𝑆1 (𝑧) = 𝛾𝑅𝐴,𝐵 (𝑧 𝑁𝑐 )𝐶 2 (𝑧) + 2𝑁𝑔 𝑧 −𝐷 𝑅𝑐 (𝑧) + 𝛾𝑧 −2𝐷 𝑅𝐵,𝐴 (𝑧 𝑁𝑐 )𝐶 2 (𝑧 −1 ) 𝑅𝑆2 (𝑧) = 𝛾𝑅𝐴,𝐵 (𝑧 −𝑁𝑐 )𝐶 2 (𝑧) + 2𝑁𝑔 𝑧 −𝐷 𝑅𝑐 (𝑧) − 𝛾𝑧 −2𝐷 𝑅𝐵,𝐴 (𝑧 −𝑁𝑐 )𝐶 2 (𝑧 −1 (60) ) (61) Both the autocorrelations consist of a zero-sidelobe region on either side of the mainlobe and an adjacent region of small cross-correlation sidelobes, as shown in Equation (37) in Section 2. Their autocorrelation sidelobe peaks (i.e., 𝐶𝐶𝑃, given by (38)) vary with 𝑁 and 𝑁𝑔 as shown in the plots in Figure 7. The cross-correlation between 𝑆1 (𝑧) and 𝑆2 (𝑧) can be represented by, 𝑅𝑆1 ,𝑆2 (𝑧) = (𝐴(𝑧 𝑁𝑐 )𝐶(𝑧) + 𝑧 −𝐷 𝐵(𝑧 𝑁𝑐 )𝛾𝐶(𝑧 −1 ))(𝐵(𝑧 𝑁𝑐 )𝐶(𝑧 −1 ) − 𝑧 𝐷 𝐴(𝑧 𝑁𝑐 )𝛾𝐶(𝑧1 )) (62) Simplifying Equation (62) results in, 𝑅𝑆1,𝑆2 (𝑧) = −𝐴2 (𝑧 𝑁𝑐 )𝐶 2 (𝑧) + 0 + 𝛾𝑧 −2𝐷 𝐵2 (𝑧 𝑁𝑐 )𝐶 2 (𝑧 −1 ) (63) Clearly, the cross-correlation consists of a zero-sidelobe region and an adjacent region of small cross-correlation sidelobes. Thus, 𝑆1 (𝑧) and 𝑆2 (𝑧) are quazi-orthogonal in the convolution sense. The zero-sidelobe domain in the cross-correlation is due to the symmetry/anti-symmetry property of the chips. Since, the symmetry/anti-symmetry property is immune to frequency selective fading, the zero-sidelobe domain in the cross-correlation is also immune to frequency selective fading. Figure 15 show the autocorrelations 𝑆1 (𝑧) and 𝑆2 (𝑧) and their cross-correlation. For these plots, 𝑆1 (𝑧) and 𝑆2 (𝑧) are constructed using DF-LFM chips with 𝑁 = 8 and 𝑁𝑔 = 16. These plots clearly show the zero-sidelobe domain in the cross-correlation between the proposed code constructed using a complementary code pair and the one constructed using its mate. Varying the slopes of the DFCW chips in both 𝑆1 (𝑧) and 𝑆2 (𝑧), as shown in Section 6, results in two good code sets. Since these two sets are quasi-orthogonal to each other, they could be combined to form a larger set with twice the number of codes, while maintaining the same cross-correlation properties as those of the individual sets. This can be seen in the plots of maximum cross-correlation peaks (𝑀𝐶𝐶𝑃) and average cross-correlation peaks (𝐴𝐶𝐶𝑃) in Column 1 of the table in Figures 16 and 17. When compared to the plots in Figure 14, clearly the cross-correlation properties remain the same, while doubling the number of the codes in the set. 0 |RS1(z)| -20 -70 2NgT 0 3NgT (a) Time [s] 4NgT |RS2(z)| -20 -70 2NgT 0 3NgT (b) Time [s] 4NgT |RS1,S2(z)| -20 -70 2NgT 3NgT (c) Time [s] 4NgT Figure 15. Plots in dB of: (a) 𝑅𝑆1 (𝑧); (b) 𝑅𝑆2 (𝑧); and (c) 𝑅𝑆1,𝑆2 (𝑧), for 𝑁 = 8 and 𝑁𝑔 = 16 using DF-LFM chips. (Column 1) Plots of 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 vs. 𝐿 (Column 2) Plots of 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 vs. 𝐿 for the good code set with twice the number of for the good codes set with better codes cross-correlation properties Good code sets from complementary pairs and their mates using DF-LFM waveforms as chips 0 -30 -40 8 -40 8 12 (a) L 14 16 0 10 14 16 -20 -30 -30 -40 8 -40 8 12 (b) L 14 16 5 6 (a) L 7 -50 4 8 N=64, Ng=16 12 (d) L 14 16 5 6 (c) L 7 8 N=64, Ng=16 -10 N=128, Ng=16 -30 -40 10 -30 0 -20 -50 4 N=128, Ng=8 -20 -40 -10 N=128, Ng=16 MCCP -20 10 N=64, Ng=16 -10 ACCP MCCP 12 (c) L -50 4 0 N=64, Ng=16 N=128, Ng=16 -30 -40 0 -10 N=128, Ng=8 -20 N=64, Ng=8 -10 ACCP N=128, Ng=8 -20 -30 N=64, Ng=8 -10 ACCP ACCP MCCP -20 10 N=64, Ng=8 -10 N=128, Ng=8 0 0 N=64, Ng=8 MCCP 0 -10 N=128, Ng=16 -20 -30 -40 5 6 (b) L 7 -50 4 8 5 6 (d) L 7 8 Good code sets from complementary pairs and their mates using DF-PLFM waveforms comprised of two up-chirps as chips -40 8 -40 8 14 16 10 12 (c) L 14 16 N=128, Ng=16 N=64, Ng=16 -10 -20 -20 -40 -40 8 -40 8 -50 4 12 (b) L 14 16 10 12 (d) L 14 16 ACCP 6 (a) L 7 -50 4 8 N=64, Ng=16 5 6 (c) L 7 8 N=64, Ng=16 -10 N=128, Ng=16 -30 -30 -30 0 -20 -30 10 5 -10 N=128, Ng=16 N=128, Ng=8 -20 -40 0 0 N=64, Ng=16 -30 -40 MCCP MCCP -10 12 (a) L N=128, Ng=8 -20 -50 4 N=64, Ng=8 -10 ACCP -30 10 N=128, Ng=8 -20 -30 0 N=64, Ng=8 -10 MCCP -20 0 0 N=64, Ng=8 -10 N=128, Ng=8 ACCP MCCP -10 0 N=64, Ng=8 ACCP 0 N=128, Ng=16 -20 -30 -40 5 6 (b) L 7 8 -50 4 Figure 16. Plots of (a), (b) 𝑀𝐶𝐶𝑃 vs. 𝐿 and (c), (d) 𝐴𝐶𝐶𝑃 vs. 𝐿. 5 6 (d) L 7 8 (Column 1) Plots of 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 vs. 𝐿 (Column 2) Plots of 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 vs. 𝐿 for the good code set with twice the number of for the good codes set with better codes cross-correlation properties Good code sets from complementary pairs and their mates using DF-PLFM waveforms comprised of an up-chirp and a down-chirp as chips -40 8 -10 10 12 (a) L 14 16 10 0 N=64, Ng=16 N=128, Ng=16 -30 12 (c) L 14 16 -20 -40 8 -40 8 -50 4 16 10 12 (d) L 14 16 7 -30 -50 4 8 5 6 (c) L 7 8 0 N=64, Ng=16 -10 N=128, Ng=16 -30 -40 14 6 (a) L N=64, Ng=16 -20 -30 12 (b) L 5 -10 N=128, Ng=16 N=128, Ng=8 -20 -40 0 -30 10 ACCP MCCP -20 -50 4 N=64, Ng=16 -10 -20 N=128, Ng=8 ACCP -40 8 N=64, Ng=8 -10 -40 MCCP -30 N=64, Ng=8 -10 N=128, Ng=8 -20 -30 0 0 N=64, Ng=8 -10 -20 0 MCCP N=128, Ng=8 ACCP MCCP -10 0 N=64, Ng=8 ACCP 0 N=128, Ng=16 -20 -30 -40 5 6 (b) L 7 8 -50 4 5 6 (d) L 7 8 Figure 17. Plots of (a), (b) 𝑀𝐶𝐶𝑃 vs. 𝐿 and (c), (d) 𝐴𝐶𝐶𝑃 vs. 𝐿. If a better good code set with the smaller 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 is required, then the best candidates from the two sets could be selected. This could be achieved by using only half the slope options for the DFCW waveforms used as chips for the complementary code pair and its mates i.e., the DF-LFM/DF-PLFM waveforms with 𝑙 = 0, 2, … , 𝐿 − 1 in Equation (52)–(57). This results in a good code set with significantly better 𝑀𝐶𝐶𝑃 and 𝐴𝐶𝐶𝑃 values, as shown in the plots in column 2 of the table in Figures 16 and 17. These are significantly smaller than the 𝑀𝐶𝐶𝑃 and the 𝐴𝐶𝐶𝑃 values in Figure 14 for the same number of codes in the set. Thus, constructing the proposed codes from complementary code pair and their mates, while using the same chips for both pairs, offers the aforementioned flexibility of choosing between a better good code set and a larger good code set. Table 1 shows the average autocorrelation and average cross-correlation values for the Deng’s polyphase [28] good code set and the Deng’s discrete frequency [20] set designs. The autocorrelation and cross-correlation sidelobe peaks of the codes introduced in this paper are smaller, as shown in the plots in Figures 7 and 17 respectively. The proposed codes constructed via concatenating biphase Golay complementary code pairs and using discrete frequency chips results in a zero-sidelobe domain and an adjacent region of very small cross-correlation sidelobes. In [28], it is shown that the average autocorrelation sidelobe and cross-correlation peaks decrease with increase in code length 1 and approach 𝑂( ) for large 𝑁. Their discrete frequency good code set [20] being wideband, √𝑁 achieve much smaller sidelobe peaks. In the case of the good code set design proposed in this paper, for a given code length (𝑁𝑔 ), increasing the number of discrete frequencies (𝑁) in the chips results in a better code set. Good code set Deng’s polyphase set (code length = 128 and 𝐿 = 3 codes) Deng’s discrete frequency set (# of discrete frequencies = 128 and 𝐿 = 3 codes) Proposed code set with 𝑁𝑔 = 16, 𝑁 = 32 and 𝐿 = 4 Average autocorrelation peak (dB) Average cross-correlation peak (dB) −20.9606 −19.1525 −32.2641 −32.2522 −39.8280 −37.9926 Table 1. Table containing the average autocorrelation and cross-correlation peaks for the proposed set in comparison with Deng’s polyphase and discrete frequency code sets. 8. Conclusions In this paper, it is shown that, by replacing the sinusoidal chips in the complementary code pair with waveforms that satisfy two conditions, symmetry/anti-symmetry and quazi-orthogonality in the convolution sense, allows for concatenating them in the time domain using one frequency band/channel. This results in a zero sidelobe domain around the mainlobe and an adjacent region of small cross-correlation sidelobes. Symmetry/anti-symmetry property results in the zero-sidelobe region, while the quasi-orthogonality property makes the adjacent region of cross-correlation sidelobes small. Discrete frequency coding waveform (DFCW) based on LFM and PLFM waveforms are used as chips, since they satisfy both the symmetry/anti-symmetry and quasi-orthogonality conditions. Since, frequency selective fading does not affect the symmetry/anti-symmetry property, the zero-sidelobe region is resistant to the effects of fading. A good code set with a zero-sidelobe region is then constructed by varying the slopes of the DFCW chips, while using the same complementary code pair. Such good code sets are constructed using a set of quasi-orthogonal DFCW chips based on LFM and PLFM waveforms. It is also shown that mates of the complementary code pair could be used to generate a second good code set using the same DFCW chips. These two sets are shown to be quasi-orthogonal with a zero-sidelobe domain. Thus, resulting in a larger good code set with twice the number of codes, while maintaining the same cross-correlation properties. Or a better good code set could be constructed by choosing the best candidates from the two sets. As a topic for further research, the proposed codes could be constructed using polyphase versions (as shown in [29,30]) of the LFM/PLFM waveforms as chips with the complementary code pairs and their mates. Exploring other waveforms or codes that satisfy the two conditions of symmetry/anti-symmetry and quazi-orthogonality and improving the Doppler properties of these codes are the other topics of future research. Author Contributions: Ravi Kadlimatti and Adly T. Fam conceived and designed the proposed good code set. Ravi Kadlimatti performed the simulations. Conflicts of Interest: The authors declare no conflict of interest. References 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Frank, R.C. Polyphase codes with good nonperiodic correlation properties. IEEE Trans. Inf. Theory 1963, 9, 43–45. Costas; J.P. A study of a class of detection waveforms having nearly ideal range-Doppler ambiguity properties. Proc. IEEE 1984, 72, 996—1009. Golomb, S.W.; Taylor, H. Construction and properties of Costas arrays. Proc. IEEE 1984, 72, 1143—1163. Barker, L.; Drakakis, K.; Rickard, S. On the Complexity of the Verification of the Costas Property. Proc. IEEE 2009, 97, 586–593. Fam, A.T.; Sarkar, I.; Poonnen, T. Area and power efficient mismatched filters based on sidelobe inversion. In Proceedings of the IEEE 2008 Radar Conference, Rome, Italy, 26–30 May 2008; pp. 1–6. Akbaripour, A; Bastani, M.H. Range Sidelobe Reduction Filter Design for Binary Coded Pulse Compression System. IEEE Trans. Aerosp. Electron. Syst. 2012, 48, 348–359. Jung, K.T.; Kim, C.J.; Lim, C.H.; Lee, H.S.; Kwag, Y.K. Design of optimum mean square sidelobe suppression filters for Barker codes. In Proceedings of the 1992 International Conference on Radar, Brighton, UK, 12–13 October 1992; pp. 530–533. Rihaczek, A.W.; Golden, R.M. Range Sidelobe Suppression for Barker Codes. IEEE Trans. Aerosp. Electron. Syst. 1971, AES-7, 1087–1092. Fam, A.T.; Qazi, F.A; Kadlimatti, R. Zero Sidelobe Aperiodic Codes via Additive-Multiplicative Mismatched Filtering. In Proceedings of the 2013 IEEE Military Communications Conference (MILCOM 2013), San Diego, CA, USA, 18–20 November 2013; pp. 829–836. Golay, M.J.E. Complementary series. IRE Trans. Inf. Theory 1961, 7, 82–87. Frank, R. Polyphase complementary codes. IEEE Trans. Inf. Theory 1980, 26, 641–647. Jafari, A.H.; O′Farrell, T. Performance Evaluation of Spatial Complementary Code Keying Modulation in MIMO Systems. In Proceedings of the 2015 IEEE 81st Vehicular Technology Conference (VTC Spring), Glasgow, UK, 11–14 May 2015; pp. 1–5. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. Galati, G.; Pavan, G. Range Sidelobes Suppression in Pulse-Compression Radar using Golay Pairs: Some Basic Limitations for Complex Targets. IEEE Trans. Aerosp. Electron. Syst. 2012, 48, 2756–2760. Liu, Z.; Parampalli, U.; Guan, Y.L. Optimal Odd-Length Binary Z-Complementary Pairs. IEEE Trans. Inf. Theory 2014, 60, 5768–5781. Tang, X.; Mow, W.H. Design of spreading codes for quasi-synchronous CDMA with intercell interference. IEEE J. Sel. Areas Commun. 2006, 24, 84–93. Li, D. The perspectives of large area synchronous CDMA technology for the fourth-generation mobile radio. IEEE Commun. Mag. 2003, 41, 114–118. Qazi, F.A.; Fam, A.T. Good code sets based on Piecewise Linear FM. In Proceedings of the 2012 IEEE Radar Conference, Atlanta, GA, USA, 7–11 May 2012; pp. 522–527. Fishler, E.; Haimovich, A.; Blum, R.; Chizhik, D.; Cimini, L.; Valenzuela, R. MIMO radar: An idea whose time has come. In Proceedings of the 2004 IEEE Radar Conference, Philadelphia, PA, USA, 26–29 April 2004; pp. 71–78. Deng, H. Orthogonal netted radar systems. IEEE Aerosp. Electron. Syst. Mag. 2012, 27, 28–35. Deng, H. Discrete frequency-coding waveform design for netted radar systems. IEEE Signal Proc. Lett. 2004, 11, 179–182. Qazi, F.A.; Fam, A.T. Discrete Frequency-Coding Waveform sets based on Piecewise Linear FM. In Proceedings of the 2014 IEEE Radar Conference, Cincinnati, OH, USA, 19–23 May 2014; pp. 469–473. Liu, B.; He, Z.; He, Q. Optimization of Orthogonal Discrete Frequency-Coding Waveform Based on Modified Genetic Algorithm for MIMO Radar. In Proceedings of the 2007 International Conference of Communications, Circuits and Systems (ICCCAS), Kokura, Japan, 11–13 July 2007; pp. 966–970. Harris. F.; Dick. C. A versatile Filter Structure to Generate and Compress Binary and Polyphase Complementary Spreading Codes. In Proceedings of the 2004 SDR Technical Conference and Product Exposition, Phoenix, AZ, USA, 15–18 November 2004. Suehiro, N. Complete complementary code composed of N-multiple-shift orthogonal sequences. IECE Trans. 1982, J65 A, 1247–1253. Fam, A.T.; Kadlimatti, R. Complementary code pairs that share the same bandwidth via symmetrical linear FM chips. In Proceedings of the 2015 IEEE Military Communications Conference (MILCOM), Tampa, FL, USA, 26–28 October 2015; pp.820–825. Kadlimatti, R.; Fam, A.T. Good code sets from complementary pairs via symmetrical/anti-symmetrical chips. IEEE Trans. Aerosp. Electron. Syst. 2016, 52, 1327–1339. Pezeshki, A.; Calderbank, A.R.; Moran, W.; Howard, S.D. Doppler Resilient Golay Complementary Waveforms. IEEE Trans. Inf. Theory 2008, 54, 4254–4266. Deng, H. Polyphase code design for Orthogonal Netted Radar systems. IEEE Trans. Signal Proc. 2004, 52, 3126–3135. Lewis, B.L.; Kretschmer, F.F. Linear Frequency Modulation Derived Polyphase Pulse Compression Codes. IEEE Trans. Aerosp. Electron. Syst. 1982, AES-18, 637–641. Qazi, F.A.; Fam, A.T. Doppler tolerant and detection capable polyphase code sets. IEEE Trans. Aerosp. Electron. Syst. 2015, 51, 1123–1135.
7cs.IT
Data-driven and Model-based Verification: a Bayesian Identification Approach arXiv:1509.03347v1 [cs.SY] 10 Sep 2015 Sofie Haesaert a, Paul M.J. Van den Hof a, Alessandro Abate b a Department of Electrical Engineering, Eindhoven University of Technology, Eindhoven, The Netherlands b Department of Computer Science, University of Oxford, Oxford, United Kingdom Abstract This work develops a measurement-driven and model-based formal verification approach, applicable to systems with partly unknown dynamics. We provide a principled method, grounded on reachability analysis and on Bayesian inference, to compute the confidence that a physical system driven by external inputs and accessed under noisy measurements, verifies a temporal logic property. A case study is discussed, where we investigate the bounded- and unbounded-time safety of a partly unknown linear time invariant system. Key words: Temporal logic properties, Bayesian inference, Linear time-invariant models, Model-based verification, Data-driven validation, Statistical model checking, 1 Introduction The design of complex, high-tech, safety-critical systems such as autonomous vehicles, intelligent robots, and cyber-physical infrastructures, demands guarantees on their correct and reliable behaviour. Correct functioning and reliability over models of systems can be attained by the use of formal methods. Within the computer sciences, the formal verification of software and hardware has successfully led to industrially relevant and impactful applications [13]. Carrying the promise of a decrease in design faults and implementation errors and of correct-by-design synthesis, the use of formal methods, such as model checking [13], has become a standard in the avionics, automotive, and railway industries [34]. Life sciences [6,14] and general engineering applications [5,11] have also recently pursued the extension of these successful techniques from the computer science: this has required a shift from finite-state to physical and cyberphysical models that are of practical use in nowadays science and technology [23,32]. The strength of formal techniques, such as model checking, is bound to the fundamental requirement of having access to a given model, obtained from the knowledge Email addresses: [email protected] (Sofie Haesaert), [email protected] (Paul M.J. Van den Hof), [email protected] (Alessandro Abate). of the behaviour of the underlying system of interest. In practice, for most physical systems the dynamical behaviour is known only in part: this holds in particular with biological systems [1] or with classes of engineered systems where, as a consequence, the use of uncertain control models built from data is a common practice [22]. Only limited work within the formal methods community deals with the verification of models with partly unknown dynamics. Classical results [4,19] consider the verification problem for non-stochastic models described by differential equations and with bounded parametric uncertainty. Similarly, but for continuous time probabilistic models, [9,10] explore the parameter space with the objective of model verification (respectively statistical or probabilistic). Whenever full state measurements of the system are available, Statistical Model Checking (SMC) [31,24] replaces model(-based) checking procedures with empirical testing of formalised properties. SMC is limited to fully observable stochastic systems with little or no non-determinism, and may require the gathering a large set of measurements. Extensions towards the inclusion of non-determinism have been studied in [18,25], with preliminary steps towards Markov decision processes. Related to SMC techniques, but bound to finite state models, [12,27,30] assume that the system is encompassed by a finite-state Markov chain and efficiently use data to learn the corresponding model and to verify it. Similarly, [3,8] employ machine learning tech- 14 September 2015 representing S, is assumed to be an element of G, namely θ0 ∈ Θ: as an example, model sets G obtained through first principles adhere to this classical assumption. niques to infer finite-state Markov models from data over specific logical formulae. An alternative approach, allowing both partly unknown dynamics over uncountable (continuous) variables and noisy output measurements, is the usage of a Bayesian framework relating the confidence in a formal property to the uncertainty of a model built from data. When applied on nonlinearly parameterised linear time invariant (LTI) models this approach introduces huge computational problems, which as proposed in [16], can only be mitigated by statistical methods. Instead, to obtain reliable and numerical solutions, we propose the use of linearly parameterised model sets defined through orthonormal basis functions to represent these partially unknown systems. This is a broadly used framework in system identification [21,22]: it allows for the incorporation of prior knowledge, while maintaining the benefits (computational aspects) of linear parameterisations. Practically, it has been widely used for the modelling of physical systems, such as the thermal dynamics of buildings [35]. In contrast, in this paper we pursue a promising new numerical approach: instead of employing directly a nonlinearly parameterised model, we embed it in a linearly parameterised one via a series expansion of orthonormal basis functions. Samples can be drawn from the underlying physical system via a measurement set-up, as depicted in Figure 1. An experiment consists of a finite number (Ns ) of inputoutput samples drawn from the system, and is denoted s by Z Ns = {u(t)ex , ỹ(t)ex }N t=1 , where u(t)ex ∈ U is the input for the experiment and ỹ(t)ex is a (possibly noisy) measurement of y0 (t)ex . In general, the measurement noise can enter non-additively and be a realisation of a stationary stochastic process. 1 We assume that at the beginning of the measurement procedure (say at t = 0), the initial condition of the system, encompassed by the initial state x(0)ex of models in M, is either known, or, when not known, has a structured uncertainty distribution based on the knowledge of past inputs and/or outputs. As reasonable, we implicitly consider only welldefined problems, such that for any model representing the system, given a signal input u(t)ex and an (uncertainty distribution for) x(0)ex , the probability density distribution of the measured signal can be fully characterised. u(t)ex In this contribution we further analyse and extend the related results in [17], obtained for a time-bounded subset of temporal logic properties, to unbounded-time temporal logic properties, and analyse their robustness. 2 S y0 (t)ex e(t) ỹ(t)ex Fig. 1. System and measurement setup. In the measurement setup (grey box) the measured output ỹ(t)ex includes the system output y0 (t)ex and the measurement noise e(t). Data collected from experiments comprises the input u(t)ex and the measured output ỹ(t)ex signals. General Framework and Problem Statement In this section, we provide a novel methodology to verify whether a system S satisfies a specification ψ, formulated in a suitable temporal logic, by integrating the partial knowledge of the system dynamics with data obtained from a measurement set-up around the system. The end objective is to analyse the behaviour of system S. We consider properties encoded as specifications ψ and expressed in a temporal logic of choice (to be detailed shortly). Let us remark that the behaviour of S to be analysed is bound to a set of operating conditions that are pertinent to the verification problem and that will be indexed with ver: this comprises the set of possible input signals u(t)ver (e.g., a white or coloured noise signal, or a non-deterministic signal u(t)ver ∈ Uver ⊆ U), and of the set of initial states x(0)ver ∈ Xver for the mathematical models M reflecting past inputs and/or outputs of the system. The system satisfies a property if the “true” model representing it satisfies it, namely S  ψ if and only if M(θ0 )  ψ. Let us further clarify this framework. Let us denote with S a physical system, or equivalently the associated dynamical behaviour. A signal input u(t) ∈ U, t ∈ N, captures how the environment acts on the system. Similarly, an output signal y0 (t) ∈ Y indicates how the system interacts with the environment, or alternatively how the system can be measured. Note that the input and output signals are assumed to take values over continuous domains. The system dynamics can be described via mathematical models, which express the behavioural relation between its inputs and outputs. The knowledge of the behaviour of the system is often limited or uncertain, making it impossible to analyse its behaviour via that of a “true” model. In this case, a-priori available knowledge allows to construct a model set G with elements M ∈ G: this model class supports the structured uncertainty as a distribution over a parameterisation θ ∈ Θ, G = {M(θ)|θ ∈ Θ}. The unknown “true” model M(θ0 ) 1 Both the operating conditions of the experiment, that is the input signal u(t)ex and the initial state x(0)ex , and the measurements have been indexed with ex to distinguish them from the operating conditions of interest for verification, to be discussed shortly. 2 which presumes an uncertainty distribution p (θ) over the parameter set Θ, representing the prior knowledge. In this work we consider the satisfaction of a property M(θ)  ψ as a binary-valued mapping from the parameter space Θ. More generally, when in addition to the measurements of the system also its transitions are disturbed by stochastic noise, then property satisfaction is a mapping from the parameter space Θ to the interval [0, 1], and quantifies the probability that the model M(θ) satisfies the property. This mapping generalises the definition of the satisfaction function introduced in [9], and is now stated as follows. The statement can be formally derived based on standard Bayesian calculus, as in [26]. We have chosen to employ a Bayesian framework, as per (3), since it allows to reason explicitly over the uncertain knowledge on the system and to work with the data acquired from the measurement setup. This leads to the efficient incorporation of the available knowledge and to its combination with the data acquisition procedure, in order to compute the confidence on the validity of a given specification over the underlying system. As a special instance, this result can be employed for Bayesian hypothesis testing [36]. As long as the mapping fψ is measurable, the models in the model set (and hence the system represented by it) can be characterised by either probabilistic or nonprobabilistic dynamics. Definition 1 (Satisfaction Function) Let G be a set of models M that is indexed by a parameter θ ∈ Θ, and let ψ be a formula in a suitable temporal logic. The satisfaction function fψ : Θ → [0, 1] associated with ψ is fψ (θ) = P (M(θ)  ψ) . (1) Let us assume that the satisfaction function fψ is measurable and entails a decidable verification problem (e.g., a model checking procedure) for all θ ∈ Θ. Remark 2 In statistical model checking [24,31], the objective is to replace the computationally tolling verification of a system over bounded-time properties by the empirical (statistical) testing of the relevant specifications over finite executions drawn from the system. In contrast, our problem statement tackles the problem of efficiently incorporating data with prior knowledge, for the formal (deductive) verification of the behaviour of a system with partly unknown dynamics – as such our overall verification approach is, as claimed, both data-driven and model-based. Moreover, by separating the operational conditions in an experiment from those of importance for the verification procedure, the system can be verified over non-deterministic inputs, encompassing as such both controller and disturbance inputs, or modelling errors. Problem 1 For a partly unknown physical system S, under prior knowledge on the system given as a parameterised model class G supporting an uncertainty distribution over the parameterisation, gather possibly noisy data drawn from the measurement setup and verify properties on S expressed in a temporal logic of choice, with a formal quantification of the confidence of the assertion. 2.1 A Bayesian Framework for Data-driven Modelling and Verification Consider Problem 1. Denote loosely with P (·) and p (·) respectively a probability measure and a probability density function, both defined over a continuous domain. We employ Bayesian probability calculus [26] to express the confidence in a property as a measure of the uncertainty distribution defined the set G. By adopting the Bayesian framework, uncertainty distributions are handled as probability distributions of random variables. Therefore the confidence in a property is computed as a probability measure P (·) via the densities p (·) over the uncertain variables. 2.2 The Bayesian approach is widely applicable to different types of properties and models, however its computational complexity might in practice limit its implementation. In the literature the satisfaction function is related to the exploration of a parameter set over the validity of a formal property fψ (θ), and has been studied for autonomous models in continuous time in [4,15,19]. Analytical solutions to the parametric inference equation (3) can be found if the prior is a conjugate distribution. For linear dynamical systems, closed-form solutions are given inter alia in [28]. In general (2)-(3) in Proposition 1 lack analytical solutions, and the assessment of the satisfaction function (1) may be computationally intensive. Statistical methods such as the one proposed in [16] on a similar Bayesian approach lead to involved computations and introduce additional uncertainty from Monte Carlo techniques. Proposition 1 (Bayesian Confidence) Given a specification ψ and a data set Z Ns , the confidence that S  ψ can be quantified via inference as   R (2) P S  ψ | Z Ns = Θ fψ (θ)p θ|Z Ns dθ . where fψ is the satisfaction function given in (1).  The a-posteriori uncertainty distribution p θ|Z Ns , given the data set Z Ns , is based on parametric inference over θ as  p(Z Ns |θ )p(θ) p θ|Z Ns = R , (3) Ns Θ p(Z Computational Approaches On the contrary, in the next section, we propose a novel computational approach over discrete-time linear time- |θ)p(θ)dθ 3 Denote the k-bounded and unbounded invariance operVk ator as ✷k ψ = i=0 i ψ and ✷ψ = ¬(true U ¬ψ), respectively. invariant systems. By exploiting linear parameterisations analytical solutions of both the parametric inference and the satisfaction function are characterised for properties expressed within a fragment of a temporal logic. 3 Of interest are formal properties encoded on the inputoutput behaviour of the system, and over a time horizon t ≥ 0. The output y0 (t)ver ∈ Y is labeled by a map L : Y → Σ, which assigns letters α in the alphabet Σ via half spaces on the output, as LTL Verification of LTI systems Consider a system S that can be represented by a class of finite-dimensional dynamical models that evolve in discrete-time, and are linear, time-invariant (LTI), and not probabilistic. These models depend on input and output signals ranging over Rm and Rp , respectively, and on variables xS (t) taking values in an Euclidean space, xS (t) ∈ X ⊆ Rn , where n, the state dimension, is the model order. The behaviour of such a system is encompassed by state-space models (AS , BS , CS , DS ) as S: ( xS (t + 1) = AS xS (t) + BS u(t), y0 (t) = CS xS (t) + DS u(t), L(y0 (t)ver ) = α ∈ Σ ⇔ (4) 3.1 πt πt (negation) πt (conjunction) πt (disjunction) πt (next) πt (until) πt  true p  ¬ψ  ψ1 ∧ ψ2  ψ1 ∨ ψ2  ψ  ψ1 U ψ2 Api y0 (t)ver ≤ bpi , (5) Model Set Selection As a first step we need to embed the a-priori available knowledge on the underlying system within a parameterised model set, under a prior distribution. The use of linearly parameterised model sets defined through orthonormal basis functions to represent partially unknown systems is a broadly used framework in system identification: it allows for the incorporation of prior knowledge, while maintaining the benefits (computational aspects) of linear parameterisations. Practically, it has been widely used for the modelling of physical systems, such as the thermal dynamics of buildings [35,29]. Note that although the goal of parameter exploration in formal verification has recently attracted quite some attention [4,15,19], there are as of yet no general scalable results for the computation of the satisfaction function for nonlinearly-parameterised discrete-time LTI models. Whilst in general linear time-invariant models with uncertain parameters do not map onto a linearlyparameterised model set, we argue that a linearlyparameterised model set can encompass a relevant class of models. For instance, any asymptotically stable LTI model can be represented uniquely by its (infinite) impulse response [20], and the coefficients of the impulse response define a linear parameterisation for this model. Further, the coefficients of the impulse response converge to zero, so that a truncated set of impulse coefficients can provide a good approximate model set with a finite-dimensional, linear parameterisation. This is only one possible instance of modelling by a finite set of orthonormal basis functions [21, Chapters 4 and 7],[33], which can be selected to optimally incorporate prior knowledge: we conclude that, as an alternative to the use of a nonlinearly parameterised set of models, structural information (even when inexact) can be used to select a System properties are expressed, over a finite set of atomic propositions pi ∈ AP , i = 1, . . . , |AP |, in Lineartime Temporal Logic [2]. LTL formulae are built recursively via the syntax ψ ::= true | p | ¬ψ | ψ ∧ ψ | ψ ∨ ψ | + ψ | ψ U ψ. Let π = π(0), π(1), π(2), . . . ∈ ΣN be a string composed of letters from the alphabet Σ = 2AP , and let πt = π(t), π(t + 1), π(t + 2), . . . be a subsequence of π, then the satisfaction relation between π and ψ is denoted as π  ψ (or equivalently π0  ψ). The semantics for the satisfaction are defined recursively over πt and the LTL syntax as (true) pi ∈α for given Api ∈ R1×p , bpi ∈ R that is, sets of atomic propositions are associated to polyhedra over Y ⊂ Rp . Let us underline that properties are defined over the behaviour y0 (t)ver of the system, and not over the noisy measurements ỹ(t)ex of the system in the measurement setup. Additionally, for the verification problem the input signal is modelled as a bounded signal u(t) ∈ Uver , and represents possible external non-determinism of the environment acting on the system. where matrices AS , BS , CS , DS are of appropriate dimensions. Let us remark that LTI systems represent the most common modelling framework in control theory, a key framework leading towards generalisations to more complicated (e.g., nonlinear) dynamical models. The experimental measurement setup, as depicted in Figure 1, consists of the signals u(t)ex and ỹ(t)ex = y0 (t)ex + e(t), representing the inputs and the measured outputs, respectively, and where e(t) is an additive zeromean, white, Gaussian-distributed measurement noise with covariance Σe that is uncorrelated from the inputs. Ns samples are collected within a data set Z Ns = s {u(t)ex , ỹ(t)ex }N t=1 . (atomic prop.) V ⇔ true ⇔ p ∈ π(t) ⇔ πt 6 ψ ⇔ πt  ψ1 and πt  ψ2 ⇔ πt  ψ1 or πt  ψ2 ⇔ πt+1  ψ ⇔ ∃ i ∈ N : πt+i  ψ2 , and ∀j ∈ N : 0 ≤ j < i, πt+j  ψ1 4  1 = p exp |Σe |Ns (2π)pNs  Ns 1X (ŷ(t, θ) − ỹ(t)ex )T Σ−1 (ŷ(t, θ) − ỹ(t) ) − ex e 2 t=1 set of orthonormal basis functions, whose finite truncation defines a finite-dimensional linearly-parameterised model set indexed over the coefficients of the basis functions. Thus, in the following we consider a linearly parameterised model set G that encapsulates system S, and specifically G = {(A, B, C(θ), D(θ)), θ ∈ Θ}. and can be directly usedin Proposition 1. This conditional density p Z Ns |θ depends implicitly on the given initial state x(0)ex and, for the case of a given uncertainty distribution for x(0)ex , p Z Ns |θ should be marginalised as a latent variable [28]. The a-posteriori uncertainty distribution is obtained as the analytical solution of the parametric inference in (3) [28]. A system, or equivalently the mathematical model that represents it, satisfies a property if all the words generated by the model satisfy that property. Since properties are encoded over the external (input-output) behaviour of the system S, which is the behaviour of M(θ0 ), θ0 ∈ Θ, we can equivalently assert that any property ψ is verified by the system, S  ψ, if and only if it is verified by the unknown model representing the system, namely M(θ0 )  ψ. Introduce Θψ to be the feasible set of parameters, such that for every parameter in that set the property ψ holds, i.e., ∀θ ∈ Θψ : M(θ)  ψ. As such Θψ is characterised as the level set of the satisfaction function fψ , Θψ = {θ ∈ Θ : fψ (θ) = 1}. 3.2 Recall now that for a given specification ψ, we seek to determine a feasible set of parameters Θψ , such that the corresponding models admit property ψ, namely M(θ)  ψ, ∀θ ∈ Θψ . Since models M(θ) have a linearlyparameterised state space realisation as per (6), it follows that when the set of initial states and inputs Xver and Uver are bounded polyhedra, the verification of a class of safety properties expressed by formulae with labels as in (5) leads to a set of feasible parameters Θψ that is a polyhedron, which can be easily computed. More precisely, the following theorem can be derived. Safety Verification of Bounded-time Properties Models M in the class G have the following representation (A, B, C(θ), 0): M(θ) : ( x(t + 1) = Ax(t) + Bu(t), ŷ(t, θ) = C(θ)x(t), Theorem 3 ([17]) Given a bounded polyhedral set (or equivalently a polytope) of initial states x(0) ∈ Xver and of inputs u(t) ∈ Uver for t ≥ 0, and considering a labelling map as in (5), then the feasible set Θψ of the parameterised model set (6) results in a polyhedron for properties ψ composed of the LTL fragment ψ ::= α| ψ|ψ1 ∧ ψ2 , with α ∈ Σ. (6) and are parameterised by θ ∈ Θ ⊂ Rpn :θ = vec(C) with a prior probability distribution p (θ). In addition to this strictly proper model class we will also allow for proper model (A, B, C(θ), D(θ)) where both the C and the Dmatrices are parameterised and the parameterisation is θ = vec([C D])). For a given initial condition x(0) and input sequence, the output of the “true” model ŷ(t, θ0 ) is equal to the system output y0 (t). Proof [of Theorem 3] Let ⊗ denote the Kronecker product. Consider the input set Uver to be the convex hull of U , i.e. conv(U ) = Uver . Similarly let the set of initial states be conv(Xver ) = Xver . Let the model set be given as M(θ) = (A, B, C(θ), D). We will temporarily assume that D is set equal to zero. Afterwards we will show how to work with a parameterised D. Note that the syntax fragment ψ ::= α| ψ|ψ1 ∧ ψ2 with α ∈ Σ = 2AP is equivalent to ψ ::= p| ψ|ψ1 ∧ ψ2 with p ∈ AP . Given a measurement set-up as in Figure 1 with unknown parameter θ0 . Then u(t)ex and ỹ(t)ex represent the input and the measured output, respectively, and e(t) is an additive zero-mean, white, Gaussiandistributed measurement noise with covariance Σe that is uncorrelated from the input. Furthermore u(t) is assumed to be uncorrelated with the noise e(t). From this set-up Ns samples are collected in a data set s Z Ns = {u(t)ex , ỹ(t)ex }N t=1 . 1. We claim that for every specification ψ composed from the syntax fragment ψ ::= p| ψ|ψ1 ∧ψ2 and θ ∈ Θ, the words generated by a model M(θ) = (A, B, C(θ), 0) with state x(t) satisfy the specification ψ, denoted < M(θ), x(t) > ψ, if and only if Therefore given the operating conditions of the experiment set-up the measured signal ỹ(t)ex can be fully characterised: its probability density, conditional on the parameters θ, is   T Inψ ⊗ x(t) Nψ + Kψ θ ≤ Bψ . (7) The matrices Nψ ∈ Rnnψ ×np , Kψ ∈ Rnψ ×np , Bψ ∈ Rnψ in the above satisfaction relation have dimensions that are functions of the parametrisation and of the property dependent “dimension” nψ , and are obtained inductively Ns  Y p Z Ns |θ = p (ỹ(t)ex |θ) t=1 5 over the syntax of the specification. For any atomic propositions the model starting from state x(t) satisfies a property pi , i.e., < M(θ), x(t) > pi ⇔ Api y ≤ bpi , with Api ∈ R1×p and bpi ∈ R we construct the matrices Npi , Kpi and Bpi as follows. Consider y(t) for a given x(t) then The and operation ψ1 ∧ ψ2 for (Nψ1 , Kψ1 ,Dψ1 ,bψ1 ) and (Nψ2 , Kψ2 ,Dψ2 ,bψ2 ) with nψ1 ∧ψ2 = (nψ1 + nψ2 ) gives Nψ1 ∧ψ2 = Api y(t) = Api C(θ)x(t) = x(t)T (In ⊗ Api )θ. " N ψ1 N ψ2 # , Kψ1 ∧ψ2 # " # " Bψ 1 K ψ1 . , Bψ1 ∧ψ2 = = Bψ 2 K ψ2 This can be derived from n×np , Kpi = O1×np ∈ This yields Npi = (In ⊗ Api ) ∈ R R1×np , and Bpi = bpi ∈ R1×1 . The next operation ψ1 with matrices (Nψ1 ,Kψ1 , Dψ1 ,bψ1 ) yields matrices < M(θ), x(t) > ψ1 ∧ ψ2  T ^  Inψi ⊗ x(t) Nψi + Kψi θ ≤ Bψi ⇔ i∈{1,2} N K B ψ1 ψ1 ψ1  = 1|U| ⊗ Inψ1 ⊗ AT Nψ1 , T = U Inψ1 ⊗ B Nψ1 + 1|U| ⊗ Kψ1 , = 1|U| ⊗ Bψ1 , ⇔ Inψ1 ∧ψ2 where the i-th set of nψ1 rows of U ∈ R|U|nψ1 ×m is defined as  Inψ1 ⊗ uTi with ui ∈ U and where n ψ1 2. The matrix-valued function   T Inψ ⊗ x(0) Nψ + Kψ θ = |U |nψ1 . This can be derived as is affine in xT (0) (for a fixed θ), therefore its value at the initial condition x(0) ∈ Xver is a convex combination of the function values at the vertices Xver of Xver . Thus the satisfaction relation < M(θ), x(0) > ψ represented by the multi-affine inequality holds uniformly over x(0) ∈ Xver if and only if it holds for the vertices of Xver . This gives a set of affine inequalities in θ, thus the feasible set Θψ is a polyhedron and is given as < M(θ), x(t) > ψ ⇔ ∀u(t) ∈ Uver :   T Inψ1 ⊗ x(t + 1) Nψ1 + Kψ1 θ ≤ Bψ1 , ⇔ ∀u(t) ∈ Uver :  T Inψ1 ⊗ Ax(t) Nψ1  T + Inψ1 ⊗ Bu(t) Nψ1 + Kψ1 θ ≤ Bψ1 . ( Since the above is an affine function in u(t), the image of every u(t) ∈ conv(U ) = Uver can be expressed as a convex combination of the values at the vertices ui ∈ U , c.f. [6]. Then an equivalent expression is + Inψ1  ψ, and b ψ, xi ∈Xver Inψ ⊗ xi T  N ψ + K ψ θ ≤ Bψ ) . 3. To prove Theorem 3 we need to extend the results to models with parameterised D. The dynamics of model (A, B, C, D) with both C and D fully parameterised can be reformulated as which  can be rewritten as T T ⇔ 1|U| ⊗ Inψ1 ⊗ Ax(t) Nψ1 + U Inψ1 ⊗ B Nψ1  + 1|U| ⊗ Kψ1 θ ≤ 1|U| ⊗ Bψ1 . Having obtained K ψ , D first term to obtain N ψ : θ∈Θ: ^ The set Θψ is a polyhedron, since it is formed by a finite set of half spaces. T Inψ1 ⊗ Ax(t) Nψ1  T T Inψ1 ⊗ B Nψ1 + Kψ1 θ ≤ Bψ1 ⊗ ui ⇔ ∀ui ∈ U : # #! " # " "  T N ψ1 Bψ 1 K ψ1 . θ≤ + ⊗ x(t) Bψ 2 K ψ2 N ψ2 " # x(t + 1) u(t + 1) = " #" # A B x(t) 0 0 u(t) + " # 0 I u(t + 1) h i y(t) = C D x(t). now rewrite the Using the new matrices (Ã, B̃, C̃(θ), 0) the obtained results still hold. For part 2. set of vertices Xver needs to be extended with the vertices of U as Xver × U . ✷   1|U| ⊗ Inψ1 ⊗ x (t) Inψ1 ⊗ AT Nψ1    = I|U| 1|U| ⊗ Inψ1 ⊗ xT (t) Inψ1 ⊗ AT Nψ1     = I|U|nψ1 ⊗ xT (t) 1|U| ⊗ Inψ1 ⊗ AT Nψ1 . T In the computation of the feasible set, the faces of the polyhedron Θψ are shown to be a function of the ver- 6 Table 1 Mean (µ) and variance (σ 2 ) of the confidence obtained from 100 experiments with 200 measurements each. tices 2 of the bounded set of initial states Xver and of the set of inputs Uver , and are also expected to grow in number as a function of the time horizon of the property. The result in Theorem 3 is valid for any finite composition of the LTL fragment ψ ::= α| ψ|ψ1 ∧ ψ2 , as such it only holds for finite horizon properties. Properties defined over the infinite horizon will be the objective of Section 3.4. 3.3 θ0 h iT -1 -1 h iT -1 0 h iT -1 1 Case Study: Bounded-Time Safety Verification Consider a system S and verify whether hthe output i y0 (t)ver remains within the interval I = −0.5, 0.5 , labeled as ι, for the next 5 time steps, under u(t)ver ∈ Uver = [−0.2, 0.2] and x(0)ver ∈ {02 } = Xver . Introduce accordingly the alphabet Σ = {ι, τ } and the labelling map L : L(y) = ι, ∀y ∈ I, L(y) = τ, ∀y ∈ Y\ I. Now Vcheck whether the following LTL property holds: S  5i=1 ( )i ι. We assume that system S can be represented as an element of a model set G with transfer functions characterised by second-order Laguerre-basis ones [20] (a special case of orthonormal basis functions), which translates to the following parameterised state-space representation: # √ 1 − a2 x(t + 1)= x(t) + u(t), √ 1 − a2 a (−a) 1 − a2 " a 0 # " µ σ2 0.348 0.073 h 0.060 h 0.086 h 0.705 0.492 θ0 µ σ2 1 -1 iT 0.491 0.085 1 0 iT 0.730 0.056 1 1 iT 0.339 0.065 represents the confidence in the safety of the system, as displayed in Table 1 via mean and variance terms. θ2 1 0 −1 −2 3.4 (8) T 0 θ1 2 Fig. 2: Feasible set of parameters in Θ, and contour lines of the quantity p θ|Z Ns , obtained for θ0 = [1 0]T . Verifying Unbounded-Time Properties Using Invariant Sets In this section we extend the approach unfolded in Section 3.2, to hold on the LTL fragment ψ ::= α| ψ|ψ1 ∧ ψ2 with additionally the unbounded invariance (safety) operator. Recall the form of the k-bounded and of the unVk bounded invariance operators, namely ✷k ψ = i=0 i ψ and ✷ψ = ¬(true U ¬ψ) respectively. The extension from a k-bounded operator, covered by the result in Theorem 3, to the unbounded invariance one, is based on the concept of robust positive invariance [7, Def. 4.3], recalled next. ŷ(t, θ) = θ x(t) . The parameter set is chosen as θ ∈ Θ = [−10, 10]2, whereas the coefficient a is chosen to be equal to 0.4. We select, as prior available knowledge on the system, a uniform distribution p (θ) on the model class, and pick a known variance σe2 = 0.5 for the white additive noise on the measurement. The set of feasible parameters Θψ ⊂ Θ is represented in Figure 2 and is computed according to Theorem 3. Based on the prior available knowledge, the confidence associated to θ0 ∈ Θψ amounts to 0.0165 3 . In comparison to this value, after doing an experiment on the system with “true parameter” θ0 = [1 0]T (Figure 2) and with input signal u(t)ex , a realisation of a white noise with a uniform distribution over [−0.2, 0.2], and measuring ỹ(t)ex for 200 consecutive time instances  the uncertainty distribution is refined as p θ|Z Ns . The resulting confidence (2) in the property is increased to 0.779. Along this line of experiments, we have repeated the test 100 times, for several instances of the parameter θ0 characterising the underlying system S. In all instances, after obtaining 200 measurements the a-posteriori confidence Definition 2 For the system x(t + 1) = Ax(t) + Bu(t), the set S ⊆ X is said to be robustly positively invariant if, for all x(0) ∈ S and u(t) ∈ U, the condition x(t) ∈ S holds for all t ≥ 0. Recall that the feasible set Θψ is defined as the set of parameters for which property ψ holds, namely ∀θ ∈ Θψ : M(θ)  ψ. The satisfaction relation M(θ)  ψ depends implicitly on the set of initial states x(0) ∈ Xver and on the set of inputs Uver . Let us extend the definition of the feasible set to explicitly account for its dependence on the set of initial conditions: given a bounded and convex set S ⊂ X, let Θψ (S) be defined as the set of parameters in Θ for which the parameterised models M(θ) initialised with x(0) ∈ S satisfy ψ over input signals u(t) ∈ Uver t ≥ 0. Hence the feasible set Θψ can be written as a function of the set of initial states Xver , that is Θψ (Xver ). Thus the extended map Θψ (·) takes 2 A polytope can be written as the convex hull of a finite set of vertices. 3 This is obtained by numerical computation of (2) with probability distribution p (θ). ntegrals are solved via the numerical integration tool in Matlab. 7 Assume that Uver includes the origin, and denote the forward reachability mappings initialised with R(0) := {0n } ⊂ X as subsets of the state space into subsets of the parameter space. Note that if S is a robustly positively invariant set that includes the set of initial states Xver ⊆ S, then for all θ ∈ Θψ (S) the models M(θ) satisfy ψ over all infinite-time model traces x(t): this allows to state that M(θ)  ✷ψ. We can show that the following holds. X R(i) := Post(R(i−1) ), with set operation Post(X) := {x′ = Ax + Bu, x ∈ X, u ∈ U}. Denote the limit reachable set as R∞ = limi→∞ R(i) . From literature we recall that properties of these i-step reachable sets, as given in [7] include the following: for a reachable pair (A, B) and an asymptotically stable matrix A, the ∞-reachable set R∞ is bounded and convex [7, Proposition 6.9]. The k-step reachable set converges to the ∞-reachable set via (9), since it is monotonically increasing R(i) ⊆ R(i+1) . Moreover, R∞ is the minimal robustly positively invariant set for the system, so that any positively invariant set includes R∞ [7, Proposition 6.13]. Thus, starting from x(0) = 0n , all x(t) ∈ R∞ , and furthermore ofinterest to this work we  conclude that Θ✷k ψ= Θψ R(k) and Θ✷ψ = Θψ R∞ . Θ Lemma 4 The function Θψ (·) : 2 → 2 , for specifications obtained as ψ ::= α | ψ | ψ1 ∧ ψ2 , is monotonically decreasing: that is if S1 ⊆ S2 , then Θψ (S2 ) ⊆ Θψ (S1 ). Proof We leverage the notation used in the proof of Theorem 1. Provided that the parameterised model is given as (A, B, C(θ), 0), we show that any θ ∈ Θψ (S2 ) is also an element of θ ∈ Θψ (S1 ). Suppose S2 has a finite number of vertices xi ∈ V (S2 ), then for any θ ∈ Θψ (S2 ): V xi ∈V(S2 )  (Inψ ⊗ xi )T Nψ + Kψ θ ≤ Bψ and for every x ∈ S2 Feasible set for invariance properties under polytopic sets of initial states (Inψ ⊗ x)T Nψ + Kψ θ ≤ Bψ .  More generally, if Xver ⊆ R∞ and ceteris paribus, then R∞ is the minimal robustly positively invariant set that includes Xver , and Θψ (R∞ ) = Θ✷ψ . For finite iterations the reachable sets R(i) are polytopes, and if R(i) = R(i+1) , then R(i) = R∞. Though the iterations can stop in finite time, in general the number of iterations to obtain R∞ can be infinite. Whilst the minimal robustly positively invariant set is not necessarily closed or a polytope, there exist methods to approximate R∞ as detailed in [7]. For instance, for stable systems, R(k) is shown to converge to R∞ , in the sense that for all ǫ > 0 there exists k̄ such that for k ≥ k̄, R(k) ⊆ R∞ ⊆ (1 + ǫ)R(k) [7, Proposition 6.9]. Since the vertices xj ∈ V (S1 ) are also elements of S2 , then V xj ∈V(S1 ) (9)  (Inψ ⊗ xj )T Nψ + Kψ θ ≤ Bψ and θ ∈ Θψ (S1 ). This reasoning can be trivially extended to include parameterised D matrices. Increasing the number of vertices of S1 and S2 , does not change the result, hence the same holds if S1 and S2 are convex sets. ✷ Based on the result in Lemma 4, we conclude that the maximal feasible set Θ✷ψ is obtained as a mapping from the minimal robustly positively invariant set S that includes Xver : Θ✷ψ = Θψ (S). This leads next to consider under which conditions such minimal robustly positively invariant set S can be exactly computed or approximated. Recall that the maximal feasible set Θ✷ψ is obtained as a mapping from the minimal robustly positively invariant set S including Xver , that is Θ✷ψ = Θψ (S). Let us extend the study to the case where the conditions Xver = {0n } or its extension Xver ⊆ R∞ do not apply, while the condition on the bounded set Uver is maintained, that is 0 ∈ Uver . Consider the more general case where the set of initial states is a polytope but not necessarily a subset of R∞ . Denote the union of the forward reachability mappings initialised with (0) RXver := Xver ⊆ X as Feasible set for invariance properties with Xver = {0n } For Xver = {0n }, assuming a bounded interval Uver with the origin in its interior, and under some basic assumptions on the dynamics (to be shortly discussed), the minimal robustly positively invariant set can be shown to be a bounded and convex set that includes the origin [7]. Maintaining the condition of Uver being bounded and having the origin in its interior, we first consider the case that Xver = {0n } and characterise S via tools available from set theory in systems and control; thereafter we look at extensions to more general sets of initial states Xver . (i) (i−1) (i−1) RXver := RXver ∪ Post(RXver ) . (10) This set is also known in the literature as the reach tube. The corresponding set for infinite time is denoted as (i) ∞ R∞ Xver = limi→∞ RXver . Notice that if Xver ⊆ R , then ∞ ∞ R = RXver . The iteration is monotonically increasing (i) (i+1) (i) (i+1) RXver ⊆ RXver , and whenever RXver = RXver it stops 8 (i) after a finite number of iterations with R∞ Xver = RXver . Of course, also in this more general case, the number of iterations can be unbounded, however the convergence properties of R(i) extend seamlessly to the case of sets (i) (i) RXver . Since RXver is a union of polytopes, it is not guaranteed to be a convex set. Still, it can be shown via the proof of Theorem 3 that the computation of the  feasible set Θψ (S) boils down to that of Θψ conv(S) . if ǫθ ≥ Proof 1. Θψ (R + ǫx B) ⊆ Θψ (R) Based on the definition of this set (c.f. the proof of Theorem 3), the set operation Θψ (·) is monotonically decreasing. Therefore Θψ (R + ǫx B) ⊆ Θψ (R) holds. Remark 5 Let us illustrate the convergence property (i) for sets RXver as follows. For every vertex xi (0) ∈ Xver , select a decomposition xir + xis with xir ∈ R∞ , which minimises kxis k for a chosen vector norm k · k. Since every element x(0) ∈ Xver is a convex combination of the vertices xi (0), it follows that for all x(0) ∈ Xver : x(0) = X i i ai x (0) = X ai xir (0) + i X ǫx ǫp maxi (kvi k)2 kAp k2 , for ǫp := max . p∈AP |bp | 1 + ǫx ǫp maxi (kvi k) 2. Θψ (R) ⊆ Θψ (R + ǫx B) + ǫθ B Consider the case where the model is (A, B, C(θ), 0). To prove (11), we first find a ǫθ as a function of ǫx such that Θψ (R) ⊆ Θψ (R + ǫx B) + ǫθ B. Let vi be the vertices of the polytope vi ∈ V (Θψ (R)), then (12) holds if and only if vi ∈ Θψ (R + ǫx B) + ǫθ B. Equivalently, this means that there exists a rθ ∈ ǫθ B such that vi − rθ ∈ Θψ (R + ǫx B). This is equivalent to demanding that for every xTj ∈ V (R), vi ∈ V (Θψ (R)) and rx ∈ ǫx B, there exists a vector rθ ∈ ǫθ B: ai xis (0) i ∈ conv(xir (0)) + conv(xis (0)) ⊆ R∞ + X̄ver , P with i ai = 1 for ai ≥ 0 and where X̄ver = conv(xis (0)). We obtain that Xver ⊆ R∞ + X̄ver , and that the minimal positively invariant set R∞ Xver can be bounded by Sk i ∞ R + limk→∞ i=0 A X̄ver . Under condition of asymptotic stability on A, necessary for R∞ to be a bounded and convex polytope, Ai X̄ver will converge to {0n }. (k) Thus, the iteration RXver is monotonically increasing and bounded, hence it converges. If X̄ver includes the origin in its interior then there exists a finite iteration Sk+1 Sk such that i=0 Ai X̄ver = i=0 Ai X̄ver . Moreover, for any reachable pair (A, B) and asymptotically stable A, the closure of the minimal robustly positively invariant set R∞ Xver includes the origin.  (Inψ ⊗ (xTj + rxT ))Nψ + Kψ (vi − rθ ) ≤ Bψ  ⇔ (Inψ ⊗ xTj )Nψ + Kψ (vi − rθ )  + (Inψ ⊗ rxT )Nψ (vi − rθ ) ≤ Bψ . Take (vi − rθ ) = (1 − αi )vi with αi ∈ [0, 1), then  (Inψ ⊗ xTj )Nψ + Kψ (1 − αi )vi  + (Inψ ⊗ rxT )Nψ (1 − αi )vi ≤ Bψ (1 − αi )(Inψ ⊗ rxT )Nψ vi ≤ αi Bψ . ⇔ (13) Separate the matrix Nψ and Bψ into its block matrices Nψj = [Nψ ]{1+(j−1)n:nj}×{1:n} and B j = [Bψj ]j such that inequality (13) is equivalent to the set of inequalities Robust approximations of the feasible set via Θψ (·) In order to exploit convergence in the computation of the feasible set for invariance properties, we need to bound the error incurred with the use of approximations of the ∞ sets R∞ Xver or R . Let B denote a unit ball centred at the origin and let the Hausdorff distance between sets R1 and R2 be defined as (1 − αi )rxT Nψj vi′ ≤ αi bj , for j = 1, . . . , nψ αi ⇔ rxT Nψj vi′ ≤ bj . (1 − αi ) (14) (15) Given that 0 ∈ Θψ (R), it follows that bj ≥ 0 for j = 1, . . . , nψ δH (R1 , R2 ) = inf{ǫ ≥ 0|R1 ⊆ R2 + ǫB, R2 ⊆ R1 + ǫB}.   max rxT Nψj vi′ (bj )−1 ≤ j We can show that the following holds. αi . (1 − αi ) The term on the left can be upper bounded based on the Cauchy-Schwarz inequality Lemma 6 Consider a polytope R, and a property ψ comprised of ψ ::= α| ψ|ψ1 ∧ψ2 , with α ∈ Σ, for which Θψ (R) is a non-empty polytope with vertices vi and the origin in its interior. Let A be bounded as kAk2 ≤ 1. Then for any ǫx ≥ 0, Θψ (R + ǫx B) ⊆ Θψ (R) ⊆ Θψ (R + ǫx B) + ǫθ B (12)   max rxT Nψj vi′ (bj )−1 ≤ max k(Nψj )T rx k2 kvi′ k2 (bj )−1 j ≤ j j T max k(Nψ ) k2 krx k2 kvi′ k2 (bj )−1 j ≤ ǫx ǫp kvi′ k2 . (11) 9 and krx k2 ≤ ǫx 0n in its interior. The generalisation to the case dealing with an Hausdorff distance of the feasible set for invariance properties with a set of inputs 0 6∈ Uver is outside of the scope of this work. The last inequality follows from the introduction of the precision of the labelling, denoted as ǫp , and defined as ǫp = max p∈AP kAp k2 . |bp | (16) Convergence properties Remember that kL ⊗ Kk2 = kLk2 kKk2 . Then based on Theorem 3 and on the condition kAk2 ≤ 1, it can be shown that max k(Nψj )T k2 |bj |−1 ≤ max j p∈AP We can employ Lemma 6 to bound the Hausdorff dis(k) tance between Θψ (RXver ) and Θ✷ψ . If Xver = {0n } and the spectral radius of A is strictly less than 1 (that is ρ(A) < 1), then the Hausdorff distance can be bounded as kAp k2 . |bp | αi Note that (1−α monotonically increases with αi for i) αi ∈ [0, 1). Therefore a bound on αi can be found as δH (R(k) , R∞ ) ≤ ǫ(k) := kAk k2 max (|u|)c1 , u∈U P∞ i with c1 a bound on i=0 kA Bk, which is the peakto-peak performance of the dynamical system formed by (A, B). In case that Xver 6⊆ R∞ then the forward reachable iteration can be rewritten as αi = (ǫx ǫp kvi k)/(1 + ǫx ǫp kvi k) for j = 1, . . . , nψ . (17) It follows that (12) holds if ǫθ = max(kvi k2 ) ǫx ǫp max(kvi k2 ) . 1 + ǫx ǫp max(kvi k2 ) (19) (18) (k) RXver = For the case that the model is parameterised in both S and D, i.e., (A, B, C(θ), D(θ)) the derivation is a bit more cumbersome but can be repeated with no change to the end result. ✷ k [ i=0  Ai Xver + R(k) . The Hausdorff norm can be bounded as (k) k+1 k δ (X δH (RXver , R∞ 2 H ver , {0n }). Xver ) ≤ ǫ(k) + kA Note that for ρ(A) < 1 the norm kAk k2 → 0 for k → ∞. (k) In case the conditions of Lemma 6 on RXver ⊆ X and  (k) Θψ RXver hold, the Hausdorff distance δH (Θ✷k ψ , Θ✷ψ ) can be bounded by  kAk k2 max(kvi k)2 ǫp max (|u|)c1 + kAkδH (Xver , {0n }) . Let us briefly discuss the conditions under which Lemma 6 is applicable. The condition that Θψ (R) is not empty is raised to avoid the trivial case where Θψ (R) = ∅ (11) holds for all ǫθ . The condition that Θψ (R) is a polytope and hence bounded is necessary to obtain a bounded Hausdorff distance. This distance quantifies the difference between two sets, and is a necessary step to bound the approximation error. The requirement that Θψ (R) includes the origin is a sufficient condition and relates to well-posedness for bounded input sets including the origin. When considering invariance properties defined for 0 ∈ Uver and for any polytope Xver , the requirement that 0n ∈ Θψ (·) is necessary for Θ✷ψ to be non-empty: this can be intuitively illustrated by noting that under an assumption of asymptotic stability for A, for any θ and for u(·) = 0 the output ŷ(t, θ) of the model in (6) converges to 0. Hence for a property to be satisfied under these conditions it should at least hold for the zero output, which is equivalent to demanding that it holds for θ = 0n . For any atomic proposition pi ∈ AP (see Equation (5)) it can be shown that there is an invertible mapping between the row vectors, proportional to the normals of the faces of the polyhedral set Θpi (x(0)), and the initial state x(0). Therefore, if R(k) has the origin in its interior, then Θpi (R(k) ) has to be bounded, and as a consequence so has any feasible set comprising this atomic proposition. This holds for k ≥ n if (A, B) is a reachable pair and if Uver has 0 in its interior. Under (k) the same conditions there exists a k such that RXver has i u∈U (20) Use in the verification of unbounded-time properties Based on the convergence properties of the feasible set, the asymptotic behaviour of the confidence computed in Proposition 1 can be stated. Corollary 7 (Convergence) Under the conditions of Lemma 6, for a Gaussian distribution p (θ) ∼ N (µθ , Rθ ) with a covariance Rθ ≻ 0, P θ ∈ Θ✷k ψ → P (θ ∈ Θ✷ψ ) for k → ∞. Proof [of Corollary 7] For a strictly positive Rθ , the Gaussian density distribution takes finite values over the parameter space, therefore the convergence of a monotonically-decreasing polytope over the parameter space induces the convergence of the associated probability measure. ✷ Theorem 3 can now be generalised to include unboundedtime invariance properties as follows. 10 Based on R(k) , the feasible set for the k-bounded  invariance ✷k ι can be computed as Θ✷k ι = Θι R(k) . The feasible sets Θ✷k ι with k = 1, . . . , 20 are plotted in Figure 3b. Observe that the feasible set Θ✷1 ι is not bounded, but for k ≥ 2 the feasible sets are bounded and, as expected, decrease in size with time. In Figure 4 (middle plot) bounds on the Hausdorff distances δH (Θ✷ι , Θ✷k ι ) are given for k = 2, . . . , 20 (no finite bound is computed for the index k = 1, since for that instance the feasible set is not bounded). Let us conclude this case study looking at confidence quantification, as a function of the time horizon. Figure 4 (lower plot) represents  the confidence over the property P θ ∈ Θ✷k ι | Z Ns , for indices k = 1, . . . , 20. Unlike the case discussed in Section 3.3, which focused on looking at statistics of the confidence via mean and variance drawn over multiple experiments, we zoom in on asymptotic properties by considering a data set Z Ns comprising a single trace made up of 200 measurements, simulated under the same conditions as in Section 3.3, and with θ0 = [1 0]T . From the  resulting probability density distribution p θ | Z Ns , it may be observed that the confidence converges rapidly to a nonzero value. Theorem 8 Consider a polytopic set of initial states x(0) ∈ Xver , inputs u(t) ∈ Uver for t ≥ 0, and a labelling map as in (5). Let R̂∞ Xver be a polytopic superset of the minimal robustly positively invariant set that includes Xver , denoted as R∞ Xver ; then the feasible set admits a polyhedral subset Θ̂ψ ⊂ Θψ for every specification ψ expressed within the LTL fragment ∞ ψ := α| ψ|ψ1 ∧ ψ2 |✷ψ, and if R̂∞ Xver = RXver then Θ̂ψ = Θψ . Proof Every property φ ::= p| ψ|ψ1 ∧ ψ2 |✷ψ with p ∈ AP can be rewritten as ✷ψ1 ∧ ψ2 where ψ1 and ψ2 have syntax ψ ::= p| ψ|ψ1 ∧ ψ2 . For the set of initial states Xver , a property ψ is invariant hM(θ), x(0)i  ✷ψ, ∀x(0) ∈ Xver ∞ if and only if ∀x ∈ R∞ Xver : hM(θ), xi  ψ. Let R̂Xver be ∞ a polytopic superset of RXver with a finite set of vertices vR ∈ VR , then the subset approximation of the feasible set Θ✷ψ follows as Θ✷ψ ⊇ Θ̂✷ψ = θ∈Θ: ^ vR ∈VR T (Inψ ⊗ vR )Nψ + Kψ θ ≤ bψ  3.6 ) The discussed approach based on polytopes allows for analytical expressions of the feasible set, however the implementation may not scale to models with very large dimension: in particular, the number of half-planes characterising the feasible set may increase with the time bound of the LTL formula ψ (that is, with the repeated application of the operator), and with the cardinality of the atomic propositions in the alphabet Σ. Still, note that these computations are essentially quite similar to known reachability computations, therefore the method is extendable well beyond the 2-dimensional case study, especially when applying sophisticated reachabil- ∞ where Θ̂✷ψ ⊆ Θ✷ψ . Note that if R̂∞ Xver = RXver then Θ̂✷ψ = Θ✷ψ . The feasible set of ✷ψ1 ∧ ψ2 is equal to Θ✷ψ1 ∧ψ2 = Θ✷ψ1 ∩Θψ2 . And Θ✷ψ1 ∧ψ2 can be upper and lower bounded as Θ̂✷ψ1 ∩Θψ2 ⊆ Θ✷ψ1 ∧ψ2 ⊆ Θ✷k ψ1 ∩Θψ2 with k ∈ N. This proves Theorem 8 for the case where the model is (A, B, C(θ), 0). The additional parameterisation of D does not change the reasoning. ✷ The extension beyond the LTL fragment discussed above may lead to feasible sets that are in general not convex and are therefore beyond the scope of this work. 0.5 5 x2 3.5 Discussion on the Generalisation of the Results Case Study (cont.): Unbounded-Time Safety Verification 0 −0.5 We study convergence properties for the safety specification ι considered in the case study in Section 3.3 maintaining the same operating conditions as before for the safety verification and the experiment. In Figure 3a the forward reachability sets R(k) with k = 1, . . . , 20 are obtained for the model dynamics in (8). Figure 4 (upper plot) displays bounds ǫ(k) on the Hausdorff distances δH (R(k) , R∞ ) computed with (19): starting from a slanted line segment for R(1) as in Figure 3a, it can be observed that the forward reachable sets R(k) converge rapidly, as confirmed with the error bound displayed in Figure 4 (upper plot). θ2 ( −0.2 0 x1 0.2 (a) The first 20 iterations of the forward reachable set R(k) , k = 1, . . . , 20 for the case study. The reachable sets grow in size from dark grey (k = 1) to light grey (k = 20), so that R(k−1) ⊆ R(k) . 0 −5 −5 0 θ1 5 (b) The feasible sets for the k-bounded invariance property ✷k ι, with k = 1, . . . , 20, obtained for the case study. Fig. 3. Reachable and feasible sets for unbounded-time verification problem. 11 signal interaction for efficient data usage over general classes of models, as initially attempted in [17]. Additionally, the design of control policies that optimise properties of interest over partly unknown systems is topic of current work. ǫ(k) ≥ δH (R(k) , R(∞) ) 0.5 0 5 10 15 20 k ǫθ (k) ≥ δH (Θ✷ι , Θ✷k ι ) 3 1.5 0 5 10 15 References [1] A. Abate, R. C. Hillen, and S. A. Wahl. Piecewise affine approximation of fluxes and enzyme kinetics from in-vivo 13 C labeling experiments. International Journal of Robust and Nonlinear Control, pages 1120–1139, 2012. Special Issue on System Identification for Biological Systems. 20 k P θ ∈ Θ✷k ι | Z Ns 1 0.9 0.8 0 5 10  [2] C. Baier and J.-P. Katoen. Principles of model checking. MIT Press, 2008. 15 [3] E. Bartocci, L. Bortolussi, and G. Sanguinetti. Learning temporal logical properties discriminating ECG models of cardiac arrhythmias. CoRR, abs/1312.7523, 2013. 20 [4] G. Batt, C. Belta, and R. Weiss. Model checking genetic regulatory networks with parameter uncertainty. In HSCC, pages 61–75. Springer, 2007. Fig. 4. (Upper plot) Error bound on the approximation level of the k-th forward reachable sets, which is such that R(∞) ⊆ R(k) + ǫ(k) for k = 1, . . . , 20. (Middle plot) The Hausdorff distance ǫθ (k) between Θ✷k ψ and Θ✷ψ with k = 2, . . . , 20, obtained for the case study.(Lower plot) Confidence that S  ✷k ι for k = 1, . . . , 20 for the case in Section 3.3, with a new experiment consisting of 200 samples collected as Z Ns . [5] C. Belta, A. Bicchi, M. Egerstedt, E. Frazzoli, E. Klavins, and G. J. Pappas. Symbolic planning and control of robot motion [grand challenges of robotics]. Robotics Automation Magazine, IEEE, pages 61–70, Mar. 2007. [6] C. Belta, L. C. G. J. M. Habets, and V. Kumar. Control of multi-affine systems on rectangles with applications to hybrid biomolecular networks. In Conf.on CDC, pages 534–539, 2002. ity analysis tools in the literature. Therefore the discussed limitations related to the current implementation of the approach, ought to be dealt with in the future by the use of tailored and less naı̈ve computational approaches. [7] F. Blanchini and S. Miani. Set-Theoretic Methods in Control. Birkhäuser Basel, 1st edition, 2007. [8] L. Bortolussi and G. Sanguinetti. Learning and designing stochastic processes from logical constraints. In QEST, pages 89–105. Springer, 2013. [9] L. Bortolussi and G. Sanguinetti. Smoothed model checking for uncertain continuous time Markov chains. CoRR, abs/1402.1450, 2014. In the discussion of model selection, we hinted at possible generalisation beyond linearly-parameterised model sets. Future extension will deal with hybrid models, since when systems are not linear, their (local) behaviour is often well approximated with piecewise-linear dynamical models. [10] L. Brim, M. Češka, S. Dražan, and D. Šafránek. Exploring parameter space of stochastic biochemical systems using quantitative model checking. In N. Sharygina and H. Veith, editors, CAV, volume 8044 of LNCS, pages 1–17. Springer, 2013. This paper has discussed the formal verification of physical systems with partly unknown dynamics, by introducing a Bayesian framework allowing for the efficient incorporation of measurement data and prior information within a verification procedure based on safety analysis. This formal approach has allowed for the computation of the confidence level over the validity of a property of interest on the unknown system. The method has been applied to the verification of LTI models of systems over bounded and unbounded safety properties, and its computational overhead has been discussed at length. [11] J. W. Burdick, N. du Toit, A. Howard, C. Looman, J. Ma, R. M. Murray, and T. Wongpiromsarn. Sensing, navigation and reasoning technologies for the DARPA urban challenge. Technical report, DTIC Document, 2007. [12] Y. Chen and T. D. Nielsen. Active learning of Markov decision processes for system verification. In Conf. on Machine Learning and Applications, pages 289–294, 2012. [13] E. M. Clarke. The birth of model checking. In 25 Years of Model Checking, pages 1–26, 2008. [14] D. Del Vecchio and E. D. Sontag. Engineering principles in bio-molecular systems: From retroactivity to modularity. European Journal of Control, pages 389 – 397, 2009. [15] G. Frehse, S. K. Jha, and B. H. Krogh. A counterexampleguided approach to parameter synthesis for linear hybrid automata. In HSCC, pages 187–200. Springer Berlin Heidelberg, 2008. Looking forward, current work targets the extension of the applicability of tractable solutions to model-based and data-driven verification over complex physical systems. We are presently working to extensions of the considered set of logic formulae of interest, and plan to employ experiment design to optimise the input-output [16] B. M. Gyori, D. Paulin, and S. K. Palaniappan. Probabilistic verification of partially observable dynamical systems. CoRR, abs/1411.0976, 2014. 12 [17] S. Haesaert, P. M. J. Van den Hof, and A. Abate. Datadriven property verification of grey-box systems by Bayesian experiment design. In American Control Conference, pages 1800–1805, 2015. [36] P. Zuliani, A. Platzer, and E. M. Clarke. Bayesian statistical model checking with application to Stateflow/Simulink verification. Formal Methods in System Design, pages 338– 367, 2013. [18] D. Henriques, J. G. Martins, P. Zuliani, A. Platzer, and E. M. Clarke. Statistical model checking for Markov decision processes. In QEST, pages 84–93, 2012. Derivation of the Bounds in Section 3.4 [19] T. Henzinger and H. Wong-Toi. Using hytech to synthesize control parameters for a steam boiler. In Formal Methods for Industrial Applications, pages 265–282. Springer Berlin Heidelberg, 1996. 1. Hausdorff distance of forward reachable mappings. We only sketch the method to bound the Hausdorff distance, whereas a more formal derivation can be found in the literature on robustly positively invariant sets [7]. [20] P. S. C. Heuberger, P. M. J. Van den Hof, and O. H. Bosgra. A generalized orthonormal basis for linear dynamical systems. Automatic Control, IEEE Transactions on, 40(3):451–465, 1995. The k-step forward reachable set equals [21] P. S. C. Heuberger, P. M. J. Van den Hof, and B. Wahlberg. Modelling and identification with rational orthogonal basis functions. Springer London, 2005. [22] H. Hjalmarsson. From experiment design to closed-loop control. Automatica, pages 393–438, 2005. R(k) := [23] E. A. Lee. Cyber physical systems: Design challenges. In Proc. of Object Oriented Real-Time Distributed Computing, pages 363–369. IEEE Computer Society, 2008.  i k X [ i=1  j=1 Aj−1 Bu(i − j), for u(j) ∈ Uver   .  For 0 ∈ Uver , the minimal invariant set R∞ can be written as   ∞ i−1  X X Aj Bu(j) + Ai Ak Bu(k), for u(·) ∈ Uver . R(∞) :=   [24] A. Legay, B. Delahaye, and S. Bensalem. Statistical model checking: An overview. In H. Barringer, Y. Falcone, B. Finkbeiner, K. Havelund, I. Lee, G. Pace, G. Roşu, O. Sokolsky, and N. Tillmann, editors, Runtime Verification, volume 6418 of LNCS, pages 122–135. Springer Berlin Heidelberg, 2010. j=0 k=0 (.1) [25] A. Legay and S. Sedwards. Lightweight Monte Carlo algorithm for Markov decision processes. CoRR, abs/1310.3609, 2013. If the spectral radius of a A is strictly smaller than 1, ρ(A) < 1, then [26] D. V. Lindley. The philosophy of statistics. Journal of the Royal Statistical Society: Series D (The Statistician), pages 293–337, 2000. R(∞) ⊆ R(k) + ǫ(k)B, [27] H. Mao and M. Jaeger. Learning and model-checking networks of I/O automata. In Proc. of Asian Conference on Machine Learning, 2012. (.2) with [28] V. Peterka. Bayesian Approach to System Identification. Trends Prog. Syst. Identif., 1981. Ak [29] B. C. Reginato, R. Z. Freire, G. H. D. C. Oliveira, N. Mendes, and O. Abadie, Marc. Predicting the temperature profile of indoor buildings by using orthonormal basis functions. In Conf. on Building Performance Simulation Association, United Kingdom, 2009. ∞ X i=0 Ai Bu(k) ⊆ ǫ(k)B, for u(·) ∈ Uver . Note that ǫ(k) is bounded for ρ(A) < 1. For a matrix A without defective eigenvalues, i.e. where the eigenvectors form a complete basis, this L1 norm can be easily bounded using the spectral radius of A, by selecting [30] K. Sen, M. Viswanathan, and G. Agha. Learning continuous time Markov chains from sample executions. In QEST, pages 146–155, 2004. [31] K. Sen, M. Viswanathan, and G. Agha. Statistical model checking of black-box probabilistic systems. In R. Alur and D. Peled, editors, CAV, volume 3114 of LNCS, pages 202– 215. Springer, 2004. ǫ(k) = [32] P. Tabuada. Verification and Control of Hybrid Systems: a Symbolic Approach. Springer, 2009. ∞ X |ρ(A)|k kAi Bk2 |u(k)|. kBk2 max (|u|) ≥ kAk k2 u∈Uver 1 − |ρ(A)| i=0 In case that the matrix A is defective, we opt to bound the L1 -norm by exploitingPabsolute sum of the L2 in∞ duced norm for Ai i → ∞: i=0 kAi k2 . Note that kAi k2 converges to 0 for i → ∞ since ρ(A) < 1, therefore there exists a finite l such that kAl k2 < 1 and we can upper bound the absolute sum as ! ! ∞ l−1 ∞ X X X l i2 i1 i kA k2 kA k2 kA k2 ≤ [33] P. M. J. Van den Hof, P. S. C. Heuberger, and J. Bokor. System identification with generalized orthonormal basis functions. Automatica, pages 1821–1834, 1995. [34] M. Y. Vardi. From philosophical to industrial logics. In Proc. of the Indian Conference on Logic and Its Applications, pages 89–115, Berlin, Heidelberg, 2009. Springer-Verlag. [35] G. S. Virk and D. L. Loveday. Model-based control for HVAC applications. In Conf. on Control Applications, pages 1861– 1866. IEEE, 1994. i=0 13 i1 =0 i2 =0 = l−1 X i1 =0 i1 kA k2 ! 1 . 1 − kAl k2 Thus in general, the Hausdorff distance can be bounded as δH (R(k) , R(∞) ) ≤ ǫ(k) = kAk k2 max (|u|)c1 , u∈Uver P l i1 =0 kAi1 k2  kBk2 for l such that kAl k2 < with c1 = 1−kAl k2 1. Note that c1 can be replaced by any bound on the L1 norm of the dynamical system formed by (A, B). In case that Xver 6⊆ R∞ then the forward reachable iteration can be rewritten as ! k [ (k) i RXver = A Xver + R(k) , i=0 for which we know that (∞) (k) RXver ⊆ RXver + ǫ(k) + kAkk+1 δH (Xver , {0}). Thus the Hausdorff norm is upper bounded as (∞) (k) δH (RXver , RXver ) ≤ ǫ(k) + kAk+1 kδH (Xver , {0}). 2. Hausdorff distance on feasible sets. Suppose (k) that the conditions in Lemma 6 hold for RXver , then (k) we can compute a value for ǫθ such that Θψ (RXver ) ⊆ (k) Θψ (RXver +ǫx B)+ǫθ B, where ǫx is a bound on the Haus(k) (∞) dorff distance δH (RXver , RXver ). The set operation Θψ (·) is monotonically decreasing,  (k) therefore Θψ (RXver + ǫ(k)B) ⊆ Θ✷ψ = Θψ R∞ Xver ⊆   (k) (k) Θψ RXver = Θ✷k ψ , and Θ✷k ψ ⊆ Θψ (RXver + ǫ(k)B)+ ǫθ B ⊆ Θ✷ψ + ǫθ B, and Θ✷ψ ⊆ Θ✷k ψ ⊆ Θ✷ψ + ǫθ B. Based on Lemma 6, with ǫp = maxpi ǫθ = |Api | |bpi | , we obtain ǫx ǫp maxi (kvi k)2 ≤ ǫx ǫp max(kvi k)2 . i 1 + ǫx ǫp maxi (kvi k) Note that since kAk k2 converges to 0 for k → ∞ for ρ(A) < 1, and since maxi (kvi k)2 is not increasing, the error ǫθ also converges to 0. 14
3cs.SY
arXiv:1312.6461v3 [cs.LG] 19 Feb 2014 Nonparametric Weight Initialization of Neural Networks via Integral Representation Sho Sonoda, Noboru Murata Schools of Advanced Science and Engineering Waseda University Shinjuku, Tokyo 169-8555 [email protected], [email protected] Abstract A new initialization method for hidden parameters in a neural network is proposed. Derived from the integral representation of neural networks, a nonparametric probability distribution of hidden parameters is introduced. In this proposal, hidden parameters are initialized by samples drawn from this distribution, and output parameters are fitted by ordinary linear regression. Numerical experiments show that backpropagation with proposed initialization converges faster than uniformly random initialization. Also it is shown that the proposed method achieves enough accuracy by itself without backpropagation in some cases. 1 Introduction In the backpropagation learning of a neural network, the initial weight parameters are crucial to its final estimates. Since hidden parameters are put inside nonlinear activation functions, simultaneous learning of all parameters by backpropagation is accompanied by a non-convex optimization problem. When the machine starts from an initial point far from the goal, the learning curve easily gets stuck in local minima or lost in plateaus, and the machine fails to provide good performance. Recently deep learning schemes draw tremendous attention for their overwhelming high performances for real world problems[1, 2]. Deep learning schemes consist of two stages: pre-training and fine-tuning. The pre-training stage plays an important role for the convergence of the following fine-tuning stage. In pre-training, the weight parameters are constructed layer by layer, by stacking unsupervised learning machines such as restricted Boltzmann machines[3] or denoising autoencoders[4]. Despite the brilliant progress in application fields, theoretical interpretation of the schemes is still an open question[5]. In this paper we introduce a new initialization/pre-training scheme which could avoid the nonconvex optimization problem. The key concept is the probability distribution of weight parameters derived from Murata’s integral representation of neural networks[6]. The distribution gives an intuitive idea what the parameters represent and contains information about where efficient parameters exist. Sampling from this distribution, we can initialize weight parameters more efficiently than just sampling from a uniform distribution. In fact, for relatively simple or low dimensional problems, our method by itself attains a high accuracy solution without backpropagation. De Freitas et al.[7] also introduced a series of stochastic learning methods for neural networks based on the Sequential Monte Carlo (SMC). In their methods the learning process is iterative and initial parameters are given by less informative distributions such as normal distributions. On the other hand we could draw the parameters from a data dependent distribution. Furthermore, in SMC, the number of hidden units must be determined before the learning, while it is determined naturally in our method. 1 2 Back ground and related works One of the most naive initialization heuristics is to draw samples uniformly from an interval [−α, α]. Nguyen and Widrow[8] gave two fundamental points of view. First, since a typical activation function such as sigmoid and hyperbolic tangent is approximated as a linear function at its inflection point, one should initialize the hidden parameters in such a way that the inputs for each hidden unit are in the linear region. Second, since each hidden unit determines the slice of the Fourier transformed input space, that is, each individual hidden unit responds selectively to only the inputs whose spatial frequency is in a particular band, one should initialize hidden parameters in such a way that the corresponding frequency bands cover the possible input frequencies. LeCun et al.[9] also emphasized the need to preset parameters in the linear region because parameters outside the linear region have small gradients and stray into more difficult nonlinear regions. They focused on the curvature of input vectors and proposed to use α ∝ m−1/2 , where m is the fanin, or the dimensionality of input vectors. Shimodaira[10] proposed to initialize parameters such that corresponding activation regions to cover whole the possible inputs. Linear algebraic techniques are also employed. For example, Shepanski[11] used the pseudo inverse to determine the parameters of linear approximated neural networks, and Yam and Chow[12] used the QR decomposition. Integral transform viewpoints originated from more theoretical backgrounds than linear region viewpoints: the theoretical evaluation of the approximation power of neural networks. In the earliest stage, purely functional analysis methods were employed. In 1957 Kolmogorov[13] showed that any multivariate continuous functions can be exactly represented by sums of compositions of different continuous functions of only one variable. Inspired by the Kolmogorov’s theorem, HechtNielsen[14] and Kůrková[15] applied the idea to neural networks, which are sums of compositions of the same sigmoid function. Sprecher[16] gave more constructive version of the proof and later implemented the improved proof as a learning algorithm of neural networks[17]. In 1989 the universal approximation property of single layer neural networks has been investigated and the integral transform aspects emerged. Carroll and Dickinson[18] introduced the Radon transform and Funahashi[19] used the Fourier analysis and the Paley-Weiner theory, whereas Cybenko[20] employed the Hahn-Banach and Riesz Representation theorems. In the following years, upper bounds of the approximation error were investigated[21, 22, 6]. Barron[22] refined the Jones’ result[21] using the weighted Fourier transform. Kůrková[15] later developed the general theory of integral transforms. Inspired by the Barron’s result, Murata[6] introduced a family of integral transforms defined by ridge functions, which are regarded as a hybrid of the Radon and wavelet transforms. Candés[23] inherited Murata’s transforms and developed ridgelets, which was the beginning of the series of multiscale “-lets” analysis[24]. Those multiscale viewpoints also inherits the selective activation properties of neural networks. Denoeux and Lengellé[25] proposed to collect K prototype vectors as initial hidden parameters. Each prototype pk is drawn from its corresponding cluster Ck , where the clusters {Ck }K k=1 are formed in a stereographically projected input space. In this manner each prototype pk comes to selectively respond to the input vectors x which belongs to the cluster Ck . This study is based on the integral transform viewpoint, and proposes a new way for practical implementation. Although integral transforms have been well studied as theoretical integral representations of neural networks, practical implementations for training have been merely done. However integral representations have big advantage over linear region viewpoints in that they can give global directions how each neural units should behave, while the latter only give local directions. 3 3.1 Nonparametric weight initialization via integral transform Sampling based two-stage learning Let g : Rm → R be a neural network with a single hidden layer expressed as g(x) = J X wj φ (aj · x − bj ) + w0 , j=1 2 (1) where the map φ is called the activation function; aj and bj are called hidden parameters, and wj are 1 output parameters. With an ordinary sigmoid function σ(z) := 1+exp(−z) , the activation function φ is supposed to be the sigmoid pair in the form 1 {σ(z + h) − σ(z − h)} , (h > 0), (2) φ(z) := H where H := σ(h) − σ(−h) normalizes the maximum value of φ to be one. We consider an oracle distribution p(a, b) of hidden parameters. If such a distribution exists, we can sample and fix these hidden parameters according to p(a, b) first, and then we could fit the rest output parameters by ordinary linear regression. We call this two-stage framework as Sampling Regression (SR) learning. The candidates of p(a, b) could be some parametric distributions such as normal distributions or uniform distributions. In the following sections we derive a data dependent distribution from an integral representation of neural networks. 3.2 Integral representations of neural networks Consider approximating a map f : Rm → R with a neural network. Murata[6] defined an integral transform T of f with respect to a decomposing kernel φd as Z 1 T (a, b) := φd (a · x − b)f (x)dx, (3) C Rm where C is a normalizing constant. Murata also showed that given the decomposing kernel φd , there exists the associating composing kernel φc such that for any f ∈ L1 (Rm ) ∩ Lp (Rm )(1 ≤ p ≤ ∞), the inversion formula Z 2 f (x) = lim φ∗c (a · x − b)T (a, b)e−|a| dadb in Lp , (4) →0 Rm+1 2 ∗ holds (Th.1 in [6]) where · denotes the complex conjugate. The convergence factor e−|a| is omitted when T ∈ L1 (Rm+1 ), which is attained when f is compactly supported and C m,α -Hölder continuous with 0 < α ≤ 1 (Th.3 in [6]), or compactly supported and bounded C m+1 -smooth (Cor.2 in [6]). In particular one can set a composing kernel φc as a sigmoid pair φ given in Eq.2 and the associating decomposing kernel as:  (m) ρ (z) if m is even φd (z) = , (5) ρ(m+1) (z) otherwise where ρ is a nonnegative C ∞ -smooth function whose support is in the interval  [−1,  1]. Such a ρ does exist and is known as a mollifier[26].The standard mollifier ρ(z) = exp example. 1 z 2 −1 is a well-known Hereafter we assume φc is a sigmoid pair and φd is the corresponding derivative of the standard mollifier. We also assume that our target f is a bounded and compactly supported C (m+1) -smooth function. Then the integral transform R T of f is absolutely integrable and the inversion formula is reduced to the direct form f (x) = Rm+1 φ∗c (a · x − b)T (a, b)dadb. Let τ (a, b) be a probability distribution function over Rm+1 which is proportional to |T (a, b)|, and c(a, b) be satisfying c(a, b)τ (a, b) = T (a, b) for all (a, b) ∈ Rm+1 . With this notations, the inversion formula is rewritten as the expectation form with respect to τ (a, b), that is, Z f (x) = c(a, b)φc (a · x − b)τ (a, b)dadb. (6) Rm+1 The expression implies the finite sum J 1X c(aj , bj )φc (aj · x − bj ), gJ (x) := J j=1 i.i.d. (aj , bj ) ∼ τ (a, b) (7) converges to f in mean square as J → ∞, i.e. E[gJ ] = f and Var[gJ ] < ∞ holds for any J (Th.2 in [6]). Here gJ is a neural network with 2J hidden units, therefore we can regard the inversion formula as an integral representation of neural networks. 3 3.3 Practical calculation of the integral transform Now we attempt to make use of the integral transform |T (a, b)| as an oracle distribution p(a, b) of hidden parameters. Although the distribution is given in the explicit form as we saw in the preceding section, further refinements are required for practical calculation. m Given a set {(xn , yn )}N n=1 ⊂ R ×R of input and output pairs, T (a, b) is empirically approximated as N 1 X T (a, b) ≈ φd (a · xn − b)yn , (8) Z n=1 with some constant Z > 0 which is hard to calculate exactly. In fact sampling algorithms such as the acceptance-rejection method[27] and Markov chain Monte Carlo method[27] work with any unnormarized distribution because they only evaluate the ratio between probability values. Note that the approximation converges to the exact T (a, b) in probability by the law of large numbers only when the input vectors are i.i.d. samples from a uniform distribution. As a decomposing kernel φd we make use of the k-th order derivative of the standard mollifier ρ(z) = exp z21−1 where k = m if m is even and k = m + 1 otherwise. The k-th derivative ρ(k) (z) of the mollifier takes the form Pk (z) ρ(k) (z) = 2 ρ(z) (k = 0, 1, 2, · · · ), (9) (z − 1)2k where Pk (z) denotes a polynomial of z which is calculated by the following recurrence formula: P0 (z) ≡ Pk+1 (z) = 1 (const.),  Pk0 (z)(z 4 − 2z 2 + 1) + Pk (z) −4kz 3 + 2(2k − 1)z . (10) (11) The higher order derivatives of a mollifier has more rapid oscillations in the neighbourhoods of both edges of its support. m Given a data set D := {(xn , yn )}N n=1 ⊂ R × R, our Sampling Regression method is summarized as below: 0. Preliminary stage: Calculate ρ(k) (z) according to Eq.9, Eq.10 and Eq.11, where k = m if m is even and k = m + 1 otherwise. Then T (a, b) is calculated by Eq.8 with setting φd = ρ(k) . As we noted above, one can choose arbitrary Z > 0. 1. Sampling stage: Draw J samples {(aj , bj )}Jj=1 from the probability distribution τ (a, b) ∝ |T (a, b)| by acceptance-rejection method, where J denotes the number of hidden (sigmoid pair) units. Then we obtain the hidden parameters {(aj , bj )}Jj=1 . 2. Regression stage: Let φjn := φd (aj · xn − bj ) for all j = 1, · · · , J and n = 1, · · · , N . PJ Solve the system of linear equations yn = j=1 wj φjn + w0 (n = 1 · · · N ) with respect to {wj }Jj=0 . Then we obtain the output parameters {wj }Jj=0 . 3.4 For more efficient sampling Generally |T (a, b)| is ill-shaped and sampling from the distribution is difficult. For example in Fig.1 Left, samples drawn from |T (a, b)| of f (x) = sin 2πx with x ∈ [−1, 1] is plotted. Whereas in Fig.1 Right, the same distribution is transformed to another (α, β)-coordinate system (which is explained below). The support of the distribution is reshaped into a rectangular, which implies sampling from |T (α, β)| is easier than doing from |T (a, b)|. This ill-shapeness is formulated as following proposition. Proposition 3.1. Suppose the objective function f (x) has a compact support, then the support of its transform T (a, b) is in the region Ω := {(a, b) | |b| ≤ M kak + 1} with M := maxx∈supp f kxk. Proof. Recall the support of φd is included in the interval [−1, 1], therefore for any a, b and x, φd (a · x − b) 6= 0 implies |a · x − b| < 1. The latter condition is equivalently deformed to a · x − 1 < b < a · x + 1, which implies |b| < |a · x| + 1. By the compact support assumption of f , 4 Figure 1: Sample parameters drawn from |T (a, b)| of sin 2πx case. Red lines indicate the theoretical boundary b = ±(M kak + 1) of the support of |T (a, b)|. Left: |T (a, b)| has a non-convex support, in which case sampling is inefficient. Right: The same sample points are plotted in the coordinate transformed (α, β)-space. Coordinate lines are deformed to lattice lines, and |T (α, β)| has a rectangular support. taking the maximum with respect to x leads to |b| < M kak + 1. By tracking back the inferences, for any a, b and x ∈ supp f , (a, b) ∈ / Ω ⇒ φd (a · x − b) = 0. (12) Since for any x ∈ / supp f , the integrand of T (a, b) is always zero, the integration domain of T (a, b) can be restricted into supp f . Therefore by Eq.12, T (a, b) 6= 0 ⇒ (a, b) ∈ Ω (13) holds, which comes to the conclusion: supp T ⊂ Ω. In a relatively high dimensional input case, sampling in the coordinate transformed (α, β)-space     a α = , (14) b (M kαk + 1)β is more efficient than sampling in the (a, b)-space because the shape of the support of |T (a, b)| in the (α, β)-space is rectangular (see, Fig.1) and therefore the proposal distribution is expected to reduce miss proposals, out of the support. In case that the coordinate transform technique is not enough, it is worth sampling from each component distribution. Namely, the empirically approximated |T (a, b)| is bounded above by a mixture distribution: |T (a, b)| ≈ N 1 X yn φd (a · xn − b) Z n=1 ≤ ∝ N 1 X |yn ||φd (a · xn − b)|, Z n=1 N X ηn pn (a, b), (15) n=1 where pn (a, b) ∝ |φd (a·xn −b)| is a component distribution and ηn ∝ |yn | is a mixing probabilities. In addition, an upper bound of φd is given by the form log |φd (z)| ≤ Az 2 + B, for some A > 0 and B. 5 (16) 4 Experimental results We conducted three sets of experiments comparing three types of learning methods: BP Whole parameters are initialized by samples from a uniform distribution, and trained by BackPropagation. SBP Hidden parameters are initialized by Sampling from |T (a, b)|; and the rest output parameters are initialized by samples from a uniform distribution. Then whole parameters are trained by BackPropagation. SR Hidden parameters are determined by Sampling from |T (a, b)|; the rest output parameters are fitted by linear Regression. In order to compare the ability of the three methods, we conducted three experiments on three different problems: One-dimensional complicated curve regression, Multidimensional Boolean functions approximation and Real world data classification. 4.1 One-dimensional complicated curve regression - Topologist’s sine curve sin 2π/x Figure 2: Training results of three methods for fitting the topologist’s sine curve sin 2π/x. Left: SR (solid black line) by itself achieved the highest accuracy without the iterative learning, whereas SBP (dashed red line) converged to lower RMSE than BP (dotted green line). Right: The original curve (upper left) has high frequencies around the origin. SR (upper right) followed such a dynamic variation of frequency better than other two methods. SBP (lower left) roughly approximated the curve with noise. BP (lower right) only fitted moderate part of the curve. First we performed one-dimensional curve regression. The objective function is a two-sided topologists’s sine curve (TSC) f (x) := sin 2π/x defined on the interval [−1, 1] whose indefiniteness at zero is removed by defining f (0) = 0. The TSC is such a complicated curve whose spatial frequency gets arbitrary high as x tends to zero. For training, 201 points were sampled from the domain [−1, 1] in equidistant manner. The number of hidden parameters were fixed to 100 in each model. Note that relatively redundant quantity of parameters are needed for our sampling initialization scheme to obtain good parameters. The output function was set to linear and the batch learning was performed by BFGS quasi-Newton method. Uniformly random initialization parameters for BP and SBP were drawn from the interval [−1, 1]. Sampling from |T (a, b)| was performed by acceptance-rejection method. In Fig.2 Left, the Root Mean Squared Error (RMSE) in training phase of three methods are shown. The solid black line corresponds to the result by SR, which by itself achieved the highest accuracy without iterative learnings. The dashed red line corresponds to the result by SBP, and it converged to lower RMSE than that of BP depicted in the dotted green line. In Fig.2 Right, fitting results of the three methods are shown. As we noted the original curve (upper left) has numerical instability 6 around the origin, therefore it is difficult to fit the curve. SR (upper right) approximated the original curve well except around the origin, while other two methods, SBP (lower left) and BP (lower right) could just partly fit the original curve. In this experiment, we examined the flexibility of our method by fitting a complicated curve. The experimental result supports that the oracle distribution gave advantageous directions. 4.2 Multidimensional Boolean functions approximation - Combined AND, OR and XOR Second we performed a binary problem with twodimensional input and three-dimensional output. Output vectors are composed of three logical functions: F (x, y) := (xANDy, xORy, xXORy). Therefore the total number of data is just four: (x, y) ∈ {(0, 0), (0, 1), (1, 0), (1, 1)}. The number of hidden units were fixed to 10. The output function was set to sigmoid and the loss function was set to cross-entropy. Uniformly random initialization parameters for BP and SBP were drawn from the interval [−1, 1]. Sampling from |T (a, b)| was performed by acceptance-rejection method. In Fig.3 both the cross-entropy curves and classification error rates are depicted in thin and thick lines respectively. The solid black line corresponds to the results by SR, which achieved the perfectly correct answer from the beginning. The dashed red line cor- Figure 3: Cross-entropy curves (thin lines) responds to the results by SBP, which also attained and classification error rates (thick lines). the perfect solution faster than BP. The dotted green SR (solid black line) achieved the perfectly line corresponds to the results by BP, which cost 100 correct answer from the beginning. SBP iterations of learning to give the correct answer. In (dashed red line) also attained the perfect this experiment we have validated that the proposed solution faster than BP. BP (dotted green method works well with multiclass classification prob- line) costed 100 iterations of learning to lems. The quick convergence of SBP indicates that give the correct answer. |T (a, b)| contains advantageous information on the training examples to the uniform distribution. 4.3 MNIST Finally we examined a real classification problem using the MNIST data set[28]. The data set consists of 60, 000 training examples and 10, 000 test examples. Each input vector is a 256-level gray-scaled (28 × 28 =)784-pixel image of a handwritten digit. The corresponding label is one of 10 digits. We implemented these labels as 10-dimensional binary vectors whose components are chosen randomly with equivalent probability for one and zero. We used randomly sampled 15, 000 training examples for training and whole 10, 000 testing examples for testing. The number of hidden units were fixed to 300, which is the same size as used in the previous study of LeCun et al.[29]. Note that J sigmoid pairs corresponds to 2J sigmoid units, therefore we used 150 sigmoid pairs for SR and SBP, and 300 sigmoid units for BP. The output function was set to sigmoid and the loss function was set to cross-entropy. In obedience to LeCun et al.[9], input vectors were normalized and randomly initialized parameters for BP and SBP were drawn from uniform distribution with mean zero and standard deviation 784−1/2 ≈ 0.0357. 7 Figure 4: Test classification error rates for MNIST dataset. SR (black real line) marked 23.0% at the beginning and finished 9.94%, the error reascent suggests that SR may have overfitted. SBP (red dashed line) reduced the fastest and finished 8.30%. BP (green dotted line) declined the slowest and finished 8.77%. Direct sampling from |T (a, b)| is numerically difficult because the differential order of its decomposing kernel φd piles up as high as 784-th order. We abandoned rigorous sampling and tried sampling from a mixture annealed distribution. As described in Eq.15, we regarded |T (a, b)| as a mixture of |φd (a · xn − b)|. By making use of the log boundary given by Eq.16, we numerically approximated φd (z) from above log |φd (z)| ≤ 2800z 2 − 800, (|z| < 1), (17) and drew samples from an easier component distribution pn (a, b) ∝ exp{2800(a · xn − b)2 − 800}. Details of the sampling technique is explained in A.2. The sampling procedure scales linearly with the dimensionality of the input space (784) and the number of required hidden units (150) respectively. In particular it scales constantly with the number of the training examples. The following linear regression was conducted by singular value demcomposition (SVD), which generally costs O(mn2 ) operations, assuming m ≥ n, for decomposing a m × n-matrix. In our case m corresponds to the number of the training examples (15, 000) and n corresponds to the number of hidden units (300). At last backpropagation learning was performed by stochastic gradient descent (SGD) with adaptive learning rates and diagonal approximated Hessian[30]. The experiment was performed in R[31] on a Xeon X5660 2.8GHz with 50GB memory. In Fig.4 the classification error rates for test examples are depicted. The black real line corresponds to the results by SR, which marked the lowest error rate (23.0%) of the three at the beginning, and finished 9.94% after 45, 000 iterations of SGD training. The training process was not monotonically decreasing in the early stage of training, it appears that the SR initialization overfitted to some extent. The red dashed line corresponds to the results by SBP, which marked the steepest error reduction in the first 5, 000 iterations of SGD training and finished 8.30%. The green dotted line corresponds to the results by BP, which declined the slowest in the early stage of training and finished 8.77%. In Tab.1 the training time from initialization through SGD training is listed. The sampling step in SR ran faster than the following regression and SGD steps. In addition, the sampling time of SR and SBP was as fast as the sampling time of BP. As we expected, the regression step in SR, which scales linearly with the amount of the data, cost much more time than the sampling step did. The SGD step also cost, however each step cost around merely 0.05 seconds, and it would be shorten if the initial parameters had better accuracy. Table 1: Training Times for MNIST Method SR SBP BP Sampling [s] 1.15 × 10−2 1.14 × 10−2 1.15 × 10−2 Regression [s] 2.60 - BP by SGD (45, 000 itrs.) [s] 2.00 × 103 2.31 × 103 2.67 × 103 In this experiment, we confirmed that the proposed method still works for real world data with the aid of an annealed sampling technique. Although SR showed an overfitting aspects, the fastest convergence of SBP supports that the oracle distribution gave meaningful parameters, and the annealed sampling technique could draw meaningful samples. Hence the overfitting of SR possibly comes from regression step, which suggests the necessity for further blushing up of regression technique. In addition, our further experiments also indicated that when the number of hidden units increased to 6, 000, the initial test error rate scored 3.66%, which is smaller than the previously reported error rates 4.7% by LeCun et al.[29] with 300 hidden units. 5 Conclusion and future directions In this paper, we introduced a two-stage weight initialization method for backpropagation: sampling hidden parameters from the oracle distribution and fitting output parameters by ordinary linear regression. Based on the integral representation of neural networks, we constructed our oracle distributions from given data in a nonparametric way. Since the shapes of those distributions are not simple in high dimensional input cases, we also discussed some numerical techniques such as the coordinate transform and the mixture approximation of the oracle distributions. We performed three numerical experiments: complicated curve regression, Boolean function approximation, and 8 handwritten digit classification. Those experiments show that our initialization method works well with backpropagation. In particular for the low dimensional problems, well-sampled parameters by themselves achieve good accuracy without any parameter updates by backpropagation. For the handwritten digit classification problem, the proposed method works better than random initialization. Sampling learning methods inevitably come with redundant hidden units since drawing good samples usually requires a large quantity of trial. Therefore the model shrinking algorithms such as pruning, sparse regression, dimension reduction and feature selection are naturally compatible to the proposed method. Although plenty of integral transforms have been used for theoretical analysis of neural networks, numerical implementations, in particular sampling approaches are merely done. Even theoretical calculations often lack practical applicability, for example a higher order of derivative in our case, each integral representation interprets different aspects of neural networks. Further Monte Carlo discretization of other integral representations is an important future work. In the deep learning context, it is said that the deep structure remedies the difficulty of a problem by multilayered superpositions of simple information transformations. We conjecture that the complexity of high dimensional oracle distributions can be decomposed into relatively simple distributions in each layer of the deep structure. Therefore, extending our method to the multilayered structure is our important future work. Acknowledgments The authors are grateful to Hideitsu Hino for his incisive comments on the paper. They also thank to Mitsuhiro Seki for having constructive discussions with them. References [1] Q. Le, M. Ranzato, R. Monga, M. Devin, K. Chen, G. Corrado, J. Dean, and A. Ng. Building high-level features using large scale unsupervised learning. In J. Langford and J. Pineau, editors, ICML2012, pages 81–88, 2012. [2] G. E. Dahl, D. Yu, L. Deng, and A. Acero. Context-dependent pre-trained deep neural networks for largevocabulary speech recognition. IEEE Transactions on Audio, Speech & Language Processing, 20(1), 2012. [3] G. E. Hinton, S. Osindero, and Y.-W. Teh. A fast learning algorithm for deep belief nets. Neural Computation, 18(7):1527–1554, 2006. [4] Y. Bengio, P. Lamblin, D. Popovici, and H. Larochelle. Greedy layer-wise training of deep networks. In Bernhard Scholkopf, John Platt, and Thomas Hoffman, editors, NIPS ’06, pages 153–160, 2007. [5] Y. Bengio., A. Courville., and P. Vincent. Representation learning: A review and new perspectives. PAMI, 35(8):1798–1828, 2013. [6] N. Murata. An integral representation of functions using three-layered networks and their approximation bounds. Neural Networks, 9(6):947–956, 1996. [7] J. F. G. de Freitas, M. Niranjan, A. H. Gee, and A. Doucet. Sequential monte carlo methods to train neural network models. Neural Computation, 12(4):955–993, 2000. [8] D. Nguyen and B. Widrow. Improving the learning speed of 2-layer neural networks by choosing initial values of the adaptive weights. In IJCNN 1990, volume 3, pages 21–26, 1990. [9] Y. LeCun, L. Bottou, G. B. Orr, and K.-R. Müller. Efficient backprop. In G. Montavon, G. B. Orr, and K.-R. Müller, editors, Neural Networks: Tricks of the Trade (2nd ed.), pages 9–48. Springer, 2012. [10] H. Shimodaira. A weight value initialization method for improving learning performance of the backpropagation algorithm in neural networks. In ICTAI1994, pages 672–675, 1994. [11] J. F. Shepanski. Fast learning in artificial neural systems: multilayer perceptron training using optimal estimation. In ICNN1988, volume 1, pages 465–472, 1988. [12] J. Y. F. Yam and T. W. S. Chow. A weight initialization method for improving training speed in feedforward neural network. Neurocomputing, 30(1-4):219–232, 2000. [13] A. N. Kolmogorov. On the representation of continuous functions of several variables by superposition of continuous functions of one variable and addition. Doklady Akademii Nauk SSSR, 114:369–373, 1957. 9 [14] R. Hecht-Nielsen. Kolmogorov’s mapping neural network existence theorem. In ICNN1987, volume III, pages 11–13, 1987. [15] V. Kůrková. Kolmogorov’s theorem is relevant. Neural Computation, 3(4):617–622, 1991. [16] D. A. Sprecher. On the structure of continuous functions of several variables. Transactions of the AMS, 115:340–355, 1965. [17] D. A. Sprecher. A numerical implementation of kolmogorov’s superpositions. 9(5):765–772, 1996. Neural Networks, [18] S. M. Carroll and B. W. Dickinson. Construction of neural nets using the radon transform. In IJCNN 1989, volume 1, pages 607–611, 1989. [19] K. Funahashi. On the approximate realization of continuous mappings by neural networks. Neural Networks, 2(3):183–192, 1989. [20] G. Cybenko. Approximation by superpositions of a sigmoidal function. MCSS, 2(4):303–314, 1992. [21] L. K. Jones. A simple lemma on greedy approximation in hilbert space and convergence rates for projection pursuit regression and neural network training. The Annals of Statistics, 20(1):608–613, 1992. [22] A.R. Barron. Universal approximation bounds for superpositions of a sigmoidal function. IEEE Transactions on Information Theory, 39(3):930–945, 1993. [23] E. J. Candes. Ridgelets: Theory and Applications. PhD thesis, Standford University, 1998. [24] J. Fadili and J. L. Starck. Curvelets and ridgelets. In R. A. Meyers, editor, Encyclopedia of Complexity and Systems Science, volume 3, pages 1718–1738. Springer New York, 2009. [25] T. Denoeux and R. Lengelle. Initializing back propagation networks with prototypes. Neural Networks, 6(3):351–363, 1993. [26] K. O. Friedrichs. The identity of weak and strong extensions of differential operators. Transactions of the AMS, 55(1):132–151, 1944. [27] C. M. Bishop. Pattern Recognition and Machine Learning. Springer, 2006. [28] C. J. C. Burges Y. LeCun, C. Cortes. The mnist database of handwritten digits. http://yann.lecun. com/exdb/mnist/. [29] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, volume 11, pages 2278–2324, 1998. [30] L. Bottou. Online algorithms and stochastic approximations. In D. Saad, editor, Online Learning and Neural Networks. Cambridge University Press, 1998. [31] R Core Team. R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria, 2013. Supplementary materials A Sampling recipes Sampling hidden parameter (a, b)’s from the oracle distribution p(a, b) demands a little ingenuity. In our experiments, we have implemented two sampling procedures: a rigorous but naive, computationally inefficient way and an approximative/ad hoc but quick and well-performing way. Although both work quickly and accurately in a low dimensional input problem, only the latter works in a high dimensional problem such as MNIST. A.1 Sampling from rigorous oracle distribution Given a decomposing kernel φd (z) := ρ(m) (z), we employed acceptance-rejection (AR) method directly on rigorous sampling from p(a, b) On a proposal distribution q(a, b), we employed uniform distribution. We assume here that the support Ω of proposal distribution q(a, b) has been adjusted to cover the mass of p(a, b) as tight as possible, and the infimum k := inf p(a, b)/q(a, b) has been estimated. Then our sampling procedure is conducted according to the following Alg.1. Note that in a high dimensional case, the estimation accuracy of k and the tightness of Ω affects the sampling efficiency and accuracy materially. In fact, the expectation number of trial to obtain one sample by AR is k times, which gets exponentially large as the dimensionality increases. Since the support of the oracle distribution p(a, b) is not rectangular, sampling from coordinate transformed p(α, β) remedies the difficulty. In addition, the high order differentiation in the decomposing kernel φd cause numerical unstability. 10 Algorithm 1 Rigorous sampling according to ordinary acceptance-rejection method. repeat draw proposal point (a∗ , b∗ ) ∼ q(a, b). draw uniformly random value u from the interval [0, 1]. p(a∗ ,b∗ ) if u ≤ kq(a ∗ ,b∗ ) then return (a∗ , b∗ ) {accept} else do nothing {reject} end if until acceptance occurs. A.2 Sampling from mixture annealed distribution In order to overcome the high dimensional sampling difficulty, we approximately regarded p(a, b) as a mixture P distribution p(a, b) ≈ N n=1 ηn pn (a, b) (as described in Eq.15) and conducted two-step sampling: first choose one component distribution pn (a, b) according to the mixing probability ηn ∝ |yn |, second draw a sample (a, b) from chosen component distribution pn (a, b). Sampling from pn (a, b) ∝ |φd (a·xn −b)| holds another difficulty due to its high order differentiation in φd (z). According to its upper bound evaluation (Eq.16), a high order derivative ρ(m) (z)(= φd (z)) has its almost all mass around both edge of its domain interval [−1, 1] and almost no mass in the middle of the domain (see Fig.5 Left). Hence we approximated, or annealed, ρ(m) (z) by a beta distribution, which could model extreme skewness of ρ(m) (z) (e.g., Beta(z; 100, 3); see Fig.5 Right). Then we conducted further steps of sampling: first sample z ∈ [−1, 1] according to the annealing beta distribution, then sample a and b under the restriction z = a · xn − b. Figure 5: 10-th order derivative ρ(10) (z) of mollifier. Left: ρ(10) (z) has almost all mass, with high frequency, at both ends, and no mass in the middle of domain. Right: The right half of |ρ(10) (z)| is approximated by beta distribution Beta(z; 100, 3) (red line). Obviously the mixture approximation gives rise to poor restriction and virtual indefiniteness of (a, b). Since the rigorous computation establishes all relations between (a, b) and all xn ’s, whereas the mixture approximation does just one relation between (a, b) and one particular xn . We introduced two additional assumptions. First, a is parallel to given xn . Since a always appears in the form a · xn , only the parallel component of a could have any effect (on one particular xn ), hence we eliminated the extra freedom in the orthogonal component. Second, the norm a := kak has similar scale to the distances kxn − xm k between input vectors. Since a controls the spatial frequency of a hidden unit, it determines how broad the hidden unit covers the part of the input space. Namely, a controls which input vectors are selectively responded by the unit. Therefore, in order to avoid such an isolation case that an unit responds for only one input vector, we assumed a is no smaller than the distance between input vectors. In this procedure we set a as a distance kxn − xm k of randomly selected two input examples xn and xm . We denote this procedure simply by a ∼ p(kx − x0 k). Once a is fixed with these assumptions, b is determined as b = a · xn − z. 11 Given shape parameters α, β of the beta distribution Beta(z; α, β), one cycle of our second sampling method is summarized as Alg.2. This method consists of no more expensive steps. It scales linearly with the dimensionality of the input space and the number of required sample parameters respectively. Moreover, it does not depends on the size of the training data. Algorithm 2 Quick sampling from mixture annealed distribution (for high dimensional use.) choose a suffix n of xn according to the mixing probability ηn . draw ζ ∼ Beta(z; α, β) and k ∼ Bernoulli(k; p = 0.5) z ← (−1)k ζ set length a ∼ p(x − x0 ). a ← axn /kxn k. b ← a · xn − z. 12
9cs.NE
1 The Explicit Coding Rate Region of Symmetric Multilevel Diversity Coding arXiv:1801.02376v1 [cs.IT] 8 Jan 2018 Tao Guo and Raymond W. Yeung Abstract It is well known that superposition coding, namely separately encoding the independent sources, is optimal for symmetric multilevel diversity coding (SMDC) (Yeung-Zhang 1999). However, the characterization of the coding rate region therein involves uncountably many linear inequalities and the constant term (i.e., the lower bound) in each inequality is given in terms of the solution of a linear optimization problem. Thus this implicit characterization of the coding rate region does not enable the determination of the achievability of a given rate tuple. In this paper, we first obtain closed-form expressions of these uncountably many inequalities. Then we identify a finite subset of inequalities that is sufficient for characterizing the coding rate region. This gives an explicit characterization of the coding rate region. We further show by the symmetry of the problem that only a much smaller subset of this finite set of inequalities needs to be verified in determining the achievability of a given rate tuple. Yet, the cardinality of this smaller set grows at least exponentially fast with L. We also present a subset entropy inequality, which together with our explicit characterization of the coding rate region, is sufficient for proving the optimality of superposition coding. Index Terms Symmetric multilevel diversity coding, superposition coding, network coding, closed-form, distributed data storage, robust network communication. I. I NTRODUCTION Symmetric multilevel diversity coding (SMDC) was introduced by Roche et al. [1] for applications in distributed data storage and robust network communication. It is also a special case of multi-source network coding [2], [3]. In this problem, there are L (L ≥ 2) independent discrete memoryless sources {Xl (t) : t = 1, 2, · · · }, l = 1, 2, · · · , L, where for each l, Xl (t) are independent and identically distributed copies of a generic random variable Xl . The importance of the sources is in the order X1 (t) > X2 (t) > · · · > XL (t). The sources are encoded by L encoders. There are totally 2L − 1 decoders, each of which has access to a distinct subset of the encoders. A decoder which can access any α encoders, called a Level α decoder, is required to reconstruct the first α sources. Such a system is called a symmetric L-level diversity coding system. The system is symmetric in the sense that the problem is unchanged by permuting the L encoders, which is evident from the reconstruction requirements of the decoders. The SMDC problem was treated for L = 3 in [1] and in full generality by Yeung and Zhang [4], where a coding method called superposition coding was proved to be optimal. In this method, the independent sources {Xl (t)}, l = 1, 2, · · · , L are encoded separately. The problem has subsequently been generalized in different directions. The 2 secure communication setting was considered by Balasubramanian et al. [5] and Jiang et al. [6]. In [6], they also extended the original SMDC setting by introducing an all-access encoder which is accessible by all the decoders. In both of the above settings, superposition coding is shown to be optimal. Xiao et al. [7] studied the problem of distributed multilevel diversity coding where each source is decomposed into L components, each of which is accessed by one distinct encoder. Tian and Liu [8] considered the problem with regeneration, where the storage versus repair-bandwidth tradeoff was investigated. Mohajer et al. [9] considered the asymmetric multilevel diversity coding problem and proved that superposition coding is in general suboptimal. In the current paper, we focus on some fundamental issues pertaining to the original SMDC problem discussed in [1], [4]. It was proved in [1] that superposition coding is optimal for L = 3, and the corresponding coding rate region, referred to as the superposition coding rate region, can be explicitly characterized by 10 linear inequalities in the coding rates of the 3 encoders. Thus, the achievability of any given rate triple can be determined by verifying these 10 inequalities. However, the optimality proof in [1] is not readily generalizable to a general L. Here is an outline of the proof in [1]. The superposition coding rate region is first characterized by the aforementioned 10 inequalities. This involves the determination of the extreme points of the region. Then the necessity of these 10 inequalities are established by means of conventional techniques for proving converse coding theorems. The difficulty for generalizing the proof to a general L is two-fold: 1) It is observed through computation that the number of extreme points of the superposition coding rate region grows with L. As such, it is impossible to determine all of them for a general L. 2) For a fixed L, once the superposition coding rate region is characterized by a finite set of linear inequalities, their necessity needs to be proved. With conventional techniques, this needs to be done for each inequality in a way that depends on the coefficients of coding rates. It is observed through computation that the number of these inequalities grows with L. Therefore, for a general L, it is not possible to prove the necessity of all of these inequalities. For a fixed L, the extreme points of the superposition coding rate region and the set of rate constraints characterizing the region can in principle be found by computation. However, the complexity grows very quickly with L and becomes prohibitive for L larger than 5 or so. In [4], the optimality of superposition coding was established for a general L by means of a highly sophisticated method that does not involve any explicit characterization of the coding rate region. Instead of a fixed L, the problem is tackled for a general L. As L is not fixed, the number of linear inequalities needed for the characterization of the superposition coding rate region may be unbounded. To get around the problem, the coding rate region is characterized by an uncountable collection of linear inequalities, where for each inequality, the coefficients associated with the rates are arbitrary nonnegative real numbers with at least one of them being nonzero. The constant terms (i.e., the lower bounds) in these inequalities are given implicitly in terms of the solution of a common linear optimization problem with the coefficients associated with the rates as parameters. In other words, although the coding rate region is characterized by uncountably many linear inequalities, they have a common form and the necessity of these inequalities can be established in a unified manner. 3 Although the optimality of superposition coding for a general L has been established in [4], this result does not yield an explicit characterization of the coding rate region for any fixed L. In particular, it does not enable the determination of the achievability of a given rate tuple, even for a fixed L, for the following two reasons. First, the characterization of the coding rate region in [4] involves an uncountable number of inequalities. Second, each inequality in the characterization is implicit, and can be made explicit only by solving a linear optimization problem. In the present paper, we develop fundamental results pertaining to SMDC. Our main contributions are summarized as follows: 1) We obtain an explicit characterization of the coding rate region for a general L. This is done by first solving in closed form the linear optimization problem in [4] that gives an implicit characterization of the coding rate region. Then among all the uncountably many inequalities involved in characterizing the coding rate region, we identify a finite subset that is sufficient for characterizing the coding rate region. It is further proved that there is no redundancy in this finite set of inequalities. Thus for a fixed L, the achievability of any given rate tuple can be determined. 2) By taking advantage of the symmetry of the problem, we show that in determining the achievability of a given rate tuple, it suffices to verify a much smaller subset of the set of inequalities identified in 1). Yet, the cardinality of this smaller set of inequalities grows at least exponentially fast with L. This reveals the inherent complexity of the problem. 3) A subset entropy inequality, which plays a key role in the converse proof in [4], requires a painstaking and extremely technical proof. We present a weaker version of this subset entropy inequality whose proof is considerably simpler. With our explicit characterization of the coding rate region, this weaker version of the subset entropy inequality is sufficient for proving the optimality of superposition coding. The rest of the paper is organized as follows. We first formulate the problem and state some existing results in Section II. In Section III, we present a closed-form solution of the linear optimization problem in [4] and establish some basic properties of the solution. In Section IV, we identify a finite set of inequalities that characterizes the superposition coding rate region and show that this set contains no redundancy. In Section V, we further identify a subset of inequalities we need to verify in determining the achievability of a given rate tuple. We also provide a lower bound and an upper bound on the cardinality of this set. In Section VI, we present a weaker version of the subset entropy inequality in [4]. We conclude the paper in Section VII. Some essential proofs can be found in the appendices. II. P ROBLEM F ORMULATION AND E XISTING R ESULTS A. Problem Formulation Let L = {1, 2, · · · , L}, where L ≥ 2. Let t be the time index and   X1 (t), X2 (t), · · · , XL (t) : t = 1, 2, · · · be a collection of L independent discrete memoryless information sources with an L-tuple of generic random variables (X1 , X2 , · · · , XL ) taking values in X1 × X2 × · · · × XL , where Xi , i ∈ L are finite alphabets. In the sequel, we use boldfaced letters to denote vectors of length n, for example X1 = (X1 (1), X1 (2), · · · , X1 (n)). There are L 4 encoders, indexed by L, each of which can access all the L information sources. There are also 2L − 1 decoders. For each U ⊆ L such that U 6= ∅, Decoder-U can access the subset of encoders indexed by U. For 1 ≤ α ≤ L and U such that |U| = α, Decoder-U can reconstruct the first α sources X1 , X2 , · · · , Xα perfectly in the usual Shannon sense. An (n, M1 , M2 , · · · , ML ) code is defined by the encoding functions El : L Y Xin → {1, 2, · · · , Ml }, for l ∈ L (1) i=1 and decoding functions DU : Y {1, 2, · · · , Ml } → |U | Y Xin , for U ⊆ L and U 6= ∅. (2) i=1 l∈U Let Wl = El (X1 , X2 , · · · , XL ) be the output of Encoder-l and WU = (Wi : i ∈ U) for U ⊆ L. A nonnegative rate tuple (R1 , R2 , · · · , RL ) is achievable if for any ǫ > 0, there exists for sufficiently large n an (n, M1 , M2 , · · · , ML ) code such that 1 log Ml ≤ Rl + ǫ, ∀ l ∈ L, n (3) Pr{DU (WU ) 6= (X1 , X2 , · · · , Xα )} ≤ ǫ, (4) and for all α = 1, 2, · · · , L and U ⊆ L such that |U| = α. The achievable rate region R is defined as the collection of all achievable rate tuples. B. Existing Results We adopt the terminologies and notations in [4]. Let Rsup be the rate region induced by superposition coding. Then Rsup is the set of nonnegative rate tuples (R1 , R2 , · · · , RL ) such that Rl = L X rlα , for l ∈ L (5) α=1 for some rlα ≥ 0, 1 ≤ α ≤ L, satisfying X rlα ≥ H(Xα ), for all U ⊆ L and |U| = α. (6) l∈U Let λ = (λ1 , λ2 , · · · , λL ) and RL + = {λ : λ 6= 0 and λi ∈ R, λi ≥ 0 for i ∈ L}. (7)  L Let Ωα L = v ∈ {0, 1} : |v| = α , where |v| is the Hamming weight of a vector v = (v1 , v2 , · · · , vL ). Note that there is a one-to-one correspondence between a vector v ∈ {0, 1}L and Decoder-U, where U = {i : vi = 1}. For any λ ∈ RL + and α ∈ L, let fα (λ) be the optimal solution to the following optimization problem: X fα (λ) , max cα (v) (8) v∈Ωα L s.t. X cα (v)v ≤ λ (9) v∈Ωα L cα (v) ≥ 0, ∀v ∈ Ωα L. (10) 5 Note that the functions fα (·) and cα (·) above depend on L, but for simplicity we omit this dependency in the notations. Thus, if the length of λ is given, then fα (λ) can be defined accordingly. A set {cα (v) : v ∈ Ωα L } is called an α-resolution for λ if (9) and (10) are satisfied and it will be abbreviated as {cα (v)} if there is no ambiguity. Furthermore, an α-resolution is called optimal if it achieves the optimal value fα (λ). Let Rh be the collection of nonnegative rate tuples (R1 , R2 , · · · , RL ) such that L X λl Rl ≥ L X fα (λ)H(Xα ), for all λ ∈ RL +. (11) α=1 l=1 It was proved in [4] that the superposition region Rsup can be alternatively characterized by Rh . This means that in addition to being the optimal value of the optimization problem in (8), for every fixed λ ∈ RL + , fα (λ) also gives a tight linear outer bound on Rsup via (11). It was further proved in [4] that Rh is an outer bound on R. Then Rsup ⊆ R ⊆ Rh (12) R = Rh = Rsup , (13) which implies i.e., superposition coding is optimal. The following lemma is a direct consequence of Lemma 4 and 7 in [4]. It will be used in the proof of our main result in the next section. Lemma 1. Assume λ1 ≥ λ2 ≥ · · · ≥ λL . For α ≥ 2, if λ1 ≤ λ2 +λ3 +···+λL , α−1 then fα (λ) = 1 α PL i=1 λi . III. O PTIMAL α- RESOLUTION For any λ ∈ RL + and any permutation ω on {1, 2, · · · , L}, with an abuse of notation, we denote λω(1) ,  λω(2) , · · · , λω(L) by ω(λ). For any α ∈ L, due to the symmetry of the system, it is intuitive that the values of fα (ω(λ)) are the same for all ω. This important property of fα (λ) is formally proved in the following lemma.  Lemma 2. fα ω(λ) = fα (λ) for α ∈ L. Proof. For any α ∈ L, let {cα (v) : v ∈ Ωα L } be an optimal α-resolution for λ. Then we have X cα (v)v ≤ λ, (14) cα (v) ≥ 0, ∀v ∈ Ωα L, (15) X cα (v). (16) v∈Ωα L and fα (λ) = v∈Ωα L Let that P v∈Ωα L cα (v)v = λ̃. Then by (14), we have λ̃ ≤ λ. For any permutation ω on {1, 2, · · · , L}, we can check X v∈Ωα L cα (v) ω(v) = ω  X v∈Ωα L cα (v)v  = ω(λ̃) ≤ ω(λ). (17) 6 For any v ∈ Ωα L , let It is immediate that for all v ∈ Ωα L,  c′α ω(v) = cα (v). (18)  c′α ω(v) ≥ 0. (19) α α α Since ω is a one-to-one mapping from Ωα L to ΩL , we have v ∈ ΩL if and only if ω(v) ∈ ΩL for any ω. Thus, X X   c′α ω(v) ω(v) = c′α ω(v) ω(v) v∈Ωα L ω(v)∈Ωα L X = cα (v) ω(v) v∈Ωα L  ≤ ω λ , (20)  where the inequality follows from (17). By (19) and (20), we see that {c′α ω(v) : v ∈ Ωα L } is an α- resolution for ω(λ). In light of the definition of fα (λ) in (8)-(10), we have X X X    c′α ω(v) = fα ω(λ) ≥ c′α ω(v) = cα (v) = fα (λ), v∈Ωα L ω(v)∈Ωα L (21) v∈Ωα L and so  fα ω(λ) ≥ fα (λ). (22)   fα ω −1 ω(λ) ≥ fα ω(λ) . (23) Let ω −1 be the inverse permutation of ω. By the same argument, we can obtain Since ω −1 (ω(λ)) = λ, we see from (22) and (23) that The lemma is proved.  fα (λ) = fα ω(λ) for all α ∈ L. (24) If a vector λ satisfies λ1 ≥ λ2 ≥ · · · ≥ λL , (25) we call λ an ordered vector. Throughout this section except for Lemma 8, we assume without loss of generality that λ is an ordered vector. For any α ∈ L, it is easy to see that fα (µλ) = µfα (λ) (26) for all µ ∈ R such that µ > 0. Thus, we will consider only λ’s whose minimum nonzero element is equal to 1. Then there exists a ζ ∈ L such that λ1 ≥ λ2 ≥ · · · ≥ λζ = 1 (27) and λi = 0 for all i = ζ + 1, ζ + 2, · · · , L. Fix λ, it is easy to see that f1 (λ) = L X i=1 λi , (28) 7 and fζ (λ) = 1, (29) fα (λ) = 0. (30) and for α ≥ ζ + 1, For other cases, determining the value of fα (λ) is highly nontrivial. For α ∈ L and β = 0, 1, · · · , α − 1, let gα,λ (β) = L X 1 λi . α−β (31) i=β+1 Let βα∗ be a value of β (not necessarily unique) that achieves the minimum minβ∈{0,1,··· ,α−1} gα,λ (β), i.e., gα,λ (βα∗ ) = min β∈{0,1,··· ,α−1} gα,λ (β). (32) The following theorem, a main result of the current paper, gives a closed-form solution for fα (λ). Theorem 1. For any α ∈ L, fα (λ) = gα,λ (βα∗ ). Proof. Fix an α ∈ L, and denote βα∗ by β ∗ for simplicity. We prove the theorem by proving i) fα (λ) ≤ gα,λ (β ∗ ); ii) there exists a solution for the optimization problem (8) that achieves gα,λ (β ∗ ), so that fα (λ) ≥ gα,λ (β ∗ ). i) fα (λ) ≤ gα,λ (β ∗ ). For 0 ≤ β ≤ α − 1, let eβ be an L-vector with the first β components being 0 and the last L − β components Pβ being 1. For any v ∈ Ωα L , since i=1 vi ≤ β, we have v · eβ = L X vi ≥ α − β. (33) i=β+1 Then for any solutions {cα (v)} to the optimization problem in (8), we have L X = λ · eβ λi (34) i=β+1  ≥  = X v∈Ωα L  cα (v)v  · eβ (35) X cα (v)(v · eβ ) (36) X cα (v)(α − β) (37) v∈Ωα L ≥ v∈Ωα L = (α − β) X cα (v). (38) v∈Ωα L This implies that fα (λ) ≤ L X 1 λi = gα,λ (β), for all 0 ≤ β ≤ α − 1. α−β (39) i=β+1 Thus, we have fα (λ) ≤ gα,λ (β ∗ ). (40) 8 ii) fα (λ) ≥ gα,λ (β ∗ ). We now show that there exists a solution that achieves gα,λ (β ∗ ). For any α ∈ L and β ∗ ∈ {0, 1, · · · , α − 2}, by (32), we have 1 α − β∗ L X λi ≤ L X 1 λi , α − (β ∗ + 1) ∗ (41) i=β +2 i=β ∗ +1 which is equivalent to λβ ∗ +1 ≤ L X 1 λi . (α − β ∗ ) − 1 ∗ (42) i=β +2 Denote the (L − β ∗ )-vector (λβ ∗ +1 , λβ ∗ +2 , · · · , λL ) by λ′ . In view of (42), by Lemma 1, (31), and (32), we have fα−β ∗ (λ′ ) = 1 α − β∗ L X λi = gα,λ (β ∗ ). (43) i=β ∗ +1 In view of (28) and (31) with β = β ∗ , it is easy to check that (43) is also satisfied for β ∗ = α − 1. Without o n ∗ be an optimal (α − β ∗ )-resolution for λ′ . Then it follows loss of generality, let cα−β ∗ (u) : u ∈ Ωα−β ∗ L−β from (43) that X cα−β ∗ (u) = fα−β ∗ (λ′ ) = gα,λ (β ∗ ). (44) α−β ∗ u∈ΩL−β ∗ For any v ∈ Ωα L , let cα (v) = Then we have   cα−β ∗ (u),  0, X cα (v) = v∈Ωα L ∗ if v = (11 · · · 1u) for some u ∈ Ωα−β L−β ∗ (45) otherwise. X cα−β ∗ (u) = gα,λ (β ∗ ). (46) α−β ∗ u∈ΩL−β ∗ Again, by (32), we have L X 1 1 λi ≥ α − (β ∗ − 1) α − β∗ ∗ i=β Then λβ ∗ ≥ 1 α − β∗ L X L X λi . (47) i=β ∗ +1 λi = gα,λ (β ∗ ), (48) i=β ∗ +1 where the equality above follows from (31). Thus, λ1 ≥ λ2 ≥ · · · ≥ λβ ∗ ≥ gα,λ (β ∗ ). (49) For i = 1, 2, · · · , β ∗ , since cα (v) = 0 if vi = 0, we have X v∈Ωα L :vi =1 cα (v) = X v∈Ωα L cα (v) = gα,λ (β ∗ ) ≤ λi , (50) 9 where the second equality follows from (46). For i = β ∗ + 1, β ∗ + 2, · · · , L, X cα (v) X = v∈Ωα L :vi =1 cα (v) + v∈Ωα L : vi =1, (v1 ,··· ,vβ ∗ )=1 cα (v) v∈Ωα L : vi =1, (v1 ,··· ,vβ ∗ )6=1 X = X cα−β ∗ (u) + 0 ∗ α−β u∈ΩL−β ∗ : ui−β ∗ =1 ≤ λi , since (51) o n ∗ is an optimal (α − β ∗ )-resolution for λ′ . From (46), (50), and (51), we can cα−β ∗ (u) : u ∈ Ωα−β L−β ∗ ∗ see that {cα (v) : v ∈ Ωα L } defined by (45) is an α-resolution for λ that achieves gα,λ (β ). Thus, we have fα (λ) ≥ gα,λ (β ∗ ). (52) The following lemma provides an important insight into the minimum in (32). Lemma 3. For any α ∈ {2, 3, · · · , L} and 0 ≤ β ≤ α − 2, (i) if gα,λ (β) ≥ gα,λ (β + 1), then gα,λ (0) ≥ gα,λ (1) ≥ · · · ≥ gα,λ (β + 1); (ii) if gα,λ (β) ≤ gα,λ (β + 1), then gα,λ (β) ≤ gα,λ (β + 1) ≤ · · · ≤ gα,λ (α − 1). Remark 1. In Lemma 3, if all the non-strict inequalities are replaced by strict inequalities, the lemma remains valid. This alternative version of Lemma 3 can be proved by modifying the proof below accordingly. Proof of Lemma 3. In the following, we only prove (ii). The proof for (i) can be obtained similarly. For α = 2, the lemma is immediate. For 3 ≤ α ≤ L and β = α − 2, (ii) is immediate. For 0 ≤ β ≤ α − 3, from the definition of gα,λ (·) in (31), the condition gα,λ (β) ≤ gα,λ (β + 1) is equivalent to L L X X 1 1 λi ≤ λi , α−β α − (β + 1) i=β+1 or λβ+1 ≤ (53) i=β+2 L X 1 λi . α − (β + 1) (54) i=β+2 Then by the assumption in (25), we have λβ+2 ≤ L X 1 λi , α − (β + 1) (55) i=β+2 or λβ+2 ≤ L X 1 λi , α − (β + 2) (56) i=β+3 which is also equivalent to L L X X 1 1 λi ≤ λi . α − (β + 1) α − (β + 2) i=β+2 (57) i=β+3 From (31), we have gα,λ (β + 1) ≤ gα,λ (β + 2). (58) 10 Then we see inductively that for all β + 1 ≤ β ′ ≤ α − 2, gα,λ (β ′ ) ≤ gα,λ (β ′ + 1). (59) The lemma is proved. For any α ∈ {2, 3, · · · , L} and any β ∈ {0, 1, · · · , α − 1}, we can readily see from Lemma 3 that βα∗ = β if and only if gα,λ (0) ≥ gα,λ (1) ≥ · · · ≥ gα,λ (β) (60) gα,λ (β) ≤ gα,λ (β + 1) ≤ · · · ≤ gα,λ (α − 1). (61) and This provides a method to find the optimal value βα∗ quickly. We only need to compare gα,λ (β) and gα,λ (β + 1) for β = 0, 1, · · · , α − 2 successively and stop at the first β such that gα,λ (β) ≤ gα,λ (β + 1). Then this β gives a value of βα∗ that achieves the minimum in (32). Lemma 4. 0 = β1∗ ≤ β2∗ ≤ · · · ≤ βL∗ . Proof. It is easy to see from (28) that β1∗ = 0. This implies that β1∗ ≤ β2∗ . Now, we prove the lemma by showing ∗ that βα−1 ≤ βα∗ for any 3 ≤ α ≤ L. If βα∗ ∈ {α − 2, α − 1}, since for a fixed α ∈ L we have 0 ≤ β ≤ α − 1, it is obvious that ∗ ≤ α − 2 ≤ βα∗ . βα−1 (62) Otherwise, βα∗ ∈ {0, 1, · · · , α − 3}. Since βα∗ achieves the minimum in (32), we have 1 α − βα∗ L X λi ≤ ∗ +1 i=βα L X 1 λi , α − (βα∗ + 1) ∗ (63) i=βα +2 which is equivalent to λ ∗ +1 βα L X 1 ≤ λi . α − (βα∗ + 1) ∗ (64) i=βα +2 This implies that λβα∗ +1 ≤ L X 1 λi , α − (βα∗ + 2) ∗ (65) i=βα +2 which is equivalent to L L X X 1 1 λ ≤ λi . i α − (βα∗ + 1) α − (βα∗ + 2) ∗ ∗ i=βα +1 (66) i=βα +2 Thus, we have 1 (α − 1) − βα∗ L X ∗ +1 i=βα λi ≤ L X 1 λi , (α − 1) − (βα∗ + 1) ∗ (67) i=βα +2 which by (31) implies that gα−1,λ (βα∗ ) ≤ gα−1,λ (βα∗ + 1). (68) 11 By the discussion following Lemma 3, we conclude that ∗ βα−1 ≤ βα∗ . (69) Lemma 5. Let λ1 = (λ1,1 , λ1,2 , · · · , λ1,L ) and λ2 = (λ2,1 , λ2,2 , · · · , λ2,L ) be two vectors such that λ1,1 > λ2,1 and λ1,i = λ2,i for all 2 ≤ i ≤ L. For any α0 ∈ L, if fα0 (λ1 ) = fα0 (λ2 ), then fα (λ1 ) = fα (λ2 ) for all α ≥ α0 . Proof. For α ∈ L, let βα1 and βα2 be the values that achieve fα (λ1 ) and fα (λ2 ), respectively. The condition fα0 (λ1 ) = fα0 (λ2 ) implies that βα1 0 = βα2 0 ≥ 1, since otherwise (70) L L 1 X 1 X λ1,i = λ2,i , α0 i=1 α0 i=1 (71) which is a contradiction to the assumption that λ1,1 > λ2,1 and λ1,i = λ2,i for 2 ≤ i ≤ L. For all α ≥ α0 , by Lemma 4, we have βα1 ≥ 1 and βα2 ≥ 1. Then by Theorem 1, we have fα (λ1 ) = fα (λ2 ) = min β∈{1,2,··· ,α−1} gα,λ1 (β). (72) This proves the lemma. Let λ[1] be the L-vector with the first component being 1 and the rest being 0. Lemma 6. If λ1 > PL i=2 λi , let λ′ = PL  λi , λ2 , λ3 , · · · , λL . Then for all α ∈ L,   L X  fα (λ) = λ1 − λi fα λ[1] + fα (λ′ ). i=2 (73) i=2 Proof. By Theorem 1, we have f2 (λ′ ) = L X λi . (74) i=2 The condition λ1 > PL i=2 λi implies that g2,λ (0) > g2,λ (1). (75) Again by Theorem 1, we have f2 (λ) = g2,λ (1) = L X λi . (76) i=2 Then f2 (λ) = f2 (λ′ ), (77) fα (λ) = fα (λ′ ), for all 2 ≤ α ≤ L. (78) and by Lemma 5, we have 12 For 2 ≤ α ≤ L, since fα (λ[1] ) = 0, the equation (73) is satisfied by virtue of (78). For α = 1, we can check that f1 (λ) = L X λi i=1 = λ1 − L X λi i=2 = λ1 − L X i=2 so that (73) is also satisfied. This proves the lemma. λi ! ·1+2 ! f1 (λ[1] ) + f1 (λ′ ), L X λi i=2 (79) Lemma 7. For any η ∈ {1, 2, · · · , L − 1}, P (i) if λ1 ≤ η1 L i=2 λi , then fα (λ) = gα,λ (0), for α = 1, 2, · · · , η + 1; P L (ii) if λ1 ≥ η1 i=2 λi , then fα (λ) = fα−1 (λ2 , λ3 , · · · , λL ), for α = η + 1, η + 2, · · · , L. Remark 2. If λ1 = 1 η PL i=2 λi , we have from the lemma that L fη+1 (λ) = fη (λ2 , λ3 , · · · , λL ) = In this case, fα (λ) =    1 PL λi , i=1 α 1 X λi , η + 1 i=1 for α ≤ η + 1 (80) (81)  fα−1 (λ2 , λ3 , · · · , λL ), for α ≥ η + 1. Proof. We first prove (i). For α ≤ η + 1, it is easy to check that   1 1 1 1+ ≤ . α η α−1 (82) Thus, L 1X λi α i=1 L = ≤ = 1 1X λi λ1 + α α i=2   L L 1X 1 1X λi + λi α η i=2 α i=2   L 1 1 X λi 1+ α η i=2 (83) L 1 X λi , (84) α − 1 i=2 P where (83) follows from the assumption that λ1 ≤ η1 L i=2 λi and (84) follows from (82). Then by the discussion ≤ following Lemma 3, we have L fα (λ) = 1X λi = gα,λ (0). α i=1 Next, we prove (ii). For α ≥ η + 1, it is easy to check that   1 1 1 1+ ≥ . α η α−1 (85) (86) 13 Similar to the derivation of (84), with the assumption that λ1 ≥ L 1 η L PL i=2 λi , (86) implies that 1 X 1X λi ≥ λi . α i=1 α − 1 i=2 Thus, we have fα (λ) = = = min   β∈{0,1,··· ,α−1}  α 1 −β L X (87) λi    i=β+1     L X 1 min λi  β∈{1,2,··· ,α−1}  α − β i=β+1   L   X 1 min λi  β∈{0,1,··· ,α−2}  (α − 1) − β (88) i=β+2 = fα−1 (λ2 , λ3 , · · · , λL ), (89) where (88) follows from (87). This proves the lemma. The following lemma implies that fα (λ) is a concave function of λ ∈ RL + for all α ∈ L. Note that the vectors in this lemma are not necessarily ordered. Lemma 8. For any α ∈ L, fα (µ1 λ1 + µ2 λ2 ) ≥ µ1 fα (λ1 ) + µ2 fα (λ2 ) (90) for any λ1 , λ2 ∈ RL + and µ1 , µ2 ≥ 0. Proof. Let λ1 = (λ1,1 , λ1,2 , · · · , λ1,L ) and λ2 = (λ2,1 , λ2,2 , · · · , λ2,L ). Let π1 (·), π2 (·) be two permutations of {1, 2, · · · , L} such that λ1,π1 (1) ≥ λ1,π1 (2) ≥ · · · ≥ λ1,π1 (L) (91) λ2,π2 (1) ≥ λ2,π2 (2) ≥ · · · ≥ λ2,π2 (L) . (92) and Denote the ordered vectors by π1 (λ1 ) and π2 (λ2 ), respectively. For any β = 0, 1, · · · , α − 1, it is easy to see that L L X X 1 1 λ1,i ≥ λ1,π1 (i) α−β α−β i=β+1 and L L X X 1 1 λ2,i ≥ λ2,π2 (i) . α−β α−β i=β+1 Thus, we have (94) i=β+1 L L X X 1 1 (µ1 λ1,i + µ2 λ2,i ) ≥ (µ1 λ1,π1 (i) + µ2 λ2,π2 (i) ). α−β α−β i=β+1 (93) i=β+1 (95) i=β+1 This implies that fα (µ1 λ1 + µ2 λ2 ) ≥ fα (µ1 π1 (λ1 ) + µ2 π2 (λ2 )). (96) 14 For any α ∈ L, it is easy to check that fα (π1 (λ1 )) = fα (λ1 ) (97) fα (π2 (λ2 )) = fα (λ2 ). (98) and Therefore, if the lemma holds for any ordered vectors λ1 and λ2 , then the lemma holds for any vectors λ1 and λ2 (not necessarily ordered), because fα (µ1 λ1 + µ2 λ2 ) ≥ fα (µ1 π1 (λ1 ) + µ2 π2 (λ2 )) ≥ µ1 fα (π1 (λ1 )) + µ2 fα (π2 (λ2 )) = µ1 fα (λ1 ) + µ2 fα (λ2 ). (99) Thus without loss of generality, we assume that λ1 and λ2 are ordered. Then for any β = 0, 1, · · · , α − 1, we have from Theorem 1 that L X 1 λ1,i ≥ fα (λ1 ) α−β (100) i=β+1 and L X 1 λ2,i ≥ fα (λ2 ), α−β (101) i=β+1 which implies L X 1 (µ1 λ1,i + µ2 λ2,i ) ≥ µ1 fα (λ1 ) + µ2 fα (λ2 ). α−β (102) i=β+1 By taking the minimum over all β = 0, 1, · · · , α − 1, we obtain   L  1  X min (µ1 λ1,i + µ2 λ2,i ) ≥ µ1 fα (λ1 ) + µ2 fα (λ2 ),  β∈{0,1,··· ,α−1}  α − β (103) i=β+1 which by Theorem 1 is equivalent to fα (µ1 λ1 + µ2 λ2 ) ≥ µ1 fα (λ1 ) + µ2 fα (λ2 ). (104) This proves the lemma. IV. T HE M INIMUM S UFFICIENT S ET OF I NEQUALITIES Even though the superposition region Rsup can be explicitly characterized by Theorem 1, an uncountable number of inequalities are involved. For a fixed L, among all these inequalities, only a finite number of them are needed because Rsup is a polytope. In this section, we provide a method to determine this minimum sufficient set of inequalities. For any λ ∈ RL + , let π(·) be a permutation of {1, 2, · · · , L} such that λπ(1) ≥ λπ(2) ≥ · · · ≥ λπ(L) . (105) 15 Recall that we consider only λ’s whose minimum nonzero element is equal to 1. Let ζ ∈ L be such that λπ(ζ) = 1 (106) λπ(j) = 0. (107) and for j = ζ + 1, ζ + 2, · · · , L, Toward listing all the inequalities defining Rsup , we consider a certain finite subset of RL + defined as follows. Let GL be the collection of all λ ∈ RL + such that for j = ζ − 1, ζ − 2, · · · , 1,   L L L   X X X 1 1 λπ(i) , · · · , λπ(i) , λπ(i) , λπ(j) ∈   2 θj+1 + 1 i=j+1 i=j+1 (108) i=j+1 where θζ = 0 and for j = ζ − 2, · · · , 1, θj+1 is the integer such that λπ(j+1) = 1 θj+1 L X λπ(i) . (109) i=j+2 Here, (106), (108), and (109) not only defines GL but in fact provides a method to exhaust all λ ∈ GL . For ζ = 1, the only possible λ are λ[1] = (1, 0, 0, · · · ) and its permutations. For ζ ≥ 2, starting with λπ(ζ) = 1, the values of λπ(ζ−1) , λπ(ζ−2) , · · · , λπ(1) can be chosen recursively according to (108). It is easy to check that θj ∈ {1, 2, · · · , θj+1 + 1} (110) 1 ≤ θj ≤ ζ − j (111) and for 1 ≤ j ≤ ζ − 1. Furthermore, for the last element of the set in (108) which is the smallest in the set, we have   L L L X X X 1 1 1  λπ(i)  λπ(i) + λπ(i) = θj+1 + 1 i=j+1 θj+1 + 1 θj+1 i=j+2 i=j+2 = = L θj+1 + 1 X λπ(i) θj+1 + 1 θj+1 i=j+2 1 1 θj+1 L X λπ(i) i=j+2 = λπ(j+1) , (112) so that λπ(j) ≥ λπ(j+1) as required by (105). Also, we see from (108) that 1) for ζ ≥ 2, λπ(ζ−1) = λπ(ζ) = 1; 2) for ζ ≥ 3, λπ(j+1) is always a possible choice for λπ(j) for 1 ≤ j ≤ ζ − 2. Denote the cardinality of GL by SL . Let GL0 = {λ ∈ GL : λ is ordered }, and denote its cardinality by |GL0 | = SL0 . For the ease of notation, we let with λ(1) = λ[1] and o n 0 GL0 = λ(1) , λ(2) , · · · , λ(SL ) (113) o n 0 0 GL = GL0 ∪ λ(SL +1) , λ(SL +2) , · · · , λ(SL ) . (114) 16 In other words, the set GL is the collection of all possible permutations of the vectors in GL0 . For i = 1, 2, · · · , SL , let πi (·) be a permutation of {1, 2, · · · , L} such that (i) (i) (i) λπi (1) ≥ λπi (2) ≥ · · · ≥ λπi (L) . (115)  For any λ ∈ RL + , let f (λ) = f1 (λ), f2 (λ), · · · , fL (λ) . The following lemma is important for the proof of our main theorem. [1] Lemma 9. Consider any ordered vector λ ∈ RL + such that λ 6= λ . Assume there exists ci ≥ 0, i = 1, 2, · · · , SL such that SL   X ci λ(i) , f (λ(i) ) . λ, f (λ) = (116) i=1  Let I = i ∈ {1, 2, · · · , SL } : ci 6= 0 . For any η ∈ {1, 2, · · · , ζ − 1}, PL PL (i) (i) (i) if λ1 ≤ η1 j=2 λj , then λπi (1) ≤ η1 j=2 λπi (j) for all i ∈ I; PL PL (i) (i) (ii) if λ1 ≥ η1 j=2 λj , then λπi (1) ≥ η1 j=2 λπi (j) for all i ∈ I. Remark 3. In the above, since λ is ordered, we have L λ1 ≥ 1 X λj . ζ − 1 j=2 (117) Therefore, when η = ζ − 1, the condition in (i) can only be satisfied with an equality, i.e., λ1 = Proof. See Appendix A. 1 ζ−1 PL j=2 λj . The assumption that λ(i) ∈ GL for 1 ≤ i ≤ SL is not invoked in the proof of Lemma 9. By taking this assumption into account, Lemma 9 can be further strengthened with the following setup. For any ordered vector λ ∈ RL + not equal to λ[1] , by the constraint in (117), there exists a unique η ∈ {1, 2, · · · , ζ − 1} such that L L 1 X 1X λj ≤ λ1 < λj . η j=2 η − 1 j=2 (118) In the sequel, we adopt the convention that   ∞, if c 6= 0 1 ·c=  0  1, (119) if c = 0. Then the upper bound in (118) is ∞ when η = 1. [1] Lemma 10. For any ordered vector λ ∈ RL + such that λ 6= λ , assume there exists ci ≥ 0, i = 1, 2, · · · , SL such that SL   X ci λ(i) , f (λ(i) ) . λ, f (λ) = (120) i=1 Then for all i ∈ I, (i) λπi (1) ∈  L 1 X η j=2 (i) λπi (j) , 1 η−1 L X j=2 (i) λπi (j)    , (121) 17 (i) where η depends on λ and is defined in (118). In particular, if the lower bound in (118) is tight, then λπi (1) = PL (i) 1 j=2 λπi (j) for all i ∈ I. η Proof. The lemma can be easily obtained from Lemma 9. See details in Appendix B. (i) Remark 4. For all 1 ≤ i ≤ SL , λπi (1) can in general take one of the θ2 + 1 values prescribed in (108). However, (i) under the constraint (120), the above lemma asserts that for all i ∈ I, λπi (1) can only take one of the two values prescribed in (121). Let R∗ be the collection of nonnegative rate tuples (R1 , R2 , · · · , RL ) such that L X l=1 λl Rl ≥ L X fα (λ)H(Xα ), for all λ ∈ GL . (122) α=1 The next theorem shows that R∗ provides an equivalent characterization of Rsup . Note that R∗ is the intersection of only a finite set of halfspaces. Thus, R∗ is more explicit than Rh . For L = 1, 2, · · · , 5, all the rate constraints of R∗ with ordered coefficient vectors are listed in Appendix I. Theorem 2. Rsup = R∗ . ∗ ∗ Proof. We prove the theorem by showing that Rh = R∗ . Since GL ⊆ RL + , we have Rh ⊆ R . To show R ⊆ Rh , we consider the following. Define three sets of (2L)-vectors by  FL1 = (λ, f (λ)) : λ ∈ RL + , (123) FL2 = {(λ, f (λ)) : λ ∈ GL } , (124)  FL3 = (λ, f (λ)) : λ ∈ GL0 . (125) and Note that none of FL2 and FL3 is a vector space since they are not closed under vector addition. We prove R∗ ⊆ Rh by proving the claim that any (λ, f (λ)) ∈ FL1 is a conic combination of the vectors in FL2 . Without loss of generality, we consider only λ such that λ1 ≥ λ2 ≥ · · · ≥ λL , and show that (λ, f (λ)) for any such λ is a conic combination of the vectors in FL3 . We prove the claim by induction on L for L ≥ 1. Since we consider only λ’s whose minimum nonzero element is equal to 1, it is easy to see that F11 = F13 = {(1, 1)} and thus the claim is true for L = 1. Assume the claim is true for L = N . We will show that the claim is true for L = N + 1. This can readily be +1 +1 verified for λ ∈ RN such that ζ = 1. Thus, we consider only λ ∈ RN such that ζ ≥ 2. For any ordered vector + + λN = (λ2 , λ3 , · · · , λN +1 ) ∈ RN + , let λN +1 = (λ1 , λ2 , · · · , λN +1 ) where λ1 ≥ λ2 . By the induction hypothesis, 0 there exist ci ≥ 0, i = 1, 2, · · · , SN such that 0 (λN , f (λN )) = SN X i=1   (i) (i) ci λN , f (λN ) , (126) 18 (i) (i) (i) (i) (i) 0 0 are distinct elements of GN . Let λN = (λ2 , λ3 , · · · , λN +1 ). Recall that I = {i ∈ where λN , i = 1, 2, · · · , SN 0 0 {1, 2, · · · , SN } : ci 6= 0} in Lemma 9. For simplicity, let ci = 0 for all i ∈ {SN + 1, SN + 2, · · · , SN }. For any i ∈ I, by Lemma 10, we have (i) λ2 ∈  +1 1 N X  η′ j=3  N +1  X 1 (i) (i) , λj λj , ′  η − 1 j=3 (127) where η ′ ∈ {1, 2, · · · , N − 1} is unique and determined by N +1 N +1 1 X 1 X λj . λ ≤ λ < j 2 η ′ j=3 η ′ − 1 j=3 1 η′ Since the second inequality in (128) is equivalent to λ2 < for λ1 : PN +1 j=2 (128) λj , we consider the following three cases PN +1 λj < λ1 ≤ j=2 λj ; P +1 b) λ2 ≤ λ1 ≤ η1′ N j=2 λj ; PN +1 c) λ1 > j=2 λj . PN +1 PN +1 Case a): If η1′ j=2 λj < λ1 ≤ j=2 λj , there exists a unique ϕ ∈ {1, 2, · · · , η ′ − 1} such that a) 1 η′ PN +1 j=2 N +1 N +1 1 X 1 X λj < λ1 ≤ λj . ϕ + 1 j=2 ϕ j=2 (129) Then by Lemma 7, we have fα (λN +1 ) =    1 PN +1 λj , for 1 ≤ α ≤ ϕ + 1 j=1 α For all i ∈ I, let (1,i) λ1 = N +1 1 X (i) λ ϕ + 1 j=2 j and (2,i) (131) N +1 1 X (i) λ . ϕ j=2 j = λ1 (130) for ϕ + 2 ≤ α ≤ N + 1.  fα−1 (λN ), (132) For j ∈ {2, 3, · · · , N + 1}, for notational simplicity, let (1,i) λj (2,i) = λj (i) = λj . (133) Let (1,i) (1,i) (2,i) (2,i) λN +1 = (λ1 (1,i) , λ2 (1,i) , · · · , λN +1 ) (134) and λN +1 = (λ1 (2,i) , λ2 (2,i) , · · · , λN +1 ). (1,i) (135) (2,i) 0 From (127), (108), and the range of ϕ, we can check that λN +1 , λN +1 ∈ GN +1 . By Remark 2 following Lemma 7, we have (1,i) fα (λN +1 ) =    1 PN +1 λ(1,i) , for 1 ≤ α ≤ ϕ + 2 j j=1 α  fα−1 (λ(i) ), N for ϕ + 2 ≤ α ≤ N + 1, (136) 19 and (2,i) fα (λN +1 ) =    1 PN +1 λ(2,i) , for 1 ≤ α ≤ ϕ + 1 j j=1 α  fα−1 (λ(i) ), for ϕ + 1 ≤ α ≤ N + 1. N (1,i) Consider the conic combination of λ1 X (137) for i ∈ I, (1,i) N +1 1 X X (i) λj ci ϕ+1 j=2 = ci λ1 (138) i∈I i∈I  N +1  1 X X (i) ci λj ϕ + 1 j=2 = i∈I 1 ϕ+1 = < λ1 , N +1 X λj (139) j=2 (140) where (138) follows from (131), (139) follows from (126), and (140) follows from (129). Similarly, from (132), (126), and (129), we have X (2,i) ci λ1 ≥ λ1 . (141) i∈I Let u1 = P (1,i) i∈I ci λ1 and u2 = P (2,i) . i∈I ci λ1 (i) λ1 = Then we have u1 < λ1 ≤ u2 . For all i ∈ I, let u2 − λ1 (1,i) λ1 − u1 (2,i) λ + λ . u2 − u1 1 u2 − u1 1 (142) It is easy to check that X (i) ci λ1 = λ1 . (143) i∈I (1) Let ci that = u2 −λ1 u2 −u1 (2) · ci and ci = λ1 −u1 u2 −u1 (1) · ci . It is readily seen that ci (2) and ci   c(1) + c(2) = ci i i  c(1) λ(1,i) + c(2) λ(2,i) = ci λ(i) . 1 1 1 i i are nonnegative, and we can check (144) Then we have from (130), (143), and (144) that λN +1 = X i∈I  (1) (1,i) (2) (2,i) ci λN +1 + ci λN +1 . (145) 20 Following (130), we have for 1 ≤ α ≤ ϕ + 1 that fα (λN +1 ) N +1 1 X λj α j=1 = (146) N +1 1 XX (i) ci λj α j=1 i∈I " # N +1  1 X X  (1) (1,i) (2) (2,i) = ci λj + ci λj α j=1 i∈I    N   +1 +1 X (1)  1 N X X 1 (2) (1,i) (2,i)  ci = + ci λ λ α j=1 j α j=1 j i∈I i X h (1) (2,i) (1,i) (2) = ci fα (λN +1 ) + ci fα (λN +1 ) = (147) (148) (149) i∈I where (147) follows from (126), (148) follows from (133) and (144), and (149) follows from (136) and (137). Similarly, for ϕ + 2 ≤ α ≤ N + 1, following (130), we have fα (λN +1 ) = fα−1 (λN ) X (i) = ci fα−1 (λN ) (150) (151) i∈I = X (1) ci (2) + ci i∈I =  (i) fα−1 (λN ) (152) i X h (1) (2,i) (2) (1,i) ci fα (λN +1 ) + ci fα (λN +1 ) , (153) i∈I where (151) follows from (126), (152) follows from (144), and (153) follows from (136) and (137). In other words, (149) or (153) holds for all 1 ≤ α ≤ N + 1. Summarizing the above, we have      X (1)  (1,i) (1,i) (2) (2,i) (2,i) λN +1 , f (λN +1 ) = ci λN +1 , fα (λN +1 ) + ci λN +1 , fα (λN +1 ) , (154) i∈I  3 and thus λN +1 , f (λN +1 ) is a conic combination of vectors in FN +1 . P P N +1 N +1 1 1 Case b): If λ2 ≤ λ1 ≤ η′ j=2 λj , since the condition η′ j=3 λj ≤ λ2 in (128) is equivalent to λ2 ≥ we have By Lemma 7, we obtain I1 ∪ I2 = I. For i ∈ I1 , let (155) N +1 N +1 1 X 1 X λ ≤ λ ≤ λj . j 1 η ′ + 1 j=2 η ′ j=2 fα (λN +1 ) = In light of (127), let I1 = N +1 1 X λj , η ′ + 1 j=2 n (i) i ∈ I : λ2 (156)    1 PN +1 λj , for 1 ≤ α ≤ η ′ + 1 j=1 α for η ′ + 2 ≤ α ≤ N + 1. n PN +1 (i) o (i) = η′1−1 j=3 λj and I2 = i ∈ I : λ2 =  fα−1 (λN ), (1,i) λ1 (2,i) = λ1 = N +1 1 X (i) λ . η ′ j=2 j (157) 1 η′ PN +1 j=3 (i) λj o , where (158) 21 For i ∈ I2 , let (1,i) λ1 = N +1 1 X (i) λ η ′ + 1 j=2 j (159) N +1 1 X (i) λ . η ′ j=2 j (160) and (2,i) = λ1 (1,i) (2,i) 0 Again, from (127) and (108), we can check that λN +1 , λN +1 ∈ GN +1 for all i ∈ I. By Remark 2 following Lemma 7, we have for i ∈ I1 that (1,i) (2,i) fα (λN +1 ) = fα (λN +1 ) =    1 PN +1 λ(1,i) , j=1 α j  fα−1 (λ(i) ), N and for i ∈ I2 , (1,i) fα (λN +1 ) =  P   1 N +1 λ(2,i) , α j j=1  fα−1 (λ(i) ), N and (2,i) fα (λN +1 ) =    1 PN +1 λ(2,i) , α j j=1  fα−1 (λ(i) ), N for 1 ≤ α ≤ η ′ + 1 (161) for η ′ + 1 ≤ α ≤ N + 1, for 1 ≤ α ≤ η ′ + 2 (162) for η ′ + 2 ≤ α ≤ N + 1, for 1 ≤ α ≤ η ′ + 1 (163) for η ′ + 1 ≤ α ≤ N + 1. Following from (158) and (159), we have X (1,i) ci λ1 = i∈I X ci i∈I1 = N +1 N +1 1 X (i) X 1 X (i) λ + λ c i j η ′ j=2 η ′ + 1 j=2 j i∈I2 N   N +1 +1 X X 1  X 1 X (i) 1 1 (i) λ + λj 1+ ′ ci ′ ci ′ 1 + ′ η η − 1 j=3 j η +1 η j=3 = = N +1 N +1 1 X (i) X 1 X (i) + λ λ c i η ′ − 1 j=3 j η ′ j=3 j i∈I2 i∈I1 X X (i) (i) ci λ2 + ci λ2 X (164) i∈I2 i∈I1 ci i∈I1 (165) (166) i∈I2 = λ2 (167) ≤ λ1 , (168) where (164) and (166) follow from the definition of I1 and I2 . Similar to (146)-(149), we have X (2,i) ci λ1 ≥ λ1 . (169) i∈I (1) For i ∈ I, similar to (142)-(144), let ci (i) = λ1 = u2 −λ1 u2 −u1 (2) · ci , ci = λ1 −u1 u2 −u1 · ci , and u2 − λ1 (1,i) λ1 − u1 (2,i) λ + λ . u2 − u1 1 u2 − u1 1 (170) We can check that X i∈I (i) ci λ1 = λ1 (171) 22 and for all i ∈ I,   c(1) + c(2) = ci i i Then similar to (145)-(154), we have  c(1) λ(1,i) + c(2) λ(2,i) = ci λ(i) . 1 1 1 i i      X (1)  (1,i) (2,i) (2,i) (2) (1,i) λN +1 , fα (λN +1 ) . λN +1 , fα (λN +1 ) + ci λN +1 , f (λN +1 ) = ci (172) (173) i∈I Case c): If λ1 > PN +1 j=2 λj , let λ′N +1 = P N +1 j=2  (1) λj , λ2 , · · · , λN +1 and λN +1 be the (N + 1)-vector with the first component being 1 and the rest being 0. From Lemma 6, we have   N +1  X  (1) (1) λN +1 , f (λN +1 ) + λ′N +1 , f (λ′N +1 ) . λj (λN +1 , f (λN +1 )) = λ1 − (174) j=2 It is easy to see that   (1) (1) 3 λN +1 , f (λN +1 ) ∈ FN +1 . (175) Note that λ′N +1 satisfies the condition for Case a) provided that η ′ 6= 1. Otherwise, it satisfies the condition for  3 Case b). Thus we see that λ′N +1 , f (λ′N +1 ) is always a conic combination of the vectors in FN +1 . This implies 3 that (λN +1 , f (λN +1 )) is a conic combination of the vectors in FN +1 , as is to be proved.  For any λ ∈ RL + , let λL−1 = (λ2 , λ3 , · · · , λL ) and f (λL−1 ) = f1 (λL−1 ), f2 (λL−1 ), · · · , fL−1 (λL−1 ) . The  following lemma provides a method for finding a set of conic combination coefficients for λL−1 , f (λL−1 ) from  the conic combination for λ, f (λ) . [1] Lemma 11. Consider any ordered vector λ ∈ RL + such that λ 6= λ . Assume there exists ci ≥ 0, i = 1, 2, · · · , SL such that SL   X ci λ(i) , f (λ(i) ) , λ, f (λ) = (176) i=1 Then we have SL  X (i) (i) (i) (i) (i) (i)  ci (λ2 , λ3 , · · · , λL ), f (λ2 , λ3 , · · · , λL ) . λL−1 , f (λL−1 ) = (177) i=1 Proof. See Appendix C.   (i) (i) (i) (i) (i) Lemma 12. For any λ(i) ∈ GL , if λ2 , λ3 , · · · , λL ∈ GL−1 , then λ1 = 0 or λπi (1) . Proof. See Appendix D. Lemma 13. For any i0 ∈ {1, 2, · · · , SL }, there does not exist (c1 , c2 , · · · , cSL ) ∈ RS+L such that ci0 = 0 and SL   X ci λ(i) , f (λ(i) ) . λ(i0 ) , f (λ(i0 ) ) = (178) i=1 Proof. See Appendix E. Theorem 2 gives a rate region R∗ that simplifies the characterization of the superposition region. The following theorem shows that there is no redundancy in the specification of R∗ . 23 Theorem 3. For the inequalities specifying R∗ in (122), none of them is implied by the others. Proof. It suffices to show the following: for any i0 ∈ {1, 2, · · · , SL }, if λ(i0 ) = SL X ci λ(i) (179) i=1 for some (c1 , c2 , · · · , cSL ) ∈ RS+L such that ci0 = 0, then the inequality L X (i0 ) λl Rl ≥ SL X L X ci i=1 fα (λ(i0 ) )H(Xα ) (180) α=1 l=1 is tighter than the inequality L X (i) λl Rl l=1 ! ≥ SL X ci i=1 L X ! fα (λ(i) )H(Xα ) . α=1 In view of (179), the LHS of (181) is equal to the LHS of (180), and (181) can be rewritten as ! SL L L X X X (i0 ) (i) ci fα (λ ) H(Xα ). λl Rl ≥ α=1 l=1 (182) i=1 Thus we need to show that the RHS of (180) is always greater than the RHS of (182), i.e., ! SL L L X X X (i) (i0 ) ci fα (λ ) H(Xα ) fα (λ )H(Xα ) > α=1 (181) α=1 (183) i=1 for all possible values of H(Xα ), α ∈ L. By Lemma 8, (179) implies that SL X fα (λ(i0 ) ) ≥ ci fα (λ(i) ), for all α ∈ L. (184) i=1 Upon multiplying by H(Xα ) and summing over all α ∈ L, we obtain L X fα (λ(i0 ) )H(Xα ) ≥ α=1 L X α=1 SL X ! ci fα (λ(i) ) H(Xα ), i=1 (185) which is equivalent to (183) except that the inequality above is nonstrict. Thus to prove (183), we only need to show that there exists at least one α ∈ L such that fα (λ(i0 ) ) > SL X ci fα (λ(i) ). (186) i=1 Assume the contrary is true, i.e. equality holds in (184) for all α ∈ L. Then this implies λ (i0 ) , f (λ (i0 ) SL   X ci λ(i) , f (λ(i) ) , ) = (187) i=1 which is a contradiction to Lemma 13. This completes the proof of the theorem. V. C HECKING THE ACHIEVABILITY OF A R ATE T UPLE The implicit characterization of Rsup obtained in [4] does not provide a method to check the achievability of a given rate tuple because it involves an uncountable number of inequalities. In the last section, we provided an explicit characterization of Rsup that contains only a finite number of inequalities. This makes it possible to check the achievability of any given rate tuple. 24 In this section, we determine the number of inequalities that we need to check. Even though there is no redundancy in the set of inequalities in (122) that specifies R∗ , by taking advantage of the symmetry of the problem, we in fact do not need to check all these inequalities. The next lemma gives the set of the inequalities we need to check. As we will see, the number of such inequalities is significantly smaller than the total number of inequalities specifying R∗ . For any R = (R1 , R2 , · · · , RL ) ∈ RL + and any permutation ω on {1, 2, · · · , L}, recall from the beginning of Section III that  ω(R) = Rω(1) , Rω(2) , · · · , Rω(L) . (188) Due to the symmetry of the problem, for any λ ∈ GL , the inequality L X λl Rl ≥ L X fα (λ)H(Xα ) (189) α=1 l=1 implies the inequality L X λω(l) Rω(l) ≥ L X α=1 l=1  fα ω(λ) H(Xα ), (190) and vice versa. Thus, R is achievable if and only if ω(R) is achievable for all ω. As such, we only need to consider rate tuples R ∈ RL + such that R1 ≤ R2 ≤ · · · ≤ RL . (191) Lemma 14. For any nonnegative rate tuple R such that (191) is satisfied and any λ ∈ RL + , we have L X λi Ri ≥ i=1 L X λπ(i) Ri . (192) i=1 Proof. See Appendix H. From Lemma 2, we can see that RHS of the inequality in (122) does not change with λ replaced by π(λ). Thus, in order to check the achievability of a given rate tuple (assume satisfying (191)), by Lemma 14, we only need to check those inequalities for which the coefficients are in descending order, i.e. λ1 ≥ λ2 ≥ · · · ≥ λL . (193) All the other inequalities are redundant for this rate tuple. Then, the number of inequalities we need to check is only SL0 , which is bounded in the following theorem. Theorem 4. 2L−1 ≤ SL0 ≤ L!. Remark 5. We ran a program on a notebook computer to list all the SL0 inequalities for all L ≤ 15. For L = 16, the computation involved appears to be prohibitive. Proof. We can see from Appendix I that S10 = 1 and S20 = 2. It is easy to check that the theorem is true for L = 1 and L = 2. 25 For L ≥ 2, let λ = (λ1 , λ2 , · · · , λL ) and GL∗ =  λ ∈ GL0 : λL = 0 . For any λ ∈ GL∗ , it is easy to check 0 0 , we have from (108) that (λ1 , λ2 , · · · , λL−1 ) ∈ GL−1 . On the other hand, for any (λ1 , λ2 , · · · , λL−1 ) ∈ GL−1 0 (λ1 , λ2 , · · · , λL−1 , 0) ∈ GL∗ . Thus, there is a one-to-one correspondence between GL∗ and GL−1 , which implies that 0 |GL∗ | = SL−1 . (194) For k ≥ 2, let Dk = |Gk0 \Gk∗ |. By (194) and the fact that Gk∗ ⊆ Gk0 , we have 0 , Dk = Sk0 − Sk−1 (195) which implies that SL0 = S10 + L X Dk . (196) k=2 Now, we only need to calculate Dk for k ≥ 2. For any (λL−k+1 , λL−k+2 , · · · , λL ) ∈ Gk0 \Gk∗ , where λL = 1, we can ∗ 0 \Gk−1 by construction. Thus, all (λL−k+1 , λL−k+2 , · · · , λL ) ∈ see from (108) that (λL−k+2 , λL−k+3 , · · · , λL ) ∈ Gk−1 0 ∗ Gk0 \Gk∗ can be generated from (λL−k+2 , λL−k+3 , · · · , λL ) ∈ Gk−1 \Gk−1 with a proper choice of λL−k+1 . Since λL = 1, we have ζ = L. Recall from (109) that θL = 0 and for j = L − 1, L − 2, · · · , L − k + 1, θj is the integer such that L 1 X λi . λj = θj i=j+1 (197) According to (197), the k-vector (λL−k+1 , λL−k+2 , · · · , λL ) ∈ Gk0 \Gk∗ is uniquely determined by the tuple (θL−k+1 , · · · , θL−1 , θL ). Thus Dk is equal to the cardinality of the set  Θk = (θL−k+1 , · · · , θL−1 , θL ) : 1 ≤ θj ≤ θj+1 + 1 for j = L − 1, L − 2, · · · , L − k + 1 . (198) By straightforward counting, we can obtain Dk = |Θk | = θX L +1 0 X θL−k+2 +1 θL−1 +1 X ··· X 1. (199) θL−k+1 =1 θL =0 θL−1 =1 θL−2 =1 Now we bound Dk according to (199). Observe that θL = 0 and θL−1 = 1 always hold. Then for k ≥ 3, (199) can be rewritten as Dk = θL−2 +1 2 X X θL−k+2 +1 θL−2 =1 θL−3 =1 Let (1) Dk = 2 X 2 X 2 X 3 X X ··· (2) Dk = 2 X ··· θL−2 =1 θL−3 =1 and 1. (200) 1 (201) 1. (202) θL−k+1 =1 θL−k+1 =1 ··· θL−2 =1 θL−3 =1 k−1 X θL−k+1 =1 From (111), it is easy to check that (1) (2) Dk ≤ Dk ≤ Dk , (203) and we have (1) Dk = 2k−2 (204) 26 and (2) Dk = (k − 1)! . Thus, for L ≥ 3, we have L X (1) Dk = k=3 and L X L X (205) 2k−2 = 2L−1 − 2 (206) k=3 (2) = Dk k=3 L X (k − 1)! k=3 ≤ (L − 1)! × (L − 2) ≤ L! − 2. (207) Then, by (196), (203), and the fact that S10 = 1 and D2 = 1, we have for L ≥ 3 that 2L−1 ≤ SL0 ≤ L! . (208) This proves the theorem. VI. S UBSET E NTROPY I NEQUALITY In [4], the proof of the optimality of superposition coding was established through a subset entropy inequality, namely Theorem 3 therein. As we will point out, this subset entropy inequality is in fact a generalization of Han’s inequality [10]. The proof of Theorem 3 in [4], however, is painstaking. In this section, we present a weaker version of this theorem, namely Theorem 5 below, whose proof is considerably simpler. With our explicit characterization of Rsup in Theorem 2, Theorem 5 is sufficient for proving the optimality of superposition coding.  Theorem 5 (Subset entropy inequality). Let L ≥ 2 and for any u ∈ {0, 1}L , let Hu = H Wi : ui = 1 . For any λ ∈ GL , there exists {cα (u)}, α ∈ L, where {cα (u)} is an optimal α-resolution for λ, such that X X cα−1 (u)Hu ≥ cα (u)Hu (209) u∈Ωα L u∈Ωα−1 L for all α = 2, 3, · · · , L. Remark 6. Theorem 3 in [4] is the same as Theorem 5 above except that the former is for all λ ∈ RL + . By the explicit characterization of Rsup in Theorem 2, namely R∗ , Theorem 5 is sufficient for proving the tightness of R∗ . Remark 7. For α ∈ L and u ∈ Ωα L , let c̃α (u) = 1 . (210) L−1 α−1 It is not difficult to see that for all α ∈ L, {c̃α (u) : u ∈ Ωα L } is the unique optimal α-resolution for λ = 1. Then (209) in Theorem 5 becomes 1  L−1 α−2 X u∈Ωα−1 L Hu ≥ 1  L−1 α−1 X Hu , (211) u∈Ωα L which is Han’s inequality [10]. It was proved in [6] that both Han’s inequality and the subset entropy inequality in [4] can be established from the subset entropy inequality of Madiman and Tetali [11]. 27 Proof of Theorem 5. By symmetry, we only have to prove the theorem for λ ∈ GL0 . We will prove the theorem by induction on L. It is easy to check that the theorem is true for L = 2. Assume the theorem is true for L = N − 1, 0 we will show that the theorem is also true for L = N . This can be readily verified for λ ∈ GN such that ζ = 1. 0 Thus, we only need to consider λ ∈ GN such that ζ ≥ 2. 0 0 For any λN = (λ1 , λ2 , · · · , λN ) ∈ GN , by the construction in (108), we have λN −1 = (λ2 , λ3 , · · · , λN ) ∈ GN −1 .  For α ∈ {1, 2, · · · , N − 1}, by the induction hypothesis, let c̃α (u) : u ∈ Ωα N −1 be an optimal α-resolution for λN −1 such that (209) is satisfied for all α = 2, 3, · · · , N − 1. Now we need to design a proper optimal α-resolution {cα (w) : w ∈ Ωα N } for λN that satisfies (209) for all α = 2, 3, · · · , N . From (108), there exists a θ ∈ {1, 2, · · · , N − 1} such that N λ1 = 1X λi . θ i=2 (212) For any u ∈ {0, 1}N −1 and w ∈ {0, 1}N , let u = (u2 , u3 · · · , uN ) and w = (w1 , w2 , · · · , wN ). For α = 1, 2, · · · , N , we now construct an α-resolution for λN in (i) and (ii) in the following. (i) Design {cα (w)} for α = θ + 1, θ + 2, · · · , N . For α ≥ θ + 1 and w ∈ Ωα N , let cα (w) =   c̃α−1 (u), if w = (1, u), u ∈ Ωα−1 N −1  0, From (212), we have (213) otherwise. N 1 X λi λ1 ≥ α − 1 i=2 for all α = θ + 1, θ + 2, · · · , N. (214) Lemma 9 in [4] states that {cα (w)} is an optimal α-resolution for λN if N λ1 > 1 X λi α − 1 i=2 for all α = θ + 1, θ + 2, · · · , N. (215) We observe that the lemma can be strengthened by replacing the strict inequality in (215) by a non-strict inequality (i.e., the condition in (214)) with essentially no change in the proof. Thus, by invoking this strengthened version of the lemma, we conclude that {cα (w)} is an optimal α-resolution for λN . For all α = θ + 2, θ + 3, · · · , N , following the steps leading to (48) in [4], we can check that X cα−1 (w)Hw ≥ w∈Ωα−1 N X cα (w)Hw . (216) w∈Ωα N (ii) Design {cα (w)} for α = 1, 2, · · · , θ. For α = 2, 3, · · · , θ + 1 and any optimal α-resolution {cα (w) : w ∈ Ωα N } for λN , we claim that there exists an optimal (α − 1)-resolution {cα−1 (w) : w ∈ Ωα−1 N } for λN such that (209) is satisfied. Since P N 1 λ1 ≤ α−1 i=2 λi , this is exactly the first case of the proof of Proposition 1 in [4], which is relatively straightforward. 0 In (i) and (ii) above, we have constructed an optimal α-resolution {cα (w)} for any λN ∈ GN that satisfies (209) for all α = 2, 3, · · · , N . This proves the theorem. 28 VII. C ONCLUSION In this paper, we studied the problem of SMDC for which superposition coding was proved to be optimal in [1], [4]. We enhanced their results by obtaining in closed form the minimum set of inequalities that is needed for characterizing Rsup , the superposition coding rate region. We further show by the symmetry of the problem that only a much smaller subset of these inequalities needs to be verified in determining the achievability of a given rate tuple. Yet, the cardinality of this smaller set grows at least exponentially fast with L, thus revealing the inherent complexity of the problem. A subset entropy inequality, which plays a key role in the converse proof in [4], requires a painstaking and extremely technical and proof. We present a weaker version of this subset entropy inequality whose proof is considerably simpler. With our explicit characterization of the coding rate region, this weaker version of the subset entropy inequality is sufficient for proving the optimality of superposition coding. Some of our results may be extensible to the more general settings in [5]–[9]. A PPENDIX A P ROOF L EMMA 9 PL We first prove (i). By Lemma 7 (i), the condition λ1 ≤ η1 j=2 λj implies that OF L 1 X λj . η + 1 j=1 fη+1 (λ) = (217) In the following, we prove the claim by contradiction. Assume there exists a nonempty subset I1 ⊆ I such that i ∈ I1 if and only if (i) λπi (1) > L 1 X (i) , λ η j=2 πi (j) (218) which is equivalent to L X (i) λπi (j) j=1 or  L  1 X (i) , λ > 1+ η j=2 πi (j) L (219) L 1 X (i) 1 X (i) . λπi (j) > λ η + 1 j=1 η j=2 πi (j) (220) For all i ∈ I, by Lemma 7 (ii), the condition in (218) implies that By Theorem 1, we have   (i) (i) (i) fη+1 λ(i) = fη λπi (2) , λπi (3) , · · · , λπi (L) . (221) L (i) (i) (i) fη (λπi (2) , λπi (3) , · · · , λπi (L) ) ≤ 1 X (i) . λ η j=2 πi (j) (222) Then by (221), (222), and (220) we obtain L L 1 X (i) 1 X (i) fη+1 (λ ) < λπi (j) = λ . η + 1 j=1 η + 1 j=1 j (i) (223) For i ∈ I\I1 , we have (i) λπi (1) ≤ L 1 X (i) , λ η j=2 πi (j) (224) 29 which by Lemma 7 (i) implies that L fη+1 (λ(i) ) = 1 X (i) λ . η + 1 j=1 j (225) Thus, we have from (116) that fη+1 (λ) = SL X ci fη+1 (λ(i) ) i=1 = X ci fη+1 (λ(i) ) + i∈I1 < = X ci fη+1 (λ(i) ) i∈I\I1  L X 1 (i) λj  ci  η + 1 j=1 i=1 ! S L L 1 X X (i) ci λj η + 1 j=1 i=1 SL X  L = 1 X λj , η + 1 j=1 (226) where the inequality follows from (223) and (225). This is a contradiction to (217). Thus, the assumption in (218) is false and we have for all i ∈ I that (i) λπi (1) ≤ L 1 X (i) . λ η j=2 πi (j) (227) Next, we prove (ii) by contradiction. Assume there exists a nonempty subset I2 ⊆ I such that i ∈ I2 if and only if (i) λπi (1) < L 1 X (i) , λ η j=2 πi (j) (228) which is equivalent to L L 1 X (i) 1 X (i) , λπi (j) < λ η + 1 j=1 η j=2 πi (j) or gη+1,λ(i) (0) < gη+1,λ(i) (1). (229) (230) For any i ∈ I2 , by Lemma 7 (i), (228) implies that fη+1 (λ(i) ) = gη+1,λ(i) (0). (231) For any t ∈ {1, 2, · · · , η}, in light of (230), by applying the alternative version of Lemma 3 (ii) (see the remark below Lemma 3), we obtain fη+1 (λ(i) ) = gη+1,λ(i) (0) < gη+1,λ(i) (1) < · · · < gη+1,λ(i) (t). (232) Then it follows from the definition of πi (·) in (115) that fη+1 (λ(i) ) < gη+1,λ(i) (t) = L L X X 1 1 (i) (i) λπi (j) ≤ λ , η + 1 − t j=t+1 η + 1 − t j=t+1 j (233) 30 and so fη+1 (λ(i) ) < L X 1 (i) λ . η + 1 − t j=t+1 j (234) For all i ∈ I\I2 and any t ∈ {1, 2, · · · , η}, by Theorem 1, similar to (233), we have fη+1 (λ(i) ) ≤ gη+1,λ(i) (t) = L L X X 1 1 (i) (i) λπi (j) ≤ λ , η + 1 − t j=t+1 η + 1 − t j=t+1 j and so fη+1 (λ(i) ) ≤ (235) L X 1 (i) λ . η + 1 − t j=t+1 j (236) Thus, by (116), we have for any t ∈ {1, 2, · · · , η} that fη+1 (λ) = SL X ci fη+1 (λ(i) ) i=1 < =   L X 1 (i) ci  λj  η + 1 − t i=1 j=t+1 SL X L X 1 λj η + 1 − t j=t+1 = gη+1,λ (t), (237) where the inequality follows from (234) and (236). PL The condition λ1 ≥ η1 j=2 λj is equivalent to gη+1,λ (0) ≥ gη+1,λ (1). (238) Then by Theorem 1, we have fη+1 (λ) = min β∈{0,1,··· ,η} gη+1,λ (β) = min β∈{1,2,··· ,η} gη+1,λ (β). (239) Thus, there must exist a t ∈ {1, 2, · · · , η} such that fη+1 (λ) = gη+1,λ (t), (240) which is a contradiction to (237). Thus the assumption in (228) is false and we have for all i ∈ I that (i) λπi (1) ≥ L 1 X (i) . λ η j=2 πi (j) (241) A PPENDIX B P ROOF OF L EMMA 10 (i) 1 η For all i ∈ I, since λ(i) ∈ GL in light of (108), we only need to prove λπi (1) ≤ PL (i) j=2 λπi (j) . 1 η−1 PL j=2 (i) (i) λπi (j) and λπi (1) ≥ (i) We first prove the upper bound on λπi (1) . For η = 1 and i = 1, we have L (i) λπi (1) = 1 = 1 X (i) . λ η − 1 j=2 πi (j) (242) 31 For η = 1 and i ∈ I\{1}, it is obvious that L (i) λπi (1) < 1 X (i) = ∞. λ η − 1 j=2 πi (j) (243) For η ∈ {2, 3, · · · , ζ − 1}, the upper bound in (118) can be rewritten as λ1 < L 1 X λj , η ′ j=2 (244) where η ′ = η − 1 and η ′ ∈ {1, 2, · · · , ζ − 2}. By Lemma 9 (i), this implies that (i) λπi (1) ≤ L L 1 X (i) 1 X (i) . = λ λ η ′ j=2 πi (j) η − 1 j=2 πi (j) (245) (i) Thus, the upper bound on λπi (1) is proved. (i) Now we prove the lower bound on λπi (1) . For η ∈ {1, 2, · · · , ζ − 1}, the lower bound in (118) is λ1 ≥ L 1X λj , η j=2 (246) and so by Lemma 9 (ii), we have (i) λπi (1) ≥ L 1 X (i) . λ η j=2 πi (j) (247) If the lower bound in (118) is tight, it follows immediately from Lemma 9 that for any η ∈ {1, 2, · · · , ζ − 1}, (i) λπi (1) = L 1 X (i) . λ η j=2 πi (j) (248) This proves the lemma. A PPENDIX C P ROOF OF L EMMA 11 We only need to show that for α = 1, 2, · · · , L − 1, SL X (i) (i) (i) ci fα (λ2 , λ3 , · · · , λL ). (249) By (118) and Lemma 10, we have for i ∈ I that   L L 1 X  X 1 (i) (i) (i) λπi (1) ∈ λπi (j) , λπi (j) . η  η − 1 j=2 j=2 (250) fα (λL−1 ) = i=1 Consider the following two cases: i) α = 1, 2, · · · , η − 1; ii) α = η, η + 1, · · · , L − 1. Case i): For α = 1, 2, · · · , η − 1, if η = 2, then α can only be 1 and it is easy to see that f1 (λL−1 ) = L X j=2 λj = SL L X X j=2 i=1 (i) ci λj = SL X i=1 ci L X j=2 (i) λj = SL X i=1 (i) (i) (i) ci f1 (λ2 , λ3 , · · · , λL ). (251) 32 If η > 2, consider the following. The second inequality in (118) is equivalent to L L 1 X 1X λj < λj η j=1 η − 1 j=2 or (252) gη,λ (0) < gη,λ (1). (253) By applying the alternative version of Lemma 3 (ii) (see the remark below Lemma 3), we obtain gη,λ (1) < gη,λ (2), (254) which is equivalent to L L 1 X 1 X λj < λj η − 1 j=2 η − 2 j=3 or (255) L λ2 < 1 X λj . η − 2 j=3 (256) Then by Lemma 7 (i), we have fα (λL−1 ) = gα,λL−1 (0) = L 1X λj . α j=2 (257) Since (250) implies L (i) λπi (1) ≤ 1 X (i) , λ η − 1 j=2 πi (j) (258) similar to (252)-(256) (with all <’s replaced by ≤’s), we have L (i) λπi (2) ≤ 1 X (i) . λ η − 2 j=3 πi (j) (259) Thus, following (258) and (259), we have L (i) λπi (1) ≤ ≤ 1 X (i) λ η − 1 j=2 πi (j) 1 η−1  X L 1 (i) λπi (j) +1 η−2 j=3 L = ≤ 1 X (i) λ η − 2 j=3 πi (j) 1 η−2 X (i) λπi (j) (260) j∈{2,3,··· ,L}\{j0 } for any j0 ∈ {2, 3, · · · , L}. Let πi′ (·) be a permutation of {2, 3, · · · , L} defined as follows: a) if πi (1) = 1, then πi′ (j) = πi (j) for all j ∈ {2, 3, · · · , L}; b) if πi (j0 ) = 1 for some j0 ∈ {2, 3, · · · , L}, then   πi (j − 1), for j = 2, 3, · · · , j0 πi′ (j) =  πi (j), for j = j0 + 1, · · · , L. (261) 33 It is easy to check that (i) (i) (i) λπ′ (2) ≥ λπ′ (3) ≥ · · · ≥ λπ′ (L) . (262) i i i If a) holds, then by (259), we have L L 1 X (i) 1 X (i) λπi (j) = λ ′ . η − 2 j=3 η − 2 j=3 πi (j) (i) (i) λπ′ (2) = λπi (2) ≤ i (263) If b) holds, then by (260), we have (i) (i) λπ′ (2) = λπi (1) ≤ i L 1 η−2 (i) X λπi (j) = j∈{2,3,··· ,L}\{j0 } 1 X (i) λ ′ . η − 2 j=3 πi (j) (264) Summarizing the two cases, we see that L (i) λπ′ (2) ≤ i 1 X (i) λ ′ η − 2 j=3 πi (j) (265) always holds. By Lemma 7 (i), this implies that L (i) (i) (i) fα (λ2 , λ3 , · · · , λL ) = L 1 X (i) 1 X (i) λπ′ (j) = λ . i α j=2 α j=2 j (266) Following (257), we have L 1X λj α j=2 fα (λL−1 ) = (267) ! SL L 1X X (i) ci λj α j=2 i=1   SL L X X 1 (i) ci  λj  α i=1 j=2 = = SL X = (i) (i) (268) (269) (i) ci fα (λ2 , λ3 , · · · , λL ), (270) i=1 where (268) follows from (176) and (270) follows from (266). Case ii): For α = η, η + 1, · · · , L − 1, by Lemma 7 (ii), the first inequality in (118) implies that fα (λL−1 ) = fα+1 (λ). (i) For any i ∈ {1, 2, · · · , SL }, since (250) implies λπi (1) ≥ 1 η PL (271) (i) j=2 λπi (j) , we have by Lemma 7 (ii) that  (i) (i) (i) fα+1 (λ(i) ) = fα λπi (2) , λπi (3) , · · · , λπi (L) . (272) From the definition of πi′ (·), it is readily seen that (i) (i) λπi (j) ≤ λπ′ (j) , for all j = 2, 3, · · · , L. (273) i Thus, we have for any β = 1, 2, · · · , α − 1 that L L X X 1 1 (i) (i) λπi (j) ≤ λπ′ (j) . i α−β α−β j=β+1 j=β+1 (274) 34 By Theorem 1, this implies that   (i) (i) (i) (i) (i) (i) fα λπi (2) , λπi (3) , · · · , λπi (L) ≤ fα λπ′ (2) , λπ′ (3) , · · · , λπ′ (L) , (275) i i i and thus by (272), we have (i) (i) (i)  fα+1 (λ(i) ) ≤ fα λ2 , λ3 , · · · , λL . Following (271), we have fα (λL−1 ) = (276) fα+1 (λ) SL X = (277) ci fα+1 (λ(i) ) (278) i=1 SL X ≤ (i) (i)  (i) ci fα λ2 , λ3 , · · · , λL i=1 ≤ fα SL X (i) (i) ci λ2 , λ3 , · · · i=1 = fα SL X (i) ci λ2 , SL X = fα (λ2 , λ3 , · · · , λL ) = fα (λL−1 ), ! (i)  , λL (i) ci λ3 , · · · i=1 i=1 (279) , SL X i=1 (280) (i) ci λL ! (281) (282) (283) where both (278) and (282) follow from (176), (279) follows from (276), and (280) follows from Lemma 8. Upon observing that the LHS of (277) is the same as the RHS of (283), we conclude that the inequalities in both (279) and (280) are tight, and hence fα (λL−1 ) = SL X i=1 The lemma is proved. (i) (i) (i)  ci fα λ2 , λ3 , · · · , λL . (284) A PPENDIX D P ROOF L EMMA 12  (i) (i) (i) Fix i ∈ {1, 2, · · · , SL } and assume that λ2 , λ3 , · · · , λL ∈ GL−1 . Let γj , j = 1, 2, · · · , ζ − 1 be the integer OF  such that (i) λπi (j) = L 1 X (i) λπi (k) , γj (285) k=j+1 and let γζ = 0. Note that the role of γj for λ(i) is the same as the role of θj for λ (cf. (109)). Also note that ζ and γj depend on i, but since we fix i, this dependence is omitted to simplify notation. Let j0 ∈ {1, 2, · · · , L} be such that (i) (i) λπi (j0 ) = λ1 . (286) (i) If j0 ≥ ζ + 1, λ1 = 0 and thus the lemma is proved. If j0 = 1, the lemma is immediate from (286). If 2 ≤ j0 ≤ ζ, (i) (i) we claim that γj = γj0 + (j0 − j) and λπi (j) = λπi (j0 ) for all j = j0 , j0 − 1, · · · , 1. Then the lemma follows from 35 the claim for j = 1. In the following, we prove the claim by induction on j for j ≤ j0 . The claim is immediate for j = j0 . Assume the claim is true for j = j0 , j0 − 1, · · · , N for some N ∈ {2, 3, · · · , j0 }, and we will show that the claim is also true for j = N − 1. By the induction hypothesis, we have γN = γj0 + (j0 − N ), (287) and for all j = j0 , j0 − 1, · · · , N , L X 1 γj0 (i) (i) λπi (j) = λπi (j0 ) = (i) λπi (k) . (288) k=j0 +1 By (108) and (110), there exists γN −1 ∈ {1, 2, · · · , γj0 + (j0 − N + 1)} such that (i) λπi (N −1) L X 1 = γN −1 (i) = = = 1 γN −1 L X (i) λπi (k) . (290) k=N Thus, we have λπi (N −1) (289) (i) λπi (k) k=N j0 X 1 1+ γj0 1 γN −1 k=N ! L X (i) λπi (k) (291) k=j0 +1 L γj0 + (j0 − N + 1) X (i) λπi (k) , γj0 γN −1 (292) k=j0 +1 where (291) follows from (288). In light of (286) and j0 ≥ 2, recall the definition of πi′ (·) in (261). With the   (i) (i) (i) ′ assumption that λ2 , λ3 , · · · , λL ∈ GL−1 , by (108), there exists an integer γN −1 such that (i) λπ′ (N ) i = or (i) λπi (N −1) = 1 ′ γN −1 L X 1 ′ γN −1   jX 0 −1 (i) λπ′ (k) (i) λπi (k) + k=N L X (i) k=N (i) λπi (k) > jX 0 −1 k=N (i) λπi (k) + (i) k=j0 +1 Comparing the RHS of (290) and (294), since λπi (j0 ) ≥ 1, we have L X (293) i k=N +1 L X  λπi (k)  . (i) λπi (k) . (294) (295) k=j0 +1 ′ Since the LHS of (290) and (294) are the same, we see that γN −1 < γN −1 , which implies that ′ γN −1 ≤ γj0 + (j0 − N ). (296) 36 Following (294), we have (i) λπi (N −1) = = = 1 ′ γN −1 1   ′ γN −1 jX 0 −1 (i) λπi (k) + k=j0 +1 k=N 1+ L X jX 0 −1 k=N 1 γj0 ! L X  (i) λπi (k)  (i) λπi (k) (297) k=j0 +1 L γj0 + (j0 − N ) X (i) λπi (k) , ′ γj0 γN −1 (298) k=j0 +1 where (297) follows from (288). Comparing (292) and (298), it is easy to see that ′ γN −1 = γN −1 [γj0 + (j0 − N )] . γj0 + (j0 − N + 1) (299) Since γj0 + (j0 − N ) and γj0 + (j0 − N + 1) are coprime and γN −1 ≤ γj0 + (j0 − N + 1) by (289), we have γN −1 = γj0 + (j0 − N + 1). (i) (300) (i) Substituting (300) into (292) and invoking (287), we have λπi (N −1) = λπi (j0 ) . This implies that the claim is true for j = N − 1. The lemma is proved. A PPENDIX E P ROOF OF L EMMA 13 Since there is only one vector in G1 , we only need to consider L ≥ 2. If ζ = 1 for λ(i0 ) , it is obvious that λ(i0 ) cannot be a conic combination of the other vectors in GL . Thus, we consider only λ(i0 ) ∈ GL such that ζ ≥ 2. We prove the lemma by induction on L for L ≥ 2. We first check that the claim is true for L = 2. It is easy to see    from (108) that G2 = {(1, 0), (0, 1), (1, 1)}. Then f (1, 0) = f (0, 1) = (1, 0) and f (1, 1) = (2, 1). Since (1, 1) = (1, 0) + (0, 1) (301)    f2 (1, 1) > f2 (1, 0) + f2 (0, 1) , (302) whereas    we see that (1, 1), f (1, 1) cannot be a conic combination of (1, 0), f (1, 0) and (0, 1), f (0, 1) . Thus, the lemma is true for L = 2. For any L ≥ 3, the lemma will be proved by contradiction via the following proposition, whose proof is given in Appendix F. Proposition 1. If Lemma 13 is false for any L ≥ 3, then the lemma is false for L − 1. By backward induction, if Lemma 13 is false for any L ≥ 3, then the lemma is false for L = 2. This is a contradiction because we already have shown that the lemma is true for L = 2. This proves the lemma for all L ≥ 2. 37 A PPENDIX F P ROOF OF P ROPOSITION 1 Assume Lemma 13 is false for some L ≥ 3, i.e., for some i0 ∈ {1, 2, · · · , SL }, there exists (c1 , c2 , · · · , cSL ) ∈ RS+L such that ci0 = 0 and SL   X ci λ(i) , f (λ(i) ) . λ(i0 ) , f (λ(i0 ) ) = (303) i=1 Assume without loss of generality that λ(i0 ) ∈ GL0 . Since we assume at the beginning of Appendix E that (i ) (i ) (i )  0 ζ ≥ 2 for λ(i0 ) , we can see from (108) that λ2 0 , λ3 0 , · · · , λL 0 ∈ GL−1 by construction. Let GL−1 = n o (1) (2) (SL−1 ) λL−1 , λL−1 , · · · , λL−1 . Then there exists a unique j0 ∈ {1, 2, · · · , SL−1 } such that   (i ) (i ) (i ) (j0 ) (304) = λ2 0 , λ3 0 , · · · , λL 0 . λL−1 By Lemma 11, (303) implies that SL X (i) (i) (i) (i) (i) (i)  (j0 ) (j0 )  ci (λ2 , λ3 , · · · , λL ), f (λ2 , λ3 , · · · , λL ) . λL−1 , f (λL−1 ) = (305) i=1 o  n  (j0 ) (i) (i) (i) (j ) , and Let KL = {1, 2, · · · , SL }, IL = {i ∈ KL : ci 6= 0}, KL 0 = i ∈ KL : λ2 , λ3 , · · · , λL = λL−1 X d0 = ci . (306) (j ) i∈KL 0 In the proof of Theorem 2, we have shown that any vector in FL1 is a conic combination of the vectors in FL2 .   (j ) (i) (i) (i) S Then for any i ∈ KL \KL 0 , there exists t1 , t2 , · · · , tSL−1 ∈ R+L−1 such that SL−1 X (i) (j) (j)  (i) (i) (i) (i) (i) (i)  tj λL−1 , f (λL−1 ) . (λ2 , λ3 , · · · , λL ), f (λ2 , λ3 , · · · , λL ) = (307) j=1 Substitute (306) and (307) into (305), we have (j0 ) (j0 )  λL−1 , f (λL−1 ) (j0 ) (j0 )  , f (λL−1 ) + = d0 λL−1   = d0 + (j ) i∈KL \KL 0  = d0 + Thus,   1 − d0 − X (j ) (i)  ci tj0   ci  SL−1 X (i) tj j=1 (j0 )  (j0 ) ) , f (λL−1 λL−1 + (j ) (j0 )  (j0 ) (i)  ) + , f (λL−1 ci tj0  λL−1 (j0 )  (j0 ) (i)  ) = , f (λL−1 ci tj0  λL−1 X j∈KL−1 \{j0 }   (j) (j) λL−1 , f (λL−1 )  X (j ) i∈KL \KL 0  i∈KL \KL 0  i∈KL \KL 0 X (j ) i∈KL \KL 0  X  X    X ci    (j )   (j0 ) (i) (i) (i) . Proposition 2. There exists i ∈ IL such that λ2 , λ3 , · · · , λL 6= λL−1 (i) tj X  (j)  (j) λL−1 , f (λL−1 )   (j ) i∈KL \KL 0  i∈KL \KL 0 X j∈KL−1 \{j0 }  j∈KL−1 \{j0 } X  (j)  (j) (i)  ci tj  λL−1 , f (λL−1 ) . (j)  (j) (i)  ci tj  λL−1 , f (λL−1 ) . (308) (309) 38 The proof of Proposition 2 is given in Appendix G. The proposition implies that (j ) IL ∩ (KL \KL 0 ) 6= ∅. (310) (j ) For any i ∈ IL ∩ (KL \KL 0 ), we can rewrite (307) as follows: (i) (i) (i) (i) (i) (i)  (λ2 , λ3 , · · · , λL ), f (λ2 , λ3 , · · · , λL ) X (j)  (j) (i) (j0 )  (j0 ) (i) tj λL−1 , f (λL−1 ) . ) + , f (λL−1 = tj0 λL−1 (311) j∈KL−1 \{j0 } Since (i) (i) (λ2 , λ3 , · · · (i) , λL ) 6= (j0 ) λL−1 , there must exist j ∈ KL−1 \{j0 } such that (i) tj > 0. (312) L−1 L−1 For any x, y ∈ R+ , define a binary relation ‘>’ by x > y if and only if (x − y) ∈ R+ , i.e., x is strictly greater than y in at least one component (cf. (7)). Then for the RHS of (309), we have   X X  (j)  (j) (i)  ci tj  λL−1 , f (λL−1 )  j∈KL−1 \{j0 } X = (j ) i∈KL \KL 0 (j ) i∈KL \KL 0 X =  (i) X ci  tj (j) (j) λL−1 , f (λL−1 j∈KL−1 \{j0 } (j ) i∈IL ∩(KL \KL 0 ) > 0,  (i) X ci  tj j∈KL−1 \{j0 }   )    (j) (j) λL−1 , f (λL−1 )  (313) (j) where the inequality follows from (310), (312) and the fact that λL−1 > 0 for all j ∈ KL−1 \{j0 }. Then we can see from (309) that which implies that   1 − d0 −  X (j ) i∈KL \KL 0 (j0 ) (j0 )  (i)  , f (λL−1 ) > 0, ci tj0  λL−1 X 1 − d0 − (i) ci tj0 > 0. (314) (315) (j ) i∈KL \KL 0 For each j ∈ KL−1 \{j0 }, let dj = 1 1 − d0 − P (j ) i∈KL \KL 0 (i) c i tj . (i) ci tj0 (j ) i∈KL \KL 0 X (316) It is easy to see that dj ≥ 0 for all j ∈ KL−1 \{j0 }. By (313), there exists j ∈ KL−1 \{j0 } such that dj > 0. Upon letting dj = 0 for j = j0 , by (309) and (316), we have SL−1 (j0 ) (j0 )  λL−1 , f (λL−1 ) = X j=1 (j) (j)  dj λL−1 , f (λL−1 ) . This means that Lemma 13 is false for L − 1. The proposition is proved. (317) 39 A PPENDIX G P ROOF OF P ROPOSITION 2 Since λ(i0 ) ∈ GL0 , there exists a unique ηi0 ∈ {0, 1, · · · , L − 1} such that L 1 X (i0 ) (318) λ . ηi0 j=2 j   (i ) (i ) (i ) = λ2 0 , λ3 0 , · · · , λL 0 . Since we assume at the beginning of Appendix E that (i ) λ1 0 = (j ) 0 Recall from (304) that λL−1 ζ ≥ 2 for λ(i0 ) , we see that (j ) 0 λL−1 6= 0, which implies that PL j=2 (319) (i ) (i ) λj 0 > 0. Then we have ηi0 6= 0, otherwise λ1 0 = ∞ in (318). Thus, ηi0 ∈ {1, 2, · · · , L − 1}. By Remark 2 following Lemma 7, we have L (j ) 0 )= fηi0 +1 (λ(i0 ) ) = fηi0 (λL−1 1 X (i0 ) λj . ηi0 + 1 (320) j=1 We now prove the proposition by contradiction. Assume that for all i ∈ IL ,   (i) (i) (i) (j0 ) λ2 , λ3 , · · · , λL = λL−1 . (321) This means that for each i ∈ IL ,     (i) (i) (i) (i) (i) (i ) (i ) (i ) λ(i) = λ1 , λ2 , λ3 , · · · , λL = λ1 , λ2 0 , λ3 0 , · · · , λL 0 . (j ) 0 Furthermore, since λ(i0 ) ∈ GL0 , we see from (108) that λL−1 (i) (i) 0 GL−1 . Then by Lemma 12, we have λ1 = 0 or λπi (1) . (322)   (i) (i) (i) 0 ∈ GL−1 by construction, so that λ2 , λ3 , · · · , λL ∈ (i) (i) Let IL0 be the subset of IL such that i ∈ IL0 if and only if λ1 = 0. For i ∈ IL0 , it is easy to see that λπi (L) = 0. Then upon noting that by Theorem 1 we have     (i ) (i ) (i ) (i) (i) (i) λπi (1) , λπi (2) , · · · , λπi (L−1) = λ2 0 , λ3 0 , · · · , λL 0 , (i) fηi0 +1 (λ ) = (323) L−1 X (i) 1 min λπi (j) β∈{0,1,··· ,ηi0 } (ηi0 + 1) − β j=β+1 = L X 1 (i ) λj 0 β∈{0,1,··· ,ηi0 } (ηi0 + 1) − β min j=β+2 = (j0 ) ) fηi0 +1 (λL−1 < 0 ), fηi0 (λL−1 (j ) (324) where the inequality follows from Lemma 5 in [4]. By (320), this implies that L fηi0 +1 (λ(i) ) < (i) (i) X (i ) 1 λ 0 . ηi0 + 1 j=1 j (325) For i ∈ IL \IL0 , we have λ1 = λπi (1) . Since λ(i) ∈ GL , there exists a unique ηi ∈ {0, 1, · · · , L − 1} such that (i) λ1 = L 1 X (i) λ . ηi j=2 j (326) 40   (i) (i) (i) From (319) and the assumption in (321), we have λ2 , λ3 , · · · , λL 6= 0. Then from (326), we have ηi 6= 0, and thus ηi ∈ {1, 2, · · · , L − 1}. Since ci0 = 0 in (303), we have λ(i) 6= λ(i0 ) for all i ∈ IL and hence for all (i) (i ) i ∈ IL \IL0 . In light of (322), λ(i) 6= λ(i0 ) implies λ1 6= λ1 0 , and upon comparing (318) and (326), we see that ηi 6= ηi0 . (327) Let IL1 = {i ∈ IL \IL0 : ηi > ηi0 } and IL2 = {i ∈ IL \IL0 : ηi < ηi0 }. Then we can see from (327) that IL0 ∪ IL1 ∪ IL2 = IL . (i) (328) (i ) For i ∈ IL1 , we have λ1 < λ1 0 , which is equivalent to (i) λ1 < L 1 X (i) λ . ηi0 j=2 j (329) Thus, by Lemma 7 (i), we have L L X (i ) 1 X (i) 1 fηi0 +1 (λ ) = λj < λ 0 . ηi0 + 1 j=1 ηi0 + 1 j=1 j (i) (i) (330) (i ) On the other hand, for i ∈ IL2 , we have λ1 > λ1 0 , which is equivalent to (i) λ1 > L 1 X (i) λ . ηi0 j=2 j (331) Thus, by Lemma 7 (ii), we have (j ) 0 ), fηi0 +1 (λ(i) ) = fηi0 +1 (λL−1 (332) which by (320) implies that L fηi0 +1 (λ(i) ) = X (i ) 1 λ 0 . ηi0 + 1 j=1 j (333) From (303) and (328), we have fηi0 +1 (λ (i0 ) ) = SL X ci fηi0 +1 (λ(i) ) i=1 = X ci fηi0 +1 (λ(i) ) i∈IL = X 0 i∈IL ci fηi0 +1 (λ(i) ) + X ci fηi0 +1 (λ(i) ) + 1 i∈IL X ci fηi0 +1 (λ(i) ). (334) 2 i∈IL Comparing (320) for fηi0 +1 (λ(i0 ) ) and (325), (330), and (333) for fηi0 +1 (λ(i) ), we see that both IL0 and IL1 must be empty in order for the equality in (334) to hold, and hence IL = IL2 . (335) 41 For any i ∈ IL2 , since ηi < ηi0 and ηi ≥ 1, we see that ηi0 ≥ 2. Thus from (318), we have   L L L 1  1 X (i0 ) X (i0 )  1 X (i0 ) λj = + λ λ ηi0 j=1 j ηi0 ηi0 j=2 j j=2 = 1 ηi0  X L 1 (i ) λj 0 +1 ηi0 j=2 L < Then by Lemma 7 (i), (318) implies that fηi0 (λ(i0 ) ) = Since λ(i0 ) is ordered, by (318), we have X (i ) 1 λ 0 . ηi0 − 1 j=2 j L L X 1 1 X (i0 ) (i ) λj < λ 0 . ηi0 j=1 ηi0 − 1 j=2 j (i ) (i ) λ2 0 ≤ λ1 0 = which implies that L 1 X (i0 ) λ , ηi0 j=2 j (336) (337) (338) L (i ) λ2 0 ≤ Then by Lemma 7 (i), we have X (i ) 1 λ 0 . ηi0 − 1 j=3 j (339) L (j0 ) ) fηi0 −1 (λL−1 It follows from (337) and (340) that X (i ) 1 = λ 0 . ηi0 − 1 j=2 j (j ) 0 ). fηi0 (λ(i0 ) ) < fηi0 −1 (λL−1 (340) (341) For i ∈ IL2 , we have ηi0 ≥ ηi + 1. Then by Lemma 7 (ii), (326) implies that (j ) 0 ). fηi0 (λ(i) ) = fηi0 −1 (λL−1 (342) Following (303), we have   (i ) (i ) (i ) λ2 0 , λ3 0 , · · · , λL 0  X  (i) (i) (i) = ci λ2 , λ3 , · · · , λL i∈IL = X 2 i∈IL =   (i) (i) (i) ci λ2 , λ3 , · · · , λL X 2 i∈IL ci   (i ) (i ) (i ) λ2 0 , λ3 0 , · · · , λL 0 , (343) (344) where (343) follows from (335) and (344) follows from the assumption in (321). Thus we have X ci = 1. (345) Then from (342) and (345), we see that X  X (j0 ) (j0 ) ), ) = fηi0 −1 (λL−1 ci fηi0 (λ(i) ) = ci fηi0 −1 (λL−1 (346) 2 i∈IL 2 i∈IL 2 i∈IL 42 and it follows from (341) that X ci fηi0 (λ(i) ) > fηi0 (λ(i0 ) . (347) 2 i∈IL This is a contradiction to (303). Therefore, the assumption in (321) is false and the proposition is proved. A PPENDIX H P ROOF OF L EMMA 14 For any permutation ω on {1, 2, · · · , L} and any λ ∈ RL + , recall from the beginning of Section III that  ω(λ) = λω(1) , λω(2) , · · · , λω(L) . (348)  Then for the ordered permutation π, we have π(λ) = λπ(1) , λπ(2) , · · · , λπ(L) . If λ = π(λ), the lemma is immediate. Otherwise, let ω0 (i) = i for all i ∈ L so that ω0 (λ) = λ. Set t = 1 and we sort λ in descending order by iteration as follows: (i) Let it = min{i ∈ L : ωt−1 (i) 6= π(i)}. Let kt , jt be any indexes in L such that π(kt ) = ωt−1 (it ) (349) ωt−1 (jt ) = π(it ). (350) and It is easy to check that kt > it and jt > it , which implies λπ(it ) − λπ(kt ) ≥ 0 (351) Rjt − Rit ≥ 0. (352) and Let ωt (λ) = (λωt (1) , λωt (2) , · · · , λωt (L) ) be a permutation of ωt−1 (λ) where we switch λωt−1 (jt ) and λωt−1 (it ) , i.e.,    π(it ), if i = it    ωt (i) = π(kt ), if i = jt     ω (i), otherwise. t−1 Then we have L X λωt−1 (i) Ri − = λωt (i) Ri i=1 i=1 = L X (353)   λωt−1 (it ) Rit + λωt−1 (jt ) Rjt − λωt (it ) Rit + λωt (jt ) Rjt   λπ(kt ) Rit + λπ(it ) Rjt − λπ(it ) Rit + λπ(kt ) Rjt = Rit (λπ(kt ) − λπ(it ) ) + Rjt (λπ(it ) − λπ(kt ) ) = (λπ(it ) − λπ(kt ) )(Rjt − Rit ) ≥ 0, (354) 43 where the second equality follows from (349), (350) and (353), and the inequality follows from (351) and (352). (ii) If ωt (λ) = π(λ), return T = t and stop. Otherwise, let t = t + 1 and go back to step (i). At the end of the iteration, ωT (λ) is sorted in the same order as π(λ), and we have L X λi Ri − λπ(i) Ri i=1 i=1 = L X L X λω0 (i) Ri − L T X X t=1 ≥ λωT (i) Ri i=1 i=1 = L X λωt−1 (i) Ri − L X λωt (i) Ri i=1 i=1 0. ! (355) This proves the lemma. R EFERENCES [1] J. R. Roche, R. W. Yeung, and K. P. Hau, “Symmetrical multilevel diversity coding,” IEEE Trans. Inf. Theory, vol. 43, pp. 1059–1064, May 1997. [2] R. W. Yeung and Z. Zhang, “Distributed source coding for satellite communications,” IEEE Trans. Inf. Theory, vol. 45, pp. 1111–1120, May 1999. [3] L. Song, R. W. Yeung, and N. Cai, “Zero-error network coding for acyclic networks,” IEEE Trans. Inf. Theory, vol. 49, pp. 3129–3139, Dec 2003. [4] R. W. Yeung and Z. Zhang, “On symmetrical multilevel diversity coding,” IEEE Trans. Inf. Theory, vol. 45, pp. 609–621, Mar. 1999. [5] A. Balasubramanian, H. D. Ly, S. Li, T. Liu, and S. L. Miller, “Secure symmetrical multilevel diversity coding,” IEEE Trans. Inf. Theory, vol. 59, pp. 3572–3581, June 2013. [6] J. Jiang, N. Marukala, and T. Liu, “Symmetrical multilevel diversity coding and subset entropy inequalities,” IEEE Trans. Inf. Theory, vol. 60, pp. 84–103, Jan. 2014. [7] Z. Xiao, J. Chen, Y. Li, and J. Wang, “Distributed multilevel diversity coding,” IEEE Trans. Inf. Theory, vol. 61, pp. 6368–6384, Nov 2015. [8] C. Tian and T. Liu, “Multilevel diversity coding with regeneration,” IEEE Trans. Inf. Theory, vol. 62, pp. 4833–4847, Sept 2016. [9] S. Mohajer, C. Tian, and S. N. Diggavi, “Asymmetric multilevel diversity coding and asymmetric gaussian multiple descriptions,” IEEE Trans. Inf. Theory, vol. 56, pp. 4367–4387, Sept 2010. [10] T. S. Han, “Nonnegative entropy measures of multivariate symmetric correlations,” Inf. Control, vol. 36, pp. 133–156, 02 1978. [11] M. Madiman and P. Tetali, “Information inequalities for joint distributions, with interpretations and applications,” IEEE Trans. Inf. Theory, vol. 56, pp. 2699–2713, June 2010. A PPENDIX I TABLES OF N ON -R EDUNDANT λ For L = 1, 2, · · · , 5, the vectors λ ∈ GL0 and the corresponding fα (λ) are listed in the following tables. The L P parameter θ is the integer such that λ1 = θ1 λi . i=2 44 λ f1 (λ) suffix λ f1 (λ) f2 (λ) θ 1 1 - (1, 0) 1 0 0 (1) (1, 1) 2 1 1 TABLE I NON - REDUNDANT CONSTRAINT FOR L TABLE II = 1. NON - REDUNDANT CONSTRAINTS FOR suffix λ f1 (λ) f2 (λ) f3 (λ) θ - (1, 0, 0) 1 0 0 0 (1, 0) (1, 1, 0) 2 1 0 1 (1, 1, 1) 3 3 2 1 2 4 2 1 1 (1, 1) (2, 1, 1) L = 2. TABLE III NON - REDUNDANT CONSTRAINTS FOR L = 3. suffix λ f1 (λ) f2 (λ) f3 (λ) f4 (λ) θ - (1, 0, 0, 0) 1 0 0 0 0 (1, 0, 0) (1, 1, 0, 0) 2 1 0 0 1 (1, 1, 1, 0) 3 3 2 1 0 2 (2, 1, 1, 0) 4 2 1 0 1 (1, 1, 1, 1) 4 2 4 3 1 3 ( 23 , 1, 1, 1) 9 2 9 4 3 2 1 2 (3, 1, 1, 1) 6 3 3 2 1 1 (2, 2, 1, 1) 6 3 2 1 2 8 4 2 1 1 (1, 1, 0) (1, 1, 1) (2, 1, 1) (4, 2, 1, 1) TABLE IV NON - REDUNDANT CONSTRAINTS FOR L = 4. 45 suffix λ f1 (λ) f2 (λ) f3 (λ) f4 (λ) f5 (λ) θ - (1, 0, 0, 0, 0) 1 0 0 0 0 0 (1, 0, 0, 0) (1, 1, 0, 0, 0) 2 1 0 0 0 1 (1, 1, 1, 0, 0) 3 3 2 1 0 0 2 (2, 1, 1, 0, 0) 4 2 1 0 0 1 (1, 1, 1, 1, 0) 4 2 4 3 1 0 3 (1, 1, 1, 0) ( 3 , 1, 1, 1, 0) 2 9 2 9 4 3 2 1 0 2 (3, 1, 1, 1, 0) 6 3 3 2 1 0 1 (2, 2, 1, 1, 0) 6 3 2 1 0 2 (4, 2, 1, 1, 0) 8 4 2 1 0 1 (1, 1, 1, 1, 1) 5 5 2 5 3 5 4 1 4 ( 34 , 1, 1, 1, 1) 16 3 8 3 16 9 4 3 1 3 (2, 1, 1, 1, 1) 6 3 2 4 3 1 2 (4, 1, 1, 1, 1) 8 4 2 4 3 1 1 ( 32 , 23 , 1, 1, 1) 6 3 2 3 2 1 3 ( 32 , 1, 1, 1) ( 9 , 3 , 1, 1, 1) 4 2 27 4 27 8 9 4 3 2 1 2 ( 92 , 23 , 1, 1, 1) 9 9 2 9 4 3 2 1 1 (3, 3, 1, 1, 1) 9 9 2 3 3 2 1 2 (6, 3, 1, 1, 1) 12 6 3 3 2 1 1 (2, 2, 2, 1, 1) 8 4 8 3 2 1 3 (2, 2, 1, 1) (3, 2, 2, 1, 1) 9 9 2 3 2 1 2 (6, 2, 2, 1, 1) 12 6 3 2 1 1 (4, 4, 2, 1, 1) 12 6 4 2 1 2 (8, 4, 2, 1, 1) 16 8 4 2 1 1 (1, 1, 0, 0) (2, 1, 1, 0) (1, 1, 1, 1) (3, 1, 1, 1) (4, 2, 1, 1) TABLE V NON - REDUNDANT CONSTRAINTS FOR L = 5.
7cs.IT
Efficient Exploration through Bayesian Deep Q-Networks Kamyar Azizzadenesheli 1 Emma Brunskill 2 Animashree Anandkumar 3 arXiv:1802.04412v1 [cs.AI] 13 Feb 2018 Abstract We propose Bayesian Deep Q-Network (BDQN), a practical Thompson sampling based Reinforcement Learning (RL) Algorithm. Thompson sampling allows for targeted exploration in high dimensions through posterior sampling but is usually computationally expensive. We address this limitation by introducing uncertainty only at the output layer of the network through a Bayesian Linear Regression (BLR) model. This layer can be trained with fast closed-form updates and its samples can be drawn efficiently through the Gaussian distribution. We apply our method to a wide range of Atari games in Arcade Learning Environments. Since BDQN carries out more efficient exploration, it is able to reach higher rewards substantially faster than a key baseline, the double deep Q network (DDQN). 1. Introduction A central challenge in RL is how to design algorithms that both scale to enormous or infinite state spaces, and efficiently balance exploration and exploitation in such environments. Much of the exciting advances in deep RL that scale to enormous domains employ simple exploration strategies such as ε-greedy, which are often highly inefficient. Though there is a large body of work on efficient exploration relevant when the domain is small enough to be represented with lookup tables for the value function, there has been much less work on scaling exploration Several papers(Bellemare et al., 2016; Tang et al., 2016) that do combine generalization and strategic exploration use optimism-under-uncertainty, which involve explicit or implicit bonuses over rewards based on uncertainty over the reward, dynamics or values. An alternative to (Brafman & Tennenholtz, optimism-under-uncertainty 2003) is Thompson Sam- 1 University of California Irvine 2 Stanford University 3 Caltech, Amazon. Correspondence to: Kamyar Azizzadenesheli <[email protected]>, Emma Brunskill <[email protected]>, Animashree Anandkumar <[email protected]>. pling (TS) (Thompson, 1933). Thompson sampling is a Bayesian approach which involves maintaining a prior distribution over the environment models (reward and/or dynamics), which is updated as observations are made during the interaction with the environment. To choose an action, a sample from the posterior belief is drawn and an action is selected that maximizes the expected return under the sampled belief. Interestingly, posterior sampling for decision making has also been studied in the field of psychology (Sanborn & Chater, 2016). In the MDP setting this involves sampling a reward and dynamics model and then performing MDP planning using the sampled models to compute an optimal action for the current state (Strens, 2000; Osband et al., 2013). Thompson sampling approaches have been observed to often empirically work significantly better than optimistic approaches in contextual bandit settings(Chapelle & Li, 2011) and small MDPs(Osband et al., 2013) and still maintains strong preserve state-of-the- art performance bounds(Russo & Van Roy, 2014; Agrawal & Goyal, 2012; Osband et al., 2013; Abbasi-Yadkori & Szepesvári, 2015). In large MDPs, sampling a model and then performing planning for that model is computationally intractable. Therefore some form of function approximation is required to help scale the ideas of Thompson Sampling. To help address this, (Osband et al., 2014) introduced randomized least-squares value iteration (RLSVI). RLSVI involves combining linear value function approximation with Bayesian regression in order to be able to sample the value function weights from a distribution. The authors prove strong regret bounds for RLSVI when a tabular basis function set is used, but RLSVI is not scalable to large-scale RL with deep neural networks. To try to combine the benefits of Thompson sampling style approaches with deep networks for generalization and scale, Osband et al. (2016) introduced a bootstrapped-ensemble approach that trains several models in parallel to approximate the posterior distribution. Other works suggest using a posterior over the parameters of each node in the network and employ a variational approximation (Lipton et al., 2016b) or use noisy network (Fortunato et al., 2017). However, mostly these approaches have lead to modest gains on the Atari benchmarks, not equaling some of the substantial benefits over by combining optimism-under-uncertainty with deep neu- Efficient Exploration through Bayesian Deep Q-Networks ral networks(Bellemare et al., 2016). Surprizingly in this paper we show that a simple approach that extends the randomized least-squares value iteration method (Osband et al., 2014) to deep neural networks can yield substantial gains on Atari benchmarks. Specifically, we combine a deep neural network with Bayesian linear regression at the last layer of the network. Our work is also related to a concurrently developed approach by Levine et al. (2017) who perform least squares temporal difference learning on top of a deep neural network, uses ε-greedy exploration on top of the learned Q function, and also demonstrate modest gains on 5 Atari benchmarks. Our results show that performing Bayesian regression instead, and sampling from the result, can yield a substantial benefit, indicating that it is not just the higher data efficiency at the last layer, but that leveraging an explicit uncertainty representation over the value function is of substantial benefit. More specifically we introduce Bayesian deep Qnetworks (BDQN) which combines a Deep Q network (DQN) (Mnih et al., 2013) with a Bayesian linear regression model on the last layer. Due to linearity and by choosing a Gaussian prior, we derive a closed-form analytical update to the approximated posterior distribution over Q functions. We can also draw samples efficiently from the Gaussian distribution. Exploration is performed by sampling from the learned Gaussian posterior to instantiate the Q values, and then the best action is selected. We test BDQN on a wide range of Arcade Learning Environment (Bellemare et al., 2013; Machado et al., 2017) Atari games, and compare our results to our own implementation of DDQN (Van Hasselt et al., 2016). BDQN and DDQN share the same architecture, and follow same target objective, and differ only in the way they are used to select actions: DDQN uses ε-greedy and BDQN performs Bayesian linear regression on the last layer, samples the parameters from the resulting distributions, and selects the best action for that sample. We also compare our results to the reported results from a number of the state-of-the-art approaches. Our proposed approach has several benefits– simplicity and targeted exploration– and yields performance often substantially better than existing optimism-based and other state of the art deep RL approaches. 2. Related Work The complexity of the exploration-exploitation trade-off has been deeply investigated in RL literature (Kearns & Singh, 2002; Brafman & Tennenholtz, 2003; Asmuth et al., 2009). Jaksch et al. (2010) investigates the regret analysis of MDPs where Optimism in Face of Uncertainty (OFU) principle is deployed to guarantee a high probability regret upper bound. Azizzadenesheli et al. Table 1. We run both BDQN and DDQN for the same number of times steps, written in the last column. The first column presents the score ratio of BDQN to DDQN after the steps provided in the last column. The second column is the score ratio of BDQN after the number of steps in the last column compared to the score of DDQN† , which is the reported scores of DDQN in Van Hasselt et al. (2016) after running for 200M samples during evaluation time where the ε = 0.001, and the third column is with respect to Human score reported at Mnih et al. (2015). It is worth noting that we do not design a evaluation phase for BDQN BDQN DDQN BDQN DDQN† BDQN H UMAN Steps Amidar 558% 103% Alien Assault 396% 2517% Asteroids Asterix 531% 207% BeamRider 281% BattleZone Atlantis 80604% 292% DemonAttack 114% Centipede BankHeist 211% 148% CrazyClimber ChopperCommand 14500% 295% Enduro 112% Pong 788% 103% 176% 1516% 385% 114% 253% 49413% 114% 178% 100% 122% 1576% 350% 100% 325% 43% 589% 108% 687% 150% 172% 11172% 326% 61% 100% 350% 732% 361% 226% 100M 100M 100M 100M 100M 70M 50M 40M 40M 40M 40M 40M 40M 30M 5M Game (2016a) deploys OFU in order to propose the high probability regret upper bound for Partially Observable MDPs (POMDPs) using spectral methods (Anandkumar et al., 2014). Furthermore, Bartók et al. (2014) tackles a general case of partial monitoring games and provides minimax regret guarantee which is polynomial in certain dimensions of the problem. In multi-arm bandit, there are compelling empirical pieces of evidence that Thompson Sampling can provide better results than optimism-under-uncertainty approaches (Chapelle & Li, 2011), while the state of the art performance bounds are preserved (Russo & Van Roy, 2014; Agrawal & Goyal, 2012). A natural adaptation of this algorithm to RL, posterior sampling RL (PSRL), first proposed by Strens (2000) also shown to have good frequentist and Bayesian performance guarantees (Osband et al., 2013; Abbasi-Yadkori & Szepesvári, 2015). Even though the theoretical RL addresses the exploration and exploitation trade-offs, these problems are still prominent in empirical reinforcement learning research (Mnih et al., 2015; Abel et al., 2016; Azizzadenesheli et al., 2016b). On the empirical side, the recent success in the video games has sparked a flurry of research interest. Following the success of Deep RL on Atari games (Mnih et al., 2015) and the board game Go (Silver et al., 2017), many researchers have begun exploring practical applications of deep re- Efficient Exploration through Bayesian Deep Q-Networks inforcement learning (DRL). Some investigated applications include, robotics (Levine et al., 2016), self-driving cars (Shalev-Shwartz et al., 2016), and safety (Lipton et al., 2016a). much beyond modest gains on Atari games while BDQN provides significant improvements in terms of both sample complexity and final performance. Inevitably for PSRL, the act of posterior sampling for policy or value is computationally intractable with large systems, so PSRL can not be easily leveraged to high dimensional problems. To remedy these failings Osband et al. (2017) consider the use of randomized value functions to approximate posterior samples for the value function in a computationally efficient manner. They show that with a suitable linear value function approximation, using the approximated Bayesian linear regression for randomized least-squares value iteration method can remain statistically efficient (Osband et al., 2014) but still is not scalable to large-scale RL with deep neural networks. 3. Thompson Sampling vs ε−greedy To combat these shortcomings, Osband et al. (2016) suggests a bootstrapped-ensemble approach that trains several models in parallel to approximate the posterior distribution. Other works suggest using a variational approximation to the Q-networks (Lipton et al., 2016b) or noisy network (Fortunato et al., 2017). However, most of these approaches significantly increase the computational cost of DQN and neither approach produced much beyond modest gains on Atari games. Interestingly, Bayesian approach as a technique for learning a neural network has been deployed for object recognition and image caption generation where its significant advantage has been verified Snoek et al. (2015). In this work we present another alternative approach that extends randomized least-squares value iteration method (Osband et al., 2014) to deep neural networks: we approximate the posterior by a Bayesian linear regression only on the last layer of the neural network. This approach has several benefits, e.g. simplicity, robustness, targeted exploration, and most importantly, we find that this method is much more effective than any of these predecessors in terms of sample complexity and final performance. Concurrently, Levine et al. (2017) proposes least squares temporal difference which learns a linear model on the feature representation in order to estimate the Q-function while ε-greedy exploration is employed and improvement on 5 tested Atari games is provided. Out of these 5 games, one is common with our set of 15 games which BDQN outperform it by factor of 360% (w.r.t. the score reported in their paper). Drop-out, as another randomized exploration method is proposed by Gal & Ghahramani (2016) but Osband et al. (2016) investigates the sufficiency of the estimated uncertainty and hardness in driving a suitable exploitation out of it. As stated before, in spite of the novelties proposed by the methods, mentioned in this section, neither of them, including TS based approaches, produced In this section, we enumerate a few benefits of TS over εgreedy strategies. We show how TS strategies exploit the uncertainties and expected returns to design a randomized exploration while ε−greedy strategies disregard all these useful information for the exploration. In order to make a balance between exploration and exploitation, TS explores actions with higher estimated return with higher probability. In order to exploit the estimated uncertainties, TS dedicates a higher chance to explore an action if its uncertainty increases. Fig. 1(a) expresses the agent’s estimated values and uncertainties for the available actions at a given state x. While ε−greedy strategy mostly focuses on the greedy action, action 1, the TS based strategy randomizes, mostly, over actions 1 through 4, utilizes their approximated expected returns and uncertainties, and with low frequency explores actions 5, 6. On the other hand, ε−greedy strategy explores actions 5 and 6, the actions that the RL agent is almost sure about their low expected returns, as frequent as other sub-greedy actions 2, 3, 4 which increases its samples complexity. Moreover, a ε−greedy strategy requires a deep network to approximate the value of all the sub-greedy actions equally good, therefore, it dedicates the network capacity to accurately estimate the values of all the sub-greedy actions equally good, instead of focusing more on the actions with higher promising estimated value. Therefore, it ends up with not accurate enough estimation of other good actions compared to the greedy action. In a study of value-based deep RL, e.g. DQN, the network is following a target value which is updated occasionally. Therefore, TS based strategy should not estimate the posterior distribution which adaptively follows the target values. A commonly used technique in deep RL is a moving window of replay buffer to store the recent experiences. The TS based agent, after a few tries of actions 5 and 6, builds a belief in the low return of these actions given the current target values, while it is possible that later on, the target value suggests a high expected return of these actions. Since the replay buffer is bounded moving window, lack of samples of these actions pushes the posterior belief of these actions to the prior belief, over time, and the agent tries them again in order to update its belief. Fig. 1(b) shows that the lack of samples for action 6 in the replay buffer, increases the uncertainty of this action and a randomized TS strategy starts to explore them over. It means that due to adaptive change of target value, respectively the objective, and limited replay buffer, the BDQN agent is never too confident about Efficient Exploration through Bayesian Deep Q-Networks (c) (a) (b) Figure 1. A cartoon on TS vs ε-greedy. The red crosses are the target values, the diamonds are the mean of estimated Q-values with blue intervals as uncertainties (e.g. c · variance). (a) ε-greedy strategy mostly chooses the greedy action, action 1 and explore actions 5, 6 as much as actions 2, 3, 4, while TS randomizes mostly over actions 1, 2, 3, 4 barely explore actions 5, 6. (b) BDQN computes the posterior using recent experiences in the replay buffer. Therefore, lack of samples of action 6 increases the uncertainty on the estimated value and BDQN explores it again. This further exploration is crucial since the target value changes over time. (c) maze. the expected return of poor actions and keeps exploring them once in a while. In general, TS based strategy advances the explorationexploitation balance by making a trade-off between the expected returns and the uncertainties, while ε−greedy strategy ignores all of this information. Another benefit of TS over ε-greedy can be described using Fig. 1(c). Consider a deterministic and episodic maze game, with episode length H of the shortest pass from the start to the destination. The agent is placed to the start point at the beginning of each episode where the goal state is to reach the destination and receive a reward of 1 otherwise the reward is 0. Consider an agent, which is given a set of Q-functions where the true Q-function is within the set and is the most optimistic function in the set. The agent is supposed to find a Q from this set which maximizes the average return. It is worth noting that the agent task is to find a good function from a function set. In this situation, TS randomizes over the Q-functions with high promising returns and relatively high uncertainty, including the true Q-function. When the TS agent picks the true Q-function, it increases the posterior probability of this Q-function because it matches the observation. When the TS agent chooses other functions, they predict deterministically wrong values and the posterior update of those functions set to zero. Therefore, the agent will not choose these functions again, i.e. TS finds the true Q-function by transferring the information through posterior update which helps the agent to find the optimal Q very fast. For ε-greedy agent, even though it chooses the true function at the beginning (it is the optimistic one), at each time step, it randomizes its action with the probability ε. Therefore, it takes exponentially many trials in order to get to the target in this game. 4. Preliminaries An infinite horizon γ-discounted MDP M is a tuple hX , A, T, R, γi, with state space X , action space A, and the transition kernel T , accompanied with reward function of R where 0 < γ ≤ 1. At each time step t, the environment is at a state xt , called current state, where the agent needs to make a decision at under its policy. Given the current state and action, the environment stochastically proceed to a successor state xt+1 under probability distribution T (Xt+1 |xt , at ) := P(Xt+1 |xt , at ) and provides a stochastic reward rt with mean of E[r|x = xt , a = at ] = R(xt , at ). The agent objective is to optimize the overall expected discounted reward over its policy π := X → A, a stochastic mapping from states to actions, π(a|x) := P(a|x). ∗ ∗ η = η(π ) = max η(π) = max lim Eπ π π N →∞ " N X t γ rt t=0 # (1) The expectation in Eq. 1 is with respect to the randomness in the distribution of initial state, transition probabilities, stochastic rewards, and policy, under stationary distribution, where η ∗ , π ∗ are optimal average return and optimal policy, respectively. Let Qπ (x, a) denote the average discounted reward under policy π starting off from state x and taking action a in the first place. Qπ (x, a) := lim Eπ N →∞ "N X t=0 t γ rt |x0 = x, a0 = a # For a given policy π and Markovian assumption of the model, we can rewrite the equation for the Q functions as Efficient Exploration through Bayesian Deep Q-Networks follows: Qπ (x, a) = R(x, a) + γ X T (x′ |x, a)π(a′ |x′ )Qπ (x′ , a′ ) x′ ,a′ (2) To find the optimal policy, one can solve a linear programming problem in Eq. 1 or follow the corresponding Bellman equation Eq. 2 where both of the optimization methods solve the following X Q∗ (x, a) = R(x, a) + γ T (x′ |x, a) max Q∗ (x′ , a′ ) ′ x′ a ∀x, a, Q∗ (x, a) = Qπ∗ (x, a) and the optimal policy is a deterministic mapping from state to actions in A, i.e. x → arg maxa Q∗ (x, a). In RL, we do not know the transition kernel and the reward function in advance, therefore, we cannot solve the posed Bellman equation directly. In order to tackle this problem, the property of minimizing the Bellman residual of a given Q-function h i 2 L(Q) = Eπ (Q(x, a) − r − γQ(x′ , a′ )) (3) has been proposed (Lagoudakis & Parr, 2003; Antos et al., 2008). Here, the tuple (x, a, r, x′ ) consists of consecutive samples under behavioral policy π. Furthermore, (Mnih et al., 2015) carries the same idea, and introduce Deep Q-Network (DQN) where the Q-functions are parameterized by a deep network. To improve the quality of Q estimate, they use back propagation on loss L(Q) using the TD update (Sutton & Barto, 1998). In the following we describe the setting used in DDQN. In order to reduce the bias of the estimator, they introduce target network Qtarget and target value y = r + γQtarget (x′ , â) where â = arg maxa′ Q(x′ , a′ ) with a new loss L(Q, Qtarget ) i h 2 (4) L(Q, Qtarget ) = Eπ (Q(x, a) − y) This regression problem minimizes the estimated loss b L(Q, Qtarget ), which minimize the distance between the Q and the target y. A DDQN agent, once in a while updates the Qtarget network by setting it to Q network, pursues the regression with the new target value and provides a biased estimator of the target. 5. Bayesian Deep Q-Networks We now show how we can extend the randomized leastsquares value iteration method (Osband et al., 2014) to combine it with a deep neural network. The result can be viewed as a coarse approximation to representing the uncertainty over the Q-function, which we use to guide exploration. We utilize the DQN architecture, remove its last layer, and directly build a Bayesian linear regression (BLR) Algorithm 1 BDQN 1: Initialize parameter sets θ, θtarget , W , W target , and Cov using a normal distribution. 2: Initialize replay buffer and set counter = 0 3: for episode = 1 to inf do 4: Initialize x1 to the initial state of the environment 5: for t = to the end of episode do 6: if count mod T sample = 0 then 7: sample W ∼ N (W target , Cov) 8: end if   9: Select action at = argmaxa′ W ⊤ φθ (xt ) a′ 10: Execute action at in environment, observing reward rt and successor state xt+1 11: Store transition (xt , at , rt , xt+1 ) in replay buffer 12: Sample a random minibatch of transitions (xτ , aτ , rτ ,xτ +1 ) from replay buffer for terminal xτ +1 :     rτ   for non-terminal xτ +1 : 13: yτ ← h i  target ⊤ target  r + W φ (x ) where  τ τ +1 θ  â    ⊤  â = argmaxa′ W φθ (xτ +1 ) a′   14: θ ← θ − η · ∇θ (yτ − W ⊤ φθ (xτ ) aτ )2 15: if count mod T target = 0 then 16: set θtarget ← θ 17: end if 18: if count mod T Bayes target = 0 then 19: Update W target and Cov 20: end if 21: count = count + 1 22: end for 23: end for (Rasmussen & Williams, 2006) on the output of the deep network φθ (x) ∈ Rd , the feature representation layer, parametrized by θ. We use BLR to efficiently approximate the distribution over the Q-values where the uncertainty over the values is captured. A common assumption in DNN is that the feature representation is suitable for linear classification or regression (same assumption in DQN), therefore, therefore building a linear model on the features a suitable choice (as was done recently in (Levine et al., 2017)). The Q-functions are approximated as a linear transformation of the deep neural network features, i.e. for a given pair of state-action, Q(x, a) = φθ (x)⊤ wa , where wa ∈ Rd , ∀a ∈ A. Consequently, as mentioned in the previous section, the target value is generated using target model. The target model follows the same structure as the Q model, and contains φtarget (x) ∈ Rd , ∀x ∈ X denotes the feature θ representation of target network, and wtarget â , ∀â ∈ A denotes the target linear model applied on the target feature representation. Inspired by DDQN, for a given tuple of experience (x, a, r, x′ ), the predicted value of pair (x, a) is              Efficient Exploration through Bayesian Deep Q-Networks Q(x, a) = φθ (x)⊤ wa , while the target value is y = r + γφtarget (x′ )wtarget â , ; â = argmaxa φθ (x′ )⊤ wa . Therefore, by deploying BLR on the space of features, we can approximate the posterior distribution of model parameter wa ∈ Rd , ∀a ∈ A, as well as the posterior distribution of the Q-functions using the corresponding target values. In Gaussian BLR models, in order to make the posterior update computationally tractable in a closed form a common approximation is to make the prior and likelihood choices as conjugates of each other. Therefore, for a given pair of (x, a), the vector wa is drawn from a Gaussian prior N (0, σ 2 ) and given wa , the target value is generated from the following model; y ∼ wa⊤ φ(x) + ǫ where ǫ ∼ N (0, σǫ2 ) is an iid noise. Therefore, y|x, a, wa ∼ N (φ(x)⊤ wa , σǫ2 ). Moreover, the distribution R of the target value y is P (y| a) = wa P (y|wa ) P (wa ) dwa which also has a closed form. Given a experience replay buffer D = {xτ , aτ , yτ }D τ =1 , we construct |A| (number of actions) disjoint datasets for each action, Da , where D = ∪a∈A Da and Da is a set of tuples xτ , aτ , yτ with the action aτ = a and cardinality Da . We are interested in the approximated posterior distribution of wa , ∀a ∈ A and correspondingly the Q(x, a); P(wa |Da ), ∀a ∈ A and P(Q(x, a)|Da ), ∀x ∈ X . The following are the standard Bayesian linear regression equations adjusted for our setting and we encourage readers who are familiar with Bayesian linear regression to skip the derivation. For each action a and the corresponding dataset Da , we construct a matrix Φa ∈ Rd×Da , a concatenation Da a ,a of feature column vectors {φ(xi )}D i=1 , and ya ∈ R concatenation of target values in set Da . Therefore the posterior distribution of wa is as follows: wa ∼ N    −1 1 1 1 ⊤ , Ξ = Ξ Φ y , Ξ Φ Φ + I a a a a a a a σǫ2 σǫ2 σ2 (5) and I ∈ Rd is an identity matrix. The Q(x, a)|Da = wa⊤ φ(x) where wa is drawn following the posterior distribution in Eq. 5. Since the prior and likelihood are conjugate of each other we have the closed form posterior distribution P t of the discounted return, N γ rt |x0 = x, a0 = a, Da , t=0 is approximated as N   1 ⊤ ⊤ φ(x) Ξa Φa ya , φ(x) Ξa φ(x) σǫ2 (6) As TS suggests, for the exploration, we exploit the expression in Eq. 5.At the decision time, we sample a wight vector wa for each action in order to have samples of Q-values. Then we act optimally with respect to these sampled value aTS = arg max wa⊤ φθ (x). a |A| (7) |A| Let W = {wa }a=1 , respectively W target = {watarget }a=1 , |A| and Cov = {Ξa }a=1 . In BDQN, the agent interacts with the environment through applying the actions proposed by TS , i.e. aTS . We utilize a notion of experience replay buffer where the agent stores its recent experiences. The agent draws W ∼ N (W target , Cov) (abbreviation for sampling of vector wa for each action separately) every T sample steps and act optimally with respect to the drawn weights. During the inner loop of the algorithm, we draw a minibatch of data from replay buffer and use loss   (yτ − W ⊤ φθ (xτ ) aτ )2 (8) where h i ⊤ yτ :=rτ + W target φθtarget (xτ +1 ) â  ⊤  ′ (9) â :=argmaxa W φθ (xτ +1 ) a′ and  ⊤update the  weights of network: θ ← θ − η · ∇θ (yτ − W φθ (xτ ) aτ )2 . We update the target network every T target steps and set θtarget to θ. With the period of T Bayes target the agent updates its posterior distribution using a larger minibatch of data drawn from replay buffer, set the watarget , ∀a ∈ A to the mean of the posterior, and sample wa , ∀A with respect to the updated posterior. Algorithm 1 gives the full description of BDQN. 6. Experiments We apply BDQN on a variety of Atari games using the Arcade Learning Environment (Bellemare et al., 2013) through OpenAI Gym1 (Brockman et al., 2016). As a baseline, we run the DDQN algorithm and evaluate BDQN on the measures of sample complexity and score. Furthermore, all the implementations are coded in MXNet framework (Chen et al., 2015). Network architecture: The input to the network part of BDQN is 4 × 84 × 84 tensor with a rescaled and averaged over channels of the last four observations. The first convolution layer has 32 filters of size 8 with a stride of 4. The second convolution layer has 64 filters of size 4 with stride 2. The last convolution layer has 64 filters of size 3 followed by a fully connected layer with size 512. We add a BLR layer on top of this. 1 Each input frame is a pixel-max of the two consecutive frames. We detailed the environment setting in the implementa- Efficient Exploration through Bayesian Deep Q-Networks 0.6 2.5 2.0 1.5 1.0 0.5 0.0 0 1 2 3 Number of steps 4 5 4 3 2 BDQN DDQN 1 1 2 3 Number of steps 4 1e7 1.0 1e8 2.0 1.5 1.0 0.5 0.2 0.4 0.6 0.8  r a zyl m b er 0.8 0.6 0.4 BDQN DDQN 0.2 3 N um ber of st eps 4 0.6 Number of steps 0.8 4 3 0 4 3 2 1 0 0.2 0.4 0.6 0.8 E d u r o 0.8 0.6 0.4 0.2 0.0 0.5 1.0 1.5 2.0 2.5 3.0 Number of steps 4 1 0 5 1e6 BDQN DDQN 0.6 0.4 0.2 0.0 0.0 0.5 1.0 1.5 2.0 2.5 3.0 0.6 0.4 0.2 0.0 1.5 2.0 2.5 N um ber of st eps 3.0 3.5 4.0 1e7 4 5 1e7 BDQN DDQN 6 5 4 3 2 0.0 BDQN DDQN 3 7 0.5 1.0 1.5 2.0 2.5 3.0 3.5 1e7 N um ber of st eps Beam R der 1e4 0.8 1.0 2 Number of steps C e  t  pede 8 3.5 h opper om m a d 0.5 1 1e7 N um ber of st eps 1.0 0 1e3 0.8 0.0 1e7 N um ber of st eps 3 1.0 1e5 BDQN DDQN 1.0 2 Dem o n At t ack 1.2 1.0 1e8 N um ber of st eps 1.2 1 1e4 i 2 BDQN DDQN 1.0 1e8 5 0.0 1e7 5 0 Ast er ix 0.0  1.0 2 0.4 1e3 1.2 1 0.2 BDQN DDQN 6 1.0 1e8 N um ber of st eps 0 0.0 1e4 2.5 0.0  6 0 Number of episode 0.8 Alien 1e5 7 0.6 BDQN DDQN 3.0 1e7 BankHeist 1e2 0.4 1e3 BDQN DDQN 3.0 0.2 10 Aver age Rew ar d per ep sode Atlantis 1e6 0.0 BDQN DDQN 6 Aver age Rew ar d per ep sode 1.0 1e8 BattleZone 1e4 7 −20 0.0 Aver age Rew ar d per ep sode Number of steps 0.8 0.2 Aver age Rew ar d per ep sode 0.6 20 −10 0.4 Aver age Rew ar d per episode 0.4 Pong Average Reward per episode 0.8 Aver age Rew ar d per ep sode 0.2 Aver age Rew ar d per episode 0.0 0.0 Average Reward per episode Average Reward per step 0 Average Reward per episode 1.0 0.2 1 BDQN DDQN 1.2 0.4 2 Asteroids 1e4 1.4 0.6 3 Average Reward per episode 1.6 BDQN DDQN 0.8 4 0 Assault 1e4 BDQN DDQN Average Reward per episode Amidar 1e3 5 Aver age Rew ar d per ep sode Average Reward per episode 6 1.0 0.8 0.6 0.4 BDQN DDQN 0.2 0.0 0 1 2 3 4 N um ber of st eps 5 6 1e7 Figure 2. The efficient and targeted exploration of BDQN Choice of hyper-parameters: For BDQN, we set the values of W target to the mean of the posterior distribution over the weights of BLR with covariances Cov and draw W from this posterior. For the fixed W and W target , we randomly initialize the parameters of network part of BDQN, θ, and train it using RMSProp, with learning rate of 0.0025, and a momentum of 0.95, inspired by (Mnih et al., 2015) where the discount factor is γ = 0.99, the number of steps between target updates T target = 10k steps, and weights W are re-sampled from their posterior distribution every T sample steps. We update the network part of BDQN every 4 steps by uniformly at random sampling a mini-batch of size 32 samples from the replay buffer. We update the posterior distribution of the weight set W every T Bayes target using mini-batch of size B (if the size of replay buffer is less than B at the current step, we choose the minimum of these two ), with entries sampled uniformly form replay buffer. The experience replay contains the 1M most recent transitions. Further hyper-parameters are equivalent to ones in DQN setting. Furthermore, for the BLR part of BDQN, we have noise variance σǫ , variance of prior over weights σ, sample size B, posterior update period T Bayes target , and the posterior sampling period T sample . To optimize for this set of hyper-parameters we set up a very simple, fast, cheap, and non-exhaustive hyper-parameter tuning procedure using a pre-trained DQN model for the game of Assault. The simplicity and cheapness of our hyper parameter tuning proves the robustness and superiority of BDQN where the exhaustive hyper-parameter search is likely to provide even better performance. The details of hyper parameters tuning is provided in Apx. A. tion code In order to compare the fairness in sample usage, we argue in Apx. A, that the network part of BDQN and its corresponding part in DDQN observe the same number of samples but the BLR part of BDQN uses 16 times fewer samples compared to its corresponding last layer in DDQN, Apx. A. Baselines: We implemented DDQN and fix its architecture to match our BDQN implementation. We also aimed to implement a couple other deep RL methods that employ strategic exploration. Unfortunately we encountered several implementation challenges. To try to illustrate the performance of our approach we instead extracted the best reported results from a number of state-of-the-art deep RL methods and include them in Table 2. Note that this is not a perfect comparison, as sometimes there can be additional details that are not included in the papers that mean that it is hard to compare the reported results (an issue that has been discussed extensively recently, e.g. (Henderson et al., 2017) ).5 Here we tried to report final performance (when those were reported or identifiable from plots). We report results from bootstrapped DQN(Osband et al., 2016), count based exploration(Bellemare et al., 2016), the Pixel and Reactor results that build on the count based exploration(Ostrovski et al., 2017), and NoisyNet(Fortunato et al., 2017). 5 To further reproducibility, we released our codes and trained models https://github.com/kazizzad/BDQN-MxNet-Gluon. Since DRL experiments are expensive, we also have released the recorded arrays of returns, in order to make it possible for others to compare against BDQN, without running the experiments again. Moreover, our Bootstrap DQN implementation is also available https://github.com/kazizzad/Bootstrap-DQN Efficient Exploration through Bayesian Deep Q-Networks Table 2. Comparison of scores and sample complexities(scores in the first two columns are average of 100 consecutive episodes). The sample complexity, SC, represents the number of samples the BDQN requires to bit the human score (Mnih et al., 2015)(“ − ” means BDQN could not bit) and SC† is the number number of samples the BDQN requires to bit the score of DDQN † . The scores of DDQN † are borrowed from the original DDQN paper Van Hasselt et al. (2016) which are reported after running for 200M samples during evaluation time where the ε = 0.001. Same for bootstrap DQN (Osband et al., 2016), CTS, Pixel, Reactor (Ostrovski et al., 2017) where the scores are borrowed from their original papers. For NoisyNet (Fortunato et al., 2017) since there is no score for noisy DDQN we reported the score of its closest model noisyDQN scores. The Human scores are borrowed from Mnih et al. (2015). It is worth noting that we do not design a evaluation phase for BDQN. Game BDQN DDQN DDQN† Bootstrap2 NoisyNet3 Amidar Alien Assault Asteroids Asterix BeamRider BattleZone Atlantis DemonAttack Centipede BankHeist CrazyClimber ChopCmd4 Enduro Pong 5.52k 3k 8.84k 14.1k 58.4k 8.7k 65.2k 3.24M 11.1k 7.3k 0.72k 124k 72.5k 1.12k 21 0.99k 2.9k 2.23k 0.56k 11k 4.2k 23.2k 39.7k 3.8k 6.4k 0.34k 84k 0.5k 0.38k 18.82 0.7k 2.9k 5.02k 0.93k 15.15k 7.6k 24.7k 64.76k 9.7k 4.1k 0.72k 102k 4.6k 0.32k 21 1.27k 2.44k 8.05k 1.03k 19.7k 23.4k 36.7k 99.4k 82.6k 4.55k 1.21k 138k 4.1k 1.59k 20.9 1.5k 2.9k 3.1k 2.1k 11.0 14.7k 11.9k 7.9k 26.7k 3.35k 0.64k 121k 5.3k 0.91k 21 Results: The results are provided in Fig. 2 and Table. 2. BDQN performs best across the majority of games at the stated number of samples, even typically performing much better than several other methods when they are trained for much longer. Note that comparisons to Bootstrap, NoisyNet and CTS should be viewed lightly, since the reported results for those algorithms were generally when trained for substantially longer (often 100-200M steps). Reactor(Ostrovski et al., 2017) outperformed our BDQN on three games, Alien, Atlantis and Enduro, when trained for an identical number of time steps. Note also that BDQN outperforms the optimism based approaches (Bellemare et al., 2016; Ostrovski et al., 2017) on all other games we tried including Amidar, which they classify as one of the harder exploration games(Ostrovski et al., 2017). It is worth noting that the scores of DDQN are reported during the leaning phase (not evaluation phase). For example, DDQN gives score of 18.82 during the learning phase, but setting ε to zero, it mostly gives the score of 21. We also report the number of samples (sample complexity (SC)) it take from BDQN to reach human scores, SC, and DDQN † scores, SC† , Apx. A. For the game Atlantis, DDQN† gives score of 64.67k after 200M samples during evaluation time, while BDQN reaches 3.24M after 40M samples. As it is been shown in Fig. 2, BDQN saturates for Atlantis after 20M samples. CTS 1.03k 1.9k 2.88k 3.95k 9.55k 7.0k 7.97k 1.8M 39.3k 5.4k 1.3k 112.9k 5.1k 0.69k 20.8 Pixel Reactor Human 0.62k 1.7k 1.25k 0.9k 1.4k 3k 10k 40k 1.3k 1.8k 0.42k 75k 2.5k 0.19k 17 1.18k 3.5k 3.5k 1.75k 6.2k 3.8k 45k 9.5M 7k 3.5k 1.1k 119k 4.8k 2.49k 20 1.7k 6.9k 1.5k 13.1k 8.5k 5.8k 38k 29k 3.4k 12k 0.72k 35.4k 9.9k 0.31k 9.3 SC SC† Step 22.9M 4.4M 100M 36.27M 100M 1.6M 24.3M 100M 58.2M 9.7M 100M 3.6M 5.7M 100M 4.0M 8.1M 70M 25.1M 14.9M 50M 3.3M 5.1M 40M 2.0M 19.9M 40M 4.2M 40M 2.1M 10.1M 40M 0.12M 2.1M 40M 4.4M 2.2M 40M 0.82M 0.8M 30M 1.2M 2.4M 5M We realized that BDQN reaches the internal OpenAIGym limit of max episode, where relaxing it improves score after 15M steps to 62M . We observe that BDQN immediately learns significantly better policies due to its targeted exploration in a much shorter period of time. Since BDQN on game Atlantis promise a big jump around time step 20M , we ran it five more times in order to make sure it was not just a coincidence Apx. A Fig. 5. For the game Pong, we ran the experiment for a longer period but just plotted the beginning of it in order to observe the difference. For some games, we did not run the experiment to 100M samples since the reached their plateau. 7. Conclusion In this work we proposed BDQN, a practical TS based RL algorithm which provides targeted exploration in a computationally efficient manner. It involved making simple modifications to the DDQN architecture by replacing the last layer with a Bayesian linear regression. Under the Gaussian prior, we obtained fast closed-form updates for the posterior distribution. We demonstrated significantly faster training and much better performance in many games compared to the reported results of a wide number of state-ofthe-art baselines. Due to computational limitations we did not try the algorithm on all games and it remains an interesting issue to further explore its performance, and combine it Efficient Exploration through Bayesian Deep Q-Networks with other advances in deep RL that can be easily extended. In this work, for BDQN we randomize the last layer of the model and use a Bayesian linear regression framework to train it, and alternate it with training the other layers of the network. An alternative approach is to train it end-to-end using stochastic optimization approaches (Welling & Teh, 2011). This could significantly speed up training while retaining the computational efficiency of DDQN. In this work, we have considered value based approaches in deep RL and we plan to explore the advantages of TS based exploration in policy gradient based approaches in future. References Abbasi-Yadkori, Yasin and Szepesvári, Csaba. Bayesian optimal control of smoothly parameterized systems. In UAI, pp. 1–11, 2015. Abel, David, Agarwal, Alekh, Diaz, Fernando, Krishnamurthy, Akshay, and Schapire, Robert E. Exploratory gradient boosting for reinforcement learning in complex domains. arXiv, 2016. Agrawal, Shipra and Goyal, Navin. Analysis of thompson sampling for the multi-armed bandit problem. In COLT, 2012. Anandkumar, Animashree, Ge, Rong, Hsu, Daniel, Kakade, Sham M, and Telgarsky, Matus. Tensor decompositions for learning latent variable models. The Journal of Machine Learning Research, 15(1):2773–2832, 2014. Antos, András, Szepesvári, Csaba, and Munos, Rémi. Learning near-optimal policies with bellman-residual minimization based fitted policy iteration and a single sample path. Machine Learning, 2008. Asmuth, John, Li, Lihong, Littman, Michael L, Nouri, Ali, and Wingate, David. A bayesian sampling approach to exploration in reinforcement learning. In Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence, 2009. Azizzadenesheli, Kamyar, Lazaric, Alessandro, and Anandkumar, Animashree. Reinforcement learning of pomdps using spectral methods. In Proceedings of the 29th Annual Conference on Learning Theory (COLT), 2016a. Azizzadenesheli, Kamyar, Lazaric, Alessandro, and Anandkumar, Animashree. Reinforcement learning in rich-observation mdps using spectral methods. arXiv preprint arXiv:1611.03907, 2016b. Bartók, Gábor, Foster, Dean P, Pál, Dávid, Rakhlin, Alexander, and Szepesvári, Csaba. Partial monitoringclassification, regret bounds, and algorithms. Mathematics of Operations Research, 2014. Bellemare, Marc, Srinivasan, Sriram, Ostrovski, Georg, Schaul, Tom, Saxton, David, and Munos, Remi. Unifying count-based exploration and intrinsic motivation. In Advances in Neural Information Processing Systems, pp. 1471–1479, 2016. Bellemare, Marc G, Naddaf, Yavar, Veness, Joel, and Bowling, Michael. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 2013. Brafman, Ronen I and Tennenholtz, Moshe. R-max-a general polynomial time algorithm for near-optimal reinforcement learning. The Journal of Machine Learning Research, 3:213–231, 2003. Brockman, Greg, Cheung, Vicki, Pettersson, Ludwig, Schneider, Jonas, Schulman, John, Tang, Jie, and Zaremba, Wojciech. Openai gym, 2016. Chapelle, Olivier and Li, Lihong. An empirical evaluation of thompson sampling. In Advances in neural information processing systems, 2011. Chen, Tianqi, Li, Mu, Li, Yutian, Lin, Min, Wang, Naiyan, Wang, Minjie, Xiao, Tianjun, Xu, Bing, Zhang, Chiyuan, and Zhang, Zheng. Mxnet: A flexible and efficient machine learning library for heterogeneous distributed systems. arXiv, 2015. Fortunato, Meire, Azar, Mohammad Gheshlaghi, Piot, Bilal, Menick, Jacob, Osband, Ian, Graves, Alex, Mnih, Vlad, Munos, Remi, Hassabis, Demis, Pietquin, Olivier, et al. Noisy networks for exploration. arXiv, 2017. Gal, Yarin and Ghahramani, Zoubin. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In ICML, 2016. Henderson, Peter, Islam, Riashat, Bachman, Philip, Pineau, Joelle, Precup, Doina, and Meger, David. Deep reinforcement learning that matters. arXiv, 2017. Jaksch, Thomas, Ortner, Ronald, and Auer, Peter. Nearoptimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 2010. Kearns, Michael and Singh, Satinder. Near-optimal reinforcement learning in polynomial time. Machine Learning, 49(2-3):209–232, 2002. Lagoudakis, Michail G and Parr, Ronald. Least-squares policy iteration. Journal of machine learning research, 4 (Dec):1107–1149, 2003. Efficient Exploration through Bayesian Deep Q-Networks Levine, Nir, Zahavy, Tom, Mankowitz, Daniel J, Tamar, Aviv, and Mannor, Shie. Shallow updates for deep reinforcement learning. arXiv, 2017. Russo, Daniel and Van Roy, Benjamin. Learning to optimize via posterior sampling. Mathematics of Operations Research, 39(4):1221–1243, 2014. Levine et al., Sergey. End-to-end training of deep visuomotor policies. JMLR, 2016. Sanborn, Adam N and Chater, Nick. Bayesian brains without probabilities. Trends in cognitive sciences, 2016. Lipton, Zachary C, Gao, Jianfeng, Li, Lihong, Chen, Jianshu, and Deng, Li. Combating reinforcement learning’s sisyphean curse with intrinsic fear. arXiv preprint arXiv:1611.01211, 2016a. Shalev-Shwartz, Shai, Shammah, Shaked, and Shashua, Amnon. Safe, multi-agent, reinforcement learning for autonomous driving. arXiv, 2016. Lipton, Zachary C, Gao, Jianfeng, Li, Lihong, Li, Xiujun, Ahmed, Faisal, and Deng, Li. Efficient exploration for dialogue policy learning with bbq networks & replay buffer spiking. arXiv preprint arXiv:1608.05081, 2016b. Silver, David, Schrittwieser, Julian, Simonyan, Karen, Antonoglou, Ioannis, Huang, Aja, Guez, Arthur, Hubert, Thomas, Baker, Lucas, Lai, Matthew, Bolton, Adrian, et al. Mastering the game of go without human knowledge. Nature, 2017. Machado, Marlos C, Bellemare, Marc G, Talvitie, Erik, Veness, Joel, Hausknecht, Matthew, and Bowling, Michael. Revisiting the arcade learning environment: Evaluation protocols and open problems for general agents. arXiv preprint arXiv:1709.06009, 2017. Snoek, Jasper, Rippel, Oren, Swersky, Kevin, Kiros, Ryan, Satish, Nadathur, Sundaram, Narayanan, Patwary, Mostofa, Prabhat, Mr, and Adams, Ryan. Scalable bayesian optimization using deep neural networks. In ICML, 2015. Mnih, Volodymyr, Kavukcuoglu, Koray, Silver, David, Graves, Alex, Antonoglou, Ioannis, Wierstra, Daan, and Riedmiller, Martin. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013. Strens, Malcolm. A bayesian framework for reinforcement learning. In ICML, 2000. Mnih, Volodymyr, Kavukcuoglu, Koray, Silver, David, Rusu, Andrei A, Veness, Joel, Bellemare, Marc G, Graves, Alex, Riedmiller, Martin, Fidjeland, Andreas K, Ostrovski, Georg, et al. Human-level control through deep reinforcement learning. Nature, 2015. Sutton, Richard S and Barto, Andrew G. Reinforcement learning: An introduction. MIT press Cambridge, 1998. Tang, Haoran, Houthooft, Rein, Foote, Davis, Stooke, Adam, Chen, Xi, Duan, Yan, Schulman, John, De Turck, Filip, and Abbeel, Pieter. Exploration:a study of count-based exploration for deep reinforcement learning. arXiv, 2016. Osband, Ian, Russo, Dan, and Van Roy, Benjamin. (more) efficient reinforcement learning via posterior sampling. In Advances in Neural Information Processing Systems, 2013. Thompson, William R. On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika, 1933. Osband, Ian, Van Roy, Benjamin, and Wen, Zheng. Generalization and exploration via randomized value functions. arXiv, 2014. Van Hasselt, Hado, Guez, Arthur, and Silver, David. Deep reinforcement learning with double q-learning. In AAAI, 2016. Osband, Ian, Blundell, Charles, Pritzel, Alexander, and Van Roy, Benjamin. Deep exploration via bootstrapped dqn. In Advances in Neural Information Processing Systems, 2016. Welling, Max and Teh, Yee W. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 681–688, 2011. Osband, Ian, Russo, Daniel, Wen, Zheng, and Van Roy, Benjamin. Deep exploration via randomized value functions. arXiv, 2017. Ostrovski, Georg, Bellemare, Marc G, Oord, Aaron van den, and Munos, Rémi. Count-based exploration with neural density models. arXiv, 2017. Rasmussen, Carl Edward and Williams, Christopher KI. Gaussian processes for machine learning, volume 1. MIT press Cambridge, 2006. Efficient Exploration through Bayesian Deep Q-Networks A. Appendix Hyper-parameters tuning: For the BLR, we have noise variance σǫ , variance of prior over weights σ, sample size B, posterior update period T Bayes target , and the posterior sampling period T sample . To optimize for this set of hyperparameters we set up a very simple, fast, and cheap hyper-parameter tuning procedure which proves the robustness of BDQN. To find the first three, we set up a simple hyper-parameter search. We used a pretrained DQN model for the game of Assault, and removed the last fully connected layer in order to have access to its already trained feature representation. Then we tried combination of B = {T target , 10·T target }, σ = {1, 0.1, 0.001}, and σǫ = {1, 10} and test for 1000 episode of the game. We set these parameters to their best B = 10 · T target , σ = 0.001, σ = 1. The above hyper-parameter tuning is cheap and fast since it requires only a few times the B number of forwarding passes. For the remaining parameter, we ran BDQN ( with weights randomly initialized) on the same game, Assault, for 5M time target target steps, with a set of T Bayes target = {T target , 10 · T target } and T sample = { T 10 , T 100 } where BDQN performed Bayes target target sample better with choice of T = 10 · T . For both choices of T , it performed almost equal where we choose the higher one. We started off with the learning rate of 0.0025 and did not tune for that. Thanks to the efficient TS exploration and closed form BLR, BDQN can learn a better policy in an even shorter period of time. In contrast, it is well known for DQN based methods that changing the learning rate causes a major degradation in the performance, Apx. A. The proposed hyper-parameter search is very simple where the exhaustive hyper-parameter search is likely to provide even better performance. Average Reward per episode Learning rate: It is well known that DQN and DDQN are sensitive to the learning rate and change of learning rate can degrade the performance to even worse than random policy. We tried the same learning rate as BDQN, 0.0025, for DDQN and observed that its performance drops. Fig. 3 shows that the DDQN with higher learning rates learns as good as BDQN at the very beginning but it can not maintain the rate of improvement and degrade even worse than the original DDQN. Amidar 1e3 BDQN DDQN DDQN-10xlr 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 0 1 2 3 Number of steps 4 5 1e7 Figure 3. Effect of learning rate on DDQN Computational and sample cost comparison: For a given period of game time, the number of the backward pass in both BDQN and DQN are the same where for BDQN it is cheaper since it has one layer (the last layer) less than DQN. In the sense of fairness in sample usage, for example in duration of 10 · T Bayes target = 100k, all the layers of both BDQN and DQN, except the last layer, sees the same number of samples, but the last layer of BDQN sees 16 times fewer samples compared to the last layer of DQN. The last layer of DQN for a duration of 100k, observes 25k = 100k/4 (4 is back prob period) mini batches of size 32, which is 16 · 100k, where the last layer of BDQN just observes samples size of B = 100k. As it is mentioned in Alg. 1, to update the posterior distribution, BDQN draws B samples from the replay buffer and needs to compute the feature vector of them. Therefore, during the duration of 100k decision making steps, for the learning procedure, DDQN does 32 ∗ 25k of forward passes and 32 ∗ 25k of backward passes, while BDQN does same number of backward passes (cheaper since there is no backward pass for the final layer) and 36 ∗ 25k of forward passes. One can easily relax it by parallelizing this step along the main body of BDQN or deploying on-line posterior update methods. Efficient Exploration through Bayesian Deep Q-Networks Thompson sampling frequency: The choice of TS update frequency can be crucial from domain to domain. If one chooses T sample too short, then computed gradient for backpropagation of the feature representation is not going to be useful since the gradient get noisier and the loss function is changing too frequently. On the other hand, the network tries to find a feature representation which is suitable for a wide range of different weights of the last layer, results in improper use of model capacity. If the TS update frequency is too low, then it is far from being TS and losses randomized exploration property. The current choice of T sample is suitable for a variety of Atari games since the length of each episode is in range of O(T sample ) and is infrequent enough to make the feature representation robust to big changes. For the RL problems with shorter horizon we suggest to introduce two more parameters, T̃ sample and W̃ where T̃ sample , the period that of W̃ is sampled our of posterior, is much smaller than T sample and W̃ is being used just for making TS actions while W is used for backpropagation of feature representation. For game Assault, we tried using T̃ sample and W̃ but did not observe much a difference, and set them to T sample and W . But for RL setting with a shorter horizon, we suggest using them. Average Reward per episode Further investigation in Atlantis: After removing the maximum episode length limit for the game Atlantis, BDQN gets the score of 62M. This episode is long enough to fill half of the replay buffer and make the model perfect for the later part of the game but losing the crafted skill for the beginning of the game. We observe in Fig. 4 that after losing the game in a long episode, the agent forgets a bit of its skill and loses few games but wraps up immediately and gets to score of 30M . To overcome this issue, one can expand the replay buffer size, stochastically store samples in the reply buffer where the later samples get stored with lowers chance, or train new models for the later parts of the episode. There are many possible cures for this interesting observation and while we are comparing against DDQN, we do not want to advance BDQN structure-wise. Atlantis 1e7 BDQN 6 5 4 3 2 1 0 0.0 0.5 1.0 1.5 Number of steps 2.0 2.5 1e7 Average Reward per episode Figure 4. BDQN on Atlantis after removing the limit on max of episode length hits the score of 62M in 16M samples. Atlantis 1e6 3.0 2.5 2.0 1.5 1.0 0.5 0.0 0 1 2 3 Number of steps 4 1e7 Figure 5. A couple of more runs of BDQN where the jump around 15M constantly happens Efficient Exploration through Bayesian Deep Q-Networks Further discussion on Reproducibility In Table. 2, we provide the scores of bootstrap DQN (Osband et al., 2016) and NoisyNet6 (Fortunato et al., 2017) along side with BDQN. These score are directly copied from their original papers and we did not make any change to them. We also desired to report the scores of count-based method (Ostrovski et al., 2017), but unfortunately there is no table of score in that paper in order to provide them here. In order to make it easier for the readers to compare against the results in Ostrovski et al. (2017), we visually approximated their plotted curves for CT S, P ixel, P ixel, and Reactor, and added them to the Table. 2. We added these numbers just for the convenience of the readers Surly we do not argue any scientific meaning for them and leave it to the readers to interpret them. Table. 2 shows a significant improvement of BDQN over these baselines by looking at Table. 2. Despite the simplicity and negligible computation overhead of BDQN over DDQN, we can not scientifically claim that BDQN outperforms these baselines by just looking at the scores in Table.2 because we are not aware of their detailed implementation as well as environment detail. For example, in this work, we directly implemented DDQN by following the implementation details mentioned in the original DDQN paper and the scores of our DDQN implementation during the evaluation time almost matches the scores of DDQN reported in the original paper. But the reported scores of implemented DDQN in Osband et al. (2016) are much different from the reported score in the original DDQN paper. 6 This work does not have scores of Noisy-net with DDQN objective function but it has Noisy-net with DQN objective which are the scores reported in Table. 2
2cs.AI
Knowledge Matters: Importance of Prior Information for Optimization Çağlar Gülçehre [email protected] Département d’informatique et de recherche opérationnelle Université de Montréal, Montréal, QC, Canada arXiv:1301.4083v6 [cs.LG] 13 Jul 2013 Yoshua Bengio [email protected] Département d’informatique et de recherche opérationnelle Université de Montréal, Montréal, QC, Canada Editor: Not Assigned Abstract We explore the effect of introducing prior information into the intermediate level of deep supervised neural networks for a learning task on which all the black-box state-of-the-art machine learning algorithms tested have failed to learn. We motivate our work from the hypothesis that there is an optimization obstacle involved in the nature of such tasks, and that humans learn useful intermediate concepts from other individuals via a form of supervision or guidance using a curriculum. The experiments we have conducted provide positive evidence in favor of this hypothesis. In our experiments, a two-tiered MLP architecture is trained on a dataset for which each image input contains three sprites, and the binary target class is 1 if all three have the same shape. Black-box machine learning algorithms only got chance on this task. Standard deep supervised neural networks also failed. However, using a particular structure and guiding the learner by providing intermediate targets in the form of intermediate concepts (the presence of each object) allows to nail the task. Much better than chance but imperfect results are also obtained by exploring architecture and optimization variants, pointing towards a difficult optimization task. We hypothesize that the learning difficulty is due to the composition of two highly non-linear tasks. Our findings are also consistent with hypotheses on cultural learning inspired by the observations of effective local minima (possibly due to ill-conditioning and the training procedure not being able to escape what appears like a local minimum). Keywords: Deep Learning, Neural Networks, Optimization, Evolution of Culture, Curriculum Learning, Training with Hints 1. Introduction There is a recent emerging interest in different fields of science for cultural learning (Henrich and McElreath, 2003) and how groups of individuals exchanging information can learn in ways superior to individual learning. This is also witnessed by the emergence of new research fields such as ”Social Neuroscience”. Learning from other agents in an environment by the means of cultural transmission of knowledge with a peer-to-peer communication is an efficient and natural way of acquiring or propagating common knowledge. The most popular belief on how the information is transmitted between individuals is that bits of information are transmitted by small units, called memes, which share some characteristics of genes, such as self-replication, mutation and response to selective pressures (Dawkins, 1976). 1 This paper is based on the hypothesis (which is further elaborated in Bengio (2013a)) that human culture and the evolution of ideas have been crucial to counter an optimization issue: this difficulty would otherwise make it difficult for human brains to capture high level knowledge of the world without the help of other educated humans. In this paper machine learning experiments are used to investigate some elements of this hypothesis by seeking answers for the following questions: are there machine learning tasks which are intrinsically hard for a lone learning agent but that may become very easy when intermediate concepts are provided by another agent as additional intermediate learning cues, in the spirit of Curriculum Learning (Bengio et al., 2009b)? What makes such learning tasks more difficult? Can specific initial values of the neural network parameters yield success when random initialization yield complete failure? Is it possible to verify that the problem being faced is an optimization problem or with a regularization problem? These are the questions discussed (if not completely addressed) here, which relate to the following broader question: how can humans (and potentially one day, machines) learn complex concepts? In this paper, results of different machine learning algorithms on an artificial learning task involving binary 64×64 images are presented. In that task, each image in the dataset contains 3 Pentomino tetris sprites (simple shapes). The task is to figure out if all the sprites in the image are the same or if there are different sprite shapes in the image. Several state-of-the-art machine learning algorithms have been tested and none of them could perform better than a random predictor on the test set. Nevertheless by providing hints about the intermediate concepts (the presence and location of particular sprite classes), the problem can easily be solved where the same-architecture neural network without the intermediate concepts guidance fails. Surprisingly, our attempts at solving this problem with unsupervised pre-training algorithms failed solve this problem. However, with specific variations in the network architecture or training procedure, it is found that one can make a big dent in the problem. For showing the impact of intermediate level guidance, we experimented with a two-tiered neural network, with supervised pre-training of the first part to recognize the category of sprites independently of their orientation and scale, at different locations, while the second part learns from the output of the first part and predicts the binary task of interest. The objective of this paper is not to propose a novel learning algorithm or architecture, but rather to refine our understanding of the learning difficulties involved with composed tasks (here a logical formula composed with the detection of object classes), in particular the training difficulties involved for deep neural networks. The results also bring empirical evidence in favor of some of the hypotheses from Bengio (2013a), discussed below, as well as introducing a particular form of curriculum learning (Bengio et al., 2009b). Building difficult AI problems has a long history in computer science. Specifically hard AI problems have been studied to create CAPTCHA’s that are easy to solve for humans, but hard to solve for machines (Von Ahn et al., 2003). In this paper we are investigating a difficult problem for the off-the-shelf black-box machine learning algorithms.1 1.1 Curriculum Learning and Cultural Evolution Against Effective Local Minima What Bengio (2013a) calls an effective local minimum is a point where iterative training stalls, either because of an actual local minimum or because the optimization algorithm is 1. You can access the source code of some experiments presented in that paper and their hyperparameters from here: https://github.com/caglar/kmatters 2 unable (in reasonable time) to find a descent path (e.g., because of serious ill-conditioning). In this paper, it is hypothesized that some more abstract learning tasks such as those obtained by composing simpler tasks are more likely to yield effective local minima for neural networks, and are generally hard for general-purpose machine learning algorithms. The idea that learning can be enhanced by guiding the learner through intermediate easier tasks is old, starting with animal training by shaping (Skinner, 1958; Peterson, 2004; Krueger and Dayan, 2009). Bengio et al. (2009b) introduce a computational hypothesis related to a presumed issue with effective local minima when directly learning the target task: the good solutions correspond to hard-to-find-by-chance effective local minima, and intermediate tasks prepare the learner’s internal configuration (parameters) in a way similar to continuation methods in global optimization (which go through a sequence of intermediate optimization problems, starting with a convex one where local minima are no issue, and gradually morphing into the target task of interest). In a related vein, Bengio (2013a) makes the following inferences based on experimental observations of deep learning and neural network learning: Point 1: Training deep architectures is easier when some hints are given about the function that the intermediate levels should compute (Hinton et al., 2006; Weston et al., 2008; Salakhutdinov and Hinton, 2009; Bengio, 2009). The experiments performed here expand in particular on this point. Point 2: It is much easier to train a neural network with supervision (where examples ar provided to it of when a concept is present and when it is not present in a variety of examples) than to expect unsupervised learning to discover the concept (which may also happen but usually leads to poorer renditions of the concept). The poor results obtained with unsupervised pre-training reinforce that hypothesis. Point 3: Directly training all the layers of a deep network together not only makes it difficult to exploit all the extra modeling power of a deeper architecture but in many cases it actually yields worse results as the number of required layers is increased (Larochelle et al., 2009; Erhan et al., 2010). The experiments performed here also reinforce that hypothesis. Point 4: Erhan et al. (2010) observed that no two training trajectories ended up in the same effective local minimum, out of hundreds of runs, even when comparing solutions as functions from input to output, rather than in parameter space (thus eliminating from the picture the presence of symmetries and multiple local minima due to relabeling and other reparametrizations). This suggests that the number of different effective local minima (even when considering them only in function space) must be huge. Point 5: Unsupervised pre-training, which changes the initial conditions of the descent procedure, sometimes allows to reach substantially better effective local minima (in terms of generalization error!), and these better local minima do not appear to be reachable by chance alone (Erhan et al., 2010). The experiments performed here provide another piece of evidence in favor of the hypothesis that where random initialization can yield rather poor results, specifically targeted initialization can have a drastic impact, i.e., that 3 effective local minima are not just numerous but that some small subset of them are much better and hard to reach by chance.2 Based on the above points, Bengio (2013a) then proposed the following hypotheses regarding learning of high-level abstractions. • Optimization Hypothesis: When it learns, a biological agent performs an approximate optimization with respect to some implicit objective function. • Deep Abstractions Hypothesis: Higher level abstractions represented in brains require deeper computations (involving the composition of more non-linearities). • Local Descent Hypothesis: The brain of a biological agent relies on approximate local descent and gradually improves itself while learning. • Effective Local Minima Hypothesis: The learning process of a single human learner (not helped by others) is limited by effective local minima. • Deeper Harder Hypothesis: Effective local minima are more likely to hamper learning as the required depth of the architecture increases. • Abstractions Harder Hypothesis: High-level abstractions are unlikely to be discovered by a single human learner by chance, because these abstractions are represented by a deep subnetwork of the brain, which learns by local descent. • Guided Learning Hypothesis: A human brain can learn high level abstractions if guided by the signals produced by other agents that act as hints or indirect supervision for these high-level abstractions. • Memes Divide-and-Conquer Hypothesis: Linguistic exchange, individual learning and the recombination of memes constitute an efficient evolutionary recombination operator in the meme-space. This helps human learners to collectively build better internal representations of their environment, including fairly high-level abstractions. This paper is focused on “Point 1 ” and testing the “Guided Learning Hypothesis”, using machine learning algorithms to provide experimental evidence. The experiments performed also provide evidence in favor of the “Deeper Harder Hypothesis” and associated “Abstractions Harder Hypothesis”. Machine Learning is still far beyond the current capabilities of humans, and it is important to tackle the remaining obstacles to approach AI. For this purpose, the question to be answered is why tasks that humans learn effortlessly from very few examples, while machine learning algorithms fail miserably? 2. Recent work showed that rather deep feedforward networks can be very successfully trained when large quantities of labeled data are available (Ciresan et al., 2010; Glorot et al., 2011a; Krizhevsky et al., 2012). Nonetheless, the experiments reported here suggest that it all depends on the task being considered, since even with very large quantities of labeled examples, the deep networks trained here were unsuccessful. 4 2. Culture and Optimization Difficulty As hypothesized in the “Local Descent Hypothesis”, human brains would rely on a local approximate descent, just like a Multi-Layer Perceptron trained by a gradient-based iterative optimization. The main argument in favor of this hypothesis relies on the biologically-grounded assumption that although firing patterns in the brain change rapidly, synaptic strengths underlying these neural activities change only gradually, making sure that behaviors are generally consistent across time. If a learning algorithm is based on a form of local (e.g. gradient-based) descent, it can be sensitive to effective local minima (Bengio, 2013a). When one trains a neural network, at some point in the training phase the evaluation of error seems to saturate, even if new examples are introduced. In particular Erhan et al. (2010) find that early examples have a much larger weight in the final solution. It looks like the learner is stuck in or near a local minimum. But since it is difficult to verify if this is near a true local minimum or simply an effect of strong ill-conditioning, we call such a “stuck” configuration an effective local minimum, whose definition depends not just on the optimization objective but also on the limitations of the optimization algorithm. Erhan et al. (2010) highlighted both the issue of effective local minima and a regularization effect when initializing a deep network with unsupervised pre-training. Interestingly, as the network gets deeper the difficulty due to effective local minima seems to be get more pronounced. That might be because of the number of effective local minima increases (more like an actual local minima issue), or maybe because the good ones are harder to reach (more like an ill-conditioning issue) and more work will be needed to clarify this question. As a result of Point 4 we hypothesize that it is very difficult for an individual’s brain to discover some higher level abstractions by chance only. As mentioned in the “Guided Learning Hypothesis” humans get hints from other humans and learn high-level concepts with the guidance of other humans3 . Curriculum learning (Bengio et al., 2009a) and incremental learning (Solomonoff, 1989), are examples of this. This is done by properly choosing the sequence of examples seen by the learner, where simpler examples are introduced first and more complex examples shown when the learner is ready for them. One of the hypothesis on why curriculum works states that curriculum learning acts as a continuation method that allows one to discover a good minimum, by first finding a good minimum of a smoother error function. Recent experiments on human subjects also indicates that humans teach by using a curriculum strategy (Khan et al., 2011). Some parts of the human brain are known to have a hierarchical organization (i.e. visual cortex) consistent with the deep architecture studied in machine learning papers. As we go from the sensory level to higher levels of the visual cortex, we find higher level areas corresponding to more abstract concepts. This is consistent with the Deep Abstractions Hypothesis. Training neural networks and machine learning algorithms by decomposing the learning task into sub-tasks and exploiting prior information about the task is well-established and in fact constitutes the main approach to solving industrial problems with machine learning. The contribution of this paper is rather on rendering explicit the effective local minima issue and providing evidence on the type of problems for which this difficulty arises. This prior information and hints given to the learner can be viewed as inductive bias for a particular task, an important ingredient to obtain a good generalization error (Mitchell, 1980). An interesting 3. But some high-level concepts may also be hardwired in the brain, as assumed in the universal grammar hypothesis (Montague, 1970), or in nature vs nurture discussions in cognitive science. 5 earlier finding in that line of research was done with Explanation Based Neural Networks (EBNN) in which a neural network transfers knowledge across multiple learning tasks. An EBNN uses previously learned domain knowledge as an initialization or search bias (i.e. to constrain the learner in the parameter space) (O’Sullivan, 1996; Mitchell and Thrun, 1993). Another related work in machine learning is mainly focused on reinforcement learning algorithms, based on incorporating prior knowledge in terms of logical rules to the learning algorithm as a prior knowledge to speed up and bias learning (Kunapuli et al., 2010; Towell and Shavlik, 1994). As discussed in “Memes Divide and Conquer Hypothesis“ societies can be viewed as a distributed computational processing systems. In civilized societies knowledge is distributed across different individuals, this yields a space efficiency. Moreover computation, i.e. each individual can specialize on a particular task/topic, is also divided across the individuals in the society and hence this will yield a computational efficiency. Considering the limitations of the human brain, the whole processing can not be done just by a single agent in an efficient manner. A recent study in paleoantropology states that there is a substantial decline in endocranial volume of the brain in the last 30000 years Henneberg (1988). The volume of the brain shrunk to 1241 ml from 1502 ml (Henneberg and Steyn, 1993). One of the hypothesis on the reduction of the volume of skull claims that, decline in the volume of the brain might be related to the functional changes in brain that arose as a result of cultural development and emergence of societies given that this time period overlaps with the transition from hunter-gatherer lifestyle to agricultural societies. 3. Experimental Setup Some tasks, which seem reasonably easy for humans to learn4 , are nonetheless appearing almost impossible to learn for current generic state-of-art machine learning algorithms. Here we study more closely such a task, which becomes learnable if one provides hints to the learner about appropriate intermediate concepts. Interestingly, the task we used in our experiments is not only hard for deep neural networks but also for non-parametric machine learning algorithms such as SVM’s, boosting and decision trees. The result of the experiments for varying size of dataset with several off-the-shelf black box machine learning algorithms and some popular deep learning algorithms are provided in Table 1. The detailed explanations about the algorithms and the hyperparameters used for those algorithms are given in the Appendix Section 5.2. We also provide some explanations about the methodologies conducted for the experiments at Section 3.2. 3.1 Pentomino Dataset In order to test our hypothesis, an artificial dataset for object recognition using 64×64 binary images is designed5 . If the task is two tiered (i.e., with guidance provided), the task in the first part is to recognize and locate each Pentomino object class6 in the image. The second 4. keeping in mind that humans can exploit prior knowledge, either from previous learning or innate knowledge. 5. The source code for the script that generates the artificial Pentomino datasets (Arcade-Universe) is available at: https://github.com/caglar/Arcade-Universe. This implementation is based on Olivier Breuleux’s bugland dataset generator. 6. A human learner does not seem to need to be taught the shape categories of each Pentomino sprite in order to solve the task. On the other hand, humans have lots of previously learned knowledge about the notion of shape and how central it is in defining categories. 6 (a) sprites, not all same type (b) sprites, all of same type Figure 1: Left (a): An example image from the dataset which has a different sprite type in it. Right (b): An example image from the dataset that has only one type of Pentomino object in it, but with different orientations and scales. part/final binary classification task is to figure out if all the Pentominos in the image are of the same shape class or not. If a neural network learned to detect the categories of each object at each location in an image, the remaining task becomes an XOR-like operation between the detected object categories. The types of Pentomino objects that is used for generating the dataset are as follows: Pentomino sprites N, P, F, Y, J, and Q, along with the Pentomino N2 sprite (mirror of “Pentomino N” sprite), the Pentomino F2 sprite (mirror of “Pentomino F” sprite), and the Pentomino Y2 sprite (mirror of “Pentomino Y” sprite). Figure 2: Different classes of Pentomino shapes used in our dataset. As shown in Figures 1(a) and 1(b), the synthesized images are fairly simple and do not have any texture. Foreground pixels are “1” and background pixels are “0”. Images of the training and test sets are generated iid. For notational convenience, assume that the domain of raw input images is X, the set of sprites is S, the set of intermediate object categories is Y for each possible location in the image and the set of final binary task outcomes is Z = {0, 1}. Two different types of rigid body transformation is performed: sprite rotation rot(X, γ) where Γ = {γ : (γ = 90 × φ) ∧ [(φ ∈ N), (0 ≤ φ ≤ 3)]} and scaling scale(X, α) where α ∈ {1, 2} is the scaling factor. The data generating procedure is summarized below. Sprite transformations: Before placing the sprites in an empty image, for each image x ∈ X, a value for z ∈ Z is randomly sampled which is to have (or not) the same three sprite shapes in the image. Conditioned on the constraint given by z, three sprites are randomly 7 selected sij from S without replacement. Using a uniform probability distribution over all possible scales, a scale is chosen and accordingly each sprite image is scaled. Then rotate each sprite is randomly rotated by a multiple of 90 degrees. Sprite placement: Upon completion of sprite transformations, a 64×64 uniform grid is generated which is divided into 8×8 blocks, each block being of size 8×8 pixels, and randomly select three different blocks from the 64=8×8 on the grid and place the transformed objects into different blocks (so they cannot overlap, by construction). Each sprite is centered in the block in which it is located. Thus there is no object translation inside the blocks. The only translation invariance is due to the location of the block inside the image. A Pentomino sprite is guaranteed to not overflow the block in which it is located, and there are no collisions or overlaps between sprites, making the task simpler. The largest possible Pentomino sprite can be fit into an 8×4 mask. 3.2 Learning Algorithms Evaluated Initially the models are cross-validated by using 5-fold cross-validation. With 40,000 examples, this gives 32,000 examples for training and 8,000 examples for testing. For neural network algorithms, stochastic gradient descent (SGD) is used for training. The following standard learning algorithms were first evaluated: decision trees, SVMs with Gaussian kernel, ordinary fully-connected Multi-Layer Perceptrons, Random Forests, k-Nearest Neighbors, Convolutional Neural Networks, and Stacked Denoising Auto-Encoders with supervised fine-tuning. More details of the configurations and hyper-parameters for each of them are given in Appendix Section 5.2. The only better than chance results were obtained with variations of the Structured Multi-Layer Perceptron described below. 3.2.1 Structured Multi-Layer Perceptron (SMLP) The neural network architecture that is used to solve this task is called the SMLP (Structured Multi-Layer Perceptron), a deep neural network with two parts as illustrated in Figure 5 and 7: The lower part, P1NN (Part 1 Neural Network, as it is called in the rest of the paper), has shared weights and local connectivity, with one identical MLP instance of the P1NN for each patch of the image, and typically an 11-element output vector per patch (unless otherwise noted). The idea is that these 11 outputs per patch could represent the detection of the sprite shape category (or the absence of sprite in the patch). The upper part, P2NN (Part 2 Neural Network) is a fully connected one hidden layer MLP that takes the concatenation of the outputs of all patch-wise P1NNs as input. Note that the first layer of P1NN is similar to a convolutional layer but where the stride equals the kernel size, so that windows do not overlap, i.e., P1NN can be decomposed into separate networks sharing the same parameters but applied on different patches of the input image, so that each network can actually be trained patch-wise in the case where a target is provided for the P1NN outputs. The P1NN output for patch pi which is extracted from the image x is computed as follows: fθ (pi ) = g2 (V g1 (U pi + b) + c) 8 (1) where pi ∈ Rd is the input patch/receptive field extracted from location i of a single image. U ∈ Rdh ×d is the weight matrix for the first layer of P1NN and b ∈ Rhd is the vector of biases for the first layer of P1NN. g1 (·) is the activation function of the first layer and g2 (·) is the activation function of the second layer. In many of the experiments, best results were obtained with g1 (·) a rectifying non-linearity (a.k.a. as RELU), which is max(0, X) (Jarrett et al., 2009b; Nair and Hinton, 2010; Glorot et al., 2011a; Krizhevsky et al., 2012). V ∈ Rdh ×do is the second layer’s weights matrix, such that and c ∈ Rdo are the biases of the second layer of the P1NN, with do expected to be smaller than dh . In this way, g1 (U pi + b) is an overcomplete representation of the input patch that can potentially represent all the possible Pentomino shapes for all factors of variations in the patch (rotation, scaling and Pentomino shape type). On the other hand, when trained with hints, fθ (pi ) is expected to be the lower dimensional representation of a Pentomino shape category invariant to scaling and rotation in the given patch. In the experiments with SMLP trained with hints (targets at the output of P1NN), the P1NN is expected to perform classification of each 8×8 non-overlapping patches of the original 64×64 input image without having any prior knowledge of whether that specific patch contains a Pentomino shape or not. P1NN in SMLP without hints just outputs the local activations for each patch, and gradients on fθ (pi ) are backpropagated from the upper layers. In both cases P1NN produces the input representation for the Part 2 Neural Net (P2NN). Thus the input representation of P2NN is the concatenated output of P1NN across all the 64 patch locations: ho = [fθ (p0 ), ..., fθ (pi ), ..., fθ (pN ))] where N is the number of patches and the ho ∈ Rdi , di = do × N . ho is the concatenated output of the P1NN at each patch. There is a standardization layer on top of the output of P1NN that centers the activations and performs divisive normalization by dividing by the standard deviation over a minibatch of the activations of that layer. We denote the standardization function z(·). Standardization makes use of the mean and standard deviation computed for each hidden unit such that each hidden unit of ho will have 0 activation and unit standard deviation on average over the minibatch. X is the set of pentomino images in the minibatch, where X ∈ Rdin ×N is a matrix (i) with N images. ho (xj ) is the vector of activations of the i-th hidden unit of hidden layer ho (xj ) for the j-th example, with xj ∈ X. µh(i) = o s σh(i) = 1 X (i) ho (xj ) N (2) xj ∈X PN j (i) (ho (xj ) − µh(i) )2 o N o + (3) (i) z(ho(i) (xj )) = ho (xj ) − µh(i) o max(σh(i) , ) (4) o where  is a very small constant, that is used to prevent numerical underflows in the standard deviation. P1NN is trained on each 8×8 patches extracted from the image. ho is standardized for each training and test sample separately. Different values of  were used for SMLP-hints and SMLP-nohints. The concatenated output of P1NN is fed as an input to the P2NN. P2NN is a feedforward MLP with a sigmoid output layer using a single RELU hidden layer. The task of P2NN is to perform a nonlinear logical operation on the representation provided at the output of P1NN. 9 3.2.2 Structured Multi Layer Perceptron Trained with Hints (SMLP-hints) The SMLP-hints architecture exploits a hint about the presence and category of Pentomino objects, specifying a semantics for the P1NN outputs. P1NN is trained with the intermediate target Y , specifying the type of Pentomino sprite shape present (if any) at each of the 64 patches (8×8 non-overlapping blocks) of the image. Because a possible answer at a given location can be “none of the object types” i.e., an empty patch, yp (for patch p) can take one of the 11 possible values, 1 for rejection and the rest is for the Pentomino shape classes, illustrated in Figure 2: ( 0 if patch p is empty yp = s ∈ S if the patch p contains a Pentomino sprite . A similar task has been studied by Fleuret et al. (2011) (at SI appendix Problem 17), who compared the performance of humans vs computers. The SMLP-hints architecture takes advantage of dividing the task into two subtasks during training with prior information about intermediate-level relevant factors. Because the sum of the training losses decomposes into the loss on each patch, the P1NN can be pre-trained patchwise. Each patch-specific component of the P1NN is a fully connected MLP with 8×8 inputs and 11 outputs with a softmax output layer. SMLP-hints uses the the standardization given in Equation 3 but with  = 0. The standardization is a crucial step for training the SMLP on the Pentomino dataset, and yields much sparser outputs, as seen on Figures 3 and 4. If the standardization is not used, even SMLP-hints could not solve the Pentomino task. In general, the standardization step dampens the small activations and augments larger ones(reducing the noise). Centering the activations of each feature detector in a neural network has been studied in (Raiko et al., 2012) and (Vatanen et al., 2013). They proposed that transforming the outputs of each hidden neuron in a multi-layer perceptron network to have zero output and zero slope on average makes first order optimization methods closer to the second order techniques. By default, the SMLP uses rectifier hidden units as activation function, we found a significant boost by using rectification compared to hyperbolic tangent and sigmoid activation functions. The P1NN has a highly overcomplete architecture with 1024 hidden units per patch, and L1 and L2 weight decay regularization coefficients on the weights (not the biases) are respectively 1e-6 and 1e-5. The learning rate for the P1NN is 0.75. 1 training epoch was enough for the P1NN to learn the features of Pentomino shapes perfectly on the 40000 training examples. The P2NN has 2048 hidden units. L1 and L2 penalty coefficients for the P2NN are 1e-6, and the learning rate is 0.1. These were selected by trial and error based on validation set error. Both P1NN (for each patch) and P2NN are fully-connected neural networks, even though P1NN globally is a special kind of convolutional neural network. Filters of the first layer of SMLP are shown in Figure 6. These are the examples of the filters obtained with the SLMP-hints trained with 40k examples, whose results are given in Table 1. Those filters look very noisy but they work perfectly on the Pentomino task. 3.2.3 Deep and Structured Supervised MLP without Hints (SMLP-nohints) SMLP-nohints uses the same connectivity pattern (and deep architecture) that is also used in the SMLP-hints architecture, but without using the intermediate targets (Y ). It directly predicts the final outcome of the task (Z), using the same number of hidden units, the same 10 Figure 3: Bar chart of concatenated softmax output activations ho of P1NN (11×64=704 outputs) in SMLP-hints before standardization, for a selected example. There are very large spikes at each location for one of the possible 11 outcome (1 of K representation). 11 Figure 4: Softmax output activations ho of P1NN at SMLP-hints before standardization. There are positive spiked outputs at the locations where there is a Pentomino shape. Positive and negative spikes arise because most of the outputs are near an average value. Activations are higher at the locations where there is a pentomino shape. 12 Structured MLP Architecture with Hints Second Level Neural Network Final Binary task labels Intermediate level targets. First Level Neural Network Figure 5: Structured MLP architecture, used with hints (trained in two phases, first P1NN, bottom two layers, then P2NN, top two layers). In SMLP-hints, P1NN is trained on each 8x8 patch extracted from the image and the softmax output probabilities of all 64 patches are concatenated into a 64×11 vector that forms the input of P2NN. Only U and V are learned in the P1NN and its output on each patch is fed into P2NN. The first level and the second level neural networks are trained separately, not jointly. Figure 6: Filters of Structured MLP architecture, trained with hints on 40k examples. 13 connectivity and the same activation function for the hidden units as SMLP-hints. 120 hyperparameter values have been evaluated by randomly selecting the number of hidden units from [64, 128, 256, 512, 1024, 1200, 2048] and randomly sampling 20 learning rates uniformly in the log-domain within the interval of [0.008, 0.8]. Two fully connected hidden layers with 1024 hidden units (same as P1NN) per patch is used and 2048 (same as P2NN) for the last hidden layer, with twenty training epochs. For this network the best results are obtained with a learning rate of 0.05.7 Structured MLP Architecture without Hints Second Level Neural Network Final Binary task labels First Level Neural Network Figure 7: Structured MLP architecture, used without hints (SMLP-nohints). It is the same architecture as SMLP-hints (Figure 5) but with both parts (P1NN and P2NN) trained jointly with respect to the final binary classification task. We chose to experiment with various SMLP-nohint architectures and optimization procedures, trying unsuccessfully to achieve as good results with SMLP-nohint as with SMLP-hints. Rectifier Non-Linearity A rectifier nonlinearity is used for the activations of MLP hidden layers. We observed that using piecewise linear nonlinearity activation function such as the rectifier can make the optimization more tractable. 7. The source code of the structured MLP is available at the github repository: https://github.com/caglar/ structured_mlp 14 Figure 8: First layer filters learned by the Structured MLP architecture, trained without using hints on 447600 examples with online SGD and a sigmoid intermediate layer activation. Intermediate Layer The output of the P1NN is considered as an intermediate layer of the SMLP. For the SMLP-hints, only softmax output activations have been tried at the intermediate layer, and that sufficed to learn the task. Since things did not work nearly as well with the SMLP-nohints, several different activation functions have been tried: softmax(·), tanh(·), sigmoid(·) and linear activation functions. Standardization Layer Normalization at the last layer of the convolutional neural networks has been used occasionaly to encourage the competition between the hidden units. (Jarrett et al., 2009a) used a local contrast normalization layer in their architecture which performs subtractive and divisive normalization. A local contrast normalization layer enforces a local competition between adjacent features in the feature map and between features at the same spatial location in different feature maps. Similarly (Krizhevsky et al., 2012) observed that using a local response layer that enjoys the benefit of using local normalization scheme aids generalization. Standardization has been observed to be crucial for both SMLP trained with or without hints. In both SMLP-hints and SMLP-nohints experiments, the neural network was not able to generalize or even learn the training set without using standardization in the SMLP intermediate layer, doing just chance performance. More specifically, in the SMLP-nohints architecture, standardization is part of the computational graph, hence the gradients are being backpropagated through it. The mean and the standard deviation is computed for each hidden unit separately at the intermediate layer as in Equation 4. But in order to prevent numerical underflows or overflows during the backpropagation we have used  = 1e − 8 (Equation 3). The benefit of having sparse activations may be specifically important for the ill-conditioned problems, for the following reasons. When a hidden unit is “off”, its gradient (the derivative of the loss with respect to its output) is usually close to 0 as well, as seen here. That means that all off-diagonal second derivatives involving that hidden unit (e.g. its input weights) are also near 0. This is basically like removing some columns and rows from the Hessian matrix associated with a particular example. It has been observed that the condition number of the Hessian matrix (specifically, its largest eigenvalue) increases as the size of the network increases (Dauphin and Bengio, 2013), making training considerably slower and inefficient (Dauphin and Bengio, 2013). Hence one would expect that as sparsity of the gradients (obtained because of sparsity of the activations) increases, training would become more efficient, as if we were training a smaller sub-network for each example, with shared weights across examples, as in dropouts (Hinton et al., 2012). In Figure 9, the activation of each hidden unit in a bar chart is shown: the effect of standardization is significant, making the activations sparser. 15 (a) Before standardization. (b) After standardization. Figure 9: Activations of the intermediate-level hidden units of an SLMP-nohints for a particular examples (x-axis: hidden unit number, y-axis: activation value). Left (a): before standardization. Right (b): after standardization. In Figure 10, one can see the activation histogram of the SMLP-nohints intermediate layer, showing the distribution of activation values, before and after standardization. Again the sparsifying effect of standardization is very apparent. (a) Before standardization. (b) After standardization. Figure 10: Distribution histogram of activation values of SMLP-nohints intermediate layer. Left (a): before standardization. Right (b): after standardization. In Figures 10 and 9, the intermediate level activations of SMLP-nohints are shown before and after standardization. These are for the same SMLP-nohints architecture whose results are presented on Table 1. For that same SMLP, the Adadelta (Zeiler, 2012) adaptive learning 16 rate scheme has been used, with 512 hidden units for the hidden layer of P1NN and rectifier activation function. For the output of the P1NN, 11 sigmoidal units have been used while P2NN had 1200 hidden units with rectifier activation function. The output nonlinearity of the P2NN is a sigmoid and the training objective is the binary crossentropy. Adaptive Learning Rates We have experimented with several different adaptive learning rate algorithms. We tried rmsprop 8 , Adadelta (Zeiler, 2012), Adagrad (Duchi et al., 2010) and a linearly (1/t) decaying learning rate (Bengio, 2013b). For the SMLP-nohints with sigmoid activation function we have found Adadelta(Zeiler, 2012) converging faster to an effective local minima and usually yielding better generalization error compared to the others. 3.2.4 Deep and Structured MLP with Unsupervised Pre-Training Several experiments have been conducted using an architecture similar to the SMLP-nohints, but by using unsupervised pre-training of P1NN, with Denoising Auto-Encoder (DAE) and/or Contractive Auto-Encoders (CAE). Supervised fine-tuning proceeds as in the deep and structured MLP without hints. Because an unsupervised learner may not focus the representation just on the shapes, a larger number of intermediate-level units at the output of P1NN has been explored: previous work on unsupervised pre-training generally found that larger hidden layers were optimal when using unsupervised pre-training, because not all unsupervised features will be relevant to the task at hand. Instead of limiting to 11 units per patch, we experimented with networks with up to 20 hidden (i.e., code) units per patch in the second-layer patch-wise auto-encoder. In Appendix 5.1 we also provided the result of some experiments with binary-binary RBMs trained on 8×8 patches from the 40k training dataset. In unsupervised pretraining experiments in this paper, both contractive auto-encoder (CAE) with sigmoid nonlinearity and binary cross entropy cost function and denoising auto-encoder (DAE) have been used. In the second layer, experiments were performed with a DAE with rectifier hidden units utilizing L1 sparsity and weight decay on the weights of the auto-encoder. Greedy layerwise unsupervised training procedure is used to train the deep auto-encoder architecture (Bengio et al., 2007). In unsupervised pretraining experiments, tied weights have been used. Different combinations of CAE and DAE for unsupervised pretraining have been tested, but none of the configurations tested managed to learn the Pentomino task, as shown in Table 1. 3.3 Experiments with 1 of K representation To explore the effect of changing the complexity of the input representation on the difficulty of the task, a set of experiments have been designed with symbolic representations of the information in each patch. In all cases an empty patch is represented with a 0 vector. These representation can be seen as an alternative input for a P2NN-like network, i.e., they were fed as input to an MLP or another black-box classifier. The following four experiments have been conducted, each one using one using a different input representation for each patch: 8. This is learning rate scaling method that is discussed by G. Hinton in his Video Lecture 6.5 - rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012. 17 Algorithm SVM RBF K Nearest Neighbors Decision Tree Randomized Trees MLP Convnet/Lenet5 Maxout Convnet 2 layer sDA Struct. Supervised MLP w/o hints Struct. MLP+CAE Supervised Finetuning Struct. MLP+CAE+DAE, Supervised Finetuning Struct. MLP+DAE+DAE, Supervised Finetuning 20k dataset Training Test Error Error 26.2 50.2 24.7 50.0 5.8 48.6 3.2 49.8 26.5 49.3 50.6 49.8 14.5 49.5 49.4 50.3 0.0 48.6 50.5 49.7 49.1 49.7 49.5 50.3 40k dataset Training Test Error Error 28.2 50.2 25.3 49.5 6.3 49.4 3.4 50.5 33.2 49.9 49.4 49.8 0.0 50.1 50.2 50.3 0.0 36.0 49.8 49.7 49.4 49.7 49.7 49.8 80k dataset Training Test Error Error 30.2 49.6 25.6 49.0 6.9 49.9 3.5 49.1 27.2 50.1 50.2 49.8 0.0 44.6 49.7 50.3 0.0 12.4 50.3 49.7 50.1 49.7 50.3 49.7 Struct. MLP with Hints 0.21 0 0 30.7 3.1 0.01 Table 1: The error percentages with different learning algorithms on Pentomino dataset with different number of training examples. Experiment 1-Onehot representation without transformations: In this experiment several trials have been done with a 10-input one-hot vector per patch. Each input corresponds to an object category given in clear, i.e., the ideal input for P2NN if a supervised P1NN perfectly did its job. Experiment 2-Disentangled representations: In this experiment, we did trials with 16 binary inputs per patch, 10 one-hot bits for representing each object category, 4 for rotations and 2 for scaling, i.e., the whole information about the input is given, but it is perfectly disentangled. This would be the ideal input for P2NN if an unsupervised P1NN perfectly did its job. Experiment 3-Onehot representation with transformations: For each of the ten object types there are 8 = 4×2 possible transformations. Two objects in two different patches are the considered “the same” (for the final task) if their category is the same regardless of the transformations. The one-hot representation of a patch corresponds to the crossproduct between the 10 object shape classes and the 4×2 transformations, i.e., one out of 80=10×4 × 2 possibilities represented in an 80-bit one-hot vector. This also contains all the information about the input image patch, but spread out in a kind of non-parametric and non-informative (not disentangled) way, like a perfect memory-based unsupervised learner (like clustering) could produce. Nevertheless, the shape class would be easier to read out from this representation than from the image representation (it would be an OR over 8 of the bits). Experiment 4-Onehot representation with 80 choices: This representation has the same 1 of 80 one-hot representation per patch but the target task is defined differently. Two objects in two different patches are considered the same iff they have exactly the same 80-bit onehot representation (i.e., are of the same object category with the same transformation applied). The first experiment is a sanity check. It was conducted with single hidden-layered MLP’s with rectifier and tanh nonlinearity, and the task was learned perfectly (0 error on both training and test dataset) with very few training epochs. 18 0.6 0.6 Training Error Rate Test Error Rate 0.5 0.5 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0.00 100 200 300 400 500 600 700 800 Training Error Rate Test Error Rate 0.00 900 (a) Training and Test Errors for Experiment 4 100 200 300 400 500 600 700 800 (b) Training and Test Errors for Experiment 3 Figure 11: Tanh MLP training curves. Left (a): The training and test errors of Experiment 3 over 800 training epochs with 100k training examples using Tanh MLP. Right (b):The training and test errors of Experiment 4 over 700 training epochs with 100k training examples using Tanh MLP. The results of Experiment 2 are given in Table 2. To improve results, we experimented with the Maxout non-linearity in a feedforward MLP (Goodfellow et al., 2013) with two hidden layers. Unlike the typical Maxout network mentioned in the original paper, regularizers have been deliberately avoided in order to focus on the optimization issue, i.e: no weight decay, norm constraint on the weights, or dropout. Although learning from a disentangled representation is more difficult than learning from perfect object detectors, it is feasible with some architectures such as the Maxout network. Note that this representation is the kind of representation that one could hope an unsupervised learning algorithm could discover, at best, as argued in Bengio et al. (2012). The only results obtained on the validation set for Experiment 3 and Experiment 4 are shown respectively in Table 3 and Table 4. In these experiments a tanh MLP with two hidden layers have been tested with the same hyperparameters. In experiment 3 the complexity of the problem comes from the transformations (8=4×2) and the number of object types. But in experiment 4, the only source of complexity of the task comes from the number of different object types. These results are in between the complete failure and complete success observed with other experiments, suggesting that the task could become solvable with better training or more training examples. Figure 11 illustrates the progress of training a tanh MLP, on both the training and test error, for Experiments 3 and 4. Clearly, something has been learned, but the task is not nailed yet. On experiment 3 for both maxout and tanh the maxout there was a long plateau where the training error and objective stays almost same. Maxout did just chance on the experiment for about 120 iterations on the training and the test set. But after 120th iteration the training and test error started decline and eventually it was able to solve the task. Moreover as seen from the curves in Figure 11(a) and 11(b), the training and test error curves are almost the same for both tasks. This implies that for onehot inputs, whether you increase the number of possible transformations for each object or the number of 19 Learning Algorithm SVM Random Forests Tanh MLP Maxout MLP Training Error 0.0 1.29 0.0 0.0 Test Error 35.6 40.475 0.0 0.0 Table 2: Performance of different learning algorithms on disentangled representation in Experiment 2. Learning Algorithm SVM Random Forests Tanh MLP Maxout MLP Training Error 11.212 24.839 0.0 0.0 Test Error 32.37 48.915 22.475 0.0 Table 3: Performance of different learning algorithms using a dataset with onehot vector and 80 inputs as discussed for Experiment 3. object categories, as soon as the number of possible configurations is same, the complexity of the problem is almost the same for the MLP. 3.4 Does the Effect Persist with Larger Training Set Sizes? The results shown in this section indicate that the problem in the Pentomino task clearly is not just a regularization problem, but rather basically hinges on an optimization problem. Otherwise, we would expect test error to decrease as the number of training examples increases. This is shown first by studying the online case and then by studying the ordinary training case with a fixed size training set but considering increasing training set sizes. In the online minibatch setting, parameter updates are performed as follows: θt+1 = θt − ∆θt PN ∆θt =  i ∇θt L(xt , θt ) N (5) (6) where L(xt , θt ) is the loss incurred on example xt with parameters θt , where t ∈ Z + and  is the learning rate. Ordinary batch algorithms converge linearly to the optimum θ∗ , however the noisy gradient estimates in the online SGD will cause parameter θ to fluctuate near the local optima. However, online SGD directly optimizes the expected risk, because the examples are drawn iid from the ground-truth distribution (Bottou, 2010). Thus: Z L∞ = E[L(x, θ)] = L(x, θ)p(x)dx (7) x 20 Learning Algorithm SVM Random Forests Tanh MLP Training Error 4.346 23.456 0 Test Error 40.545 47.345 25.8 Table 4: Performance of different algorithms using a dataset with onehot vector and 80 binary inputs as discussed in Experiment 4. where L∞ is the generalization error. Therefore online SGD is trying to minimize the expected risk with noisy updates. Those noisy updates have the effect of regularizer: PN ∆ θt =  i ∇θt L(xt , θt ) = ∇θt L(x, θt ) + ξt N (8) where ∇θt L(x, θt ) is the true gradient and ξt is the zero-mean stochastic gradient “noise” due to computing the gradient over a finite-size minibatch sample. We would like to know if the problem with the Pentomino dataset is more a regularization or an optimization problem. An SMLP-nohints model was trained by online SGD with the randomly generated online Pentomino stream. The learning rate was adaptive, with the Adadelta procedure (Zeiler, 2012) on minibatches of 100 examples. In the online SGD experiments, two SMLP-nohints that is trained with and without standardization at the intermediate layer with exactly the same hyperparameters are tested. The SMLP-nohints P1NN patch-wise submodel has 2048 hidden units and the SMLP intermediate layer has 1152 = 64 × 18 hidden units. The nonlinearity that is used for the intermediate layer is the sigmoid. P2NN has 2048 hidden units. SMLP-nohints has been trained either with or without standardization on top of the output units of the P1NN. The experiments illustrated in Figures 12 and 13 are with the same SMLP without hints architecture for which results are given in Table 1. In those graphs only the results for the training on the randomly generated 545400 Pentomino samples have been presented. As shown in the plots SMLP-nohints was not able to generalize without standardization. Although without standardization the training loss seems to decrease initially, it eventually gets stuck in a plateau where training loss doesn’t change much. Training of SMLP-nohints online minibatch SGD is performed using standardization in the intermediate layer and Adadelta learning rate adaptation, on 1046000 training examples from the randomly generated Pentomino stream. At the end of the training, test error is down to 27.5%, which is much better than chance but from from the score obtained with SMLP-hints of near 0 error. In another SMLP-nohints experiment without standardization the model is trained with the 1580000 Pentomino examples using online minibatch SGD. P1NN has 2048 hidden units and 16 sigmoidal outputs per patch. for the P1NN hidden layer. P2NN has 1024 hidden units for the hidden layer. Adadelta is used to adapt the learning rate. At the end of training this SMLP, the test error remained stuck, at 50.1%. 21 0.55 0.50 Test Error 0.45 0.40 0.35 0.30 0.25 0.200 SMLP with standardization SMLP without standardization 100 200 300 400 500 Batch no 600 700 800 Figure 12: Test errors of SMLP-nohints with and without standardization in the intermediate layer. Sigmoid as an intermediate layer activation has been used. Each tick (batch no) in the x-axis represents 400 examples. 22 7 SMLP with standardization SMLP without standardization 6 Training Loss 5 4 3 2 1 00 100 200 300 400 Batch no 500 600 700 Figure 13: Training errors of SMLP-nohints with and without standardization in the intermediate layer. Sigmoid nonlinearity has been used as an intermediate layer activation function. The x-axis is in units of blocks of 400 examples in the training set. 23 3.4.1 Experiments with Increased Training Set Size Here we consider the effect of training different learners with different numbers of training examples. For the experimental results shown in Table 1, 3 training set sizes (20k, 40k and 80k examples) had been used. Each dataset was generated with different random seeds (so they do not overlap). Figure 14 also shows the error bars for an ordinary MLP with three hidden layers, for a larger range of training set sizes, between 40k and 320k examples. The number of training epochs is 8 (more did not help), and there are three hidden layers with 2048 feature detectors. The learning rate we used in our experiments is 0.01. The activation function of the MLP is a tanh nonlinearity, while the L1, L2 penalty coefficients are both 1e-6. Table 1 shows that, without guiding hints, none of the state-of-art learning algorithms could perform noticeably better than a random predictor on the test set. This shows the importance of intermediate hints introduced in the SMLP. The decision trees and SVMs can overfit the training set but they could not generalize on the test set. Note that the numbers reported in the table are for hyper-parameters selected based on validation set error, hence lower training errors are possible if avoiding all regularization and taking large enough models. On the training set, the MLP with two large hidden layers (several thousands) could reach nearly 0% training error, but still did not manage to achieve good test error. In the experiment results shown in Figure 14, we evaluate the impact of adding more training data for the fully-connected MLP. As mentioned before for these experiments we have used a MLP with three hidden layers where each layer has 2048 hidden units. The tanh(·) activation function is used with 0.05 learning rate and minibatches of size 200. As can be seen from the figure, adding more training examples did not help either training or test error (both are near 50%, with training error slightly lower and test error slightly higher), reinforcing the hypothesis that the difficult encountered is one of optimization, not of regularization. Figure 14: Training and test error bar charts for a regular MLP with 3 hidden layers. There is no significant improvement on the generalization error of the MLP as the new training examples are introduced. 24 3.5 Experiments on Effect of Initializing with Hints Initialization of the parameters in a neural network can have a big impact on the learning and generalization (Glorot and Bengio, 2010). Previously Erhan et al. (2010) showed that initializing the parameters of a neural network with unsupervised pretraining guides the learning towards basins of attraction of local minima that provides better generalization from the training dataset. In this section we analyze the effect of initializing the SMLP with hints and then continuing without hints at the rest of the training. For experimental analysis of hints based initialization, SMLP is trained for 1 training epoch using the hints and for 60 epochs it is trained without hints on the 40k examples training set. We also compared the same architecture with the same hyperparameters, against to SMLP-nohints trained for 61 iterations on the same dataset. After one iteration of hint-based training SMLP obtained 9% training error and 39% test error. Following the hint based training, SMLP is trained without hints for 60 epochs, but at epoch 18, it already got 0% training and 0% test error. The hyperparameters for this experiment and the experiment that the results shown for the SMLP-hints in Table 1 are the same. The test results for initialization with and without hints are shown on Figure 15. This figure suggests that initializing with hints can give the same generalization performance but training takes longer. Figure 15: Plots showing the test error of SMLP with random initialization vs initializing with hint based training. 3.5.1 Further Experiments on Optimization for Pentomino Dataset With extensive hyperparameter optimization and using standardization in the intermediate level of the SMLP with softmax nonlinearity, SMLP-nohints was able to get 5.3% training and 25 6.7% test error on the 80k Pentomino training dataset. We used the 2050 hidden units for the hidden layer of P1NN and 11 softmax output per patch. For the P2NN, we used 1024 hidden units with sigmoid and learning rate 0.1 without using any adaptive learning rate method. This SMLP uses a rectifier nonlinearity for hidden layers of both P1NN and P2NN. Considering that architecture uses softmax as the intermediate activation function of SMLP-nohints. It is very likely that P1NN is trying to learn the presence of specific Pentomino shape in a given patch. This architecture has a very large capacity in the P1NN, that probably provides it enough capacity to learn the presence of Pentomino shapes at each patch effortlessly. An MLP with 2 hidden layers, each 1024 rectifier units, was trained using LBFGS (the implementation from the scipy.optimize library) on 40k training examples, with gradients computed on batches of 10000 examples at each iteration. However, after convergence of training, the MLP was still doing chance on the test dataset. We also observed that using linear units for the intermediate layer yields better generalization error without standardization compared to using activation functions such as sigmoid, tanh and RELU for the intermediate layer. SMLP-nohints was able to get 25% generalization error with linear units without standardization whereas all the other activation functions that has been tested failed to generalize with the same number of training iterations without standardization and hints. This suggests that using non-linear intermediate-level activation functions without standardization introduces an optimization difficulty for the SMLP-nohints, maybe because the intermediate level acts like a bottleneck in this architecture. 4. Conclusion and Discussion In this paper we have shown an example of task which seems almost impossible to solve by standard black-box machine learning algorithms, but can be almost perfectly solved when one encourages a semantics for the intermediate-level representation that is guided by prior knowledge. The task has the particularity that it is defined by the composition of two nonlinear sub-tasks (object detection on one hand, and a non-linear logical operation similar to XOR on the other hand). What is interesting is that in the case of the neural network, we can compare two networks with exactly the same architecture but a different pre-training, one of which uses the known intermediate concepts to teach an intermediate representation to the network. With enough capacity and training time they can overfit but did not not capture the essence of the task, as seen by test set performance. We know that a structured deep network can learn the task, if it is initialized in the right place, and do it from very few training examples. Furthermore we have shown that if one pre-trains SMLP with hints for only one epoch, it can nail the task. But the exactly same architecture which started training from random initialization, failed to generalize. Consider the fact that even SMLP-nohints with standardization after being trained using online SGD on 1046000 generated examples and still gets 27.5% test error. This is an indication that the problem is not a regularization problem but possibly an inability to find a good effective local minima of generalization error. What we hypothesize is that for most initializations and architectures (in particular the fully-connected ones), although it is possible to find a good effective local minimum of training error when enough capacity is provided, it is difficult (without the proper initialization) to find a good local minimum of generalization error. On the other hand, when the network architecture 26 is constrained enough but still allows it to represent a good solution (such as the structured MLP of our experiments), it seems that the optimization problem can still be difficult and even training error remains stuck high if the standardization isn’t used. Standardization obviously makes the training objective of the SMLP easier to optimize and helps it to find at least a better effective local minimum of training error. This finding suggests that by using specific architectural constraints and sometimes domain specific knowledge about the problem, one can alleviate the optimization difficulty that generic neural network architectures face. It could be that the combination of the network architecture and training procedure produces a training dynamics that tends to yield into these minima that are poor from the point of view of generalization error, even when they manage to nail training error by providing enough capacity. Of course, as the number of examples increases, we would expect this discrepancy to decrease, but then the optimization problem could still make the task unfeasible in practice. Note however that our preliminary experiments with increasing the training set size (8-fold) for MLPs did not reveal signs of potential improvements in test error yet, as shown in Figure 14. Even using online training on 545400 Pentomino examples, the SMLP-nohints architecture was still doing far from perfect in terms of generalization error (Figure 12). These findings bring supporting evidence to the “Guided Learning Hypothesis” and “Deeper Harder Hypothesis” from Bengio (2013a): higher level abstractions, which are expressed by composing simpler concepts, are more difficult to learn (with the learner often getting in an effective local minimum ), but that difficulty can be overcome if another agent provides hints of the importance of learning other, intermediate-level abstractions which are relevant to the task. Many interesting questions remain open. Would a network without any guiding hint eventually find the solution with a enough training time and/or with alternate parametrizations? To what extent is ill-conditioning a core issue? The results with LBFGS were disappointing but changes in the architectures (such as standardization of the intermediate level) seem to make training much easier. Clearly, one can reach good solutions from an appropriate initialization, pointing in the direction of an issue with local minima, but it may be that good solutions are also reachable from other initializations, albeit going through a tortuous ill-conditioned path in parameter space. Why did our attempts at learning the intermediate concepts in an unsupervised way fail? Are these results specific to the task we are testing or a limitation of the unsupervised feature learning algorithm tested? Trying with many more unsupervised variants and exploring explanatory hypotheses for the observed failures could help us answer that. Finally, and most ambitious, can we solve these kinds of problems if we allow a community of learners to collaborate and collectively discover and combine partial solutions in order to obtain solutions to more abstract tasks like the one presented here? Indeed, we would like to discover learning algorithms that can solve such tasks without the use of prior knowledge as specific and strong as the one used in the SMLP here. These experiments could be inspired by and inform us about potential mechanisms for collective learning through cultural evolutions in human societies. Acknowledgments We would like to thank to the ICLR 2013 reviewers for their insightful comments, and NSERC, CIFAR, Compute Canada and Canada Research Chairs for funding. 27 References A. Ben-Hur and J. Weston. A user’s guide to support vector machines. Methods in Molecular Biology, 609:223–239, 2010. Y. Bengio, P. Lamblin, D. Popovici, and H. Larochelle. Greedy layer-wise training of deep networks. In NIPS’2006, 2007. Yoshua Bengio. Learning deep architectures for AI. Foundations and Trends in Machine Learning, 2(1):1–127, 2009. Also published as a book. Now Publishers, 2009. Yoshua Bengio. Evolving culture vs local minima. In Growing Adaptive Machines: Integrating Development and Learning in Artificial Neural Networks, number also as ArXiv 1203.2990v1, pages T. Kowaliw, N. Bredeche & R. Doursat, eds. Springer-Verlag, March 2013a. URL http://arxiv.org/abs/1203.2990. Yoshua Bengio. Practical recommendations for gradient-based training of deep architectures. In K.-R. Müller, G. Montavon, and G. B. Orr, editors, Neural Networks: Tricks of the Trade. Springer, 2013b. Yoshua Bengio, Jerome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In Léon Bottou and Michael Littman, editors, Proceedings of the Twenty-sixth International Conference on Machine Learning (ICML’09). ACM, 2009a. Yoshua Bengio, Jerome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ICML’09, 2009b. Yoshua Bengio, Aaron Courville, and Pascal Vincent. Unsupervised feature learning and deep learning: A review and new perspectives. Technical Report arXiv:1206.5538, U. Montreal, 2012. URL http://arxiv.org/abs/1206.5538. Yoshua Bengio, Aaron Courville, and Pascal Vincent. Unsupervised feature learning and deep learning: A review and new perspectives. IEEE Trans. Pattern Analysis and Machine Intelligence (PAMI), 2013. James Bergstra, Olivier Breuleux, Frédéric Bastien, Pascal Lamblin, Razvan Pascanu, Guillaume Desjardins, Joseph Turian, David Warde-Farley, and Yoshua Bengio. Theano: a CPU and GPU math expression compiler. In Proceedings of the Python for Scientific Computing Conference (SciPy), 2010. Léon Bottou. Large-scale machine learning with stochastic gradient descent. In Proceedings of COMPSTAT’2010, pages 177–186. Springer, 2010. Leo Breiman. Random forests. Machine Learning, 45(1):5–32, 2001. D. C. Ciresan, U. Meier, L. M. Gambardella, and J. Schmidhuber. Deep big simple neural nets for handwritten digit recognition. Neural Computation, 22:1–14, 2010. Yann Dauphin and Yoshua Bengio. Big neural networks waste capacity. Technical Report arXiv:1301.3583, Universite de Montreal, 2013. Richard Dawkins. The Selfish Gene. Oxford University Press, 1976. 28 J. Duchi, E. Hazan, and Y. Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12:2121–2159, 2010. Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research, 11:625–660, February 2010. François Fleuret, Ting Li, Charles Dubout, Emma K Wampler, Steven Yantis, and Donald Geman. Comparing machines and humans on a visual categorization test. Proceedings of the National Academy of Sciences, 108(43):17621–17625, 2011. X. Glorot, A. Bordes, and Y. Bengio. Deep sparse rectifier neural networks. In AISTATS, 2011a. Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In JMLR W&CP: Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics (AISTATS 2010), volume 9, pages 249–256, May 2010. Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In JMLR W&CP: Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics (AISTATS 2011), April 2011b. Ian J. Goodfellow, David Warde-Farley, Mehdi Mirza, Aaron Courville, and Yoshua Bengio. Maxout networks. In ICML, 2013. Maciej Henneberg. Decrease of human skull size in the holocene. Human biology, pages 395–405, 1988. Maciej Henneberg and Maryna Steyn. Trends in cranial capacity and cranial index in subsaharan africa during the holocene. American journal of human biology, 5(4):473–479, 1993. J. Henrich and R. McElreath. The evolution of cultural evolution. Evolutionary Anthropology: Issues, News, and Reviews, 12(3):123–135, 2003. Geoffrey E. Hinton, Simon Osindero, and Yee Whye Teh. A fast learning algorithm for deep belief nets. Neural Computation, 18:1527–1554, 2006. Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. Technical report, arXiv:1207.0580, 2012. C.W. Hsu, C.C. Chang, C.J. Lin, et al. A practical guide to support vector classification, 2003. Kevin Jarrett, Koray Kavukcuoglu, Marc’Aurelio Ranzato, and Yann LeCun. What is the best multi-stage architecture for object recognition? In Proc. International Conference on Computer Vision (ICCV’09), pages 2146–2153. IEEE, 2009a. Kevin Jarrett, Koray Kavukcuoglu, Marc’Aurelio Ranzato, and Yann LeCun. What is the best multi-stage architecture for object recognition? In ICCV’09, 2009b. 29 Faisal Khan, Xiaojin Zhu, and Bilge Mutlu. How do humans teach: On curriculum learning and teaching dimension. In Advances in Neural Information Processing Systems 24 (NIPS’11), pages 1449–1457, 2011. Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton. ImageNet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems 25 (NIPS’2012). 2012. Kai A. Krueger and Peter Dayan. Flexible shaping: how learning in small steps helps. Cognition, 110:380–394, 2009. G. Kunapuli, K.P. Bennett, R. Maclin, and J.W. Shavlik. The adviceptron: Giving advice to the perceptron. Proceedings of the Conference on Artificial Neural Networks In Engineering (ANNIE 2010), 2010. Hugo Larochelle, Yoshua Bengio, Jerome Louradour, and Pascal Lamblin. Exploring strategies for training deep neural networks. Journal of Machine Learning Research, 10:1–40, 2009. Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. T.M. Mitchell. The need for biases in learning generalizations. Department of Computer Science, Laboratory for Computer Science Research, Rutgers Univ., 1980. T.M. Mitchell and S.B. Thrun. Explanation-based neural network learning for robot control. Advances in Neural information processing systems, pages 287–287, 1993. R. Montague. Universal grammar. Theoria, 36(3):373–398, 1970. V. Nair and G. E Hinton. Rectified linear units improve restricted Boltzmann machines. In ICML’10, 2010. L.B.J.H.F.R.A. Olshen and C.J. Stone. Classification and regression trees. Belmont, Calif.: Wadsworth, 1984. Joseph O’Sullivan. Integrating initialization bias and search bias in neural network learning, 1996. F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, et al. Scikit-learn: Machine learning in python. The Journal of Machine Learning Research, 12:2825–2830, 2011. Gail B. Peterson. A day of great illumination: B. F. Skinner’s discovery of shaping. Journal of the Experimental Analysis of Behavior, 82(3):317–328, 2004. Tapani Raiko, Harri Valpola, and Yann LeCun. Deep learning made easier by linear transformations in perceptrons. In International Conference on Artificial Intelligence and Statistics, pages 924–932, 2012. Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive auto-encoders: Explicit invariance during feature extraction. In ICML’2011, 2011. 30 Salah Rifai, Yoshua Bengio, Yann Dauphin, and Pascal Vincent. A generative process for sampling contractive auto-encoders. In Proceedings of the Twenty-nine International Conference on Machine Learning (ICML’12). ACM, 2012. URL http://icml.cc/discuss/2012/590. html. R. Salakhutdinov and G.E. Hinton. Deep Boltzmann machines. In Proceedings of the Twelfth International Conference on Artificial Intelligence and Statistics (AISTATS 2009), volume 8, 2009. Burrhus F. Skinner. Reinforcement today. American Psychologist, 13:94–99, 1958. R.J. Solomonoff. A system for incremental learning based on algorithmic probability. In Proceedings of the Sixth Israeli Conference on Artificial Intelligence, Computer Vision and Pattern Recognition, pages 515–527. Citeseer, 1989. G.G. Towell and J.W. Shavlik. Knowledge-based artificial neural networks. Artificial intelligence, 70(1):119–165, 1994. Tommi Vatanen, Tapani Raiko, Harri Valpola, and Yann LeCun. Pushing stochastic gradient towards second-order methods–backpropagation learning with transformations in nonlinearities. arXiv preprint arXiv:1301.3476, 2013. Pascal Vincent, Hugo Larochelle, Isabelle Lajoie, Yoshua Bengio, and Pierre-Antoine Manzagol. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of Machine Learning Research, 11:3371–3408, December 2010. Luis Von Ahn, Manuel Blum, Nicholas J Hopper, and John Langford. Captcha: Using hard ai problems for security. In Advances in CryptologyEUROCRYPT 2003, pages 294–311. Springer, 2003. Jason Weston, Frédéric Ratle, and Ronan Collobert. Deep learning via semi-supervised embedding. In William W. Cohen, Andrew McCallum, and Sam T. Roweis, editors, Proceedings of the Twenty-fifth International Conference on Machine Learning (ICML’08), pages 1168–1175, New York, NY, USA, 2008. ACM. ISBN 978-1-60558-205-4. doi: 10.1145/1390156.1390303. Matthew D Zeiler. Adadelta: arXiv:1212.5701, 2012. An adaptive learning rate method. arXiv preprint 5. Appendix 5.1 Binary-Binary RBMs on Pentomino Dataset We trained binary-binary RBMs (both visible and hidden are binary) on 8×8 patches extracted from the Pentomino Dataset using PCD (stochastic maximum likelihood), a weight decay of .0001 and a sparsity penalty9 . We used 256 hidden units and trained by SGD with a batch size of 32 and a annealing learning rate (Bengio, 2013b) starting from 1e-3 with annealing rate 9. implemented as TorontoSparsity in pylearn2, see the yaml file in the repository for more details 31 1.000015. The RBM is trained with momentum starting from 0.5. The biases are initialized to -2 in order to get a sparse representation. The RBM is trained for 120 epochs (approximately 50 million updates). After pretraining the RBM, its parameters are used to initialize the first layer of an SMLPnohints network. As in the usual architecture of the SMLP-nohints on top of P1NN, there is an intermediate layer. Both P1NN and the intermediate layer have a sigmoid nonlinearity, and the intermediate layer has 11 units per location. This SMLP-nohints is trained with Adadelta and standardization at the intermediate layer 10 . RBM Test and Training Errors 0.5 Training Error Test Error Error percentage 0.4 0.3 0.2 0.1 0.00 5 10 15 20 25 Epoch 30 35 40 45 Figure 16: Training and test errors of an SMLP-nohints network whose first layer is pre-trained as an RBM. Training error reduces to 0% at epoch 42, but test error is still chance. 5.2 Experimental Setup and Hyper-parameters 5.2.1 Decision Trees We used the decision tree implementation in the scikit-learn (Pedregosa et al., 2011) python package which is an implementation of the CART (Regression Trees) algorithm. The CART algorithm constructs the decision tree recursively and partitions the input space such that the samples belonging to the same category are grouped together (Olshen and Stone, 1984). We used The Gini index as the impurity criteria. We evaluated the hyper-parameter configurations with a grid-search. We cross-validated the maximum depth (max depth) of the tree (for preventing the algorithm to severely overfit the training set) and minimum number of samples 10. In our auto-encoder experiments we directly fed features to P2NN without standardization and Adadelta. 32 Figure 17: Filters learned by the binary-binary RBM after training on the 40k examples. The RBM did learn the edge structure of Pentomino shapes. Figure 18: 100 samples generated from trained RBM. All the generated samples are valid Pentomino shapes. 33 required to create a split (min split). 20 different configurations of hyper-parameter values were evaluated. We obtained the best validation error with max depth = 300 and min split = 8. 5.2.2 Support Vector Machines We used the “Support Vector Classifier (SVC)” implementation from the scikit-learn package which in turn uses the libsvm’s Support Vector Machine (SVM) implementation. Kernelbased SVMs are non-parametric models that map the data into a high dimensional space and separate different classes with hyperplane(s) such that the support vectors for each category will be separated by a large margin. We cross-validated three hyper-parameters of the model using grid-search: C, γ and the type of kernel(kernel type). C is the penalty term (weight decay) for the SVM and γ is a hyper-parameter that controls the width of the Gaussian for the RBF kernel. For the polynomial kernel, γ controls the flexibility of the classifier (degree of the polynomial) as the number of parameters increases (Hsu et al., 2003; Ben-Hur and Weston, 2010). We evaluated forty-two hyper-parameter configurations. That includes, two kernel types: {RBF, P olynomial}; three gammas: {1e − 2, 1e − 3, 1e − 4} for the RBF kernel, {1, 2, 5} for the polynomial kernel, and seven C values among: {0.1, 1, 2, 4, 8, 10, 16}. As a result of the grid search and cross-validation, we have obtained the best test error by using the RBF kernel, with C = 2 and γ = 1. 5.2.3 Multi Layer Perceptron We have our own implementation of Multi Layer Perceptron based on the Theano (Bergstra et al., 2010) machine learning libraries. We have selected 2 hidden layers, the rectifier activation function, and 2048 hidden units per layer. We cross-validated three hyper-parameters of the model using random-search, sampling the learning rates  in log-domain, and selecting L1 and L2 regularization penalty coefficients in sets of fixed values, evaluating 64 hyperparameter values. The range of the hyperparameter values are  ∈ [0.0001, 1], L1 ∈ {0., 1e−6, 1e−5, 1e−4} and L2 ∈ {0, 1e − 6, 1e − 5}. As a result, the following were selected: L1 = 1e − 6, L2 = 1e − 5 and  = 0.05. 5.2.4 Random Forests We used scikit-learn’s implementation of “Random Forests” decision tree learning. The Random Forests algorithm creates an ensemble of decision trees by randomly selecting for each tree a subset of features and applying bagging to combine the individual decision trees (Breiman, 2001). We have used grid-search and cross-validated the max depth, min split, and number of trees (n estimators). We have done the grid-search on the following hyperparameter values, n estimators ∈ {5, 10, 15, 25, 50}, max depth ∈ {100, 300, 600, 900}, and min splits ∈ {1, 4, 16}. We obtained the best validation error with max depth = 300, min split = 4 and n estimators = 10. 5.2.5 k-Nearest Neighbors We used scikit-learn’s implementation of k-Nearest Neighbors (k-NN). k-NN is an instancebased, lazy learning algorithm that selects the training examples closest in Euclidean distance to the input query. It assigns a class label to the test example based on the categories of the k closest neighbors. The hyper-parameters we have evaluated in the cross-validation are the number of neighbors (k) and weights. The weights hyper-parameter can be either “uniform” or 34 “distance”. With “uniform”, the value assigned to the query point is computed by the majority vote of the nearest neighbors. With “distance”, each value assigned to the query point is computed by weighted majority votes where the weights are computed with the inverse distance between the query point and the neighbors. We have used n neighbours ∈ {1, 2, 4, 6, 8, 12} and weights ∈ {”unif orm”, ”distance”} for hyper-parameter search. As a result of cross-validation and grid search, we obtained the best validation error with k = 2 and weights=“uniform”. 5.2.6 Convolutional Neural Nets We used a Theano (Bergstra et al., 2010) implementation of Convolutional Neural Networks (CNN) from the deep learning tutorial at deeplearning.net, which is based on a vanilla version of a CNN LeCun et al. (1998). Our CNN has two convolutional layers. Following each convolutional layer, we have a max-pooling layer. On top of the convolution-poolingconvolution-pooling layers there is an MLP with one hidden layer. In the cross-validation we have sampled 36 learning rates in log-domain in the range [0.0001, 1] and the number of filters from the range [10, 20, 30, 40, 50, 60] uniformly. For the first convolutional layer we used 9×9 receptive fields in order to guarantee that each object fits inside the receptive field. As a result of random hyperparameter search and doing manual hyperparameter search on the validation dataset, the following values were selected: • The number of features used for the first layer is 30 and the second layer is 60. • For the second convolutional layer, 7×7 receptive fields. The stride for both convolutional layers is 1. • Convolved images are downsampled by a factor of 2×2 at each pooling operation. • The learning rate for CNN is 0.01 and it was trained for 8 epochs. 5.2.7 Maxout Convolutional Neural Nets We used the pylearn2 (https://github.com/lisa-lab/pylearn2) implementation of maxout convolutional networks (Goodfellow et al., 2013). There are two convolutional layers in the selected architecture, without any pooling. In the last convolutional layer, there is a maxout non-linearity. The following were selected by cross-validation: learning rate, number of channels for the both convolution layers, number of kernels for the second layer and number of units and pieces per maxout unit in the last layer, a linearly decaying learning rate, momentum starting from 0.5 and saturating to 0.8 at the 200’th epoch. Random search for the hyperparameters was used to evaluate 48 different hyperparameter configurations on the validation dataset. For the first convolutional layer, 8×8 kernels were selected to make sure that each Pentomino shape fits into the kernel. Early stopping was used and test error on the model that has the best validation error is reported. Using norm constraint on the fan-in of the final softmax units yields slightly better result on the validation dataset. As a result of cross-validation and manually tuning the hyperparameters we used the following hyperparameters: • 16 channels per convolutional layer. 600 hidden units for the maxout layer. • 6x6 kernels for the second convolutional layer. 35 • 5 pieces for the convolution layers and 4 pieces for the maxout layer per maxout units. • We decayed the learning rate by the factor of 0.001 and the initial learning rate is 0.026367. But we scaled the learning rate of the second convolutional layer by a constant factor of 0.6. • The norm constraint (on the incoming weights of each unit) is 1.9365. Figure 19 shows the first layer filters of the maxout convolutional net, after being trained on the 80k training set for 85 epochs. Figure 19: Maxout convolutional net first layer filters. Most of the filters were able to learn the basic edge structure of the Pentomino shapes. 5.2.8 Stacked Denoising Auto-Encoders Denoising Auto-Encoders (DAE) are a form of regularized auto-encoder (Bengio et al., 2013). The DAE forces the hidden layer to discover more robust features and prevents it from simply learning the identity by reconstructing the input from a corrupted version of it (Vincent et al., 2010). Two DAEs were stacked, resulting in an unsupervised transformation with two hidden layers of 1024 units each. Parameters of all layers are then fine-tuned with supervised finetuning using logistic regression as the classifier and SGD as the gradient-based optimization algorithm. The stochastic corruption process is binomial (0 or 1 replacing each input value, with probability 0.2). The selected learning rate is 0 = 0.01 for the DAe and 1 = 0.1 for supervised fine-tuning. Both L1 and L2 penalty for the DAEs and for the logistic regression layer are set to 1e-6. CAE+MLP with Supervised Finetuning: A regularized auto-encoder which sometimes outperforms the DAE is the Contractive Auto-Encoder (CAE), (Rifai et al., 2012), which penalizes the Frobenius norm of the Jacobian matrix of derivatives of the hidden units with respect to the CAE’s inputs. The CAE serves as pre-training for an MLP, and in the supervised fine-tuning state, the Adagrad method was used to automatically tune the learning rate (Duchi et al., 2010). After training a CAE with 100 sigmoidal units patch-wise, the features extracted on each patch are concatenated and fed as input to an MLP. The selected Jacobian penalty coefficient is 2, the learning rate for pre-training is 0.082 with batch size of 200 and 200 epochs of unsupervised learning are performed on the training set. For supervised finetuning, the learning rate is 0.12 over 100 epochs, L1 and L2 regularization penalty terms respectively are 1e-4 and 1e-6, and the top-level MLP has 6400 hidden units. 36 Greedy Layerwise CAE+DAE Supervised Finetuning: For this experiment we stack a CAE with sigmoid non-linearities and then a DAE with rectifier non-linearities during the pretraining phase. As recommended by Glorot et al. (2011b) we have used a softplus nonlinearity for reconstruction, sof tplus(x) = log(1 + ex ). We used an L1 penalty on the rectifier outputs to obtain a sparser representation with rectifier non-linearity and L2 regularization to keep the non-zero weights small. The main difference between the DAE and CAE is that the DAE yields more robust reconstruction whereas the CAE obtains more robust features (Rifai et al., 2011). As seen on Figure 7 the weights U and V are shared on each patch and we concatenate the outputs of the last auto-encoder on each patch to feed it as an input to an MLP with a large hidden layer. We used 400 hidden units for the CAE and 100 hidden units for DAE. The learning rate used for the CAE is 0.82 and for DAE it is 9*1e-3. The corruption level for the DAE (binomial noise) is 0.25 and the contraction level for the CAE is 2.0. The L1 regularization penalty for the DAE is 2.25*1e-4 and the L2 penalty is 9.5*1e-5. For the supervised finetuning phase the learning rate used is 4*1e-4 with L1 and L2 penalties respectively 1e-5 and 1e-6. The top-level MLP has 6400 hidden units. The auto-encoders are each trained for 150 epochs while the whole MLP is fine-tuned for 50 epochs. Greedy Layerwise DAE+DAE Supervised Finetuning: For this architecture, we have trained two layers of denoising auto-encoders greedily and performed supervised finetuning after unsupervised pre-training. The motivation for using two denoising auto-encoders is the fact that rectifier nonlinearities work well with the deep networks but it is difficult to train CAEs with the rectifier non-linearity. We have used the same type of denoising auto-encoder that is used for the greedy layerwise CAE+DAE supervised finetuning experiment. In this experiment we have used 400 hidden units for the first layer DAE and 100 hidden units for the second layer DAE. The other hyperparameters for DAE and supervised finetuning are the same as with the CAE+DAE MLP Supervised Finetuning experiment. 37
9cs.NE
QSGD: Communication-Efficient SGD via Gradient Quantization and Encoding arXiv:1610.02132v4 [cs.LG] 6 Dec 2017 Dan Alistarh IST Austria & ETH Zurich [email protected] Demjan Grubic ETH Zurich & Google [email protected] Ryota Tomioka Microsoft Research [email protected] Jerry Z. Li MIT [email protected] Milan Vojnovic London School of Economics [email protected] Abstract Parallel implementations of stochastic gradient descent (SGD) have received significant research attention, thanks to its excellent scalability properties. A fundamental barrier when parallelizing SGD is the high bandwidth cost of communicating gradient updates between nodes; consequently, several lossy compresion heuristics have been proposed, by which nodes only communicate quantized gradients. Although effective in practice, these heuristics do not always converge. In this paper, we propose Quantized SGD (QSGD), a family of compression schemes with convergence guarantees and good practical performance. QSGD allows the user to smoothly trade off communication bandwidth and convergence time: nodes can adjust the number of bits sent per iteration, at the cost of possibly higher variance. We show that this trade-off is inherent, in the sense that improving it past some threshold would violate information-theoretic lower bounds. QSGD guarantees convergence for convex and non-convex objectives, under asynchrony, and can be extended to stochastic variance-reduced techniques. When applied to training deep neural networks for image classification and automated speech recognition, QSGD leads to significant reductions in end-to-end training time. For instance, on 16GPUs, we can train the ResNet-152 network to full accuracy on ImageNet 1.8× faster than the full-precision variant. 1 Introduction The surge of massive data has led to significant interest in distributed algorithms for scaling computations in the context of machine learning and optimization. In this context, much attention has been devoted to scaling large-scale stochastic gradient descent (SGD) algorithms [33], which can be briefly defined as follows. Let f : Rn → R be a function which we want to minimize. We have access to stochastic gradients ge such that E[e g (x)] = ∇f (x). A standard instance of SGD will converge towards the minimum by iterating the procedure xt+1 = xt − ηt ge(xt ), (1) where xt is the current candidate, and ηt is a variable step-size parameter. Notably, this arises if we are given i.i.d. data points X1 , . . . , Xm generated from an unknown distribution D, and a loss function `(X, θ), which measures the loss of the model θ at data point X. We wish to find a model θ∗ which minimizes f (θ) = EX∼D [`(X, θ)], the expected loss to the data. This framework captures many fundamental tasks, such as neural network training. 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA. In this paper, we focus on parallel SGD methods, which have received considerable attention recently due to their high scalability [6, 8, 13, 32]. Specifically, we consider a setting where a large dataset is partitioned among K processors, which collectively minimize a function f . Each processor maintains a local copy of the parameter vector xt ; in each iteration, it obtains a new stochastic gradient update (corresponding to its local data). Processors then broadcast their gradient updates to their peers, and aggregate the gradients to compute the new iterate xt+1 . In most current implementations of parallel SGD, in each iteration, each processor must communicate its entire gradient update to all other processors. If the gradient vector is dense, each processor will need to send and receive n floating-point numbers per iteration to/from each peer to communicate the gradients and maintain the parameter vector x. In practical applications, communicating the gradients in each iteration has been observed to be a significant performance bottleneck [8, 35, 37]. One popular way to reduce this cost has been to perform lossy compression of the gradients [1, 3, 10, 11, 41]. A simple implementation is to simply reduce precision of the representation, which has been shown to converge under convexity and sparsity assumptions [10]. A more drastic quantization technique is 1BitSGD [35, 37], which reduces each component of the gradient to just its sign (one bit), scaled by the average over the coordinates of ge, accumulating errors locally. 1BitSGD was experimentally observed to preserve convergence [35], under certain conditions; thanks to the reduction in communication, it enabled state-of-the-art scaling of deep neural networks (DNNs) for acoustic modelling [37]. However, it is currently not known if 1BitSGD provides any guarantees, even under strong assumptions, and it is not clear if higher compression is achievable. Contributions. Our focus is understanding the trade-offs between the communication cost of dataparallel SGD, and its convergence guarantees. We propose a family of algorithms allowing for lossy compression of gradients called Quantized SGD (QSGD), by which processors can trade-off the number of bits communicated per iteration with the variance added to the process. QSGD is built on two algorithmic ideas. The first is an intuitive stochastic quantization scheme: given the gradient vector at a processor, we quantize each component by randomized rounding to a discrete set of values, in a principled way which preserves the statistical properties of the original. The second step is an efficient lossless code for quantized gradients, which exploits their statistical properties to generate efficient encodings. Our analysis gives tight bounds on the precision-variance trade-off induced by QSGD. √ At one extreme of this trade-off, we can guarantee that each processor transmits √ at most n(log n + O(1)) expected bits per iteration, while increasing variance by at most a n multiplicative factor. At the other extreme, we show that each processor can transmit ≤ 2.8n + 32 bits per iteration in expectation, while increasing variance by a only a factor of 2. In particular, in the latter regime, compared to full precision SGD, we use ≈ 2.8n bits of communication per iteration as opposed to 32n bits, and guarantee at most 2× more iterations, leading to bandwidth savings of ≈ 5.7×. QSGD is fairly general: it can also be shown to converge, under assumptions, to local minima for nonconvex objectives, as well as under asynchronous iterations. One non-trivial extension we develop is a stochastic variance-reduced [23] variant of QSGD, called QSVRG, which has exponential convergence rate. One key question is whether QSGD’s compression-variance trade-off is inherent: for instance, does any algorithm guaranteeing at most constant variance blowup need to transmit Ω(n) bits per iteration? The answer is positive: improving asymptotically upon this trade-off would break the communication complexity lower bound of distributed mean estimation (see [44, Proposition 2] and [38]). Experiments. The crucial question is whether, in practice, QSGD can reduce communication cost by enough to offset the overhead of any additional iterations to convergence. The answer is yes. We explore the practicality of QSGD on a variety of state-of-the-art datasets and machine learning models: we examine its performance in training networks for image classification tasks (AlexNet, Inception, ResNet, and VGG) on the ImageNet [12] and CIFAR-10 [25] datasets, as well as on LSTMs [19] for speech recognition. We implement QSGD in Microsoft CNTK [3]. Experiments show that all these models can significantly benefit from reduced communication when doing multi-GPU training, with virtually no accuracy loss, and under standard parameters. For example, when training AlexNet on 16 GPUs with standard parameters, the reduction in communication time is 4×, and the reduction in training to the network’s top accuracy is 2.5×. When training an LSTM on two GPUs, the reduction in communication time is 6.8×, while the reduction in training 2 time to the same target accuracy is 2.7×. Further, even computationally-heavy architectures such as Inception and ResNet can benefit from the reduction in communication: on 16GPUs, QSGD reduces the end-to-end convergence time of ResNet152 by approximately 2×. Networks trained with QSGD can converge to virtually the same accuracy as full-precision variants, and that gradient quantization may even slightly improve accuracy in some settings. Related Work. One line of related research studies the communication complexity of convex optimization. In particular, [40] studied two-processor convex minimization in the same model, provided a lower bound of Ω(n(log n + log(1/))) bits on the communication cost of n-dimensional convex problems, and proposed a non-stochastic algorithm for strongly convex problems, whose communication cost is within a log factor of the lower bound. By contrast, our focus is on stochastic gradient methods. Recent work [5] focused on round complexity lower bounds on the number of communication rounds necessary for convex learning. Buckwild! [10] was the first to consider the convergence guarantees of low-precision SGD. It gave upper bounds on the error probability of SGD, assuming unbiased stochastic quantization, convexity, and gradient sparsity, and showed significant speedup when solving convex problems on CPUs. QSGD refines these results by focusing on the trade-off between communication and convergence. We view quantization as an independent source of variance for SGD, which allows us to employ standard convergence results [7]. The main differences from Buckwild! are that 1) we focus on the variance-precision trade-off; 2) our results apply to the quantized non-convex case; 3) we validate the practicality of our scheme on neural network training on GPUs. Concurrent work proposes TernGrad [41], which starts from a similar stochastic quantization, but focuses on the case where individual gradient components can have only three possible values. They show that significant speedups can be achieved on TensorFlow [1], while maintaining accuracy within a few percentage points relative to full precision. The main differences to our work are: 1) our implementation guarantees convergence under standard assumptions; 2) we strive to provide a black-box compression technique, with no additional hyperparameters to tune; 3) experimentally, QSGD maintains the same accuracy within the same target number of epochs; for this, we allow gradients to have larger bit width; 4) our experiments focus on the single-machine multi-GPU case. We note that QSGD can be applied to solve the distributed mean estimation problem [24, 38] with an optimal error-communication trade-off in some regimes. In contrast to the elegant random rotation solution presented in [38], QSGD employs quantization and Elias coding. Our use case is different from the federated learning application of [24, 38], and has the advantage of being more efficient to compute on a GPU. There is an extremely rich area studying algorithms and systems for efficient distributed large-scale learning, e.g. [1, 3, 6, 10, 11, 21, 32, 39, 43]. Significant interest has recently been dedicated to quantized frameworks, both for inference, e.g., [1, 17] and training [10, 16, 20, 35, 37, 42, 45]. In this context, [35] proposed 1BitSGD, a heuristic for compressing gradients in SGD, inspired by delta-sigma modulation [34]. It is implemented in Microsoft CNTK, and has a cost of n bits and two floats per iteration. Variants of it were shown to perform well on large-scale Amazon datasets by [37]. Compared to 1BitSGD, QSGD can achieve asymptotically higher compression, provably converges under standard assumptions, and shows superior practical performance in some cases. 2 Preliminaries SGD has many variants, with different preconditions and guarantees. Our techniques are rather portable, and can usually be applied in a black-box fashion on top of SGD. For conciseness, we will focus on a basic SGD setup. The following assumptions are standard; see e.g. [7]. Let X ⊆ Rn be a known convex set, and let f : X → R be differentiable, convex, smooth, and unknown. We assume repeated access to stochastic gradients of f , which on (possibly random) input x, outputs a direction which is in expectation the correct direction to move in. Formally: Definition 2.1. Fix f : X → R. A stochastic gradient for f is a random function ge(x) so that E[e g (x)] = ∇f (x). We say the stochastic gradient has second moment at most B if E[ke g k22 ] ≤ B for 2 2 2 all x ∈ X . We say it has variance at most σ if E[ke g (x) − ∇f (x)k2 ] ≤ σ for all x ∈ X . Observe that any stochastic gradient with second moment bound B is automatically also a stochastic gradient with variance bound σ 2 = B, since E[ke g (x) − ∇f (x)k2 ] ≤ E[ke g (x)k2 ] as long as E[e g (x)] = ∇f (x). Second, in convex optimization, one often assumes a second moment bound 3 Data: Local copy of the parameter vector x 1 for each iteration t do 2 Let g eti be an independent stochastic gradient ; i i M ← Encode(e g (x)) //encode gradients ; 3 broadcast M i to all peers; for each peer ` do receive M ` from peer `; 4 5 6 ` ` g b ← Decode(M ) //decode gradients ; 7 8 9 10 end Figure 1: An illustration of generalized stochastic quantization with 5 levels. end P xt+1 ← xt − (ηt /K) K b` ; `=1 g Algorithm 1: Parallel SGD Algorithm. when dealing with non-smooth convex optimization, and a variance bound when dealing with smooth convex optimization. However, for us it will be convenient to consistently assume a second moment bound. This does not seem to be a major distinction in theory or in practice [7]. Given access to stochastic gradients, and a starting point x0 , SGD builds iterates xt given by Equation (1), projected onto X , where (ηt )t≥0 is a sequence of step sizes. In this setting, one can show: Theorem 2.1 ([7], Theorem 6.3). Let X ⊆ Rn be convex, and let f : X → R be unknown, convex, and L-smooth. Let x0 ∈ X be given, and let R2 = supx∈X kx − x0 k2 . Let T > 0 be fixed. Given repeated, independent access to stochastic gradients with variance bound σ 2 for f , SGD with initial q point x0 and constant step sizes ηt = " E f T 1X xt T t=0 1 L+1/γ , where γ = R σ !# r − min f (x) ≤ R x∈X 2 T , achieves LR2 2σ 2 + . T T (2) Minibatched SGD. A modification to the SGD scheme presented above often observed in practice is a technique known as minibatching. In minibatched SGD, updates are of the form xt+1 = e t (xt ) = 1 Pm get,i , and where each get,i is an independent stochastic e t (xt )), where G ΠX (xt − ηt G i=1 m gradient for f at xt . It is not hard to see that if get,i are stochastic gradients with variance bound σ 2 , e t is a stochastic gradient with variance bound σ 2 /m. By inspection of Theorem 2.1, as then the G long as the first term in (2) dominates, minibatched SGD requires 1/m fewer iterations to converge. Data-Parallel SGD. We consider synchronous data-parallel SGD, modelling real-world multi-GPU systems, and focus on the communication cost of SGD in this setting. We have a set of K processors p1 , p2 , . . . , pK who proceed in synchronous steps, and communicate using point-to-point messages. Each processor maintains a local copy of a vector x of dimension n, representing the current estimate of the minimizer, and has access to private, independent stochastic gradients for f . In each synchronous iteration, described in Algorithm 1, each processor aggregates the value of x, then obtains random gradient updates for each component of x, then communicates these updates to all peers, and finally aggregates the received updates and applies them locally. Importantly, we add encoding and decoding steps for the gradients before and after send/receive in lines 3 and 7, respectively. In the following, whenever describing a variant of SGD, we assume the above general pattern, and only specify the encode/decode functions. Notice that the decoding step does not necessarily recover the original gradient ge` ; instead, we usually apply an approximate version. When the encoding and decoding steps are the identity (i.e., no encoding / decoding), we shall refer to this algorithm as parallel SGD. In this case, it is a simple calculation to see that at each processor, if xt was the value of x that the processors held before iteration t, then the updated value of x by the PK end of this iteration is xt+1 = xt − (ηt /K) `=1 ge` (xt ), where each ge` is a stochatic gradient. In particular, this update is merely a minibatched update of size K. Thus, by the discussion above, and by rephrasing Theorem 2.1, we have the following corollary: Corollary 2.2. Let X , f, L, x0 , and R be as in Theorem 2.1. Fix  > 0. Suppose we run parallel SGD on K processors, each with access to independent stochastic gradients with second moment 4 √ bound B, with step size ηt = 1/(L + K/γ), where γ is as in Theorem 2.1. Then if " !#    T 1X 2B L 2 , , then E f xt T = O R · max − min f (x) ≤ . x∈X K2  T t=0 (3) In most reasonable regimes, the first term of the max in (3) will dominate the number of iterations necessary. Specifically, the number of iterations will depend linearly on the second moment bound B. 3 Quantized Stochastic Gradient Descent (QSGD) In this section, we present our main results on stochastically quantized SGD. Throughout, log denotes the base-2 logarithm, and the number of bits to represent a float is 32. For any vector v ∈ Rn , we let kvk0 denote the number of nonzeros of v. For any string ω ∈ {0, 1}∗ , we will let |ω| denote its length. For any scalar x ∈ R, we let sgn (x) ∈ {−1, +1} denote its sign, with sgn (0) = 1. 3.1 Generalized Stochastic Quantization and Coding Stochastic Quantization. We now consider a general, parametrizable lossy-compression scheme for stochastic gradient vectors. The quantization function is denoted with Qs (v), where s ≥ 1 is a tuning parameter, corresponding to the number of quantization levels we implement. Intuitively, we define s uniformly distributed levels between 0 and 1, to which each value is quantized in a way which preserves the value in expectation, and introduces minimal variance. Please see Figure 1. For any v ∈ Rn with v 6= 0, Qs (v) is defined as Qs (vi ) = kvk2 · sgn (vi ) · ξi (v, s) , (4) where ξi (v, s)’s are independent random variables defined as follows. Let 0 ≤ ` < s be an integer such that |vi |/kvk2 ∈ [`/s, (` + 1)/s]. That is, [`/s, (` + 1)/s] is the quantization interval corresponding to |vi |/kvk2 . Then (   |vi | `/s with probability 1 − p kvk , s ; 2 ξi (v, s) = (` + 1)/s otherwise. Here, p(a, s) = as − ` for any a ∈ [0, 1]. If v = 0, then we define Q(v, s) = 0. The distribution of ξi (v, s) has minimal variance over distributions with support {0, 1/s, . . . , 1}, and its expectation satisfies E[ξi (v, s)] = |vi |/kvk2 . Formally, we can show: n Lemma 3.1. For any √ vector v ∈ R , we have that (i) E[Qs (v)] = v (unbiasedness),√(ii) E[kQs (v)− vk22 ] ≤ min(n/s2 , n/s)kvk22 (variance bound), and (iii) E[kQs (v)k0 ] ≤ s(s + n) (sparsity). Efficient Coding of Gradients. Observe that for any vector v, the output of Qs (v) is naturally expressible by a tuple (kvk2 , σ, ζ), where σ is the vector of signs of the vi ’s and ζ is the vector of integer values s · ξi (v, s). The key idea behind the coding scheme is that not all integer values s · ξi (v, s) can be equally likely: in particular, larger integers are less frequent. We will exploit this via a specialized Elias integer encoding [14]. Intuitively, for any positive integer k, its code, denoted Elias(k), starts from the binary representation of k, to which it prepends the length of this representation. It then recursively encodes this prefix. We show that for any positive integer k, the length of the resulting code has |Elias(k)| = log k + log log k + . . . + 1 ≤ (1 + o(1)) log k + 1, and that encoding and decoding can be done efficiently. Given a gradient vector represented as the triple (kvk2 , σ, ζ), with s quantization levels, our coding outputs a string S defined as follows. First, it uses 32 bits to encode kvk2 . It proceeds to encode using Elias recursive coding the position of the first nonzero entry of ζ. It then appends a bit denoting σi and follows that with Elias(s · ξi (v, s)). Iteratively, it proceeds to encode the distance from the current coordinate of ζ to the next nonzero, and encodes the σi and ζi for that coordinate in the same way. The decoding scheme is straightforward: we first read off 32 bits to construct kvk2 , then iteratively use the decoding scheme for Elias recursive coding to read off the positions and values of the nonzeros of ζ and σ. The properties of the quantization and of the encoding imply the following. Theorem 3.2. Let f : Rn → R be fixed, and let x ∈ Rn be arbitrary. Fix s ≥ 2 quantization levels. If ge(x) is a stochastic gradient for f at x with second moment bound B, then Qs (e g (x)) is a 5 stochastic gradient for f at x with variance bound min  √  n n B. s2 , s Moreover, there is an encoding scheme so that in expectation, the number of bits to communicate Qs (e g (x)) is upper bounded by      2 √ 3 2(s + n) √ 3+ s(s + n) + 32. + o(1) log 2 s(s + n) Sparse levels 0, 1, and −1, the gradient density is √ Regime. For the case s = 1, i.e., quantization √ O(√n), while the second-moment blowup is ≤ n. Intuitively, this means√that we will employ O( n log n) bits per iteration, while the convergence time is increased by O( n). √ Dense Regime. The variance blowup is minimized to at most 2 for s = n quantization levels; in this case, we devise a more efficient encoding which yields an order of magnitude shorter codes compared to the full-precision variant. The proof of this statement is not entirely obvious, as it exploits both the statistical properties of the quantization and the guarantees of the Elias coding. Corollary 3.3. Let f, x, and ge(x) be as in Theorem 3.2. There is an encoding scheme for Q√n (e g (x)) which in expectation has length at most 2.8n + 32. 3.2 QSGD Guarantees Putting the bounds on the communication and variance given above with the guarantees for SGD algorithms on smooth, convex functions yield the following results: Theorem 3.4 (Smooth Convex QSGD). Let X , f, L, x0 , and R be as in Theorem 2.1. Fix  > 0. Suppose we run parallel QSGD with s quantization levels on K processors accessing indepen√ dent stochastic gradients with second moment bound B, with stepsize ηt = 1/(L + K/γ), √ where γ is as in Theorem 2.1 with σ = B 0 , where B 0 = min sn2 , sn B. Then if T =   0  h  P i T L 2B O R2 · max K , then E f T1 t=0 xt − minx∈X f (x) ≤ . Moreover, QSGD re2,     2  √ +n) √ quires 3 + 23 + o(1) log 2(s (s2 + n) + 32 bits of communication per round. In the 2 s + n √ special case when s = n, this can be reduced to 2.8n + 32. QSGD is quite portable, and can be applied to almost any stochastic gradient method. For illustration, we can use quantization along with [15] to get communication-efficient non-convex SGD. Theorem 3.5 (QSGD for smooth non-convex optimization). Let f : Rn → R be a L-smooth (possibly nonconvex) function, and let x1 be an arbitrary initial point. Let T > 0 be fixed, and s > 0. Then there is a random stopping time R supported on {1, . . . , N } so that QSGD with quantization level s, constant stepsizes η = O(1/L) and access   √ to stochastic gradients√of f with   L(f (x1 )−f ∗ ) min(n/s2 , n/s)B 1 second moment bound B satisfies L E k∇f (x)k22 ≤ O + . N L Moreover, the communication cost is the same as in Theorem 3.4. 3.3 Quantized Variance-Reduced SGD Assume we are given K processors, and a parameter m > 0, where each processor i P has access to m 1 functions {fim/K , . . . , f(i+1)m/K−1 }. The goal is to approximately minimize f = m i=1 fi . For P P (i+1)m/K−1 K 1 processor i, let hi = m j=im/K fi be the portion of f that it knows, so that f = i=1 hi . A natural question is whether we can apply stochastic quantization to reduce communication for parallel SVRG. Upon inspection, we notice that the resulting update will break standard SVRG. We resolve this technical issue, proving one can quantize SVRG updates using our techniques and still obtain the same convergence bounds. √ e = Q(v, n), where Q(v, s) is defined as in Section 3.1. Given Algorithm Description. Let Q(v) arbitrary starting point x0 , we let y (1) = x0 . At the beginning of epoch p, each processor broadcasts ∇hi (y (p) P),mthat is, the unquantized full gradient, from which the processors each aggregate ∇f (y (p) ) = i=1 ∇hi (y (p) ). Within each epoch, for each iteration t = 1, . . . , T , and for each (p) processor i = 1, . . . , K, we let ji,t be a uniformly random integer from [m] completely independent from everything else. Then, in iteration t in epochp, processor i broadcasts the update vector  (p) (p) e ut,i = Q ∇fj (p) (xt ) − ∇fj (p) (y (p) ) + ∇f (y (p) ) . i,t i,t 6 Table 1: Description of networks, final top-1 accuracy, as well as end-to-end training speedup on 8GPUs. Network AlexNet ResNet152 ResNet50 ResNet110 BN-Inception VGG19 LSTM Dataset ImageNet ImageNet ImageNet CIFAR-10 ImageNet ImageNet AN4 Params. 62M 60M 25M 1M 11M 143M 13M Init. Rate 0.07 1 1 0.1 3.6 0.1 0.5 Top-1 (32bit) 59.50% 77.0% 74.68% 93.86% 81.13% Top-1 (QSGD) 60.05% (4bit) 76.74% (8bit) 74.76% (4bit) 94.19% (4bit) 81.15 % (4bit) Speedup (8 GPUs) 2.05 × 1.56 × 1.26 × 1.10 × 1.16× (projected) 2.25× (projected) 2× (2 GPUs) PK (p) (p) (p) (p) 1 Each processor then computes the total update ut = K i=1 ut,i , and sets xt+1 = xt − ηut . P (p) T At the end of epoch p, each processor sets y (p+1) = T1 t=1 xt . We can prove the following. P m 1 Theorem 3.6. Let f (x) = m i=1 fi (x), where f is `-strongly convex, and fi are convex and ∗ L-smooth, for all i. Let x be the unique minimizer of f over Rn . Then, if η = O(1/L) and T = O(L/`), then QSVRG with initial point y (1) ensures E f (y (p+1) ) − f (x∗ ) ≤  0.9p f (y (1) ) − f (x∗ ) , for any epoch p ≥ 1. Moreover, QSVRG with T iterations per epoch requires ≤ (F + 2.8n)(T + 1) + F n bits of communication per epoch. Discussion. In particular, this allows us to largely decouple the dependence between F and the condition number of f in the communication. Let κ = L/` denote the condition number of f . Observe that whenever F  κ, the second term is subsumed by the first and the per epoch communication is dominated by (F + 2.8n)(T + 1). Specifically, for any fixed , to attain accuracy  we must take F = O(log 1/). As long as log 1/ ≥ Ω(κ), which is true for instance in the case when κ ≥ poly log(n) and  ≥ poly(1/n), then the communication per epoch is O(κ(log 1/ + n)). Gradient Descent. The full version of the paper [4] contains an application of QSGD to gradient descent. Roughly, in this case, QSGD can simply truncate the gradient to its top components, sorted by magnitude. 4 QSGD Variants Our experiments will stretch the theory, as we use deep networks, with non-convex objectives. (We have also tested QSGD for convex objectives. Results closely follow the theory, and are therefore omitted.) Our implementations will depart from the previous algorithm description as follows. First, we notice that the we can control the variance the quantization by quantizing into buckets of a fixed size d. If we view each gradient as a one-dimensional vector v, reshaping tensors if necessary, a bucket will be defined as a set of d consecutive vector values. (E.g. the ith bucket is the sub-vector v[(i − 1)d + 1 : i · d].) We will quantize each bucket independently, using QSGD. Setting d = 1 corresponds to no quantization (vanilla SGD), and d = n corresponds to full quantization, as described in the previous section. It is easy to see that, using bucketing, the guarantees from Lemma 3.1 will be expressed in terms of d, as opposed to the full dimension n. This provides a knob by which we can control variance, at the cost of storing an extra scaling factor on every d bucket values. As an example, if we use a bucket √ size of 512, and 4 bits, the variance increase due to quantization will be upper bounded by only 512/24 ' 1.41. This provides a theoretical justification for the similar convergence rates we observe in practice. The second difference from the theory is that we will scale by the maximum value of the vector (as opposed to the 2-norm). Intuitively, normalizing by the max preserves more values, and has slightly higher accuracy for the same number of iterations. Both methods have the same baseline bandwidth reduction because of lower bit width (e.g. 32 bits to 2 bits per dimension), but normalizing by the max no longer provides any √ sparsity guarantees. We note that this does not affect our bounds in the regime where we use Θ( n) quantization levels per component, as we employ no sparsity in that case. (However, we note that in practice max normalization also generates non-trivial sparsity.) 5 Experiments Setup. We performed experiments on Amazon EC2 p2.16xlarge instances, with 16 NVIDIA K80 GPUs. Instances have GPUDirect peer-to-peer communication, but do not currently support NVIDIA 7 2.3x 1.6x 3.5x Figure 2: Breakdown of communication versus computation for various neural networks, on 2, 4, 8, 16 GPUs, 2.0 1.5 Training loss > 2x faster 2bit QSGD (d=128) 4bit QSGD (d=8192) 8bit QSGD (d=8192) SGD 1.0 0.5 0.00 (a) AlexNet Accuracy versus Time. 300 600 900 Time (sec) 1200 (b) LSTM error vs Time. 1500 Test accuracy (%) for full 32-bit precision versus QSGD 4-bit. Each bar represents the total time for an epoch under standard parameters. Epoch time is broken down into communication (bottom, solid) and computation (top, transparent). Although epoch time diminishes as we parallelize, the proportion of communication increases. 80 70 60 50 40 30 20 10 00 1bitSGD* 32bit QSGD 4bit QSGD 8bit 20 40 60 Epoch 80 100 120 (c) ResNet50 Accuracy. Figure 3: Accuracy numbers for different networks. Light blue lines represent 32-bit accuracy. NCCL extensions. We have implemented QSGD on GPUs using the Microsoft Cognitive Toolkit (CNTK) [3]. This package provides efficient (MPI-based) GPU-to-GPU communication, and implements an optimized version of 1bit-SGD [35]. Our code is released as open-source [31]. We execute two types of tasks: image classification on ILSVRC 2015 (ImageNet) [12], CIFAR10 [25], and MNIST [27], and speech recognition on the CMU AN4 dataset [2]. For vision, we experimented with AlexNet [26], VGG [36], ResNet [18], and Inception with Batch Normalization [22] deep networks. For speech, we trained an LSTM network [19]. See Table 1 for details. Protocol. Our methodology emphasizes zero error tolerance, in the sense that we always aim to preserve the accuracy of the networks trained. We used standard sizes for the networks, with hyperparameters optimized for the 32bit precision variant. (Unless otherwise stated, we use the default networks and hyper-parameters optimized for full-precision CNTK 2.0.) We increased batch size when necessary to balance communication and computation for larger GPU counts, but never past the point where we lose accuracy. We employed double buffering [35] to perform communication and quantization concurrently with the computation. Quantization usually benefits from lowering learning rates; yet, we always run the 32bit learning rate, and decrease bucket size to reduce variance. We will not quantize small gradient matrices (< 10K elements), since the computational cost of quantizing them significantly exceeds the reduction in communication. However, in all experiments, more than 99% of all parameters are transmitted in quantized form. We reshape matrices to fit bucket sizes, so that no receptive field is split across two buckets. Communication vs. Computation. In the first set of experiments, we examine the ratio between computation and communication costs during training, for increased parallelism. The image classification networks are trained on ImageNet, while LSTM is trained on AN4. We examine the cost breakdown for these networks over a pass over the dataset (epoch). Figure 2 gives the results for various networks for image classification. The variance of epoch times is practically negligible (<1%), hence we omit confidence intervals. Figure 2 leads to some interesting observations. First, based on the ratio of communication to computation, we can roughly split networks into communication-intensive (AlexNet, VGG, LSTM), and computation-intensive (Inception, ResNet). For both network types, the relative impact of communication increases significantly as we increase the number of GPUs. Examining the breakdown for the 32-bit version, all networks could significantly benefit from reduced communication. For 8 example, for AlexNet on 16 GPUs with batch size 1024, more than 80% of training time is spent on communication, whereas for LSTM on 2 GPUs with batch size 256, the ratio is 71%. (These ratios can be slightly changed by increasing batch size, but this can decrease accuracy, see e.g. [21].) Next, we examine the impact of QSGD on communication and overall training time. (Communication time includes time spent compressing and uncompressing gradients.) We measured QSGD with 2-bit quantization and 128 bucket size, and 4-bit and 8-bit quantization with 512 bucket size. The results for these two variants are similar, since the different bucket sizes mean that the 4bit version only sends 77% more data than the 2-bit version (but ∼ 8× less than 32-bit). These bucket sizes are chosen to ensure good convergence, but are not carefully tuned. On 16GPU AlexNet with batch size 1024, 4-bit QSGD reduces communication time by 4×, and overall epoch time by 2.5×. On LSTM, it reduces communication time by 6.8×, and overall epoch time by 2.7×. Runtime improvements are non-trivial for all architectures we considered. Accuracy. We now examine how QSGD influences accuracy and convergence rate. We ran AlexNet and ResNet to full convergence on ImageNet, LSTM on AN4, ResNet110 on CIFAR-10, as well as a two-layer perceptron on MNIST. Results are given in Figure 5, and exact numbers are given in Table 1. QSGD tests are performed on an 8GPU setup, and are compared against the best known full-precision accuracy of the networks. In general, we notice that 4bit or 8bit gradient quantization is sufficient to recover or even slightly improve full accuracy, while ensuring non-trivial speedup. Across all our experiments, 8-bit gradients with 512 bucket size have been sufficient to recover or improve upon the full-precision accuracy. Our results are consistent with recent work [30] noting benefits of adding noise to gradients when training deep networks. Thus, quantization can be seen as a source of zero-mean noise, which happens to render communication more efficient. At the same time, we note that more aggressive quantization can hurt accuracy. In particular, 4-bit QSGD with 8192 bucket size (not shown) loses 0.57% for top-5 accuracy, and 0.68% for top-1, versus full precision on AlexNet when trained for the same number of epochs. Also, QSGD with 2-bit and 64 bucket size has gap 1.73% for top-1, and 1.18% for top-1. One issue we examined in more detail is which layers are more sensitive to quantization. It appears that quantizing convolutional layers too aggressively (e.g., 2-bit precision) can lead to accuracy loss if trained for the same period of time as the full precision variant. However, increasing precision to 4-bit or 8-bit recovers accuracy. This finding suggests that modern architectures for vision tasks, such as ResNet or Inception, which are almost entirely convolutional, may benefit less from quantization than recurrent deep networks such as LSTMs. Additional Experiments. The full version of the paper contains additional experiments, including a full comparison with 1BitSGD. In brief, QSGD outperforms or matches the performance and final accuracy of 1BitSGD for the networks and parameter values we consider. 6 Conclusions and Future Work We have presented QSGD, a family of SGD algorithms which allow a smooth trade off between the amount of communication per iteration and the running time. Experiments suggest that QSGD is highly competitive with the full-precision variant on a variety of tasks. There are a number of optimizations we did not explore. The most significant is leveraging the sparsity created by QSGD. Current implementations of MPI do not provide support for sparse types, but we plan to explore such support in future work. Further, we plan to examine the potential of QSGD in larger-scale applications, such as super-computing. On the theoretical side, it is interesting to consider applications of quantization beyond SGD. The full version of this paper [4] contains complete proofs, as well as additional applications. 7 Acknowledgments The authors would like to thank Martin Jaggi, Ce Zhang, Frank Seide and the CNTK team for their support during the development of this project, as well as the anonymous NIPS reviewers for their careful consideration and excellent suggestions. Dan Alistarh was supported by a Swiss National Fund Ambizione Fellowship. Jerry Li was supported by the NSF CAREER Award CCF-1453261, CCF-1565235, a Google Faculty Research Award, and an NSF Graduate Research Fellowship. This work was developed in part while Dan Alistarh, Jerri Li and Milan Vojnovic were with Microsoft Research Cambridge, UK. 9 References [1] Martın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv preprint arXiv:1603.04467, 2016. [2] Alex Acero. Acoustical and environmental robustness in automatic speech recognition, volume 201. Springer Science & Business Media, 2012. [3] Amit Agarwal, Eldar Akchurin, Chris Basoglu, Guoguo Chen, Scott Cyphers, Jasha Droppo, Adam Eversole, Brian Guenter, Mark Hillebrand, Ryan Hoens, et al. An introduction to computational networks and the computational network toolkit. Technical report, Tech. Rep. MSR-TR-2014-112, August 2014., 2014. [4] Dan Alistarh, Demjan Grubic, Jerry Li, Ryota Tomioka, and Milan Vojnovic. QSGD: Communication-efficient SGD via gradient quantization and encoding. arXiv preprint arXiv:1610.02132, 2016. [5] Yossi Arjevani and Ohad Shamir. Communication complexity of distributed convex learning and optimization. In NIPS, 2015. [6] Ron Bekkerman, Mikhail Bilenko, and John Langford. Scaling up machine learning: Parallel and distributed approaches. Cambridge University Press, 2011. [7] Sébastien Bubeck. Convex optimization: Algorithms and complexity. Foundations and Trends R in Machine Learning, 8(3-4):231–357, 2015. [8] Trishul Chilimbi, Yutaka Suzue, Johnson Apacible, and Karthik Kalyanaraman. Project adam: Building an efficient and scalable deep learning training system. In OSDI, October 2014. [9] Cntk brainscript file for alexnet. https://github.com/Microsoft/CNTK/tree/master/ Examples/Image/Classification/AlexNet/BrainScript. Accessed: 2017-02-24. [10] Christopher M De Sa, Ce Zhang, Kunle Olukotun, and Christopher Ré. Taming the wild: A unified analysis of hogwild-style algorithms. In NIPS, 2015. [11] Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Andrew Senior, Paul Tucker, Ke Yang, Quoc V Le, et al. Large scale distributed deep networks. In NIPS, 2012. [12] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pages 248–255. IEEE, 2009. [13] John C Duchi, Sorathan Chaturapruek, and Christopher Ré. Asynchronous stochastic convex optimization. NIPS, 2015. [14] Peter Elias. Universal codeword sets and representations of the integers. IEEE transactions on information theory, 21(2):194–203, 1975. [15] Saeed Ghadimi and Guanghui Lan. Stochastic first- and zeroth-order methods for nonconvex stochastic programming. SIAM Journal on Optimization, 23(4):2341–2368, 2013. [16] Suyog Gupta, Ankur Agrawal, Kailash Gopalakrishnan, and Pritish Narayanan. Deep learning with limited numerical precision. In ICML, pages 1737–1746, 2015. [17] Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015. [18] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 770–778, 2016. [19] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997. [20] Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks. In Advances in Neural Information Processing Systems, pages 4107–4115, 2016. 10 [21] Forrest N Iandola, Matthew W Moskewicz, Khalid Ashraf, and Kurt Keutzer. Firecaffe: nearlinear acceleration of deep neural network training on compute clusters. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2592–2600, 2016. [22] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015. [23] Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In NIPS, 2013. [24] Jakub Konečnỳ. Stochastic, distributed and federated optimization for machine learning. arXiv preprint arXiv:1707.01155, 2017. [25] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images, 2009. [26] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages 1097–1105, 2012. [27] Yann LeCun, Corinna Cortes, and Christopher JC Burges. The mnist database of handwritten digits, 1998. [28] Mu Li, David G Andersen, Jun Woo Park, Alexander J Smola, Amr Ahmed, Vanja Josifovski, James Long, Eugene J Shekita, and Bor-Yiing Su. Scaling distributed machine learning with the parameter server. In OSDI, 2014. [29] Xiangru Lian, Yijun Huang, Yuncheng Li, and Ji Liu. Asynchronous parallel stochastic gradient for nonconvex optimization. In NIPS. 2015. [30] Arvind Neelakantan, Luke Vilnis, Quoc V Le, Ilya Sutskever, Lukasz Kaiser, Karol Kurach, and James Martens. Adding gradient noise improves learning for very deep networks. arXiv preprint arXiv:1511.06807, 2015. [31] Cntk implementation of qsgd. https://gitlab.com/demjangrubic/QSGD. Accessed: 201711-4. [32] Benjamin Recht, Christopher Re, Stephen Wright, and Feng Niu. Hogwild: A lock-free approach to parallelizing stochastic gradient descent. In NIPS, 2011. [33] Herbert Robbins and Sutton Monro. A stochastic approximation method. The Annals of Mathematical Statistics, pages 400–407, 1951. [34] Richard Schreier and Gabor C Temes. Understanding delta-sigma data converters, volume 74. IEEE Press, Piscataway, NJ, 2005. [35] Frank Seide, Hao Fu, Jasha Droppo, Gang Li, and Dong Yu. 1-bit stochastic gradient descent and its application to data-parallel distributed training of speech dnns. In INTERSPEECH, 2014. [36] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. [37] Nikko Strom. Scalable distributed DNN training using commodity GPU cloud computing. In INTERSPEECH, 2015. [38] Ananda Theertha Suresh, Felix X Yu, H Brendan McMahan, and Sanjiv Kumar. Distributed mean estimation with limited communication. arXiv preprint arXiv:1611.00429, 2016. [39] Seiya Tokui, Kenta Oono, Shohei Hido, CA San Mateo, and Justin Clayton. Chainer: a nextgeneration open source framework for deep learning. In Proceedings of workshop on machine learning systems (LearningSys), 2015. [40] John N Tsitsiklis and Zhi-Quan Luo. Communication complexity of convex optimization. Journal of Complexity, 3(3), 1987. [41] Wei Wen, Cong Xu, Feng Yan, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Terngrad: Ternary gradients to reduce communication in distributed deep learning. arXiv preprint arXiv:1705.07878, 2017. [42] Hantian Zhang, Jerry Li, Kaan Kara, Dan Alistarh, Ji Liu, and Ce Zhang. Zipml: Training linear models with end-to-end low precision, and a little bit of deep learning. In International Conference on Machine Learning, pages 4035–4043, 2017. 11 [43] Sixin Zhang, Anna E Choromanska, and Yann LeCun. Deep learning with elastic averaging sgd. In Advances in Neural Information Processing Systems, pages 685–693, 2015. [44] Yuchen Zhang, John Duchi, Michael I Jordan, and Martin J Wainwright. Information-theoretic lower bounds for distributed statistical estimation with communication constraints. In NIPS, 2013. [45] Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv preprint arXiv:1606.06160, 2016. Roadmap of the Appendix A Proof of Lemmas and Theorems A.1 Proof of Lemma 3.1 The first claim obviously holds. We thus turn our attention to the second claim of the lemma. We first note the following bound: h i 2 E[ξi (v, s)2 ] = E[ξi (v, s)]2 + E (ξi (v, s) − E[ξi (v, s)])     1 |vi | v2 |vi | = i 2 + 2p ,s 1−p ,s kvk2 s kvk2 kvk2   2 v 1 |vi | ≤ i 2 + 2p ,s . kvk2 s kvk2 Using this bound, we have " 2 # |vi | E[kQ(v, s)k ] = E ,s kvk2 i=1   n  X |vi | |vi |2 1 p , s + ≤ kvk22 kvk22 s2 kvk2 i=1 !   n 1 X |vi | = 1+ 2 p ,s kvk22 s i=1 kvk2    a n kvk1 ≤ 1 + min 2 , kvk22 s skvk2   √  n n ≤ 1 + min 2 , kvk22 . s s 2 n X kvk22 ξi  where (a) follows from thefact that p(a, s) ≤ 1 and p(a, s) ≤ as. This immediately implies that E[kQ(v, s) − vk22 ] ≤ min A.2 √ n n s2 , s · kvk22 , as claimed. A Compression Scheme for Qs Matching Theorem 3.2 In this section, we describe a scheme for coding Qs and provide an upper bound for the expected number of information bits that it uses, which gives the bound in Theorem 3.2. Observe that for any vector v, the output of Q(v, s) is naturally expressible by a tuple (kvk2 , σ, ζ), where σ is the vector of signs of the vi ’s and ζ is the vector of ξi (v, s) values. With a slight abuse of notation, let us consider Q(v, s) as a function from R \ {0} to Bs , where Bs = {(A, σ, z) ∈ R × Rn × Rn : A ∈ R≥0 , σi ∈ {−1, +1}, zi ∈ {0, 1/s, . . . , 1}} . 12 We define a coding scheme that represents each tuple in Bs with a codeword in {0, 1}∗ according to a mapping Codes : Bs → {0, 1}∗ . To encode a single coordinate, we utilize a lossless encoding scheme for positive integers known as recursive Elias coding or Elias omega coding. Definition A.1. Let k be a positive integer. The recursive Elias coding of k, denoted Elias(k), is defined to be the {0, 1} string constructed as follows. First, place a 0 at the end of the string. If k = 0, then terminate. Otherwise, prepend the binary representation of k to the beginning of the code. Let k 0 be the number of bits so prepended minus 1, and recursively encode k 0 in the same fashion. To decode an recursive Elias coded integer, start with N = 1. Recursively, if the next bit is 0, stop, and output N . Otherwise, if the next bit is 1, then read that bit and N additional bits, and let that number in binary be the new N , and repeat. The following are well-known properties of the recursive Elias code which are not too hard to prove. Lemma A.1. For any positive integer k, we have 1. |Elias(k)| ≤ log k + log log k + log log log k . . . + 1 = (1 + o(1)) log k + 1. 2. The recursive Elias code of k can be encoded and decoded in time O(|Elias(k)|). 3. Moreover, the decoding can be done without previously knowing a bound on the size of k. Given a tuple (A, σ, z) ∈ Bs , our coding outputs a string S defined as follows. First, it uses F bits to encode A. It proceeds to encode using Elias recursive coding the position of the first nonzero entry of z. It then appends a bit denoting σi and follows that with Elias(szi ). Iteratively, it proceeds to encode the distance from the current coordinate of z to the next nonzero using c, and encodes the σi and zi for that coordinate in the same way. The decoding scheme is also straightforward: we first read off F bits to construct A, then iteratively use the decoding scheme for Elias recursive coding to read off the positions and values of the nonzeros of z and σ. We can now present a full description of our lossy-compression scheme. For any input vector v, we first compute quantization Q(v, s), and then encode using Codes . In our notation, this is expressed as v → Codes (Q(v, s)). √ Lemma A.2. For any v ∈ Rn and s2 + n ≤ n/2, we have   2  √ 3 2(s + n) √ E[|Codes (Q(v, s))|] ≤ 3 + · (1 + o(1)) log (s2 + n) . 2 2 s + n This lemma together with Lemma 3.1 suffices to prove Theorem 3.2. We first show a technical lemma about the behavior of the coordinate-wise coding function c on a vector with bounded `p norm. Lemma A.3. Let q ∈ Rd be a vector so that for all i, we have that qi is a positive integer, and moreover, kqkpp ≤ ρ. Then   d ρ X 1 + o(1) |Elias(qi )| ≤ log +1 n. p n i=1 Proof. Recall that for any positive integer k, the length of Elias(k) is at most (1 + o(1)) log k + 1. Hence, we have d d X X |Elias(qi )| ≤ (1 + o(1)) (log qi ) + d i=1 i=1 n 1 + o(1) X ≤ (log(qip )) + d p i=1 ! n (a) 1 + o(1) 1X p ≤ n log q + +d p n i=1 i ρ 1 + o(1) ≤ n log +n p n 13 where (a) follows from Jensen’s inequality. We can bound the number of information bits needed for our coding scheme in terms of the number of non-zeroes of our vector. Lemma A.4. For any tuple (A, σ, z) ∈ Bs , the string Codes (A, σ, z) has length of at most this many bits:     2  n 1 + o(1) s kzk22 F + (1 + o(1)) · log + log +3 · kzk0 . kzk0 2 kzk0 Proof. First, the float A takes F bits to communicate. Let us now consider the rest of the string. We break up the string into a couple of parts. First, there is the subsequence S1 dedicated to pointing to the next nonzero coordinate of z. Second, there is the subsequence S2 dedicated to communicating the sign and c(zi ) for each nonzero coordinate i. While these two sets of bits are not consecutive within the string, it is clear that they partition the remaining bits in the string. We bound the length of these two substrings separately. We first bound the length of S1 . Let i1 , . . . , ikzk0 be the nonzero coordinates of z. Then, from the definition of Codes , it is not hard to see that S1 consists of the encoding of the vector q (1) = (i1 , i2 − i1 , . . . , ikzk0 − ikzk0 −1 ) , where each coordinate of this vector is encoded using c. By Lemma A.3, since this vector has length kzk0 and has `1 norm at most n, we have that   n |S1 | ≤ (1 + o(1)) log + 1 kzk0 . (5) kzk0 We now bound the length of S2 . Per non-zero coordinate of z, we need to communicate a sign (which takes one bit), and c(szi ). Thus by Lemma A.3, we have that kzk0 |S2 | = X (1 + |Elias(szi )|) j=1  ≤ kzk0 +  (1 + o(1)) s2 kzk22 log + 1 kzk0 . 2 kzk0 (6) Putting together (5) and (6) yields the desired conclusion. We first need the following technical lemma about the number of nonzeros of Q(v, s) that we have in expectation. Lemma A.5. Let v ∈ Rn such that kvk2 6= 0. Then E[kQ(v, s)k0 ] ≤ s2 + √ n. Proof. Let u = v/kvk2 . Let I(u) denote the set of coordinates i of u so that ui ≤ 1/s. Since X 1≥ u2i ≥ (n − |I(u)|)/s2 , i6∈I(u) we must have that s2 ≥ n − |I(u)|. Moreover, for each i ∈ I(u), we have that Qi (v, s) is nonzero with probability ui , and zero otherwise. Hence X √ E[L(v)] ≤ n − |I(u)| + ui ≤ s2 + kuk1 ≤ s2 + n . i∈I(u) 14 Proof of Lemma A.2 Let Q(v, s) = (kvk2 , σ, ζ), and let u = v/kvk2 . Observe that we always have that 2 (a) X n  n n  X X 1 n 1 kζk22 ≤ ui + = 2 1 + , (7) ≤ 2 u2i + 2 s s2 s2 i=1 i=1 i=1 where (a) follows since (a + b)2 ≤ 2(a2 + b2 ) for all a, b ∈ R. By Lemma A.4, we now have that    n E[|Codes (Q(v, s)|] ≤F + (1 + o(1)) E kζk0 log kζk0   2  1 + o(1) s R(ζ) + E kζk0 log + 3 E[kζk0 ] 2 kζk0    n ≤F + (1 + o(1)) E kζk0 log + kζk0 !# "  √  2 s2 + n 1 + o(1) + 3 s2 + n , E kζk0 log 2 kζk0 by (7) and Lemma A.5.  It is a straightforward verification that the function f (x) = x log Cx is concave for all C > 0. Moreover, it is increasing up until x = C/2,√ and decreasing afterwards. Hence, by Jensen’s inequality, Lemma A.5, and the assumption that s2 + n ≤ n/2, we have that      √ n n √ E kζk0 log , and ≤ (s2 + n) log kζk0 s2 + n "  !#  2  √ 2 s2 + n 2(s + n) √ E kζk0 log . ≤ (s2 + n) log kζk0 s2 + n Simplifying yields the expression in the Lemma. A.3 A Compression Scheme for Qs Matching Theorem 3.3 For the case of the quantized SGD scheme that requires Θ(n) bits per iteration, we can improve the constant factor in the bit length bound in√Theorem A.2 by using a different encoding of Q(v, s). This corresponds to the regime where s = n, i.e., where the quantized update is not expected to be sparse. In this case, there is no advantage gained by transmitting the location of the next nonzero, since generally that will simply be the next coordinate of the vector. Therefore, we may as well simply transmit the value of each coordinate in sequence. Motivated by the above remark, we define the following alternative compression function. Define Elias0 (k) = Elias(k + 1) to be a compression function on all nonnegative natural numbers. It is easy to see that this is uniquely decodable. Let Code0s be the compression function which, on input (A, σ, z), simply encodes every coordinate of z in the same way as before, even if it is zero, using Elias0 . It is straightforward to show that this compression function is still uniquely decodable. Then, just as before, our full quantization scheme is as follows. For any arbitrary vector v, we first compute Q(v, s), and then encode using Code0s . In our notation, this is expressed as v → Code0s (Q(v, s)). For this compression scheme, we show: Lemma A.6. For any v ∈ Rn , we have      √  1 + o(1) s2 + min(n, s n) 0 E[|Codes (Q(v, s))|] ≤ F + log 1 + +1 +2 n. 2 n √ In particular, if s = n, then E[|Code0s (Q(v, s))|] ≤ F + 2.8n. It is not hard to see that this is equivalent to the bound stated in Theorem 3.3. We start by showing the following lemma. 15 Lemma A.7. For any tuple (A, σ, z) ∈ Bs , the string Code0s (A, σ, z) has length of at most this many bits:       1 + o(1) s2 kzk22 F+ log 1 + + 1 + 2 n. 2 n Proof. The proof of this lemma follows by similar arguments as that of Lemma A.4. The main differences are that (1) we do not need to encode the position of the nonzeros, and (2) we always encode Elias(k + 1) instead of Elias(k). Hence, for coordinate i, we require 1 + Elias(szi + 1) bits, since in addition to encoding zi we must also encode the sign. Thus the total number of bits may be bounded by F+ n X (Elias(zi + 1) + 1) = F + n + i=1 ≤F +n+ n X i=1 n X Elias(szi + 1) [(1 + o(1)) log(szi + 1) + 1] i=1 ≤ F + 2n + (1 + o(1)) ≤ F + 2n + (a) ≤ F + 2n + 1 + o(1) 2 1 + o(1) 2 n X log(szi + 1) i=1 n X log((szi + 1)2 ) i=1 n X (log(1 + s2 zi2 ) + log (2)) i=1 n (b) 1 + o(1) 1X 2 2 ≤ F + 2n + n log 1 + s zi 2 n i=1 ! ! +1 where (a) follows from basic properties of logarithms and (b) follows from the concavity of the function x 7→ log(1 + x) and Jensen’s inequality. Simplifying yields the desired statement. Proof of Lemma A.6 As in the proof of Lemma A.2, let Q(v, s) = (kvk2 , σ, ζ), and let u = v/kvk2 . By Lemma A.7, we have        1 + o(1) s2 R(ζ) 0 E[|Codes (Q(v, s)|] ≤ F + E log 1 + +1 +2 n 2 n ! ! !   (a) E s2 R(ζ) 1 + o(1) log 1 + +1 +2 n ≤ F+ 2 n       √ (b) 1 + o(1) s2 (1 + min(n/s2 , n/s) log 1 + +1 +2 n ≤F+ 2 n where (a) follows from Jensen’s inequality, and (b) follows from the proof of Lemma 3.1. B Quantized SVRG Variance Reduction for Sums of Smooth Functions. One common setting in which SGD sees application in machine learning is when Pfmcan be naturally expressed as a sum of smooth functions. 1 Formally, we assume that f (x) = m i=1 fi (x). When f can be expressed as a sum of smooth functions, this lends itself naturally to SGD. This is because a natural stochastic gradient for f in this setting is, on input x, to sample a uniformly random index i, and output ∇fi (x). We will also impose somewhat stronger assumptions on f and f1 , f2 , . . . , fm , namely, that f is strongly convex, and that each fi is convex and smooth. 16 Definition B.1 (Strong Convexity). Let f : Rn → R be a differentiable function. We say that f is `-strongly convex if for all x, y ∈ Rn , we have ` f (x) − f (y) ≤ ∇f (x)T (x − y) − kx − yk22 . 2 Observe that when ` = 0 this is the standard definition of convexity. Note that it is well-known that even if we impose these stronger assumptions on f and f1 , f2 , . . . , fm , then by only applying SGD one still cannot achieve exponential convergence rates, i.e. error rates which improve as exp(−T ) at iteration T . (Such a rate is known in the optimization literature as linear convergence.) However, an epoch-based modification of SGD, known as stochastic variance reduced gradient descent (SVRG) [23], is able to give such rates in this specific setting. We describe the method below, following the presentation of Bubeck [7]. (p) Background on SVRG. Let y (1) ∈ Rn be an arbitrary point. For p = 1, 2, . . . , P , we let x1 = (p) y (p) . Each p is called an epoch. Then, within epoch p, for t = 1, . . . , T , we let it be a uniformly random integer from [m] completely independent from everything else, and we set:   (p) (p) (p) xt+1 = xt − η ∇fi(p) (xt ) − ∇fi(p) (y (p) ) + ∇f (y (p) ) . t t We then set y (p+1) k 1 X (p) = x . k i=1 t With this iterative scheme, we have the following guarantee: Pm 1 Theorem B.1 ([23]). Let f (x) = m i=1 fi (x), where f is `-strongly convex, and fi are convex ∗ and L-smooth, for all i. Let x be the unique minimizer of f over Rn . Then, if η = O(1/L) and T = O(L/`), we have h i   E f (y (p+1) ) − f (x∗ ) ≤ 0.9p f (y (1) ) − f (x∗ ) . (8) Quantized SVRG. In parallel SVRG, we are given K processors, each processor i having access to fim/K , . . . , f(i+1)m/K−1 . The goal is the same as before: to approximately minimize f = Pm P(i+1)m/K−1 1 1 fi be the portion of f that it knows, so that i=1 fi . For processor i, let hi = m j=im/K m PK f = i=1 hi . A natural question is whether we can apply randomized quantization to reduce communication for parallel SVRG. Whenever one applies our quantization functions to the gradient updates in SVRG, the resulting update is no longer an update of the form used in SVRG, and hence the analysis for SVRG does not immediately give any results in black-box fashion. Instead, we prove that despite this technical issue, one can quantize SVRG updates using our techniques and still obtain the same convergence bounds. √ e Let Q(v) = Q(v, n), where Q(v, s) is defined as in Section 3.1. Our quantized SVRG updates are as follows. Given arbitrary starting point x0 , we let y (1) = x0 . At the beginning of epoch p, each processor broadcasts   (i+1)m/K−1 X 1 e e (∇hi ) , Hp,i = Q ∇fi (y (p) ) = Q m j=im/K Pm from which the processors collectively form Hp = i=1 Hp,i without additional communication. (p) Within each epoch, for each iteration t = 1, . . . , T , and for each processor i = 1, . . . , K, we let ji,t be a uniformly random integer from [m] completely independent from everything else. Then, in iteration t in epoch p, processor i broadcasts the update vector   (p) (p) e ∇f (p) (x(p) ut,i = Q ) − ∇f (y ) + H . (p) p t j j i,t i,t 17 (p) Each processor then computes the total update for that iteration ut = (p) (p) (p) xt+1 = xt − ηut . At the end of epoch p, each processor sets y (p+1) = PK 1 ut,i , K PTi=1 (p) 1 t=1 xt . T and sets Our main theorem is that this algorithm still converges, and is communication efficient: Pm 1 Theorem B.2. Let f (x) = m i=1 fi (x), where f is `-strongly convex, and fi are convex and L-smooth, for all i. Let x∗ be the unique minimizer of f over Rn . Then, if η = O(1/L) and T = O(L/`), then QSVRG with initial point y (1) ensures h i   E f (y (p+1) ) − f (x∗ ) ≤ 0.9p f (y (1) ) − f (x∗ ) . (9) Moreover, QSVRG with P epochs and T iterations per epoch requires ≤ P (F + 2.8n)(T + 1) bits of communication per processor. In particular, observe that when L/` is a constant, this implies that for all epochs p, we may communicate O(pn) bits and get an error rate of the form (14). Up to constant factors, this matches the lower bound given in [40]. Proof of Theorem G.2. By Theorem A.6, each processor transmits at most F + 2.8n bits per iteration, and then an additional F + 2.8n bits per epoch to communicate the Hp,i . Thus the claimed communication bound follows trivially. We now turn our attention to correctness. As with the case of quantized SGD, it is not hard to see that the parallel updates are equivalent to minibatched updates, and serve only to decrease the variance of the random gradient estimate. Hence, as before, for simplicity of presentation, we will consider the effect of quantization on convergence rates on a single processor. In this case, the updates can be written down somewhat more simply. Namely, in iteration t of epoch p, we have that (p) (p) xt+1 = xt (p) where jt (p) et − ηQ  (p) e (p) (∇f (y)) ∇fj (p) (xt ) − ∇fj (p) (y (p) ) + Q t  , t e (p) e (p) are all different, independent instances of Q. e is a random index of [m], and Q t and Q We follow the presentation in [7]. Fix an epoch p ≥ 1, and let E denote the expectation taken with respect to the randomness within that epoch. We will show that " # T h  i   1 X (p) (p+1) ∗ − f (x∗ ) ≤ 0.9p f (y (1) ) − f (x∗ ) . E f y − f (x ) = E xt T t=1 This clearly suffices to show the theorem. Because we only deal with a fixed epoch, for simplicity of notation, on p in the notation. For t = 1, . . . , T , let  we shall proceed to drop the dependence  (p) e e vt = Qt ∇fjt (xt ) − ∇fjt (y) − Q (∇f (y)) be the update in iteration t. It suffices to show the following two equations: Ejt ,Qet ,Qe [vt ] = ∇f (xt ) , and   Ejt ,Qet ,Qe kvt k2 ≤ C · L (f (xt ) − f (x∗ ) + f (y) − f (x∗ )) , 18 where C is some universal constant. That the first equation is true follows from the unbiasedness of e We now show the second. We have: Q.     Ejt ,Qet ,Qe kvt k2 = Ejt ,Qe EQes kvt k2   (a) 2 e (p) (∇f (y)) ≤ 2 Ejt ,Qe ∇fjt (xt ) − ∇fjt (y) + Q  h i (b) 2 e (p) (∇f (y)) ≤ 4 Ejt k∇fjt (xt ) − ∇fjt (x∗ )k + 4 Ejt ,Qe ∇fjt (x∗ ) − ∇fjt (y) + Q (c) h i h i 2 2 ≤ 4 Ejt k∇fjt (xt ) − ∇fjt (x∗ )k + 4 Ejt ,Qe k∇fjt (x∗ ) − ∇fjt (y) + ∇f (y)k   2 (p) e + 4 Ejt ,Qe ∇f (y) − Q (∇f (y)) (d) h i h i 2 2 ≤ 4 Ejt k∇fjt (xt ) − ∇fjt (x∗ )k + 4 Ejt ,Qe k∇fjt (x∗ ) − ∇fjt (y) + ∇f (y)k + 8 k∇f (y)k 2 (e) ≤ 8L (f (xt ) − f (x∗ )) + 4L (f (y) − f (x∗ )) + 16L(f (y) − f (x∗ )) ≤ C · L (f (xt ) − f (x∗ ) + f (y) − f (x∗ )) , as claimed, for some positive constant C ≤ 16. Here (a) follows from Lemma 3.1, (b) and (c) follow from the fact that (a + b)2 ≤ 2a2 + 2b2 for all scalars a, b, (d) follows from Lemma 3.1 and independence, and (e) follows from Lemma 6.4 in [7] and the standard fact that k∇f (y)k2 ≤ 2L(f (y) − f (x∗ )) if f is `-strongly convex. Plugging these bounds into proof structure in [7] yields the proof of G.1, as claimed. Why does naive quantization not achieve this rate? Our analysis shows that quantized SVRG achieves the communication efficient rate, using roughly 2.8 times as many bits per iteration, and roughly C/2 = 8 times as many iterations. This may beg the question why naive quantization schemes (say, quantizing down to 16 or 32 bits) fails. At a high level, this is because any such quantization can inherently only achieve up to constant error, since the stochastic gradients are always biased by a (small) constant. To circumvent this, one may quantize down to O(log 1/) bits, however, this only matches the upper bound given by [40], and is off from the optimal rate (which we achieve) by a logarithmic factor. C Quantization for Non-convex SGD As stated previously, our techniques are portable, and apply easily to a variety of settings where SGD is applied. As a demonstration of this, we show here how we may use quantization on top of recent results which show that SGD converges to local minima when applied on smooth, non-convex functions. Throughout this paper, our theory only considers the case when f is a convex function. In many interesting applications such as neural network training, however, the objective is non-convex, where much less is known. However, there has been an interesting line of recent work which shows that SGD at least always provably converges to a local minima, when f is smooth. For instance, by applying Theorem 2.1 in [15], we immediately obtain the following convergence result for quantized SGD. Let Qs be the quantization function defined in Section 3.1. Here we will only state the convergence bound; the communication complexity per iteration is the same as in 3.1. Theorem C.1. Let f : Rn → R be a L-smooth (possibly nonconvex) function, and let x1 be an arbitrary initial point. Let T > 0 be fixed, and s > 0. Then there is a random stopping time R supported on {1, . . . , N } so that QSGD with quantization function Qs , and constant stepsizes η = O(1/L) and access to stochastic gradients of f with second moment bound B satisfies ! p √ 2 ∗)  L(f (x ) − f 1  (1 + min(n/s , n/s))B 1 E k∇f (x)k22 ≤ O + . L N L 19 2  Table 2: Description of networks. Network AlexNet BN-Inception ResNet152 VGG19 ResNet110 LSTM Dataset ImageNet ImageNet ImageNet ImageNet CIFAR-10 AN4 Epochs 112 300 120 80 160 20 Parameters 62M 11M 60M 143M 1M 13M Init. L. Rate 0.07 3.6 1 0.1 0.1 0.5 Minibatch size (2, 4, 8, 16 GPUs) Varies (256, 512, 1024, 1024) Varies (256, 256, 256, 1024) Varies (32, 64, 128, 256) Varies (64, 128, 256) 128 256 Observe that the only difference in the assumptions in [15] from what we generally assume is that they assume a variance bound on the stochastic gradients, whereas we prefer a second moment bound. Hence our result applies immediately to their setting. Another recent result [29] demonstrates local convergence for SGD for smooth non-convex functions in asynchronous settings. The formulas there are more complicated, so for simplicity we will not reproduce them here. However, it is not hard to see that quantization affects the convergence bounds there in a manner which is parallel to Theorem 3.2. D Asynchronous QSGD We consider an asynchronous parameter-server model [28], modelled identically as in [29, Section 3]. In brief, the system consists of a star-shaped network, with a central parameter server, communicating with worker nodes, which exchange information with the master independently and simultaneously. Asynchrony consists of the fact that competing updates might be applied by the master to the shared parameter (but workers always get a consistent version of the parameter). In this context, the following follows from [29, Theorem 1]: Theorem D.1. Let f : Rn → R be a L-smooth (possibly nonconvex) function, and let x1 be an arbitrary initial point. Assume unbiased stochastic gradients, with bounded variance σ 2 , and Lipschitzian gradient with parameter L. Let K be the number of iterations, and M be the minibatch size. Further assume that all the locations of the gradient updates {ξk,m }k=[K],m=[M ] are independent random variables, and that the delay with which each update is applied is upper bounded by a parameter T . Finally, assume that the steplength sequence {γk }k=[K] satisfies LM γk + 2L2 M 2 T γk T X γk+κ ≤ 1, ∀k = 1, 2, . . . . κ=1 We then have the following ergodic convergence rate for the iteration of QSGD with quantization PK √ function Qs . Let γ = k=1 γk , and σs = (1 + min(n/s2 , n/s))σ. Then:  PK  2 Pk−1 2 2 2 2 ∗ K γ M L + 2L M γ γ 2(f (x ) − f (x )) + X 1 k k k=1 j=k−T j σs γk E [k∇f (xk )k] ≤ . γ Mγ k=1 E Experiments We now empirically validate our approach on data-parallel GPU training of deep neural networks. Setup. We performed experiments on Amazon EC2 p2.16xlarge instances, using up to 16 NVIDIA K80 GPUs. Instances have GPUDirect peer-to-peer communication, but do not currently support NVIDIA NCCL extensions. We have implemented QSGD on GPUs using the Microsoft Cognitive Toolkit (CNTK) [3]. This package provides efficient (MPI-based) GPU-to-GPU communication, and implements an optimized version of 1bit-SGD [35]. Our code is released both as open-source and as a docker instance. We do not quantize small gradient matrices in QSGD, since the computational cost of quantizing small matrices significantly exceeds the reduction in communication from quantization. However, 20 1bitSGD 32bit 8 GPUs 4 GPUs 1bitSGD 32bit 20 8 GPUs 2bit (d=128) 4bit (d=1024) 10 8 6 4 2 0 4 GPUs 1bitSGD 32bit 1bitSGD 32bit 8 GPUs 16 GPUs 5 40 35 30 25 20 15 10 5 0 ResNet50 2 GPUs 4 GPUs 10 0 16 GPUs VGG19 2 GPUs 15 2bit (d=128) 4bit (d=1024) Inception 2 GPUs 16 GPUs Time per epoch (hours) AlexNet 4 GPUs Time per epoch (hours) 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 2 GPUs Time per epoch (hours) Time per epoch (hours) Time per epoch (hours) 1.4 1.2 1.0 0.8 0.6 0.4 0.2 0.0 8 GPUs 2 GPUs 1bitSGD 2bit (d=128) 4bit (d=1024) ResNet152 4 GPUs 32bit 8 GPUs 16 GPUs 2bit (d=128) 4bit (d=1024) 16 GPUs 2bit (d=128) 4bit (d=1024) Figure 4: Breakdown of communication versus computation for various neural networks, on 2, 4, 8, 16 GPUs, for full 32-bit precision versus 1BitSGD versus QSGD 2-bit and 4-bit. Each bar represents the total time for an epoch under standard parameters. Epoch time is broken down into communication (bottom, solid color) and computation (top, transparent color). Notice that, although epoch time usually diminishes as we increase parallelism, the proportion of communication cost increases. in all experiments, at least 99% of all parameters are transmitted in quantized form. If required, we reshape matrices to fit bucket sizes. We execute two types of tasks: image classification on the ILSVRC (ImageNet) [12], CIFAR10 [25], and MNIST [27] datasets, and speech recognition on the CMU AN4 dataset [2]. For vision, we experimented with AlexNet [26], VGG [36], ResNet [18], and Inception with Batch Normalization [22] deep networks. For speech, we trained an LSTM network [19]. See Table 1. We used standard sizes for the networks, with hyper-parameters optimized for the 32bit precision variant.1 Full details for networks and experiments are given in the additional material. We increased batch size when necessary to balance communication and computation for larger GPU counts, and we employed double buffering [35] to perform communication and quantization concurrently with the computation. Quantization usually benefits from lowering learning rates; yet, we always run the 32bit learning rate, and decrease bucket size to reduce variance if needed. Communication vs. Computation. In the first set of experiments, we examine the ratio between computation and communication costs during training, for increased parallelism. The image classification networks are trained on ImageNet, while LSTM is trained on AN4. We examine the cost breakdown for these networks over a pass over the dataset (epoch). Figure 2 gives image classification results. The variance of epoch times is practically negligible. 1 Unless otherwise stated, we use the default networks and hyper-parameters available in the open-source CNTK 2.0. 21 Test accuracy (%) > 2x faster 2.0 2bit QSGD (d=128) 4bit QSGD (d=8192) 8bit QSGD (d=8192) SGD Training loss 1.5 1.0 0.5 0.00 300 600 900 Time (sec) 1200 1500 (c) LSTM Accuracy versus Time. 20 40 60 2bit QSGD (d=128) 4bit QSGD (d=512) 8bit QSGD (d=512) SGD 80 100 120 140 160 Epoch (b) ResNet110 Accuracy on CIFAR. Test accuracy (%) (a) AlexNet Accuracy on ImageNet. 96 94 92 90 88 86 84 82 800 98 97 96 95 94 93 92 910 SGD QSGD (d=256) QSGD (d=1024) QSGD (d=4096) 5 10 Epoch 15 20 (d) Two-Layer Perceptron Accuracy on MNIST. Figure 5: Accuracy numbers for different networks. The red lines in (a) represent final 32-bit accuracy. The data leads to some interesting observations. First, based on the ratio of communication to computation, we can roughly split networks into communication-intensive (AlexNet, VGG, LSTM), and computation-intensive (Inception, ResNet). For both network types, the relative impact of communication increases significantly as we increase the number of GPUs. Examining the breakdown for the 32-bit version, all networks could significantly benefit from reduced communication. For example, for AlexNet on 16 GPUs with batch size 1024, more than 80% of training time is spent on communication, whereas for LSTM on 2 GPUs with batch size 256, the proportion is 71% communication.2 Next, we examine the impact of QSGD on communication and overall training time. (For QSGD, communication time includes time spent compressing and uncompressing gradients.) We measured QSGD with 2-bit quantization and 64 bucket size, and 4-bit quantization and 8192 bucket size. The results for these two variants are similar, since the different bucket sizes mean that the 4bit version only sends 77% more data than the 2-bit version (but ∼ 8× less than 32-bit). These bucket sizes are chosen to ensure good convergence, but are not carefully tuned. On 16GPU AlexNet with batch size 1024, 4-bit QSGD reduces communication time by 4×, and overall epoch time by 2.5×. On LSTM, it reduces communication time by 6.8×, and overall epoch time by 2.7×. Runtime improvements are non-trivial for all architectures we considered. Accuracy. We now examine how QSGD influences accuracy and convergence rate. We ran AlexNet to full convergence on ImageNet, LSTM on AN4, ResNet110 on CIFAR-10, as well as a two-layer perceptron on MNIST. Results are given in Figure 5. On ImageNet using AlexNet, 4-bit QSGD with 8192 bucket size converges to 59.22% top-1 error, and 81.63% top-5 error. The gap from the 32bit version is 0.57% for top-5, and 0.68% for top-1 [9]. QSGD with 2-bit and 64 bucket size has gap 1.73% for top-1, and 1.18% for top-1. We note that we did not tune bucket size, number of bits used, number of epochs or learning rate for this experiment. 2 These ratios can be improved by increasing batch size. However, increasing batch size further hurts convergence and decreases accuracy, see also e.g. [21]. 22 1 2 3 Data: Parameter vector x procedure GradientDescent for each iteration t do Q(∇f (x)) ← Quantize(∇f (x))) //quantize gradient x ← x − ηt Q(∇f (x)) //apply gradient 4 5 end Algorithm 2: The gradient descent algorithm with gradient encoding. On AN4 using LSTMs, 2-bit QSGD has similar convergence rate and the same accuracy as 32bit. It is able to converge 3× faster to the target accuracy with respect to full precision, thanks to reduced communication overheads. The 4-bit variant has the same convergence and accuracy, but is slightly slower than 2-bit (by less than 10%). On CIFAR-10, 2-bit QSGD applied to ResNet-110 drops about 1.22% top-1 accuracy points. However, 4-bit QSGD converges to the same accuracy as the original, whereas 8-bit QSGD improves accuracy by 0.33%. We observe a similar result on MNIST, where 2-bit QSGD with buckets equal to the size of hidden layers improves accuracy by 0.5%. These results are consistent with recent work [30] noting benefits of added noise in training deep networks. Linear models on e.g. MNIST do not show such improvements. One issue we examined in more detail is which layers are more sensitive to quantization. It appears that quantizing convolutional layers too aggressively (e.g., 2-bit precision) can lead to accuracy loss if not trained further. However, increasing precision to 4-bit or 8-bit recovers accuracy. This finding suggests that modern architectures for vision tasks, such as ResNet or Inception, which are almost entirely convolutional, may benefit less from quantization than recurrent deep networks such as LSTMs. Comparison with 1BitSGD. We have also compared against the 1BitSGD algorithm of [35]. Before discussing results, it is important to note some design choices made in the CNTK implementation of 1BitSGD. For objects without dynamic dimensions, the first tensor dimension is the “row" while the rest are flattened onto “columns." At the same time, 1BitSGD always quantizes per column. In practice, this implies that quantization is often applied to a column of very small dimension (1–3), especially in the case of networks with many convolutions. This has the advantage of having extremely low variance, but does not yield any communication benefits. In fact, it can hurt performance due to the cost of quantization. (By contrast, we reshape to quantize on large dimensions.) Given this artefact, 1BitSGD is slower than even the 32bit version on heavily convolutional networks such as ResNet and Inception. However, 1BitSGD matches the performance of 2-bit and 4-bit QSGD on AlexNet, VGG, and LSTMs within 10%. In general, 1BitSGD attains very good accuracy (on par with 32bit), probably since the more delicate convolutional layers are not quantized. QSGD has the advantage of being able to perform quantization on the fly, without error accumulation: this saves memory, since we do not need to allocate an additional model copy. F Quantized Gradient Descent: Description and Analysis In this section, we consider the effect of lossy compression on standard (non-stochastic) gradient descent. Since this procedure is not data-parallel, we will first have to modify the blueprint for the iterative procedure, as described in Algorithm 2. In particular, we assume that, instead of directly applying the gradient to the iterate xt+1 , the procedure first quantizes the gradient, before applying it. This setting models a scenario where the model and the computation are performed by different machines, and we wish to reduce the communication cost of the gradient updates. We now give a quantization function tailored for gradient descent, prove convergence of gradient descent with quantization, and then finally bound the length of the encoding. 23 The Quantization Function. We consider the following deterministic quantization function, inspired by [35]. For any vector v ∈ Rn , let I(v) be the smallest set of indices of v such that X |vi | ≥ kvk. i∈I(v) Further, define Q(v) to be the vector ( Q(v)i = kvk −kvk 0 if x ≥ 0 and i ∈ I(v); if x < 0 and i ∈ I(v); otherwise. Practically, we preserve the sign for each index in I(v), the 2-norm of v, and cancel out all remaining components of v. Convergence Bound. We begin by proving some properties of our quantization function. We have the following: Lemma F.1. For all v ∈ Rn , we have 1. v T Q(v) ≥ kvk2 , √ 2. |I(v)| ≤ n, and √ 3. kQ(v)k2 ≤ nkvk2 . Proof. For the first claim, observe that v T Q(v) = kvk P i∈I(v) |vi | ≥ kvk2 . We now prove the second claim. Let v = (v1 , . . . , vn ), and without loss of generality, assume that |vi | ≥ |vi+1 | for all i = 1, . . . , n − 1, so that the coordinates are in decreasing order. Then I(v) = {1, . . . , D} for some D. PD √ √ We show that if D ≥ n then i=1 |vi | ≥ kvk, which shows that |I(v)| ≤ n. Indeed, we have that !2 D D X X X vi2 + |vi ||vj | |vi | = i=1 i=1 ≥ D X i6=j i,j≤D 2 vi2 + (D2 − D)vD+1 . i=1 On the other hand, we have kvk2 = D X vi2 + i=1 ≤ D X n X vi2 D+1 2 vi2 + (n − D)vD+1 i=1 and so we see that if D = √ n, we must have P D i=1 2 |vi | ≥ kvk2 , as claimed. For the third claim, observe that kQ(v)k2 = kvk2 · |I(v)|; thus the claim follows from the previous upper bound on the cardinality of I(v). To establish convergence of the quantized method, we prove the following theorem. ∗ Theorem F.2. Let f : Rn → R be a `-strongly convex, L-smooth function, with  global  minimizer x , `√ and condition number κ = L/`. Then, for all step sizes η satisfying η ≤ O L2 n , for all T ≥ 1, and all initial points x0 , we have     1 √ f (xT ) − f (x∗ ) ≤ exp −Ω T (f (x0 ) − f (x∗ )) . κ2 n 24 Proof. We first establish the following two properties: Lemma F.3. Let f be `-strongly convex and L-smooth. Then, 1. for all x ∈ Rn , ` L kx − x∗ k2 ≤ f (x) − f (x∗ ) ≤ kx − x∗ k2 . 2 2 2. for all x ∈ Rn , ∇f (x)T Q(∇f (x)) ≥ `(f (x) − f (x∗ )) . Proof. The first property follows directly from the definitions of strong convexity and smoothness. We now show the second property. If x = x∗ the property trivially holds so assume that this does not happen. By Lemma F.1, we have ∇f (x)T Q(∇f (x)) ≥ k∇f (x)k2 . We then have f (x) − f (x∗ ) ≤ ∇f (x)T (x − x∗ ) ≤ k∇f (x)k kx − x∗ k , where the first inequality follows from convexity, and the second from Cauchy-Schwartz. From strong convexity we then have that 2` kx − x∗ k2 ≤ ∇f T (x)(x − x∗ ) from which we get that ` x − x∗ kx − x∗ k ≤ ∇f (x)T ≤ k∇f (x)k , 2 kx − x∗ k where the last line follows since from self-duality of the 2-norm, we know that for all vectors v ∈ Rn , we have kvk2 = supkuk=1 v T u. Putting these two things together yields that f (x) − f (x∗ ) ≤ 2 2 2 k∇f (x)k ≤ ∇f (x)T Q(∇f (x)) , ` ` as claimed. With all this in place, we can now complete the proof of the theorem. Fix t ≥ 0. By applying the lemma, we have: ` (10) ∇f (xt )T (xt+1 − xt ) = −η∇f (xt )T Q(∇f (xt )) ≤ −η (f (x) − f (x∗ )) . 2 Moreover, observe that, from standard properties of smooth functions [7], we have 1 k∇f (x)k2 ≤ f (x) − f (x∗ ) . (11) 2L Thus, we obtain the following chain of inequalities: (a) f (xt+1 ) − f (xt ) ≤ ∇f (xt+1 )T (xt+1 − xt ) T = ∇f (xt )T (xt+1 − xt ) + (∇f (xt+1 ) − ∇f (xt )) (xt+1 − xt ) (b) ` ≤ −η (f (xt ) − f (x∗ )) + k∇f (xt+1 ) − ∇f (xt )k kxt+1 − xt k 2 (c) ` ≤ −η (f (xt ) − f (x∗ )) + Lkxt+1 − xt k2 2 ` = −η (f (xt ) − f (x∗ )) + η 2 LkQ(∇f (xt ))k2 2 (d) √ ` ≤ −η (f (xt ) − f (x∗ )) + η 2 L nk∇f (xt )k22 2 (e) √ ` ≤ −η (f (xt ) − f (x∗ )) + η 2 2L2 n(f (xt ) − f (x∗ ))  2  √ ` = −η + 2η 2 L2 n (f (xt ) − f (x∗ )) , 2 25 where (a) follows from the convexity of f , (b) follows from Equation 10 and the Cauchy-Schwarz inequality, (c) follows from the L-smoothness of f , (d) follows from Lemma F.1, and (e) follows from Equation 11. By our choice of η, we know that the RHS of Equation 12 is negative. Hence, by Lemma F.3 and the definition of η, we have   1 √ f (xt+1 ) − f (xt ) ≤ −Ω (f (xT ) − f (x∗ )) . (12) κ2 n Letting δt = f (xt ) − f (x∗ ), and observing that f (xt+1 ) − f (xt ) = δt+1 − δt , we see that Equation 12 is equivalent to the statement that    1 √ δt+1 ≤ 1 − Ω δt . κ2 n Thus altogether we have   T 1 √ δ0 δT ≤ 1 − Ω κ2 n     1 √ ≤ exp −Ω T δ0 , κ2 n as claimed. Encoding Length. We obtain the following: Theorem F.4. Let v ∈ Rn . Then √ |Code(Q(v))| ≤ n(log(n) + 1 + log(e)) + F. G Quantized SVRG Variance Reduction for Sums of Smooth Functions. One common setting in which SGD sees application in machine learning is when Pfmcan be naturally expressed as a sum of smooth functions. 1 Formally, we assume that f (x) = m i=1 fi (x). When f can be expressed as a sum of smooth functions, this lends itself naturally to SGD. This is because a natural stochastic gradient for f in this setting is, on input x, to sample a uniformly random index i, and output ∇fi (x). We will also impose somewhat stronger assumptions on f and f1 , f2 , . . . , fm , namely, that f is strongly convex, and that each fi is convex and smooth. Definition G.1 (Strong Convexity). Let f : Rn → R be a differentiable function. We say that f is `-strongly convex if for all x, y ∈ Rn , we have ` f (x) − f (y) ≤ ∇f (x)T (x − y) − kx − yk22 . 2 Observe that when ` = 0 this is the standard definition of convexity. Note that it is well-known that even if we impose these stronger assumptions on f and f1 , f2 , . . . , fm , then by only applying SGD one still cannot achieve exponential convergence rates, i.e. error rates which improve as exp(−T ) at iteration T . (Such a rate is known in the optimization literature as linear convergence.) However, an epoch-based modification of SGD, known as stochastic variance reduced gradient descent (SVRG) [23], is able to give such rates in this specific setting. We describe the method below, following the presentation of Bubeck [7]. (p) Background on SVRG. Let y (1) ∈ Rn be an arbitrary point. For p = 1, 2, . . . , P , we let x1 = (p) y (p) . Each p is called an epoch. Then, within epoch p, for t = 1, . . . , T , we let it be a uniformly random integer from [m] completely independent from everything else, and we set:   (p) (p) (p) xt+1 = xt − η ∇fi(p) (xt ) − ∇fi(p) (y (p) ) + ∇f (y (p) ) . t t We then set y (p+1) k 1 X (p) = x . k i=1 t With this iterative scheme, we have the following guarantee: 26 Pm 1 Theorem G.1 ([23]). Let f (x) = m i=1 fi (x), where f is `-strongly convex, and fi are convex and L-smooth, for all i. Let x∗ be the unique minimizer of f over Rn . Then, if η = O(1/L) and T = O(L/`), we have h i   E f (y (p+1) ) − f (x∗ ) ≤ 0.9p f (y (1) ) − f (x∗ ) . (13) Quantized SVRG. In parallel SVRG, we are given K processors, each processor i having access to fim/K , . . . , f(i+1)m/K−1 . The goal is the same as before: to approximately minimize f = Pm P(i+1)m/K−1 1 1 fi be the portion of f that it knows, so that i=1 fi . For processor i, let hi = m j=im/K m PK f = i=1 hi . A natural question is whether we can apply randomized quantization to reduce communication for parallel SVRG. Whenever one applies our quantization functions to the gradient updates in SVRG, the resulting update is no longer an update of the form used in SVRG, and hence the analysis for SVRG does not immediately give any results in black-box fashion. Instead, we prove that despite this technical issue, one can quantize SVRG updates using our techniques and still obtain the same convergence bounds. √ e Let Q(v) = Q(v, n), where Q(v, s) is defined as in Section 3.1. Our quantized SVRG updates are as follows. Given arbitrary starting point x0 , we let y (1) = x0 . At the beginning of epoch p, each processor broadcasts   (i+1)m/K−1 X 1 e (∇hi ) , e ∇fi (y (p) ) = Q Hp,i = Q m j=im/K Pm from which the processors collectively form Hp = i=1 Hp,i without additional communication. (p) Within each epoch, for each iteration t = 1, . . . , T , and for each processor i = 1, . . . , K, we let ji,t be a uniformly random integer from [m] completely independent from everything else. Then, in iteration t in epoch p, processor i broadcasts the update vector   (p) (p) e ∇f (p) (x(p) ut,i = Q ) − ∇f (y ) + H (p) p . t j j i,t i,t (p) Each processor then computes the total update for that iteration ut = (p) (p) (p) xt+1 = xt − ηut . At the end of epoch p, each processor sets y (p+1) = PK 1 ut,i , K PTi=1 (p) 1 t=1 xt . T and sets Our main theorem is that this algorithm still converges, and is communication efficient: Pm 1 Theorem G.2. Let f (x) = m i=1 fi (x), where f is `-strongly convex, and fi are convex and L-smooth, for all i. Let x∗ be the unique minimizer of f over Rn . Then, if η = O(1/L) and T = O(L/`), then QSVRG with initial point y (1) ensures h i   E f (y (p+1) ) − f (x∗ ) ≤ 0.9p f (y (1) ) − f (x∗ ) . (14) Moreover, QSVRG with P epochs and T iterations per epoch requires ≤ P (F + 2.8n)(T + 1) bits of communication per processor. In particular, observe that when L/` is a constant, this implies that for all epochs p, we may communicate O(pn) bits and get an error rate of the form (14). Up to constant factors, this matches the lower bound given in [40]. Proof of Theorem G.2. By Theorem A.6, each processor transmits at most F + 2.8n bits per iteration, and then an additional F + 2.8n bits per epoch to communicate the Hp,i . Thus the claimed communication bound follows trivially. We now turn our attention to correctness. As with the case of quantized SGD, it is not hard to see that the parallel updates are equivalent to minibatched updates, and serve only to decrease the variance of the random gradient estimate. Hence, as before, for simplicity of presentation, we will consider the 27 effect of quantization on convergence rates on a single processor. In this case, the updates can be written down somewhat more simply. Namely, in iteration t of epoch p, we have that   (p) (p) (p) (p) (p) e (p) e xt+1 = xt − η Q ∇f (x ) − ∇f (y ) + Q (∇f (y)) , (p) (p) t t j j t where (p) jt is a random index of [m], and t e (p) Q t e (p) and Q e are all different, independent instances of Q. We follow the presentation in [7]. Fix an epoch p ≥ 1, and let E denote the expectation taken with respect to the randomness within that epoch. We will show that " # T  h  i  1 X (p) (p+1) ∗ E f y − f (x ) = E xt − f (x∗ ) ≤ 0.9p f (y (1) ) − f (x∗ ) . T t=1 This clearly suffices to show the theorem. Because we only deal with a fixed epoch, for simplicity of notation, on p in the notation. For t = 1, . . . , T , let  we shall proceed to drop the dependence  (p) e e vt = Qt ∇fjt (xt ) − ∇fjt (y) − Q (∇f (y)) be the update in iteration t. It suffices to show the following two equations: Ejt ,Qet ,Qe [vt ] = ∇f (xt ) , and   Ejt ,Qet ,Qe kvt k2 ≤ C · L (f (xt ) − f (x∗ ) + f (y) − f (x∗ )) , where C is some universal constant. That the first equation is true follows from the unbiasedness of e We now show the second. We have: Q.     Ejt ,Qet ,Qe kvt k2 = Ejt ,Qe EQes kvt k2   (a) 2 (p) e ≤ 2 Ejt ,Qe ∇fjt (xt ) − ∇fjt (y) + Q (∇f (y))  h i (b) 2 e (p) (∇f (y)) ≤ 4 Ejt k∇fjt (xt ) − ∇fjt (x∗ )k + 4 Ejt ,Qe ∇fjt (x∗ ) − ∇fjt (y) + Q (c) h i h i 2 2 ≤ 4 Ejt k∇fjt (xt ) − ∇fjt (x∗ )k + 4 Ejt ,Qe k∇fjt (x∗ ) − ∇fjt (y) + ∇f (y)k   2 (p) e + 4 Ejt ,Qe ∇f (y) − Q (∇f (y)) (d) h i h i 2 2 ≤ 4 Ejt k∇fjt (xt ) − ∇fjt (x∗ )k + 4 Ejt ,Qe k∇fjt (x∗ ) − ∇fjt (y) + ∇f (y)k + 8 k∇f (y)k 2 (e) ≤ 8L (f (xt ) − f (x∗ )) + 4L (f (y) − f (x∗ )) + 16L(f (y) − f (x∗ )) ≤ C · L (f (xt ) − f (x∗ ) + f (y) − f (x∗ )) , as claimed, for some positive constant C ≤ 16. Here (a) follows from Lemma 3.1, (b) and (c) follow from the fact that (a + b)2 ≤ 2a2 + 2b2 for all scalars a, b, (d) follows from Lemma 3.1 and independence, and (e) follows from Lemma 6.4 in [7] and the standard fact that k∇f (y)k2 ≤ 2L(f (y) − f (x∗ )) if f is `-strongly convex. Plugging these bounds into proof structure in [7] yields the proof of G.1, as claimed. Why does naive quantization not achieve this rate? Our analysis shows that quantized SVRG achieves the communication efficient rate, using roughly 2.8 times as many bits per iteration, and roughly C/2 = 8 times as many iterations. This may beg the question why naive quantization schemes (say, quantizing down to 16 or 32 bits) fails. At a high level, this is because any such quantization can inherently only achieve up to constant error, since the stochastic gradients are always biased by a (small) constant. To circumvent this, one may quantize down to O(log 1/) bits, however, this only matches the upper bound given by [40], and is off from the optimal rate (which we achieve) by a logarithmic factor. 28 2 
8cs.DS
arXiv:1710.07831v1 [cs.CV] 21 Oct 2017 A Generative Restricted Boltzmann Machine Based Method for High-Dimensional Motion Data Modeling Siqi Nie∗ Ziheng Wang Qiang Ji‡ † October 24, 2017 Abstract Many computer vision applications involve modeling complex spatiotemporal patterns in high-dimensional motion data. Recently, restricted Boltzmann machines (RBMs) have been widely used to capture and represent spatial patterns in a single image or temporal patterns in several time slices. To model global dynamics and local spatial interactions, we propose to theoretically extend the conventional RBMs by introducing another term in the energy function to explicitly model the local spatial interactions in the input data. A learning method is then proposed to perform efficient learning for the proposed model. We further introduce a new method for multi-class classification that can effectively estimate the infeasible partition functions of different RBMs such that RBM is treated as a generative model for classification purpose. The improved RBM model is evaluated on two computer vision applications: facial expression recognition and human action recognition. Experimental results on benchmark databases demonstrate the effectiveness of the proposed algorithm. 1 Introduction Spatio-temporal patterns in high-dimensional motion data are crucial in many recognition applications. For example, human action is the combination of the body joint movements over a time interval. Facial expression is the result of the facial landmark movements (Figure 1). Understanding the movement trajectories and modeling the underlying spatio-temporal patterns play an important ∗ Email: [email protected]. [email protected]. ‡ Email: [email protected]. Affiliation: Rensselaer Polytechnic Institute, USA. † Email: 1 role in recognizing these actions, especially with the recent emergences of reliable algorithms [1, 2] to estimate the positions of body joints and facial landmarks. In this work, we are interested in developing a probabilistic model to capture the spatio-temporal pattenrs in high-dimensional time series for classification purpose. Many recent works develop novel models to capture the spatiotemporal dynamics [3, 4, 5, 6]. However, most models, such as hidden Markov model (HMM) [5], dynamic Bayesian network (DBN) [7] and conditional random field (CRF) [8] are time-slice local models, which assume Markov property and stationary transitions and hence can only capture local dynamics. The local models suffer from two limitations. First, local dynamics may not represent a sequence well because it fails to mpdel the overall dynamics. Second, the stationary transition assumption may not hold for many real-world applications. Compared with time-sliced dynamic models, restricted Boltzmann machines (RBMs) has shown strong capability of modeling joint distributions and therefore can capture the global patterns. In literature, RBMs have been successfully applied to separately capture the spatial [9] or temporal [10] patterns in different types of data. In this work, we propose a variant of RBM that can capture spatial and global temporal patterns simultaneously to comprehensively model the high-dimensional motion data. In a typical RBM, since there are no lateral connections among nodes in each layer, input data are independent of each other given the states of hidden layer. This assumption limits RBM’s representation power, since there exist direct dependencies among input data. There are generally two types of data interactions: interactions through latent variable and direct interactions independent of latent variable. For example, as stated in [11], soldiers on a parade follow the commander’s order to march in some direction, but they “form a neat rectangle by interacting with their neighbors”. This example illustrates that soldiers’ behavior are determined by both the commander’s order (latent) and the interactions with their neighbors. In this case, RBM is not effective in modeling the local interaction that is independent of the latent variable. The use of RBM for data representation and classification is further hindered by the difficulty in comparing different RBMs due to the intractable computation of the partition functions. Allowing interaction among visible units can overcome this shortcoming. We introduce restricted Boltzmann machine with local interactions (LRBM) to capture both the global temporal patterns and local spatial interactions in the input data. Specifically, we add a new pairwise potential term in the learning objective function of RBM to capture the local spatial interactions among components of an input vector. To perform efficient learning for the model, we replace the reconstruction procedure in the conventional Contrastive Divergence [13] algorithm with a mean field approach. For classification task, RBM is typically used for learning features, as the input to a second stage classifier (e.g., SVM [14]). Typically one model is trained for all classes. To obtain good features, deep structure is built and back propagation is employed to carefully tune the parameters. In this work, we use RBM as a generative model to capture the spatio-temporal patterns in the 2 Figure 1: Examples of spatiotemporal patterns in different applications: facial expression recognition and human action recognition. Both spatial interactions and temporal movements of landmarks define an expression or an action. Images are from CK+ data set[2] and G3D data set [12], respectively. data. RBM is used for data representation instead of feature learning. Given an observation, the only output we get from an RBM model is the likelihood of the model. For the recognition purpose, one model is trained for one class of input data. To compare among different models, we employ a method to estimate the relative partition function of a pair of RBMs for binary classification, and a label ranking method is used to extend the binary classification to multi-class classification. To evaluate the performance of LRBM, we apply it to two areas related to complex spatial and temporal patterns: facial expression recognition and human action recognition. Experimental results on benchmark databases demonstrate the effectiveness of the proposed model. The rest of the paper is structured as follows. Section 2 presents an overview of the related work. Section 3 introduces the LRBM to model the global temporal dynamics and spatial patterns of motion data, as well as the classification method. We will then give the experimental results in 4. The paper is concluded in section 5. 2 Related Work Capturing and representing spatio-temporal structure in data is important for many recognition and classification tasks. Research for capturing such patterns can be categorized into feature-based and model-based methods. The most widely used spatio-temporal features include spatio-temporal interest point (STIP) based features [3, 4] and optical flow based features [15]. These features capture local appearance or motion patterns near the interest points or optical 3 flows. Although having been successfully applied to many applications, these features generally focus more on local patterns. Model-based methods include probabilistic graphical models such as Hidden Markov Models [5], Dynamic Bayesian Networks [16], Conditional Random Fields [17], and their variants. While capable of simultaneously capturing both spatial and temporal interactions, they can only capture the local spatial and temporal interactions due to the underlying Markov assumption. Restricted Boltzmann machines (RBMs) have been separately used for modeling spatial correlation or temporal correlation in the data in the last decade. RBM was firstly introduced to learn deep features from handwritings to recognize digits [18]. In [9], Eslami et al. propose a Deep Belief Network to model the shapes of horses and motorbikes. The samples from the model look realistic and have a good generalization. A more complicated model, proposed by Nair and Hinton [19], considers the spatial correlation among visible layer using a factored 3-way RBM, in which triple potentials are used to model the correlations among pixels in natural images. The intuition is that in natural images, the intensity of each pixel is approximately the average of its neighbors. Wu et al. [20] apply the 3-way RBM to facial landmark tracking, and model the relationship between posed faces and frontal faces, under varying facial expressions. For dynamic data modeling, Taylor et al. [21] use a Conditional RBM (CRBM) to model the temporal transitions in human body movements, and reconstruct body movements. Nevertheless, like HMM, CRBM still models local dynamics by assuming n’th order Markov property. The idea of using RBM to model global pattern is not new. In [22, 23], RBM and CRF are combined for face labeling problem in a simgle image or video sequences. Compared with these works, our work is different for several reasons. First, our goal is to use RBM for data representation for multi-class classification, while the goal of [22, 23] is MAP inference, which is to recover the label for each superpixel. Second, we extend the conventional RBM to capture the local shape and global temporal patterns in a unified model, while in [22, 23] RBM is built on top of the hidden layer of the CRF, as the prior for the labels. Third, our method learns all the parameters simultaneously, while their method performs learning separately. RBM and its variants have also been used for modeling motion data. For example, Sutskever and Hinton [24] introduce a temporal RBM to model highdimensional sequences. Wang et al. [10] use RBM to capture the global dynamics of finger trace. However, it is limited to model the global dynamics for 1-D data only. To improve the representation power of RBM, semi-restricted Boltzmann machine (SRBM) [11] is introduced to model the lateral interactions between visible variables. The main property of SRBM is that given the hidden variables, the visible layer forms a Markov random field. However, for high-dimensional motion data, there will be too many parameters if every pair of visible units has an interaction. In this work, we model the dynamic nature of data with fewer parameters than a SRBM, which makes the learning process more efficient. Besides feature extraction and shape modeling, RBMs have also been used 4 Hidden Layer h v Visible Layer Figure 2: Illustration of a standard RBM for classification. Larochelle and Bengio [25] introduce a discriminative RBM as a classifier by including the labels in visible layer, and make predictions by comparing the likelihood of each label vector. In [26] discriminate RBM is introduced to model vector inputs by duplicating the discriminative RBM and adding constraints on the hidden layer. In all RBM related models discussed above, one RBM is trained for all classes. For this work, in contrast, we build one RBM for each class, and perform a multi-class classification task. In this research, we propose to extend the standard RBM to simultaneously capture the spatial and global temporal patterns in high-dimensional sequential data and employ such RBM model to different classification tasks in computer vision. 3 Data Spatio-Temporal Pattern Modeling In this section, we will firstly give a brief introduction of restricted Boltzmann machine, and then introduce the proposed RBM with Local Interaction (LRBM) to model multi-dimensional motion data and its learning method. Finally we present the method to use LRBMs as a set of pairwise classifier to perform multi-class recognition. 3.1 Restricted Boltzmann Machine A standard RBM is a generative model with two densely connected layers, one visible layer to represent data and one latent layer to extract stochastic binary features from data (Figure 2). Hidden units are connected to visible nodes using symmetrically weighted connections to model their joint distribution. In our work, we use Gaussian-Binary RBM, where the hidden units are binary and the visible variables are assumed to follow normal distribution. The energy function E(v, h) for each pair (v, h) is parameterized in Equation 5 1. E (v, h) = X (vi − ai )2 2σi2 i − X vi X wij hj − bj hj , σj i,j j (1) where ai is the bias for visible unit vi , σi is the standard deviation of the Gaussian distribution, which is typically 1 if we normalize the data, bj is the bias for the hidden unit hj , wij is the weight of the link connecting vi and hj . For every possible pair of visible and hidden vector, the network assigns a probability: 1 (2) p (v, h) = exp (−E (v, h)) , Z where Z is the partition function. With continuous inputs, the Z is calculated by integrating over all visible nodes and summing over all hidden unit configurations. 3.2 Proposed Model Using standard RBM to model high-dimensional motion data has its limitations. First, the interaction among the data is represented through latent variables, which can be easily represented in direct connections. Second, if a single RBM models the whole sequence, the spatial information in a time slice is treated the same as the temporal information of one dimension. If one RBM models only one time slice (as in [21]), the temporal information remains local. In this work, we propose the restricted Boltzmann machine with local interaction (LRBM, Figure 3) to overcome such limitations. For d × nt sequential data V = [v1 , v2 , . . . , vnt ], by allowing local interaction, we have the following energy function, E(V, h) = nh nt X 1X (vi − ai )T (vi − ai ) − bj hj 2 i=1 j=1 − nh nt X X n viT wij· hj − i=1 j=1 t 1X vT Uvi , 2 i=1 i (3) where vi is a d-dimension vector representing input vector at time slice i, w has the dimension of nt × nh × d, wij· is the weight vector connecting vi to a hidden node hj . ai and bj have the same meaning as in Equation 1. U is a d × d symmetric matrix with zeros on diagonal, modeling the correlation of each vector vi . The proposed energy function models two kinds of data interactions: interaction through latent variables and interaction directly among data. In highdimensional motion data, components in a single time slice (spatial information) is better to be considered differently from components along the timeline (temporal information). Interactions between input data and hidden variables are through weight w, which models global pattenrs, because every visible unit is connected to every latent unit. Matrix U models direct interactions among 6 input data, as in Figure 3, representing local spatial patterns. This kind of interaction directly affects visible layer without going through latent layer, so it is more effective to model some local spatial patterns. The elements in U are pairwise potentials of features in one time slice. Different shapes (spatial pattern) of input will have different contributions to the energy function. Thus, U captures spatial patterns among elements of input vector. With temporal information captured via the hidden nodes, our work can capture global spatio-temporal dynamics. We assume the spatial relationship are constant throughout the whole sequence, so the parameters in U are shared in different frames, which means U is invariant of i. Under this invariance assumption of U, the number of parameters is significantly reduced. From the energy function (Equation 3) and likelihood function (Equation 2), we can derive the probability of an hidden unit to be activated, given an visible layer: X p(hj = 1|V) = sigmoid(bj + viT wij· ) . (4) i As one hidden unit is connected to all visible units, whether it is activated or not depends stochastically on the visible layer. A hidden unit hj is activated through Equation 4 when it detects some specific pattern in the visible layer. The pattern is captured by the weights connecting each element in V to hj . Therefore the hidden layer h is able to capture important global patterns of V. Hence, the proposed model can simultaneously capture the global temporal patterns (through w) and local shape patterns (through U). LRBM is similar to the factored 3-way RBM [19] and SRBM [11] with respect to modeling the interactions in the visible layer. However, there exist some significant differences. First, in factored 3-way RBM, every pair of visible units has a potential to represent the interaction, while in LRBM, units only interact with neighbors in the time slice. Second, if the number of factors in 3-way RBM or the data dimension in SRBM is high, the overall parameters are much more than LRBM. In LRBM, the additional parameters are from matrix U, with the d(d − 1)/2 parameters, where d is the dimension of the vector vi . This would greatly reduce the computational load. Finally, both 3-way RBM and semi-RBM are proposed to model the spatial patterns of a single natural image, while LRBM models spatio-temporal patterns of sequential data. The joint probability of V and h are the same as in Equation 2. The likelihood of input data is computed by summing over all configurations of hidden units: 1 X −E(V,h) e . (5) p(V) = Z h 3.3 Model Learning In our work, one LRBM is trained for one class. The parameters include bias for visible and hidden units ai and bj , weight between two layers w, and local interaction matrix U. To learn the parameters, we seek to maximize the joint 7 ℎ𝑗 Hidden Layer … (𝑟) (𝑠) 𝑣𝑡 𝒗1 𝑢𝑟𝑠 𝑣𝑡 … 𝒗𝑛 𝑡 𝒗𝑡 Slice 𝑡 Slice 1 Visible Layer 𝑤𝑖𝑗 Slice 𝑛𝑡 T Figure 3: Illustration of the proposed LRBM model. Each hidden unit connects to each visible unit to capture the global temporal patterns. (Some links are omitted for brevity.) Connections within each time slice are to capture spatial pattern. The local covariance is parameterized using symmetric matrix U, which is consistent over time. Q probability of all training data D of a class, P (D) = V∈D p(V). Assume the data has been normalized, so ai can be removed from the energy function. The derivative of the log-likelihood of a training instance with respect to a parameter is given below: ∂ log p(V) ∂wij ∂ log p(V) ∂bj ∂ log p(V) ∂urs = hvi hj idata − hvi hj imodel , (6) = hhj idata − hhj imodel , (7) = h nt X (r) (s) vi vi idata i nt X (r) (s) vi vi imodel , −h (8) i where the angle brackets are used to denote expectations under the distribution specified by the subscript that follows. urs is the element of U at position (r, s). (r) (s) vi , vi are the rth and sth components of vector vi . This leads to a simple learning rule: stochastic steepest ascent in the log-likelihood of training data. Take wij as an example: ∆wij = (hvi hj idata − hvi hj imodel ) , (9) where  is the learning rate. hvi hj idata is easy to get from the data. hvi hj imodel is much more difficult to compute due to the large dimension of hidden and vis8 ible layers. Hinton [27] proposes the CD algorithm to approximate hvi hj imodel by using a reconstructed sample, which gives the following weight change: ∆wij = (hvi hj idata − hvi hj irecon ) . (10) Given the visible layer, the hidden units are independent with each other, so sampling the states of hidden units can be performed in parallel using Equation 4. Given the states of the hidden units, the visible units form a Markov Random (r) (s) Field in which the pairwise interaction weight between vi and vi is urs . They are no longer independent, so sampling cannot be done in parallel. However, we can obtain the conditional probability of each node by fixing its neighbors. The mean field algorithm is used to sample data from the model, and to reconstruct visible layer when learning the parameters of LRBM. Specifically, for each vector (s) vi , each component vi is sampled by fixing all its neighbors. Once a component is sampled, the vector is updated with the newly sampled component. This procedure is repeated until all components have been updated, and thus we get a reconstructed vector. The conditional probability of one visible node is given in Equation 11: X X (s) (s) (s) (s) p(vi |N(vi ), h) = N (ai + hj wij· + vk uks , 1) , (11) j (s) (s) vk ∈N(vi ) (s) where N(vi ) are the neighbors of vi , N (µ, σ 2 ) denotes the Gaussian probability density function with mean µ and variance σ 2 . The superscript (s) means the sth component of a vector. Compared with distribution of visible units in standard RBM: X p(vi |h) = N (ai + hj wij , 1) , (12) j the mean of the distribution of a visible node is similar in the first two terms, except that in LRBM, it is modified by the pairwise potentials relating one node to all its neighbors. With the reconstructed data, we are able to calculate the approximate gradient of each parameter, and perform the CD learning procedure. As mentioned in [28], the RBMs learn better if more steps of reconstruction are used before collecting the statistics. In practice, we sample 10 times using the mean field method before collecting the reconstructed data in each epoch. Due to the non-convex property of the objective function, different parameter initializations in RBM learning can end up with different models. For each class, several candidate models are learned from different initializations, and we select the one that can best discriminate current class from the others. For example, after learning model M1 for class C1 , given instances from all classes {I1 , I2 , · · · , IN }, we expect instance I1 to have greater likelihood on model M1 than all other instances ({I2 , · · · , IN }). In practice, we can sort the 9 likelihoods of instances from all classes, and choose the candidate model that minimizes the rank of the instances from class C1 . Notice that the likelihood is calculated according to Equation 5, given a single LRBM model, so for the comparison of the likelihoods, we don’t need to estimate the intractable partition function, since it is merely a constant. 3.4 Multi-class Classification For this work, RBM is used as a generative model for classification. A common strategy for training generative model for classification is to train multiple models for different classes and then evaluate the likelihood of each model during testing. In particular, given a set of properly learned LRBM’s {Mi }N i=1 for N classes, the basic idea for classification is to find the model that generates the largest likelihood given an instance of data V. i∗ = arg max p(V|Mi ) , i (13) where i∗ is the prediction of our classifier. The likelihood of a data instance is nt nt X 1X (vi − ai )T (vi − ai ) + viT Uvi 2 i=1 i=1 !! nh nt X X viT wij + log 1 + exp bj + − log Z . log p(V) = − (14) i=1 j=1 For brevity, we denote p(V) as p(V) = g(V) − log Z . (15) g(V) can be computed directly. However the partition functions Z are intractable for RBMs with large numbers of hidden and visible units. One possible solution is the Annealed Importance Sampling [29] to estimate the partition functions, and directly compare the likelihood. However, such estimation needs too many samples to obtain a good estimation of the partition function. Instead, for binary classification, Schmah et al. [30] propose a method to discriminatively estimate the difference of log-partition functions of two RBMs: cij = log Zi − log Zj . (16) We extend this method to multi-class classification. Ideally, cij = cik + ckj . But since the partition function is not directly computed, there is a slight error in the estimation. To address this issue, we perform a label ranking process [31] to make the final decision using a set of pairwise classifiers. In the simplest case, with all the pairwise classifiers fij , each prediction is interpreted as a vote for a class, and the class with the highest votes is proposed as a prediction. Alternatively, in confidence estimation, instead of a binary 10 result {0, 1}, a “soft” classifier is employed to map the difference in likelihood into the unit interval [0, 1]: Fij (V) = 1 . 1 + exp(−α(g(V|Mi ) − g(V|Mj ) − cij )) (17) Parameter α is searched in a range of [0.01, 100] to maximize the training accuracy. The output of such “soft” binary classifier can be interpreted as a confidence value in the classification: the closer the output Fij to 1, the stronger the decision of choosing class Ci is supported. Notice that Fij is not symmetrical. It only gives the preference toward i between i and j. The preference toward j is 1 − Fij . A valued preference relation matrix RV is defined for any query instance V:  Fij (V) if i < j RV (i, j) = . (18) 1 − Fij (V) if i > j In our approach, we evaluate the confidence score by summing up all the confidence value X SV (i) = Rv (i, j) , (19) j6=i where the index i goes through 1 to N , meaning the confidence score for one instance on different classes. The label of the model that associates with the highest score is proposed as the final decision. i∗ = arg max SV (i) . (20) i In general, if we have a N -class classification problem, pairwise classifiers are used to compute the confidence score. 4 n 2  = n(n − 1)/2 Experiments We evaluate our algorithm on two different areas that involve high-dimensional motion data: facial expression recognition and human action recognition. Two benchmark data sets are used in our experiment: the extended Cohn-Kanade data set (CK+) [2] and G3D data set [12]. We will also compare the proposed LRBM model with other related methods. 4.1 Facial Expression Recognition The Extended Cohn-Kanade data set (CK+) is a complete data set for action units and emotion-specified expressions. In this work, based on a sequence of landmarks on the human face, our goal is to classify it into one of seven expressions: angry, disgust, fear, happy, sadness, surprise and contempt. CK+ data set includes 593 sequences from 123 subjects. From all the sequences, 327 are associated with expression labels. In our experiment, these 327 sequences 11 300 250 200 150 100 50 0 0 50 100 150 200 250 300 Figure 4: The 15 points (circled dots) we selected as the input data for each time slice. Because of facial symmetry, we only select points on the left side of the face, and points along the vertical center line. Table 1: Confusion Matrix of the classification performance of LRBM on CK+ data set (%). For brevity, An, Di, Fe, Ha, Sa, Su, Co correspond to angry, disgust, fear, happy, sadness, surprise, contempt, respectively. An Di Fe Ha Sa Su Co An 97.8 8.5 0.0 0.0 10.7 0.0 5.6 Di 0.0 89.8 0.0 0.0 3.6 0.0 0.0 Fe 0.0 0.0 84.0 0.0 3.6 0.0 0.0 Ha 0.0 1.7 8.0 100.0 0.0 0.0 11.1 Sa 0.0 0.0 0.0 0.0 78.6 1.2 11.1 Su 2.2 0.0 8.0 0.0 3.6 97.6 0.0 Co 0.0 0.0 0.0 0.0 0.0 1.2 72.2 are used. Landmarks are the positions of 68 facial points from a detection and tracking procedure, which are provided by the database. As the pose of each subject varies slightly over time, we apply a pose rectification procedure to make each face a frontal one. Then, using the detected eyes and the interocular distance, we perform a geometric normalization by making the size of facial area the same throughout all subjects, and moving the centers of eyes to the same position. A smoothing filter is also used to reduce the noise in the trajectory. To reduce the feature dimension while keeping the useful information, as shown in Figure 4, we omit the outline landmarks and some other points, and select the more informative points, resulting in a 15-point feature for each frame, which is a 30d vector. The features selected are reasonable due to the property of facial symmetry. 12 Table 2: Classification accuracy of LRBM and other state-of-the-art approaches (%) An Di Fe Ha Sa Su Co Avg. 4.1.1 Lucey et al. [2] 75.0 94.7 65.2 100.0 68.0 96.0 84.4 83.3 Wang et al. [32] 91.1 94.0 83.3 89.8 76.0 91.3 78.6 86.3 LRBM 97.8 89.8 84.0 100.0 78.6 97.6 72.2 88.6 Classification Performance Intuitively, the spatial patterns are crucial in recognizing an expression. From a single face, human can identify the expression without any difficulty. But in order to explore the underlying facial dynamics as additional features for our system, we choose 10 frames from each sequence, representing the neutral look, intermediate expressions and the peak expression. Since our method captures global temporal patterns, a good alignment of different sequences is important to ensure recognition performance. Linear interpolation is used to get sequences with fixed length. The size of hidden layer is set as 400. To compare with baseline method, we use a leave-one-subject-out cross-validation configuration. Each time we generate the testing data from sequences of one subject. 25 other subjects form the validation set, and all the other subject form the training set. The performance of the algorithm is given in Table 1. As we only use the shape features (i.e. facial landmark positions), the comparison is only between methods using the same features. Our method’s hit rates for each expression are: Angry - 97.8%, Disgust - 89.8%, Fear - 84.0%, Happy - 100.0%, Sadness 78.6%, Surprise - 97.6%, Contempt - 72.2%. The average accuracy of all the expressions is 88.6%, which is more than 2% better than state-of-the-art method, as reported in [32]. In Table 2, we list the comparison of our model with some recent approaches. Our approach reaches the best accuracy on five expressions (angry, fear, happy, sadness and surprise) among all the methods listed. Although our model does not achieve the best accuracy for every expression, it does not fall behind very much on Disgust, but it fails sometimes on Contempt, because this is a subtle expression that our method needs more features to represent it accurately. In CK+ data set, contempt expression has only 18 samples. However, the average performance of the proposed method has been improved a lot. Another thing to mention is that the method in [2] uses both shape features and appearance features, while we only use the shape features. If we do not consider the spatial interaction within each frame, the data is simply aligned as a long vector to feed in the conventional RBM. Then the 13 Angry Disgust Fear 1 1 1 0.9 0.9 0.9 0.8 0.8 0.8 0.7 0.7 0.7 0.6 0.6 0.6 0.5 0.5 0.5 0.4 0.4 0.4 0.3 0.3 0.3 0.2 0.2 0.2 0.1 0.1 0 0 0.2 0.4 0.6 0.8 1 0 0 0.1 0.2 (a) 0.4 0.6 0.8 1 0 0 Happy Sadness 1 0.9 0.9 0.9 0.8 0.8 0.8 0.7 0.7 0.7 0.6 0.6 0.6 0.5 0.5 0.5 0.4 0.4 0.4 0.3 0.3 0.3 0.2 0.2 0.2 0.1 0.1 0.4 (d) 0.6 0.8 1 0 0 0.6 0.8 1 0.8 1 Surprise 1 0.2 0.4 (c) 1 0 0 0.2 (b) 0.1 0.2 0.4 (e) 0.6 0.8 1 0 0 0.2 0.4 0.6 (f) Figure 5: ROC curves of six emotion classifiers: (a) anger, (b) disgust, (c) fear, (d) happy, (e) sadness, (f) surprise. performance is 86.3%, which is less than the LRBM. This also proves the improvement of LRBM over RBM. We also compare our method with 4 best available results to date, including Time-series Kernels (Lorincz et al. [33]), spatio-temporal independent component analysis (Long et al. [34]), boosted dynamic features (Yang et al. [35]), and non-negative matrix factorization techniques (Jeni et al. [36]). These methods are different from the baseline method in [2], because contempt emotion is removed from the data set, and binary classification is performed for each expression, so for the classification of one expression, the other five expressions are negative samples. Following the same experiment settings, the result of classification is shown in Figure 5, and detailed comparison is in Table 3. The classification performance of our algorithm is close to, or even better than state-of-the-art method, with a better average accuracy. This demonstrate the effectiveness of the proposed LRBM model as both a binary classifier and a multi-class classifier. 14 Table 3: AUC values of LRBM and the competing methods: Time-series Kernels (Lorincz et al. [33]), spatio-temporal independent component analysis (Long et al. [34]), boosted dynamic features (Yang et al. [35]), and non-negative matrix factorization techniques (Jeni et al. [36]) Method Yang et al. [35] Long et al. [34] Jeni et al. [36] Lorincz et al. [33] LRBM An 0.973 0.933 0.989 0.991 0.992 Di 0.941 0.988 0.998 0.994 0.995 Fe 0.916 0.964 0.977 0.987 0.995 Ha 0.991 0.993 0.998 0.999 0.999 Sa 0.978 0.991 0.994 0.995 0.997 Su 0.998 0.999 0.994 0.996 0.995 Avg. 0.966 0.978 0.992 0.994 0.996 Table 4: Confusion Matrix of the classification performance using the feature learning method. An Di Fe Ha Sa Su Co 4.1.2 An 88.9 11.9 0.0 0.0 17.9 0.0 5.6 Di 11.1 86.4 4.0 0.0 0.0 2.4 5.6 Fe 0.0 0.0 36.0 1.4 3.6 0.0 5.6 Ha 0.0 1.7 12.0 97.1 0.0 0.0 27.8 Sa 0.0 0.0 0.0 0.0 57.1 0.0 5.6 Su 0.0 0.0 48.0 0.0 10.7 97.6 5.6 Co 0.0 0.0 0.0 1.4 10.7 0.0 44.4 Comparison with Feature Learning Method To comprehensively evaluate our method, we compare with a feature learning method, since RBMs are typically used for feature learning. A single RBM is trained on all classes of sequences using contrastive divergence. The size of hidden layer is the same as in the generative model. In the test process, given each observation sequence V, we compute the posterior probability P (hj |V) for each hidden variable hj according to Equation. 4, as the feature representation. This is reasonable because P (hj = 1|V) is the probability of a pattern being activated. A linear multi-class SVM is trained on such features for classification. The confusion matrix of this method is given in Table 4. For most expressions, the feature-based method is not as good as the generative model. The average recognition accuracy is 83.8%, which is approximately 5% below the performance of the generative model. This is reasonable, because the features learned from the model cannot capture the spatial relationship in each frame, which is specifically modeled in our model using the matrix U . If we add another latent layer, the classification performance only increases marginally by about 1%. 15 PunchRight 100 PunchLeft KickRight KickLeft Defend 100 100 100 100 Golf SwingFore 25.0 75.0 10.0 80.0 10.0 90.0 Serve Bowling 10.0 90.0 SwingBack 44.4 10.0 44.4 Aim 7.5 11.1 92.5 Walk 91.7 8.3 Run 100 Jump 33.3 Climb 100 Crouch 100 Drive 100 Wave 27.3 72.7 Flap 100 Clap t t t t d igh hLef Righ kLef efen c k hR D Kic nc Pun Kic Pu 66.7 100 lf e k g e Go gFor gBac Serv owlin in B in Sw Sw k Aim Wal e e h p n b p p Ru Jum Clim rouc Driv Wav Fla Cla C Figure 6: The confusion matrix of the proposed method on G3D data set 4.2 Human Action Recognition G3D data set is an action data set containing a range of gaming actions captured by Microsoft Kinect. The data set contains 10 subjects performing 20 gaming actions: punch right, punch left, kick right, kick left, defend, golf swing, tennis swing forehand, tennis swing backhand, tennis serve, throw bowling ball, aim and fire gun, walk, run, jump, climb, crouch, steer a car, wave, flap and clap. Synchronized video, depth and skeleton data are available in this data set. We only pick the skeleton data. To reduce the data dimension but keep the useful information, we use the 3D location information of four dominant joints (i.e. two hands and two feet). However the proposed approach can be applied to modeling more joints if we have enough training data. Before abstracting the features, we perform a normalization procedure to minimize the effect brought by difference in subjects’ body shapes. Specifically, we obtain the average bone lengths from all subjects in the training data, and then change the skeleton tracking results in every frame for each subject with the average shape. Therefore, every subject has the same body shape, and the cross subject distinction is alleviated. As the size of the visible layer of an RBM is fixed, linear interpolation is performed to convert all sequences into the same length (20 frames for each sequence). The 3D positions of the body joints along all three dimensions (x, y and z) form the 240-dimension input for the LRBM model. In the training phase, we set the size of hidden layer as 80. 16 Table 5: F1 score of LRBM and baseline model Action Fighting Golf Tennis Bowling FPS Driving Misc Avg. Bloom et al. [12] 70.46 83.37 56.44 80.78 53.57 84.24 78.21 72.44 LRBM 97.09 81.82 84.38 61.54 95.52 100.00 95.24 87.94 We use the action segmentation that is provided by the data and the same experiment configuration as in [12]. The data set is split by subjects where the first 4 subjects were used for training, 1 for validation and the remaining 5 subjects for testing. 4.2.1 Classification Performance The confusion matrix is given in Figure 6. The overall accuracy of LRBM is 90.5%. Our model encounters some failures for the actions of ThrowBowlingBall in Bowling category and Jump. In these actions, occasionally the body parts are occluded from the Kinect sensor, which will lead to estimated positions of joints. Then the positions of the two feet are significantly corrupted. As our method depends fully on the trajectories of joints, corrupted tracking results have a huge influence on the performance of LRBM. If we remove the pairwise potential in the visible layer and make the model a standard RBM, the accuracy drops to 84%, which proves the better performance of LRBM than RBM, as expected, due to modeling the spatial interactions. Comparison with the baseline model [12] is given in Table 5. Other than Bowling, performance on golf action is quite close to the baseline method, and on all the other actions, our approach outperforms the baseline method. The overall accuracy is increased by 15.5% in terms of F1 score. One reason of the improvement is that the method in [12] is based on 3 frames, hence can only capture local dynamics, while the proposed method is sequence based that can handle global dynamics. To further demonstrate the effectiveness of global dynamic model over local dynamic model, we implement a conditional RBM [21] and a hidden Markov model for action recognition. For the conditional RBM model, each frame depends on 3 previous frames. 20 models are trained for 20 actions. Classification is based on the likelihood of a target sequence on different models. Basically the local dynamic model (CRBM or HMM) models one frame at a time and the global model (RBM or LRBM) models all frames at the same time. Similar to the expression recognition case, the posterior probability of the 17 Table 6: Recognition accuracy of different dynamic models. The feature learning method is denoted as n-FL-SVM for the feature learning nature and SVM classifier, with n hidden layers. Method HMM 1-FL-SVM 2-FL-SVM CRBM [21] RBM LRBM Accuracy (%) 70.3 75.9 76.7 83.2 84.0 90.5 hidden variables P (hj |V) can be used as the features for classification. We implement the feature-based method using linear SVM as the classifier. Again, it does not perform well compare with other dynamic methods, mainly due to the reason that it cannot capture the local spatial patterns in each frame. Details are given in Table 6. 4.2.2 Handling Noisy and Missing Data One advantage of generative model is that they can handle noisy or missing data in the input. To demonstrate this point, we design two scenarios with randomly selected noisy or missing data: (a) Noisy data. For a randomly selected portion of data, we multiply the ground truth data by a Gaussian noise 1 + N (0, 1), where N (0, 1) is the normal distribution; (b) Missing data. For a randomly selected portion of data, we assume they are missing, and use the average of their neighbors as the approximation when computing the likelihood. The data under these scenarios are then fed into our generative model for classification purpose. We vary the portion of noisy or missing data from 0 to 50%, and observe the change of the classification accuracy. The details are given in Figure 7. In scenario (a), with the portion of noisy data increase, the performance almost decays linearly. In scenario (b), if the percentage of missing data is small (less than 30%), the average of its neighborhood is a decent estimation of the missing value, but with more data missing, the performance decays quite significantly. This is because several consecutive frames are missing at the same time, and the temporal information cannot be recovered effectively. One thing to notice is that with as much as 30% noisy or missing data, our algorithm can achieve 86% accuracy, only 4% below the noiseless situation, which demonstrates the effectiveness of our algorithm to handle noisy or missing data. 18 95 Noisy Missing Classification accuracy 90 85 80 75 70 0 5 10 15 20 25 30 35 40 45 50 Percentage of noisy or missing data Figure 7: The classification performance with noisy or missing data. 4.3 Complexity In the learning procedure of LRBM, we compute the data-dependent expectation and model-dependent expectation using matrix multiplication, so the computational complexity is linear with the size of the weight matrix (dnt × nh ) and iteration times (niter ). Thus, the computation complexity is O(dnt nh niter ). For facial expression recognition task, we set the epoch to 250, and the average running time for training one RBM is 1.77s, compared with 1.30s for standard RBM without local interaction. With 10 candidate models, it takes less than 5 min to train all the models. Experiments are performed on a desktop computer with an Intel i7 3.4GHz CPU and 8GB RAM. For testing, given a target sequence, we need to compute the unnormalized likelihood on each LRBM model using Equation 14, with computational cost O(nt d2 + nh nt d). Given the unnormalized likelihood and the relative partition functions, the classification needs n2 comparisons, therefore the overall classification complexity is O(n(nt d2 + nh nt d) + n2 ), which is linear in the dimension of the input sequence. If we linearly increase the length of the sequence by increasing the frame rate, the complexity is also increased linearly. For multi-class classification with n classes, the confidence value matrix SV is built with complexity O(n2 ). In typical computer vision applications, the number of classes cannot exceed the dimension of the data, which means n2 does not contribute much in the complexity, compared to the first term. To reduce the quadratic term O(n2 ) to a linear term O(n), Annealed Importance Sampling [29] can be used to estimate the partition function, thus the likelihood can be directly compared. However, the sampling method requires many samples to get a good estimation of the partition function, and the overall classification 19 complexity is not reduced significantly. Theoretically, the proposed method can be scaled up to data with thousands of dimensions, but much more training data will be needed since the number of parameters increases linearly with the size of input. 5 Conclusion In this paper, we study classification problem with multi-dimensional sequence data. To capture both the global dynamics and the local spatial interactions, we extend the conventional restricted Boltzmann machine by adding pairwise potentials in the energy function. An efficient mean field learning method is proposed to replace the reconstruction procedure in typical Contrastive Divergence learning, to estimate the additional parameters. Also, a novel label ranking approach of estimating the partition function of different LRBMs is presented to perform multi-class classification task. Experiments on two areas that involve multi-dimensional sequence data are performed to evaluate our approach. Results on two benchmark data sets prove the effectiveness of our algorithm. Using the generative model for data representation, we do not need to deal with a deep and complicated structure, as in feature learning, and do not need to carefully tune the parameters. This is a major advantage of our method compared with feature learning methods. However, one shortcoming is that is that the data sequences have to be aligned for our global model to function properly, and the classification complexity is quadratic in the number of classes. We will address these issues in future work. References References [1] J. Shotton, A. Fitzgibbon, M. Cook, T. Sharp, M. Finocchio, R. Moore, A. Kipman, A. Blake, Real-time human pose recognition in parts from single depth images, in: CVPR, IEEE, 2011, pp. 1297–1304. [2] P. Lucey, J. F. Cohn, T. Kanade, J. Saragih, Z. Ambadar, I. Matthews, The extended cohn-kanade dataset (ck+): A complete dataset for action unit and emotion-specified expression, in: CVPR Workshops, IEEE, 2010, pp. 94–101. [3] I. Laptev, On space-time interest points, International Journal of Computer Vision 64 (2-3) (2005) 107–123. [4] I. Laptev, M. Marszalek, C. Schmid, B. Rozenfeld, Learning realistic human actions from movies, in: CVPR, 2008, pp. 1–8. [5] F. Lv, R. Nevatia, Recognition and segmentation of 3-d human action using hmm and multi-class adaboost, ECCV (2006) 359–372. 20 [6] J. Wang, Z. Liu, Y. Wu, J. Yuan, Mining actionlet ensemble for action recognition with depth cameras, in: CVPR, IEEE, 2012, pp. 1290–1297. [7] I. Dagli, M. Brost, G. Breuel, Action recognition and prediction for driver assistance systems using dynamic belief networks, in: Agent Technologies, Infrastructures, Tools, and Applications for E-Services, Springer, 2003, pp. 179–194. [8] C. Sminchisescu, A. Kanaujia, D. Metaxas, Conditional models for contextual human motion recognition, Computer Vision and Image Understanding 104 (2) (2006) 210–220. [9] S. A. Eslami, N. Heess, J. Winn, The shape boltzmann machine: a strong model of object shape, in: CVPR, IEEE, 2012, pp. 406–413. [10] Z. Wang, G. Schalk, Q. Ji, Anatomically constrained decoding of finger flexion from electrocorticographic signals, in: NIPS, 2011. [11] S. Osindero, G. E. Hinton, Modeling image patches with a directed hierarchy of markov random fields, in: NIPS, 2007, pp. 1121–1128. [12] V. Bloom, D. Makris, V. Argyriou, G3d: A gaming action dataset and real time action recognition evaluation framework, in: CVPR Workshops, IEEE, 2012, pp. 7–12. [13] M. Carreira-Perpinan, G. Hinton, On contrastive divergence learning, in: Artificial Intelligence and Statistics, Vol. 2005, 2005, p. 17. [14] H. Lee, R. Grosse, R. Ranganath, A. Y. Ng, Convolutional deep belief networks for scalable unsupervised learning of hierarchical representations, in: Proceedings of the 26th Annual International Conference on Machine Learning, ACM, 2009, pp. 609–616. [15] R. Cutler, M. Turk, View-based interpretation of real-time optical flow for gesture recognition, in: Automatic Face and Gesture Recognition, IEEE, 1998, pp. 416–421. [16] G. Yang, Y. Lin, P. Bhattacharya, A driver fatigue recognition model based on information fusion and dynamic bayesian network, Information Sciences 180 (10) (2010) 1942–1954. [17] B. Packer, K. Saenko, D. Koller, A combined pose, object, and feature model for action understanding, in: CVPR, IEEE, 2012, pp. 1378–1385. [18] G. Hinton, R. Salakhutdinov, Reducing the dimensionality of data with neural networks, Science 313 (5786) (2006) 504–507. [19] V. Nair, G. Hinton, 3-d object recognition with deep belief nets, NIPS 22 (2009) 1339–1347. 21 [20] Y. Wu, Z. Wang, Q. Ji, Facial feature tracking under varying facial expressions and face poses based on restricted boltzmann machine, in: CVPR, IEEE, 2013. [21] G. Taylor, G. Hinton, S. Roweis, Modeling human motion using binary latent variables, NIPS 19 (2007) 1345. [22] A. Kae, K. Sohn, H. Lee, E. Learned-Miller, Augmenting crfs with boltzmann machine shape priors for image labeling, in: Computer Vision and Pattern Recognition (CVPR), 2013 IEEE Conference on, IEEE, 2013, pp. 2019–2026. [23] A. Kae, B. Marlin, E. Learned-Miller, The shape-time random field for semantic video labeling, in: Computer Vision and Pattern Recognition (CVPR), 2013 IEEE Conference on, IEEE, 2014. [24] I. Sutskever, G. E. Hinton, Learning multilevel distributed representations for high-dimensional sequences, in: Artificial Intelligence and Statistics, 2007, pp. 544–551. [25] H. Larochelle, Y. Bengio, Classification using discriminative restricted boltzmann machines, in: ICML, ACM, 2008, pp. 536–543. [26] J. Louradour, H. Larochelle, Classification of sets using restricted boltzmann machines, in: UAI, IEEE, 2011. [27] G. Hinton, Training products of experts by minimizing contrastive divergence, Neural computation 14 (8) (2002) 1771–1800. [28] G. Hinton, A practical guide to training restricted boltzmann machines, Momentum 9 (2010) 1. [29] R. Salakhutdinov, I. Murray, On the quantitative analysis of deep belief networks, in: Proceedings of the 25th international conference on Machine learning, ACM, 2008, pp. 872–879. [30] T. Schmah, G. E. Hinton, S. L. Small, S. Strother, R. S. Zemel, Generative versus discriminative training of rbms for classification of fmri images, in: NIPS, 2008, pp. 1409–1416. [31] E. Hüllermeier, J. Fürnkranz, W. Cheng, K. Brinker, Label ranking by learning pairwise preferences, Artificial Intelligence 172 (16) (2008) 1897– 1916. [32] Z. Wang, S. Wang, Q. Ji, Capturing complex spatio-temporal relations among facial muscles for facial expression recognition, in: CVPR, 2013. [33] A. Lorincz, L. A. Jeni, Z. Szabó, J. F. Cohn, T. Kanade, Emotional expression classification using time-series kernels, in: Computer Vision and Pattern Recognition Workshops (CVPRW), 2013 IEEE Conference on, IEEE, 2013, pp. 889–895. 22 [34] F. Long, T. Wu, J. R. Movellan, M. S. Bartlett, G. Littlewort, Learning spatiotemporal features by using independent component analysis with application to facial expression recognition, Neurocomputing 93 (2012) 126– 132. [35] P. Yang, Q. Liu, D. N. Metaxas, Boosting encoded dynamic features for facial expression recognition, Pattern Recognition Letters 30 (2) (2009) 132–139. [36] L. A. Jeni, J. M. Girard, J. F. Cohn, F. De La Torre, Continuous au intensity estimation using localized, sparse facial feature space, in: Automatic Face and Gesture Recognition (FG), 2013 10th IEEE International Conference and Workshops on, IEEE, 2013, pp. 1–7. 23
1cs.CV
2013 IEEE International Conference on Computer Vision Slice Sampling Particle Belief Propagation Oliver Müller, Michael Ying Yang, and Bodo Rosenhahn Institute for Information Processing (TNT), Leibniz University Hannover, Germany arXiv:1802.03275v1 [cs.CV] 9 Feb 2018 {omueller, yang, rosenhahn}@tnt.uni-hannover.de Abstract #1 ··· Inference in continuous label Markov random fields is a challenging task. We use particle belief propagation (PBP) for solving the inference problem in continuous label space. Sampling particles from the belief distribution is typically done by using Metropolis-Hastings (MH) Markov chain Monte Carlo (MCMC) methods which involves sampling from a proposal distribution. This proposal distribution has to be carefully designed depending on the particular model and input data to achieve fast convergence. We propose to avoid dependence on a proposal distribution by introducing a slice sampling based PBP algorithm. The proposed approach shows superior convergence performance on an image denoising toy example. Our findings are validated on a challenging relational 2D feature tracking application. #467 ··· ··· Figure 1. Relational 2D feature tracking example. pend on a proposal distribution which is difficult to tune. We show the superiority of our method theoretically on a simplified toy application on image denoising. Our findings are then verified on a complex 2D relational feature tracking application as shown in Fig. 1. We furthermore provide a publicly available database of image sequences for feature tracking applications including manually labeled groundtruth data [11]. The rest of the paper is organized as follows. Section 2 provides an overview of related work. Section 3 introduces notations and definitions used throughout the paper and gives a short introduction to slice sampling. Our proposed approach is described in detail in Sect. 4. In Sect. 5 we present a thorough evaluation of our method compared to the state-of-the-art and propose a 2D relational feature tracking application. We conclude our findings in Sect. 6. 1. Introduction Markov Random Fields (MRFs) are a powerful tool for modeling relational dependencies among observations. Inference in such models is an inherent problem which has been widely addressed in the past. MRFs, and hence its inference methods, can be classified in two categories: discretely and continuously labeled problems. Numerous optimization approaches for discrete labels have been proposed, from binary labeled Graph Cuts [4], to multi-label tree reweighted message passing [17, 7]. In this paper, we deal with continuous labeled MRFs where we use a particle belief propagation (PBP) approach [6]. The efficiency of such particle based approaches highly depends on the sampling scheme used to explore the label space. Previous approaches use Metropolis-Hastings (MH) Markov chain Monte Carlo (MCMC) methods for particle sampling. The performance of these methods depends on a carefully designed proposal distribution. Contributions. We propose a novel sampling technique for PBP based on slice sampling [12]. This method exploits the structure of the PBP message passing equations for direct sampling from the target distribution and does not de1550-5499/13 $31.00 © 2013 IEEE DOI 10.1109/ICCV.2013.144 #377 2. Related Work Most works on MRF optimization specialize on a discrete label space [4, 17, 7]. Often such approaches are hard to apply on tasks where a continuous label space would be a more natural choice, such as feature tracking with relational constraints [14, 9]. Loopy belief propagation is a prominent method using a local message passing mechanism for coordinating the optimal labeling of neighboring nodes. These methods work on discrete label spaces. The computational complexity is O(n2 ) over the number of discrete labels n, making computations with many labels for approximating near-continuous models intractable [16]. Recently, message passing approaches working in continuous rather than discrete label space were proposed 1129 b(xt ) t Ms→t (xt ) Mt→s (xs ) s with a unary potential function ψs (xs ) and a binary potential function ψs,t (xs , xt ). Then p(x) ∝ exp [−E(x)] defines a Markov random field (MRF). We consider the problem of computing the maximum p(x )1 . marginals: μ(xs ) = max  b(xs ) b(xs ) u Graphical Model (exemplary) mcmc sampling xs x |xs =xs 3.2. Max-Product Particle Belief Propagation Figure 2. Particle Belief Propagation framework. Left: Message passing mechanism. Right: MCMC particle sampling of the belief b(xs ) with an exemplary MCMC sampling chain of one particle (blue) and its corresponding histogram (red). In the following we summarize the max-product particle belief propagation algorithm [8, 3]. The energy term E(x) is approximated by particles such that the label space Ls of each node s in the MRF is represented by a set of particles (1) (p) Ps = {xs , . . . , xs }, where p is the number of particles (i) per node. Then the estimated belief bns (xs ) or log disbe(i) (i) lief Bsn (xs ) = − log(bns (xs )) of node s at iteration n is calculated as follows [3]:  (i) (i) (i) n Bsn (xs ) = ψs (xs ) + t∈Ns Mt→s (xs ), (2) [6, 8, 13, 16]. These approaches use MCMC methods to approximate the message distributions. To the best of our knowledge, all previously proposed MCMC based belief propagation methods use Metropolis-Hastings (MH) sampling. This sampling strategy consists of two steps: (a) sampling a candidate particle from an easy to sample proposal distribution, and (b) accept or reject the candidate depending on a transition probability [18]. Applying this sampling technique involves a careful design of the proposal distribution, which is a compromise between exploring the label space (using a broad proposal distribution) and maximizing the transition acceptance ratio (minimize sample moves) at the same time. Throughout the paper we show that considering alternative sampling techniques can be advantageous. We propose to use slice sampling [12] instead of MH, rendering proposal distribution selection obsolete in the context of PBP. To demonstrate superior performance of our method on a real world problem we propose a relational feature tracking application inspired by [9, 14] in the experiment section. Some related works such as [15, 5] propose to formulate feature tracking as a discrete labeling problem and use global optimization algorithms (i.e. linear programming or dynamic programming). Such approaches need some sort of label pruning in order to keep computational complexity low. Closely related methods use belief propagation combined with particle filtering [19, 9, 14], but still use proposal distributions for particle perturbation which introduces sensible optimization parameter tuning. n where the messages Mt→s (xs ) for xs ∈ Ps from node t to node s are: n−1 n Mt→s (xs ) = min [ψs,t (xs , xt )+Btn−1 (xt )−Ms→t (xt )]. xt ∈Pt (3) Note that the log disbelief Bsn (xs ) and the messages n Mt→s (xs ) can be calculated for all continuous values xs ∈ Ls rather than only on the particle set Ps . On the other hand, the messages from node s to node t are approximated only using the particles xt from the particle set (1) (p) Pt = {xt , . . . , xt } of node t. Messages and log disbeliefs are calculated iteratively for n = 1, . . . , N iterations. An estimate of the most likely configuration can be obtained with x̂s = arg min BsN (xs ). xs The main issue in PBP lies in how to sample new particles xns ∼ Bsn (xs ). Typically, the Metropolis-Hastings (MH) MCMC method is used. This method requires a proposal distribution q where new particles can be easily sampled from. Typically a Gaussian function q = pσ with a predefined standard deviation σ is used. Figure 2 shows a schematic overview of the PBP framework. Algorithm 1 summarizes the Metropolis-Hastings based max-product particle belief propagation algorithm (MH - PBP). Typically, q needs to be carefully adjusted to the true belief distribution. This introduces a dependency on prior knowledge about how the labels are distributed in the label space. In the following we propose to replace the MH sampling step by a slice sampling approach which does not depend on proposal distribution selection. 3. Definitions and Notation 3.1. Markov Random Field Let V be a set of nodes and Ns ⊂ V the set of neighboring nodes to s ∈ V. For every node s there  is a label xs from the label space Ls . The product L = s∈V Ls is the space of configurations x = {xs }s∈V . A Markov random field potential energy is given by:    E(x) = ψs (xs ) + ψs,t (xs , xt ) (1) s∈V (4) 1 Backtracking can be used to compute the arg max p(x) from the max-marginals [8]. s∈V t∈Ns x 1130 MAP -configuration x∗ = Algorithm 1 MH - PBP [8, 3] p(x) (i) {xs }i=1,...,p , proposal distribuInput: Initial set of particles: tion pσ (i) 0 1: Initialize the messages Mt→s (xs ) and log disbelief Bs0 (xs ) with zero ∀s, t 2: for BP iteration n = 1 to N do 3: for each node s and each particle i = 1, . . . , p do (i)0 (i) 4: Initialize sampling chain xs ← xs 5: for MCMC iteration m = 1, . . . , M do (i)m (i)m−1 6: Sample x̄s ∼ pσ (x | xs ) from proposal distribution pσ (i)m 7: Calc. belief Bsn (x̄s ) from Eqs. (2), (3) 8: Sample u ∼ U[0,1] (u) (i)m (i)m ) − log(u) then 9: if Bsn (x̄s )<Bsn (xs (i)m (i)m 10: Accept: xs ← x̄s 11: end if 12: end for (i) (i)M  13: xs ← x s 14: end for 15: Normalize messages and beliefs 16: end for xm−1 m u1 .. . m uL x (5) ∼ q(x | u ) = UA (x), ∼ q(uL | xm−1 ) = U[0,fL (xm−1 )] (uL ) (10) ∼ q(x | m m u1 , . . . , u L ) = UAm (x), (11) 4. Slice Sampling Particle Belief Propagation Our main contribution is presented in this section. We propose to sample particles from the belief b(xs ) using slice sampling rather than Metropolis-Hastings sampling. For applying the slice sampler, the sampling interval A(i)m needs to be determined for the ith particle of node s and for the mth MCMC iteration which we can uniformly sam(i)m from. The superscripts (i)m are ple the particle xs omitted in the following for better readability. The goal is to determine the sampling interval A. Given the potential functions ψs (xs ) and ψs,t (xs , xt ), it is assumed that the intervals Aψs (ū) = {xs ; ψs (xs ) ≤ ū} and Axψts,t (ū) = {xs ; ψs,t (xs , xt ) ≤ ū} (12) (13) can be computed analytically. Note that computations are done in negative log space, thus a slice interval {x ; f (x) ≥ u} is transformed to {x ; − log(f (x)) ≤ ū}, where ū is the negative logarithm of a uniformly sampled value. The final sampling interval A can be computed from these intervals as shown below. If the intervals cannot be computed analytically then an approximated interval à may be still computed and rejection sampling can be applied [1]. Sampling is then done by uniformly drawing the auxiliary variable u (defining the slice) and given this, uniformly drawing the new sample from an interval A defined over u as follows: x (9) m given an initial sample x . Note that in the PBP framework, there is a MCMC (i)m (i) sampling chain {xs }m=1,...,M for each particle xs . MCMC sampling could be done using several sampling techniques such as Metropolis-Hastings (MH) or Gibbs sampling (provided the conditional distributions are easy to sample from). Metropolis-Hastings sampling has the drawback of requiring a proposal distribution. Choosing the proposal distribution is very often a difficult task and introduces a compromise between reducing the rejection rate and obtaining large random moves [1]. In slice sampling, an auxiliary variable u ∈ R is introduced and the target distribution q(x) is extended to  1 if u ∈ [0, q(x)] (6) q ∗ (x, u) = 0 otherwise m m ∼ q(u1 | xm−1 ) = U[0,f1 (xm−1 )] (u1 ) where Am = {x ; fl (x) ≥ ul , l = 1, . . . , L} [1]. The main difficulty lies in determining the interval A. Fortunately it turns out, that in the max-product particle belief propagation framework the sampling interval A can be determined efficiently as shown in the following section. 0 m x where UI is the uniform distribution over an interval I and A = {x; q(x) ≥ um }. Figure 3 shows an exemplary slice sampling step. Assume that q(x) can be decomposed in L functions L fl (x) such that q(x) ∝ l=1 fl (x). Then we can sample over q(x) by introducing L auxiliary variables u1 , . . . , uL : In this section we briefly summarize the concept of slice sampling [12, 1] which is defined in a general MCMC sampling framework. Suppose we are given a distribution q(x) and want to sample from this distribution, i.e. MCMC sampling of M samples x1 , x2 , . . . , xM  : um ∼ q(u | xm−1 ) = U[0,q(xm−1 )] (u) xm Figure 3. Slice Sampling [12, 1] 3.3. MCMC Slice Sampling xm ∼ q(x | xm−1 ), A um (7) (8) 1131 √ solution Aφs (ū) = {xs : (xs −ds )2 ≤ ū} = [ds − ū, ds + √ ū]. Similarly, the closed form √ solution for √ φs,t (xs , xt ) = (xs − xt )2 is Axφts,t (ū) = [xt − ū, xt + ū]. Multidimensional Bounds. In order to deal with multidimensional label spaces, i.e. Ls ∈ Rd for d > 1, we propose to randomly sample one dimension in each MCMC step and slice sample on this dimension while the other dimensions are held fixed. Analytic Bounds Calculation. Assume the unary and/ or binary potential functions ψs and ψst are given as an analytic function. Then one can use standard computer algebra solvers for defining Aψs (u) and/or Axψts,t (u). We have implemented our S - PBP framework in MATLAB® with MEX and use the MATLAB® -MUPAD® interface to solve the inequalities automatically. This way no manual work has to be done. Algorithm 2 S - PBP (i) Input: Initial set of particles: {xs }i=1,...,p (i) 0 1: Initialize the messages Mt→s (xs ) and log disbelief Bs0 (xs ) with zero ∀s, t 2: for BP iteration n = 1 to N do 3: for each node s and each particle i = 1, . . . , p do (i)0 (i) 4: Initialize sampling chain xs ← xs 5: for MCMC iteration m = 1, . . . , M do (i)m−1 6: Sample ūl = Fl (xs ) − log(ul ) where ul ∼ U[0,1] (u) for l = 0, . . . , |Ns | 7: Compute A(i)m from Eqs. (15), (16), (17) (i)m 8: Sample x̄s ∼ UA(i)m (x) (i)m 9: Calc. belief Bsn (x̄s ) from Eqs. (2), (3) (i)m ) ≤ ūl for l = 0, . . . , |Ns | then 10: if Fl (x̄s (i)m (i)m 11: Accept: xs ← x̄s 12: end if 13: end for (i) (i)M  14: xs ← x s 15: end for 16: Normalize messages and beliefs 17: end for 5. Experiments 5.1. Image Denoising For analyzing the random walk behaviour of our method we have chosen the application of image denoising due to its relatively simple model structure. The basic image denoising model is as follows: The log disbelief can be decomposed as follows: B(xs ) = |Ns | l=0 Fl (xs ) (14) ψs (xs ) = θ1 (xs − ds )2 , with F0 (xs ) = ψs (xs ) and Fj (xs ) = Mt(j) →s (xs ) where t(j) is the j-th neighbor of s. From this follows the decomposition of the sampling interval A= |Ns |  Al , l=0 with Al = {x ; Fl (x) ≤ ūl }. ψs,t (xs , xt ) = θ2 min{θ3 , (xs − xt )2 }. For minimizing particle noise in the final estimation result an annealing scheme is used where the target belief (i) distribution is modified to bns (xs )1/Tn , where Tn = T0 · n/N is the temperature at PBP iteration n, T0 is the (TN /T0 ) start temperature, and TN the end temperature. Given this annealing scheme the temperature is successively reduced for each new iteration n. The evaluation was done on an example image as shown in Fig. 4. The training and testing sets each include 10 noisy image instances with Gaussian noise standard deviation σ = 0.05 (where image intensity ∈ [0, 1]). Training of the parameter vector θ = {θ1 , θ2 , θ3 } is done by minimizK (i) 1 (i) ing the empirical risk R(θ) = K i=1 L(xθ , y ) given 2 (i) the loss function L(x, y) = x − y 2 where {y , d(i) } is the training data pair with groundtruth y(i) and noisy obser(i) vation d(i) . xθ is the MAP estimate given d(i) and the parameter θ. Learned parameters are θ1 = 0.756, θ2 = 1.170, θ3 = 0.0059. Comparing S - PBP with MH - PBP. We further compared the efficiency of the slice sampling method to the Metropolis-Hastings sampling applied on the image denoising problem. For the experimental setup we use N = 100 PBP iterations, p = 5 particles, and a temperature schedule of T0 = 1 to TN = 10−4 . An MCMC chain of M = 500 samples is generated for each particle and (15) Using the definitions of Eqs. (2, 3), we obtain for Al : A0 = Aψs (ū1 ) Aj = {xs ; Mt(j) →s (xs ) ≤ ūj } = {xs ; min Gxj t (xs ) ≤ ūj } xt ∈Pt  {xs ; Gxj t (xs ) ≤ ūj } = (16) xt ∈Pt =  xt ∈Pt Axψts,t (ūj − Bt (xt ) + Ms→t (xt )), (18) (17) n−1 (xt ). where Gxj t (xs ) = ψs,t (xs , xt ) + Btn−1 (xt ) − Ms→t This result shows that A only depends on the given intervals Aψs (ū) and Axψts,t (ū) which are defined by the unary and binary potential functions ψs and ψs,t . Algorithm 2 summarizes the proposed method. We further refer to the proposed technique as S - PBP (slice sampling particle belief propagation). Example. Consider a quadratic unary potential function φs (xs ) = (xs − ds )2 . Then Aφs (ū) has the closed form 1132 Empirical Risk Autocorrelation ρk Figure 4. Denoising example: Groundtruth (left), noisy input example (middle left), reconstruction with MH - PBP (middle right), reconstruction with our proposed S - PBP method (right). 0.4 1 0.8 0.6 0.4 0.2 0 −0.2 mh-pbp s-pbp 1 5 10 Order k 15 20 Figure 6. Comparison of S - PBP and MH - PBP at different PBP iterations (dotted n = 30, dashed n = 50, and solid n = 70) using an annealing schedule. s-pbp mh-pbp 0.3 0.2 0.1 5.2. Relational Feature Tracking bp 0.1 0.3 0.5 0.7 0.9 1.0 1.5 2.0 s-p σ= σ= σ= σ= σ= σ= σ= σ= mh mh mh mh mh mh mh mh We propose to apply our S - PBP algorithm on a 2D relational feature tracking system inspired by [9, 14] as a more complex application. Figure 5. Comparison of the empirical risk for S - PBP and MH - PBP with different proposal distributions. 5.2.1 in each PBP iteration. The iteration numbers are chosen to be more than sufficiently large in order to guarantee convergence and to collect statistical information in the MCMC chains in steady-state situations. For the MH - PBP proposal distribution the family of Gaussian distributions pσ (x | xm−1 ) = (2πσ 2 )−0.5 · exp[−0.5(x − xm−1 )2 · σ −2 ] is used. In order to provide a fair comparison the proposal distribution is adapted to the current temperature by using pσ (x | xm−1 )1/Tn instead. Figure 5 shows a comparison of the empirical risk for different MH - PBP proposal distributions. For σ > 0.7 the empirical risk stays nearly at the same level and thus we selected σ = 0.7 for further experiments. Another observation is that S - PBP outperforms MH - PBP in terms of minimal empirical risk. This is because the reconstructed images with MH - PBP have always much higher noise than images reconstructed with S - PBP. This effect can be significantly reduced by averaging over particles instead of only selecting the best one as stated in Eq. (4). For comparing the random walk behavior of the MCMC sampling chains from S - PBP and MH - PBP, the normalized autocorrelation function M −k m (x − x̄)(xm−k − x̄) ρk = m=1M −k , (19) m − x̄)2 m=1 (x  m 1 where x̄ = M x , is used [18]. Only the last 50 % of the MCMC chain is considered to skip any burn-in phase. Figure 6 shows a comparison of the first 20 kth order autocorrelation of S - PBP and MH - PBP at different PBP iterations n (and thus at different temperatures Tn ). It can be observed that the MH - PBP method produces a much higher autocorrelation than the S - PBP method, thus the MCMC chain mixing behaviour of S - PBP outperforms MH - PBP. Tracker Model The proposed feature tracker uses a pairwise MRF model. The model is separated into two parts: (a) the unary potentials are derived from a feature patch matching model, and (b) the binary potentials encode the relative positioning of the features to each other. The label space of the MRF is the space of feature poses including the local central patch position, patch rotation, and scale. The proposed MRF model is as follows:    E(x) = ψs (xs ) + α · ψs,t (xs , xt ), (20) s∈V s∈V t∈Ns where the unary potential function ref ψs (xs ) = χ2 (HOGIn (ps , os ) − HOGI ref (pref s , os )) (21) is the Chi-square distance of HOG features [10] of a patch at position ps ∈ R2 of the current image In and orientation os ∈ R2 , where xs = {ps , os } and a reference image ref I ref at reference position pref s and orientation os . The orientation vector os encodes two aspects: the feature patch rotation (rotation of os , i.e. atan2(os )) and feature patch scale (length of os , i.e. os 2 ). The binary potential ψs,t (xs , xt ) is as follows: ψs,t ( · ) = pt − ps − Rs dst 22 + ps − pt − Rt dts 22 2 · dst 22 (22) ref where dst(ts) = pref t(s) −ps(t) and Rs(t) = [ox,s(t) , −oy,s(t) ; oy,s(t) , ox,s(t) ] is a 2 × 2 rotation and scale matrix. The proposed binary potential function models the surrounding of each feature point as a weak-perspective model and 1133 5.2.3 transforms its neighbor points (with respect to the reference frame) according to a similarity transformation (consisting of translation, rotation, and scaling). The scalar parameter α > 0 is a weighting factor determining the “stiffness” of the feature mesh balancing between feature point independence (α → 0; i.e. multi-target tracker) and rigid single object tracking. Tracker Evaluation Test sequences. We use four challenging test sequences (PAPER 1, PAPER 2, FACEOCC 1, and FACEOCC 2) to evaluate our proposed method. The self-made PAPER 1 and PAPER 2 sequences were chosen to challenge the methods on a fast moving deformable object under major scale changes. The sequences have a spatial resolution of 960 px × 540 px and consist of 563 and 726 frames respectively. The captured object (paper) is textured with patches of similar appearance and shape. The similar appearing features were chosen to stress the relational structure of our tracker model. Thus the only way to distinguish the features is by considering the relative position of the feature patches to each other. The PAPER 1 sequence consists of five feature patches with a carefully chosen position pattern which allows unique identification of the features by only having knowledge about the relative distances of the features to each other. The PAPER 2 sequence is more challenging since the number of features is increased to 70 and the features are arranged in a grid structure allowing local relational ambiguities. The FACEOCC 1 and FACEOCC 2 sequences from [2, 5] are designed for evaluating object trackers under major occlusions. The sequences have a spatial resolution of 352 px × 288 px (FACEOCC 1) and 320 px × 240 px (FACEOCC 2) and both consist of 888 frames each. While the FACEOCC 1 sequence has only slow object movements, but showing substantial occlusions, the FACEOCC 2 sequence challenges with fast movements, illumination changes, object rotation and substantial occlusions. The sequences and tracking results are shown in Fig. 7. Parameter selection. Parameter selection can be split into two parts. The first part consists in MRF model parameter selection. Since the proposed model is relatively robust to changes in α, we set α in an ad-hoc fashion for each sequence as follows: α = 20 for PAPER 1 and PA PER 2 and α = 50 for FACEOCC 1 and FACEOCC 2. For the HOG features we set the smallest scale pyramid resolution to 50 px × 50 px. This leads to 3 scales for FACEOCC 1 and FACEOCC 2 and 4 scales for PAPER 1 and PAPER 2. The second part is parameter selection for the PBP framework. We use N = 20 PBP iterations and p = 10 particles for each node. With this setting both algorithms (MH - PBP and S - PBP) converge well. Since we compare the overall sampling behaviour of the proposed method rather than the belief propagation convergence behaviour selecting these parameters should be uncritical. Evaluation metrics. We consider the distance εtrack between the estimated feature position and the groundtruth (manually labeled) position as a quality measure. From this measure we derive two metrics: The rooted mean of squared distances (RMSD) and a quantile box-plot (10%, 25%, 50%, 75%, and 90% quantiles). While the first metric is very sensitive to outliers, the second metric provides more infor- 5.2.2 Tracker Pipeline A practical application requires some common modifications of the basic tracker pipeline in Sect. 5.2.1. The modifications include an additional particle resampling step, where for each frame the initial set of particles are sampled (i) with replacement from the set of particles {xs }i=1,...,p (i) from the previous frame with probability bN s (xs ). For the tracker to be able to deal with fast moving objects, a resolution pyramid approach is applied. The resolution pyramid is only applied to the unary potential function, i.e. the feature descriptor is a concatenation of HOG descriptors of patches with the same center position but differing spatial resolution. For each resolution pyramid level (scale) the image is downsampled by a factor of 0.5 using bicubic interpolation. Slice sampling. For the slice sampling approach we need to define the boundary functions Aψs (u) and Axψts,t (u). Since ψs,t is given as an analytic function we can use our automatic inequality solver as described in Sect. 4. An analytic description of the unary potential is not available thus we have to define the boundary manually. We choose to set Aψs (u) to the whole image space for ps , i.e. ps ∈ [1, W ] × [1, H], where W and H are the image width and height respectively, and to restrict os to os ∈ [−10, 10] × [−10, 10]. This way it is ensured that the sampling space is large enough. On the other hand, particles sampled outside the true (sub-)bounds are automatically rejected by the algorithm. Metropolis-Hastings sampling. In order to provide a fair comparison of our slice sampling approach to the stateof-the-art MH - PBP approach, the design of the proposal distribution has to be done very carefully. We propose to use a 4D Gaussian distribution with a covariance matrix Σ combined with a suitable coordinate transformation to ensure a well-mixing random walk behaviour. The label space can be divided into two parts, the feature position ps ∈ R2 and orthogonal feature transformation os ∈ R2 . The proposal m m−1 m−1 ) = N (ps , I2×2 · distribution for ps is p(ps | ps σxy ), where N (μ, Σ) is a Gaussian pdf with mean μ and covariance Σ. I2×2 is the 2 × 2 identity matrix. The vector os is sampled analogously, but in the polar coordinate system with covariance matrix Σpolar = [σr2 , 0; 0, σφ2 ], where σr2 is the variance for the radius and σφ2 the variance for the angle. Finally we have to carefully tune the three parameters σxy , σr , and σφ . 1134 Figure 7. Datasets and tracking results for our proposed method: PAPER 1, PAPER 2, FACEOCC 1, FACEOCC 2 (from left to right). First two rows: successful tracking; third row: tracking failure cases. Note that the estimation error varies highly, where very high values (usually > 15 px) indicate a tracking failure. In order to visualize both the performance differences for nearoptimal parameters and tracking failures, the error values below and above the 15 px mark are shown with a differing vertical axis scaling. In Fig. 9, only a comparison for PA PER 1 and FACEOCC 1 is shown. The other two sequences perform similarly. It can be observed that the tracking performance of MH - PBP strongly depends on careful parameter selection. The parameter σxy has the highest impact on the tracking performance and the optimal parameter value varies strongly between sequences (σxy = 5 for PAPER 1 and σxy = 0.5 for FACEOCC 1). Selecting σxy is a compromise between allowing fast object motions and reducing overall localization noise. Selecting σr and σφ has analogous effects on changes in object scaling and rotation. This way one has to incorporate prior knowledge about the object motion in order to obtain good tracking results using MH - PBP . Tracked sequences and further comparisons are provided in the supplemental material. The computational complexity for MH - PBP is O(N SpM (1 + V p)) and for S - PBP is O(N SpM (3 + 2V p)) given the number of PBP iterations N , nodes S, particles p, MCMC iterations M and the average number of neighbors per node V . This indicates a doubling of computation time of S PBP compared to MH - PBP which is due to the overhead introduced for computing the interval bounds A. A look at the CPU times using fixed parameters for both algorithms (M = 5, p = 10, N = 20) verifies this finding: FACEOCC: 0.69 s/frame (S - PBP) vs. 0.33 s/frame (MH - PBP) ; PAPER 2: 7.43 s/frame vs. 3.66 s/frame. Nevertheless we have shown mation about the overall error distribution. Discussion. The evaluation results comparing S - PBP with MH - PBP using different MCMC iterations are shown in Fig. 8. For MH - PBP, the MH sampling parameters {σxy , σr , σφ } are chosen (from the set {0.1, 0.2, 0.5, 1.0, 2.0, 5.0} × {0.01, 0.02, 0.05, 0.10, 0.20, 0.50} × {0.01, 0.02, 0.05, 0.10, 0.20, 0.50}) such that the RMSD is minimized. Note that for S - PBP such parameter tuning is not necessary. We have evaluated the tracking performance for different MCMC iterations M = 2 to 5. The box plots in Fig. 8 show that S - PBP outperforms or performs equally well as MH PBP for all tested sequences except for sequence PAPER 2 with only 2 (and 3) MCMC iterations where both methods fail. This is mainly due to a much higher overall sampling noise of the MH - PBP method compared to S - PBP. We observed that the sampling noise of S - PBP is much less than with MH - PBP at feature positions with high confidence (i.e. high belief). On the other hand the sampling noise of S - PBP increases for uncertain feature positions. The RMSD in sequence PAPER 2 and FACEOCC 1 is higher for S - PBP than for MH - PBP due to temporal tracking failures. These tracking failures are caused by strong local deformations or by occlusions of many feature points. Typical tracking failures are depicted in the bottom row of Fig. 7. It can be observed in such cases that S - PBP leads to much higher tracking error than MH - PBP due to broader particle sampling in uncertain feature positions. Figure 9 shows an evaluation of MH - PBP under differing (non-optimal) sampling parameters. To this end, we vary each of the three sampling parameters individually and let the other two parameters stay fixed at their optimal values. 1135 compute the slice sampling bounds, provided the unary and binary potentials are defined by analytic functions or can be bounded by one. We showed on a toy example that S - PBP outperforms MH - PBP in terms of MCMC chain mixing performance. Furthermore we showed that our approach performs equally well or better than MH - PBP on challenging relational feature tracking sequences. 2 3 4 6 4 2 εtrack 100 εtrack rmsd paper1 40 20 0 50 mh-pbp s-pbp M =2 5 M mh-pbp s-pbp M =5 2 3 4 50 0 5 M 4 3 2 1 0 εtrack 100 εtrack rmsd paper2 60 40 20 0 mh-pbp s-pbp M =2 Acknowledgements The work is funded by the ERC-Starting mh-pbp s-pbp M =5 Grant (DYNAMIC MINVIP). The authors gratefully acknowledge the support. 2 0 2 3 4 5 M εtrack 4 εtrack rmsd faceocc1 6 4 2 0 4 2 0 mh-pbp s-pbp M =2 References [1] C. Andrieu, N. de Freitas, A. Doucet, and M. I. Jordan. An introduction to mcmc for machine learning. Machine Learning, 50(1-2):5– 43, 2003. [2] B. Babenko, M.-H. Yang, and S. Belongie. Visual tracking with online multiple instance learning. In CVPR, pages 983–990, 2011. [3] F. Besse, C. Rother, A. Fitzgibbon, and J. Kautz. Pmbp: Patchmatch belief propagation for correspondence field estimation. In BMVC, 2012. [4] Y. Boykov, O. Veksler, and R. Zabih. Fast approximate energy minimization via graph cuts. PAMI, 23:1222–1239, 2001. [5] G. Duan, H. Ai, S. Cao, and S. Lao. Group tracking: Exploring mutual relations for multiple object tracking. In ECCV (3), pages 129–143, 2012. [6] A. Ihler and D. McAllester. Particle belief propagation. In AISTATS, pages 256–263, 2009. [7] V. Kolmogorov. Convergent tree-reweighted message passing for energy minimization. PAMI, 28:1568–1583, 2006. [8] R. Kothapa, J. Pacheco, and E. B. Sudderth. Max-product particle belief propagation. Technical report, Brown University, 2011. [9] W.-C. Lin and Y. Liu. Tracking dynamic near-regular textures under occlusion and rapid movements. In ECCV, pages 44–55, 2006. [10] O. Ludwig, D. Delgado, V. Goncalves, and U. Nunes. Trainable classifier-fusion schemes: An application to pedestrian detection. In IEEE Intelligent Transportation Systems (ITSC), pages 1–6, 2009. [11] O. Müller, M. Y. Yang, and B. Rosenhahn. http://www.tnt. uni-hannover.de/papers/view_paper.php?id=996, 2013. [12] R. M. Neal. Slice sampling. Ann. Statist., 31(3):705–767, 2003. With discussions and a rejoinder by the author. [13] J. Peng, T. Hazan, D. McAllester, and R. Urtasun. Convex maxproduct algorithms for continuous mrfs with applications to protein folding. In ICML, 2011. [14] M. Salzmann and R. Urtasun. Beyond feature points: Structured prediction for monocular non-rigid 3d reconstruction. In ECCV, pages 245–259. 2012. [15] H. B. Shitrit, J. Berclaz, F. Fleuret, and P. Fua. Tracking multiple people under global appearance constraints. ICCV, pages 137–144, 2011. [16] E. B. Sudderth, A. T. Ihler, M. Isard, W. T. Freeman, and A. S. Willsky. Nonparametric belief propagation. Communications of the ACM, 53(10):95–103, 2010. [17] M. J. Wainwright, T. S. Jaakkola, and A. S. Willsky. Map estimation via agreement on trees: message-passing and linear programming. IEEE Trans. Information Theory, 51:3697–3717, 2005. [18] B. Walsh. Markov chain monte carlo and gibbs sampling. In Lecture Notes for EEB 581 version 26, April 2004. [19] J. Xue, N. Zheng, J. Geng, and X. Zhong. Tracking multiple visual targets via particle-based belief propagation. IEEE Trans. Systems, Man, and Cybernetics, Part B, 38(1):196 –209, 2008. mh-pbp s-pbp M =5 2 3 4 5 mh-pbp s-pbp M =2 5 M mh-pbp 10 εtrack εtrack rmsd faceocc2 8 6 4 2 0 8 6 4 2 mh-pbp s-pbp M =5 s-pbp Figure 8. Relational feature tracker evaluation results showing the overal RMSD (for MCMC iterations from 2 to 5) and box plots over the error distance to groundtruth for selected MCMC iterations. paper1 200 100 15 10 5 0 1 2 5 1020 50 σxy · 10−1 200 100 15 10 5 0 1 2 5 1020 50 σr · 10−2 200 100 15 10 5 0 1 2 5 1020 50 σφ · 10−2 faceocc1 50 30 15 10 5 0 1 2 5 1020 50 σxy · 10−1 50 30 15 10 5 0 1 2 5 1020 50 σr · 10−2 50 30 15 10 5 0 1 2 5 1020 50 σφ · 10−2 Figure 9. Optimal parameter evaluation for MH - PBP method (with M = 5). The vertical axis shows the error distance to groundtruth in px. Note that the vertical axis is stretched for error values lower than 15 px in order to better visualize performance differences. that S - PBP needs significant less MCMC iterations than MH PBP such that the computational overhead can be typically well compensated. 6. Conclusion We presented a novel particle belief propagation algorithm using slice sampling (S - PBP) instead of MetropolisHastings. We exploit the message passing equations to 1136
1cs.CV
arXiv:1504.00941v2 [cs.NE] 7 Apr 2015 A Simple Way to Initialize Recurrent Networks of Rectified Linear Units Quoc V. Le, Navdeep Jaitly, Geoffrey E. Hinton Google Abstract Learning long term dependencies in recurrent networks is difficult due to vanishing and exploding gradients. To overcome this difficulty, researchers have developed sophisticated optimization techniques and network architectures. In this paper, we propose a simpler solution that use recurrent neural networks composed of rectified linear units. Key to our solution is the use of the identity matrix or its scaled version to initialize the recurrent weight matrix. We find that our solution is comparable to a standard implementation of LSTMs on our four benchmarks: two toy problems involving long-range temporal structures, a large language modeling problem and a benchmark speech recognition problem. 1 Introduction Recurrent neural networks (RNNs) are very powerful dynamical systems and they are the natural way of using neural networks to map an input sequence to an output sequence, as in speech recognition and machine translation, or to predict the next term in a sequence, as in language modeling. However, training RNNs by using back-propagation through time [30] to compute error-derivatives can be difficult. Early attempts suffered from vanishing and exploding gradients [15] and this meant that they had great difficulty learning long-term dependencies. Many different methods have been proposed for overcoming this difficulty. A method that has produced some impressive results [23, 24] is to abandon stochastic gradient descent in favor of a much more sophisticated Hessian-Free (HF) optimization method. HF operates on large mini-batches and is able to detect promising directions in the weight-space that have very small gradients but even smaller curvature. Subsequent work, however, suggested that similar results could be achieved by using stochastic gradient descent with momentum provided the weights were initialized carefully [34] and large gradients were clipped [28]. Further developments of the HF approach look promising [35, 25] but are much harder to implement than popular simple methods such as stochastic gradient descent with momentum [34] or adaptive learning rates for each weight that depend on the history of its gradients [5, 14]. The most successful technique to date is the Long Short Term Memory (LSTM) Recurrent Neural Network which uses stochastic gradient descent, but changes the hidden units in such a way that the backpropagated gradients are much better behaved [16]. LSTM replaces logistic or tanh hidden units with “memory cells” that can store an analog value. Each memory cell has its own input and output gates that control when inputs are allowed to add to the stored analog value and when this value is allowed to influence the output. These gates are logistic units with their own learned weights on connections coming from the input and also the memory cells at the previous time-step. There is also a forget gate with learned weights that controls the rate at which the analog value stored in the memory cell decays. For periods when the input and output gates are off and the forget gate is not causing decay, a memory cell simply holds its value over time so the gradient of the error w.r.t. its stored value stays constant when backpropagated over those periods. 1 The first major success of LSTMs was for the task of unconstrained handwriting recognition [12]. Since then, they have achieved impressive results on many other tasks including speech recognition [13, 10], handwriting generation [8], sequence to sequence mapping [36], machine translation [22, 1], image captioning [38, 18], parsing [37] and predicting the outputs of simple computer programs [39]. The impressive results achieved using LSTMs make it important to discover which aspects of the rather complicated architecture are crucial for its success and which are mere passengers. It seems unlikely that Hochreiter and Schmidhuber’s [16] initial design combined with the subsequent introduction of forget gates [6, 7] is the optimal design: at the time, the important issue was to find any scheme that could learn long-range dependencies rather than to find the minimal or optimal scheme. One aim of this paper is to cast light on what aspects of the design are responsible for the success of LSTMs. Recent research on deep feedforward networks has also produced some impressive results [19, 3] and there is now a consensus that for deep networks, rectified linear units (ReLUs) are easier to train than the logistic or tanh units that were used for many years [27, 40]. At first sight, ReLUs seem inappropriate for RNNs because they can have very large outputs so they might be expected to be far more likely to explode than units that have bounded values. A second aim of this paper is to explore whether ReLUs can be made to work well in RNNs and whether the ease of optimizing them in feedforward nets transfers to RNNs. 2 The initialization trick In this paper, we demonstrate that, with the right initialization of the weights, RNNs composed of rectified linear units are relatively easy to train and are good at modeling long-range dependencies. The RNNs are trained by using backpropagation through time to get error-derivatives for the weights and by updating the weights after each small mini-batch of sequences. Their performance on test data is comparable with LSTMs, both for toy problems involving very long-range temporal structures and for real tasks like predicting the next word in a very large corpus of text. We initialize the recurrent weight matrix to be the identity matrix and biases to be zero. This means that each new hidden state vector is obtained by simply copying the previous hidden vector then adding on the effect of the current inputs and replacing all negative states by zero. In the absence of input, an RNN that is composed of ReLUs and initialized with the identity matrix (which we call an IRNN) just stays in the same state indefinitely. The identity initialization has the very desirable property that when the error derivatives for the hidden units are backpropagated through time they remain constant provided no extra error-derivatives are added. This is the same behavior as LSTMs when their forget gates are set so that there is no decay and it makes it easy to learn very long-range temporal dependencies. We also find that for tasks that exhibit less long range dependencies, scaling the identity matrix by a small scalar is an effective mechanism to forget long range effects. This is the same behavior as LTSMs when their forget gates are set so that the memory decays fast. Our initialization scheme bears some resemblance to the idea of Mikolov et al. [26], where a part of the weight matrix is fixed to identity or approximate identity. The main difference of their work to ours is the fact that our network uses the rectified linear units and the identity matrix is only used for initialization. The scaled identity initialization was also proposed in Socher et al. [32] in the context of tree-structured networks but without the use of ReLUs. Our work is also related to the work of Saxe et al. [31], who study the use of orthogonal matrices as initialization in deep networks. 3 Overview of the experiments Consider a recurrent net with two input units. At each time step, the first input unit has a real value and the second input unit has a value of 0 or 1 as shown in figure 1. The task is to report the sum of the two real values that are marked by having a 1 as the second input [16, 15, 24]. IRNNs can learn to handle sequences with a length of 300, which is a challenging regime for other algorithms. 2 Another challenging toy problem is to learn to classify the MNIST digits when the 784 pixels are presented sequentially to the recurrent net. Again, the IRNN was better than the LSTM, having been able to achieve 3% test set error compared to 34% for LSTM. While it is possible that a better tuned LSTM (with a different architecture or the size of the hidden state) would outperform the IRNN for the above two tasks, the fact that the IRNN performs as well as it does, with so little tuning, is very encouraging, especially given how much simpler the model is, compared to the LSTM. We also compared IRNNs with LSTMs on a large language modeling task. Each memory cell of an LSTM is considerably more complicated than a rectified linear unit and has many more parameters, so it is not entirely obvious what to compare. We tried to balance for both the number of parameters and the complexity of the architecture by comparing an LSTM with N memory cells with an IRNN with four layers of N hidden units, and an IRNN with one layer and 2N hidden units. Here we find that the IRNN gives results comparable to the equivalent LSTM. Finally, we benchmarked IRNNs and LSTMs on a acoustic modeling task on TIMIT. As the tasks only require a short term memory of the inputs, we used a the identity matrix scaled by 0.01 as initialization for the recurrent matrix. Results show that our method is also comparable to LSTMs, despite being a lot simpler to implement. 4 Experiments In the following experiments, we compare IRNNs against LSTMs, RNNs that use tanh units and RNNs that use ReLUs with random Gaussian initialization. For IRNNs, in addition to the recurrent weights being initialized at identity, the non-recurrent weights are initialized with a random matrix, whose entries are sampled from a Gaussian distribution with mean of zero and standard deviation of 0.001. Our implementation of the LSTMs is rather standard and includes the forget gate. It is observed that setting a higher initial forget gate bias for LSTMs can give better results for long term dependency problems. We therefore also performed a grid search for the initial forget gate bias in LSTMs from the set {1.0, 4.0, 10.0, 20.0}. Other than that we did not tune the LTSMs much and it is possible that the results of LSTMs in the experiments can be improved. In addition to LSTMs, two other candidates for comparison are RNNs that use the tanh activation function and RNNs that use ReLUs with standard random Gaussian initialization. We experimented with several values of standard deviation for the random initialization Gaussian matrix and found that values suggested in [33] work well. To train these models, we use stochastic gradient descent with a fixed learning rate and gradient clipping. To ensure that good hyperparameters are used, we performed a grid search over several learning rates α = {10−9 , 10−8 , ..., 10−1 } and gradient clipping values gc = {1, 10, 100, 1000} [9, 36]. The reported result is the best result over the grid search. We also use the same batch size of 16 examples for all methods. The experiments are carried out using the DistBelief infrastructure, where each experiment only uses one replica [20, 4]. 4.1 The Adding Problem The adding problem is a toy task, designed to examine the power of recurrent models in learning long-term dependencies [16, 15]. This is a sequence regression problem where the target is a sum of two numbers selected in a sequence of random signals, which are sampled from a uniform distribution in [0,1]. At every time step, the input consists of a random signal and a mask signal. The mask signal has a value of zero at all time steps except for two steps when it has values of 1 to indicate which two numbers should be added. An example of the adding problem is shown in figure 1 below. A basic baseline is to always predict the sum to have a value of 1 regardless of the inputs. This will give the Mean Squared Error (MSE) around 0.1767. The goal is to train a model that achieves MSE well below 0.1767. 3 Figure 1: An example of the “adding” problem, where the target is 1.2 which is the sum of 2nd and the 7th numbers in the first sequence [24]. The problem gets harder as the length of the sequence T increases because the dependency between the output and the relevant inputs becomes more remote. To solve this problem, the recurrent net must remember the first number or the sum of the two numbers accurately whilst ignoring all of the irrelevant numbers. We generated a training set of 100,000 examples and a test set of 10,000 examples as we varied T . We fixed the hidden states to have 100 units for all of our networks (LSTMs, RNNs and IRNNs). This means the LSTMs had more parameters by a factor of about 4 and also took about 4 times as much computation per timestep. As we varied T , we noticed that both LSTMs and RNNs started to struggle when T is around 150. We therefore focused on investigating the behaviors of all models from this point onwards. The results of the experiments with T = 150, T = 200, T = 300, T = 400 are reported in figure 2 below (best hyperparameters found during grid search are listed in table 1). Adding two numbers in a sequence of 150 numbers Adding two numbers in a sequence of 200 numbers 0.8 0.8 LSTM RNN + Tanh RNN + ReLUs IRNN 0.6 0.6 0.5 0.5 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0 0 1 2 3 4 5 6 7 8 Steps LSTM RNN + Tanh RNN + ReLUs IRNN 0.7 Test MSE Test MSE 0.7 0 9 0 Adding two numbers in a sequence of 300 numbers 3 4 5 6 7 8 9 6 x 10 Adding two numbers in a sequence of 400 numbers 0.8 LSTM RNN + Tanh RNN + ReLUs IRNN 0.7 0.6 0.6 0.5 0.5 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0 1 2 3 4 5 Steps 6 7 LSTM RNN + Tanh RNN + ReLUs IRNN 0.7 Test MSE Test MSE 2 Steps 0.8 0 1 6 x 10 8 0 9 0 1 2 3 4 5 Steps 6 x 10 6 7 8 9 6 x 10 Figure 2: The results of recurrent methods on the “adding” problem for the case of T = 150 (top left), T = 200 (top right), T = 300 (bottom left) and T = 400 (bottom right). The objective function is the Root Mean Squared Error, reported on the test set of 10,000 examples. Note that always predicting the sum to be 1 should give MSE of 0.1767. The results show that the convergence of IRNNs is as good as LSTMs. This is given that each LSTM step is more expensive than an IRNN step (at least 4x more expensive). Adding two numbers in a sequence of 400 numbers is somewhat challenging for both algorithms. 4 T 150 200 300 400 LSTM lr = 0.01, gc = 10, f b = 1.0 lr = 0.001, gc = 100, f b = 4.0 lr = 0.01, gc = 1, f b = 4.0 lr = 0.01, gc = 100, f b = 10.0 RNN + Tanh lr = 0.01, gc = 100 N/A N/A N/A IRNN lr = 0.01, gc = 100 lr = 0.01, gc = 1 lr = 0.01, gc = 10 lr = 0.01, gc = 1 Table 1: Best hyperparameters found for adding problems after grid search. lr is the learning rate, gc is gradient clipping, and f b is forget gate bias. N/A is when there is no hyperparameter combination that gives good result. 4.2 MNIST Classification from a Sequence of Pixels Another challenging toy problem is to learn to classify the MNIST digits [21] when the 784 pixels are presented sequentially to the recurrent net. In our experiments, the networks read one pixel at a time in scanline order (i.e. starting at the top left corner of the image, and ending at the bottom right corner). The networks are asked to predict the category of the MNIST image only after seeing all 784 pixels. This is therefore a huge long range dependency problem because each recurrent network has 784 time steps. To make the task even harder, we also used a fixed random permutation of the pixels of the MNIST digits and repeated the experiments. All networks have 100 recurrent hidden units. We stop the optimization after it converges or when it reaches 1,000,000 iterations and report the results in figure 3 (best hyperparameters are listed in table 2). Pixel−by−pixel MNIST Pixel−by−pixel permuted MNIST 100 100 LSTM RNN + Tanh RNN + ReLUs IRNN 90 80 90 80 70 Test Accuracy Test Accuracy 70 60 50 40 60 50 40 30 30 20 20 10 0 LSTM RNN + Tanh RNN + ReLUs IRNN 10 0 1 2 3 4 5 Steps 6 7 8 9 0 10 5 x 10 0 1 2 3 4 5 Steps 6 7 8 9 10 5 x 10 Figure 3: The results of recurrent methods on the “pixel-by-pixel MNIST” problem. We report the test set accuracy for all methods. Left: normal MNIST. Right: permuted MNIST. Problem MNIST permuted MNIST LSTM lr = 0.01, gc = 1 f b = 1.0 lr = 0.01, gc = 1 f b = 1.0 RNN + Tanh lr = 10−8 , gc = 10 RNN + ReLUs lr = 10−8 , gc = 10 IRNN lr = 10−8 , gc = 1 lr = 10−8 , gc = 1 lr = 10−6 , gc = 10 lr = 10−9 , gc = 1 Table 2: Best hyperparameters found for pixel-by-pixel MNIST problems after grid search. lr is the learning rate, gc is gradient clipping, and f b is the forget gate bias. The results using the standard scanline ordering of the pixels show that this problem is so difficult that standard RNNs fail to work, even with ReLUs, whereas the IRNN achieves 3% test error rate which is better than most off-the-shelf linear classifiers [21]. We were surprised that the LSTM did not work as well as IRNN given the various initialization schemes that we tried. While it still possible that a better tuned LSTM would do better, the fact that the IRNN perform well is encouraging. 5 Applying a fixed random permutation to the pixels makes the problem even harder but IRNNs on the permuted pixels are still better than LSTMs on the non-permuted pixels. The low error rates of the IRNN suggest that the model can discover long range correlations in the data while making weak assumptions about the inputs. This could be important to have for problems when input data are in the form of variable-sized vectors (e.g. the repeated field of a protobuffer 1 ). 4.3 Language Modeling We benchmarked RNNs, IRNNs and LSTMs on the one billion word language modelling dataset [2], perhaps the largest public benchmark in language modeling. We chose an output vocabulary of 1,000,000 words. As the dataset is large, we observed that the performance of recurrent methods depends on the size of the hidden states: they perform better as the size of the hidden states gets larger (cf. [2]). We however focused on a set of simple controlled experiments to understand how different recurrent methods behave when they have a similar number of parameters. We first ran an experiment where the number of hidden units (or memory cells) in LSTM are chosen to be 512. The LSTM is trained for 60 hours using 32 replicas. Our goal is then to check how well IRNNs perform given the same experimental environment and settings. As LSTM have more parameters per time step, we compared them with an IRNN that had 4 layers and same number of hidden units per layer (which gives approximately the same numbers of parameters). We also experimented shallow RNNs and IRNNs with 1024 units. Since the output vocabulary is large, we projected the 1024 hidden units to a linear layer with 512 units before the softmax. This avoids greatly increasing the number of parameters. The results are reported in table 3, which show that the performance of IRNNs is closer to the performance of LSTMs for this large-scale task than it is to the performance of RNNs. Methods LSTM (512 units) IRNN (4 layers, 512 units) IRNN (1 layer, 1024 units + linear projection with 512 units before softmax) RNN (4 layer, 512 tanh units) RNN (1 layer, 1024 tanh units + linear projection with 512 units before softmax) Test perplexity 68.8 69.4 70.2 71.8 72.5 Table 3: Performances of recurrent methods on the 1 billion word benchmark. 4.4 Speech Recognition We performed Phoneme recognition experiments on TIMIT with IRNNs and Bidirectional IRNNs and compared them to RNNs, LSTMs and Bidirectional LSTMs and RNNs. Bidirectional LSTMs have been applied previously to TIMIT in [11]. In these experiments we generated phoneme alignments from Kaldi [29] using the recipe reported in [17] and trained all RNNs with two and five hidden layers. Each model was given log Mel filter bank spectra with their delta and accelerations, where each frame was 120 (=40*3) dimensional and trained to predict the phone state (1 of 180). Frame error rates (FER) from this task are reported in table 4. In this task, instead of the identity initialization for the IRNNs matrices we used 0.01I so we refer to them as iRNNs. Initalizing with the full identity led to slow convergence, worse results and sometimes led to the model diverging during training. We hypothesize that this was because in the speech task similar inputs are provided to the neural net in neighboring frames. The normal IRNN keeps integrating this past input, instead of paying attention mainly to the current input because it has a difficult time forgetting the past. So for the speech task, we are not only showing that iRNNs work much better than RNNs composed of tanh units, but we are also showing that initialization with the full identity is suboptimal when long range effects are not needed. Mulitplying the identity with a small scalar seems to be a good remedy in such cases. 1 https://code.google.com/p/protobuf/ 6 Methods RNN (500 neurons, 2 layers) LSTM (250 cells, 2 layers) iRNN (500 neurons, 2 layers) RNN (500 neurons, 5 layers) LSTM (250 cells, 5 layers) iRNN (500 neurons, 5 layers) Bidirectional RNN (500 neurons, 2 layers) Bidirectional LSTM (250 cells, 2 layers) Bidirectional iRNN (500 neurons, 2 layers) Bidirectional RNN (500 neurons, 5 layers) Bidirectional LSTM (250 cells, 5 layers) Bidirectional iRNN (500 neurons, 5 layers) Frame error rates (dev / test) 35.0 / 36.2 34.5 / 35.4 34.3 / 35.5 35.6 / 37.0 35.0 / 36.2 33.0 / 33.8 31.5 / 32.4 29.6 / 30.6 31.9 / 33.2 33.9 / 34.8 28.5 / 29.1 28.9 / 29.7 Table 4: Frame error rates of recurrent methods on the TIMIT phone recognition task. In general in the speech recognition task, the iRNN easily outperforms the RNN that uses tanh units and is comparable to LSTM although we don’t rule out the possibility that with very careful tuning of hyperparameters, the relative performance of LSTMs or the iRNNs might change. A five layer Bidirectional LSTM outperforms all the other models on this task, followed closely by a five layer Bidirectional iRNN. 4.5 Acknowledgements We thank Jeff Dean, Matthieu Devin, Rajat Monga, David Sussillo, Ilya Sutskever and Oriol Vinyals for their help with the project. References [1] D. Bahdanau, K. Cho, and Y. Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014. [2] C. Chelba, T. Mikolov, M. Schuster, Q. Ge, T. Brants, and P. Koehn. One billion word benchmark for measuring progress in statistical language modeling. CoRR, abs/1312.3005, 2013. [3] G. E. Dahl, D. Yu, L. Deng, and A. Acero. Context-dependent pre-trained deep neural networks for large vocabulary speech recognition. IEEE Transactions on Audio, Speech, and Language Processing - Special Issue on Deep Learning for Speech and Language Processing, 2012. [4] J. Dean, G. S. Corrado, R. Monga, K. Chen, M. Devin, Q. V. Le, M. Z. Mao, M. A. Ranzato, A. Senior, P. Tucker, K. Yang, and A. Y. Ng. Large scale distributed deep networks. In NIPS, 2012. [5] J. Duchi, E. Hazan, and Y. Singer. Adaptive subgradient methods for online learning and stochastic optimization. The Journal of Machine Learning Research, 12:2121–2159, 2011. [6] F. A. Gers, J. Schmidhuber, and F. Cummins. Learning to forget: Continual prediction with LSTM. Neural Computation, 2000. [7] F. A. Gers, N. N. Schraudolph, and J. Schmidhuber. Learning precise timing with lstm recurrent networks. The Journal of Machine Learning Research, 2003. [8] A. Graves. Generating sequences with recurrent neural networks. arXiv:1308.0850, 2013. arXiv preprint [9] A. Graves. Generating sequences with recurrent neural networks. In Arxiv, 2013. [10] A. Graves and N. Jaitly. Towards end-to-end speech recognition with recurrent neural networks. In Proceedings of the 31st International Conference on Machine Learning, 2014. [11] A. Graves, N. Jaitly, and A-R. Mohamed. Hybrid speech recognition with deep bidirectional lstm. In IEEE Workshop on Automatic Speech Recognition and Understanding (ASRU),, 2013. 7 [12] A. Graves, M. Liwicki, S. Fernández, R. Bertolami, H. Bunke, and J. Schmidhuber. A novel connectionist system for unconstrained handwriting recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2009. [13] A. Graves, A-R. Mohamed, and G. Hinton. Speech recognition with deep recurrent neural networks. In IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2013. [14] G. Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012. [15] S. Hochreiter, Y. Bengio, P. Frasconi, and J. Schmidhuber. Gradient flow in recurrent nets: the difficulty of learning long-term dependencies. A Field Guide to Dynamical Recurrent Neural Networks, 2001. [16] S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, 1997. [17] N. Jaitly. Exploring Deep Learning Methods for discovering features in speech signals. PhD thesis, University of Toronto, 2014. [18] R. Kiros, R. Salakhutdinov, and R. S. Zemel. Unifying visual-semantic embeddings with multimodal neural language models. arXiv preprint arXiv:1411.2539, 2014. [19] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, 2012. [20] Q. V. Le, M. A. Ranzato, R. Monga, M. Devin, K. Chen, G. S. Corrado, J. Dean, and A. Y. Ng. Building high-level features using large scale unsupervised learning. In International Conference on Machine Learning, 2012. [21] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 1998. [22] T. Luong, I. Sutskever, Q. V. Le, O. Vinyals, and W. Zaremba. Addressing the rare word problem in neural machine translation. arXiv preprint arXiv:1410.8206, 2014. [23] J. Martens. Deep learning via Hessian-free optimization. In Proceedings of the 27th International Conference on Machine Learning, 2010. [24] J. Martens and I. Sutskever. Learning recurrent neural networks with Hessian-Free optimization. In ICML, 2011. [25] J. Martens and I. Sutskever. Training deep and recurrent neural networks with Hessian-Free optimization. Neural Networks: Tricks of the Trade, 2012. [26] T. Mikolov, A. Joulin, S. Chopra, M. Mathieu, and M. A. Ranzato. Learning longer memory in recurrent neural networks. arXiv preprint arXiv:1412.7753, 2014. [27] V. Nair and G. Hinton. Rectified Linear Units improve Restricted Boltzmann Machines. In International Conference on Machine Learning, 2010. [28] R. Pascanu, T. Mikolov, and Y. Bengio. On the difficulty of training recurrent neural networks. arXiv preprint arXiv:1211.5063, 2012. [29] D. Povey, A. Ghoshal, G. Boulianne, L. Burget, O. Glembek, N. Goel, M. Hannemann, P. Motlicek, Y. Qian, P. Schwarz, J. Silovsky, G. Stemmer, and K. Vesely. The kaldi speech recognition toolkit. In IEEE 2011 Workshop on Automatic Speech Recognition and Understanding. IEEE Signal Processing Society, 2011. [30] D. Rumelhart, G. E. Hinton, and R. J. Williams. Learning representations by back-propagating errors. Nature, 323(6088):533–536, 1986. [31] A. M. Saxe, J. L. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. arXiv preprint arXiv:1312.6120, 2013. [32] R. Socher, J. Bauer, C. D. Manning, and A. Y. Ng. Parsing with compositional vector grammars. In ACL, 2013. [33] D. Sussillo and L. F. Abbott. Random walk intialization for training very deep networks. arXiv preprint arXiv:1412.6558, 2015. [34] I. Sutskever, J. Martens, G. Dahl, and G. Hinton. On the importance of initialization and momentum in deep learning. In Proceedings of the 30th International Conference on Machine Learning, 2013. 8 [35] I. Sutskever, J. Martens, and G. E. Hinton. Generating text with recurrent neural networks. In Proceedings of the 28th International Conference on Machine Learning, pages 1017–1024, 2011. [36] I. Sutskever, O. Vinyals, and Q. V. Le. Sequence to sequence learning with neural networks. In NIPS, 2014. [37] O. Vinyals, L. Kaiser, T. Koo, S. Petrov, I. Sutskever, and G. Hinton. Grammar as a foreign language. arXiv preprint arXiv:1412.7449, 2014. [38] O. Vinyals, A. Toshev, S. Bengio, and D. Erhan. Show and tell: A neural image caption generator. arXiv preprint arXiv:1411.4555, 2014. [39] W. Zaremba and I. Sutskever. Learning to execute. arXiv preprint arXiv:1410.4615, 2014. [40] M. Zeiler, M. Ranzato, R. Monga, M. Mao, K. Yang, Q. V. Le, P. Nguyen, A. Senior, V. Vanhoucke, and J. Dean. On rectified linear units for speech processing. In IEEE Conference on Acoustics, Speech and Signal Processing (ICASSP), 2013. 9
9cs.NE
A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems Hadi Ravanbakhsh and Sriram Sankaranarayanan Department of Computer Science University of Colorado, Boulder Boulder, CO, USA [email protected] In this article, we consider the problem of synthesizing switching controllers for temporal properties through the composition of simple primitive reach-while-stay (RWS) properties. Reach-while-stay properties specify that the system states starting from an initial set I, must reach a goal (target) set G in finite time, while remaining inside a safe set S. Our approach synthesizes switched controllers that select between finitely many modes to satisfy the given RWS specification. To do so, we consider control certificates, which are Lyapunov-like functions that represent control strategies to achieve the desired specification. However, for RWS problems, a control Lyapunov-like function is often hard to synthesize in a simple polynomial form. Therefore, we combine control barrier and Lyapunov functions with an additional compatibility condition between them. Using this approach, the controller synthesis problem reduces to one of solving quantified nonlinear constrained problems that are handled using a combination of SMT solvers. The synthesis of controllers is demonstrated through a set of interesting numerical examples drawn from the related work, and compared with the state-of-theart tool SCOTS. Our evaluation suggests that our approach is computationally feasible, and adds to the growing body of formal approaches to controller synthesis. 1 Introduction The problem of synthesizing switching controllers for reach-while-stay (RWS) specifications is examined in this article. RWS properties are an important class, since we may decompose more complex temporal specifications into a sequence of RWS specifications [11]. The plant model is a switched system that consists of finitely many (controllable) modes, and the dynamics for each mode are specified using ODEs. Furthermore, we consider nonlinear ODEs for each mode, including rational, trigonometric, and exponential functions. The goal of the controller is to switch between the appropriate modes, so that the resulting closed loop traces satisfy the specification. RWS properties specify that a goal set G must be reached by all behaviors of the closed-loop system while staying inside a safe set S. Specifically, the state of the system is assumed to be initialized to any state in the set S. RWS properties include safety properties (stay inside a safe set S), reachability properties (reach a goal set G), and “control-to-facet” problems [7, 8]. The controller synthesis is addressed in two phases: (a) formulating a control certificate whose existence guarantees the existence of a non-Zeno switching control law for the given RWS specification, and (b) solving for a certificate of a particular form as a feasibility problem. The control certificates are control Lyapunov-like functions which represent a strategy for the controller to satisfy the specifications. Additionally, this strategy can be effectively implemented as a feedback law using a controller that respects min dwell time constraints. In the second phase, a counterexample guided inductive synthesis (CEGIS) framework [26], — an approach that uses SMT solvers at its core — is used to discover such control certificates. However, this procedure is used off the shelf, building upon the previous work of D. Fisman, S. Jacobs (Eds.): Sixth Workshop on Synthesis (SYNT 2017) EPTCS 260, 2017, pp. 44–61, doi:10.4204/EPTCS.260.6 c H. Ravanbakhsh & S. Sankaranarayanan This work is licensed under the Creative Commons Attribution License. H. Ravanbakhsh & S. Sankaranarayanan 45 Ravanbakhsh et al. [22]. This procedure uses a specialized solver for finding a certificate of a given parametric form that handles quantified formulas by alternating between a series of quantifier free formulas using existing SMT solvers [18, 3]. The contributions of the paper are as follows: first, we show that a straightforward formulation of the control certificate for the RWS problem yields an exponential number of conditions, and hence can be computationally infeasible. Next, we introduce a class of control certificates which (i) has a concise logical structure that makes the problem of discovering the certificates computationally feasible; and (ii) we show that such certificates yield corresponding switching strategies with a min-dwell time property unlike the conventional control certificates. Next, we extend our approach to the initialized RWS (IRWS) property that additionally restricts the set of initial conditions of the system using a class of “control zero-ing” barrier functions [33, 36] . Also, a suitable formulation for these functions is provided within our framework. Finally, we provide numerical examples to demonstrate the effectiveness of the method, including comparisons with recently developed state-of-art automatic control synthesis tool SCOTS [25]. 1.1 Related Work The broader area of temporal logic synthesis seeks to synthesize formally guaranteed controllers from the given plant model and specifications. The dominant approach is to build a discrete abstraction of the given plant that is related to the original system [35, 15, 10, 25, 17]. Once a suitable abstraction is found, these approaches use a systematic temporal logic-based controller design approach over the abstraction [32]. The properties of interest in these systems include the full linear temporal logic (LTL) and an efficiently synthesizable subset such as GR(1) [35, 15]. These approaches differ in how the abstraction can be constructed in a guaranteed manner. One class of approaches works by fixing a time step, gridding the state-space, and simulating one point per cell [17, 10, 25, 37, 31]. The resulting abstraction, however, is not always approximately bisimilar to the original system. Nevertheless, conditions such as open loop incremental stability of the plant can be used to obtain bisimilarity [5]. Alternatively, the abstraction can be built without time discretization [20, 15] by considering infeasible transitions. And furthermore, the abstraction can be iteratively refined through a counter-example refinement scheme [19]. Our work here does not directly focus on building abstractions. Rather, our focus is on deductive approaches for a narrow class of temporal logic properties namely RWS properties. Using our approach, control systems for richer properties can be built from solving a series of RWS problems. Our approach is closely related to work of Habets et al. [6] and Kloetzer et al. [11]. In these methods, an abstraction is obtained by solving local control-to-facet problems instead of reachability analysis. However, continuous feedback is synthesized for each control-to-facet problem. The key difference in this paper is that the control-to-facet problems themselves are solved using switching. Furthermore, we consider initialized problems, where the initial states are also restricted to belong to a set. We find that IRWS problems can often be realized through a controller even when the corresponding RWS problem (for which the initial condition is not restricted) cannot be synthesized. Another related class of solutions is based on synthesizing “a deductive proof of correctness” simultaneously with “a control strategy”. The goal of these approaches also consists of finding a control certificate, which yields a (control) strategy to guarantee the property. This typically takes the form of a control Lyapunov-like function. The idea of control Lyapunov functions goes back to Artstein [1] and Sontag [27]. The problem of discovering a control Lyapunov function is usually formulated using bilinear matrix inequalities (BMI) [30]. Also, instead of solving such NP-hard problems, usually alternating optimization (V-K iteration or policy iteration) is used to conservatively find a solution [30, 4]. Wongpiromsarn et al. [34] discuss verification of temporal logic properties using barrier certificates. 46 A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems For synthesis, Xu et al. [36] discuss conditions for the so-called “control zeroing” barrier functions for safety and their properties. They also, consider their combination with control Lyapunov functions. In this article, we provide an alternative condition that is based on “exponential condition” barrier functions [12] and enforcing a compatibility condition between the control actions suggested by the control barrier and control Lyapunov functions. Also, Dimitrova et. al. [2] have shown that control certificates can be extended to address more complicated specifications i.e. parity games. While these results show that constraint solving based methods can be applied on more complicated specification, no method of finding such certificates is provided. The use of SMT solvers in control synthesis has also been well-studied. Taly et. al [28, 29] use a constraint solving approach to find control certificates for reachability and safety. They adapt a technique known as Counter-Example Guided Inductive Synthesis (CEGIS), originally proposed for program synthesis [26], to solve the control problems using a combination of an SMT solver with numerical simulations. Ravanbakhsh et al. [22] propose a combination of SMT and SDP solvers for finding control certificates. However, their method is only applicable to stability or simple reachability properties, involving the use of a single Lyapunov function. In a subsequent paper, their approach is extended to handle disturbance inputs [23]. The use of SMT solvers to solve for Lyapunov-like functions is used in our paper as well. However, this paper focuses on defining a more tractable class of control certificates for RWS problems. Furthermore, we show how these problems can be composed for more complex temporal objectives. In particular, our use of the CEGIS procedure is not a contribution of this paper. Furthermore, in order to handle nonlinear systems and also to guarantee numerical soundness of these solvers, we use the nonlinear SMT solver dReal [3]. Huang et. al. [9] also propose control certificates to solve the RWS problem for piecewise affine systems, using SMT solvers. Their approach uses piecewise constant functions as control certificates and partitions the state space into small enough cells in order to define such functions. By using this technique, any function can be approximated, which makes the method relatively complete. As mentioned earlier, past work by Habets et al. and Klutzier et al. [6, 11] build a finite abstraction by repeatedly solving control-to-facet problems. These problems seek to find a feedback law inside a polytope P that guarantees all the resulting trajectories exit P through a specific facet F of P. Habets et. al. [7] show necessary and sufficient conditions for the existence of a control strategy for the control-tofacet problem on simplices. This condition is sufficient but not necessary for polytopes. They extract a unique certificate from each problem instance and check whether the condition holds for the certificate. Subsequently, Roszak et al. [24] and Helwa et al. [8] extend this approach and solve reachability to a set of facets by introducing flow condition, which combined with invariant condition serves as a control certificate similar to those used in this paper. From the published results, these methods are more efficient, but are only applicable to affine systems over polytopes. In contrast, the dynamics in this article can be non-linear involving rational, trigonometric, and exponential functions. In this article, we demonstrate that our method can be used to solve such problems and it can be integrated into other methods which build an abstraction for the system. 2 2.1 Background Notation . Given a function f (t), let f + (t) ( f − (t)) be the right (left) limit of f at t, and f (t) represent the right derivative of f at time t. For a set S ⊆ Rn , ∂ S and int(S) are its boundary and interior, respectively. H. Ravanbakhsh & S. Sankaranarayanan 47 Definition 1 (Nondegenerate Basic Semialgebraic Set): A nondegenerate basic semialgebraic set K is a nonempty set defined by a conjunction polynomial inequalities: K : {x | pK,1 (x) ≤ 0 ∧ · · · ∧ pK,i (x) ≤ 0} , where x ∈ Rn . For each j ∈ [1, i], we define HK, j = {x | x ∈ K ∧ pK, j (x) = 0} . It is required that (a) each HK, j is nonempty, (b) the boundary ∂ K and the interior int(K) are given W V by ij=1 HK, j and ij=1 pK, j (x) < 0, respectively, and (c) the interior is nonempty. We use “basic semialgebraic” and “nondegenerate basic semialgebraic” interchangeably. 2.2 Switched Systems We consider continuous-time switched system plants, controlled by a memoryless controller that provides continuous-time switching feedback. The state of the plant P is defined by n continuous variables x in a state space X ⊆ Rn , along with a finite set of modes Q = {q1 , . . . , qm }. The trace of the system (q(t), x(t)) maps time to mode q(.) : R+ → Q, and state x(.) : R+ → X. The mode q ∈ Q is controlled by an external switching input q(t). The state of the plant inside each mode evolves according to (time invariant) dynamics: . x(t) = fq(t) (x(t)) , (1) wherein fq : X → Rn is a Lipschitz continuous function over X, describing the vector field of the plant for mode q. The controller C is defined as a function K : Q × X → Q, which given the current mode and state of the plant, decides the mode of the plant at the next time instant. Formally: q+ (t) = K (q(t), x(t)). (2) The closed loop hP, C i produces traces (q(t), x(t)) defined jointly by equations (1) and (2). However, care must be taken to avoid Zenoness, wherein the controller can switch infinitely often in a finite time interval. Such controllers are physically unrealizable. Therefore, we will additionally ensure that the K function satisfies a minimum dwell time requirement that guarantees a minimum time δ > 0 between mode switches. Definition 2 (Minimum Dwell Time): A controller C has a minimum dwell time δ > 0 with respect to a plant P iff for all traces and for all switch times T (q(T ) 6= q+ (T ), the controller does not switch during the times t ∈ [T, T + δ ): i.e, K (q(t), x(t)) = q+ (T ) for all t ∈ [T, T + δ ). Once the function K is defined with a minimum dwell time guarantee, given initial mode (q(0)), and initial state (x(0)), a unique trace is defined for the system. Specifications: Generally, specifications describe desired sequences of plant states x(t) over time t ≥ 0 that we wish to control for. In this paper, we focus on reach-while-stay (RWS) specifications involving three sets: initial set I ⊆ X, safe set S ⊆ X and goal set G ⊆ X. Definition 3 (Initialized Reach-While-Stay (RWS) Specification): A trace x(t) for t ∈ [0, ∞) satisfies a reach-while-stay (RWS) specification w.r.t sets hI, S, Gi iff whenever x(0) ∈ I, there exists a time T ≥ 0 s.t. for all t ∈ [0, T ), x(t) ∈ S, and x(T ) ∈ G. 48 A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems In other words, whenever the system is initialized inside the set I, it stays inside the safe set S until it reaches the goal set G. Alternatively, we may express the specification in temporal logic as I =⇒ (S U G), where U is the temporal operator “until”. We will assume that set S is a compact basic semialgebraic set. Typical examples include polytopes defined by linear inequalities or ellipsoids, that can be easily checked for the properties such as compactness and nondegeneracy. Also, sets I and G are compact semialgebraic sets. The special case when I = S will be called uninitialized RWS. Such a property simply states that the system initialized inside the set S continues to remain in S until it reaches a goal state x ∈ G at some finite time instant T . This case is suitable for building a finite abstraction as mentioned in Sec. 1. 2.3 Control Certificates Encoding verification and synthesis problems into (control) certificates, which are defined by a set of conditions, is a standard approach. For example Lyapunov functions have been used for ensuring stability and barrier functions are employed to reason about safety properties. However, these functions are not usually known in advance. To discover such a function in the first place, we solve a constrained problem in which certificates are parameterized. Usually, certificates are defined over polynomials with unknown coefficients and the problem reduces to finding proper coefficients for polynomials [21, 2]. For example, to find a Lyapunov function, first, a template for Lyapunov function V is chosen: V = ∑i cα xα , where xα is a monomial with degree greater than zero. Then, solving the following constrained problem yields   . . a Lyapunov function for proving stability to origin: (∃c) (∀x 6= 0) V (x) > 0 ∧ V (x) < 0 , where V is ∇V. f (x). In these techniques, it is essential to define control certificate with a simple structure that can be discovered automatically. In the subsequent we combine the certificates for safety and liveness to obtain a certificate for RWS properties. 3 RWS for Basic Semialgebraic Safe Sets In this section, we first focus on the uninitialized RWS problem (I = S) and provide solutions for the case when S is a basic nondegenerate semialgebraic set (see Def. 1). Let S be a nondegenerate basic semialgebraic sets, as in Def. 1. Let ∂ S be partitioned into nonempty facets F1 , . . . , Flk . Each facet Fk is, in turn, defined by two sets of polynomial inequalities Fk< of inactive V V constraints and Fk= of active constraints: Fk = { pS, j ∈Fk< pS, j (x) < 0 ∧ pS, j ∈Fk= pS, j (x) = 0}. For each state on a facet and not in G, we require the existence of a mode q, whose vector field points inside S. Additionally, we will require a certificate V to decrease everywhere in S \ G. For any . polynomial p, let pq : (∇p) · fq (x). By combining conditions for safety and liveness, one can obtain the following conditions:  .  x ∈ int(S) \ G =⇒ (∃ q) Vq (x) < −ε     .   V  .  V (x) < −ε ∧ p (x) < −ε  q q x ∈ F1 \ G =⇒ (∃ q) = p∈F1 ..   .    .   V .   V (x) < −ε ∧ p (x) < −ε  q q . x ∈ Flk \ G =⇒ (∃ q) p∈F = lk (3) H. Ravanbakhsh & S. Sankaranarayanan 49 The first condition in Eq. (3) states that V must strictly decrease everywhere in the set int(S) \ G. The subsequent conditions treat each facet Fj of the set S and posit the existence of a mode q for each state that causes the active constraints and the function V to decrease. However, we note that as the number of state variables increases, the number of facets can be exponential in the number of inequalities that define S [8] . This poses a serious limitation to the applicability of Eq. (3). Our solution to this problem, is based partly on the idea of exponential barriers discussed by Kong et al. [12]. Rather than force the vector field to point inwards at each facet, we simply ensure that each polynomial inequality pS, j ≤ 0 that defines S, satisfies a decrease condition outside set G. Thus, Eq. (3) is replaced by a simpler (relaxed) condition: . x ∈ S \ G =⇒ (∃ q) Vq (x) < −ε ∧ V . j ( pS, j,q (x) + λ pS, j (x)) < −ε  . (4) Here λ > 0 is a user specified parameter. This rule is a relaxation of (3). The rule is made stronger for larger values of λ . However, larger values of λ can cause numerical difficulties in practice while searching for a control certificate. . For safety constraints, we require pq to be numerically ≤ −ε mainly, to avoid numerical issues. This . can be restrictive for cases where pS, j,q is simply zero. To go around this, we define a set of facets . Jq = { j|(∃x) pS, j,q (x) > 0} for each mode q. Informally speaking, Jq is set of all facets for which change of pS, j must be considered when mode q is selected. Because for each facet j ∈ / Jq , pS, j will never increase as long as mode q is selected. Then, the conditions become: . x ∈ S \ G =⇒ (∃ q) Vq (x) < −ε ∧ V . j∈Jq (( pS, j,q (x) + λ pS, j (x)) < −ε) . (5) As mentioned earlier, the problem of control synthesis consists of two phases. The first phase deals with the problem of finding a control certificate V (x) that satisfies (5). We use a counter-example guided inductive synthesis (CEGIS) framework to find such certificates. In the second phase, a switching strategy is extracted from the control certificate to design the final controller. We now examine each phase, in turn. 3.1 Discovering Control Certificates We now explain the CEGIS framework that searches for a suitable control certificate V . To synthesize a control certificate, we start with a parametric form Vc (x) = V (c, x) : ∑Ni=1 ci gi (x) with some (nonlinear) basis functions g1 (x), . . . , gN (x) chosen by the user, and unknown coefficients c : (c1 , . . . , cN ), s.t. c ∈ C for a compact set C ⊆ RN . The certificate V is a linear function over c. The constraints from Eq. (5) become as follows:  W . V . (∃c ∈ C) (∀x ∈ X) x ∈ S \ G =⇒ q Vq < −ε ∧ j∈Jq ( pS, j,q (x) + λ pS, j (x) < −ε) . (6) The constraints in Eq. (6) has a complex quantifier alternation structure involving the ∃c quantifier nested outside the ∀x quantifier. First, we note that Jq is computed separately and here we assume it is given. Next, we modify an algorithm commonly used for program synthesis problems to the problem of synthesizing the coefficients c ∈ C [26]. The counterexample guided inductive synthesis (CEGIS) approach has its roots in program synthesis, wherein it was proposed as a general approach to solve ∃∀ constraints that arise in such problems [26]. 50 A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems The key idea behind the CEGIS approach is to find solutions to such constraints while using a satisfiability (feasibility) solver for quantifier-free formulas that check whether a given set of constraints without quantifiers have a feasible solution. Solvers like Z3 allow us to solve many different classes of constraints with extensive support for linear arithmetic constraints [18]. On the other hand, general purpose nonlinear delta-satisfiability solvers like dReal, support the solving of quantifier-free nonlinear constraints involving polynomials, trigonometric, and rational functions [3]. However, the presence of quantifiers drastically increases the complexity of solving these constraints. Here, we briefly explain the idea of CEGIS procedure for ∃∀ constraints of the form (∃ c ∈ C) (∀ x ∈ X) Ψ(c, x). Here, c represents the unknown coefficients of a control certificate and x represents the state variables of the system. Our goal is to find one witness for c that makes the overall quantified formula true. The overall approach constructs, maintains, and updates two sets iteratively: 1. Xi ⊆ X is a finite set of witnesses. This is explicitly represented as Xi = {x1 , . . . , xi }. 2. Ci ⊆ C is a (possibly infinite) subset of available candidates. This is implicitly represented by a constraint ψi (c), s.t. Ci : {c ∈ C | ψi (c)}. In the beginning, X0 = {} and ψ0 : true representing the set C0 : C. At each iteration, we perform the following steps: (a) Choose a candidate solution ci+1 ∈ Ci . This is achieved by checking the feasibility of the formula ψi . Throughout this paper, we will maintain ψi as a linear arithmetic formula that involves boolean combinations of linear inequality constraints. Solving these problems is akin to solving linear optimization problems involving disjunctive constraints. Although the complexity is NP-hard, solvers like Z3 integrate fast LP solvers with Boolean satisfiability solvers to present efficient solutions [18]. (b) Test the current candidate. This is achieved by testing the satisfiability of ¬Ψ(c, x) for fixed c = ci+1 . In doing so, we obtain a set of nonlinear constraints over x. We wish to now check if it is feasible. If ¬Ψ(ci+1 , x) has no feasible solutions, then Ψ(ci+1 , x) is true (valid) for all x. Therefore, we can stop with c = ci+1 as the required solution for c. Otherwise, if ¬Ψ(c, x) is feasible for some x = xi+1 , we add it back as a witness: Xi+1 : Xi ∪ {xi+1 }. The formula ψi+1 is given by ψi+1 : ψi ∧ Ψ(c, xi+1 ) . Note that ψi+1 =⇒ ψi , and ci+1 is no longer a feasible point for ψi+1 . The set Ci+1 described by ψi+1 is: Ci+1 : {c ∈ C | Ψ(c, xi ) holds for each xi ∈ Xi+1 } . The CEGIS procedure either (i) runs forever, or (ii) terminates after i iterations with a solution c : ci , or (iii) terminates with a set of witness points Xi proving that no solution exists. We now provide further details of the CEGIS procedure adapted to find a certificate that satisfies Eq. (6). In the CEGIS procedure, the formula Ψ(c, x) will have the following form:   x ∈ R1 =⇒ ϕ1 (c, x)    x ∈ R =⇒ ϕ (c, x) 2 2 (7)  ...    x ∈ R =⇒ ϕ (c, x) , Nj Nj H. Ravanbakhsh & S. Sankaranarayanan 51 and each ϕ j for j = 1, . . . , N j has the form _^ k p j,k,l (c, x) > 0 , (8) l where p j,k,l (c, x) is a function linear in c and possibly nonlinear in x, depending on the dynamics and template used for the control certificate. The CEGIS procedure involves two calls to solvers: (a) Testing satisfiability of ψi (c) and (b) Testing the satisfiability of ¬Ψ(ci+1 , x). We shall discuss each of these problems in the following paragraphs. Finding Candidate Solutions: exists c ∈ C s.t. Given a finite set of witnesses Xi , a solution exists for ψi+1 iff there Nj ^ ^ ! x ∈ R j =⇒ x∈Xi j=1 _^ k p j,k,l (c, x) > 0 , l and since p j,k,l is a linear function in c, such c can be found by solving a formula in Linear Arithmetic Theory (L A ). Finding Witnesses: Finding a witness for a given candidate solution ci involves checking the satisfiability ¬Ψ. Whereas Ψ is a conjunction of N j clauses, ¬Ψ is a disjunction of clauses. The jth clause in ¬Ψ (1 ≤ j ≤ N j ) has the form ^_ x ∈ Rj ∧ p j,k,l (ci , x) ≤ 0 . (9) k l We will test each clause separately for satisfiability. Assuming that p j,k,l is a general nonlinear function over x, SMT solvers like dReal [3] can be used to solve this over a compact set R j . Numerical SMT solvers like dReal can either conclude that the given formula is unsatisfiable or provide a solution to a “nearby” formula that is δ close. The parameter δ is adjusted by the user. As a result, dReal can correctly conclude that the current candidate yields a valid certificate. On the other hand, its witness may not be a witness for the original problem. In this case, using the spurious witness may cause the CEGIS procedure to potentially continue (needlessly) even when a solution ci has been found. Nevertheless, the overall procedure produces a correct result whenever it terminates with an answer. Example 1 This example is adopted from [19]. There are two variables and three control modes with the dynamics given below:  .          x1 −x2 − 1.5x1 − 0.5x13 0 0 2 + Bq , Bq1 = , Bq2 = , Bq3 = . . = x2 x1 −x22 + 2 −x2 10 The goal is to reach the target set G : (x1 +0.75)2 +(x2 −1.75)2 ≤ 0.252 , a circle centered at (−0.75, 1.75), as shown in Figure 1a, while staying in the safe region given by the rectangle S0 : [−2, 2] × [−2, 3]: S0 : {x|(x1 + 2)(x1 − 2) ≤ 0 ∧ (x2 + 2)(x2 − 3) ≤ 0} . First, we shift co-ordniates to transform (−0.75, 1.75) as the new origin. Then, we use a quadratic template for V (c1 x12 + c2 x1 x2 + c3 x22 ) , ε = 1, λ = 5. The solution V is found in 5 iterations. Then, we translate the function back to the original co-ordinates: V (x1 , x2 ) :37.782349x12 − 2.009762x1 x2 + 60.190607x1 + 4.415093x22 − 16.960145x2 + 37.411604 . 52 A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems Example 2 A unicycle [37] has three variables. x and y .are position of the car and θ is its angle. The . . dynamics of the system is x = u1 cos(θ ) , y = u1 sin(θ ) , θ = u2 , where u1 and u2 are inputs. Assuming a switched system, we consider u1 ∈ {−1, 0, 1} and u2 ∈ {−1, 0, 1}. The safe set is [−1, 1] × [−1, 1] × [−π, π] and the target facet is x = 1. We use a template that is linear in (x, y) and quadratic in θ . Using ε = 0.1 and λ = 0.5, the following CLF is found after 22 iterations: V (x) : −x − y − 0.5881θ + θ 2 − 0.1956θ x + θ y . Example 3 This example is adopted from [7]. There are four variables and two control inputs. The dynamic is as follows:     .   u1 x1 + x2 + 8 x1  x.2   −x2 + x3 + 1   −u2      . =  x3   −2x3 + 2x4 + 1  +  −2u1  . . u2 −3x4 + 1 x4 The region of interest S is hyber-box [−1, 1]4 and the input belongs to set [0, 1] × [0, 2]. The goal is to reach facet x1 = 1, while staying in S as the safe region. First, we discretize the control input to model the system as a switched system. For this purpose, we assume u1 ∈ {0, 1} and u2 ∈ {0, 0.5, 1, 1.5, 2}. Then, we use a linear template for the CLF (c1 x1 + c2 x2 + c3 x3 + c4 x4 ) , ε = 0.1, λ = 5. CEGIS framework finds certificate V (x) : −0.13333344(x1 + x2 + x3 + x4 ). 3.2 Control Design Thus far, we discussed the CEGIS framework for finding a control certificate. Extracting the K function from the certificate is now considered. Given a control certificate V satisfying Eq. (5), the choice of a switching mode is dictated by a function ηq (x) defined for each state x ∈ X and mode q ∈ Q as follows:  . ηq (x) : max Vq (x), ηS,1,q (x), · · · , ηS,k,q (x) , . where for all j ∈ Jq , ηS, j,q is pS, j,q + λ pS, j and for j ∈ / Jq , ηS, j,q = −∞ or equivalently ηS, j,q = −L for some large constant L. The idea is that whenever (at time t) the controller chooses a mode q s.t. ηq (x(t)) < −ε, one can guarantee that ηq (x(t)) < 0 holds for all t ∈ [T, T + δ ), for some minimum time δ . Therefore, for some fixed εs (0 < εs < ε), the function K for any x ∈ S \ G can be defined as     q̂ if  η (x) ≥ −ε ∧ η (x) < −ε q s q̂  K (q, x) := (10)   q otherwise . In other words, the controller state persists in a given mode q until ηq (x) ≥ −εs . Then, given that x ∈ S \ G, Eq. (5) will provide us a new control mode q̂ that satisfies ηq̂ (x) < −ε. This mode is chosen as the next mode to switch to. Example 4 Consider once again, the problem from Ex. 1. Using the defined function V (x1 , x2 ), Eq. (10) yields a controller. Figure 1b shows some of the simulation traces of this closed loop system, demonstrating the RWS property. H. Ravanbakhsh & S. Sankaranarayanan 53 (a) (b) Figure 1: (a) Region G for Example 1 is shown shaded in the center, and the vector fields for modes q1 , q2 and q3 are shown in red, green and blue, respectively. Level-sets of V are shown with black dashed lines. (b) Closed loop trajectories for Example 1 using the controller defined by Eq. (10). The segments shown in colors red, green and blue correspond to the modes q1 , q2 and q3 , respectively. We now establish the key result that provides a minimum dwell time guarantee. Lemma 1 There exists a δ > 0 s.t. for all initial conditions x(T ) ∈ S \ G, if ηq (x(T )) < −ε, and if the mode of the system is set to q at time T , then (∀t ∈ [T, T + δ ]) (x(t) ∈ S \ G) =⇒ ηq (x(t)) ≤ −εs . Proof Let T + δ be the earliest time instant, where ηq (x(T + δ )) ≥ −εs while at the same time (∀t ∈ [T, T + δ ]) q(t) = q, x(t) ∈ S \ G . At time T , ηq (x(T )) < −ε and at time T + δ , ηq (x(T + δ )) = −εs . Note that ηq (x) is defined as max(α1 (x), . . . , αm (x)) for some smooth functions α1 , . . . , αm . As a result, Since S is a bounded set, and p, fq , and V are bounded over S, there exists a constant Λ > 0 s.t. . (∀ x ∈ S) αi,q ≤ Λ . Therefore, for each αi , we have Z T +δ αi (x(T + δ )) = αi (x(T )) + . αi,q (x(t))dt ≤ αi (x(T )) + Λδ . t=T As a result, we conclude that ηq (x(T + δ )) = max αi (x(T + δ )) = α j∗ (x(T + δ )) ≤ α j∗ (x(T )) + Λδ ≤ ηq (T ) + Λδ . i (11) 54 A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems Therefore, we can conclude −εs < −ε + Λδ =⇒ ε−εs Λ < δ and there exists a fixed δ > ε−εs Λ > 0 s.t. (∀t ∈ [T, T + δ )) ηq (x(t)) < −εs . Eq. (10) gives a switching strategy which respects the. min-dwell time and as long as x(t) ∈ S, the . controller guarantees ηq(t) (x(t)) ≤ −εs . I.e. for all j ∈ Jq , Vq (x(t)) ≤ −εs and pS, j,q (x(t))+λ pS, j (x(t)) ≤ −εs . Theorem 1 Given nondegenerate basic semialgebraic set S, a semialgebraic set G, and a function V (satisfying Equation (5)), the control strategy defined by Eq. (10) respects the min-dwell time property and guarantees the RWS property defined by S, G: S =⇒ SU G. Proof As discussed, there exists a controller which respects the min-dwell time property. Also, the . . controller guarantees Vq (x) ≤ −εs and ( pS, j,q (x) + λ pS, j (x) ≤ −εs (for all j ∈ Jq ), as long as x ∈ S \ G. Assume x(t) is on the boundary of S (and not in G) at some time t. Because S is assumed to be a nondegenerate basic semialgebraic set, there exists at least one j s.t. pS, j (x(t)) = 0. If j ∈ / Jq , by . definition, pS, j,q is negative for all states and pS, j,q remains ≤ 0 as long as mode q is selected. Otherwise . ( j ∈ Jq ), we obtain pS, j,q (x(t)) ≤ −εs < 0. Therefore, there exits τ j > 0, s.t. s ∈ (t,t + τ j ), we conclude that pS, j,q (x(s)) < 0. As a result, the trajectory cannot leave the set S. Thus, the trace cannot leave S, unless it reaches G. Now, we show that the trajectory cannot stay inside S \ G forever. By the construction of the controller, we can conclude . time diverges (because the controller respects the min-dwell time property) and that V decreases (Vq (x(t)) ≤ −εs ). However, the value of V is bounded on bounded set S \ G. Therefore, x cannot remain in S \ G and the only possible outcome for the trace is to reach G.  4 RWS for Semialgebraic Safe Set As Habets et al [6] discussed, control-to-facet problems can be used to build an abstraction. Here, we demonstrate that the method described so far can be integrated in this framework to tackle more complicated problems. First, we briefly explain how the method works. For a more detailed discussion, the reader can refer to [6] or [11]. First, state space is decomposed into polytopes according to the specifications. Here, we can use basic semialgebraic sets instead of polytopes. Then, for each such a set u, we consider an abstract state A (u). Furthermore, for each of its n − 1 dimensional facet F, a control-to-facet problem is solved. The corresponding problem is to find a control strategy to reach F starting from u. If the control-to-facet problem is solved successfully, then for each basic semialgebraic set v with a n − 1 dimensional facet F 0 ⊆ F, an edge from A (u) to A (v) (with label/action F) is added to the abstraction. Also for each basic semialgebraic set u, one can check if u is a control invariant to build self loops. However, for RWS properties, self loops are redundant and we skip them here. After building the abstract system, we use standard techniques to solve the problem for finite systems. If the problem could be solved for the abstract system, then, one can design a controller. First, for each abstract state A (u), there is at least one action F that agrees with the winning strategy for the abstract system. Let that action be F (A (u)). The idea is to implement transition F (A (u)), using controller Ku,F (A (u)) for the corresponding control-to-facet problem [6]. Formally, the controller H. Ravanbakhsh & S. Sankaranarayanan 55 can be defined as follows:    Ku1 ,F (A (u1 )) (q, x) . K (q, x) = ..   K (q, x) x ∈ u1 (12) x ∈ us . us ,F (A (us )) When x belongs to multiple sets, one can break the tie by some ordering, where states in the winning set have priorities. It is worth mentioning that combining these controllers together, does not produce any Zeno behavior as it is guaranteed that each abstract state is visited only once for RWS properties. However, superdense switching is possible as two facets of a polytope can get arbitrarily close. If one is interested in LTL properties (not just reach-while-stay) or min-dwell time property, one possible solution is to use fat facets, where the target sets are n dimensional goal sets. This extends the domain of the control-to-facet problem to adjacent basic semialgebraic sets as well. Also, it allows the controller to continue using current sub-controller for some minimum time (if min-dwell time requirement is not met), before changing the sub-controller (at the switch time). Example 5 Consider again the system from Example 1, with the addition of some obstacles [19]. More precisely, as shown in Fig 2a, safe set is S = S0 \ (O1 ∪ O2 ). First, the safe set is decomposed into four basic semialgebraic sets, which are shown with R0 to R3 in Fig. 2a. R0 is the target set. Next, we build a transition O relation between four abstract states, representR ing four basic semialgebraic sets. This is done R Converge R by solving seven RWS problems for basic semialLeft Diverge R gebraic sets. For R1 to R0 , we use a quadratic R R template for V , and for other problems, we use Up linear template. The abstract system is shown in Left R O Fig. 2b. Next, the problem is solved for the abR stract system. The solution to the abstract system (b) is simple: if the state is in R2 , the controller uses (a) the left facet to reach R1 or R3 . Otherwise, if the state is in R3 , the controller uses the upper facet Figure 2: (a) Schematic view of state decomposito reach R1 and finally, if the state is in R1 , the tion. (b) Finite abstraction for the original problem. controller makes sure the state reaches R0 . 2 1 0 0 2 1 2 1 3 3 Example 6 This example is a path planning problem for the unicycle [25]. Projection of safe set on x and y yields a maze. The target set is placed at the right bottom corner of the maze (Fig. 3). Using specification-guided technique, we modeled the system with 53 polyhedra. Each polyhedron is treated as a single state and a transition relation is built by solving 113 control-to-facet problems. Then, the problem is solved over the finite graph. The total computation took 1484 seconds. The figure also shows a single trajectory of the closed loop system. Example 7 This example is similar to Example 6, except for the fact that there is no direct control over the angular velocity. More precisely, only the angular acceleration is controllable and the system would . . . . have the following dynamics x = u1 cos(θ ), y =p u1 sin(θ ), θ = ω, ω = u2 . Also, we assume ω ∈ [−1, 1]. By changing the coordinates one can use r = x2 + y2 , z1 = x cos(θ ) + y sin(θ ) and z2 = y cos(θ ) − x sin(θ ) to define position and angle of the car(cf. [13] for details). Then, we use the following template V (x, y, θ , ω) = c1 r2 + c2 z1 + c3 z2 ω + c4 ω 2 , where the origin is located just outside of the target facet. Using this template, we find control certificates for all 113 control-to-facet problems in 5296 seconds. 56 A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems Figure 3: Region G is shown shaded in Orange, and unsafe regions are shown in blue. An execution trace of the car is shown for x and y variables. 5 Initialized Reach-While-Stay So far, we discussed uninitialized RWS specifications (S =⇒ SU G). In these systems, we use boundary of safe set as barrier. However, as pointed out by Lin et al. [14], this may not be the case. Now, we consider the initialized problem for a given initial set I (I =⇒ SU G). To avoid technical difficulties, we assume that I ⊆ int(S). The solution is to create a composite barrier that is formed by the boundary of S as well as other a priori unknown barrier functions. Barrier Functions: We recall that for a control barrier function [29, 36], the following conditions are considered x ∈ ∂ S =⇒ B(x) > 0 x ∈ I =⇒ B(x) (13)  <0  x ∈ S =⇒ . B(x) = 0 =⇒ (∃q)Bq (x) < −ε . This ensures that B(x) = 0 is a barrier and ∂ S is unreachable. Eq. (13), combined with the smoothness of B and fq ensures that as soon as the state is sufficiently “close” to the barrier, it is possible to choose a control mode that ensures the local decrease of the B. The condition in Equation (13) can be encoded into the CEGIS framework. However, the presence of the equality B(x) = 0 poses practical problems. In particular, it requires for each candidate Bc , to find a counterexample x s.t. Bc (x) 6= 0. Unfortunately, such an assertion is easy to satisfy, resulting in the procedure always exceeding the maximum number of iterations permitted. Again, we find that the following relaxation of the third condition is particularly effective in our experiments x ∈ ∂ S =⇒ B(x) > 0 x ∈ I =⇒ B(x) < 0 (14)  . . W x ∈ S =⇒ q Bq (x) − λ B(x) < −ε ∨ Bq (x) + λ B(x) < −ε , for some constant λ . Intuitively, by choosing λ = 0, the condition is similar to that of Lyapunov functions, whereas as |λ | → ∞, the condition gets less conservative and in the limit, it is equivalent to the original condition. H. Ravanbakhsh & S. Sankaranarayanan 57 In fact, for smaller |λ | CEGIS terminates faster, but at the cost of missing potential solutions. On the other hand, using larger |λ |, is less conservative at the cost of CEGIS timing out. We also note that this formulation is less conservative than the one introduced by Kong et al. [12] as our formulation uses two exponential conditions which only forces decrease of value of B around B∗ = {x | B(x) = 0}. To solve the RWS in general form, we define a finite set of barriers B with the following conditions: x ∈ ∂ S =⇒ B∈B B(x) > 0 V x ∈ I =⇒ B∈B B(x) < 0 . W (15) . Also for each mode q, Bq is defined as Bq = {B ∈ B|(∃x)Bq (x) > 0}. Then, existence of a proper mode can be encoded as the following:    .    V . Bq (x) + λ B(x) < −ε∨ . x ∈ S \ G =⇒ Vq (x) < −ε ∧ B∈Bq . (16) Bq (x) − λ B(x) < −ε Theorem 2 Given nondegenerate basic semialgebraic set S, semialgebraic sets I and G, function V , and a non-empty set of functions B (satisfying Equation (15) and (16)), there is a control strategy that respects the min-dwell time property and guarantees the RWS property: I =⇒ SU G. To simplify these constraints and reduce the number of unknowns, one can use some of pS,i ’s to fix some of these barriers, which yields conditions similar to the ones used for the uninitialized problem. This trick is demonstrated in the following example. Example 8 This example is taken from [16], in which a DC-DC converter is modeled with two variables i and v. The system has two modes q1 and q2 , with the following dynamics: B2 = 0 (. B4 = 0 S i = 0.0167i + 0.3333 q1 : . v = −0.0142v (. G i = −0.0183i − 0.0663v + 0.3333 q2 : . v = −0.0711i − 0.0142v . The safe set is S : [0.65, 1.65] × [4.95, 5.95] and the goal set is G : [1.25, 1.45] × [5.55, 5.75]. We assume initial set to be I : [0.85, 0.95] × [5.15, 5.25] (Fig. 4). Then, we use 5 barriers B0 , . . . , B4 . Using boundaries of S, we choose B1 , . . . , B4 as follows: B1 =0.65 − i + εb B2 = 1.65 − i + εb B3 =4.95 − v + εb B4 = 5.95 − v + εb , B0 = 0 I B5 = 0 B3 = 0 B1 = 0 Figure 4: The blue lines are the barriers and the red lines are level-sets of the Lyapunov function. where εb > 0 is small enough that I ⊂ int( 4i=1 Bi ). In this case, we choose εb = 0.01. Notice that such εb always exists by the definition. Next, we assume B0 = V and both have the following template: T B0 = V : c1 (i − 1.35)2 + c2 (i − 1.35)(v − 5.65) + c3 (v − 5.65)2 − 1 . This template is chosen in a way that V is a quadratic function with minimum value of −1 for the point of interest i = 1.35, v = 5.65. So far, we used these tricks to reduce the number of unknowns for barriers. 58 A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems Table 1: Results of Comparison with SCOTS on examples Legend: n: # state variables, itr : # iterations, Time: total computation time, η: state discretization step, τ: time step. All timings are in seconds and rounded, TO: timeout (> 10 hours). Problem ID n Ex. 5 2 Ex. 8 2 Ex. 6 3 Ex. 3 4 Ex. 7 4 η 0.162 0.012 0.22 ×0.1 0.03×0.13 0.12 ×0.052 SCOTS τ itr Time 0.12 18 0 1.0 106 1 0.3 404 989 0.005 48 304 0.3 TO CEGIS δ Time −4 10 3 10−4 39 10−4 1484 10−5 3 −4 10 5296 However, our method fails to find a certificate. Next, we add one more barrier (B5 ) to the formulation and we use the following template for B5 : c4 (i − 0.9)2 + c5 (i − 0.9)(v − 5.2) + c6 (v − 5.05)2 − 1, which is a quadratic function with minimum value of −1 for initial point i = 0.9, v = 5.2. This time, we can successfully find a control certificate. The final barriers and level-sets of the Lyapunov function is shown in Fig. 4. Comparison: While abstraction based methods can provide a near optimal solution (are relatively complete), these methods can be computationally expensive. On the other hand, our method is a Lyapunovbased method and the solution is not necessarily (relatively) complete. For example, our approach assumes that control certificates with a given form (that is given as input by user) exist . As such, the existence of such certificates is not guaranteed and thus, our approach lacks the general applicability of a fixed-point based synthesis. Also, for initialized problems our method needs an initial set as input, while for the abstraction based methods, maximum controllable region can be obtained without the need for specifying the initial set. However, our method is relatively more scalable thanks to recent development in SMT solvers. Here, for the sake of completeness, we provide a brief comparison with SCOTS toolbox [25] for the examples provided in this article. To compare Example 3, we use fat facet and assume target set has a volume (otherwise, because of time discretization, SCOTS cannot find a solution). More precisely, we use target set [1, 1.2] × [−1, 1]3 instead of [1, 1] × [−1, 1]3 . All the experiments are ran on a laptop with Core i7 2.9 GHz CPU and 16GB of RAM. The results are reported in Table 1. We also note that if we use larger values for SCOTS parameters, SCOTS fails to solve these problems (initial set is not a subset of controllable region). Table 1 shows that SCOTS performs much better for Example 5 and 8 for which there are only 2 state variables. For Example 6, both methods have similar performances. And for Example. 3 and Example.7, which have 4 state variables, our method is faster. 6 Conclusions In this paper, given a switched system, we addressed controller synthesis problems for RWS with composite barriers. Specifically, we addressed uninitialized problems which are useful for building an abstraction, as well as initialized problems. For each problem, we provided sufficient conditions in terms of “existence of a control certificate”. Also, we demonstrated that searching for a control certificate can be encoded into constrained problems and solving these problems is computationally feasible. In the future, H. Ravanbakhsh & S. Sankaranarayanan 59 we wish to investigate how the initialized RWS problems can be extended to be used along fixed-point computation based techniques as it allows more flexible switching strategies. Acknowledgments This work was funded in part by NSF under award numbers SHF 1527075 and CPS 1646556. All opinions expressed are those of the authors and not necessarily of the NSF. References [1] Zvi Artstein (1983): Stabilization with relaxed controls. Nonlinear Analysis: Theory, Methods & Applications 7(11), pp. 1163 – 1173, doi:10.1016/0362-546X(83)90049-4. Available at http://www. sciencedirect.com/science/article/pii/0362546X83900494. [2] Rayna Dimitrova & Rupak Majumdar (2014): Deductive control synthesis for alternating-time logics. In: 2014 International Conference on Embedded Software, EMSOFT 2014, New Delhi, India, October 12-17, 2014, pp. 14:1–14:10, doi:10.1145/2656045.2656054. [3] Sicun Gao, Soonho Kong & Edmund M. Clarke (2013): dReal: An SMT Solver for Nonlinear Theories over the Reals. In: Automated Deduction - CADE-24 - 24th International Conference on Automated Deduction, Lake Placid, NY, USA, June 9-14, 2013. Proceedings, pp. 208–214, doi:10.1007/978-3-642-38574-2 14. Available at https://doi.org/10.1007/978-3-642-38574-2_14. [4] L. El Ghaoui & V. Balakrishnan (1994): Synthesis of fixed-structure controllers via numerical optimization. In: Proceedings of 1994 33rd IEEE Conference on Decision and Control, 3, pp. 2678–2683 vol.3, doi:10.1109/CDC.1994.411398. [5] A. Girard, G. Pola & P. Tabuada (2010): Approximately Bisimilar Symbolic Models for Incrementally Stable Switched Systems. IEEE Transactions on Automatic Control 55(1), pp. 116–126, doi:10.1109/TAC.2009.2034922. [6] L. C. G. J. M. Habets, P. J. Collins & J. H. van Schuppen (2006): Reachability and control synthesis for piecewise-affine hybrid systems on simplices. IEEE Transactions on Automatic Control 51(6), pp. 938–948, doi:10.1109/TAC.2006.876952. [7] L.C.G.J.M. Habets & J.H. van Schuppen (2004): A control problem for affine dynamical systems on a fulldimensional polytope. Automatica 40(1), pp. 21 – 35, doi:10.1016/j.automatica.2003.08.001. Available at http://www.sciencedirect.com/science/article/pii/S0005109803002620. [8] M. K. Helwa & M. E. Broucke (2011): doi:10.1109/CDC.2011.6160866. Monotonic reach control on polytopes, pp. 4741–4746. [9] Z. Huang, Y. Wang, S. Mitra, G. E. Dullerud & S. Chaudhuri (2015): Controller synthesis with inductive proofs for piecewise linear systems: An SMT-based algorithm. In: 2015 54th IEEE Conference on Decision and Control (CDC), pp. 7434–7439, doi:10.1109/CDC.2015.7403394. [10] Manuel Mazo Jr., Anna Davitian & Paulo Tabuada (2010): PESSOA: A Tool for Embedded Controller Synthesis. In: Computer Aided Verification, 22nd International Conference, CAV 2010, Edinburgh, UK, July 15-19, 2010. Proceedings, pp. 566–569, doi:10.1007/978-3-642-14295-6 49. Available at https: //doi.org/10.1007/978-3-642-14295-6_49. [11] M. Kloetzer & C. Belta (2008): A Fully Automated Framework for Control of Linear Systems from Temporal Logic Specifications. IEEE Transactions on Automatic Control 53(1), pp. 287–297, doi:10.1109/TAC.2007.914952. [12] Hui Kong, Fei He, Xiaoyu Song, William N. N. Hung & Ming Gu (2013): Exponential-Condition-Based Barrier Certificate Generation for Safety Verification of Hybrid Systems. In: Computer Aided Verification - 25th 60 A Class of Control Certificates to Ensure Reach-While-Stay for Switched Systems International Conference, CAV 2013, Saint Petersburg, Russia, July 13-19, 2013. Proceedings, pp. 242–257, doi:10.1007/978-3-642-39799-8 17. Available at https://doi.org/10.1007/978-3-642-39799-8_17. [13] Daniel Liberzon (2012): Switching in systems and control. doi:10.1007/978-1-4612-0017-8. Springer Science & Business Media, [14] Z. Lin & M. E. Broucke (2007): Reachability and control of affine hypersurface systems on polytopes. In: 2007 46th IEEE Conference on Decision and Control, pp. 733–738, doi:10.1109/CDC.2007.4434805. [15] J. Liu, N. Ozay, U. Topcu & R. M. Murray (2013): Synthesis of Reactive Switching Protocols From Temporal Logic Specifications. IEEE Transactions on Automatic Control 58(7), pp. 1771–1785, doi:10.1109/TAC.2013.2246095. [16] Sebti Mouelhi, Antoine Girard & Gregor Gössler (2012): CoSyMA: A Tool for Controller Synthesis Using Multi-scale Abstractions. Research Report RR-8108, INRIA. Available at https://hal.inria.fr/ hal-00743982. [17] Sebti Mouelhi, Antoine Girard & Gregor Gößler (2013): CoSyMA: a tool for controller synthesis using multiscale abstractions. In: Proceedings of the 16th international conference on Hybrid systems: computation and control, HSCC 2013, April 8-11, 2013, Philadelphia, PA, USA, pp. 83–88, doi:10.1145/2461328.2461343. [18] Leonardo Mendonça de Moura & Nikolaj Bjørner (2008): Z3: An Efficient SMT Solver. In: Tools and Algorithms for the Construction and Analysis of Systems, 14th International Conference, TACAS 2008, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2008, Budapest, Hungary, March 29-April 6, 2008. Proceedings, pp. 337–340, doi:10.1007/978-3-540-78800-3 24. Available at https://doi.org/10.1007/978-3-540-78800-3_24. [19] P. Nilsson & N. Ozay (2014): Incremental synthesis of switching protocols via abstraction refinement. In: 53rd IEEE Conference on Decision and Control, pp. 6246–6253, doi:10.1109/CDC.2014.7040368. [20] N. Ozay, J. Liu, P. Prabhakar & R. M. Murray (2013): Computing augmented finite transition systems to synthesize switching protocols for polynomial switched systems. In: 2013 American Control Conference, pp. 6237–6244, doi:10.1109/ACC.2013.6580816. [21] S. Prajna, A. Papachristodoulou & P. A. Parrilo (2002): Introducing SOSTOOLS: a general purpose sum of squares programming solver. In: Proceedings of the 41st IEEE Conference on Decision and Control, 2002., 1, pp. 741–746 vol.1, doi:10.1109/CDC.2002.1184594. [22] H. Ravanbakhsh & S. Sankaranarayanan (2015): Counter-Example Guided Synthesis of control Lyapunov functions for switched systems. In: 2015 54th IEEE Conference on Decision and Control (CDC), pp. 4232– 4239, doi:10.1109/CDC.2015.7402879. [23] Hadi Ravanbakhsh & Sriram Sankaranarayanan (2016): Robust Controller Synthesis of Switched Systems Using Counterexample Guided Framework. In: Proceedings of the 13th International Conference on Embedded Software, EMSOFT ’16, ACM, pp. 8:1–8:10, doi:10.1145/2968478.2968485. [24] Bartek Roszak & Mireille E. Broucke (2006): Necessary and sufficient conditions for reachability on a simplex. Automatica 42(11), pp. 1913 – 1918, doi:10.1016/j.automatica.2006.06.003. Available at http: //www.sciencedirect.com/science/article/pii/S0005109806002445. [25] Matthias Rungger & Majid Zamani (2016): SCOTS: A Tool for the Synthesis of Symbolic Controllers. In: Proceedings of the 19th International Conference on Hybrid Systems: Computation and Control, HSCC 2016, Vienna, Austria, April 12-14, 2016, pp. 99–104, doi:10.1145/2883817.2883834. [26] Armando Solar Lezama (2008): Program Synthesis By Sketching. Ph.D. thesis, EECS Department, University of California, Berkeley. Available at http://www2.eecs.berkeley.edu/Pubs/TechRpts/2008/ EECS-2008-177.html. [27] Eduardo D. Sontag (1989): A universal construction of Artstein’s theorem on nonlinear stabilization. Systems & Control Letters 13(2), pp. 117 – 123, doi:10.1016/0167-6911(89)90028-5. Available at http://www. sciencedirect.com/science/article/pii/0167691189900285. H. Ravanbakhsh & S. Sankaranarayanan 61 [28] Ankur Taly, Sumit Gulwani & Ashish Tiwari (2011): Synthesizing switching logic using constraint solving. STTT 13(6), pp. 519–535, doi:10.1007/s10009-010-0172-8. Available at https://doi.org/10.1007/ s10009-010-0172-8. [29] Ankur Taly & Ashish Tiwari (2010): Switching logic synthesis for reachability. In: Proceedings of the 10th International conference on Embedded software, EMSOFT 2010, Scottsdale, Arizona, USA, October 24-29, 2010, pp. 19–28, doi:10.1145/1879021.1879025. [30] Weehong Tan & Andrew Packard (2004): Searching for control Lyapunov functions using sums of squares programming. In: Allerton conference on communication, control and computing, pp. 210–219. [31] Y. Tazaki & J. i. Imura (2012): Discrete Abstractions of Nonlinear Systems Based on Error Propagation Analysis. IEEE Transactions on Automatic Control 57(3), pp. 550–564, doi:10.1109/TAC.2011.2161789. [32] Wolfgang Thomas, Thomas Wilke et al. (2002): Automata, logics, and infinite games: a guide to current research. 2500, Springer Science & Business Media, doi:10.1007/3-540-36387-4. [33] Peter Wieland & Frank Allgwer (2007): CONSTRUCTIVE SAFETY USING CONTROL BARRIER FUNCTIONS. IFAC Proceedings Volumes 40(12), pp. 462 – 467, doi:10.3182/20070822-3-ZA-2920.00076. Available at http://www.sciencedirect.com/science/article/pii/S1474667016355690. 7th IFAC Symposium on Nonlinear Control Systems. [34] T. Wongpiromsarn, U. Topcu & A. Lamperski (2016): Automata Theory Meets Barrier Certificates: Temporal Logic Verification of Nonlinear Systems. IEEE Transactions on Automatic Control 61(11), pp. 3344–3355, doi:10.1109/TAC.2015.2511722. [35] Tichakorn Wongpiromsarn, Ufuk Topcu, Necmiye Ozay, Huan Xu & Richard M. Murray (2011): TuLiP: A Software Toolbox for Receding Horizon Temporal Logic Planning. In: Proceedings of the 14th International Conference on Hybrid Systems: Computation and Control, HSCC ’11, ACM, New York, NY, USA, pp. 313–314, doi:10.1145/1967701.1967747. [36] Xiangru Xu, Paulo Tabuada, Jessy W. Grizzle & Aaron D. Ames (2015): Robustness of Control Barrier Functions for Safety Critical Control**This work is partially supported by the National Science Foundation Grants 1239055, 1239037 and 1239085. IFAC-PapersOnLine 48(27), pp. 54 – 61, doi:10.1016/j.ifacol.2015.11.152. Available at http://www.sciencedirect.com/science/article/pii/S2405896315024106. Analysis and Design of Hybrid Systems ADHS. [37] M. Zamani, G. Pola, M. Mazo & P. Tabuada (2012): Symbolic Models for Nonlinear Control Systems Without Stability Assumptions. IEEE Transactions on Automatic Control 57(7), pp. 1804–1809, doi:10.1109/TAC.2011.2176409.
3cs.SY
Subjective Knowledge Acquisition and Enrichment Powered By Crowdsourcing Rui Meng Hao Xin Lei Chen Yangqiu Song arXiv:1705.05720v1 [cs.DB] 16 May 2017 Department of Computer Science and Engineering, HKUST, Hong Kong SAR, China {rmeng,hxinaa,leichen,yqsong}@cse.ust.hk ABSTRACT being “subjective” by workers [19], 63% of location-based queries in mobile search are asking for subjective opinions [7], and need the corresponding subjective knowledge as the query answers. For example, there might exist such queries, “popular American singers” or “beautiful cities in Europe”, we refer the knowledge concerning popular singers and beautiful cities as the subjective knowledge. More specifically, subjective knowledge refers to the dominant opinion about whether a particular subjective property applies to entities of a particular type [25]. For instance, given a pair consists of a subjective property1 and a type from a KB (subjective property-type pair, ST pair), e.g., POPULAR and SINGER, we can find a list of instances of the type SINGER from the KB, e.g., E LVIS P RESLEY, where the dominant opinion of “whether Elvis Presley is a popular singer” is a piece of subjective knowledge. As this kind of information is missing in existing KBs, queries concerning such information cannot be satisfied. Fortunately, crowdsourcing, which has been recently proved to be successful for various human intrinsic tasks such as entity resolution [28], knowledge extraction [13], translation [31], etc., provides a natural and reliable way of obtaining the subjective knowledge by collecting opinions from workers. Many works have been done to perform KB enrichment, completion and population [9] [29] [4] [12] [11], but none of these works focus on the subjective dimension. For subjective knowledge acquisition, the state-of-the-art approach is to use information extraction techniques to mine the text of Web contents [25]. However, it only relies on machine-based technique and online Web data, and does not consider to incorporate the wisdom of the crowd and existing KB information. Thus, the precision is far from satisfactory, i.e. SURVEYOR has the precision of 77% [25]. To the best of our knowledge, we are the first to leverage the collaborative knowledge from both the crowd and existing KBs to perform subjective knowledge acquisition and KB enrichment in the subjective dimension. Challenge. Leveraging the power of the crowd for knowledge acquisition comes with the challenge of “How to resolve the conflict between large scale knowledge facts and the limited crowdsourcing resource?”. Real world KBs are often in very large scales, e.g., YAGO has 2,747,873 entities and 292,898 types, DBpedia has 2,531,369 entities and 827 types, while each crowdsourcing operation is associated with a monetary cost and is somewhat timeconsuming. Therefore, it is infeasible and costly to ask the crowd to carry the whole burden of subjective knowledge acquisition task. In our system CoSKA, we make use of the knowledge in existing KBs and the semantic relationship among subjective properties to perform knowledge inference and based on the inference power, the most beneficial questions are identified for crowdsourcing. Framework. The input of CoSKA is a list of ST pairs mined from the corpus and a KB. The output is a list of subjective knowl- Knowledge bases (KBs) have attracted increasing attention due to its great success in various areas, such as Web and mobile search. Existing KBs are restricted to objective factual knowledge, such as CITY POPULATION or FRUIT SHAPE , whereas, subjective knowledge, such as BIG CITY, which is commonly mentioned in Web and mobile queries, has been neglected. Subjective knowledge differs from objective knowledge in that it has no documented or observed ground truth. Instead, the truth relies on people’s dominant opinion. Thus, we can use the crowdsourcing technique to get opinion from the crowd. In our work, we propose a system, called crowdsourced subjective knowledge acquisition (CoSKA), for subjective knowledge acquisition powered by crowdsourcing and existing KBs. The acquired knowledge can be used to enrich existing KBs in the subjective dimension which bridges the gap between existing objective knowledge and subjective queries. The main challenge of CoSKA is the conflict between large scale knowledge facts and limited crowdsourcing resource. To address this challenge, in this work, we define knowledge inference rules and then select the seed knowledge judiciously for crowdsourcing to maximize the inference power under the resource constraint. Our experimental results on real knowledge base and crowdsourcing platform verify the effectiveness of CoSKA system. 1. INTRODUCTION Motivation. In recent years, knowledge bases (KBs) have become increasingly popular and large-scale KBs have been constructed, such as Freebase [2], DBpedia [17], YAGO [10], KnowItAll [8], etc. The KBs encode information and knowledge of the real world in a structured, machine-understandable way which can empower various kinds of applications, especially Web and mobile search. Despite of containing millions of knowledge facts on large amount of entities and relations, the knowledge encoded by these KBs is limited in objective dimension. In other words, existing KBs have so far focused on encoding objective knowledge facts, which are factual and observable, such as FRUIT SHAPE, MOVIE DIREC TOR and so forth. In contrast, many real world queries are subjective, e.g., around 20% of product-related queries are labeled as 1 1 Typically expressed as an adjective Figure 1: Framework of CoSKA. edge facts and enriched KB. CoSKA consists of three stages: ST pair selection, crowdsourced ST pair applying, and knowledge inference. The details of the framework is shown in Figure 1. 1) ST Pair Selection: Given the large amount of ST pairs, we need to identify the benefit of each pair and select them judiciously for subsequent crowdsourced ST pair applying as the process needs the involvement of crowd workers. We first define some subjective knowledge inference rules. Then the ST pair selection problem is formulated as a Maximum Knowledge Inference Problem. We show that the problem is NP-hard and propose a diversity-aware forward greedy algorithm for ST pair selection. 2) Crowdsourced ST Pair Applying: For each selected ST pair, the task of subjective knowledge acquisition is to identify the opinions that whether the subjective property can be applied to the instances of the type powered by crowdsourcing, referred as crowdsourced ST pair applying. However, asking the crowd for every instance is still too costly as a type could contain hundreds of thousands instances. In order to improve the scalability of the knowledge acquisition task, we formulate the crowdsourced ST pair applying as a binary classification problem. The objective knowledge of instances in existing KBs is selected as the features. We adopt a representative sampling strategy to sample a set of instances to ask the crowd and the classifier is trained based on the collected answers. 3) Knowledge Inference: After the crowdsourced ST pair applying process, we have acquired a set of subjective knowledge facts. To further improve the scalability of our system and derive more subjective knowledge facts, we perform knowledge inference based on the subjective inference rules. The acquired and inferred knowledge can be encoded into existing KBs to perform KB enrichment in the subjective dimension. In summary, the contributions of our work are as follows: Figure 2: An example of knowledge base. the crowdsourced ST pair applying problem as a classification task and derive more knowledge facts based on the crowdsourced seed knowledge. • We conduct extensive experiments using real large-scale knowledge base and crowdsourcing platform and verify the effectiveness of CoSKA system. The rest of the paper is organized as follows. In Section 2, we introduce preliminaries and give the formal definitions of subjective knowledge acquisition and enrichment. In Section 3, we present the methodology for ST pair selection. In Section 4, we describe the models for crowdsourced ST pair applying. The crowdsourcing mechanism design is illustrated in Section 5. Section 6 shows the experimental results on real KBs and crowdsourcing platform. The related works are introduced in Section 7. We conclude our work in Section 8. 2. PROBLEM DEFINITION A knowledge base is a repository of storing entities and relations in a real world scenario. Similar with [16], knowledge base is formally defined as follows. D EFINITION 1 (K NOWLEDGE BASE ). A knowledge base KB is a tuple denoted by (E, L, R, P ), consisting of a collection of entities E, literals L, relations R holding between entities, and properties P holding between entities and literals. An entity e ∈ E can be a class or an instance. Figure 2 shows a toy example of a knowledge base. There are six entities - three classes, e.g., “lawyer”, “politician”, and “president”, and three instances, e.g., “Obama”, “Michelle ”, and “Gorge W. Bush”; the date “1961-8-4” and string “Barack Obama” are literals; there are three relations (“type”, “married”, and “subclassOf”) and two kinds of properties (“birthDate” and “fullName”). • We propose the problem of crowdsourced subjective knowledge acquisition and perform knowledge base enrichment in the subjective dimension, which bridges the gap between the subjective queries and existing knowledge bases encoding only objective knowledge. • We describe and implement our CoSKA system, consists of ST pair selection, crowdsourced ST pair applying and knowledge inference, for crowd-powered subjective knowledge acquisition. D EFINITION 2 (O BJECTIVE K NOWLEDGE ). Objective knowledge is a fact of triple < s, po , o >, where s is an entity in a knowledge base, p is an objective property, and o is either an entity or a literal. Objective knowledge recording the real world facts, which is factual and observable. • We define subjective knowledge inference rules among ST pairs and formulate the ST pair selection problem as a Maximum Knowledge Inference Problem. We prove the problem is NP-hard and propose a diversity-aware forward greedy algorithm for ST pair selection. As shown in the toy example of a KB of Figure 2, there are eight objective knowledge facts, e.g. < Obama, birthDate, “1961-8-400 > and < president, subclassOf, policitian >. As mentioned in Section 1, the subjective knowledge refers to the dominant opinion about whether a particular subjective property applies to entities of a particular type [25]. Therefore, the combination of a subjective property and a certain type should be • To further resolve the conflict between large scale knowledge facts and the limited crowdsourcing resource, we formulate 2 figured out for subsequent subjective knowledge acquisition. We define it as the ST pair (subjective property-type pair). D EFINITION 3 (ST PAIR ). An ST pair consists of a subjective property and a type, which corresponds to a class entity in the knowledge base, i.e. ST = (ps , T ). An ST pair for knowledge acquisition task indicates that the subjective property ps can be applied to the type T , namely, can be applied to the instances of the type T . Figure 3: ST Pair Extraction Pattern. For example, an ST pair, ST = (big, City) indicates that the entities of the City type have the subjective property of big. Same for the ST pairs like (cute, Animal), (popular, Sport) and etc. 3. ST PAIR SELECTION In this section, we describe the ST pair selection problem concerning the knowledge inference power. We first introduce the ST D EFINITION 4 (S UBJECTIVE K NOWLEDGE ). A subjective knowlpair extraction method; then, we introduce the subjective resemble edge fact is a triple denoted by < s, ST, l >, where s is an entity in relationship among ST pairs and define the knowledge inference a knowledge base, ST is an ST pair consists of a subjective proprules based on the relationship. We then formulate the ST pair erty and a type, and l is a label with value either be true or f alse. selection problem as a Maximum Knowledge Inference Problem which is NP-hard and propose a diversity-aware forward greedy The subjective knowledge has no ground truth, instead it has a algorithm for ST pair selection. dominant opinion which can be used to derive such knowledge. For example, if most people hold the opinion that “New York is a 3.1 ST Pair Extraction big city”, then we can derive a new subjective knowledge fact < As described, the input of our system CoSKA is a set of ST pairs, N ewY ork, (big, City), true >; otherwise, we will derive a new and an ST pair consists of a subjective property which is usually an subjective knowledge fact < N ewY ork, (big, City), f alse >. “adjective” and a type which is usually a “noun phrase” and corD EFINITION 5 (ST PAIR A PPLYING ). Given an ST pair, ST =< responds to a type (class) entity in the KB. For example, a pair of ps , T >, consists of a subjective property ps and a type T , and (big, city) is an ST pair as the big is an adjective and city can be a knowledge base KB, ST pair applying refers to the process of mapped to a class entity in the knowledge base. In order to derive deciding whether ps can be applied to the instances of type T the commonly used ST pairs, we perform extraction from the news in the KB, and the result is a list of subjective knowledge facts, from New York Times. We use three years’ data which contains F s = {F1 , F2 , · · · , Fm }, where Fi = {ei , ST, l}. 167,958 news and 582,898,171 sentences. We process the data using NLP tools to identify adjective and noun phrase pairs. Similar Given a list of ST pairs, subjective knowledge acquisition refers with work [25], we use the synthetic patterns to extract information, to the process of performing ST pair applying for all the input ST i.e. ST pairs, from matched sentences. The pattern we adopted pairs. The derived knowledge can be encoded into the existing KB is shown in Figure 3. For example, given a sentence of “Snakes to perform KB enrichment in the subjective dimension. are dangerous animals”, an ST pair of < dangerous, animal > are extracted and the ST pair of < successf ul, f ilm > can be D EFINITION 6 (S UBJECTIVE K NOWLEDGE E NRICHMENT ). extracted from sentence “Titanic is the most successful film of all Given a knowledge base KB consisting objective knowledge facts time”. O F , a list of ST pairs, ST = {ST 1 , ST 2 , · · · , ST m }, the target After extraction using the pattern, we map the type from the exis to enrich the KB with a list of subjective knowledge facts F S by tracted pairs to the given knowledge bases through textual similarperforming subjective knowledge acquisition for the ST pairs. ity and filter out pairs that have no mapped class entity. In total, there are 40,582 mapped ST pairs with DBpedia. We employ crowdsourcing for the subjective knowledge acquisition, specifically for the ST pair applying process. Due to the 3.2 ST Pair Selection limited crowdsourcing resource, we need to crowdsource in an efIn order to reduce the number of ST pairs for crowdsourced subficient and productive manner. In other words, for crowdsourced sequent ST pair applying and identify the most productive ST pairs subjective knowledge acquisition, our target is to maximize the acin terms of the knowledge inference power. We define the Subjecquired knowledge under the crowdsourcing budget. Next, we detive Resemble Relationship among ST pairs as follows: fine the Crowdsourced Subjective Knowledge Acquisition problem. D EFINITION 8 (ST PAIR S UBJECTIVE R ESEMBLE R ELATIONSHIP ). D EFINITION 7 (C ROWDSOURCED S UBJECTIVE K NOWLEDGE ACQUISITION ). Given two ST pairs , ST1 = (ps1 , T1 ), ST2 = (ps2 , T2 ), a knowlGiven a list of ST pairs, a knowledge base and a crowdsourcing edge base KB and an object e, we define that ST1 and ST2 have budget k (e.g. the number of crowdsourcing operation or monethe subjective resemble relationship on e, denoted as ST1 ≈e ST2 tary budget). The Crowdsourced Subjective Knowledge Acquisition if the following condition satisfies: (CoSKA) problem is to perform ST pair applying operations to acquire new subjective knowledge facts powered by crowdsourcing. • Object e is an instance of both types , i.e., e ∈ Ikb (T1 ) ∧ e ∈ The target is to maximize the number of derived knowledge facts Ikb (T2 ), where Ikb (T ) denotes the instances of type T in the under the given budget k. KB. As described in Section 1, we propose a three stage approach for • There exist a “subclassOf” relationship among two types in CoSKA: ST pair selection, crowdsourced ST pair applying and knowlthe KB, denoted as < T1 , subclassOf, T2 >∈ F (KB)∨ edge inference. In next sections, we illustrate the details of each stage. < T2 , subclassOf, T1 >∈ F (KB). 3 • If the two subjective properties are the same, synonymous or antonymous, denoted as ps1 ≈ ps2 . If two subjective properties are synonymous or same, we have ps1 ≈+ ps2 and ps1 ≈− ps2 for antonymous. • The weight of wij is the number of entities on which two corresponding ST pairs have the subjective resemble relationship, denoted as wij = |E| where, ∀e ∈ E, STi ≈e STj . For the example shown in Example 1, we can have an ST graph with four vertices and two edges: G = {{v1 , v2 , v3 , v4 }, {w12 , w34 }}, where vi corresponds to STi and w12 = 1, w34 = 2. Our target of ST pair selection is to identify the most beneficial ST pairs for subsequent crowdsourced ST pair applying to increase the acquired subjective knowledge facts. In our work, based on the ST pair subjective resemble relationship and knowledge inference rules, we use the number of knowledge facts that can be inferred, i.e. the inference power, to measure the beneficial of selected ST pairs. Therefore, we formulate the ST pair selection problem as a Maximum Knowledge Inference Problem. Note that there are two kinds of subjective resemble relationships, − + s + ST1 ≈+ e ST2 and ST1 ≈e ST2 , we have ST1 ≈e ST2 if p1 ≈ s − s − s p2 and ST1 ≈e ST2 if p1 ≈ p2 . If two ST pairs have the subjective resemble relationship on an entity, we can perform knowledge inference using the knowledge inference rule: L EMMA 1 (K NOWLEDGE I NFERENCE RULE ). If we have a knowledge fact of F = {e, ST1 , l} and two ST pairs where ST1 =< ps1 , T1 >, ST2 =< ps2 , T2 >: 0 • If ST1 ≈+ e ST2 , a new knowledge fact of F = {e, ST2 , l} can be inferred D EFINITION 10 (M AXIMUM K NOWLEDGE I NFERENCE P ROBLEM ). Given a knowledge base KB and a set of ST pairs, P = {ST1 , ST2 , · · · , STm }, the target is to select k ST pairs to maximize the knowledge inference power. 0 0 • If ST1 ≈− e ST2 , a new knowledge fact of F = {e, ST2 , l } 0 can be inferred, where l = ¬l Based on the ST Graph Model defined in 9, the maximum knowledge acquisition problem is to select a set of nodes in the graph that maximize the total edge weight induced by the nodes. We can prove that the Maximum Knowledge Inference Problem is NP-hard by a reduction Densest k-Subgraph problem. Next, we illustrate the ST Pair Subjective Resemble Relationship and the Knowledge Inference Rule through the following example. E XAMPLE 1. Given a knowledge base KB, four ST pairs, i.e., ST1 =< old, P olitician >, ST2 =< young, P resident > , ST3 =< big, City >, ST4 =< large, City > and four inT HEOREM 1. The Maximum Knowledge Inference Problem is stances e1 ={“Hillary Clinton”}, e2 ={“Barack Obama”} , e3 ={“New NP-hard York”} and e4 ={”Los Angeles”}. Referring to the knowledge in P ROOF. Given an undirected graph G = (V, E), the Densest KB, we have that: e1 is an instance of type “Politician”, e2 is an ink-Subgraph (DkS) problem on G is the problem of finding a substance of type “Politician” and type “President”, and e3 , e4 are inset U ⊆ V of vertices of size k with the maximum induced averstances of the type “City”, denoted as T ype(e1 )={“Politician”}, T ype(e2 )={“Politician”,“President”}, T ype(e3 )=T ype(e4 )={“City”}.age degree. The average degree of the subgraph will be denoted as 2|E(U )|/k. Here |E(U )| denotes the number of edges in the Therefore, based on the Definition 8, we can have the following ST subgraph induced by U . We construct the instance of ST graph as pair subjective resemble relationships: follows: Given |V | ST pairs, each corresponds to a vertex in G, two 1). ST1 ≈− e2 ST2 , as “young” and “old” are antonymous of ST pairs, STi , STj have the subjective resemble relationship on a each other, e2 is an instance of both type “President” and single object if there is an edge between to corresponding nodes, “Politician” and “President” is a subclass of “Politician” ; vi , vj in G. Given the parameter k, the maximum knowledge in∗ ference problem + P is to select k nodes S with maximum induced 2). ST3 ≈e3 ST4 , as “big” and “large” are synonymous and edge weight, e∈E(S ∗ ) W (e) = |E(S ∗ )|. Therefore, under the the type of two ST pairs is “City” and e3 is an instance of same k, the optimal solution of the maximum knowledge acqui“City”; sition problem is equivalent to that of Densest k-Subgraph prob3). Similarly, we also have ST3 ≈+ lem e4 ST 4 Based on the ST pair subjective resemble relationships, we can infer new knowledge facts using the inference rule according to Lemma 1. If we have crowdsourced subjective knowledge facts of Fcr = {< e2 , ST2 , Y ES >, < e3 , ST3 , Y ES >} (“Barack Obama is a young president” and “New York is a big city”), we can get Finf =< e2 , ST1 , N O > (“Barack Obama is NOT an old politician”) and Finf =< e3 , ST4 , Y ES > (“New York is a large city”). The maximum knowledge acquisition problem is NP-hard, a backwardgreedy strategy, which repeatedly removes a vertex with the minimum weighted-degree in the remaining graph, until exactly k vern 2 ) − tices are left, has an worst case approximation ratio of [( 12 + 2k −1 2 1 n 1 n O(n 3 ), ( 2 + 2k ) + O( n )] for k in the range of [ 3 , n] and [2( nk − 1) − O( k1 ), 2( nk − 1) + O( kn2 )] for k in the range of [0, n3 ), where n is the number of vertex [1]. However, the backwardgreedy strategy is time consuming as it needs to iterate (|V | − k) times; moreover, the strategy does not consider the knowledge diBased on the subjective resemble relationship and the inference versity, i.e. knowledge about different types, when making decirule, we can construct a graph to model the ST pair subjective resions, and therefore may results in top ST pairs share the same semble relationship and the knowledge inference power. type. For example, in our experiment, we find that there are only D EFINITION 9 (ST G RAPH M ODEL ). Given a knowledge base two types from top 100 ST pairs by the backward-greedy stratKB = (E, L, R, P ) and a set of ST pairs P = {ST1 , ST2 , · · · , STn }, egy. In order to improve the efficiency and balance the subjective we can construct a weighted graph G = {V, W}, where knowledge over various types, we propose a diversity-aware forward greedy strategy for ST pair selection: each time we select the • Each vertex in V corresponds to an ST pair of P. pair with the maximum weight-degree, and add the pair to the result if the number of pairs with the same type does not exceed the • There is an undirected edge wij between node vi (STi ) and given threshold. vj (STj ) if exists an instance e ∈ E(KB) and STi ≈e STj . 4 Algorithm 1: Diversity-aware Forward Greedy Selection Input: ST Model Graph G = {V, W}, Parameter k and threshold δ Output: A set of vertices S 1 V ← ∅ 2 while |V| ≤ k do 3 v ∗ ← arg maxv∈V W eightDegree(v) 4 T ← type(v ∗ ) 5 if N um(V, T ) ≤ δ ∗ k then 6 V ← V ∪ v∗ 7 8 V ← V\v ∗ Figure 4: Human Intelligent Task (HIT) interface. return V property can be applied. Furthermore, we list all the properties of the given type in each HIT and let the crowd worker to select the properties that would affect the decision. We compute the voting for each feature, and retain those with voting number exceeds the threshold (set through experimental studies) for further classification models. The HIT interface is shown in Figure 4. The illustrated HIT is for ST pair (big, City), we include five instances of the type “City” in each HIT, and ask the crowd to select the instances that has the attribute of “big”. Also, there are properties related to instances of type “City” in the KB, e.g., Country, areaLand, foundingDate, e.t.c, we list the properties and let the crowd workers to select relevant ones. Agreement-based Answer Aggregation. After all the HITs are answered, for each selected instance sample, we can collect a set of yes or no answers of whether the given subjective property can be applied to it. We compute the degree of the agreement on each task: The procedure of the diversity-aware forward greedy algorithm is illustrated in Algorithm 1. There are k iterations (lines 2-7); in each iteration, we first pick the vertex with the maximum weightdegree (line 3); next, we check the number of vertices of the same type in the current result set, if the number dose not exceed the threshold, the vertex is added into the result set (lines 4-6). The complexity of Algorithm 1 is O(|V| · |W|). 4. CROWDSOURCED ST PAIR APPLYING For a given ST pair, the task of subjective knowledge acquisition is to identify the dominant opinion of whether the subjective property can be applied to the instances of the type, referred as crowdsourced ST pair applying. However, asking the crowd for every instance is too costly as a type in a KB could contain hundreds of thousands instances. Therefore, we formulate the crowdsourced ST pair applying as a binary classification problem taking advantage of the knowledge in the KBs. For each instance, we decide whether the ST pair can be applied by the classification result. However, we do not have any labeled data for training the classifier. Therefore, we select a set of seed instances and ask the crowd to collect the corresponding subjective knowledge facts. We take the crowdsourced samples as the training data and train the classifier using the features extracted from the KB. As each type in a KB would have a set of properties/relations, we extract these properties/relations and list them in the crowdsourcing tasks, the crowd workers are also asked to mark which of the properties would affect the decision about whether the ST pair applies to the instances. Then, we filter out the properties/relations with votes less than a threshold and training the classifier on the remaining properties. We adopt a representative sampling to sample the instances which explores the clustering structure of the large amount of unlabeled data and query the representative samples, i.e. samples from different clusters, as the training data. In our work, we cluster the instances using the knowledge from existing KBs and sample k instances for each ST pair. 5. A(I, ST ) = X 1 V (I, wi ) |W | w ∈W (1) i where V (I, wi ) = 1 if the worker answer is yes and 0 otherwise. The degree agreement of properties is computed in a similar way, and we retain the properties with agreement score at least θP as our subsequent classification features The agreement score evaluates the confidence of the collected opinion among workers over the random answer. With the given threshold θA (which is set through experimental study, as the degree of agreement would vary with different ST pairs [25]), we derive the dominant opinion, denoted as (DO(I, ST )) of whether an ST pair ST applies to the instance I: ( DO(I, ps ) = yes no if A(I, ST ) − 0.5 ≥ θA otherwise (2) According to Equation (2), we would obtain the positive opinion over the ST pair applies to an instance if the majority of the opinions is positive and this positive opinion has a high agreement (larger than θA ). CROWDSOURCING MECHANISM DESIGN 6. EXPERIMENTS In this section, we evaluate CoSkA on real knowledge base and crowdsourcing platform with extracted ST pairs. We describe the experimental setup in Section 6.1. Section 6.2 compares different methods for ST selection; Section 6.3 verifies the proposed approaches for crowdsourced ST pair applying; Section 6.4 shows the test results of the proposed knowledge inference approach. In this section, we first describe the human intelligent task (HIT) interface of CoSKA, then we introduce the answer aggregation strategy. HIT Interface. Given an ST pair, we need to obtain the knowledge of whether a subjective property can be applied to the instances of the type. In order to reduce the cost, we design the task as a multiple choice question where each question contains 5 instances and the crowd worker is asked to select those that the given 6.1 5 Experimental Setup Table 1: Statistics of DBpedia Dataset #Facts #Entities #Classes DBpedia 26,797,299 2,531,369 827 Factor θA θP Classifier Knowledge Base. We adopt DBpedia, which contains millions of knowledge facts (restricted to objective knowledge), classes (types) and instances as the KB in our experiments. The KB is represented as text files containing a list of triples of facts. The statistics DBpedia are given in Table 1. The KB offers information for mapping extracted ST pair to the KB types and subjective knowledge inference. Crowdsourcing Platform. We use the real crowdsorucing platform, Amazon Mechanical Turk (AMT) as the platform to conduct the subjective knowledge acquisition tasks. As mentioned in Section 5, each HIT is designed as a multiple choice question, each question is assigned to 5 workers and each worker would get a reward of $0.02 for answering the task. In addition, we would pay for the AMT platform $0.01 for each assignment. In our experimental settings, for each crowdsourced ST pair applying task, we would sample up to 200 instances. As illustrated in Figure 4, we include = 40 HITs 5 instances in each HIT, therefore there are totally 200 5 which cost $6. 6.2 ST Pairs For crowdsourced ST pair applying, we need to ask the crowd for a set of seed subjective knowledge facts and train the classifier based on the collected samples and features. In our experiments, we select 5 ST pairs through Div-FGreedy algorithm as test cases to evaluate the accuracy of our approach 2 . There are following configurations for the task: answer aggregation parameter θA , feature selection parameter θP and classification models, the settings are illustrated in Table 2, where we mark our default settings in bold font. As we have no ground truth, we use 5-fold cross validation to test the performance of our approach. Effect of Answer Aggregation Parameter. There are two parameters in terms of the answer aggregation: θA for opinion aggregation and θP for feature selection. We first fix θA = 0.1 (in our settings, θA = 0.1 means at lease 60% workers select the instance to have the given property), and vary the value of θP from 0.1∼0.5 to compare the classification accuracy. The results are shown in Figure 6 3 . From the results, we can observe that the classification accuracy would change with various θP value, the reason is that different θP have different filter power, i.e. with larger value of θP , there would be less features remaining. Overall, the θP = 0.3 achieves best performance: from 0.1∼0.3, there is an increasing trend of the accuracy for three pairs (old,Building), (experienced,Athlete) and (popular,film), and for pair (cute,Animal), the accuracy does not have much difference; for larger values (0.3∼0.5), the accuracy would remain approximately the same. The reason is that the performance would change with different features (remained properties), and with lower value, less properties would be filtered therefore might retain those irrelevant properties as the training features. Next, we check the effect of θA on the classification accuracy. We set the θP to 0.3 and vary the values of θA according to Table 2, the classification accuracy results are illustrated in Figure 7. From the results we can observe that the classification models achieve best performance with the value of θA equals to 0.1, and would decrease as the value of θA increases. The reason is that with larger θA , we have stronger restriction for deriving the dominant opinion of whether the property applies to an instance. For example, in our settings, when θ = 0.5, we would only obtain the opinion that the property applies to the instance if all the 5 workers gives the “yes” answer, which might results in missing some positive training samples and affect the classification performance. Overall, the classification models achieve best performance with the value of θA to 0.1. Therefore, we set the default value of θA to 0.1. Effect of Classification Model. From the Figures 6 and 7, we can find that the performance of different classification models varies with different ST pairs. For pair (cute,Animal) different ST Pair Selection As illustrated in the Section 3, we adopt a diversity-based forward greedy algorithm in our work for ST pair selection (DivFGreedy). To evaluate the efficiency and the effectiveness of the propose algorithm, we use three metrics: 1). Induced Edge Weight of ST pairs, which indicates the inference power of selected ST pairs; 2). The number of different types of the ST pairs, which is used to evaluate the knowledge diversity; 3). Running time, which is recorded to demonstrate the efficiency of the algorithm. For comparison, we implement three other algorithms: backward greedy selection algorithm (BGreedy), forward greedy selection algorithm (FGreedy) and random selection algorithm (Random). We vary the number of selected ST pairs from 10∼100, and fix the threshold for the diversity-based forward greedy algorithm (Div-FGreedy) to 0.1 (the value of δ can be changed to satisfy the various diversity demand as the Div-FGreedy strategy can derive ST pairs with at least θ1 types), the results are shown in Figure 5. From Figure 5(a), we can find that the Random algorithm cannot achieve a good result, and the FGreedy and the Div-FGreedy algorithm outperform the BGreedy algorithm. We can observe that in our experiments, the FGreedy strategy has the best performance in terms of the inference power (induced edge weight). However, from Figure 5(b), we can see that the FGreedy algorithm would favor pairs with the same type as it does not consider the knowledge diversity, e.g. for the FGreedy algorithm, there would be only 5 types out of 100 selected ST pairs. The BGreedy strategy also has the same problem, e.g. the BGreedy only has 2 types out of 100 selected ST pairs. For the Div-FGreedy strategy, we have 16 types out of 100 selected ST pairs with the threshold set to 0.1. We can see that the Random strategy can select pairs with larger type numbers as it selects ST pairs randomly. However, it does not consider the inference power when selecting ST pairs and thus results in ST pairs with quite low inference power as shown in Figure 5(a). For the running time shown in Figure 5(c), we can observe that except for the BGreedy algorithm, all other three algorithms are quite efficient. To conclude, considering all three evaluation metrics, the Div-FGreedy algorithm can achieve a good inference power, guarantee the ST pair type diversity and is quite efficient. 6.3 Table 2: Parameter Setting Setting 0.1, 0.3, 0.5 0.1, 0.2, 0.3, 0.4, 0.5 AdaBoost (AD), Decision Tree (DT), RBF-SVM, Nearest Neighbors (NN), Random Forest (RF) (big,City), (experienced, Athlete), (cute,Animal), (old,Building), (popular,Film) 2 Note that the workflow of crowdsourced ST pair applying is same for each ST pair, to acquire more knowledge facts, we can perform crowdsourced ST pair applying for a larger number of ST pairs 3 Note that due to the space limit, we only show the results for four pairs and the result of (big,City) pair is summarized in Table 5 Crowdsourced ST Pair Applying 6 80 BGreedy Random Div-FGreedy FGreedy 1 0.5 0 60 Number of ST Pairs (a) Induced Edge Weight BGreedy Random Div-FGreedy FGreedy 40 20 0 10 20 30 40 50 60 70 80 90 100 2.5 RunningTime(ms) 1.5 ×108 Number of Types Induced Edge Weight 2 ×105 2 1.5 1 0.5 0 10 20 30 40 50 60 70 80 90 100 BGreedy Random Div-FGreedy FGreedy 10 20 30 40 50 60 70 80 90 100 Number of ST Pairs Number of ST Pairs (b) Number of Types (c) Running Time Figure 5: ST pair Selection Comparison. Table 3: Crowdsourced ST Pair Applying Performance ST Pair Classification Model Accuracy (big,City) DT 0.925 (experienced, Athlete) RBF-SVM 0.80 (cute,Animal) RBF-SVM/RF/DT 0.685 (old,Building) RBF-SVM 0.89 (popular,Film) DT 0.79 Table 4: Subjective Resemble Relationship ST Pair (big,City) (experienced, Athlete) (cute,Animal) (old,Building) (popular,Film) Table 5: Knowledge Inference Performance models have similar performance; for pairs (old,Building) and (experienced,Athlete) the RBF-SVM achieves the best performance whereas for (popular,film), the DT model outperforms other approaches. We summarize the results of crowdsourced ST pair applying with the five pairs with all the parameters setting to the default value, the results are presented in Table 3. Overall, we can find that the RBF-SVM and DT model can achieve good performance for different ST pairs. To justify the effectiveness of our approach for subjective knowledge acquisition, we compare our results with the state-of-the-art technique, Surveyor, proposed in [25]. The reported accuracy of the approach by Surveyor is 77%. Compared our results with the Surveyor approach, we can observe that except for the ST pair (cute,Animal), our approach can achieve better results, i.e. the pair (popular,Film) achieves accuracy of 79% and all the other three pairs can achieve the accuracy of over 80%. Therefore, our approach can perform accurate and scalable subjective knowledge acquisition with a low crowdsourcing budget (with up to 40 HITs and $6 for each ST pair). 6.4 Subjective Resemble Relationship Pairs (small,City) , (big, Settlement) , (large,Place) (experienced, SoccerPlayer) , (trained, Boxer) (lovely, Animal) , (lovely,Species) (old, Hotel) , (new, Museum) (popular, Work) , (neglected, Film) ST Pair (big,City) (experienced, Athlete) (cute,Animal) (old,Building) (popular,Film) #Seed Facts 10,354 499 4,096 233 272 #Inferred Facts 93,186 3,488 12,284 1,398 1,632 Accuracy 0.92 0.83 0.76 0.93 0.87 with those presented in Table 3, we can observe that the inferred knowledge of each ST pair has close but higher accuracy than the facts acquired by crowdsourced ST pair applying, which confirms that our proposed knowledge inference process does not introduce significant noises and verifies the high quality of our knowledge inference rules. To conclude, our knowledge inference approach can help to derive more high quality knowledge facts compared with that only using the crowd and classification models in the crowdsourced ST pair applying process. 7. Knowledge Inference RELATED WORK In this section, we discuss the works related to subjective knowledge acquisition, knowledge base enrichment and crowdsourcing. Subjective knowledge acquisition is closely related to works that associating properties with entities. Some works have been conducted for commonsense knowledge acquisition [18] [15] [14] [24]. WebChild [23] presents a method for automatically constructing a large commonsense knowledge base, it contains triples that connect nouns with adjectives via fine-grained relations. Entitytagger [5], presented by Chakrabarti et al., automatically associate descriptive phrases, referred to as etags (entity tags), to each entity. Instead of subjective properties, these works focus on the less controversial and more objective properties, which is not related to obtaining dominant opinion. The most similar work is SURVEYOR, which mines the dominant opinion on the web content of whether a subjective property applies to a type. However, they does not consider to use the existing information in knowledge base and resorting to the crowd for subjective knowledge acquisition. After the crowdsourced ST pair applying process, we have acquired a set of subjective knowledge facts, either collected from the crowd or obtained through the classification model. Then, we can perform knowledge inference to acquire more knowledge facts. Some resemble relationship of the selected ST pairs are shown in Table 4. In order to verify the effectiveness of our knowledge inference approach, we evaluate two metrics: the number of inferred facts and the accuracy of inferred facts. As we do not have the ground truth, we sample 100 facts for each pair and verify the correctness manually. We ask three students to label whether the fact is correct or not and derive the answer by majority voting. The results of the knowledge inference performance are shown in Table 5. From the results, we can observe that, on the one hand, large amount of knowledge facts could be inferred through the subjective knowledge inference approach; on the other hand, the inferred knowledge facts have high accuracy. Compare the accuracy results 7 0.85 0.95 0.76 0.8 0.74 0.8 0.9 0.68 0.66 AD DT RBF-SVM NN RF 0.64 0.62 0.6 0.1 0.2 0.3 0.4 0.85 0.8 AD DT RBF-SVM NN RF 0.75 0.7 0.1 0.5 0.2 0.3 0.4 0.75 0.7 0.65 0.1 0.5 (a) Pair (cute,Animal) 0.2 0.3 0.4 0.75 0.7 (b) Pair (old,Building) AD DT RBF-SVM NN RF 0.65 0.6 0.1 0.5 0.2 0.3 0.4 0.5 Value of θP Value of θP Value of θP Value of θP AD DT RBF-SVM NN RF Accuracy 0.7 Accuracy Accuracy Accuracy 0.72 (c) Pair (experienced,Athlete) (d) Pair (popular,Film) Figure 6: Results on varying Feature Selection Parameter (θP ). 0.9 0.5 0.45 0.85 0.9 AD DT RBF-SVM NN RF 0.85 AD DT RBF-SVM NN RF 0.85 0.8 0.8 0.75 0.75 0.4 AD DT RBF-SVM NN RF 0.8 Accuracy Accuracy 0.6 0.55 Accuracy AD DT RBF-SVM NN RF Accuracy 0.7 0.65 0.75 0.7 0.7 0.35 0.3 0.1 0.3 Value of θA (a) Pair (cute,Animal) 0.5 0.7 0.1 0.3 0.65 0.1 0.5 Value of θA 0.3 0.5 Value of θA (b) Pair (old,Building) (c) Pair (experienced,Athlete) 0.65 0.1 0.3 0.5 Value of θA (d) Pair (popular,Film) Figure 7: Results on varying Opinion Aggregation Parameter (θA ). among ST pairs and perform knowledge inference to derive more knowledge facts. We formulate the ST pair selection problem as a Maximum Knowledge Inference Problem which is NP-hard and we propose a diversity-aware forward greedy algorithm for ST pair selection. The crowdsourced ST pair applying problem is formulated as a classification task to further improve the system scalability. Experimental results on real knowledge base and crowdsourcing platform verify that our system, CoSKA, could derive large amount accurate subjective knowledge facts with a comparative low crowdsourcing cost. Knowledge base enrichment, completion and population have been widely studied. There are two mainstreams: internal methods, which use only the knowledge contained in the knowledge base to predict missing information [27] [9]; external methods,which use sources of knowledge such as text corpora or other knowledge base to add new knowledge facts [30] [21] [12] [11]. However, these works are limited to add objective knowledge and neglect subjective knowledge. Moreover, they do not consider to make use of a natural source of knowledge, the crowd, to complete/enrich the existing knowledge base. Recently, the increasing popularity of crowdsourcing brings new trend to leverage the power of the crowd in knowledge acquisition, data integration and many other applications. Kondreddi et al. [13] proposes a hybrid approach that combines information extraction technique with human computation for knowledge acquisition. Marta et al. [22] presents a hybrid-genre workflow for games in crowdsourced knowledge acquisition process. Works [6] [3] [20] present approaches that use the wisdom of crowd to perform taxonomy construction. Crowdsourcing also proved to have good performance in applications such as entity resolution [28] [26], schema matching [33], translation [32] and so forth. 9. REFERENCES [1] Y. Asahiro, K. Iwama, H. Tamaki, and T. Tokuyama. Greedily finding a dense subgraph. Journal of Algorithms, 34(2):203–221, 2000. [2] K. D. Bollacker, C. Evans, P. Paritosh, T. Sturge, and J. Taylor. Freebase: a collaboratively created graph database for structuring human knowledge. In SIGMOD, pages 1247–1250, 2008. [3] J. Bragg, Mausam, and D. S. Weld. Crowdsourcing multi-label classification for taxonomy creation. In 8. CONCLUSION Proceedings of the First AAAI Conference on Human Computation and Crowdsourcing, HCOMP 2013, November In our work, we propose a system Crowdsourced subjective knowledge 7-9, 2013, Palm Springs, CA, USA, 2013. acquisition (CoSKA), for subjective knowledge acquisition pow[4] L. Bühmann and J. Lehmann. Pattern based knowledge base ered by crowdsourcing and existing KBs. The acquired knowledge enrichment. In The Semantic Web - ISWC 2013 - 12th can be encoded into existing KBs to perform KB enrichment in International Semantic Web Conference, Sydney, NSW, the subjective dimension which can bridge the gap between existAustralia, October 21-25, 2013, Proceedings, Part I, pages ing objective knowledge and the subjective queries. Our CoSKA 33–48, 2013. system, consists of three stages: ST pair selection, Crowdsourced ST pair applying and knowledge inference. To resolve the con[5] K. Chakrabarti, S. Chaudhuri, T. Cheng, and D. Xin. flict between large scale knowledge facts and the limited crowdEntitytagger: automatically tagging entities with descriptive sourcing resource, we define subjective knowledge inference rules phrases. In Proceedings of the 20th International Conference 8 [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] on World Wide Web, WWW 2011, Hyderabad, India, March 28 - April 1, 2011 (Companion Volume), pages 19–20, 2011. L. B. Chilton, G. Little, D. Edge, D. S. Weld, and J. A. Landay. Cascade: crowdsourcing taxonomy creation. In 2013 ACM SIGCHI Conference on Human Factors in Computing Systems, CHI ’13, Paris, France, April 27 - May 2, 2013, pages 1999–2008, 2013. M. Choy, J. Lee, G. Gweon, and D. Kim. Glaucus: Exploiting the wisdom of crowds for location-based queries in mobile environments. In Proceedings of the Eighth International Conference on Weblogs and Social Media, ICWSM 2014, Ann Arbor, Michigan, USA, June 1-4, 2014., 2014. O. Etzioni, M. J. Cafarella, D. Downey, S. Kok, A. Popescu, T. Shaked, S. Soderland, D. S. Weld, and A. Yates. Web-scale information extraction in knowitall: (preliminary results). In WWW, pages 100–110, 2004. L. A. Galárraga, C. Teflioudi, K. Hose, and F. M. Suchanek. AMIE: association rule mining under incomplete evidence in ontological knowledge bases. In 22nd International World Wide Web Conference, WWW ’13, Rio de Janeiro, Brazil, May 13-17, 2013, pages 413–422, 2013. J. Hoffart, F. M. Suchanek, K. Berberich, and G. Weikum. YAGO2: A spatially and temporally enhanced knowledge base from wikipedia. Artif. Intell., 194:28–61, 2013. H. Ji, T. Cassidy, Q. Li, and S. Tamang. Tackling representation, annotation and classification challenges for temporal knowledge base population. Knowl. Inf. Syst., 41(3):611–646, 2014. H. Ji and R. Grishman. Knowledge base population: Successful approaches and challenges. In The 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, Proceedings of the Conference, 19-24 June, 2011, Portland, Oregon, USA, pages 1148–1158, 2011. S. K. Kondreddi, P. Triantafillou, and G. Weikum. Combining information extraction and human computing for crowdsourced knowledge acquisition. In ICDE, pages 988–999, 2014. Y.-L. Kuo, J. Hsu, and F. Shih. Contextual commonsense knowledge acquisition from social content by crowd-sourcing explanations. In Proceedings of the Fourth AAAI Workshop on Human Computation, pages 18–24, 2012. Y.-L. Kuo and J. Y.-j. Hsu. Resource-bounded crowd-sourcing of commonsense knowledge. In IJCAI Proceedings-International Joint Conference on Artificial Intelligence, volume 22, page 2470, 2011. S. Lacoste-Julien, K. Palla, A. Davies, G. Kasneci, T. Graepel, and Z. Ghahramani. Sigma: simple greedy matching for aligning large knowledge bases. In The 19th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD 2013, Chicago, IL, USA, August 11-14, 2013, pages 572–580, 2013. J. Lehmann, R. Isele, M. Jakob, A. Jentzsch, D. Kontokostas, P. N. Mendes, S. Hellmann, M. Morsey, P. van Kleef, S. Auer, and C. Bizer. Dbpedia - A large-scale, multilingual knowledge base extracted from wikipedia. Semantic Web, pages 167–195, 2015. H. Liu and P. Singh. Conceptneta practical commonsense reasoning tool-kit. BT technology journal, 22(4):211–226, 2004. J. McAuley and A. Yang. Addressing complex and subjective [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] 9 product-related queries with customer reviews. In Proceedings of the 25th International Conference on World Wide Web, WWW 2016, Montreal, Canada, April 11 - 15, 2016, pages 625–635, 2016. R. Meng, Y. Tong, L. Chen, and C. C. Cao. CrowdTC: Crowdsourced taxonomy construction. In 2015 IEEE International Conference on Data Mining, ICDM 2015, Atlantic City, NJ, USA, November 14-17, 2015, pages 913–918, 2015. A. G. Nuzzolese, A. Gangemi, V. Presutti, and P. Ciancarini. Type inference through the analysis of wikipedia links. In WWW2012 Workshop on Linked Data on the Web, Lyon, France, 16 April, 2012, 2012. M. Sabou, A. Scharl, and M. Föls. Crowdsourced knowledge acquisition: Towards hybrid-genre workflows. Int. J. Semantic Web Inf. Syst., 9(3):14–41, 2013. N. Tandon, G. de Melo, F. M. Suchanek, and G. Weikum. Webchild: harvesting and organizing commonsense knowledge from the web. In Seventh ACM International Conference on Web Search and Data Mining, WSDM 2014, New York, NY, USA, February 24-28, 2014, pages 523–532, 2014. N. Tandon, G. de Melo, and G. Weikum. Acquiring comparative commonsense knowledge from the web. In Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, July 27 -31, 2014, Québec City, Québec, Canada., pages 166–172, 2014. I. Trummer, A. Y. Halevy, H. Lee, S. Sarawagi, and R. Gupta. Mining subjective properties on the web. In SIGMOD, pages 1745–1760, 2015. N. Vesdapunt, K. Bellare, and N. N. Dalvi. Crowdsourcing algorithms for entity resolution. PVLDB, 7(12):1071–1082, 2014. J. Völker and M. Niepert. Statistical schema induction. In The Semantic Web: Research and Applications - 8th Extended Semantic Web Conference, ESWC 2011, Heraklion, Crete, Greece, May 29-June 2, 2011, Proceedings, Part I, pages 124–138, 2011. J. Wang, T. Kraska, M. J. Franklin, and J. Feng. CrowdER: Crowdsourcing entity resolution. PVLDB, 5(11):1483–1494, 2012. R. West, E. Gabrilovich, K. Murphy, S. Sun, R. Gupta, and D. Lin. Knowledge base completion via search-based question answering. In 23rd International World Wide Web Conference, WWW ’14, Seoul, Republic of Korea, April 7-11, 2014, pages 515–526, 2014. R. West, E. Gabrilovich, K. Murphy, S. Sun, R. Gupta, and D. Lin. Knowledge base completion via search-based question answering. In 23rd International World Wide Web Conference, WWW ’14, Seoul, Republic of Korea, April 7-11, 2014, pages 515–526, 2014. O. Zaidan and C. Callison-Burch. Crowdsourcing translation: Professional quality from non-professionals. In ACL, pages 1220–1229, 2011. O. F. Zaidan and C. Callison-Burch. Crowdsourcing translation: Professional quality from non-professionals. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1, pages 1220–1229, 2011. C. J. Zhang, L. Chen, H. V. Jagadish, and C. C. Cao. Reducing uncertainty of schema matching via crowdsourcing. PVLDB, 6(9):757–768, 2013.
2cs.AI
Trace-Based Run-Time Analysis of Message-Passing Go Programs arXiv:1709.01588v4 [cs.PL] 30 Jan 2018 Martin Sulzmann and Kai Stadtmüller Faculty of Computer Science and Business Information Systems Karlsruhe University of Applied Sciences Moltkestrasse 30, 76133 Karlsruhe, Germany [email protected] [email protected] Abstract. We consider the task of analyzing message-passing programs by observing their run-time behavior. We introduce a purely librarybased instrumentation method to trace communication events during execution. A model of the dependencies among events can be constructed to identify potential bugs. Compared to the vector clock method, our approach is much simpler and has in general a significant lower runtime overhead. A further advantage is that we also trace events that could not commit. Thus, we can infer more alternative communications. This provides the user with additional information to identify potential bugs. We have fully implemented our approach in the Go programming language and provide a number of examples to substantiate our claims. 1 Introduction We consider run-time analysis of programs that employ message-passing. Specifically, we consider the Go programming language [4] which integrates messagepassing in the style of Communicating Sequential Processes (CSP) [6] into a C style language. We assume the program is instrumented to trace communication events that took place during program execution. Our objective is to analyze program traces to assist the user in identifying potential concurrency bugs. Motivating Example In Listing 1.1 we find a Go program implementing a system of newsreaders. The main function creates two synchronous channels, one for each news agency. Go supports (a limited form of) type inference and therefore no type annotations are required. Next, we create one thread per news agency via the keyword go. Each news agency transmits news over its own channel. In Go, we write ch <- "REUTERS" to send value "REUTERS" via channel ch. We write <-ch to receive a value via channel ch. As we assume synchronous channels, both operations block and only unblock once a sender finds a matching receiver. We find two newsreader instances. Each newsreader creates two helper threads that wait for news to arrive and transfer any news that has arrived to a common channel. The intention is that the newsreader wishes to receive any news whether it be from Reuters or Bloomberg. However, there is a subtle bug (to be explained shortly). func reuters ( ch chan string ) { ch <- " REUTERS " } // r ! func bloomberg ( ch chan string ) { ch <- " BLOOMBERG " } // b ! func newsReader ( rCh chan string , bCh chan string ) { ch := make ( chan string ) go func () { ch <- ( < - rCh ) }() // r ?; ch ! go func () { ch <- ( < - bCh ) }() // b ?; ch ! x := <- ch // ch ? } func main () { reutersCh := make ( chan string ) bloombergCh := make ( chan string ) go reuters ( reutersCh ) go bloomberg ( bloombergCh ) go newsReader ( reutersCh , bloombergCh ) // N1 newsReader ( reutersCh , bloombergCh ) // N2 } Listing 1.1. Message passing in Go Trace-Based Run-Time Verification We only consider finite program runs and therefore each of the news agencies supplies only a finite number of news (exactly one in our case) and then terminates. During program execution, we trace communication events, e.g. send and receive, that took place. Due to concurrency, a bug may not manifest itself because a certain ‘bad’ schedule is rarely taken in practice. Here is a possible trace resulting from a ‘good’ program run. r!; N1.r?; N1.ch!; N1.ch?; b!; N2.b?; N2.ch!; N2.ch? We write r! to denote that a send event via the Reuters channel took place. As there are two instances of the newsReader function, we write N1.r? to denote that a receive event via the local channel took place in case of the first newsReader call. From the trace we can conclude that the Reuters news was consumed by the first newsreader and the Bloomberg news by the second newsreader. Here is a trace resulting from a bad program run. r!; b!; N1.r?; N1.b?; N1.ch!; N1.ch?; DEADLOCK The helper thread of the first newsreader receives the Reuters and the Bloomberg news. However, only one of these messages will actually be read (consumed). This is the bug! Hence, the second newsreader gets stuck and we encounter a deadlock. The issue is that such a bad program run may rarely show up. So, the question is how can we assist the user based on the trace information resulting from a good program run? How can we infer that alternative schedules and communications may exist? 2 Event Order via Vector Clock Method A well-established approach is to derive a partial order among events. This is usually achieved via a vector of (logical) clocks. The vector clock method was independently developed by Fidge [1] and Mattern [8]. For the above good program run, we obtain the following partial order among events. r! < N1.r? N1.r? < N1.ch! N1.ch! < N1.ch? b! < N2.b? N2.b? < N2.ch! (1) N2.ch! < N2.ch? (2) For example, (1) arises because N2.ch! happens (sequentially) after N2.b? For synchronous send/receive, we assume that receive happens after send. See (2). Based on the partial order, we can conclude that alternative schedules are possible. For example, b! could take place before r!. However, it is not clear how to infer alternative communications. Recall that the issue is that one of the newsreaders may consume both news messages. Our proposed method is able to clearly identify this issue and has the advantage to require a much simpler instrumentation We discuss these points shortly. First, we take a closer look at the details of instrumentation for the vector clock method. Vector clocks are a refinement of Lamport’s time stamps [7]. Each thread maintains a vector of (logical) clocks of all participating partner threads. For each communication step, we advance and synchronize clocks. In pseudo code, the vector clock instrumentation for event sndR. vc [ r e u t e r s T h r e a d ]++ ch <- ( " R E U T E R S" , vc , vcCh ) vc ’ := max ( vc , <- vcCh ) We assume that vc holds the vector clock. The clock of the Reuters thread is incremented. Besides the original value, we transmit the sender’s vector clock and a helper channel vcCh. For convenience, we use tuple notation. The sender’s vector clock is updated by building the maximum among all entries of its own vector clock and the vector clock of the receiving party. The same vector clock update is carried out on the receiver side. Our Method We propose a much simpler instrumentation and tracing method to obtain a partial order among events. Instead of a vector clock, each thread traces the events that might happen and have happened. We refer to them as pre and post events. In pseudo code, our instrumentation for sndR looks like follows. pre ( hash ( ch ) , " ! " ) ch <- ( " R E U T E R S" , t h r e a d I d) post ( hash ( ch ) , " ! " ) The bang symbol (‘!’) indicates a send operation. Function hash builds a hash index of channel names. The sender transmits its thread id number to the receiver. This is the only intra-thread overhead. No extra communication link is necessary. 3 Here are the traces for individual threads resulting from the above good program run. R: N1_helper1: N1_helper2: N1: B: N2_helper1: N2_helper2: N2: pre(r!); post(r!) pre(r?); post(R#r?); pre(ch1!); post(ch1!) pre(b?) pre(ch1?); post(N1_helper1#ch1?) pre(b!); post(b!) pre(r?) pre(b?); post(B#b?); pre(ch2!); post(ch2!) pre(ch2?); post(N2_helper2#ch2?) We write pre(r!) to indicate that a send via the Reuters channel might happen. We write post(R#r?) to indicate that a receive has happened via thread R. The partial order among events is obtained by a simple post-processing phase where we linearly scan through traces. For example, within a trace there is a strict order and therefore N2_helper2: pre(b?); post(B#b?); pre(ch2!); post(ch2!) implies N2.b? < N2.ch!. Across threads we check for matching pre/post events. Hence, R: N1_helper1: pre(r!); post(r!) pre(r?); post(R#r?); ... implies r! < N1.r?. So, we obtain the same (partial order) information as the vector clock approach but with less overhead. The reduction in terms of tracing overhead compared to the vector clock method is rather drastic assuming a library-based tracing scheme with no access to the Go run-time system. For each communication event we must exchange vector clocks, i.e. n additional (time stamp) values need to be transmitted where n is the number of threads. Besides extra data to be transmitted, we also require an extra communication link because the sender requires the receivers vector clock. In contrast, our method incurs a constant tracing overhead. Each sender transmits in addition its thread id. No extra communication link is necessary. This results in much less run-time overhead as we will see later. The vector clock tracing method can be improved assuming we extend the Go run-time system. For example, by maintaining a per-thread vector clock and having the run-time system carrying out the exchange of vector clocks for each send/receive communication. There is still the O(n) space overhead. Our method does not require any extension of the Go run-time system to be efficient and therefore is also applicable to other languages that offer similar features as found in Go. A further advantage of our method is that we also trace (via pre) events that could not commit (post is missing). Thus, we can easily infer alternative communications. For example, for R: pre(r!); ... there is the alternative match 4 N2_helper1: pre(r?). Hence, instead of r! < N1.r? also r! < N2.r? is possible. This indicates that one newsreader may consume both news message. The vector clock method, only traces events that could commit, post events in our notation. Hence, the above alternative communication could not be derived. Contributions Compared to earlier works based on the vector clock method, we propose a much more light-weight and more informative instrumentation and tracing scheme. Specifically, we make the following contributions: – We give a precise account of our run-time tracing method (Section 3) for message-passing as found in the Go programming language (Section 2) where for space reasons we only formalize the case of synchronous channels and selective communications. – A simple analysis of the resulting traces allows us to detect alternative schedules and communications (Section 4). For efficiency reasons, we employ a directed dependency graph to represent happens-before relations (Section 4.1). – We show that vector clocks can be easily recovered based on our tracing method (Section 5). We also discuss the pros and cons of both methods for analysis purposes. – Our tracing method can be implemented efficiently as a library. We have fully implemented the approach supporting all Go language features dealing with message-passing such as buffered channels, select with default or timeout and closing of channels (Section 6). – We provide experimental results measuring the often significantly lower overhead of our method compared to the vector clock method assuming based methods are implemented as libraries (Section 6.2). The online version of this paper contains an appendix with further details.1 2 Message-Passing Go Syntax For brevity, we consider a much simplified fragment of the Go programming language. We only cover straight-line code, i.e. omitting procedures, if-thenelse etc. This is not an onerous restriction as we only consider finite program runs. Hence, any (finite) program run can be represented as a program consisting of straight-line code only. Definition 1 (Program Syntax). x, y, . . . i, j, . . . b ::= x | i | hash(x) | head(b) | last(b) | bs | tid bs ::= [] | b : bs e, f ::= x ← b | y :=← x c ::= y := b | y := makeChan | go p | select [ei ⇒ pi ]i∈I p, q, r ::= [] | c : p 1 https://arxiv.org/abs/1709.01588 5 Variables, Channel Names Integers Expressions Transmit/Receive Commands Program For our purposes, values are integers or lists (slices in Go terminology). For lists we follow Haskell style notation and write b : bs to refer to a list with head element b and tail bs. We can access the head and last element in a list via primitives head and last. We often write [b1 , . . . , bn ] as a shorthand b1 : · · · : []. Primitive tid yields the thread id number of the current thread. We assume that the main thread always has thread id number 1 and new thread id numbers are generated in increasing order. Primitive hash() yields a unique hash index for each variable name. Both primitives show up in our instrumentation. A program is a sequence of commands where commands are stored in a list. Primitive makeChan creates a new synchronous channel. Primitive go creates a new go routine (thread). For send and receive over a channel we follow Go notation. We assume that a receive is always tied to an assignment. For assignment we use symbol := to avoid confusion with the mathematical equality symbol =. In Go, symbol := declares a new variable with some initial value. We also use := to overwrite the value of existing variables. As a message passing command we only support selective communication via select. Thus, we can fix the bug in our newsreader example. func n e w s R e a d e r F i x e d ( rCh chan string , bCh chan string ) { ch := make ( chan string ) select { case x := <- rCh : case x := <- bCh : } } The select statement guarantees that at most one news message will be consumed and blocks if no news are available. In our simplified language, we assume that the x ← b command is a shorthand for select [x ← b ⇒ []]. For space reasons, we omit buffered channels, select paired with a default/timeout case and closing of channels. All three features are fully supported by our implementation. Trace-Based Semantics The semantics of programs is defined via a small-step operational semantics. The semantics keeps track of the trace of channel-based communications that took place. This allows us to relate the traces obtained by our instrumentation with the actual run-time traces. We support multi-threading via a reduction relation T (S, [i1 ♯p1 , . . . , in ♯pn ]) = ⇒ (S ′ , [j1 ♯q1 , . . . , jn ♯qn ]). We write i♯p to denote a program p that runs in its own thread with thread id i. We use lists to store the set of program threads. The state of program variables, before and after execution, is recorded in S and S ′ . We assume that threads share the same state. Program trace T records the sequence of communications that took place during execution. We write x! to denote a send operation on channel x and x? to denote a receiver operation on channel x. The semantics of expressions is defined in terms a big-step semantics. We employ a reduction 6 relation (i, S) ⊢ b ⇓ v where S is the current state, b the expression and v the result of evaluating b. The formal details follow. Definition 2 (State). v ::= x | i | [] | vs Values vs ::= [] | v : vs s ::= v | Chan Storables S ::= () | (x 7→ s) | S ⊳ S State A state S is either empty, a mapping, or an override of two states. Each state maps variables to storables. A storable is either a plain value or a channel. Variable names may appear as values. In an actual implementation, we would identify the variable name by a unique hash index. We assume that mappings in the right operand of the map override operator ⊳ take precedence. They overwrite any mappings in the left operand. That is, (x 7→ v1 ) ⊳ (x 7→ v2 ) = (x 7→ v2 ). Definition 3 (Expression Semantics (i, S) ⊢ b ⇓ v). S(x) = v (i, S) ⊢ b ⇓ v (i, S) ⊢ bs ⇓ vs (i, S) ⊢ j ⇓ j (i, S) ⊢ [] ⇓ [] (i, S) ⊢ x ⇓ v (i, S) ⊢ b : bs ⇓ v : vs (i, S) ⊢ b ⇓ v : vs (i, S) ⊢ b ⇓ [v1 , . . . , vn ] (i, S) ⊢ tid ⇓ i (i, S) ⊢ hash(x) ⇓ x (i, S) ⊢ head(b) ⇓ v (i, S) ⊢ last(b) ⇓ vn T Definition 4 (Program Execution (S, P ) = ⇒ (S ′ , Q)). i♯p Single program thread P, Q ::= [] | i♯p : P Program threads t := i♯x! | i ← j♯x? Send and receive event T ::= [] | t : T Trace [] We write (S, P ) = ⇒ (S ′ , Q) as a shorthand for (S, P ) = ⇒ (S ′ , Q). Definition 5 (Single Step). (Terminate) (S, i♯[] : P ) ⇒ = (S, P ) (Assign) (MakeChan) (i, S) ⊢ b ⇓ v S ′ = S ⊳ (y 7→ v) (S, i♯(y := b : p) : P ) = ⇒ (S ′ , i♯p : P ) S ′ = S ⊳ (y 7→ Chan (S, i♯(y := makeChan : p) : P ) = ⇒ (S ′ , i♯p : P ) 7 Definition 6 (Multi-Threading and Synchronous Message-Passing). (Go) i 6∈ {i1 , . . . , in } (S, i1 ♯(go p : p1 ) : P ) = ⇒ (S, i♯p : i1 ♯p1 : P ) ∃l ∈ J, m ∈ K.el = x ← b fm = y :=← x S(x) = Chan (i1 , S) ⊢ b ⇓ v S ′ = S ⊳ (y 7→ v) (Sync) (S, i1 ♯(select [ej ⇒ qj ]j∈J : p1 ) : i2 ♯(select [fk ⇒ rk ]k∈K : p2 ) : P ) [i1 ♯x!,i2 ←i1 ♯x?] ==========⇒ (S ′ , i1 ♯(ql ++ p1 ) : i2 ♯(rm ++ p2 ) : P ) Definition 7 (Scheduling). (Schedule) π permutation on {1, . . . , n} (S, [i1 ♯p1 , . . . , in ♯pn ]) = ⇒ (S, [π(i1 )♯pπ(1) , . . . , π(in )♯pπ(n) ]) T (Closure) 3 (S, P ) = ⇒ (S ′ , P ′ ) T′ (S ′ , P ′ ) =⇒ (S ′′ , P ′′ ) T ++ T ′ (S, P ) =====⇒ (S ′′ , P ′′ ) Instrumentation and Run-Time Tracing For each message passing primitive (send/receive) we log two events. In case of send, (1) a pre event to indicate the message is about to be sent, and (2) a post event to indicate the message has been sent. The treatment is analogous for receive. In our instrumentation, we write x! to denote a single send event and x? to denote a single receive event. These notations are shorthands and can be expressed in terms of the language described so far. We use ≡ to define shortforms and their encodings. We define x! ≡ [hash(x), 1] and x? ≡ [hash(x), 0]. That is, send is represented by the number 1 and receive by the number 0. As we support non-deterministic selection, we employ a list of pre events to indicate that one of several events may be chosen For example, pre([x!, y?]) indicates that there is the choice among sending over channel x and receiving over channel y. This is again a shorthand notation where we assume pre([b1 , . . . , bn ]) ≡ [0, b1 , . . . , bn ]. A post event is always singleton as at most one of the possible communications is chosen. As we also trace communication partners, we assume that the sending party transmits its identity, the thread id, to the receiving party. We write post (i♯x?) to denote reception via channel x where the sender has thread id i. In case of a post send event, we simply write post (x!). The above are yet again shorthands where i♯x? ≡ [hash(x), 0, i] and post (b) ≡ [1, b]. Pre and post events are written in a fresh thread local variable, denoted by xtid where tid refers to the thread’s id number. At the start of the thread the variable is initialized by xtid := []. Instrumentation ensures that pre and post 8 events are appropriately logged. As we keep track of communication partners, we must also inject and project messages with additional information (the sender’s thread id). We consider instrumentation of select [x ← 1 ⇒ [], y :=← x ⇒ [z ← y]]. We assume the above program text is part of a thread with id number 1. We nondeterministically choose between a send an receive operation. In case of receive, the received value is further transmitted. Instrumentation yields the following. [x1 := x1 ++ pre([x!, x?]), select [x ← [tid, 1] ⇒ [x1 := x1 ++ post (x!)], y ′ :=← x ⇒ [x1 := x1 ++ post (head(y ′ )♯x?), y := last(y ′ ), z ← [tid, y]]] We first store the pre events, either a read or send via channel x. The send is instrumented by additionally transmitting the senders thread id. The post event for this case simply logs that a send took place. Instrumentation of receive is slightly more involved. As senders supply their thread id, we introduce a fresh variable y ′ . Via head(y ′ ) we extract the senders thread id to properly record the communication partner in the post event. The actual value transmitted is accessed via last(y ′ ). Definition 8 (Instrumentation of Programs). We write instr(p) = q to denote the instrumentation of program p where q is the result of instrumentation. Function instr (·) is defined by structural induction on a program. We assume a similar instrumentation function for commands. instr([]) instr(c : p) = [] = instr (c) : instr (p) instr(y := b) = [y := b] instr(y := makeChan) = [y := makeChan] instr(go p) = [go ([xtid := [] ++ instr (p)])] instr(select [ei ⇒ pi ]i∈{1,...,n} ) = [xtid := xtid ++ [pre([retr(e1 ), . . . , retr (en )])], select [instr (ei ⇒ pi )]i∈{1,...,n} ] instr(x ← b ⇒ p) = x ← [tid, b] ⇒ (xtid := xtid ++ [post (x!)]) ++ instr (p) instr(y :=← x ⇒ p) = y ′ :=← x ⇒ [xtid := xtid ++ [post (head(y ′ )♯x?)], y := last(y ′ )] ++ instr(p) retr(x ← b) = x! retr(y =← x) = x? Run-time tracing proceeds as follows. We simply run the instrumented program and extract the local traces connected to variables xtid . We assume that thread id numbers are created during program execution and can be enumerated by 1 . . . n for some n > 0 where thread id number 1 belongs to the main thread. Definition 9 (Run-Time Tracing). Let p and q be programs such that instr(p) = T q. We consider a specific instrumented program run where ((), [1♯[x1 := []] ++ q]) = ⇒ 9 (S, 1♯[] : P ) for some S, T and P . Then, we refer to T as p’s actual run-time trace. We refer to the list [1♯S(x1 ), . . . , n♯S(xn )] as the local traces obtained via the instrumentation of p. Command x1 := [] is added to the instrumented program to initialize the trace of the main thread. Recall that main has thread id number 1. This extra step is necessary because our instrumentation only initializes local traces of threads generated via go. The final configuration (S, 1♯[] : P ) indicates that the main thread has run to full completion. This is a realistic assumption as we assume that programs exhibit no obvious bug during execution. There might still be some pending threads, in case P differs from the empty list. 4 Trace Analysis We assume that the program has been instrumented and after some program run we obtain a list of local traces. We show that the actual run-time trace can be recovered and we are able to point out alternative behaviors that could have taken place. Alternative behaviors are either due alternative schedules or different choices among communication partners. We consider the list of local traces [1♯S(x1 ), . . . , n♯S(xn )]. Their shape can be characterized as follows. Definition 10 (Local Traces). U, V L as M ::= [] | i♯L : U ::= [] | pre(as) : M ::= [] | x! : as | x? : as ::= [] | post (x!) : L | post (i♯x?) : L We refer to U = [1♯L1 , . . . , n♯Ln ] as a residual list of local traces if for each Li either Li = [] or Li = [pre(. . . )]. To recover the communications that took place we check for matching pre and post events recorded in the list of local traces. For this purpose, we introduce a T relation U = ⇒ V to denote that ‘replaying’ of U leads to V where communications T took place. Valid replays are defined via the following rules. 10 T Definition 11 (Replay U = ⇒ V ). L1 = pre([. . . , x!, . . . ]) : post (x!) : L′1 L2 = pre([. . . , x?, . . . ]) : post (i1 ♯x?) : L′2 (Sync) [i1 ♯x!,i2 ←i1 ♯x?] i1 ♯L1 : i2 ♯L2 : U ==========⇒ i1 ♯L′1 : i2 ♯L′2 : U (Schedule) π permutation on {1, . . . , n} [] [i1 ♯L1 , . . . , in ♯Ln ] = ⇒ [iπ(1) ♯Lπ(1) , . . . , iπ(n) ♯Lπ(n) ] T′ T (Closure) U= ⇒ U ′ U ′ =⇒ U ′′ T ++ T ′ U =====⇒ U ′′ Rule (Sync) checks for matching communication partners. In each trace, we must find complementary pre events and the post events must match as well. Recall that in the instrumentation the sender transmits its thread id to the receiver. Rule (Schedule) shuffles the local traces as rule (Sync) only considers the two leading local traces. Via rule (Closure) we perform repeated replay steps. We can state that the actual run-time trace can be obtained via the replay reT lation U = ⇒ V but further run-time traces are possible. This is due to alternative schedules. Proposition 1 (Replay Yields Run-Time Traces). Let p be a program and q its instrumentation where for a specific program run we observe the actual behavior T and the list [1♯L1 , . . . , n♯Ln ] of local traces. Let T = {T ′ | T′ [1♯L1 , . . . , n♯Ln ] =⇒ 1♯[] : U for some residual U }. Then, we find that T ∈ T T′ and for each T ′ ∈ T we have that ((), p) =⇒ (S, 1♯[] : P ) for some S and P . Definition 12 (Alternative Schedules). We say [1♯L1 , . . . , n♯Ln ] contains T′ alternative schedules iff the cardinality of the set {T ′ | [1♯L1 , . . . , n♯Ln ] =⇒ 1♯[] : U for some residual U } is greater than one. We can also check if even further run-time traces might have been possible by testing for alternative communications. Definition 13 (Alternative Communications). We say [1♯L1 , . . . , n♯Ln ] contains alternative matches iff for some i, j, x, L, L′ we have that (1) Li = pre([. . . , x!, . . . ]) : L, (2) Lj = pre([. . . , x?, . . . ]) : L′ , and (3) if L = post (x!) : L′′ for some L′′ then L′ 6= post (j♯x?) : L′′′ for any L′′′ . We say U = [1♯L1 , . . . , n♯Ln ] contains alternative communications iff U T contains alternative matches or there exists T and V such that U = ⇒ V and V contains alternative matches. The alternative match condition states that a sender could synchronize with a receiver (see (1) and (2)) but this synchronization did not take place (see (3)). For an alternative match to result in an alternative communication, the match must be along a possible run-time trace. 11 [x := makeChan, y := makeChan, go [z := (← y)6 ], go [(y ← 1)4 , (x ← 1)5 ], go [(x ← 1)3 ], x := (← x)1 , x := (← x)2 ] x!|3 [4♯[pre((y?)6 ), post (3♯(y?)6 )], 3♯[pre((y!)4 ), post ((y!)4 ), pre((x!)5 ), post ((x!)5 )], 2♯[pre((x!)3 ), post ((x!)3 )], 1♯[pre((x?)1 ), post (2♯(x?)1 ), pre((x?)2 ), post (4♯(x?)3 )]] x?|1 x?|2 x!|5 y!|4 y?|6 Fig. 1: Dependency Graph among Events 4.1 Dependency Graph for Efficient Trace Analysis Instead of replaying traces to check for alternative schedules and communications, we build a dependency graph where the graph captures the partial order among events. It is much more efficient to carry out the analysis on the graph than replaying traces. Figure 1 shows a simple example. We find a program that makes use of two channels and four threads. For reference, send/receive events are annotated (as subscript) with unique numbers. We omit the details of instrumentation and assume that for a specific program run we find the list of given traces on the left. Pre events consist of singleton lists as there is no select. Hence, we write pre((y?)6 ) as a shorthand for pre([(y?)6 ]). Replay of the trace shows that the following locations synchronize with each other: (4, 6), (3, 1) and (5, 2). This information as well as the order among events can be captured by a dependency graph. Nodes are obtained by a linear scan through the list of traces. To derive edges, we require another scan for each element in a trace as we need to find pre/post pairs belonging to matching synchronizations. This results overall in O(m ∗ m) for the construction of the graph where m is the number of elements found in each trace. To avoid special treatment of dangling pre events (with not subsequent post event), we assume that some dummy post events are added to the trace. Definition 14 (Construction of Dependency Graph). Each node corresponds to a send or a receive operation in the program text. Edges are constructed by observing events recorded in the list of traces. We draw a (directed) edge among nodes if either – the pre and post events of one node precede the pre and post events of another node in the trace, or – the pre and post events belonging to both nodes can be synchronized. See rule (Sync) in Definition 11. We assume that the edge starts from the node with the send operation. Applied to our example, this results in the graph on the right. See Figure 1. For example, x!|3 denotes a send communication over channel x at program 12 location 3. As send precedes receive we find an edge from x!|3 to x?|1. In general, there may be several initial nodes. By construction, each node has at most one outgoing edge but may have multiple incoming edges. The trace analysis can be carried out directly on the dependency graph. To check if one event happens-before another event we seek for a path from one event to the other. This can be done via a depth-first search and takes time O(v + e) where v is the number of nodes and e the number of edges. Two events are concurrent if neither happens-before the other. To check for alternative communications, we check for matching nodes that are concurrent to each other. By matching we mean that one of the nodes is a send and the other is a receive over the same channel. For our example, we find that x!|5 and x?|1 represents an alternative communication as both nodes are matching and concurrent to each other. To derive (all) alternative schedules, we perform a backward traversal of the graph. Backward in the sense that we traverse the graph by moving from children to parent node. We start with some final node (no outgoing edge). Each node visited is marked. We proceed to the parent if all children are marked. Thus, we guarantee that the happens-before relation is respected. For our example, suppose we visit first y?6. We cannot visit its parent y!4 until we have visited x?2 and x!5. Via a (backward) breadth-first search we can ‘accumulate’ all schedules. 5 Comparison to Vector Clock Method Via a simple adaptation of the Replay Definition 11 we can attach vector clocks to each send and receive event. Hence, our tracing method strictly subsumes the vector clock method as we are also able to trace events that could not commit. Definition 15 (Vector Clock). cs ::= [] | n : cs For convenience, we represent a vector clock as a list of clocks where the first position belongs to thread 1 etc. We write cs[i] to retrieve the i-th component in cs. We write inc(i, cs) to denote the vector clock obtained from cs where all elements are the same but at index i the element is incremented by one. We write max(cs1 , cs2 ) to denote the vector clock where we per-index take the greater element. We write ics to denote thread i with vector clock cs. We write i♯x!cs to denote a send over channel x in thread i with vector clock cs. We write i ← j♯x?cs to denote a receive over channel x in thread i from thread j with vector clock cs. Definition 16 (From Trace Replay to Vector Clocks). (Sync) L1 = pre([. . . , x!, . . . ]) : post (x!) : L′1 L2 = pre([. . . , x?, . . . ]) : post (i1 ♯x?) : L′2 cs = max(inc(i1 , cs1 ), inc(i2 , cs2 )) [i1 ♯x!cs ,i2 ←i1 ♯x?cs ] cs2 ′ cs ′ 1 ics ============⇒ ics 1 ♯L1 : i2 ♯L2 : U 1 ♯L1 : i2 ♯L2 : U = 13 Like the construction of the dependency graph, the (re)construction of vector clocks takes time O(m ∗ m) where m is the number of elements found in each trace. To check for an alternative communication, the vector clock method seeks for matching events. This incurs the same (quadratic in the size of the trace) cost as for our method. However, the check that these two events are concurrent to each other can be performed more efficiently via vector clocks. Comparison of vector clocks takes time O(n) where n is the number of threads. Recall that our graph-based method requires time O(v + e) where v is the number of nodes and e the number of edges. The number n is smaller than v + e. However, our dependency graph representation is more efficient in case of exploring alternative schedules. In case of the vector clock method, we need to continuously compare vector clocks whereas we only require a (backward) traversal of the graph. We believe that the dependency graph has further advantages in case of user interaction and visualization as it is more intuitive to navigate through the graph. This is something we intend to investigate in future work. 6 Implementation We have fully integrated the approach laid out in the earlier sections into the Go programming language and have built a prototype tool. We give an overview of our implementation which can be found here [5]. A detailed treatment of all of Go’s message-passing features can be found in the extended version of this paper. 6.1 Library-Based Instrumentation and Tracing We use a pre-processor to carry out the instrumentation as described in Section 3. In our implementation, each thread maintains an entry in a lock-free hashmap where each entry represents a thread (trace). The hashmap is written to file either at the end of the program or when a deadlock occurs. We currently do not deal with the case that the program crashes as we focus on the detection of potential bugs in programs that do not show any abnormal behavior. 6.2 Measurement of Run-Time Overhead Library-Based Tracing We measure the run-time overhead of our method against the vector clock method. Both methods are implemented as libraries assuming no access to the Go run-time system. For experimentation we use three programs where each program exercises some of the factors that have an impact on tracing. For example, dynamic versus static number of threads and channels. Low versus high amount of communication among threads. The Add-Pipe (AP) example uses n threads where the first n − 1 threads receive on an input channel, add one to the received value and then send the 14 3ms 6ms 243ms PS100 C2000 107ms 476ms 5901ms 8ms 7ms 1475ms PS250 910ms AP21 6229ms 909ms Default 3ms 17ms C1000 44ms AP51 1191ms 0ms Pre-Post 2141ms 3825ms 7500ms 0ms VC 7500ms Fig. 2: Performance overhead using Pre/Post vs Vector clocks(VC) in ms. new value on their output channel to the next thread. The first thread sends the initial value and receives the result from the last thread. In the Primesieve (PS) example, the communication among threads is similar to the Add-Pipe example. The difference is that threads and channels are dynamically generated to calculate the first n prime numbers. For each found prime number a ‘filter’ thread is created. Each thread has an input channel to receive new possible prime numbers v and an output channel to report each number for which v mod prime 6= 0 where prime is the prime number associated with this filter thread. The filter threads are run in a chain where the first thread stores the prime number 2. The Collector (C) example creates n threads that produce a number which is then sent to the main thread for collection. This example has much fewer communications compared to the other examples but uses a high number of threads. Figure 2 summarizes our results. Results are carried out on some commodity hardware (Intel i7-6600U with 12 GB RAM, a SSD and Go 1.8.3 running on Windows 10 was used for the tests). Our results show that a library-based implementation of the vector clock method does not scale well for examples with a dynamic number of threads and/or a high amount communication among threads. See examples Primesieve and Add-Pipe. None of the vector clock optimizations [3] apply here because of the dynamic number of threads and channels. Our method performs much better. This is no surprise as we require less (tracing) data and no extra communication links. We believe that the overhead can still be further reduced as access to the thread id in Go is currently rather cumbersome and expensive. 7 Conclusion One of the challenges of run-time verification in the concurrent setting is to establish a partial order among recorded events. Thus, we can identify potential bugs due to bad schedules that are possible but did not take place in some specific program run. Vector clocks are the predominant method to achieve this task. For 15 example, see work by Vo [11] in the MPI setting and work by Tasharofi [10] in the actor setting. There are several works that employ vector clocks in the shared memory setting For example, see Pozniansky’s and Schuster’s work [9] on data race detection. Some follow-up work by Flanagan and Freund [2] employs some optimizations to reduce the tracing overhead by recording only a single clock instead of the entire vector. We leave to future work to investigate whether such optimizations are applicable in the message-passing setting and how they compare to existing optimizations such as [3]. We have introduced a novel tracing method that has much less overhead compared to the vector clock method. Our method can deal with all of Go’s message-passing language features and can be implemented efficiently as a library. We have built a prototype that can automatically identify alternative schedules and communications. In future work we plan to conduct some case studies and integrate heuristics for specific scenarios, e.g. reporting a send operation on a closed channel etc. Acknowledgments We thank some HVC’17 reviewers for their constructive feedback on an earlier version of this paper. References 1. C. J. Fidge. Timestamps in message-passing systems that preserve the partial ordering. 10(1):56–66, 1987. 2. C. Flanagan and S. N. Freund. Fasttrack: Efficient and precise dynamic race detection. In Proc. of PLDI ’09, pages 121–133. ACM, 2009. 3. V. K. Garg, C. Skawratananond, and N. Mittal. Timestamping messages and events in a distributed system using synchronous communication. Distributed Computing, 19(5-6):387–402, 2007. 4. The Go programming language. https://golang.org/. 5. Trace-based run-time analysis of message-passing Go programs. https://github.com/KaiSta/gopherlyzer-GoScout. 6. C. A. R. Hoare. Communicating sequential processes. Commun. ACM, 21(8):666– 677, Aug. 1978. 7. L. Lamport. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM, 21(7):558–565, 1978. 8. F. Mattern. Virtual time and global states of distributed systems. In Parallel and Distributed Algorithms, pages 215–226. North-Holland, 1989. 9. E. Pozniansky and A. Schuster. Multirace: efficient on-the-fly data race detection in multithreaded C++ programs. Concurrency and Computation: Practice and Experience, 19(3):327–340, 2007. 10. S. Tasharofi. Efficient testing of actor programs with non-deterministic behaviors. PhD thesis, University of Illinois at Urbana-Champaign, 2013. 11. A. Vo. Scalable Formal Dynamic Verification of Mpi Programs Through Distributed Causality Tracking. PhD thesis, University of Utah, 2011. AAI3454168. 16 func A ( x chan int ) { x <- 1 // A1 } func bufferedChan () { x := make ( chan int ,1) go A ( x ) x <- 1 // A2 <- x } func closedChan () { x := make ( chan int ) go A ( x ) go B ( x ) close ( x ) } func B ( x chan int ) { <- x } func selDefault () { x := make ( chan int ) go A ( x ) select { case <-x : // A3 fmt . Println ( " received from x " ) default : fmt . Println ( " default " ) } } Fig. 3: Further Go Features A A.1 Further Go Message-Passing Features Overview Besides selective synchronous message-passing, Go supports some further message passing features that can be easily dealt with by our approach and are fully supported by our implementation. Figure 3 shows such examples where we put the program text in two columns. Buffered Channels Go also supports buffered channels where send is asynchronous assuming sufficient buffer space exists. See function buffered in Figure 3. Depending on the program run, our analysis reports that either A1 or A2 are alternative matches for the receive operation. In terms of the instrumentation and tracing, we treat each asynchronous send as if the send is executed in its own thread. This may lead to some slight inaccuracies. Consider the following variant. func b u f f e r e d 2 () { x := make ( chan int ,1) x <- 1 go A ( x ) <-x } // B1 // B2 // B3 Our analysis reports that B2 and B3 form an alternative match. However, in the Go semantics, buffered messages are queued. Hence, for every program run the only possibility is that B1 synchronizes with B3. B3 never takes place! As our 17 main objective is bug finding, we argue that this loss of accuracy is justifiable. How to eliminate such false positives is subject of future work. Select with default/timeout Another feature in Go is to include a default/timeout case to select. See selDefault in Figure 3. The purpose is to avoid (indefinite) blocking if none of the other cases are available. For the user it is useful to find out if other alternatives are available in case the default case is selected. The default case applies for most program runs. Our analysis reports that A1 and A3 are an alternative match. To deal with default/timeout we introduce a new post event post (select ). To carry out the analysis in terms of the dependency graph, each subtrace . . . , pre([. . . , select , . . . ]), post (select ), . . . creates a new node. Construction of edges remains unchanged. Closing of Channels Another feature in Go is the ability to close a channel. See closedChan in Figure 3. Once a channel is closed, each send on a closed channel leads to failure (the program crashes). On the other hand, each receive on a closed channel is always successful, as we receive a dummy value. A run of is successful if the close operation of the main thread happens after the send in thread A. As the close and send operations happen concurrently, our analysis reports that the send A1 may take place after close. For instrumentation/tracing, we introduce event close(x). It is easy to identify a receive on a closed channel, as we receive a dummy thread id. So, for each subtrace [. . . , pre([. . . , x?, . . . ]), post (i♯x?), . . . ] where i is a dummy value we draw an edge from close(x) to x?. Here are the details of how to include buffered channels, select and closing of channels. A.2 Buffered Channels Consider the following Go program. x := make ( chan , 2) x <- 1 // E1 x <- 1 // E2 <- x // E3 <- x // E4 We create a buffer of size 2. The two send operations will then be carried out asynchronously and the subsequent receive operations will pick up the buffered values. We need to take special care of buffered send operations. If we would treat them like synchronous send operations, their respective pre and post events would be recorded in the same trace as the pre and post events of the receive operations. This would have the consequence that our trace analysis does not find out that events E1 and E2 happen before E3 and E4. Our solution to this issue is to treat each send operation on a buffered channel as if the send operation is carried out in its own thread. Thus, our trace analysis 18 is able to detect that E1 and E2 take place before E3 and E4. This is achieved by marking each send on a buffered channel in the instrumentation. After tracing, pre and post events will then be moved to their own trace. From the viewpoint of our trace analysis, a buffered channel then appears as having infinite buffer space. Of course, when running the program a send operation may still block if all buffer space is occupied. Here are the details of the necessary adjustments to our method. During instrumentation/tracing, we simply record if a buffered send operation took place. The only affected case in the instrumentation of commands (Definition 8) is x ← b ⇒ p. We assume a predicate isBuffered(·) to check if a channel is buffered or not. In terms of the actual implementation this is straightforward to implement. We write postB (x, n) to indicate a buffered send operation via x where n is a fresh thread id. We create fresh thread id numbers via tidB. Definition 17 (Instrumentation of Buffered Channels). Let x be a buffered channel. instr(x ← b ⇒ p) | isBuffered(x) = x ← [n, b] ⇒ (xtid := xtid ++ [postB (x!n, ])) ++ instr (p) where n = tidB | otherwise = x ← [tid, b] ⇒ (xtid := xtid ++ [post (x!)]) ++ instr (p) The treatment of buffered channels has no overhead on the instrumentation and tracing. However, we require a post-processing phase where marked events will be then moved to their own trace. This can be achieved via a linear scan through each trace. Hence, requires time complexity O(k) where k is the overall size of all (initially recorded) traces. For the sake of completeness, we give below a declarative description of post-processing in terms of relation U ⇒ V . Definition 18 (Post-Processing for Buffered Channels U ⇒ V ). (MovePostB) L = pre(as) : postB (x!, n) : L′ i♯L : U ⇒ i♯L′ : n♯[pre(as), postB (x!, n)] : U L = pre(as) : post (a) : L′ (a = x! ∨ a = j♯x?) (Shift) i♯L′ : U ⇒ i♯L′′ : U ′ i♯L : U ⇒ i♯pre(as) : post (a) : L′′ : U ′ (Schedule) π permutation on {1, . . . , n} [i1 ♯L1 , . . . , in ♯Ln ] ⇒ [iπ(1) ♯Lπ(1) , . . . , iπ(n) ♯Lπ(n) ] (Closure) U ⇒ U ′ U ′ ⇒ U ′′ U ⇒ U ′′ 19 Subsequent analysis steps will be carried out on the list of traces obtained via post-processing. There is some space for improvement. Consider the following program text. func A ( x chan int ) { x <- 1 // A1 } func b u f f e r e d 2 () { x := make ( chan int ,1) x <- 1 go A ( x ) <-x } // B1 // B2 // B3 Our analysis (for some program run) reports that B2 and B3 is an alternative match. However, in the Go semantics, buffered messages are queued. Hence, for every program run the only possibility is that B1 synchronizes with B3. B3 never takes place. As our main objective is bug finding, we can live with this inaccuracy. We will investigate in future work how to eliminate this false positive. B Select with default/timeout In terms of the instrumentation/tracing, we introduce a new special post event post (select ). For the trace analysis (Definition 11), we require a new rule. [i♯select] (Default/Timeout) i♯pre([. . . ]) : post (select ) : L : U =====⇒ i♯L : U This guarantees that in case default or timeout is chosen, select acts as if asynchronous. The dependency graph construction easily takes care of this new feature. For each default/timeout case we introduce a node. Construction of edges remains unchanged. C Closing of Channels For instrumentation/tracing of the close(x) operation on channel x, we introduce a special pre and post event. Our trace analysis keeps track of closed channels. As a receive on a closed channel yields some dummy values, it is easy to distinguish this case from the regular (Sync). Here are the necessary adjustments to our replay relation from Definition 11. C ::= [] | i♯close(x) : C 20 [] (Close) (i♯pre(close(x)) : post (close(x)) : L : U | C) = ⇒ (i♯L : U | i♯close(x) : C) (RcvClosed) Q = j♯close(x) : Q′ [j♯close(x),i←j♯x?] (i♯pre([. . . , x?, . . . ]) : post (j ′ ♯x?) : L : U | Q) ============⇒ (i♯L : U | Q) For the construction of the dependency graph, we create a node for each close statement. For each receive on a closed channel x at program location l, we draw an edge from close(x) to x?|l. D Codes used for the Experimental results Add-Pipe func add1 ( in chan int) chan int { out := make ( chan int ) go func () { for { n := <- in out <- n + 1 } }() return out } func main () { in := make ( chan int) c1 := add1 ( in ) for i := 0; i < 19; i ++ { c1 = add1 ( c1 ) } for n := 1; n < 1000; n ++ { in <- n <- c1 } } Primesieve func g e n e r a t e( ch chan int ) { for i := 2; ; i ++ { ch <- i 21 } } func filter ( in chan int , out chan int , prime int ) { for { tmp := <- in if tmp % prime != 0 { out <- tmp } } } func main () { ch := make ( chan int) go g e n e r a t e( ch ) for i := 0; i < 100; i ++ { prime := <- ch ch1 := make ( chan int ) go filter ( ch , ch1 , prime ) ch = ch1 } } Collector func c o l l e c t( x chan int , v int ) { x <- v } func main () { x := make ( chan int ) for i := 0; i < 1000; i ++ { go c o l l e c t(x , i ) } for i := 0; i < 1000; i ++ { <-x } } 22 x!|2 x?|4 x!|4’ x?|3 x!|2’ x?|4’’ x!|4’ x?|3 x!|2 x?|4
6cs.PL
Deep Mean Field Games for Learning Optimal Behavior Policy of Large Populations Jiachen Yang1 , Xiaojing Ye2 , Rakshit Trivedi1 , Huan Xu3 , and Hongyuan Zha1 1 College of Computing, Georgia Institute of Technology Department of Mathematics and Statistics, Georgia State University 3 School of Industrial and Systems Engineering, Georgia Institute of Technology arXiv:1711.03156v1 [cs.LG] 8 Nov 2017 2 Abstract We consider the problem of representing a large population’s behavior policy that drives the evolution of the population distribution over a discrete state space. A discrete time mean field game (MFG) is motivated as an interpretable model founded on game theory for understanding the aggregate effect of individual actions and predicting the temporal evolution of population distributions. We achieve a synthesis of MFG and Markov decision processes (MDP) by showing that a special MFG is reducible to an MDP. This enables us to broaden the scope of mean field game theory and infer MFG models of large real-world systems via deep inverse reinforcement learning. Our method learns both the reward function and forward dynamics of an MFG from real data, and we report the first empirical test of a mean field game model of a real-world social media population. 1 Introduction Nothing takes place in the world whose meaning is not that of some maximum or minimum. (Leonhard Euler) Major global events involving large populations, such as the wave of protests during the Arab Spring, the Black Lives Matter movement, and the controversy over fake news during the 2016 U.S. presidential election, provide significant impetus for devising new models that account for macroscopic population behavior resulting from the aggregation of decisions and actions taken by all individuals (Howard et al., 2011; Anderson and Hitlin, 2016; Silverman, 2016). Just as physical systems behave according to the principle of least action, to which Euler’s statement alludes, population behavior emerging from individual actions may also be optimal with respect to some objective. The influential role of social media in modern mass movements lends plausibility to this hypothesis (Perrin, 2015), since the availability of information enables individuals to plan and act based on their observations of the global population state. For example, a population’s behavior directly affects the ranking of a set of trending topics on social media, represented by the global population distribution over topics, while each user’s observation of this global state influences their choice of the next topic in which to participate, thereby contributing to future population behavior (Twitter, 2017). In general, this phenomenon is present in any system where the distribution of a large population over a set of states is observable (or partially observable) by the population itself, whose implicit behavior policy is informed by their observations. This motivates multiple criteria for a model of population behavior: 1. The model captures the dependency between population distribution and their behavior policy. 2. It is explainable via a notion of a reward optimized by the aggregate decisions of all individuals. 3. It enables prediction of future distribution over a state space given measurements at previous times, and can be learned from real data. We present a mean field game (MFG) approach to address the modeling and prediction criteria. Mean field games originated as a branch of game theory that provides tractable models of large agent populations, by considering the limit of N -player games as N tends to infinity (Lasry and Lions, 2007). In this limit, an agent population is represented 1 via their distribution over a state space, the mutual influence between individual agents becomes infinitesimal, and each agent’s optimal strategy is informed by a reward that is a function of the population distribution and their aggregate actions. In its most general form, MFG represents a class of stochastic differential equations that can be specialized to model the production of economic resources (Guéant et al., 2011), opinion dynamics in social networks (Bauso et al., 2016), and the adoption of competing technologies by consumer populations (Lachapelle et al., 2010). Representing agents as a distribution means that MFG is scalable to arbitrary population sizes, enabling it to simulate real-world phenomenon such as the Mexican wave in stadiums (Guéant et al., 2011). As the model detailed in Section 3 will show, MFG naturally addresses the modeling criteria in our problem context by overcoming limitations of alternative predictive methods. For example, time series analysis builds predictive models from data, but these models may not provide insight into the motivations that produce a population’s behavior policy, since they do not consider the behavior as the result of optimization of a reward function. Alternatively, methods that employ the underlying population network structure have assumed that nodes are only influenced by a local neighborhood, do not include a representation of a global state, and may face difficulty in explaining events as the result of uncontrolled implicit optimization (Farajtabar et al., 2015; De et al., 2016). MFG is unique as a descriptive model whose solution tells us how a system naturally behaves according to its underlying optimal control policy. This is the essential insight that enables us to draw a connection with the framework of Markov decision processes (MDP) and reinforcement learning (RL) (Sutton and Barto, 1998). The crucial difference from a traditional MDP viewpoint is that we frame the problem as MFG model inference via MDP policy optimization: we infer the implicit optimization that the system performs on its own accord, by solving an associated MDP without externally controlling the system. MFG offers a computationally tractable framework for adapting inverse reinforcement learning (IRL) methods (Ng and Russell, 2000; Ziebart et al., 2008; Finn et al., 2016), with flexible neural networks as function approximators, to learn complex reward functions that explain behavior of arbitrarily large populations. In the other direction, RL enables us to devise a data-driven method for solving an MFG model of a real-world system. While research on the theory of MFG has progressed rapidly in recent years, with some examples of numerical simulation of synthetic toy problems, there is a conspicuous absence of scalable methods for empirical validation (Lachapelle et al., 2010; Achdou et al., 2012; Bauso et al., 2016). Therefore, while we show how MFG is well-suited for the specific problem of modeling population behavior, we also demonstrate a general data-driven approach to MFG inference via a synthesis of MFG and MDP. Our main contributions are the following. We propose a data-driven approach to learn an MFG model along with its reward function, showing that research in MFG need not be confined to toy problems with artificial reward functions. Specifically, we derive a discrete time graph-state MFG from general MFG and provide detailed interpretation in a real-world setting (Section 3). Then we prove that a special case can be reduced to an MDP and show that finding an optimal policy and reward function in the MDP is equivalent to inference of the MFG model (Section 4). Using our approach, we empirically validate an MFG model of population’s activity distribution on social media (Section 5). The learned MFG model shows significantly better predictive performance compared to baselines and offers insights on population behavior. Our synthesis of MFG with MDP has potential to open new research directions for both fields. 2 Related work Mean field games originated in the work of Lasry and Lions (2007), and independently as stochastic dynamic games in Huang et al. (2006), both of which proposed mean field problems in the form of differential equations for modeling problems in economics and analyzed the existence and uniqueness of solutions. Guéant et al. (2011) provided a survey of MFG models and discussed various applications in continuous time and space, such as a model of population distribution that informed the choice of application in our work. Even though the MFG framework is agnostic towards the choice of cost function (i.e. negative reward), prior work make strong assumptions on the cost in order to attain analytic solutions. We take a view that the dynamics of any game is heavily impacted by the reward function, and hence we propose methods to learn the MFG reward function from data. Discretization of MFGs in time and space have been proposed (Gomes et al., 2010; Achdou et al., 2012; Guéant, 2015), serving as the starting point for our model of population distribution over discrete topics; while these early work analyze solution properties and lack empirical verification, we focus on algorithms for attaining solutions in real-world settings. Related to our application case, prior work by Bauso et al. (2016) analyzed the evolution of 2 opinion dynamics in multi-population environments, but they imposed a Gaussian density assumption on the initial population distribution and restrictions on agent actions, both of which limit the generality of the model and are not assumed in our work. There is a collection of work on numerical finite-difference methods for solving continuous mean field games (Achdou et al., 2012; Lachapelle et al., 2010; Carlini and Silva, 2014). These methods involve forward-backward or Newton iterations that are sensitive to initialization and have inherent computational challenges for large real-valued state and action spaces, which limit these methods to toy problems and cannot be scaled to real-world problems. We overcome these limitations by showing how the MFG framework enables adaptation of RL algorithms that have been successful for problems involving unknown reward functions in large real-world domains. In reinforcement learning, there are numerous value- and policy-based algorithms employing deep neural networks as function approximators for solving MDPs with large state and action spaces (Mnih et al., 2013; Silver et al., 2014; Lillicrap et al., 2015). Even though there are generalizations to multi-agent settings (Hu et al., 1998; Littman, 2001; Lowe et al., 2017), the MDP and Markov game frameworks do not easily suggest how to represent systems involving thousands of interacting agents whose actions induce an optimal trajectory through time. In our work, mean field game theory is the key to framing the modeling problem such that RL can be applied. In the area of inverse reinforcement learning (Ng and Russell, 2000), the maximum entropy IRL framework has proved successful at learning unknown reward functions from expert demonstrations in situations involving human and robotic agency (Ziebart et al., 2008; Boularias et al., 2011; Kalakrishnan et al., 2013). This probabilistic framework can be augmented with deep neural networks for learning complex reward functions from demonstration samples (Wulfmeier et al., 2015; Finn et al., 2016). Our MFG model enables us to extend the sample -based IRL algorithm in Finn et al. (2016) to the problem of learning a reward function under which a large population’s behavior is optimal, and we employ a neural network to process MFG states and actions efficiently. 3 Mean field games We begin with an overview of a continuous-time mean field games over graphs, and derive a general discrete-time graph-state MFG (Guéant, 2015). Then we give a detailed presentation of a discrete-time MFG over a complete graph, which will be the focus for the rest of this paper. 3.1 Mean field games on graphs Let G = (V, E) be a directed graph, where the vertex set V = {1, . . . , d} represents d possible states of each agent, and E ⊆ V × V is the edge set consisting of all possible direct transition between states (i.e., a agent can hop from i to j only if (i, j) ∈ E). For each node i ∈ V, define Vi+ := {j : (j, i) ∈ E}, Vi− := {j : (i, j) ∈ E}, and V̄i+ := Vi+ ∪ {i} and V̄i− := Vi− ∪ {i}. Let πi (t) be the density (proportion) of agent population in state i at time t, and π(t) := (π1 (t), . . . , πd (t)). Population dynamics are generated by right stochastic matrices P (t) ∈ S(G), where S(G) := S1 (G) × · · · × Sd (G) and each row Pi (t) belongs to Si (G) := {p ∈ ∆d−1 | supp(p) ⊂ V̄i− } where ∆d−1 is the simplex in Rd . Moreover, we have a value function Vi (t) of state i at time t, and a reward function ri (π(t), Pi (t)) 1 , quantifying the instantaneous reward for agents in state i taking transitions with probability Pi (t) when the current distribution is π(t). We are mainly interested in a discrete time graph state MFG, which is derived from a continuous time MFG by the following proposition. Appendix A provides a derivation from the continuous time MFG. Proposition 1. Under a semi-implicit discretization scheme with unit time step labeled by n, the backward HamiltonJacobi-Bellman (HJB) equation and the forward Fokker-Planck equation for each i ∈ {1, . . . , d} and n = 0, . . . , N −1 in a discrete time graph state MFG are given by:   X n n+1 (HJB) Vin = maxPin ∈Si (G) ri (π n , Pin ) + P V (1) ij j j∈V̄i− X n n (Fokker-Planck) πin+1 = Pji πj (2) + j∈V̄i 1 We here consider a rather special formulation where the reward function ri only depends on the overall population distribution π(t) and the choice Pi the players in state i made. 3 3.2 Discrete time MFG over complete graph Proposition 1 shows that a discrete time MFG given in Gomes et al. (2010) can be seen as a special case of a discrete time graph state MFG with a complete graph (such that S(G) = ∆d−1 × · · · × ∆d−1 (d of ∆d−1 )). We focus on the complete graph in this paper, as the methodology can be readily applied to general directed graphs. While Section 4 will show a connection between MFG and MDP, we note here that a “state” in the MFG sense is a node in V and not an MDP state. 2 We now interpret the model using the example of evolution of user activity distribution over topics on social media, to provide intuition and set the context for our real-world experiments in Section 5. Independent of any particular interpretation, the MFG approach is generally applicable to any problem where population size vastly outnumbers a set of discrete states. • Population distribution π n ∈ ∆d−1 for n = 0, . . . , N − 1. Each π n is a discrete probability distribution over d topics, where πin is the fraction of people who posted on topic i at time n. Although a person may participate in more than one topic within a time interval, normalization can be enforced by a small time discretization or by using a notion of “effective population size”, defined as population size multiplied by the max participation count of any person during any time interval. π 0 is a given initial distribution. • Transition matrix P n ∈ S(G). Pijn is the probability of people in topic i switching to topic j at time n, so we refer to Pin as the action of people in topic i. P n generates the forward equation d X Pijn πin (3) πjn+1 = i=1 n , Pin ) Pd n n n j=1 Pij rij (π , Pi ), • Reward ri (π := for i ∈ {1, . . . , d}. This is the reward received by people in topic i who choose action Pin at time n, when the distribution is π n . In contrast to previous work, we learn the reward function from data (Section 4.1). The only assumption we make is that reward for i depends only on Pin , not on the entire P n . This is a causality assumption that actions by people in j 6= i have no instantaneous effect on the reward for people in topic i. 3 • Value function V n ∈ Rd . Vin is the expected maximum total reward of being in topic i at time n. A terminal value V N −1 is given, which we set to zero to avoid making any assumption on the problem structure beyond what is contained in the learned reward function. • Average reward ei (π, P, V ), for i ∈ {1, . . . , d} and V ∈ Rd and P ∈ S(G). This is the average reward received by agents at topic i when the current distribution is π, action P is chosen, and the subsequent expected maximum total reward is V . It is defined as: d X ei (π, P, V ) = Pij (rij (π, P ) + Vj ) (4) j=1 Intuitively, agents want to act optimally in order to maximize their expected total average reward. For P ∈ S(G) and a vector q ∈ Si (G), define P(P, i, q) to be the matrix equal to P , except with the i-th row replaced by q. Then a Nash maximizer is defined as follows: Definition 1. A right stochastic matrix P ∈ S(G) is a Nash maximizer of e(π, P, V ) if, given a fixed π ∈ ∆d−1 and a fixed V ∈ Rd , for any i ∈ {1, . . . , d} and any q ∈ Si (G), there is ei (π, P, V ) ≥ ei (π, P(P, i, q), V ) (5) The rows of P form a Nash equilibrium set of actions, since for any topic i, the people in topic i cannot increase their reward by unilaterally switching their action from Pi to any q. Under Definition 1, the value function of each topic i at each time n satisfies the optimality criteria: X  d   n+1 n n n Vi = max qj rij (π , P(P , i, q)) + Vj (6) q∈Si (G) j=1 A solution of the MFG is a sequence of pairs {(π n , V n )}n=0,...,N satisfying optimality criteria (6) and forward equation (3). 2 Section 4 explains that the population distribution π is the appropriate definition of an MDP state. this assumption is removed, there is a resemblance between the discrete time MFG and a Markov game in a continuous state and continuous action space (Littman, 2001; Hu et al., 1998). See Appendix G for a discussion. 3 If 4 4 Inference of MFG via MDP optimization A Markov decision process is a well-known framework for optimization problems. We focus on the discrete time MFG in Section 3.2 and prove a reduction to a single-agent finite-horizon deterministic MDP, whose state trajectory under an optimal policy coincides with the forward evolution of the MFG. This leads to the essential insight that solving the optimization problem of a single-agent MDP is equivalent to solving the inference problem of an MFG. This connection will enable us to apply efficient inverse RL methods, using measurements of real population trajectories, to learn an MFG model along with its reward function in Section 4.1. The MDP is constructed as follows: Definition 2. A single-agent finite-horizon deterministic MDP for a discrete time MFG over a complete graph is defined as: • States: π n ∈ ∆d−1 , the population distribution at time n. • Actions: P n ∈ S(G), the transition probability matrix at time n. Pd Pd • Reward: R(π n , P n ) := i=1 πin j=1 Pijn rij (π n , Pin ) Pd • Finite-horizon state transition, given by Eq (3): ∀n ∈ {0, . . . , N − 1} : πjn+1 = i=1 Pijn πin . Theorem 2. The value function of a solution to the discrete time MFG over a complete graph defined by optimality criteria (6) and forward equation (3) is a solution to the Bellman optimality equation of the MDP in Definition 2. Proof. Since rij depends on P n only through row Pin , optimality criteria 6 can be written as    X X Vin = max Pij rij (π n , Pi ) + Pij Vjn+1 .  Pi ∈Si (G)  j (7) j We now define V ∗ (π n ) as follows and show that it is the value function of the constructed MDP in Definition 2 by verifying that it satisfies the Bellman optimality equation: V ∗ (π n ) := d X i=1 πin Vin = d X πin max Pi ∈Si (G) i=1 = max X d P ∈S(G)  = max P ∈S(G)  = max X d P ∈S(G) πin i=1 Pij rij (π n , Pi ) + j=1 d X Pij Vjn+1  (8) j=1 n Pij rij (π , Pi ) + d d X X j=1 j=1 R(π n , P ) + d X d X πjn+1 Vjn+1 ! Pij πin Vjn+1  (9) i=1  (10) j=1 ∗ n R(π , P ) + V (π n+1  ) (11) which is the Bellman optimality equation for the MDP in Definition 2. Corollary 1. Given a start state π 0 , the state trajectory under the optimal policy of the MDP in Definition 2 is equivalent to the forward evolution part of the solution to the MFG. Proof. Under the optimal policy, equations 11 and 8 are satisfied, which means the matrix P generated by the optimal policy at any state π n is the Nash maximizer matrix. Therefore, the state trajectory {π n }n=0,...,N −1 is the forward part of the MFG solution. 4.1 Reinforcement learning solution for MFG MFG provides a general framework for addressing the problem of modeling population dynamics, while the new connection between MFG and MDP enables us to apply inverse RL algorithms to solve the MDP in Definition 2 with 5 unknown reward. In contrast to previous MFG research, most of which impose reward functions that are quadratic in actions and logarithmic in the state distribution (Guéant, 2009; Lachapelle et al., 2010; Bauso et al., 2016), we learn a reward function using demonstration trajectories measured from actual population behavior, to attain a succinct and data-driven representation of the motivation behind population dynamics. We leverage the MFG forward dynamics (Eq 3) in a sample-based IRL method based on the maximum entropy IRL framework (Ziebart et al., 2008). From this probabilistic viewpoint, we minimize the relative entropy between a probability distribution p(τ ) over a space of trajectories T := {τi }i and a distribution q(τ ) from which demonstrated expert trajectories are generated (Boularias et al., 2011). This is related to a path integral IRL formulation, where the likelihood of measured optimal trajectories is evaluated only using trajectories generated from their local neighborhood, rather than uniformly over the whole trajectory space (Kalakrishnan et al., 2013). Specifically, making no assumption on the true distribution of optimal demonstration other than matching of reward expectation, we posit that demonstration trajectories τi = (π 0 , P 1 , . . . , π N −1 , P N −1 )i are sampled from the maximum entropy distribution (Jaynes, 1957): 1 (12) p(τ ) = exp(RW (τ )) Z P where RW (τ ) = n RW (π n , P n ) is the sum of reward of single state-action pairs over a trajectory τ , and W are the parameters of the reward function approximator (derivation in Appendix E). Intuitively, this means that trajectories with higher reward are exponentially more likely to be sampled. Given M sampleR trajectories τj ∈ Dsamp from k distributions F1 (τ ), . . . , Fk (τ ), an unbiased estimator of the partition function Z = exp(RW (τ ))dτ using multiple P 1 importance sampling is Ẑ := M τj zj exp(RW (τj )) (Owen and Zhou, 2000), where importance weights are zj := 1 P −1 (derivation in Appendix F). Each action matrix P is sampled from a stochastic policy Fk (P ; π, θ) k Fk (τj ) k (overloading notation with F (τ )), where π is the current state and θ the policy parameter. The negative log likelihood of L demonstration trajectories τi ∈ Ddemo is:   X X 1 1 L(W ) = − RW (τi ) + log  zj exp(RW (τj )) (13) L M τi ∈Ddemo τj ∈Dsamp We build on Guided Cost Learning (GCL) in Finn et al. (2016) (Alg 1) to learn a deep neural network approximation of RW (π, P ) via stochastic gradient descent on L(W ), and learn a policy F (P ; π, θ) using a simple actor-critic algorithm (Sutton and Barto, 1998). In contrast to GCL, we employ a combination of convolutional neural nets and fully-connected layers to process both the action matrix P and state vector π efficiently in a single architecture (Appendix C), analogous to how Lillicrap et al. (2015) handle image states in Atari games. Due to our choice of policy parameterization (described below), we also set importance weights to unity for numerical stability. These implementation choices result in successful learning of a reward representation (Fig 1). Our forward MDP solver (Alg 2) performs gradient ascent on the expected value Eθ [π 0 ] w.r.t. policy parameter θ, to find successively improved stochastic policies Fk (P ; π, θ). We construct the joint distribution F (P ; π, θ) informed by domain knowledge about human population behavior on social media, but this does not reduce the generality of the MFG framework since it is straightforward to employ flexible policy and value networks in a DDPG algorithm when intuition is not available (Silver et al., 2014; Lillicrap et al., 2015). Our joint distribution is d instances of a d-dimensional Dirichlet distribution, each parameterized by an αi ∈ Rd+ . Each row Pi can be sampled from f (Pi1 , . . . , Pid ; α1i , . . . , αdi ) = d i 1 Y (Pij )αj −1 i B(α ) j=1 (14) where B(·) is the Beta function and αji is defined using the softplus function αji (π, θ) := ln(1 + exp{θ(πj − πi )}), which is a monotonically increasing function of the population density difference πj −πi . In practice, a constant scaling Qd factor c ∈ R can be applied to α for variance reduction. Finally, we let F (P n ; π n , θ) = i=1 f (Pin ; αi (π n , θ)) denote the parameterized policy, from which P n is sampled based on π n , and whose logarithmic gradient ∇θ ln(F ) can be used in a policy gradient algorithm. We employ variance reduction by learning the value function using a linear function approximation V̂ (π; w), containing all components of π up to second-order, with parameter w (Konda and Tsitsiklis, 2000). 6 Reward density for training demo and generated transitions Demo (test) Generated 3.5 0.3 2 States 2.5 3 2.0 0.2 1 0.1 1.5 0.0 1.0 1 0.1 2 0.5 0 0.1 0.0 0.1 Reward 0.2 0.3 (a) Reward densities on train set 0.4 0.5 0.4 0 3.0 Density Density 4 Reward of state-action pairs Reward density for test demo and generated transitions Demo (train) Generated 0.2 0.1 0.0 0.1 Reward 0.2 0.3 (b) Reward densities on test set 0.4 0 1 Actions 2 (c) Reward of state-action pairs Figure 1: (a) JSD between train demo and generated transitions is 0.130. (b) JSD between test demo and generated transitions is 0.017. (c) Reward of state-action pairs. States: large negative mass gradient from π1 to πd (S0), less negative gradient (S1), uniform (S2). Actions: high probability transitions to smaller indices (A0), uniform transition (A1), row-reverse of A0 (A2). 5 Experiments We demonstrate the effectiveness of our method with two sets of experiments: (i) recovery of an interpretable reward function and (ii) prediction of population trajectory over time. Our experiment matches the discrete time mean field game given in Section 3.2: we use data representing the activity of a Twitter population consisting of 406 users. We model the evolution of the population distribution over d = 15 topics and N = 16 time steps (9am to midnight) each day for 27 days. The sequence of state-action pairs {(π n , P n )}n=0,...,N −1 measured on each day shall be called a demonstration trajectory. Although the set of topics differ semantically each day, indexing topics in order of decreasing initial popularity suffices for identifying the topic sets across all days. As explained earlier, the MFG framework can model populations of arbitrarily large size, and we find that our chosen population is sufficient for extracting insights on population behavior. For evaluating performance on trajectory prediction, we compare MFG with two baselines: VAR. Vector autoregression of order 18 trained on 21 demonstration trajectories. RNN. Recurrent neural network with a single fully-connected layer and rectifier nonlinearity. We use Jenson-Shanon Divergence (JSD) as metric to report all our results. Appendix D provides comprehensive implementation details. 5.1 Interpretation of reward function Our method learned a representation of the implicit reward optimized by population behavior, which we evaluated using four sets of state-action pairs acquired from: 1. all train demo trajectories; 2. trajectories generated by the learned policy given initial states π 0 of train trajectories; 3. all test demo trajectories; 4. trajectories generated by the learned policy given initial states π 0 of test trajectories. We find three distinct modes in the density of reward values for both the train group of sets 1 and 2 (Fig 1a) and the test group of sets 3 and 4 (Fig 1b). Although we do not have access to a ground truth reward function, the low JSD values of 0.13 and 0.017 between reward distributions for demo and generated state-action pairs show generalizability of the learned reward function. We further investigated the reward landscape with nine state-action pairs (Figure 1c), and find that the mode with highest rewards is attained by pairing states that have large mass in topics having high initial popularity (S0) with action matrices that favor transition to topics with higher density (A0). On the other hand, uniformly distributed state vectors (S2) attain the lowest rewards, while states with a small negative mass gradient from topic 1 to topic d (S1) attain medium rewards. 5.2 Trajectory prediction The primary hypothesis to test is that real user populations act near-optimally on social media, just as the MFG approach assumes rational agents. Fig 2a (log scale) shows that MFG has 58% smaller error than VAR when evaluated N −1 N −1 on the JSD between generated and measured final distributions JSD(πgenerated , πmeasured ), and 40% smaller error when 7 Demonstration actions JSD (log scale) Average test error over 6 days MFG VAR RNN 10 1 10 2 Final distribution 0 Difference 0 1.0 0.8 5 5 10 10 Entire trajectory (averaged) 0 5 10 0.6 0.4 0.2 0 (a) Prediction error 5 0.0 10 (b) Action matrices Figure 2: (a) Test error on final distribution and mean over entire trajectory (log scale). MFG: (2.9e-3, 4.9e-3), VAR: (7.0e-3, 8.1e-3), RNN: (0.58, 0.57). (b) heatmap of action matrix P ∈ R15×15 averaged element-wise over demo train set, and absolute difference between average demo action matrix and average matrix generated from learned policy. Topic 2 measurement and predictions 1.00 0.05 0.99 0.04 Topic 2 popularity Topic 0 popularity Topic 0 measurement and predictions 0.98 0.97 0.96 0.95 0 1 2 3 Day 4 test data MFG (test) VAR (test) 5 6 test data MFG (test) VAR (test) RNN (test) 0.03 0.02 0.01 0.00 0 (a) Topic 0 test trajectory 1 2 3 Day 4 5 6 (b) Topic 2 test trajectory Figure 3: (a) Measured and predicted trajectory of topic 0 popularity over test days for MFG and VAR (RNN outside range and not shown). (b) Measured and predicted trajectory of topic 2 popularity over test days for all methods. PN −1 n n evaluated on the average JSD over all hours in a day N1 n=0 JSD(πgenerated , πmeasured ). Both measures were averaged over M = 6 held-out test trajectories. It is worth emphasizing that learning the MFG model required only the initial population distribution of each day in the training set, while VAR and RNN used the distributions over all hours of each day. Even with much fewer training samples, MFG achieves excellent prediction performance because it represents the underlying optimization processes conducted by large populations, unlike the simple models of VAR and RNN. As shown by sample trajectories for topic 0 and 2 in Figures 3, and the average transition matrices in Figure 2b, MFG correctly represents the fact that the real population tends to congregate to topics with higher initial popularity (i.e. lower topic indices), and that the popularity of topic 0 becomes more dominant across time in each day. The small real-world dataset size, and the fact that RNN mainly learns state transitions without accounting for actions, could be contributing factors to lower performance of RNN compared to MFG. We acknowledge that our design of policy parameterization, although informed by domain knowledge, introduced bias and resulted in noticeable differences between demonstration and generated transition matrices. This can be addressed using deep policy and value networks, since the MFG framework is agnostic towards choice of policy representation. 5.3 Insights The learned reward function reveals that a social media population favors states characterized by a highly non-uniform distribution with negative mass gradient in decreasing order of topic popularity, as well as transitions that increase this imbalance. The high prediction accuracy of the learned policy provides evidence that population behavior can be understood and modeled as the result of population-level optimization with respect to a reward function. 8 6 Conclusion We have motivated and demonstrated a data-driven method to solve a mean field game model of population evolution, by proving a connection to Markov decision processes and building on methods in reinforcement learning. Our method is scalable to arbitrarily large populations, because the MFG framework represents population density rather than individual agents, while the representations are linear in the number of MFG states and quadratic in the transition matrix. Our real-world experiments show that MFG is a powerful framework for learning both the underlying reward function being optimized by a real world population and a policy that is able to predict future population trajectories more accurately than alternatives. Even with a simple policy parameterization designed via some domain knowledge, our method attains superior performance on test data. It motivates exploration of flexible neural networks for more complex applications. An interesting extension is to develop an efficient method for solving the discrete time MFG in a more general setting, where the reward at each state i is coupled to the full population transition matrix. Our work also opens the path to a variety of real-world applications, such as a synthesis of MFG with models of social networks at the level of individual connections to construct a more complete model of social dynamics, and mean field models of interdependent systems that may display complex interactions via coupling through global states and reward functions. References Achdou, Y., Camilli, F., and Capuzzo-Dolcetta, I. (2012). Mean field games: numerical methods for the planning problem. SIAM Journal on Control and Optimization, 50(1), 77–109. Anderson, M. and Hitlin, P. (2016). Social Media Conversations About Race. Pew Research Center. Bauso, D., Pesenti, R., and Tolotti, M. (2016). Opinion dynamics and stubbornness via multi-population mean-field games. Journal of Optimization Theory and Applications, 170(1), 266–293. Boularias, A., Kober, J., and Peters, J. (2011). Relative entropy inverse reinforcement learning. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pages 182–189. Carlini, E. and Silva, F. J. (2014). A fully discrete semi-lagrangian scheme for a first order mean field game problem. SIAM Journal on Numerical Analysis, 52(1), 45–67. De, A., Valera, I., Ganguly, N., Bhattacharya, S., and Rodriguez, M. G. (2016). Learning and forecasting opinion dynamics in social networks. In Advances in Neural Information Processing Systems, pages 397–405. Farajtabar, M., Wang, Y., Rodriguez, M. G., Li, S., Zha, H., and Song, L. (2015). Coevolve: A joint point process model for information diffusion and network co-evolution. In Advances in Neural Information Processing Systems, pages 1954–1962. Finn, C., Levine, S., and Abbeel, P. (2016). Guided cost learning: Deep inverse optimal control via policy optimization. In International Conference on Machine Learning, pages 49–58. Gomes, D. A., Mohr, J., and Souza, R. R. (2010). Discrete time, finite state space mean field games. Journal de mathématiques pures et appliquées, 93(3), 308–328. Guéant, O. (2009). A reference case for mean field games models. Journal de mathématiques pures et appliquées, 92(3), 276–294. Guéant, O. (2015). Existence and uniqueness result for mean field games with congestion effect on graphs. Applied Mathematics & Optimization, 72(2), 291–303. Guéant, O., Lasry, J.-M., and Lions, P.-L. (2011). Mean field games and applications. In Paris-Princeton lectures on mathematical finance 2010, pages 205–266. Springer. Howard, P. N., Duffy, A., Freelon, D., Hussain, M. M., Mari, W., and Maziad, M. (2011). Opening closed regimes: what was the role of social media during the arab spring? 9 Hu, J., Wellman, M. P., et al. (1998). Multiagent reinforcement learning: theoretical framework and an algorithm. In ICML, volume 98, pages 242–250. Citeseer. Huang, M., Malhamé, R. P., Caines, P. E., et al. (2006). Large population stochastic dynamic games: closed-loop mckean-vlasov systems and the nash certainty equivalence principle. Communications in Information & Systems, 6(3), 221–252. Jaynes, E. T. (1957). Information theory and statistical mechanics. Physical review, 106(4), 620. Kalakrishnan, M., Pastor, P., Righetti, L., and Schaal, S. (2013). Learning objective functions for manipulation. In Robotics and Automation (ICRA), 2013 IEEE International Conference on, pages 1331–1336. IEEE. Konda, V. R. and Tsitsiklis, J. N. (2000). Actor-critic algorithms. In Advances in neural information processing systems, pages 1008–1014. Lachapelle, A., Salomon, J., and Turinici, G. (2010). Computation of mean field equilibria in economics. Mathematical Models and Methods in Applied Sciences, 20(04), 567–588. Lasry, J.-M. and Lions, P.-L. (2007). Mean field games. Japanese journal of mathematics, 2(1), 229–260. Lillicrap, T. P., Hunt, J. J., Pritzel, A., Heess, N., Erez, T., Tassa, Y., Silver, D., and Wierstra, D. (2015). Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971. Littman, M. L. (2001). Value-function reinforcement learning in markov games. Cognitive Systems Research, 2(1), 55–66. Lowe, R., Wu, Y., Tamar, A., Harb, J., Abbeel, P., and Mordatch, I. (2017). Multi-agent actor-critic for mixed cooperative-competitive environments. arXiv preprint arXiv:1706.02275. Mnih, V., Kavukcuoglu, K., Silver, D., Graves, A., Antonoglou, I., Wierstra, D., and Riedmiller, M. (2013). Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602. Ng, A. Y. and Russell, S. (2000). Algorithms for inverse reinforcement learning. In in Proc. 17th International Conf. on Machine Learning, pages 663–670. Morgan Kaufmann. Owen, A. and Zhou, Y. (2000). Safe and effective importance sampling. Journal of the American Statistical Association, 95(449), 135–143. Perrin, A. (2015). Social Media Usage: 2005-2015. Pew Research Center. Silver, D., Lever, G., Heess, N., Degris, T., Wierstra, D., and Riedmiller, M. (2014). Deterministic policy gradient algorithms. In Proceedings of the 31st International Conference on Machine Learning (ICML-14), pages 387–395. Silverman, C. (2016). This analysis shows how viral fake election news stories outperformed real news on facebook. Sutton, R. S. and Barto, A. G. (1998). Introduction to Reinforcement Learning. MIT Press, Cambridge, MA, USA, 1st edition. Twitter (2017). Faqs about trends on twitter. Wulfmeier, M., Ondruska, P., and Posner, I. (2015). Maximum entropy deep inverse reinforcement learning. arXiv preprint arXiv:1507.04888. Ziebart, B. D., Maas, A. L., Bagnell, J. A., and Dey, A. K. (2008). Maximum entropy inverse reinforcement learning. In AAAI, volume 8, pages 1433–1438. Chicago, IL, USA. 10 A Proof of Propostion 1 Given the definitions in Section 3.1, a mean field game is defined by a Hamilton-Jacobi-Bellman (HJB) equation evolving backwards in time and a Fokker-Planck equation evolving forward in time. The continuous-time HamiltonJacobi-Bellman (HJB) equation on G is X  0 Vi (t) = − maxPi Pij (t)(Vj (t) − Vi (t)) + ri (π(t), Pi (t)) (15) − j∈V̄i where ri (π, Pi ) is the reward function, and Vi (t) is the value function of state i at time t. Note that the reward function ri (π(t), Pi (t)) is often presented as −ci (π(t), Pi (t)) for some cost function ci (π(t), Pi (t)) in the MFG context, and similarly for Vi (t). In addition, we set ri (π(t), Pi (t)) = −∞ if Pi (t) ∈ / Si (G) (i.e. P (t) must be a valid transition matrix). For any fixed π(t), let Hi (π(t), ·) be the Legendre transform of ci (π(t), ·) defined by Hi (π(t), ·) = maxPi {h·, Pi i − ci (π(t), Pi )} = maxPi {h·, Pi i + ri (π(t), Pi )} (16) Then the HJB equation (15) is an analogue to the backward equation in mean field games Vi0 (t) + Hi (π(t), [Vj (t) − Vi (t)]j∈V̄ − ) = 0 (17) i − where [Vj (t) − Vi (t)]j∈V̄ − ∈ R|V̄i | is the dual variable of Pi . We can discretize (15) using a semi-implicit scheme i with unit time step labeled by n to obtain X  n+1 n+1 n n n Vin+1 − Vin = − maxPi P (V − V ) + r (π , P ) (18) i ij i − j i j∈V̄i Rearranging (18) yields the discrete time HJB equation over a graph (19)   X n n n n n+1 Vi = maxPi ri (π , Pi ) + Pij Vj − (19) The forward evolving Fokker-Planck equation for the continuous-time graph-state MFG is given by X X πi0 (t) = Qji (t)πj (t) − Qij (t)πi (t) + − (20) j∈V̄i j∈Vi j∈Vi where Qji (t) = ∂ui Hj (π(t), [Vk (t) − Vj (t)]k∈V̄ − ) j (21) where ∂ui Hj (π, u) is the partial derivative w.r.t. the coordinate corresponding to the i-th index of the argument − u ∈ R|V̄j | . We can set Qji (t) = 0 for all (j, i) ∈ / E, so that Q(t) := [Qji (t)] can be regarded as the d-by-d infinitesimal generator matrix of states π(t), and hence (20) can be written as π 0 (t) = π(t)Q(t), where π(t) ∈ Rd is a row vector. Then an Euler discretization of (20) with unit time step reduces to π n+1 − π n = π n Qn , which can be written as X n n πin+1 = Pji πj (22) + j∈V̄i where Pijn := Qnij + δij . If the graph G is complete, meaning E = {(i, j) : 1 ≤ i, j ≤ d}, then the summation is taken over j = 1, . . . , d. For ease of presentation, we only consider the complete graph in this paper, as all derivations can be carried out similarly for general directed graphs. A solution of a mean field game defined by (19) and (22) is a collection of Vin and πin for i = 0, . . . , d − 1 and n = 0, . . . , N − 1. 11 B Algorithms We learn a reward function and policy using an adaptation of GCL (Finn et al., 2016) in Alg 1 and a simple actor-critic Alg 2 (Sutton and Barto, 1998) as a forward RL solver. Algorithm 1 Guided cost learning 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: procedure G UIDED COST LEARNING Initialize F0 (P ; π, θ) as random policy and reward network weights W 0 for iteration 1 to I do Generate sample trajectories Dtraj from Fk (P ; π, θ) Dsamp ← Dsamp ∪ Dtraj while Avgπi ,Pi ∼Ddemo (RW t (πi , Pi ) − RW t−1 (πi , Pi )) > dR do Sample demonstration D̂demo ⊂ Ddemo from expert demonstration Sample D̂samp ⊂ Dsamp W t+1 ← W t − ∇L(W t ) using D̂demo and D̂samp end while Run Alg 2 on Dtraj for improved Fk+1 end for return Final reward function RW (π, P ) and policy F (P ; π, θ) end procedure Algorithm 2 Actor-critic algorithm for MFG Input: Generative model F (P ; π, θ), value function V̂ (π; w), training data {π 0 }M days Output: Policy parameter θ, value function parameter w 1: procedure ACTOR - CRITIC -MFG(F, V̂ , {π 0 }M days , β, ξ, RW ) 2: initialize θ and w 3: for episodes s = 1, . . . , S do 4: Sample initial distribution π 0 from {π 0 }M days 5: for time step n = 0, . . . , N − 1 do 6: Sample action P n ∼ F (P ; π n , θ) 7: Generate π n+1 using Eq 3 8: Receive reward RW (π n , P n ) 9: δ ← R + V̂ (π n+1 ; w) − V̂ (π n ; w) 10: w ← w + ξδ∇w V̂ (π n ; w) 11: θ ← θ + βδ∇θ log(F (P ; π n , θ)) 12: end for 13: end for 14: end procedure C Reward network Our reward network uses two convolutional layers to process the 15 × 15 action matrix P , which is then flattened and concatenated with the state vector π and processed by two fully-connected layers regularized with L1 and L2 penalties and dropout (probability 0.6). The first convolutional layer zero-pads the input into a 19×19 matrix and convolves one filter of kernel size 5 × 5 with stride 1 and applies a rectifier nonlinearity. The second convolutional layer zero-pads its input into a 17 × 17 matrix and convolves 2 filters of kernel size 3 × 3 with stride 1 and applies a rectifier nonlinearity. The fully connected layers have 8 and 4 hidden rectifier units respectively, and the output is a single fully connected tanh unit. All layers were initialized using the Xavier normal initializer in Tensorflow. 12 D Experiment details By default, Twitter users in a certain geographical region primarily see the trending topics specific to that region (Twitter, 2017). This experiment focused on the population and trending topics in the city of Atlanta in the U.S. state of Georgia. First, a set of 406 active users were collected to form the fixed population. This was done by collecting a set of high-visibility accounts in Atlanta (e.g. the Atlanta Falcons team), gathering all Twitter users who follow these accounts, filtering for those whose location was set to Atlanta, and filtering for those who responded to least two trending topics within four days. Data collection proceeded as follows for 27 days: at 9am of each day, a list of the top 14 trending topics on Twitter in Atlanta was recorded; for each hour until midnight, for each topic, the number of users who responded to the topic within the past hour was recorded. Whether or not a user responded to a topic was determined by checking for posts by the user containing unique words for that topic; the “hashtag” convention of trending topics on Twitter reduces the likelihood of false positives. The hourly count of people who did not respond to any topic was recorded as the count for a “null topic”. Although some users may respond to more than one topic within each hour, the data shows that this is negligible, and a shorter time interval can be used to reduce this effect. The result of data collection is a set of trajectories, one trajectory per day, where each trajectory consists of hourly measurements of the population distribution over d = 15 topics over N = 16 hours. The training set consists of trajectories {π 0,m , . . . , π N −1,m }m=1,...,M over the first M = 21 days. MFG uses the initial distribution π 0 of each day for training (Alg 2 line 4), while VAR and RNN use all measured distributions. RNN method employs a simple recurrent unit with ReLU as nonlinear activation and weight matrix of dimension d × d. Table 1 shows parameters of Alg 2 and 1. Table 1: Parameters E Parameter Use Value S β ξ c  dR θfinal max actor-critic episodes critic learning rate actor learning rate αji scaling factor Adam optimizer learning rate for reward convergence threshold for reward iteration learned policy parameter 4000 O(1/s) O(1/s ln ln s) 1e4 1e-4 1e-4 8.64 Maximum entropy distribution Given a finite set of trajectories {τi }i , where each trajectory is a sequence of state-action pairs τi = (si1 , ai1 , . . . , ). Suppose each trajectory τi has an unknown probability pi . The entropy of the probability distribution is H = P − i pi ln(pi ). In the continuous case, we write the differential entropy: Z H = − p(τ ) ln(p(τ ))dτ where p(·) is the probability density we want to derive. The constraints are: Z r(τ )p(τ )dτ = E[r(τ )] = µr Z p(τ )dτ = 1 13 The first constraint says: the expected reward over all trajectories is equal to an empirical measurement µr . We write the Lagrangian L: Z   Z Z r(τ )p(τ )dτ − µr L = − p(τ ) ln(p(τ ))dτ − λ1 p(τ )dτ − 1 − λ2 For L to be stationary, the Euler-Lagrange equation with integrand denoted by L says ∂L =0 ∂p since L does not depend on dp dτ . Hence Z  −λ2 r(τ ) λ1 = ln e dτ − 1  Z   −λ2 r(τ ) e p(τ ) = exp − ln dτ − λ2 r(τ ) = where Z := F R 1 e−λ2 r(τ ) Z(λ2 ) e−λ2 r(τ ) dτ . Then the constant λ2 is determined by: Z Z 1 e−λ2 r(τ ) r(τ )dτ µr = p(τ )r(τ )dτ = Z(λ2 ) ∂ =− ln(Z(λ2 )) ∂λ2 Multiple importance sampling We show how multiple importance sampling (Owen and Zhou, 2000) can beR used to estimate the partition function in the maximum entropy IRL framework. The problem is to estimate Z := f (x)dx. Let p1 , . . . , pm be m proposal distributions, with nj samples from the j-th proposal distribution, so that samples can be denoted Xij for i = 1, . . . , nj and j = 1, . . . , m. Let wj (x) for j = 1, . . . , m satisfy 0 ≤ wj (x) ≤ m X wj (x) = 1 j=1 Then define the estimator Ẑ = nj m X f (Xij ) 1 X wj (Xij ) n pj (Xij ) j=1 j i=1 Let S(pj ) = {x | pj (x) > 0} be the support of pj and S(wj ) = {x | wj (x) > 0} be the support of wj , and let them satisfy S(wj ) ⊂ S(pj ). Under these assumptions: Z E[Ẑ] = f (x)dx = Z In particular, choose nj pj (x) wj (x) := Pm k=1 nk pk (x) Then the estimate becomes Ẑ = nj m X X f (Xji ) Pm k=1 nk pk (x) j=1 i=1 m nj = 1 XX f (X ) Pm nkji n j=1 i=1 k=1 n pk (x) 14 Pm where n = j=1 nj is the total count of samples. Further assuming that samples are drawn uniformly from all proposal distributions, so that nj = nk = n/m for all j, k ∈ {1, . . . , m}, the expression for Ẑ reduces to the form used in Eq 13: f (x) 1 X Pm Ẑ = 1 n k=1 pk (x) m all samples G A comparison of mean field games and multi-agent MDPs In this section, we discuss the reason that the general MFG is not reducible to a collection of distinct single-agent MDPs, and also not equivalent to a multi-agent MDP. Assume the case of a general reward function rij (π n , P n ) that depends on the full Nash maximizer matrix P n . G.1 Collection of single-agent MDPs Consider each topic i as a separate entity associated with a value, rather than subsuming it into an average (as is the case in Section 4). In order to assign a value to each topic, each tuple (i, π n ) must be defined as a state, which leads to the problem: since a state requires specification of π n , and state transitions depend on the actions for all other topics, the action at each topic is not sufficient for fully specifying the next state. More formally, consider a value function on the state: X  X n n n n T n V (i, π ) = max qj rij (π , P(P , i, q)) + qj V (j, (P ) π ) (23) q∈Si (G) j j Superficially, this resembles the Bellman optimality equation for the value function in a single-agent stochastic MDP, where s is a state, a is an action, R is an immediate reward, and P (s0 |s, a) is the probability of transition to state s0 from state s, given action a: X V ∗ (s) = max{R(s, a) + P (s0 |s, a)V ∗ (s0 )} (24) a s0 In the second summation, qj can be interpreted as a transition probability, conditioned on the fact that the current topic is i. The action q selected in the state (i, π n ) induces a stochastic transition to a next topic j, but the next distribution π n+1 is given by the deterministic forward equation π n+1 = (P n )T π n , where P n is the true Nash maximizer matrix. This means that qj does not completely specify the next state (j, π n+1 ), and there is a formal difference between P (s0 |s, a)V∗ (s0 ) and qj V (j, (P n )T π n ). Also notice that the Bellman equation sums over all possible next states s0 , but that is not the case for equation 23, because a full state specification requires (j, π). G.2 Multi-agent MDP The following explanation shows that an exact reduction from the MFG to a multi-agent MDP (i.e. Markov game) is not possible. A discrete state space discrete action space multi-agent MDP is defined by d agents moving within a set S of environment states; a collection {A1 , . . . , Ad } of sets of actions, one for each agent; a transition function P (s0 |s, a1 , . . . , ad ) giving the probability of the environment transitioning to state s0 given that the current state is s and agents choose actions ā , (a1 , . . . , ad ); a collection of reward functions {Ri (s, a1 , . . . , ad )}i , one for each agent; and a discount factor γ in the infinite horizon case. One natural attempt to reduce the MFG to a Markov game is to let the set of π n (with appropriate discretization) be the state space, limit the set of actions to some discretization of the simplex, and consider each topic to be a single agent. Now, the agent representing topic i is no longer identified with the set of people who selected topic i: topics have fixed 15 labels for all time, so an agent who accumulates reward for topic i must be associated only with topic i. Therefore, the value function for agent i is defined only in terms of itself, never depending on the value function of agents j 6= i: ! XY X µ µ µj (āj |s) Ri (s, ā) + γ Vi (s) = P (s0 |s, ā)Vi (s0 ) (25) ā s0 j where µ := (µ1 , . . . , µd ) is a set of stationary policies of all agents. However, recall that the MFG equation for Vin explicitly depends on Vjn+1 of all topics j, which would require a different form such as the following: Viµ (π n ) = d X Y P ∈S(G) j=1 ! n µj (Pj |π ) X n Pik rik (π , P ) + k X Pik Vkµ (P T π n ) (26) k where the last summation involves the value function Vkµ for all k. This difference is exactly the reason that the MFG equations cannot be reduced to the equations of a standard Markov game. 16
5cs.CE
Generators of the pro-p Iwahori and Galois representations arXiv:1611.06084v1 [math.NT] 18 Nov 2016 Christophe Cornut1 and Jishnu Ray2 1 CNRS - Institut de Mathématiques de Jussieu - Paris Rive Gauche, 4, place Jussieu, 75252 Paris Cedex 05, France, [email protected] 2 Département de Mathématiques, Université Paris-Sud 11, 91405 Orsay Cedex, France, [email protected] Abstract For an odd prime p, we determine a minimal set of topological generators of the pro-p Iwahori subgroup of a split reductive group G over Zp . In the simple adjoint case and for any sufficiently large regular prime p, we also construct Galois extensions of Q with Galois group between the pro-p and the standard Iwahori subgroups of G. 1 Introduction Let p be an odd prime, let G be a split reductive group over Zp , fix a Borel subgroup B = U ⋊ T of G with unipotent radical U ⊳ B and maximal split torus T ⊂ B. The Iwahori subgroup I and pro-p-Iwahori subgroup I(1) ⊂ I of G(Zp ) are defined [13, 3.7] by I = {g ∈ G(Zp ) : red(g) ∈ B(Fp )}, I(1) = {g ∈ G(Zp ) : red(g) ∈ U(Fp )}. where ‘red’ is the reduction map red: G(Zp ) → G(Fp ). The subgroups I and I(1) are both open subgroups of G(Zp ). Thus I = I(1) ⋊ Ttors and T(Zp ) = T (1) × Ttors where T (1) and Ttors are respectively the pro−p and torsion subgroups of T(Zp ). Following [3] (who works with G = GLn ), we construct in section 2 a minimal set of topological generators for I(1). More precisely, let M = X ∗ (T) be the group of characters of T, R ` ⊂ M the set of roots of T in g = Lie(G), ∆ ⊂ R the set of simple roots with respect to B, R = c∈C Rc the decomposition of R into irreducible components, ∆c = ∆ ∩ Rc the simple roots in Rc , αc,max the highest positive root in Rc . We let D ⊂ C be the set of irreducible components of type G2 and for d ∈ D, we denote by δd ∈ Rd,+ the sum of the two simple roots in ∆d . We denote by M ∨ = X∗ (T) the group of cocharacters of T, by ZR∨ the subgroup spanned by the coroots R∨ ⊂ M ∨ and we fix a set of representatives S ⊂ M ∨ for an Fp -basis of (M ∨ /ZR∨ ) ⊗ Fp = ⊕s∈S Fp · s ⊗ 1. 1 2 We show (see theorem 2.4.1): Theorem. The following elements form a minimal set of topological generators of the pro-pIwahori subgroup I(1) of G = G(Qp ): 1. The semi-simple elements {s(1 + p) : s ∈ S} of T (1), 2. For each c ∈ C, the unipotent elements {xα (1) : α ∈ ∆c }, 3. For each c ∈ C, the unipotent element x−αc,max (p), 4. (If p = 3) For each d ∈ D, the unipotent element xδd (1). This result generalizes Greenberg [3] proposition 5.3, see also Schneider and Ollivier ([9], proposition 3.64, part i) for G = SL2 . Let Tad be the image of T in the adjoint group Gad of G. The action of Gad on G induces an ac˜ of I(1) with a structure tion of Tad (Zp ) on I and I(1) and the latter equips the Frattini quotient I(1) ad ad ad of Fp [Ttors ]-module, where Ttors is the torsion subgroup of T (Zp ) (cf. section 2.12). Any element tors β in ZR = M ad = X ∗ (Tad ) induces a character β : Tad → F× p and we denote by Fp (β) the corad responding simple (1-dimensional) Fp [Ttors ]-module. With these notations, the theorem implies that ad ˜ is isomorphic to Corollary. The Fp [Ttors ]-module I(1)        F♯S ⊕ ⊕ F (α) ⊕ ⊕ F (−α ) ⊕ ⊕ F (δ ) if p = 3 . α∈∆ p c∈C p c,max d∈D p c p Here ♯S is the cardinality of S. Suppose from now on in this introduction that G is simple and of adjoint type. Then: ˜ is multiplicity free unless p = 3 and G is of type A1 , Bℓ Corollary The Fp [Ttors ]-module I(1) or Cℓ (ℓ ≥ 2), F4 or G2 . Let now K be a Galois extension of Q, Σp the set of primes of K lying above p. Let M be the compositum of all finite p-extensions of K which are unramified outside Σp , a Galois extension over Q. Set Γ = Gal(M/K), Ω = Gal(K/Q) and Π = Gal(M/Q). We say that K is p-rational if Γ is a free pro−p group, see [6]. The simplest example is K = Q, where Γ = Π is also abelian and M is the cyclotomic Zp -extension of Q. Other examples of p-rational fields are Q(µp ) where p is a regular prime. Assume K is a p-rational, totally complex, abelian extension of Q and (p − 1) · Ω = 0. Then Greenberg in [3] constructs a continuous homomorphism ρ0 : Gal(M/Q) → GLn (Zp ) such that ρ0 (Γ) is the pro-p Iwahori subgroup of SLn (Zp ), assuming that there exists n distinct characters of Ω, trivial or odd, whose product is the trivial character. In section 3, we are proving results which show the existence of p-adic Lie extensions of Q where the Galois group corresponds to a certain specific p-adic Lie algebra. More precisely, for p-rational fields, we construct continuous morphisms with open image ρ : Π → I such that ρ(Γ) = I(1). We 3 show in corollary 3.3.1 that Corollary Suppose that K is a p-rational totally complex, abelian extension of Q and (p−1)·Ω = 0. Assume also that if p = 3, our split simple adjoint group G is not of type A1 , Bℓ or Cℓ (ℓ ≥ 2), F4 or G2 . Then there is a morphism ρ : Π → I such that ρ(Γ) = I(1) if and only if there is morphism ρ : Ω → Ttors such that the characters α ◦ ρ : Ω → F× p for α ∈ {∆ ∪ −αmax } are all S distinct and belong to Ω̂odd . Here Ω̂Sodd is a subset of the characters of Ω with values in F× p (it is defined after proposition 3.2.1). Furthermore assuming K = Q(µp ) we show the existence of such a morphism ρ : Ω → Ttors provided that p is a sufficiently large regular prime (cf. section 3.2): Corollary There is a constant c depending only upon the type of G such that if p > c is a regular prime, then for K = Q(µp ), M, Π and Γ as above, there is a continuous morphism ρ : Π → I with ρ(Γ) = I(1). The constant c can be determined from lemmas 3.4.1, 3.4.2 and remark 3.4.3. In section 2, we find a minimal set of topological generators of I(1) and study the structure ad ˜ of I(1) as an Fp [Ttors ]-module. In section 3, assuming our group G to be simple and adjoint, we discuss the notion of p-rational fields and construct continuous morphisms ρ : Π → I with open image. We would like to thank Marie-France Vignéras for useful discussions and for giving us the reference [9]. We are also deeply grateful to Ralph Greenberg for numerous conversations on this topic. 2 Topological Generators of the pro-p Iwahori This section is organized as follows. In sections (2.1 − 2.3) we introduce the notations, then section 2.4 states our main result concerning the minimal set of topological generators of I(1) (see theorem 2.4.1) with a discussion of the Iwahori factorisation in section 2.5. Its proof for G simple and simply connected is given in sections (2.6 − 2.10), where section 2.10 deals with the case of a group of type G2 . The proof for an arbitrary split reductive group over Zp is discussed in sections (2.11 − 2.14). In particular, section 2.14 establishes the minimality of our set of topological generators. Finally, ad ˜ in section 2.15 we study the structure of the Frattini quotient I(1) of I(1) as an Fp [Ttors ]-module and determine the cases when it is multiplicity free. 2.1 1] Let p be an odd prime, G be a split reductive group over Zp . Fix a pinning of G [11, XXIII (T, M, R, ∆, (Xα )α∈∆ ) . Thus T is a split maximal torus in G, M = X ∗ (T) is its group of characters, g = g0 ⊕ ⊕α∈R gα is the weight decomposition for the adjoint action of T on g = Lie(G), ∆ ⊂ R is a basis of the root system R ⊂ M and for each α ∈ ∆, Xα is a Zp -basis of gα . 4 2.2 We denote by M ∨ = X∗ (T) the group of cocharacters of T, by α∨ the coroot associated to α ∈ R and by R∨ ∈ M ∨ the set of all such coroots. We expand (Xα )α∈∆ to a Chevalley system (Xα )α∈R of G [11, XXIII 6.2]. For α ∈ R, we denote by Uα ⊂ G the corresponding unipotent group, by xα : Ga,Zp → Uα the isomorphism given by xα (t) = exp(tXα ). The height h(α) ∈ Z of α ∈ R is the sum of the coefficients of α in the basis ∆ of R. Thus R+ = h−1 (Z>0 ) is the set of positive roots in R, corresponding to a Borel subgroup B = U ⋊ T of G with unipotent radical U. We let C be the set of irreducible components of R, so that a a a R= Rc , ∆ = ∆c , R+ = Rc,+ c∈C c∈C c∈C with Rc irreducible, ∆c = ∆ ∩ Rc is a basis of Rc and Rc,+ = R+ ∩ Rc is the corresponding set of positive roots in Rc . We denote by αc,max ∈ Rc,+ the highest root of Rc . We let D ⊂ C be the set of irreducible components of type G2 and for d ∈ D, we denote by δd ∈ Rd,+ the sum of the two simple roots in ∆d . 2.3 Since G is smooth over Zp , the reduction map red : G(Zp ) → G(Fp ) is surjective and its kernel G(1) is a normal pro-p-subgroup of G(Zp ). The Iwahori subgroup I and pro-p-Iwahori subgroup I(1) ⊂ I of G(Zp ) are defined [13, 3.7] by I = {g ∈ G(Zp ) : red(g) ∈ B(Fp )} , I(1) = {g ∈ G(Zp ) : red(g) ∈ U(Fp )} . Thus I(1) is a normal pro-p-sylow subgroup of I which contains U(Zp ) and I/I(1) ≃ B(Fp )/U(Fp ) ≃ T(Fp ). Since T(Zp ) ։ T(Fp ) is split by the torsion subgroup Ttors ≃ T(Fp ) of T(Zp ), T(Zp ) = T (1) × Ttors and I = I(1) ⋊ Ttors where T (1) = T(Zp ) ∩ I(1) = ker (T(Zp ) → T(Fp )) is the pro-p-sylow subgroup of T(Zp ). Note that T (1) = Hom (M, 1 + pZp ) = M ∨ ⊗ (1 + pZp ), Ttors = Hom (M, µp−1) = M ∨ ⊗ F× p. 2.4 Let S ⊂ M ∨ be a set of representatives for an Fp -basis of (M ∨ /ZR∨ ) ⊗ Fp = ⊕s∈S Fp · s ⊗ 1. Theorem 2.4.1. The following elements form a minimal set of topological generators of the prop-Iwahori subgroup I(1) of G = G(Qp ): 1. The semi-simple elements {s(1 + p) : s ∈ S} of T (1). 2. For each c ∈ C, the unipotent elements {xα (1) : α ∈ ∆c }. 3. For each c ∈ C, the unipotent element x−αc,max (p). 4. (If p = 3) For each d ∈ D, the unipotent element xδd (1). 5 2.5 By [11, XXII 5.9.5] and its proof, there is a canonical filtration U = U1 ⊃ U2 ⊃ · · · ⊃ Uh ⊃ Uh+1 = 1 of U by normal subgroups such that for 1 ≤ i ≤ h, the product map (in any order) Y Uα → U h(α)=i factors through Ui and yields an isomorphism of group schemes Y ≃ Uα −→ Ui , Ui = Ui /Ui+1 . h(α)=i By [11, XXII 5.9.6] and its proof, Ui (R) = Ui (R)/Ui+1 (R) for every Zp -algebra R. It follows that the product map Y Uα × Ui+1 → Ui h(α)=i is an isomorphism of Zp -schemes and by induction, the product map Y Y Y Uα × Uα × · · · × Uα → U h(α)=1 h(α)=2 h(α)=h is an isomorphism of Zp -schemes. Similarly, the product map Y Y Y Uα × Uα × · · · × Uα → U− h(α)=−h h(α)=−h+1 h(α)=−1 is an isomorphism of Zp -schemes, where U− is the unipotent radical of the Borel subgroup B− = U− ⋊ T opposed to B with respect to T. Then by [11, XXII 4.1.2], there is an open subscheme Ω of G (the “big cell”) such that the product map U− × T × U → G is an open immersion with image Ω. Plainly, B = U ⋊ T is a closed subscheme of Ω. Thus by definition of I, I ⊂ Ω(Zp ) and therefore any element of I (resp. I(1)) can be written uniquely as a product Y Y Y Y xα (aα ) × · · · × xα (aα ) × t × xα (aα ) × · · · × xα (aα ) h(α)=−h h(α)=−1 h(α)=1 h(α)=h where aα ∈ Zp for α ∈ R+ , aα ∈ pZp for α ∈ R− = −R+ and t ∈ T(Zp ) (resp. T (1)). This is the Iwahori decomposition of I (resp. I(1)). If I + is the group spanned by {xα (Zp ) : α ∈ R+ } and I − is the group spanned by {xα (pZp ) : α ∈ R− }, then I + = U(Zp ), I − ⊂ U− (Zp ) and every x ∈ I (resp. I(1)) has a unique decomposition x = u− tu+ with u± ∈ I ± and t ∈ T(Zp ) (resp. t ∈ T (1)). 6 ∨ ∨ 2.6 Suppose first that G is semi-simple and simply connected. ` Then M = ZR , thus S = ∅. Moreover, everything splits according to the decomposition R = Rc : Y Y Y Y Y G= Gc , T = Tc , B = Bc , I = Ic and I(1) = Ic (1). To establish the theorem in this case, we may thus furthermore assume that G is simple. From now on until section 2.11, we therefore assume that G is (split) simple and simply connected. 2.7 As a first step, we show that Lemma 2.7.1. The group generated by I + and I − contains T (1). Proof. Since G is simply connected, Y α∨ : α∈∆ Y Gm,Zp → T α∈∆ is an isomorphism, thus Tc (1) = Y α∨ (1 + pZp ). α∈∆ Now for any α ∈ ∆, there is a unique morphism [11, XX 5.8] fα : SL(2)Zp → G such that for every u, v ∈ Zp and x ∈ Z× p, fα  1 u 0 1  = xα (u), fα  1 0 v 1  = x−α (v) and fα  x 0 0 x−1  = α∨(x). Since for every x ∈ 1 + pZp [11, XX 2.7],        x 0 1 −x−1 1 0 1 1 1 0 = 0 x−1 0 1 x−1 1 0 1 x−1 − 1 1 in SL(2)(Zp ), it follows that α∨ (1 + pZp ) is already contained in the subgroup of G(Zp ) generated by xα (Z× p ) and x−α (pZp ). This proves the lemma. 2.8 Recall from [11, XXI 2.3.5] that for any pair of non-proportional roots α 6= ±β in R, the set of integers k ∈ Z such that β + kα ∈ R is an interval of length at most 3, i.e. there are integers r ≥ 1 and s ≥ 0 with r + s ≤ 4 such that R ∩ {β + Zα} = {β − (r − 1)α, · · · , β + sα}. The above set is called the α-chain through β and any such set is called a root chain in R. Let k−k : R → R+ be the length function on R. 7 Proposition 2.8.1. Suppose kαk ≤ kβk. Then for any u, v ∈ Ga the commutator [xβ (v) : xα (u)] = xβ (v)xα (u)xβ (−v)xα (−u) is given by the following table, with (r, s) as above: (r, s) (−, 0) (1, 1) (1, 2) (1, 3) (2, 1) (2, 2) (3, 1) [xβ (v) : xα (u)] 1 xα+β (±uv) xα+β (±uv) · x2α+β (±u2 v) xα+β (±uv) · x2α+β (±u2 v) · x3α+β (±u3 v) · x3α+2β (±u3 v 2 ) xα+β (±2uv) xα+β (±2uv) · x2α+β (±3u2 v) · xα+2β (±3uv 2 ) xα+β (±3uv) The signs are unspecified, but only depend upon α and β. Proof. This is [11, XXIII 6.4]. Corollary 2.8.2. If r + s ≤ 3 and α + β ∈ R (i.e. s ≥ 1), then for any a, b ∈ Z, the subgroup of G generated by xα (pa Zp ) and xβ (pb Zp ) contains xα+β (pa+b Zp ). Proof. This is obvious if (r, s) = (1, 1) or (2, 1) (using p 6= 2 in the latter case). For the only remaining case where (r, s) = (1, 3), note that [xβ (v) : xα (u)][xβ (w 2 v) : xα (uw −1)]−1 = xα+β (±uv(1 − w)). × Since p 6= 2, we may find w ∈ Z× p with (1 − w) ∈ Zp . Our claim easily follows. Lemma 2.8.3. If R contains any root chain of length 3, then G is of type G2 . Proof. Suppose that the α-chain through β has length 3. By [11, XXI 3.5.4], there is a basis ∆′ of R such that α ∈ ∆′ and β = aα + bα′ with α′ ∈ ∆′ , a, b ∈ N. The root system R′ spanned by ∆′ = {α, α′ } [11, XXI 3.4.6] then also contains an α-chain of length 3. By inspection of the root systems of rank 2, for instance in [11, XXIII 3], we find that R′ is of type G2 . In particular, the Dynkin diagram of R contains a triple edge (linking the vertices corresponding to α and α′ ), which implies that actually R = R′ is of type G2 . 2.9 We now establish our theorem 2.4.1 for a group G which is simple and simply connected, but not of type G2 . Lemma 2.9.1. The group I + is generated by {xα (Zp ) : α ∈ ∆}. Proof. Let H ⊂ I + be the group spanned by {xα (Zp ) : α ∈ ∆}. We show by induction on h(γ) ≥ 1 that xγ (Zp ) ⊂ H for every γ ∈ R+ . If h(γ) = 1, γ already belongs to ∆ and there is nothing to prove. If h(γ) > 1, then by [1, VI.1.6 Proposition 19], there is a simple root α ∈ ∆ such that β = γ − α ∈ R+ . Then h(β) = h(γ) − 1, thus by induction xβ (Zp ) ⊂ H. Since also xα (Zp ) ⊂ H, xγ (Zp ) ⊂ H by Corollary 2.8.2. Lemma 2.9.2. The group generated by I + and x−αmax (pZp ) contains I − . 8 Proof. Let H ⊂ I be the group spanned by I + and x−αmax (pZp ). We show by descending induction on h(γ) ≥ 1 that x−γ (pZp ) ⊂ H for every γ ∈ R+ . If h(γ) = h(αmax ), then γ = αmax and there is nothing to prove. If h(γ) < h(αmax ), then by [1, VI.1.6 Proposition 19], there is a pair of positive roots α, β such that β = γ + α. Then h(β) = h(γ) + h(α) > h(γ), thus by induction x−β (pZp ) ⊂ H. Since also xα (Zp ) ⊂ H, x−γ (pZp ) ⊂ H by Corollary 2.8.2. Remark 2.9.3. From the Hasse diagrams in [10], it seems that in the previous proof, we may always require α to be a simple root. Proof. (Of theorem 2.4.1 for G simple, simply connected, not of type G2 ) By lemma 2.7.1, 2.9.1, 2.9.2 and the Iwahori decomposition of section 2.5, I(1) is generated by {xα (Zp ) : α ∈ ∆} ∪ {x−αmax (pZp )} thus topologically generated by {xα (1) : α ∈ ∆} ∪ {x−αmax (p)} . None of these topological generators can be removed: the first ones are contained in I + ( I(1), and all of them are needed to span the image of Y I(1) ։ U(Fp ) ։ U1 (Fp ) ≃ Uα (Fp ), α∈∆ a surjective morphism that kills x−αmax (p). 2.10 Let now G be simple of type G2 , thus ∆ = {α, β} with kαk < kβk and R+ = {α, β, β + α, β + 2α, β + 3α, 2β + 3α}. The whole root system looks like this: 3α + 2β α+β β 2α + β 3α + β α −α −3α − β −β −2α − β −α − β −3α − 2β Lemma 2.10.1. The group generated by I + and x−2β−3α (pZp ) contains I − . Proof. Let H ⊂ I(1) be the group generated by I + and x−2β−3α (pZp ). Then, for every u, v ∈ Zp , H contains [x−2β−3α (pv) : xβ (u)] = [x−2β−3α (pv) : xβ+3α (u)] = [x−2β−3α (pv) : xβ+2α (u)] = x−β−3α (±puv) x−β (±puv) x−β−α (±puv) · xα (±pu2 v) · xβ+3α (±pu3 v) · x−β (±p2 u3 v 2 ) 9 It thus contains x−β−3α (pZp ), x−β (pZp ) and x−β−α (pZp ), along with [x−β−3α (pv) : xα (u)] = [x−β−3α (pv) : xβ+2α (u)] = x−β−2α (±puv) · x−β−α (±pu2 v) · x−β (±pu3 v) · x−2β−3α (±p2 u3 v 2 ) x−α (±puv) · xβ+α (±pu2 v) · x2β+3α (±pu3 v) · xβ (±p2 u3 v 2 ) It therefore also contains x−β−2α (pZp ) and x−α (pZp ). The filtration (Ui )i≥1 of U in section 2.5 induces a filtration I + = I1+ ⊃ · · · ⊃ I5+ ⊃ I6+ = 1 of I + = U(Zp ) by normal subgroups Ii+ = Ui (Zp ) whose graded pieces + + I i = Ui (Zp ) = Ii+ /Ii+1 are free Zp -modules, namely + + I 1 = Zp · xα ⊕ Zp · xβ , I 2 = Zp · xα+β + + + I 3 = Zp · x2α+β , I 4 = Zp · x3α+β , I 5 = Zp · x3α+2β where xγ is the image of xγ (1). The commutator defines Zp -linear pairings + + + [−, −]i,j : I i × I j → I i+j with [y, x]j,i = −[x, y]i,j , [x, x]i,i = 0 and, by Proposition 2.8.1, [xβ , xα ] = ±xα+β , [xα+β , xα ] = ±2x2α+β , [x2α+β , xα ] = ±3x3α+β , [xα+β , x2α+β ] = ±x3α+2β and [xβ , x3α+β ] = ±x2α+2β Let H be the subgroup of I + generated by xα (Zp ) and xβ (Zp ) and denote by Hi its image in + I + /Ii+1 = Gi . Then H1 = G1 , H2 contains [xβ , xα ] = ±xα+β thus H2 = G2 , H3 contains [xα+β , xα ] = ±2x2α+β thus H3 = G3 since p 6= 2, H4 contains [x2α+β , xα ] = ±3x3α+β thus H4 = G4 if p 6= 3, in which case actually H = H5 = G5 = I + since H always contains [xα+β , x2α+β ] = ±x3α+2β . If p = 3, let us also consider the exact sequence + 0 → J4 → G4 → I 1 → 0 The group J4 = I2+ /I5+ is commutative, and in fact again a free Z3 -module: J4 = (U2 /U5 )(Zp ) = Z3 x̃α+β ⊕ Z3 x̃2α+β ⊕ Z3 x3α+β + where x̃γ is the image of xγ (1). The action by conjugation of I 1 on J4 is given by     1 1  xβ 7→   1 xα 7→  ±2 1 ±3 ±3 1 1 in the indicated basis of J4 . The Z3 -submodule H4′ = H4 ∩ J4 of J4 satisfies H4′ + Z3 x3α+β = J4 and 3x3α+β ∈ H4′ . 10 Naming signs ǫi ∈ {±1} in formula (1, 3) of proposition 2.8.1, we find that H4′ contains ǫ1 uv · x̃α+β + ǫ2 u2 v · x̃2α+β + ǫ3 u3 v · x3α+β for every u, v ∈ Z3 . Adding these for v = 1 and u = ±1, we obtain x̃2α+β ∈ H4′ . It follows that H4′ actually contains the following Z3 -submodule of J4 : J4′ = {a · x̃α+β + b · x̃2α+β + c · x3α+β : a, b, c ∈ Z3 , ǫ1 a ≡ ǫ3 c mod 3} . Now observe that J4′ is a normal subgroup of G4 , and the induced exact sequence + 0 → J4 /J ′ 4 → G4 /J4′ → I 1 → 0 + is an abelian extension of I 1 ≃ Z23 by J4 /J4′ ≃ F3 . Since H4 /J4′ is topologically generated by two + elements and surjects onto I 1 , it actually defines a splitting: G4 /J4′ = H4 /J4′ ⊕ J4 /J4′ . Thus H4′ = J4′ , H4 is a normal subgroup of G4 , H is a normal subgroup of I + and I + /H ≃ G4 /H4 ≃ J4 /J4′ ≃ F3 is generated by the class of xα+β (1) or x3α+β (1). We have shown: Lemma 2.10.2. The group I + is spanned by xα (Zp ) and xβ (Zp ) plus xα+β (1) if p = 3. Proof. (Of theorem 2.4.1 for G simple of type G2 ) By lemma 2.7.1, 2.10.1, 2.10.2 and the Iwahori decomposition of section 2.5, the pro-p-Iwahori I(1) is generated by xα (Zp ), xβ (Zp ), x−2β−3α (pZp ), along with xα+β (1) if p = 3. It is therefore topologically generated by xα (1), xβ (1), x−2β−3α (p), along with xα+β (1) if p = 3. The surjective reduction morphism I(1) ։ U(Fp ) ։ U1 (Fp ) shows that the first two generators can not be removed. The third one also can not, since all the others belong to the closed subgroup I+ ( I(1). Finally, suppose that p = 3 and consider the extension 1 → U2 /U5 → U/U5 → U/U1 → 1 With notations as above, the reduction of J4′ ⊂ J4 = U2 (Z3 )/U5 (Z3 ) = (U2 /U5 )(Z3 ) is a normal subgroup Y of X = (U/U5 )(F3 ) with quotient X/Y ≃ F33 . The surjective reduction morphism I(1) ։ U(F3 ) ։ U(F3 )/U5 (F3 ) = X ։ X/Y then kills x−2β−3α (p). The fourth topological generator xα+β (1) of I(1) thus also can not be removed, since the first two certainly do not span X/Y ≃ F33 . 11 2.11 We now return to an arbitrary split reductive group G over Zp . Let Gsc ։ Gder ֒→ G ։ Gad be the simply connected cover Gsc of the derived group Gder of G, and the adjoint group π : G ։ Gad of G. Then     ad ad ad ad ad T , M , R , ∆ , Xα α∈∆ad = π(T), ZR, R, ∆, (π(Xα ))α∈∆ is a pinning of Gad and this construction yields a bijection between pinnings of G and pinnings of Gad . Applying this to Gsc or Gder , we obtain pinnings     sc sc sc sc sc der der der der der T , M , R , ∆ , (Xα )α∈∆sc and T , M , R , ∆ , Xα α∈∆sc for Gsc and Gder : all of the above constructions then apply to Gad , Gsc or Gder , and we will denote with a subscript ad, sc or der for the corresponding objects. For instance, we have a sequence of Iwahori (resp. pro-p-Iwahori) subgroups I sc → I der ֒→ I → I ad 2.12 and I sc (1) → I der (1) ֒→ I(1) → I ad (1). The action of G on itself by conjugation factors through a morphism Ad : Gad → Aut(G). For b ∈ Bad (Fp ), Ad(b)(BFp ) = BFp and Ad(b)(UFp ) = UFp . We thus obtain an action of the Iwahori subgroup I ad of Gad = Gad (Qp ) on I or I(1). Similar consideration of course apply to Gsc and Gder , and the sequence I sc (1) → I der (1) ֒→ I(1) → I ad (1) ad is equivariant for these actions of I ad = I ad (1) ⋊ Ttors . 2.13 Let J be the image of I sc (1) → I(1), so that J is a normal subgroup of I. From the compatible Iwahori decompositions for I(1) and I sc (1) in section 2.5, we see that T (1) ֒→ I(1) induces a T ad -equivariant isomorphism T (1)/T (1) ∩ J → I(1)/J. Since the inverse image of T(Zp ) in Gsc (Zp ) equals Tsc (Zp ) and since also T sc (1) = Tsc (Zp ) ∩ I sc (1), we see that T (1) ∩ J is the image of T sc (1) → T (1). Also, the kernel of I sc (1) → I(1) equals Z ∩ I sc (1) where Z = ker(Gsc → G)(Zp ) = ker(Tsc → T)(Zp ). Therefore Z ∩ I sc (1) is the kernel of T sc (1) → T (1), which is trivial since Z is finite and T sc (1) ≃ Hom(M sc , 1 + pZp ) has no torsion. We thus obtain exact sequences 1 → T sc (1) → T (1) → Q → 0 ∩ ∩ k sc 1 → I (1) → I(1) → Q → 0 where the cokernel Q is the finitely generated Zp -module Q = (M ∨ /ZR∨ ) ⊗ (1 + pZp ) . 12 Remark 2.13.1. If G is simple, then M ∨ /ZR∨ is a finite group of order c, with c | ℓ + 1 if G is of type Aℓ , c | 3 if G is of type E6 and c | 4 in all other cases. Thus Q = 0 and I sc (1) = I(1) unless G is of type Aℓ with p | c | ℓ + 1 or p = 3 and G is adjoint of type E6 . In these exceptional cases, M ∨ /ZR∨ is cyclic, thus Q ≃ Fp . 2.14 It follows that I(1) is generated by I sc (1) and s(1 + pZp ) for s ∈ S, thus topologically generated by I sc (1) and s(1 + p) for s ∈ S. In view of the results already established in the simply connected case, this shows that the elements listed in (1 − 4) of Theorem 2.4.1 indeed form a set of topological generators for I(1). None of the semi-simple elements in (1) can be removed: they are all needed to generate the above abelian quotient Q of I(1) which indeed kills the unipotent generators in (2 − 4). Likewise, none of the unipotent elements in (2) can be removed: they are all needed to generate the abelian quotient Y Uα (Fp ) I(1) ։ U(Fp ) ։ U1 (Fp ) ≃ α∈∆ which kills the other generators in (1), (3) and (4).Q One checks easily using the Iwahori decomposi− tion of I(1) and the product decomposition U = c∈C U− c that none of the unipotent elements in (3) can be removed. Finally if p = 3 and d ∈ D, the central isogeny Gsc → Gad induces an isomorad phism Gsc d → Gd between the simple (simply connected and adjoint) components corresponding to d, thus also an isomorphism between the corresponding pro-p-Iwahori’s Idsc (1) → Idad (1). In particular, the projection I(1) → I ad (1) ։ Idad (1) is surjective. Composing it with the projection Idad (1) ։ F33 constructed in section 2.10, we obtain an abelian quotient I(1) ։ F33 that kills all of our generators except xα (1), xβ (1) and xα+β (1) where ∆d = {α, β}. In particular, the generator xα+β (1) from (4) is also necessary. This finishes the proof of Theorem 2.4.1. 2.15 ad The action of I ad = I ad (1) ⋊ Ttors on I(1) induces an Fp -linear action of   ad Ttors = Hom M ad , µp−1 = Hom ZR, F× p ˜ of I(1). Our minimal set of topological generators of I(1) reduces to on the Frattini quotient I(1) ˜ ˜ made of eigenvectors for the action of T ad . We denote an eigenbasis of I(1), i.e. an Fp -basis of I(1) tors ad by Fp (α) the 1-dimensional representation of Ttors on Fp defined by α ∈ ZR. We thus obtain: ad ˜ Corollary 2.15.1. The Fp [Ttors ]-module I(1) is isomorphic to        ⊕ ⊕ F (δ ) if p = 3 . F♯S ⊕ ⊕ F (α) ⊕ ⊕ F (−α ) d∈D p c α∈∆ p c∈C p c,max p Here ♯S denotes the cardinality of the set S. The map α 7→ Fp (α) yields a bijection between ad ZR/(p − 1)ZR and the isomorphism classes of simple Fp [Ttors ]-modules. In particular some of the simple modules in the previous corollary may happen to be isomorphic. For instance if G is simple of type Bℓ and p = 3, then −αmax ≡ α mod 2 where α ∈ ∆ is a long simple root. An inspection of the tables in [1] yields the following: ad ˜ is multiplicity free unless p = 3 and G Corollary 2.15.2. If G is simple, the Fp [Ttors ]-module I(1) is of type A1 , Bℓ or Cℓ (ℓ ≥ 2), F4 or G2 . In the next section we use this result to construct Galois representations landing in I ad with image containing I ad (1). 13 3 The Construction of Galois Representations Let G be a split simple adjoint group over Zp and let I(1) and I = I(1) ⋊ Ttors be the corresponding Iwahori groups, as defined in the previous section. We want here to construct Galois representations of a certain type with values in I with image containing I(1). After a short review of p-rational fields in section 3.1, we establish a criterion for the existence of our representations in sections 3.2 and 3.3 and finally give some examples in section 3.4. 3.1 Let K be a number field, r2 (K) the number of complex primes of K, Σp the set of primes of K lying above p, M the compositum of all finite p-extensions of K which are unramified outside Σp , M ab the maximal abelian extension of K contained in M, and L the compositum of all cyclic extensions of K of degree p which are contained in M or M ab . If we let Γ denote Gal(M/K), then Γ is a pro-p group, Γab ∼ = Gal(L/K) is = Γab /pΓab ∼ = Gal(M ab /K) is the maximal abelian quotient of Γ, and Γ̃ ∼ the Frattini quotient of Γ. Definition A number field K is p-rational if the following equivalent conditions are satisfied: (1) rank Zp (Γab ) = r2 (K) + 1 and Γab is torsion-free as a Zp -module, (2) Γ is a free pro-p group with r2 (K) + 1 generators, (3) Γ is a free pro-p group. The equivalence of (1), (2) and (3) follows from [6], see also proposition 3.1 and the discussion before remark 3.2 of [3]. There is a considerable literature concerning p-rational fields, including [8], [4]. Examples: (1) Suppose that K is a quadratic field and that either p ≥ 5 or p = 3 and is unramified in K/Q. If K is real, then K is p-rational if and only if p does not divide the class number of K and the fundamental unit of K is not a p-th power in the completions Kv of K at the places v above p. On the other hand, if K is complex and p does not divide the class number of K, then K is a p-rational field (cf. proposition 4.1 of [3]). However, there are p-rational complex K’s for which p divides the class number (cf. chapter 2, section 1, p. 25 of [7]). For similar results, see also [2] and [5] if K is complex. (2) Let K = Q(µp ). If p is a regular prime, then K is a p-rational field (cf. [12], see also [3], proposition 4.9 for a shorter proof). 3.2 Suppose that K is Galois over Q and p-rational with p ∤ [K : Q]. Since K is Galois over Q, so is M and we have an exact sequence 1→Γ→Π→Ω→1 (3.2.1) where Ω = Gal(K/Q) and Π = Gal(M/Q). Conjugation in Π then induces an action of Ω on the Frattini quotient Γ̃ = Gal(L/K) of Γ. Any continuous morphism ρ : Π → I maps Γ to I(1) ˜ If and induces a morphism ρ : Ω → I/I(1) = Ttors and a ρ-equivariant morphism ρ̃ : Γ̃ → I(1). ρ(Γ) = I(1), then ρ̃ is also surjective. Suppose conversely that we are given the finite data ρ : Ω → Ttors ˜ and ρ̃ : Γ̃ ։ I(1). 14 Then as Ω has order prime to p, the Schur-Zassenhaus theorem ([14], proposition 2.3.3) implies that the exact sequence 3.2.1 splits. The choice of a splitting Π ≃ Γ ⋊ Ω yields a non-canonical action of Ω on Γ which lifts the canonical action of Ω on the Frattini quotient Γ̃. By [3], proposition 2.3, ρ̃ lifts to a continuous Ω-equivariant surjective morphism ρ′ : Γ ։ I(1), which plainly gives a continuous morphism ρ = (ρ′ , ρ) : Π ≃ Γ ⋊ Ω → I = I(1) ⋊ Ttors ˜ Thus: inducing ρ : Ω → Ttors and ρ̃ : Γ̃ ։ I(1). Proposition 3.2.1. Under the above assumptions on K, there is a continuous morphism ρ : Π → I such that ρ(Γ) = I(1) if and only if there is a morphism ρ : Ω → Ttors such that the induced Fp [Ω]˜ is a quotient of Γ̃. module ρ∗ I(1) ˜ ˜ as an The Frattini quotient I(1) is an Fp [Ttors ]-module and by the map ρ, we can consider I(1) ∗˜ Fp [Ω]-module which we denote by ρ I(1). 3.3 Suppose now that A(K): K is a totally complex abelian (thus CM) Galois extension of Q which is p-rational of degree [K : Q] | p − 1. Let Ω̂ be the group of characters of Ω with values in F× p , Ω̂odd ⊂ Ω̂ the subset of odd characters (those taking the value −1 on complex conjugation), and χ0 ∈ Ω̂ the trivial character. Then by [3] proposition 3.3, Γ̃ = ⊕χ∈Ω̂odd ∪{χ0 } Fp (χ) as an Fp [Ω]-module. In particular, Γ̃ is multiplicity free. Suppose therefore also that the Fp [Ttors ]˜ is multiplicity free, i.e. by corollary 2.15.2, module I(1) B(G): If p = 3, then G is not of type A1 , Bℓ or Cℓ (ℓ ≥ 2), F4 or G2 . For S as in section 2.4, we define Ω̂Sodd ( Ω̂odd ∪ χ0 , if S = ∅ = Ω̂odd , if S = 6 ∅. Note that S = ∅ unless G if of type Aℓ with p | ℓ + 1 or G is of type E6 with p = 3, in which both cases S is a singleton. We thus obtain: Corollary 3.3.1. Under the assumptions A(K) on K and B(G) on G, there is a morphism ρ : Π → I such that ρ(Γ) = I(1) if and only if there is morphism ρ : Ω → Ttors such that the S characters α ◦ ρ : Ω → F× p for α ∈ ∆ ∪ {−αmax } are all distinct and belong to Ω̂odd . 15 3.4 Some examples. Write ∆ = {α1 , ..., αℓ } and αmax = n1 α1 +· · ·+nℓ αℓ using the conventions of the tables in [1]. In this part we suppose that p is a regular (odd) prime and take K = Q(µp ), so that K is p-rational and Ω = Z/(p − 1)Z. Lemma 3.4.1. Suppose G is of type Aℓ , Bℓ , Cℓ or Dℓ and p ≥ 2l + 3 (resp. p ≥ 2l + 5) if p ≡ 1 mod 4 (resp. p ≡ 3 mod 4). Then we can find distinct characters φ1 , ..., φℓ+1 ∈ Ω̂odd ∪ χ0 such that φn1 1 φn2 2 · · · φnℓ ℓ φℓ+1 = χ0 . Furthermore, if G is of type Aℓ and ℓ is odd, then one can even choose the characters φ1 , ..., φℓ+1 to be inside Ω̂odd . Proof. Since Ω is (canonically) isomorphic to Z/(p − 1)Z, ♯Ω̂odd = p−1 and there are exactly [ p−1 ] 2 4 p−1 −1 −1 pairs of characters {χ, χ } with χ 6= χ in Ω̂odd . The condition on p is equivalent to ℓ ≤ 2[ 4 ]−1. If G is of type Aℓ , then αmax = α1 + · · · + αℓ . If ℓ is even and 2ℓ ≤ [ p−1 ], then we can pick 2ℓ 4 distinct pairs of odd characters {χ, χ−1 } as above for {φ1 , · · · , φℓ } and set φℓ+1 = χ0 . If ℓ is odd ≤ [ p−1 ], then we can choose ℓ+1 distinct such pairs for the whole set {φ1 , · · · , φℓ+1 }. and ℓ+1 2 4 2 If G is of type Dℓ (with ℓ ≥ 4), then αmax = α1 + 2α2 + ... + 2αℓ−2 + αℓ−1 + αℓ . Now if ℓ is odd we can pick ℓ+1 such pairs {χ, χ−1 }, one for {φℓ−1, φℓ }, another pair for {φ1 , φℓ+1} and ℓ−3 such 2 2 ℓ pairs for {φ2 , ..., φℓ−2 }. If ℓ is even, we let φ2 be the trivial character, and we can choose 2 such pairs of characters {χ, χ−1 }, one pair for {φ1 , φℓ−1}, another pair for {φℓ , φℓ+1} and ℓ−4 such pairs 2 p−1 for {φ3 , ..., φℓ−2 }. So the inequality that we will need is 4 ≤ ℓ ≤ 2[ 4 ] − 1. If G is of type Bℓ (with ℓ ≥ 2), then αmax = α1 + 2α2 + ... + 2αℓ . If ℓ is odd then we pick ℓ+1 2 pairs of characters {χ, χ−1 }; one pair for {φ1 , φℓ+1 } and ℓ−1 such pairs for {φ , ..., φ }. If ℓ is even 2 ℓ 2 then we need 2ℓ pairs of {χ, χ−1 }; one pair for {φ1 , φℓ+1} and ℓ−2 such pairs for {φ3 , ..., φℓ } and we 2 p−1 let φ2 be the trivial character. So in this case we need 3 ≤ ℓ ≤ 2[ 4 ] − 1. The remaining Cℓ case is analogous. P Lemma 3.4.2. Suppose G is of type E6 , E7 , E8 , F4 or G2 and p ≥ ℓi=1 (2i − 1)ni + 2ℓ. Then we can find distinct characters φ1 , ..., φℓ+1 ∈ Ω̂odd such that φn1 1 φn2 2 · · · φnℓ ℓ φℓ+1 = χ0 . Proof. The choice of a generator ξ of F× p yields an isomorphism Z/(p − 1)Z ≃ Ω̂, mapping i to χi and odd for i = 1, · · · , ℓ and φℓ+1 = χ−r where r = Pℓ 1 + 2Z/(p − 1)Z to Ω̂odd . Set φi = χ2i−1 ∈ Ω̂P ℓ show that h = φ ∈ Ω̂odd and plainly n · (2i − 1). The tables in [1] i=1 ni is odd, thus also i=1 i Pℓ ℓ+1 P ℓ nℓ n1 φ1 · · · φℓ φℓ+1 = 1. If p ≥ i=1 (2i − 1)ni + 2ℓ, the elements {2i − 1, − i=1 ni · (2i − 1); i ∈ [1, ℓ]} are all distinct modulo p − 1, which proves the lemma. P Remark 3.4.3. For G of type E6 , E7 , E8 , F4 or G2 , the tables in [1] show that the constant ℓi=1 (2i− 1)ni + 2ℓ of lemma 3.4.2 is 79, 127, 247, 53, 13 respectively. Corollary 3.4.4. There is a constant c depending only upon the type of G such that if p > c is a regular prime, then for K = Q(µp ), M, Π and Γ as above, there is a continuous morphism ρ : Π → I with ρ(Γ) = I(1). In conclusion, we have determined a minimal set of topological generators of the pro-p Iwahori subgroup of a split reductive groups over Zp (theorem 2.4.1) and used it to study the structure of ad ˜ the Frattini quotient I(1) as an Fp [Ttors ]-module (corollary 2.15.1). Then we have used corollary ˜ is multiplicity free (see corollary 2.15.2). Furthermore in proposition 2.15.1 to determine when I(1) 3.2.1 and corollary 3.3.1, assuming p-rationality, we have shown that we can construct Galois representations if and only if we can find a suitable list of distinct characters in Ω, the existence of which is discussed in section 3.4 under the assumption K = Q(µp ), for any sufficiently large regular prime p (see corollary 3.4.4). 16 References [1] N. Bourbaki, Éléments de mathématique. Fasc. XXXIV. Groupes et algèbres de Lie. Chapitre IV: Groupes de Coxeter et systèmes de Tits. Chapitre V: Groupes engendrés par des réflexions. Chapitre VI: systèmes de racines. Actualités Scientifiques et Industrielles, No. 1337, Hermann, Paris, (1968). [2] S. Fujii, On the maximal pro-p extension unramified outside p of an imaginary quadratic field, Osaka J. Math. 45, (2008), 41-60. [3] R. Greenberg, Galois representation with open image, Annales mathématiques du Québec, Volume 40, Issue 1, (2016), 83-119. [4] J. F. Jaulent, T. Nguyen Quang Do, Corps p-rationnels, corps p-réguliers, et ramification restreinte, Séminaire de Théorie des Nombres de Bordeaux, (1987-88), Exposé 10, 10-01 10-26. [5] J. Minardi, Iwasawa modules for Zdp -extensions of algebraic number fields, University of Washington Ph. D. thesis, (1986). [6] A. Movahhedi, T. Nguyen Quang Do, Sur l’arithmétique des corps de nombres p-rationnels, Prog. Math. 81, Birkhauser, (1990), 155-200. [7] A. Movahhedi, Sur les p-extensions des corps p-rationnels, Thèse de doctorat en Mathématiques, Paris 7, (1988). [8] A. Movahhedi, Sur les p-extensions des corps p-rationnels, Math. Nach, 149, (1990), 163-176. [9] R. Ollivier, P. Schneider, A canonical torsion theory for pro-p Iwahori-Hecke modules, https://arxiv.org/pdf/1602.00738v1.pdf, (2016). [10] C. M. Ringel, The (n−1)-antichains in a root poset of width n, http://arxiv.org/abs/1306.1593v1, (2013). [11] Séminaire de Géométrie Algébrique du Bois Marie - 1962-64 - Schémas en groupes - (SGA 3) Philippe Gille and Patrick Polo, editors. [12] I. R. Shafarevich, Extensions with given points of ramification, Amer. Math. Soc, Translations 59, (1966), 128-149. [13] J. Tits, Reductive groups over local fields, In Automorphic forms, representations and L-functions (Proc. Sympos. Pure Math., Oregon State Univ., Corvallis, Ore., 1977), Part 1, Proc. Sympos. Pure Math., XXXIII, pages 29-69. Amer. Math. Soc., Providence, R.I., (1979). [14] J. S. Wilson, Profinite Groups, Oxford Science Publications, London Mathematical Society Monographs, New Series 19, (2005).
4math.GR
1 Fixed-time cluster synchronization for complex networks via pinning control arXiv:1509.03350v1 [cs.SY] 6 Sep 2015 Xiwei Liu, Member, IEEE, and Tianping Chen, Senior Member, IEEE Abstract—In this paper, the fixed-time cluster synchronization problem for complex networks via pinning control is discussed. Fixed-time synchronization has been a hot topic in recent years, which means that the network can achieve synchronization in finite-time and the settling time is bounded by a constant for any initial values. To realize the fixed-time cluster synchronization, a simple distributed protocol by pinning control technique is designed, whose validity is rigorously proved, and some sufficient criteria for fixed-time cluster synchronization are also obtained. Especially, when the cluster number is one, the cluster synchronization becomes the complete synchronization problem; when the intrinsic dynamics for each node is missed, the fixedtime cluster synchronization becomes the fixed-time cluster (or complete) consensus problem; when the network has only one node, the coupling term between nodes will disappear, and the synchronization problem becomes the simplest master-slave case, which also includes the stability problem for nonlinear systems like neural networks. All these cases are also discussed. Finally, numerical simulations are presented to demonstrate the correctness of obtained theoretical results. Index Terms—Complex networks, cluster synchronization, fixed-time, finite-time, pinning control. I. I NTRODUCTION Synchronization of complex networks [1]-[11] has been a hot topic in recent decades, and it is usually described by the following continuous-time ordinary differential equation: ẋi (t) = f (xi (t)) + gi (x1 (t), · · · , xN (t)), i = 1, · · · , N n where xi ∈ R denotes the state of agent i; the first term f (xi (t)) denotes the intrinsic dynamics of agent i, when f = 0, the synchronization model becomes the consensus model; and the second term gi (x1 (t), · · · , xN (t)) means the diffusive coupling from agent i’s neighbours. Although each agent just needs to get the local information of its neighbours, under the above algorithm, the whole network can display a collective behavior—-synchronization, i.e., lim kxi (t) − xj (t)k = 0; i, j = 1, 2, · · · , N t→∞ (1) This work is jointly supported by the National Natural Sciences Foundation of China (Nos. 61203149, 61273211 and 61233016), the National Basic Research Program of China (973 Program) under Grant No. 2010CB328101, “Chen Guang” project supported by Shanghai Municipal Education Commission and Shanghai Education Development Foundation under Grant No. 11CG22, and the Fundamental Research Funds for the Central Universities. Xiwei Liu is with Department of Computer Science and Technology, Tongji University, and with the Key Laboratory of Embedded System and Service Computing, Ministry of Education, Shanghai 200092, China. E-mail: [email protected]; [email protected] Corresponding Author Tianping Chen is with the School of Mathematical/Computer Sciences, Fudan University, 200433, Shanghai, P.R. China. Email: [email protected] where k · k denotes some norm. It is a fundamental research topic in decentralized control, and has broad applications in cooperative control of unmanned air vehicles (UAVs), formation control of mobile robots, etc. The most popular model in the synchronization literature is the linear coupling protocol ẋi (t) = f (xi (t)) + c N X aij (xj (t) − xi (t)), i = 1, · · · , N j=1 and the nonlinear coupling protocol ẋi (t) = f (xi (t)) + c N X aij φ(xj (t), xi (t)), i = 1, · · · , N j=1 (Infinite-time vs Finite-time) Under these coupling protocols, the sufficient criteria for asymptotic synchronization or exponential synchronization can be obtained. Synchronization rate is an important performance indicator for protocol. However, for the above two types of synchronization speed, the disadvantage is that the completely same of each node can never occur in finite-time, i.e., there does not exist a constant T called the settling time, which may depend on the initial values, such that for any i, j = 1, 2, · · · , N lim kxi (t) − xj (t)k = 0; and xi (t) = xj (t), ∀t ≥ T. (2) t→T In many applications as robotics, a standard problem in system theory is to develop controllers which drive a system to a given position as fast as possible [12]. Moreover, chaos synchronization plays an important role in the literature, if the synchronization does not realize in a finite-time, for example, exponential synchronization is realized, then the coupling protocol or the external controllers should be always added on the network, since if they are cancelled, from the property of chaotic oscillator, a small error may cause a large difference between nodes. Furthermore, finite-time synchronization can lead to better system performances in the disturbance rejection and robustness against uncertainty. Based on above reasons, an investigation of finite-time synchronization under new coupling protocols is important both in theoretical analysis and real applications. Next, we review some progress in the finite-time literature. Finite-time synchronization (or consensus) heavily relies on the development of finite-time stabilization theory. Finitetime stabilization problems have been studied mostly in the contexts of optimality, controllability, and deadbeat control for several decades. These control laws are usually timevarying, discontinuous, or even depending directly on the 2 initial conditions of considered systems, for example, in [13], the author considered the following controllers ẋ = − grad(f )(x) , and ẋ = −sgn(grad(f )(x)), kgrad(f )(x)k2 by using the theory of Filippov, the author proved the finitetime stability and applied it on the network consensus problem. Recently, finite-time stability and finite-time stabilization via continuous time-invariant feedback have been studied. For example, [14] studied the finite-time stability of a homogeneous systems and designed the bounded continuous finitetime stabilizing feedback laws for the double integrators; [15] studied global finite-time control of robot systems through state feedback and output feedback control; [16] discussed the finite-time stability of continuous systems, investigated its sensitivity to perturbations and rigorously set up a general framework for finite-time stabilization, many papers’ works were based on this excellent result; [17]-[18] proposed two new sufficient conditions for local finite-time stability and designed an observer for a class of homogeneous systems with Lipschitz nonlinearity. As for the finite-time synchronization/consensus literature, in [19], the author proposed a new class of finite-time consensus protocol: X α X ẋi (t) = βsig Wij (xj − xi ) +γ Wij (xj − xi ), j∈Ni j∈Ni where 0 < α < 1, β > 0, γ ≥ 0, they proved that if the network had a spanning tree, then the above protocol can realize the finite-time consensus. [20] investigated the finitetime consensus under the protocol: X ẋi (t) = aij sig(xj − xi )αij (t) , 0 < αij (t) < 1, j∈Ni they proved that if the sum of time intervals, in which the interaction topology was connected, was sufficiently large, the above protocol can realize finite-time consensus for both bidirected and unidirected networks. [21] considered the finitetime weighted average consensus of time-varying topology with respect to the monotonic function g under the protocol: n X 1 aij (t)sig(h(xj ) − h(xi ))α , 0 < α < 1, ẋi (t) = ωi dg/dxi j=1 when ωi = 1, then the above protocol was the one in [22]. [23] considered the finite-time χ-consensus models, ẋi (t) = 1 ∂χ | | ∂x i n X aij (t)ψ(sig(xj − xi )α ), 0 ≤ α < 1, α aij (t)[ψ(xα j ) − ψ(xi )], 0 ≤ α < 1, j=1 and ẋi (t) = 1 ∂χ | | ∂x i n X j=1 using the homogeneity property of ψ and the Lyapunov function, the authors finally proved the finite-time consensus for undirected (the first model) and directed (the second model) networks. With the similar analysis, [24] discussed the finitetime consensus of the leader-following multi-agent systems with jointly-reachable leader and switching jointly-reachable leader for the first-order model X aij (t)φ(sig(xj (t) − xi (t))α ) ẋi (t) = vj ∈Ni (t) − bi (t)φ2 (sig(xi (t) − x0 )α ), 0 ≤ α < 1, and for the second-order model ẋi (t) =vi (t), X v̇i (t) = aij (t)[ϕ1 (sig(xj (t) − xi (t))α1 ) vj ∈Ni (t) + ϕ2 (sig(vj (t) − vi (t))α2 )] − bi (t)[ϕ3 (sig(xj (t) − x0 (t))α1 ) + ϕ4 (sig(vj (t) − v0 (t))α2 ))], 2α1 where ẋ0 (t) = v0 (t), v̇0 (t) = 0 and 0 < α1 < 1, α2 = 1+α . 1 Moreover, in [25], by using the tools from homogeneous theory, the authors investigated finite-time consensus with second-order integrators based on both relative position and relative velocity measurements as q̇i (t) =pi (t), α1   X N aij (qi − qj ) ṗi (t) = − k1 tanh sig j=1  − k2 tanh sig X N 2α1 1+α1 , j=1 α2  , aij (pi − pj ) where 0 < α1 < 1, α2 = and they also considered the case with only the relative position measurements obtained. In [26], the optimal finite-time stabilization problem was considered, and they designed a new switching protocol covering both continuous control (0 < α < 1) and discontinuous one (α = 0), which can shorten the stabilization time; with the same aim, the authors in [27] also considered the optimal consensus time for multi-agents systems and proposed a new switching protocol. Moreover, in [28], the distributed finite-time containment control algorithm for double-integrator multi-agent systems with multiple dynamic or stationary leaders was proposed and its validity was also rigorously proved. (Finite-time vs Fixed-time) Although many finite-time results are obtained in the above short review, the settling time heavily depends on the initial conditions, which limits the practical applications, since the knowledge of initial conditions is not available in advance. Therefore, to overcome this drawback, in [29], a new concept called the fixed-time stability is proposed, if it is globally finite-time stable and the settling time function is bounded for any initial values. The technique is adding extra terms on the previous finite-time model, which will be stated more carefully in the next section. Following this streamline of dealing with fixed-time stability, many new approaches and results are obtained, see [30]-[35] and references therein. For example, [33] and [34] proposed two new protocols to realize the fixed-time stabilization, and the upper bounds for the settling time were also estimated; moreover, they also applied these new protocols on fixed-time consensus problem for multi-agent systems. [35] proposed a 3 fixed-time terminal sliding-mode control protocol for a class of second-order nonlinear systems in the presence of uncertainties and perturbations. In [36], the authors considered the finite-time consensus for multi-agent systems with cooperative and antagonistic interactions, and they proved that the states of all agents can reach agreement in a finite-time regarding consensus values that were the same in modulus but may not be the same in sign. Although many papers have considered the finite-time and fixed-time consensus problem, the discussions about synchronization and consensus have a great difference because of the existence of intrinsic dynamics. There are few works to discuss the finite-time and fixed-time synchronization. For example, [37] investigated the finite-time complete synchronization, while [38] studied the fixed-time complete synchronization. On the other hand, cluster synchronization is a more practical phenomenon than the complete synchronization, which is significant in biological sciences, communication engineering, etc. The cluster synchronization means that nodes in the same cluster can achieve complete synchronization, while nodes in different clusters have different dynamical behaviors. Of course, when all the nodes lie in the same cluster, then the cluster synchronization becomes the complete synchronization. There were some paper considering the cluster synchronization exponentially like [7], [8], [40]-[42], and [43] also considered the finite-time cluster synchronization of Markovian switching complex networks with stochastic perturbations by adding the linear negative feedback controllers. To our best knowledge, there are no papers considering the fixed-time cluster synchronization via pinning control, which will be the subject of this paper. This paper is organized as follows. In Section II, some necessary definitions, lemmas, assumptions and notations are given. A simple coupling protocol to ensure the fixed-time cluster synchronization via pinning control is also proposed. In Section III, we first rigorously prove the effectiveness of proposed protocol, then the fixed-time complete synchronization is also carefully discussed. Furthermore, some numerical simulations are given in Section IV to show the correctness of obtained theoretical results. Finally, a conclusion and some discussion about future work are presented in Section V. II. P RELIMINARIES In this section, we present some definitions, lemmas, and notations, which will be useful throughout this paper. First, we will give some general results on the dynamical systems. If a nonnegative function V (t) satisfies V̇ (t) = −αµ(V (t)), where α > 0, functions µ(V (t)) > 0, V (t) > 0; µ(0) = 0. Because V̇ (t) > 0, therefore, V (t) is decreasing. Define the function V1 (t) as follows: Z s V1 (s) = −α−1 µ−1 (V )dV, V (0) then, t = V1 (V (t)), (3) and V1− (t) = V (t), (4) V1− where is the inverse function of V . If µ(s) = s, then Z V (t) V (t) −1 , t = V1 (V (t)) = −α V −1 dV = −α−1 log V (0) V (0) and V (t) = V (0)e−αt . If µ(s) = sp , p 6= 1, then V1 (s) = −1 (s1−p − V 1−p (0)), α(1 − p) which implies 1 V (t) = [α(p − 1)t + V 1−p (0)] 1−p . In case p < 1, then V (t) = 0, if t≥ V 1−p (0) . α(1 − p) On the other hand, in case p > 1, V (t) = 1 1 [α(p − 1)t + V 1−p (0)] p−1 . As direct consequences, we show some useful lemmas on the finite-time and fixed-time stability. Lemma 1: (See [16]) If a nonnegative function V (t) satisfies V̇ (t) ≤ −αV p (t), 0 < p < 1 (5) where α > 0. Then, V (t) ≡ 0, if t≥ V 1−p (0) . α(1 − p) (6) Many papers investigating the finite-time stability or consensus are based on this result, see [19]-[27]. Moreover, the other forms like V̇ (t) ≤ −αV p (t) ± kV (t) are also proposed and proved to realize finite-time stability in [17] and [18], here we omit them, interested readers can refer to these works. However, the settling time depends on the initial value V (0), which in many cases cannot be obtained. Therefore, in our recent paper, a general criteria for the fixed-time stability is proposed, which can be stated as follows. Lemma 2: (See [39]) If a nonnegative function V (t) satisfies  −αV p (t), 0 < p < 1 ; if 0 < V < 1 V̇ (t) ≤ (7) −βV q (t), q > 1 ; if V ≥ 1 where α > 0, β > 0. Then, V (t) ≡ 0, if t≥ 1 1 + . α(1 − p) β(q − 1) (8) Remark 1: As a direct result, if a nonnegative function V (t) satisfies V̇ (t) ≤ −αV p (t) − βV q (t), (9) 4 where α > 0, β > 0, 0 < p < 1, q > 1. Then, V (t) ≡ 0, if t≥ 1 1 + . α(1 − p) β(q − 1) (10) Remark 2: From the above two lemmas, one can conclude that for the finite-time stability, only one term like −V (t)p , 0 < p < 1 can realize this aim; however, to realize fixed-time stability, except for the term for finite-time stability, one should add an extra term −V (t)q , q > 1, whose role can be regarded as pulling the system into the region with norm less than 1 in a fixed-time. Remark 3: Some other criteria to ensure the fixed-time stability, like V̇ (t) ≤ −(αV p (t) + βV q (t))k , (11) where α > 0, β > 0. p > 0, q > 0, k > 0, 0 < pk < 1, qk > 1, which is presented in [29]; or 1 1 V̇ (t) ≤ −αV 1− 2µ (t) − βV 1+ 2µ (t), µ > 1, (12) m n p (t) − βV q (t), (13) where m, n, p, q are all positive odd integers satisfying m > n and p < q, which is proposed in [34], can all be regarded the special case of Lemma 2. Of course, utilizing the concrete form of (12) and (13), the authors can obtain a more exact estimation of the settling time. Since the dealing with different norms happens in the fixedtime and finite-time literature, we first introduce a powerful lemma. Lemma 3: (See [44]) For any vector z ∈ Rn and 0 < r < l, the following norm equivalence property holds: 1/r 1/l  X X n n r l , (14) |zi | ≤ |zi | i=1 i=1 and  n 1X |zi |l n i=1 1/l ΘAǫ + ATǫ Θ < 0. Especially, when A ∈ A2 and ǫ < 0, we can choose Φ = I, where I is the identity matrix with appropriate dimensions, such that matrix Aǫ is negative definite, i.e., its eigenvalues are all negative and can be sorted as 0 > λ1 (Aǫ ) ≥ λ2 (Aǫ ) ≥ λ3 (Aǫ ) ≥ · · · ≥ λN (Aǫ ). which is proposed in [30]; or V̇ (t) ≤ −αV P 1) aij ≥ 0, i 6= j, aii = − N j=1,j6=i aij , i = 1, · · · , N 2) A is irreducible. Furthermore, if A ∈ A1 and aij = aji , i 6= j, then we say matrix A belong to class A2, denoted as A ∈ A2. Obviously, if the Laplacian matrix for the graph G is A, then A ∈ A1 means that the graph is a strongly connected directed graph; and A ∈ A2 means that the graph is a strongly connected undirected graph. Lemma 4: (See [5]) Suppose A ∈ A1 and ǫ < 0, then, there exists a positive definite diagonal matrix Θ = diag(θ1 , · · · , θN ), such that the matrix Aǫ = A + diag{ǫ, 0, · · · , 0} is Lyapunov stable, i.e., ≥ 1/r  X n 1 . |zi |r n i=1 (15) Remark 4: The first inequality (14) is called the Jensen inequality, whose proof can be found in P. 4, [44], and this inequality is also commonly used in the finite-time literature. On the other hand, the second inequality (15) is very useful to deal with the newly added term like −V (t)q , q > 1, whose proof can be found in P. 26, [44]. The above two inequalities can be combined in the norm form as follows: 1 1 (16) kzkl ≤ kzkr ≤ n r − l kzkl , Pn P n where kzkr = ( i=1 |zi |r )1/r and kzkl = ( i=1 |zi |l )1/l . Next, we will introduce some definitions and lemmas about the cluster synchronization in complex networks. For a complex network of N nodes, suppose its graph is G = {V, E}, where V represents the vertex set numbered by {1, · · · , N }, and E denotes the edge set with e(i, j) ∈ E if and only if there is an edge from vertex j to i. Definition 1: (See [8]) Matrix A = (aij ) ∈ RN ×N is said to belong to class A1, denoted as A ∈ A1, if (17) Lemma 5: (See [6]) Suppose A = (aij )N ×N ∈ A2, then for any two vectors X = (x1 , · · · , xN )T and Y = (y1 , · · · , yN )T , we have X aij (xj − xi )(yj − yi ). (18) X T AY = − j>i Definition 2: (See [8]) Matrix A = (aij ) ∈ RN1 ×N2 is said to belong to class PN2 A3, denoted as A ∈ A3, if its each row-sum is zero, i.e., j=1 aij = 0, i = 1, . . . , N1 . Remark 5: In fact, we can also assume that each row-sum is a non-zero constant, but for convenience, we assume the row-sum is zero, which means that the interactions between nodes can be cooperative (when the element is positive) and competitive (when the element is negative). In order to investigate the cluster synchronization, we assume the set of nodes in the network can be divided into m clusters, i.e., {1, · · · , N } = C1 ∪ C2 ∪ · · · ∪ Cm , where C1 = {1, · · · , r1 }, C2 = {r1 + 1, · · · , r2 }, · · · , Ck = {rk−1 + 1, · · · , rk }, · · · , Cm = {rm−1 + 1, · · · , N }. (19) Now, using the above definitions of matrices, we can define a new type of coupling matrix A for the cluster synchronization analysis. Definition 3: Suppose A ∈ RN ×N is symmetric, the indexes {1, · · · , N } can be divided into m clusters as defined in (19), and the following form holds   A11 A12 · · · A1m  A21 A22 · · · A2m    (20) A= . .. ..  , ..  .. . . .  Am1 Am2 ··· Amm where Aij ∈ R(ri −ri−1 )×(rj −rj−1 ) , r0 = 0, Aii ∈ A2 and Aij ∈ A3, i, j ∈ {1, · · · , m}. Then the matrix A is said to belong to class A4, denoted as A ∈ A4. Remark 6: In fact, the coupling matrix for cluster synchronization is also defined in [8], but in that paper, the matrix 5 A can be asymmetric. The reason for the requirement in the above definition is for the convenience of later analysis. Moreover, in [42], the authors also investigate another type of cluster synchronization, i.e., A ∈ A1 and Aij ∈ A3, obviously, they are different, since in this type of coupling matrix, the interactions between nodes are only cooperative ones. Cluster synchronization means that: each vertex in the same cluster has the same individual node dynamic, while nodes in different clusters are nonidentical, which can guarantee that the trajectories are apparently distinguishing when cluster synchronization is reached. In [42], the authors use different intrinsic dynamics to guarantee the final cluster synchronization, while [7]-[8] use the pinning control technique [5] to realize the final cluster synchronization. Now, for the complex network with clusters defined in (19), we give the following definition of fixed-time cluster synchronization. Definition 4: For the network with (19), the fixed-time cluster synchronization is said to be realized, if there exists a time T independent on the initial values, such that for any initial values, node i can converge to the target trajectory sk (t), which belongs to the k-th cluster Ck , k = 1, 2, · · · , m, i.e., lim kxi (t) − sk (t)k = 0, and xi (t) = sk (t), ∀t ≥ T, (21) t→T where target trajectories in different clusters are different with each other, i.e., sk1 (t) 6= sk2 (t), k1 , k2 ∈ {1, · · · , m}. Now, we are in the position to propose the coupling protocols for the fixed-time cluster synchronization via pinning control. Without loss of generality, we assume the controllers are added on just the first node of each cluster. Therefore, we list the protocol for cluster Ck , k = 1, · · · , m as follows: ẋrk−1 +1 (t) = f (xrk−1 +1 (t))   X p +α ark−1 +1,j sig xj (t) − xrk−1 +1 (t) j∈Ck + X sig p X j∈Ck + X  ark−1 +1,j (xj (t) − xrk−1 +1 (t))  X  brk−1 +1,j (xj (t) − xrk−1 +1 (t)) j∈Ck′ k′ 6=k +β  X sig j∈Ck′ k′ 6=k −ǫ1 sigp (xrk−1 +1 (t) − sk (t)) −ǫ2 sigq (xrk−1 +1 (t) − sk (t)), k′ 6=k +β j∈Ck′ X j∈Ck + X k′ 6=k  X (22) j∈Ck′ (26) Especially, when p = 1, sig(x) = x. Remark 7: In fact, we have made many simple assumptions. For example, as for the QUAD condition (25), one can assume that there exists a diagonal matrix ∆ = diag(δ1 , · · · , δn ) and δi > 0, i = 1, · · · , n, such that (x − y)T (f (x) − f (y)) ≤ (x − y)T ∆(x − y). Moreover, as for the coupling term, one can also use a function Ψ(x) instead of x, where Ψ(x) = (ψ1 (x1 ), · · · , ψn (xn ))T , therefore in this case, the nonlinear function includes the linear one with Ψ(x) = Γx, where Γ is a positive diagonal matrix. Furthermore, the parameters α, β, ǫ1 , ǫ2 defined in (22) and (23) can also be different values or vectors which are functions of the cluster k as: α(k), β(k), ǫ1 (k), ǫ2 (k). In all, to simply the process and emphasis on the key role of terms sigp (·), 0 < p < 1 and sigq (·), q > 1 for the fixed-time synchronization, we adopt the assumptions as given, interested readers can generalize these cases themselves. Lemma 6: (Young’s inequality) Suppose a, b, u, v are all positive scalars, and u1 + v1 = 1, u > 1, v > 1, then (27) RESULTS At first, we define the synchronization error in cluster Ck , k = 1, 2, · · · , m as: f˜(ei ) = f (xi (t)) − f (sk (t)). (28) (29) Therefore, the dynamics of the synchronization error in cluster Ck , k = 1, · · · , m is given as follows:   bij sig xj (t) − xi (t) sigq sigp (x) = (sign(x1 )|x1 |p , · · · , sign(xn )|xn |p )T . where i = rk−1 + 1, · · · , rk and sk (t) is the target trajectory defined by (24). For i ∈ Ck , define  aij (xj (t) − xi (t))  bij (xj (t) − xi (t)) , For any vector x = (x1 , · · · , xn )T , the function sigp (x) : R → Rn is defined as: n ei (t) = xi (t) − sk (t), q  X (x − y)T (f (x) − f (y)) ≤ δ(x − y)T (x − y), δ > 0. (25) A. Cluster synchronization with m > 1 j∈Ck sigp (24) where targets in different clusters are different, i.e., sk1 (t) 6= sk2 (t), k1 6= k2 ∈ {1, · · · , m}. Function f : Rn → Rn is used to describe the intrinsic behavior of each isolated node, which satisfies the following QUAD condition: III. M AIN ẋi (t) =f (xi (t))   X p aij sig xj (t) − xi (t) +α + k = 1, 2, · · · , m, bv au + u v u where “=” holds if and only if a = bv . and for i = rk−1 + 2, · · · , rk , X ṡk (t) = f (sk (t)), ab ≤   q brk−1 +1,j sig xj (t) − xrk−1 +1 (t) q where xi = (x1i , · · · , xni )T ∈ Rn , scalars α > 0, β > 0, ǫ1 > 0, ǫ2 > 0, 0 < p < 1, q > 1, and the target trajectory sk (t) in cluster Ck is governed by (23) ėrk−1 +1 (t) = f˜(erk−1 +1 (t))   X p +α ark−1 +1,j sig ej (t) − erk−1 +1 (t) j∈Ck 6 + X sigp X j∈Ck + X  ark−1 +1,j ej (t)  X  brk−1 +1,j ej (t) j∈Ck′ k′ 6=k +β  X Theorem 1: For coupled systems (22) and (23), if A ∈ A4, α − γ1 − 2δ > 0 and β − γ2 − 2δ > 0, then the fixed-time cluster synchronization can be achieved with the settling time defined as:   brk−1 +1,j sigq ej (t) − erk−1 +1 (t) sigq k′ 6=k j∈Ck′ p Tmax = −ǫ1 sig (erk−1 +1 (t)) − ǫ2 sigq (erk−1 +1 (t)), (30) and for i = rk−1 + 2, · · · , rk , ėi (t) = f˜(ei (t))  X   X  X sigp aij ej (t) +α aij sigp ej (t) − ei (t) + j∈Ck +β X j∈Ck  X   X  sigq bij sigq ej (t) − ei (t) + bij ej (t) , j∈Ck′ k′ 6=k (31) Before giving the main result, we define some new matrices. Suppose the coupling matrices A and B in (30) and (31) satisfies that A ∈ A4 and B ∈ A4 in Definition 3 with the same cluster partition defined in (19). For k = 1, · · · , m, we define Akk = (aij )(rk −rk−1 )×(rk −rk−1 ) as: for i, j = 1, · · · , rk − rk−1 ,  2  a 1+p i 6= j rk−1 +i,rk−1 +j ; aij = (32) 2 1+p  − Pr′k −rk−1 a i=j ′; ′ j =1,j 6=i rk−1 +i,rk−1 +j We also define B kk = (bij )(rk −rk−1 )×(rk −rk−1 ) as: for i, j = 1, · · · , rk − rk−1 ,  2  b 1+q i 6= j rk−1 +i,rk−1 +j ; (33) bij = 2 1+q  − Pr′k −rk−1 b i=j ′; ′ j =1,j 6=i rk−1 +i,rk−1 +j Obviously, Akk ∈ A2 and B kk ∈ A2, k = 1, · · · , m. Moreover, define 2 Âkk = −2Akk + diag{(2ǫ1 α−1 ) 1+p , 0, · · · , 0}, B̂kk = −2B kk + diag{(2ǫ2 β −1 ) 2 1+q , 0, · · · , 0}. (35) ρ1 = min λmin (Âkk ), ρ2 = min λmin (B̂kk ); k=1,··· ,m k=1,··· ,m  X m (rk − rk−1 )(rk − rk−1 − 1) +m ; N =n 2 (36) a= max i∈Ck ,j∈Ck′ ,k6=k′ 1+p ρ1 2 , |aij |, r= p β = βN b= 1−q 2 2 q−1 2 max i∈Ck ,j∈Ck′ ,k6=k′ (37) γ1 = a r(N n) 2 , q γ2 = b r2 1+q 2 = . V̇ (t) rk m X X T ei (t) ėi (t) = +α j∈Ck X +β f˜(ei (t)) k′ 6=k j∈C k′ 6=k j∈Ck′ ′  Xk   X  q q sig bij sig ej (t) − ei (t) + bij ej =  − ǫ1 sigp (erk−1 +1 (t)) − ǫ2 sigq (erk−1 +1 (t)) ei (t)T f˜(ei (t)) k=1 i=rk−1 +1 rk m X X T ei (t) +α k=1 i=rk−1 +1 rk m X X T   aij sig ej (t) − ei (t) p sig p j∈Ck T ei (t) k=1 i=rk−1 +1 m X X X  X  aij ej (t)  X  bij ej (t) j∈Ck′ k′ 6=k k=1 i=rk−1 +1 rk X m X X ei (t)T +β X j∈Ck ei (t) k=1 i=rk−1 +1 rk m X X + ei (t)   X   X  p p sig aij sig ej (t) − ei (t) + aij ej j∈Ck  m X + eTrk−1 +1 k=1 rk m X X + T k=1 i=rk−1 +1 k=1 i=rk−1 +1 X rk X m X   bij sigq ej (t) − ei (t) sig k′ 6=k q j∈Ck′ erk−1 +1 (t)T sigp (erk−1 +1 (t)) −ǫ2 m X erk−1 +1 (t)T sigq (erk−1 +1 (t)) =Ṽ1 (t) + Ṽ2 (t) + Ṽ3 (t) + Ṽ4 (t) + Ṽ5 (t) + Ṽ6 (t) + Ṽ7 (t). k=1,··· ,m 1+p 2 Pk where Vk (t) = ri=r ei (t)T ei (t) = Ek (t)T Ek (t), and k−1 +1 T Ek (t) = (erk−1 +1 (t) , · · · , erk (t)T )T , k = 1, · · · , m. Differentiating it, we have k=1 |bij |; max [N − (rk − rk−1 )]; 1−p 2 (40) k=1 k−1 k=1 1+q ρ2 2 ; rk m m 1X X 1X ei (t)T ei (t) = Vk (t), 2 2 i=r +1 k=1 −ǫ1 k=1 p−1 2 V (t) = (34) Since Akk ∈ A2 and B kk ∈ A2, according to Lemma 4, matrices Âkk and B̂kk are positive definite, and we use λmin (Âkk ) and λmin (B̂kk ) to denote the smallest eigenvalue of Âkk and B̂kk , respectively. Denote positive scalars α = α2 where δ is as defined in (25), and positive parameters α, β, γ1 , γ2 are defined in (37) and (38). Proof: Define the Lyapunov function as j∈Ck′ k′ 6=k 2 2 , + (α − γ1 − 2δ)(1 − p) (β − γ2 − 2δ)(q − 1) (39) According to (25), one can get (38) Now, with the above notations, we will prove the following main theorem. Ṽ1 (t) ≤ δ m X rk X k=1 i=rk−1 +1 ei (t)T ei (t) = 2δV (t). (41) 7 Using (14) in Lemma 3, let r = (1 + p)/2 ∈ (0, 1), l = 1 and r < l, and combining with Lemma 5, one can get that Ṽ2 (t) + Ṽ6 (t)   m αX X T p = aij (ei (t) − ej (t)) sig ej (t) − ei (t) 2 k=1 i,j∈Ck m X − ǫ1 =− α 2 − ǫ1 T erk−1 +1 (t) k=1 n X m X X p sig (erk−1 +1 (t)) 2 elrk−1 +1 (t)2 X  aij ej (t) aij elj (t)|p j∈Ck′  |eli (t)|1+p 1+p p|elj (t)|1+p + 1+p  − (rk − rk−1 )] 1+p 2 k=1 i∈Ck l=1 i,j∈Ck 2 1+p |eli (t)||  m X X n  X l 2 ≤a r |ei (t)| aij |elj (t) − eli (t)|2  X j∈Ck′ p 2 1+p −1 k=1 k′ 6=k i=rk−1 +1 rk n X m X X X l=1 k=1 k′ 6=k i∈Ck j∈Ck′ n X m X X |eli (t)|1+p [N =ap l=1 k=1 i∈Ck |elrk−1 +1 (t)|1+p l=1 k=1 ei (t)T sigp ≤a l=1 k=1 i,j∈Ck  n m  X α XX rk X l=1 k=1 k′ 6=k i=rk−1 +1 m X X X n X X p l=1 k=1 ≤− Ṽ3 (t) m X X = ≤ aij |elj (t) − eli (t)|1+p n X m X According to the Young’s inequality in Lemma 6, we have  1+p 2 p ≤a r(N n) + (2ǫ1 α )  m  α X =− Ek (t)T [(−2Akk ) ⊗ I]Ek (t) 2 1−p 2 X m X X n |eli (t)|2 k=1 i∈Ck l=1  1+p 2 = γ1 V (t) 1+p 2 . (44) Similarly, k=1 T −1 + Ek (t) [diag{(2ǫ1 α ) 2 1+p  1+p 2 , 0, · · · , 0} ⊗ I]Ek (t)  m  1+p 2 α X Ek (t)T [Âkk ⊗ I]Ek (t) =− 2 k=1 X  1+p m 2 α T λmin (Âkk )Ek (t) Ek (t) ≤− 2 k=1  X  1+p m 2 α T ρ1 Ek (t) Ek (t) ≤− 2 k=1   1+p 2 1+p α = −αV (t) 2 . =− 2ρ1 V (t) 2 ≤ ≤− β N 2 2 l=1 k=1 (42) q  X j∈Ck′ X |eli (t)||  bij ej (t) bij elj (t)|q j∈Ck′   m X X n  X l 2 ≤b r |ei (t)| q |eli (t)|1+q 1+q q|elj (t)|1+q + 1+q 1+q 2 ≤b r X m X X n k=1 i∈Ck l=1 |eli (t)|2  1+q 2 = γ2 V (t) 1+q 2 . (45) Therefore, from (41)-(45), we have 1+p V̇ (t) ≤ 2δV (t) − (α − γ1 )V (t) 2 − (β − γ2 )V (t) ( 1+p V (t) < 1 −(α − γ1 − 2δ)V (t) 2 ; ≤ 1+q 2 −(β − γ2 − 2δ)V (t) ; V (t) ≥ 1 1+q 2 (46) According to Lemma 2, one can get that the fixed-time synchronization is finally realized, and the settling time can be also obtained as (39). The proof is completed. Remark 8: (Cluster consensus) Obviously, when f (·) = 0, then the above fixed-time cluster synchronization problem becomes the fixed-time cluster consensus problem. In this case, only if α − γ1 > 0 and β − γ2 > 0, then the fixed-time cluster consensus can be achieved with the settling time defined as: 2  1+q 2 X  1+q m 2 β 1−q T 2 Ek (t) [B̂kk ⊗ I]Ek (t) =− N 2 k=1   1+q 2 1−q 1+q β 2 ≤− N 2ρ2 V (t) = −βV (t) 2 . 2  k=1 i∈Ck l=1 q i,j∈Ck 2 ei (t) sig k=1 k′ 6=k i=rk−1 +1 rk n X m X X X l=1 k=1 k′ 6=k i∈Ck j∈Ck′ bij1+q |elj (t) − eli (t)|2 + (2ǫ2 β −1 ) 1+q elrk−1 +1 (t)2 T ≤b Ṽ4 (t) + Ṽ7 (t) n m β XX X =− bij |elj (t) − eli (t)|1+q 2 − rk X l=1 k=1 k′ 6=k i=rk−1 +1 n m q XX X X X Similarly, using (15) in Lemma 3, let l = (1+q)/2 > 1 = r, and combining with Lemma 5, one can get that l=1 k=1 i,j∈Ck n X m X ǫ2 |elrk−1 +1 (t)|1+q l=1 k=1 X n X m  X 1−q Ṽ5 (t) m X X = Tmax = (43) 2 2 . + (α − γ1 )(1 − p) (β − γ2 )(q − 1) (47) Remark 9: Let us analysis the role of parameters for fixedtime cluster synchronization. For the network model (30) 8 and (31), since the network topology is constant with time, therefore, parameters γ1 and γ2 in (38) and δ in (25) are constants. If we let ǫ1 = αω1 and ǫ2 = αω2 , then matrices Âkk and B̂kk in (34) and (35) are constant matrices independent of the parameters α and β, so ρ1 and ρ2 in (36) are constants; therefore, according to condition (39), one can get that the larger of parameters α and β, the network can realize the fixed-time cluster synchronization more quickly. Remark 10: Expect for the protocol (22) and (23), another two possible ways to realize fixed-time cluster synchronization are replacing the terms  X  X sigp aij (xj (t) − xi (t)) k′ 6=k j∈Ck′ and X sig k′ 6=k q  X j∈Ck′  bij (xj (t) − xi (t)) in (22) and (23) by terms X X  sigp aij (xj (t) − xi (t)) +β N X j=1   bij sigq xj (t) − xi (t) , (49) where xi ∈ Rn , α > 0, β > 0, 0 < p < 1, q > 1, and the target trajectory s(t) satisfies that: ṡ(t) = f (s(t)). (50) Similarly, we define A = (aij )N ×N as: for i, j = 1, · · · , N ,  2  a 1+p i 6= j ij ; (51) aij = 2 1+p  − PN a ; i=j k=1,k6=i ik We also define B = (bij )N ×N as: for i, j = 1, · · · , N ,  2  b 1+q ; i 6= j ij bij = 2 P N 1+q  − k=1,k6=i bik ; i = j (52) Moreover, define 2  = −2A + diag{(2ǫ1 α−1 ) 1+p , 0, · · · , 0}, k′ 6=k j∈Ck′ B̂ = −2B + diag{(2ǫ2 β −1 ) 2 1+q , 0, · · · , 0}. (53) (54) and sig q X X k′ 6=k j∈Ck′  bij (xj (t) − xi (t)) , or by linearly coupling terms as X X aij (xj (t) − xi (t)) Since matrices  and B̂ are positive definite, we can use λmin (Â) and λmin (B̂) to denote the smallest eigenvalue of  and B̂, respectively. Let N = n( N (N2−1) + 1), and α = α2 p−1 2 (λmin (Â)) 1+p 2 , β = βN 1−q 2 2 q−1 2 (λmin (B̂)) 1+q 2 . (55) k′ 6=k j∈Ck′ and X X bij (xj (t) − xi (t)). k′ 6=k j∈Ck′ Obviously, the combinations of these protocols are also feasible. Since there are no great differences in proving their validity for fixed-time cluster synchronization (for the linear coupling, there have been many results), here we just present these protocols, interested readers can complete the proofs. B. Complete synchronization with m = 1 When m = 1, i.e., all the nodes lie in the same cluster, then the cluster synchronization problem becomes the complete synchronization with pinning control. In this case, the network with N strongly connected nodes can be described as:   N X a1j sigp xj (t) − x1 (t) ẋ1 (t) =f (x1 (t)) + α Theorem 2: For coupled systems (48) and (49), if A ∈ A2, α − 2δ > 0 and β − 2δ > 0, then the fixed-time complete synchronization can be achieved with the settling time defined as: Tmax = +β b1j sigq j=1   xj (t) − x1 (t) − ǫ1 sigp (x1 (t) − s(t)) − ǫ2 sigq (x1 (t) − s(t)), (48) ẋ1 (t) =α N X j=1     N X q b1j sig xj − x1 a1j sig xj − x1 + β p j=1 − ǫ1 sigp (x1 (t) − s) − ǫ2 sigq (x1 (t) − s), and for i = 2, · · · , N , and for i = 2, · · · , N , ẋi (t) =f (xi (t)) + α (56) where δ is as defined in (25), and positive parameters α, β are defined in (55). Since the proof process is the same with that in Theorem 1, here we omit it. Remark 11: The network topology can be easily relaxed to be detail-balanced [20], i.e., there exist some scalars ωi > 0, such that ωi aij = ωj aji . Corollary 1: (Complete consensus) For the following complex network, j=1 N X 2 2 , + (α − 2δ)(1 − p) (β − 2δ)(q − 1) N X j=1   p aij sig xj (t) − xi (t) ẋi (t) =α N X j=1     N X q bij sig xj − xi , aij sig xj − xi + β p j=1 9 where xi ∈ R, α > 0, β > 0, 0 < p < 1, q > 1, and the target trajectory s ∈ R can be any constant scalar, the fixedtime complete consensus can be realized, i.e., xi (t) = s, i = 1, · · · , N when 2 2 , + α(1 − p) β(q − 1) t ≥ Tmax = (57) where positive parameters α, β are defined in (55). When the number of network node N = 1, then the network becomes the simplest master-slave coupled systems as: p q ẋ(t) =f (x(t)) − ǫ1 sig (x(t) − s(t)) − ǫ2 sig (x(t) − s(t)), (58) where x(t) ∈ Rn , 0 < p < 1, q > 1, and the target trajectory s(t) is defined by (50). Theorem 3: For coupled systems (58), if α − 2δ > 0 and β − 2δ > 0, then the fixed-time cluster synchronization can be achieved with the settling time defined as: Tmax = 2 2 , + (α − 2δ)(1 − p) (β − 2δ)(q − 1) (59) 1+p 2 β = ǫ2 n , 1−q 2 2 1+q 2 1 (W1 + W1T + εW2 W2T + ε−1 W3T W3 ) ≤ δI, 2 then under the following control ẋ(t) =W1 x(t) + W2 Φ(x(t)) + J − ǫ1 sigp (x(t) − x⋆ ) − ǫ2 sigq (x(t) − x⋆ ), (63) (64) the fixed-time stability can be realized, and the settling time is defined by (59). Proof: Denote f (x) = W1 x(t)+ W2 φ(x(t))+ J, one just needs to prove that the QUAD condition (25) holds. Denote e(t) = x(t) − x⋆ , and Φ̃(e(t)) = Φ(x(t)) − Φ(x⋆ ), one can get (x(t) − x⋆ )T (f (x(t)) − f (x⋆ )) =(x(t) − x⋆ )T [W1 (x(t) − x⋆ ) + W2 (Φ(x(t)) − Φ(x⋆ ))] =e(t)T [W1 e(t) + W2 Φ̃(e(t))] where δ is as defined in (25), and α = ǫ1 2 need to control the system (62) to the desired state x⋆ , where x⋆ is the equilibrium point of (62), W1 x⋆ +W2 Φ(x⋆ )+J = 0. Corollary 2: For the nonlinear system (62), if there exist two scalars δ > 0 and ε > 0, such that . (60) Proof: Define the Lyapunov function ≤e(t)T W1 e(t) + εe(t)T W2 W2T e(t) + ε−1 Φ̃(e(t))T Φ̃(e(t))   1 ≤ e(t)T W1 + W1T + εW2 W2T + ε−1 W3T W3 e(t) 2 ≤δe(t)T e(t). n V (t) = 1X l 2 1 e(t)T e(t) = e (t) , 2 2 (61) l=1 1 where e(t) = x(t) − s(t) = (e (t), · · · , en (t))T ∈ Rn . Differentiating it, we have V̇ (t) =e(t)T [f˜(e(t)) − ǫ1 sigp (e(t)) − ǫ2 sigq (e(t))] l=1 ≤2δV (t) − ǫ1 l=1 1+p l=1 l 2 e (t)  1+p 2 1+p − ǫ2 n 1−q 2 X n l 1−q =2δV (t) − ǫ1 2 2 V (t) 2 − ǫ2 n 2 2 ( 1+p V (t) < 1 −(α − 2δ)V (t) 2 ; ≤ 1+q 2 −(β − 2δ)V (t) ; V (t) ≥ 1 1+q 2 V (t) 2 e (t) l=1  1+q 2 1+q 2 IV. N UMERICAL According to Lemma 2, one can get that the fixed-time synchronization is finally realized, and the settling time can be also obtained as (59). Next, we will apply the above theorem on the fixedtime stabilization of equilibrium point for nonlinear systems, including neural networks. Consider the nonlinear function described by: ẋ(t) = W1 x(t) + W2 Φ(x(t)) + J W1 + W1T ) + kW2 kkW3 k. (65) 2 Remark 13: In [26], the stabilization of nonlinear systems is also investigated, but they concern on finite-time stabilization, while in this paper we investigate the fixed-time stabilizaPn tion. Of course, one can also use V (t) = 21 i=1 ξi ei (t)2 , ξi > 0, i = 1, · · · , n to investigate the fixed-time stabilization of the above Corollary, but in order to keep in accordance with Theorem 3, here we don’t consider the parameters ξi . δ ≥ λmax ( ≤2δV (t) − ǫ1 |e(t)|1+p − ǫ2 |e(t)|1+q n n X X 1+p 1+q =2δV (t) − ǫ1 (el (t)2 ) 2 − ǫ2 (el (t)2 ) 2 X n Then, according to Theorem 3, we can get the conclusion. Remark 12: As for the existence of δ in condition (63), one can first convert it to the matrix form, then use the Matlab toolbox Linear Matrix Inequality (LMI) to solve it. On the other hand, one can also estimate the term as: e(t)T W2 Φ̃(e(t)) ≤ kW2 kkW3 ke(t)T e(t), in this case, (62) where x(t) ∈ Rn is the state vector, Φ(x) : Rn → Rn is the nonlinear function satisfying kΦ(x) − Φ(y)k ≤ kW3 (x − y)k, ∀x, y ∈ Rn , and J is the external disturbance vector. If we EXAMPLES In this section, a simple numerical example is given to demonstrate the correctness of obtained theoretical results. Consider a network of five agents, and the original dynamical behavior x(t) of each node is described by is a 3-D neural network satisfying: ẋ(t) = f (x(t)) = −x(t) + W Φ(x(t)), (66) where x(t) = (x1 (t), x2 (t), x3 (t))T , Φ(x(t)) = (φ(x1 (t)), φ(x2 (t)), φ(x3 (t)))T , φ(v) = (|v + 1| − |v − 1|)/2, and   1.25 −3.2 −3.2 W =  −3.2 1.1 −4.4  . −3.2 4.4 1 10 +β X j=4,5 p 1.5   X   b3j xj (t) b3j sigq xj (t) − x3 (t) + sigq j=1,2 q − αsig (x3 (t) − s2 (t)) − βsig (x1 (t) − s2 (t)); 1 ẋi (t) = f (xi (t))   X   X p p aij xj (t) +α aij sig xj (t) − xi (t) + sig 0.5 0 j=1,2 j∈C2 ,j6=i −0.5 +β −1 j∈C2 ,j6=i −1.5 −2 −1 0 1 2 0 −1 −2 1 This neural network has a double-scrolling chaotic attractor, see Fig. 1. For this function f (·), from (65), one can easily get that δ = 6.1 can make the QUAD condition (25) hold. Suppose the network is partitioned into two clusters as C1 = {1, 2} and C2 = {3, 4, 5}. As for the coupling matrix, we assume that   A11 A12 , A=B= A21 A22 where  −1 1 1 −1 A21 = AT12 ,  , A12 =  A22   X   q q bij xj (t) bij sig xj (t) − xi (t) + sig j=1,2 i = 4, 5 (67) 2 Fig. 1. Chaotic attractor of 3-D neural network (66) with initial values (0.4, 0.1, −0.2)T . A11 = X  −0.1 0.3 −0.2 , 0.1 −0.3 0.2   −2 1 1 =  1 −2 1 . 1 1 −2 Assume the pinning controllers are added on the first node of each cluster, i.e., only node 1 and 3 are pinned. In this case, the network can be described by the following equations: where s1 (t) and s2 (t) are two different trajectories described by (66) with initial values s1 (0) = (0.4, 0.1, −0.2)T and s2 (0) = (0.1, 0.1, 0.1)T , respectively. Now, for p = 0.5 and q = 2, according to notations in (34) and (35), one can get that   4 4.5198 2 3 Â11 = −2A11 + diag{2 , 0} = , 2 −2   6.5198 −2 −2 4 −2 4 −2  , Â22 = −2A22 + diag{2 3 , 0, 0} =  −2 −2 4   2 3.5874 2 , B̂11 = −2B11 + diag{2 3 , 0} = 2 −2   5.5874 −2 −2 2 −2 4 −2  , Â22 = −2A22 + diag{2 3 , 0, 0} =  −2 −2 4 so parameters in (36)-(38) are: ρ1 = 0.6395, ρ2 = 0.4445, N = 18, and α = 0.6013α, β = 0.0988β, γ1 = 5.4385, γ2 = 0.5091. (68) According to Theorem 1, one can get that if α − γ1 − 2δ > 0 and β − γ2 − 2δ > 0, then α ≥ 29.3339 and β > 128.5617. Define an index v u 2 5 X uX kx − s (t)k2 (69) kx − s (t)k2 + E(t) = t i i=1 ẋ1 (t) = f (x1 (t))  X   5 a1j xj (t) + α · a12 sigp x2 (t) − x1 (t) + sigp j=3  X   5 q q b1j xj (t) + β · b12 sig x2 (t) − x1 (t) + sig j=3 − αsigp (x1 (t) − s1 (t)) − βsigq (x1 (t) − s1 (t)); ẋ2 (t) = f (x2 (t))  X   5 a2j xj (t) + α · a21 sigp x1 (t) − x2 (t) + sigp i 1 2 i=3 for cluster synchronization error. Let α = 30 and β = 130, then one can get the settling time defined by (39) is 7.3956, while the real settling time is about 0.1735, which is far less than the theoretical value, see Fig. 2. In fact, when parameters α and β are less than the calculated theoretical values, the fixed-time cluster synchronization can also be realized. In the following, we discuss the fixed-time cluster synchronization under different values of parameters, like α, β, p, q, see Fig. 3-Fig. 6. All these simulations can coincide with our previous analysis about fixed-time cluster synchronization. j=3  X   5 q q b2j xj (t) + β · b21 sig x1 (t) − x2 (t) + sig j=3 ẋ3 (t) = f (x3 (t))   X   X p p a3j xj (t) a3j sig xj (t) − x3 (t) + sig +α j=4,5 j=1,2 V. C ONCLUSION In this paper, we study the fixed-time cluster synchronization problem, while previous works often concentrate on fixed-time consensus problems without control or finite-time complete synchronization/consensus problems. We first design a new distributed protocol which can be used to realize the 11 4.5 7 p=0.5 p=0.1 p=0.001 4 6 3.5 5 3 2.5 E(t) E(t) 4 2 3 1.5 2 1 0.5 1 0 0 0 0.1 0.2 0.3 0.4 0.5 Time t 0.6 0.7 0.8 0.9 0 0.2 0.4 0.6 0.8 1 Fig. 2. Fixed-time cluster synchronization for network (67) with the settling time Tmax = 0.1375 for α = 30 and β = 130. 1 Time t 1.2 1.4 1.6 1.8 2 Fig. 5. Fixed-time cluster synchronization for network (67) with α = 5, β = 10, q = 2 and p = 0.5, 0.1, 0.001 respectively. One can find that, the smaller the p is, the faster the cluster synchronization can be realized. Moreover, the times used for the network error from the initial values to 1 are almost the same, since the parameter q in these cases are the same. 7 α=1 α=5 α=10 α=15 α=20 α=25 α=30 6 5 4.5 q=1.5 q=2 q=2.5 4 3.5 4 E(t) 3 2.5 E(t) 3 2 2 1.5 1 1 0 0 0.2 0.4 0.6 0.8 1 Time t 1.2 1.4 1.6 1.8 2 0.5 0 Fig. 3. Fixed-time cluster synchronization for network (67) under β = 1 and α = 1, 5, 10, 15, 20, 25, 30 respectively. Obviously, the larger the α is, the faster the cluster synchronization can be realized. 0 0.2 0.4 0.6 0.8 1 Time t 1.2 1.4 1.6 1.8 2 Fig. 6. Fixed-time cluster synchronization for network (67) with α = 5, β = 10, p = 0.5 and q = 1.5, 2, 2.5 respectively. One can find that, the settling times are almost the same, since the parameter p in these cases are the same. 7 β=1 β=10 β=50 β=100 β=150 6 5 E(t) 4 3 2 1 0 0 0.2 0.4 0.6 0.8 1 Time t 1.2 1.4 1.6 1.8 2 Fig. 4. Fixed-time cluster synchronization for network (67) under α = 5 and β = 1, 10, 50, 100, 150 respectively. Obviously, the larger the β is, the faster the cluster synchronization can be realized. fixed-time cluster synchronization, then rigorous proofs are given to show the validity of this new protocol. Moreover, when all the nodes in the network lie in the same cluster, it becomes the fixed-time complete synchronization problem, which is also carefully discussed, because it can contain the master-slave coupled case and the stability of the nonlinear systems case, which is applied on the investigation of the fixed-time stabilization of the equilibrium in neural networks. Finally, some numerical simulations are presented to show the correctness of our obtained theoretical results. It is hoped that this paper may shed some light on the study of fixed-time cluster synchronization via pinning control. However, there are still many challenging problems to be investigated in the next step, for example: 1) the unified form for general fixed-time cluster synchronization and finding its key property; 2) the fixed-time cluster synchronization for directed 12 networks, which is more general in the real world, while in this paper only undirected network topology is discussed; 3) the fixed-time cluster synchronization for networks with time delays; 4) the fixed-time cluster synchronization for networks with adaptive coupling mechanisms. R EFERENCES [1] L. M. Pecora and T. L. Carroll, “Master stability functions for synchronized coupled systems,” Phys. Rev. Lett., vol. 80, no. 10, pp. 2109-2112, 1998. [2] W. L. Lu and T. P. Chen, “New approach to synchronization analysis of linearly coupled ordinary differential systems,” Phys. D, Nonlinear Phenomena, vol. 213, no. 2, pp. 214-230, Jan. 2006. [3] C. W. Wu and L. O. Chua, “Synchronization in an array of linearly coupled dynamical systems,” IEEE Trans. Circuits Syst. I, Fundam. Theory Appl., vol. 42, no. 8, pp. 430-447, Aug. 1995. [4] R. Olfati-Saber and R. M. Murray, “Consensus problems in networks of agents with switching topology and time-delays,” IEEE Trans. Autom. Control, vol. 49, no. 9, pp. 1520-1533, Sep. 2004. [5] T. P. Chen, X. W. Liu, and W. L. Lu, “Pinning complex networks by a single controller,” IEEE Trans. Circuits Syst. I, Reg. Papers, vol. 54, no. 6, pp. 1317-1326, Jun. 2007. [6] T. P. Chen and Z. M. Zhu, “Exponential synchronization of nonlinear coupled dynamical networks,” Internat. J. Bifur. Chaos, vol. 17, no. 3, pp. 999-1005, Mar. 2007. [7] W. Wu, W. J. Zhou, and T. P. Chen, “Cluster synchronization of linearly coupled complex networks under pinning control,” IEEE Trans. Circuits Syst. I, Reg. Papers, vol. 56, no. 4, pp. 829-839, Apr. 2009. [8] X. W. Liu and T. P. Chen, “Cluster synchronization in directed networks via intermittent pinning control,” IEEE Trans. Neural Netw., vol. 22, no. 7, pp. 1009-1020, Jul. 2011. [9] Y. R. Liu, Z. D. Wang, J. L. Liang, and X. H. Liu, “Synchronization of coupled neutral-type neural networks with jumping-mode-dependent discrete and unbounded distributed delays,” IEEE Trans. Cybern., vol. 43, no. 1, pp. 102-114, Feb. 2013. [10] Y. Tang, H. J. Gao, W. Zou, and J. Kurths, “Distributed synchronization in networks of agent systems with nonlinearities and random switchings,” IEEE Trans. Cybern., vol. 43, no. 1, pp. 358-370, Feb. 2013. [11] X. W. Liu and T. P. Chen, “Synchronization of nonlinear coupled networks via aperiodically intermittent pinning control,” IEEE Trans. Neural Netw. Learn. Syst., vol. 26, no. 1, pp. 113-126, Jan. 2015. [12] V. T. Haimo, “Finite time controllers,” SIAM J. Control Optim., vol. 24, no. 6, pp. 760-770, Jul. 1986. [13] J. Cortés, “Finite-time convergent gradient flows with applications to network consensus,” Automatica, vol. 42, no. 11, pp. 1993-2000, Nov. 2006. [14] S. P. Bhat and D. S. Bernstein, “Continuous finite-time stabilization of the translational and rotational double integrators,” IEEE Trans. Autom. Control, vol. 43, no. 5, pp. 678-682, May 1998. [15] Y. G. Hong, Y. S. Xu and J. Huang, “Finite-time control for robot manipulators,” Syst. Control Lett., vol. 46, no. 4, pp. 243-253, Jul. 2002. [16] S. P. Bhat and D. S. Bernstein, “Finite-time stability of continuous autonomous systems,” SIAM J. Control Optim., vol. 38, no. 3, pp. 751766, Mar. 2000. [17] Y. J. Shen and X. H. Xia, “Semi-global finite-time observers for nonlinear systems,” Automatica, vol. 44, no. 12, pp. 3152-3156, Dec. 2008. [18] Y. J. Shen and Y. H. Huang, “Uniformly observable and globally lipschitzian nonlinear systems admit global finite-time observers,” IEEE Trans. Autom. Control, vol. 54, no. 11, pp. 2621-2625, Nov. 2009. [19] F. Xiao, L. Wang, J. Chen, and Y. P. Gao, “Finite-time formation control for multi-agent systems,” Automatica, vol. 45, no. 11, pp. 2605-2611, Nov. 2009. [20] L. Wang and F. Xiao, “Finite-time consensus problem for network of dynamic agents,” IEEE Trans. Autom. Control, vol. 55, no. 4, pp. 950-955, Apr. 2010. [21] F. C. Jiang and L. Wang, “Finite-time weighted average consensus with respect to a monotonic function and its application,” Syst. Control Lett., vol. 60, no. 9, pp. 718-725, Sep. 2011. [22] F. C. Jiang and L. Wang, “Finite-time information consensus for multiagent systems with fixed and switching topologies,” Physica D, vol. 238, no. 16, pp. 1550-1560, Aug. 2009. [23] X. L. Wang and Y. G. Hong, “Distributed finite-time χ-consensus algorithms for multi-agent systems with variable coupling topology,” J. Syst. Sci. Complex, vol. 23, no. 2, pp. 209-218, Apr. 2010. [24] F. L. Sun, J. C. Chen, Z. H. Guan, L. Ding, and T. Li, “Leaderfollowing finite-time consensus for multi-agent systems with jointlyreachable leader,” Nonlinear Anal.-Real, vol. 13, no. 5, pp. 2271-2284, Oct. 2012. [25] Y. Zhao, Z. S. Duan, and G. H. Wen, “Finite-time consensus for secondorder multi-agent systems with saturated control protocols,” IET Control Theory Appl., vol. 9, no. 3, pp. 312-319, Feb. 2015. [26] X. Y. Liu, D. W. C. Ho, W. W. Yu, and J. D. Cao, “A new switching design to finite-time stabilization of nonlinear systems with applications to neural networks,” Neural Networks, vol. 57, pp. 94-102, Sep. 2014. [27] X. Y. Liu, J. Lam, W. W. Yu, and G. Chen, “Finite-time consensus of multiagent systems with a switching protocol,” IEEE Trans. Neural Netw. Learn. Syst., DOI: 10.1109/TNNLS.2015.2425933. [28] X. Y. Wang, S. H. Li, and P. Shi, “Distributed Finite-time containment control for double-integrator multiagent systems,” IEEE Trans. Cybern., vol. 44, no. 9, pp. 1518-1528, Sep. 2014. [29] A. Polyakov, “Nonlinear feedback design for fixed-time stabilization of linear control systems,” IEEE Trans. Autom. Control, vol. 57, no. 8, pp. 2106-2110, Aug. 2012. [30] S. Parsegov, A. Polyakov, and P. Shcherbakov, “Nonlinear fixed-time control protocol for uniform allocation of agents on a segment,” in Proc. 51st IEEE Conf. on Decision and Control, Maui, Hawaii, USA, Dec. 2012, pp. 7732-7737. [31] S. Parsegov, A. Polyakov, and P. Shcherbakov, “Fixed-time consensus algorithm for multi-agent systems with integrator dynamics,” in Proc. 4th IFAC Workshop Distrbuted Estimation and Control in Networked System, Koblenz, Germany, Sep. 2013, pp. 110-115. [32] A. Polyakov, D. Efimov, and W. Perruquetti, “Finite-time and fixed-time stabilization: Implicit Lyapunov function approach,” Automatica, vol. 51, pp. 332-340, Jan. 2015. [33] Z. Y. Zuo and L. Tie, “A new class of finite-time nonlinear consensus protocols for multi-agent systems,” Int. J. Control, vol. 87, no. 2, pp. 363-370, Feb. 2014. [34] Z. Y. Zuo and L. Tie, “Distributed robust finite-time nonlinear consensus protocols for multi-agent systems,” Int. J. Syst. Sci., doi: 10.1080/00207721.2014.925608. [35] Z. Y. Zuo, “Non-singular fixed-time terminal sliding mode control of non-linear systems,” IET Control Theory and Applications, vol. 9, no. 4, pp. 545-552, Feb. 2015. [36] D. Y. Meng, Y. M. Jia, and J. P. Du, “Finite-time consensus for multiagent systems with cooperative and antagonistic interactions,” IEEE Trans. Neural Netw. Learn. Syst., DOI: 10.1109/TNNLS.2015.2424225 [37] Y. Chen and J. H. Lv, “Finite time synchronization of complex dynamical networks,” J. Sys. Sci. & Math. Scis., vol. 29, no. 10, pp. 1419-1430, Oct. 2009. (in Chinese) [38] Y. J. Zhou and C. Y. Sun, “Fixed time synchronization of complex dynamical networks,” in Proc. 2015 Chinese Intelligent Automation Conference, Lecture Notes in Electrical Engineering, vol. 338, pp. 163170, Mar. 2015. [39] W. L. Lu, X. W. Liu, and T. P. Chen, “Finite-time stability and synchronization with finite-time,” arXiv:1507.07160v1, submitted. [40] Z. J. Ma, Z. R. Liu, and G. Zhang, “A new method to realize cluster synchronization in connected chaotic networks,” Chaos, vol. 16, no. 2, p. 023103, Jun. 2006. [41] X. W. Liu and T. P. Chen, “Cluster synchronization for linearly coupled complex networks,” J. Industrial Manag. Optim., vol. 7, no. 1, pp. 87-101, Feb. 2011. [42] W. L. Lu, B. Liu, and T. P. Chen, “Cluster synchronization in networks of coupled nonidentical dynamical systems,” Chaos, vol. 20, no. 1, p. 013120, Mar. 2010. [43] W. X. Cui, J. A. Fang, W. B. Zhang, and X. Wang, “Finite-time cluster synchronisation of Markovian switching complex networks with stochastic perturbations,” IET Control Theory Appl., vol. 8, no. 1, pp. 30-41, Jan. 2014. [44] G. Hardy, J. Littlewood, and G. Polya, Inequalities, 2nd ed., Cambridge University Press, Cambridge, 1952.
3cs.SY
Published as a conference paper at ICLR 2015 N EURAL M ACHINE T RANSLATION BY J OINTLY L EARNING TO A LIGN AND T RANSLATE Dzmitry Bahdanau Jacobs University Bremen, Germany arXiv:1409.0473v7 [cs.CL] 19 May 2016 KyungHyun Cho Yoshua Bengio∗ Université de Montréal A BSTRACT Neural machine translation is a recently proposed approach to machine translation. Unlike the traditional statistical machine translation, the neural machine translation aims at building a single neural network that can be jointly tuned to maximize the translation performance. The models proposed recently for neural machine translation often belong to a family of encoder–decoders and encode a source sentence into a fixed-length vector from which a decoder generates a translation. In this paper, we conjecture that the use of a fixed-length vector is a bottleneck in improving the performance of this basic encoder–decoder architecture, and propose to extend this by allowing a model to automatically (soft-)search for parts of a source sentence that are relevant to predicting a target word, without having to form these parts as a hard segment explicitly. With this new approach, we achieve a translation performance comparable to the existing state-of-the-art phrase-based system on the task of English-to-French translation. Furthermore, qualitative analysis reveals that the (soft-)alignments found by the model agree well with our intuition. 1 I NTRODUCTION Neural machine translation is a newly emerging approach to machine translation, recently proposed by Kalchbrenner and Blunsom (2013), Sutskever et al. (2014) and Cho et al. (2014b). Unlike the traditional phrase-based translation system (see, e.g., Koehn et al., 2003) which consists of many small sub-components that are tuned separately, neural machine translation attempts to build and train a single, large neural network that reads a sentence and outputs a correct translation. Most of the proposed neural machine translation models belong to a family of encoder– decoders (Sutskever et al., 2014; Cho et al., 2014a), with an encoder and a decoder for each language, or involve a language-specific encoder applied to each sentence whose outputs are then compared (Hermann and Blunsom, 2014). An encoder neural network reads and encodes a source sentence into a fixed-length vector. A decoder then outputs a translation from the encoded vector. The whole encoder–decoder system, which consists of the encoder and the decoder for a language pair, is jointly trained to maximize the probability of a correct translation given a source sentence. A potential issue with this encoder–decoder approach is that a neural network needs to be able to compress all the necessary information of a source sentence into a fixed-length vector. This may make it difficult for the neural network to cope with long sentences, especially those that are longer than the sentences in the training corpus. Cho et al. (2014b) showed that indeed the performance of a basic encoder–decoder deteriorates rapidly as the length of an input sentence increases. In order to address this issue, we introduce an extension to the encoder–decoder model which learns to align and translate jointly. Each time the proposed model generates a word in a translation, it (soft-)searches for a set of positions in a source sentence where the most relevant information is concentrated. The model then predicts a target word based on the context vectors associated with these source positions and all the previous generated target words. ∗ CIFAR Senior Fellow 1 Published as a conference paper at ICLR 2015 The most important distinguishing feature of this approach from the basic encoder–decoder is that it does not attempt to encode a whole input sentence into a single fixed-length vector. Instead, it encodes the input sentence into a sequence of vectors and chooses a subset of these vectors adaptively while decoding the translation. This frees a neural translation model from having to squash all the information of a source sentence, regardless of its length, into a fixed-length vector. We show this allows a model to cope better with long sentences. In this paper, we show that the proposed approach of jointly learning to align and translate achieves significantly improved translation performance over the basic encoder–decoder approach. The improvement is more apparent with longer sentences, but can be observed with sentences of any length. On the task of English-to-French translation, the proposed approach achieves, with a single model, a translation performance comparable, or close, to the conventional phrase-based system. Furthermore, qualitative analysis reveals that the proposed model finds a linguistically plausible (soft-)alignment between a source sentence and the corresponding target sentence. 2 BACKGROUND : N EURAL M ACHINE T RANSLATION From a probabilistic perspective, translation is equivalent to finding a target sentence y that maximizes the conditional probability of y given a source sentence x, i.e., arg maxy p(y | x). In neural machine translation, we fit a parameterized model to maximize the conditional probability of sentence pairs using a parallel training corpus. Once the conditional distribution is learned by a translation model, given a source sentence a corresponding translation can be generated by searching for the sentence that maximizes the conditional probability. Recently, a number of papers have proposed the use of neural networks to directly learn this conditional distribution (see, e.g., Kalchbrenner and Blunsom, 2013; Cho et al., 2014a; Sutskever et al., 2014; Cho et al., 2014b; Forcada and Ñeco, 1997). This neural machine translation approach typically consists of two components, the first of which encodes a source sentence x and the second decodes to a target sentence y. For instance, two recurrent neural networks (RNN) were used by (Cho et al., 2014a) and (Sutskever et al., 2014) to encode a variable-length source sentence into a fixed-length vector and to decode the vector into a variable-length target sentence. Despite being a quite new approach, neural machine translation has already shown promising results. Sutskever et al. (2014) reported that the neural machine translation based on RNNs with long shortterm memory (LSTM) units achieves close to the state-of-the-art performance of the conventional phrase-based machine translation system on an English-to-French translation task.1 Adding neural components to existing translation systems, for instance, to score the phrase pairs in the phrase table (Cho et al., 2014a) or to re-rank candidate translations (Sutskever et al., 2014), has allowed to surpass the previous state-of-the-art performance level. 2.1 RNN E NCODER –D ECODER Here, we describe briefly the underlying framework, called RNN Encoder–Decoder, proposed by Cho et al. (2014a) and Sutskever et al. (2014) upon which we build a novel architecture that learns to align and translate simultaneously. In the Encoder–Decoder framework, an encoder reads the input sentence, a sequence of vectors x = (x1 , · · · , xTx ), into a vector c.2 The most common approach is to use an RNN such that ht = f (xt , ht−1 ) (1) and c = q ({h1 , · · · , hTx }) , n where ht ∈ R is a hidden state at time t, and c is a vector generated from the sequence of the hidden states. f and q are some nonlinear functions. Sutskever et al. (2014) used an LSTM as f and q ({h1 , · · · , hT }) = hT , for instance. 1 We mean by the state-of-the-art performance, the performance of the conventional phrase-based system without using any neural network-based component. 2 Although most of the previous works (see, e.g., Cho et al., 2014a; Sutskever et al., 2014; Kalchbrenner and Blunsom, 2013) used to encode a variable-length input sentence into a fixed-length vector, it is not necessary, and even it may be beneficial to have a variable-length vector, as we will show later. 2 Published as a conference paper at ICLR 2015 The decoder is often trained to predict the next word yt0 given the context vector c and all the previously predicted words {y1 , · · · , yt0 −1 }. In other words, the decoder defines a probability over the translation y by decomposing the joint probability into the ordered conditionals: p(y) = T Y p(yt | {y1 , · · · , yt−1 } , c), (2) t=1  where y = y1 , · · · , yTy . With an RNN, each conditional probability is modeled as p(yt | {y1 , · · · , yt−1 } , c) = g(yt−1 , st , c), (3) where g is a nonlinear, potentially multi-layered, function that outputs the probability of yt , and st is the hidden state of the RNN. It should be noted that other architectures such as a hybrid of an RNN and a de-convolutional neural network can be used (Kalchbrenner and Blunsom, 2013). 3 L EARNING TO A LIGN AND T RANSLATE In this section, we propose a novel architecture for neural machine translation. The new architecture consists of a bidirectional RNN as an encoder (Sec. 3.2) and a decoder that emulates searching through a source sentence during decoding a translation (Sec. 3.1). 3.1 D ECODER : G ENERAL D ESCRIPTION In a new model architecture, we define each conditional probability in Eq. (2) as: yt-1 yt p(yi |y1 , . . . , yi−1 , x) = g(yi−1 , si , ci ), s t-1 st (4) where si is an RNN hidden state for time i, computed by + si = f (si−1 , yi−1 , ci ). It should be noted that unlike the existing encoder–decoder approach (see Eq. (2)), here the probability is conditioned on a distinct context vector ci for each target word yi . The context vector ci depends on a sequence of annotations (h1 , · · · , hTx ) to which an encoder maps the input sentence. Each annotation hi contains information about the whole input sequence with a strong focus on the parts surrounding the i-th word of the input sequence. We explain in detail how the annotations are computed in the next section. The context vector ci is, then, computed as a weighted sum of these annotations hi : ci = Tx X αij hj . (5) αt,1 αt,2 αt,T αt,3 h1 h2 h3 hT h1 h2 h3 hT x1 x2 x3 xT Figure 1: The graphical illustration of the proposed model trying to generate the t-th target word yt given a source sentence (x1 , x2 , . . . , xT ). j=1 The weight αij of each annotation hj is computed by exp (eij ) , αij = PTx k=1 exp (eik ) (6) where eij = a(si−1 , hj ) is an alignment model which scores how well the inputs around position j and the output at position i match. The score is based on the RNN hidden state si−1 (just before emitting yi , Eq. (4)) and the j-th annotation hj of the input sentence. We parametrize the alignment model a as a feedforward neural network which is jointly trained with all the other components of the proposed system. Note that unlike in traditional machine translation, 3 Published as a conference paper at ICLR 2015 the alignment is not considered to be a latent variable. Instead, the alignment model directly computes a soft alignment, which allows the gradient of the cost function to be backpropagated through. This gradient can be used to train the alignment model as well as the whole translation model jointly. We can understand the approach of taking a weighted sum of all the annotations as computing an expected annotation, where the expectation is over possible alignments. Let αij be a probability that the target word yi is aligned to, or translated from, a source word xj . Then, the i-th context vector ci is the expected annotation over all the annotations with probabilities αij . The probability αij , or its associated energy eij , reflects the importance of the annotation hj with respect to the previous hidden state si−1 in deciding the next state si and generating yi . Intuitively, this implements a mechanism of attention in the decoder. The decoder decides parts of the source sentence to pay attention to. By letting the decoder have an attention mechanism, we relieve the encoder from the burden of having to encode all information in the source sentence into a fixedlength vector. With this new approach the information can be spread throughout the sequence of annotations, which can be selectively retrieved by the decoder accordingly. 3.2 E NCODER : B IDIRECTIONAL RNN FOR A NNOTATING S EQUENCES The usual RNN, described in Eq. (1), reads an input sequence x in order starting from the first symbol x1 to the last one xTx . However, in the proposed scheme, we would like the annotation of each word to summarize not only the preceding words, but also the following words. Hence, we propose to use a bidirectional RNN (BiRNN, Schuster and Paliwal, 1997), which has been successfully used recently in speech recognition (see, e.g., Graves et al., 2013). → − A BiRNN consists of forward and backward RNN’s. The forward RNN f reads the input sequence → − → − as it is ordered (from x1 to xTx ) and calculates a sequence of forward hidden states ( h 1 , · · · , h Tx ). ← − The backward RNN f reads the sequence in the reverse order (from xTx to x1 ), resulting in a ← − ← − sequence of backward hidden states ( h 1 , · · · , h Tx ). → − We obtain an annotation for each word xj by concatenating the forward hidden state h j and the h→ ← − − ← − > i> backward one h j , i.e., hj = h > . In this way, the annotation hj contains the summaries j ; hj of both the preceding words and the following words. Due to the tendency of RNNs to better represent recent inputs, the annotation hj will be focused on the words around xj . This sequence of annotations is used by the decoder and the alignment model later to compute the context vector (Eqs. (5)–(6)). See Fig. 1 for the graphical illustration of the proposed model. 4 E XPERIMENT S ETTINGS We evaluate the proposed approach on the task of English-to-French translation. We use the bilingual, parallel corpora provided by ACL WMT ’14.3 As a comparison, we also report the performance of an RNN Encoder–Decoder which was proposed recently by Cho et al. (2014a). We use the same training procedures and the same dataset for both models.4 4.1 DATASET WMT ’14 contains the following English-French parallel corpora: Europarl (61M words), news commentary (5.5M), UN (421M) and two crawled corpora of 90M and 272.5M words respectively, totaling 850M words. Following the procedure described in Cho et al. (2014a), we reduce the size of the combined corpus to have 348M words using the data selection method by Axelrod et al. (2011).5 We do not use any monolingual data other than the mentioned parallel corpora, although it may be possible to use a much larger monolingual corpus to pretrain an encoder. We concatenate news-test3 http://www.statmt.org/wmt14/translation-task.html Implementations are available at https://github.com/lisa-groundhog/GroundHog. 5 Available online at http://www-lium.univ-lemans.fr/˜schwenk/cslm_joint_paper/. 4 4 Published as a conference paper at ICLR 2015 30 BLEU score 25 Figure 2: The BLEU scores of the generated translations on the test set with respect to the lengths of the sentences. The results are on the full test set which includes sentences having unknown words to the models. 20 15 RNNsearch-50 RNNsearch-30 RNNenc-50 RNNenc-30 10 5 0 0 10 20 30 40 50 60 Sentence length 2012 and news-test-2013 to make a development (validation) set, and evaluate the models on the test set (news-test-2014) from WMT ’14, which consists of 3003 sentences not present in the training data. After a usual tokenization6 , we use a shortlist of 30,000 most frequent words in each language to train our models. Any word not included in the shortlist is mapped to a special token ([UNK]). We do not apply any other special preprocessing, such as lowercasing or stemming, to the data. 4.2 M ODELS We train two types of models. The first one is an RNN Encoder–Decoder (RNNencdec, Cho et al., 2014a), and the other is the proposed model, to which we refer as RNNsearch. We train each model twice: first with the sentences of length up to 30 words (RNNencdec-30, RNNsearch-30) and then with the sentences of length up to 50 word (RNNencdec-50, RNNsearch-50). The encoder and decoder of the RNNencdec have 1000 hidden units each.7 The encoder of the RNNsearch consists of forward and backward recurrent neural networks (RNN) each having 1000 hidden units. Its decoder has 1000 hidden units. In both cases, we use a multilayer network with a single maxout (Goodfellow et al., 2013) hidden layer to compute the conditional probability of each target word (Pascanu et al., 2014). We use a minibatch stochastic gradient descent (SGD) algorithm together with Adadelta (Zeiler, 2012) to train each model. Each SGD update direction is computed using a minibatch of 80 sentences. We trained each model for approximately 5 days. Once a model is trained, we use a beam search to find a translation that approximately maximizes the conditional probability (see, e.g., Graves, 2012; Boulanger-Lewandowski et al., 2013). Sutskever et al. (2014) used this approach to generate translations from their neural machine translation model. For more details on the architectures of the models and training procedure used in the experiments, see Appendices A and B. 5 R ESULTS 5.1 Q UANTITATIVE R ESULTS In Table 1, we list the translation performances measured in BLEU score. It is clear from the table that in all the cases, the proposed RNNsearch outperforms the conventional RNNencdec. More importantly, the performance of the RNNsearch is as high as that of the conventional phrase-based translation system (Moses), when only the sentences consisting of known words are considered. This is a significant achievement, considering that Moses uses a separate monolingual corpus (418M words) in addition to the parallel corpora we used to train the RNNsearch and RNNencdec. 6 7 We used the tokenization script from the open-source machine translation package, Moses. In this paper, by a ’hidden unit’, we always mean the gated hidden unit (see Appendix A.1.1). 5 It should be noted that the marine environment is the least known of environments . <end> The agreement on the European Economic Area was signed in August 1992 . <end> Published as a conference paper at ICLR 2015 L' accord sur la zone économique européenne a été signé en août 1992 . <end> Il convient de noter que l' environnement marin est le moins connu de l' environnement . <end> (b) " This will change my future with my family , " the man said . <end> Destruction of the equipment means that Syria can no longer produce new chemical weapons . <end> (a) La destruction de l' équipement signifie que la Syrie ne peut plus produire de nouvelles armes chimiques . <end> " Cela va changer mon avenir avec ma famille " , a dit l' homme . <end> (c) (d) Figure 3: Four sample alignments found by RNNsearch-50. The x-axis and y-axis of each plot correspond to the words in the source sentence (English) and the generated translation (French), respectively. Each pixel shows the weight αij of the annotation of the j-th source word for the i-th target word (see Eq. (6)), in grayscale (0: black, 1: white). (a) an arbitrary sentence. (b–d) three randomly selected samples among the sentences without any unknown words and of length between 10 and 20 words from the test set. One of the motivations behind the proposed approach was the use of a fixed-length context vector in the basic encoder–decoder approach. We conjectured that this limitation may make the basic encoder–decoder approach to underperform with long sentences. In Fig. 2, we see that the performance of RNNencdec dramatically drops as the length of the sentences increases. On the other hand, both RNNsearch-30 and RNNsearch-50 are more robust to the length of the sentences. RNNsearch50, especially, shows no performance deterioration even with sentences of length 50 or more. This superiority of the proposed model over the basic encoder–decoder is further confirmed by the fact that the RNNsearch-30 even outperforms RNNencdec-50 (see Table 1). 6 Published as a conference paper at ICLR 2015 Model RNNencdec-30 RNNsearch-30 RNNencdec-50 RNNsearch-50 RNNsearch-50? Moses 5.2 5.2.1 All 13.93 21.50 17.82 26.75 28.45 33.30 No UNK◦ 24.19 31.44 26.71 34.16 36.15 35.63 Table 1: BLEU scores of the trained models computed on the test set. The second and third columns show respectively the scores on all the sentences and, on the sentences without any unknown word in themselves and in the reference translations. Note that RNNsearch-50? was trained much longer until the performance on the development set stopped improving. (◦) We disallowed the models to generate [UNK] tokens when only the sentences having no unknown words were evaluated (last column). Q UALITATIVE A NALYSIS A LIGNMENT The proposed approach provides an intuitive way to inspect the (soft-)alignment between the words in a generated translation and those in a source sentence. This is done by visualizing the annotation weights αij from Eq. (6), as in Fig. 3. Each row of a matrix in each plot indicates the weights associated with the annotations. From this we see which positions in the source sentence were considered more important when generating the target word. We can see from the alignments in Fig. 3 that the alignment of words between English and French is largely monotonic. We see strong weights along the diagonal of each matrix. However, we also observe a number of non-trivial, non-monotonic alignments. Adjectives and nouns are typically ordered differently between French and English, and we see an example in Fig. 3 (a). From this figure, we see that the model correctly translates a phrase [European Economic Area] into [zone économique européen]. The RNNsearch was able to correctly align [zone] with [Area], jumping over the two words ([European] and [Economic]), and then looked one word back at a time to complete the whole phrase [zone économique européenne]. The strength of the soft-alignment, opposed to a hard-alignment, is evident, for instance, from Fig. 3 (d). Consider the source phrase [the man] which was translated into [l’ homme]. Any hard alignment will map [the] to [l’] and [man] to [homme]. This is not helpful for translation, as one must consider the word following [the] to determine whether it should be translated into [le], [la], [les] or [l’]. Our soft-alignment solves this issue naturally by letting the model look at both [the] and [man], and in this example, we see that the model was able to correctly translate [the] into [l’]. We observe similar behaviors in all the presented cases in Fig. 3. An additional benefit of the soft alignment is that it naturally deals with source and target phrases of different lengths, without requiring a counter-intuitive way of mapping some words to or from nowhere ([NULL]) (see, e.g., Chapters 4 and 5 of Koehn, 2010). 5.2.2 L ONG S ENTENCES As clearly visible from Fig. 2 the proposed model (RNNsearch) is much better than the conventional model (RNNencdec) at translating long sentences. This is likely due to the fact that the RNNsearch does not require encoding a long sentence into a fixed-length vector perfectly, but only accurately encoding the parts of the input sentence that surround a particular word. As an example, consider this source sentence from the test set: An admitting privilege is the right of a doctor to admit a patient to a hospital or a medical centre to carry out a diagnosis or a procedure, based on his status as a health care worker at a hospital. The RNNencdec-50 translated this sentence into: Un privilège d’admission est le droit d’un médecin de reconnaı̂tre un patient à l’hôpital ou un centre médical d’un diagnostic ou de prendre un diagnostic en fonction de son état de santé. 7 Published as a conference paper at ICLR 2015 The RNNencdec-50 correctly translated the source sentence until [a medical center]. However, from there on (underlined), it deviated from the original meaning of the source sentence. For instance, it replaced [based on his status as a health care worker at a hospital] in the source sentence with [en fonction de son état de santé] (“based on his state of health”). On the other hand, the RNNsearch-50 generated the following correct translation, preserving the whole meaning of the input sentence without omitting any details: Un privilège d’admission est le droit d’un médecin d’admettre un patient à un hôpital ou un centre médical pour effectuer un diagnostic ou une procédure, selon son statut de travailleur des soins de santé à l’hôpital. Let us consider another sentence from the test set: This kind of experience is part of Disney’s efforts to ”extend the lifetime of its series and build new relationships with audiences via digital platforms that are becoming ever more important,” he added. The translation by the RNNencdec-50 is Ce type d’expérience fait partie des initiatives du Disney pour ”prolonger la durée de vie de ses nouvelles et de développer des liens avec les lecteurs numériques qui deviennent plus complexes. As with the previous example, the RNNencdec began deviating from the actual meaning of the source sentence after generating approximately 30 words (see the underlined phrase). After that point, the quality of the translation deteriorates, with basic mistakes such as the lack of a closing quotation mark. Again, the RNNsearch-50 was able to translate this long sentence correctly: Ce genre d’expérience fait partie des efforts de Disney pour ”prolonger la durée de vie de ses séries et créer de nouvelles relations avec des publics via des plateformes numériques de plus en plus importantes”, a-t-il ajouté. In conjunction with the quantitative results presented already, these qualitative observations confirm our hypotheses that the RNNsearch architecture enables far more reliable translation of long sentences than the standard RNNencdec model. In Appendix C, we provide a few more sample translations of long source sentences generated by the RNNencdec-50, RNNsearch-50 and Google Translate along with the reference translations. 6 6.1 R ELATED W ORK L EARNING TO A LIGN A similar approach of aligning an output symbol with an input symbol was proposed recently by Graves (2013) in the context of handwriting synthesis. Handwriting synthesis is a task where the model is asked to generate handwriting of a given sequence of characters. In his work, he used a mixture of Gaussian kernels to compute the weights of the annotations, where the location, width and mixture coefficient of each kernel was predicted from an alignment model. More specifically, his alignment was restricted to predict the location such that the location increases monotonically. The main difference from our approach is that, in (Graves, 2013), the modes of the weights of the annotations only move in one direction. In the context of machine translation, this is a severe limitation, as (long-distance) reordering is often needed to generate a grammatically correct translation (for instance, English-to-German). Our approach, on the other hand, requires computing the annotation weight of every word in the source sentence for each word in the translation. This drawback is not severe with the task of translation in which most of input and output sentences are only 15–40 words. However, this may limit the applicability of the proposed scheme to other tasks. 8 Published as a conference paper at ICLR 2015 6.2 N EURAL N ETWORKS FOR M ACHINE T RANSLATION Since Bengio et al. (2003) introduced a neural probabilistic language model which uses a neural network to model the conditional probability of a word given a fixed number of the preceding words, neural networks have widely been used in machine translation. However, the role of neural networks has been largely limited to simply providing a single feature to an existing statistical machine translation system or to re-rank a list of candidate translations provided by an existing system. For instance, Schwenk (2012) proposed using a feedforward neural network to compute the score of a pair of source and target phrases and to use the score as an additional feature in the phrase-based statistical machine translation system. More recently, Kalchbrenner and Blunsom (2013) and Devlin et al. (2014) reported the successful use of the neural networks as a sub-component of the existing translation system. Traditionally, a neural network trained as a target-side language model has been used to rescore or rerank a list of candidate translations (see, e.g., Schwenk et al., 2006). Although the above approaches were shown to improve the translation performance over the stateof-the-art machine translation systems, we are more interested in a more ambitious objective of designing a completely new translation system based on neural networks. The neural machine translation approach we consider in this paper is therefore a radical departure from these earlier works. Rather than using a neural network as a part of the existing system, our model works on its own and generates a translation from a source sentence directly. 7 C ONCLUSION The conventional approach to neural machine translation, called an encoder–decoder approach, encodes a whole input sentence into a fixed-length vector from which a translation will be decoded. We conjectured that the use of a fixed-length context vector is problematic for translating long sentences, based on a recent empirical study reported by Cho et al. (2014b) and Pouget-Abadie et al. (2014). In this paper, we proposed a novel architecture that addresses this issue. We extended the basic encoder–decoder by letting a model (soft-)search for a set of input words, or their annotations computed by an encoder, when generating each target word. This frees the model from having to encode a whole source sentence into a fixed-length vector, and also lets the model focus only on information relevant to the generation of the next target word. This has a major positive impact on the ability of the neural machine translation system to yield good results on longer sentences. Unlike with the traditional machine translation systems, all of the pieces of the translation system, including the alignment mechanism, are jointly trained towards a better log-probability of producing correct translations. We tested the proposed model, called RNNsearch, on the task of English-to-French translation. The experiment revealed that the proposed RNNsearch outperforms the conventional encoder–decoder model (RNNencdec) significantly, regardless of the sentence length and that it is much more robust to the length of a source sentence. From the qualitative analysis where we investigated the (soft-)alignment generated by the RNNsearch, we were able to conclude that the model can correctly align each target word with the relevant words, or their annotations, in the source sentence as it generated a correct translation. Perhaps more importantly, the proposed approach achieved a translation performance comparable to the existing phrase-based statistical machine translation. It is a striking result, considering that the proposed architecture, or the whole family of neural machine translation, has only been proposed as recently as this year. We believe the architecture proposed here is a promising step toward better machine translation and a better understanding of natural languages in general. One of challenges left for the future is to better handle unknown, or rare words. This will be required for the model to be more widely used and to match the performance of current state-of-the-art machine translation systems in all contexts. 9 Published as a conference paper at ICLR 2015 ACKNOWLEDGMENTS The authors would like to thank the developers of Theano (Bergstra et al., 2010; Bastien et al., 2012). We acknowledge the support of the following agencies for research funding and computing support: NSERC, Calcul Québec, Compute Canada, the Canada Research Chairs and CIFAR. Bahdanau thanks the support from Planet Intelligent Systems GmbH. We also thank Felix Hill, Bart van Merriénboer, Jean Pouget-Abadie, Coline Devin and Tae-Ho Kim. R EFERENCES Axelrod, A., He, X., and Gao, J. (2011). Domain adaptation via pseudo in-domain data selection. In Proceedings of the ACL Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 355–362. Association for Computational Linguistics. Bastien, F., Lamblin, P., Pascanu, R., Bergstra, J., Goodfellow, I. J., Bergeron, A., Bouchard, N., and Bengio, Y. (2012). Theano: new features and speed improvements. Deep Learning and Unsupervised Feature Learning NIPS 2012 Workshop. Bengio, Y., Simard, P., and Frasconi, P. (1994). Learning long-term dependencies with gradient descent is difficult. IEEE Transactions on Neural Networks, 5(2), 157–166. Bengio, Y., Ducharme, R., Vincent, P., and Janvin, C. (2003). A neural probabilistic language model. J. Mach. Learn. Res., 3, 1137–1155. Bergstra, J., Breuleux, O., Bastien, F., Lamblin, P., Pascanu, R., Desjardins, G., Turian, J., WardeFarley, D., and Bengio, Y. (2010). Theano: a CPU and GPU math expression compiler. In Proceedings of the Python for Scientific Computing Conference (SciPy). Oral Presentation. Boulanger-Lewandowski, N., Bengio, Y., and Vincent, P. (2013). Audio chord recognition with recurrent neural networks. In ISMIR. Cho, K., van Merrienboer, B., Gulcehre, C., Bougares, F., Schwenk, H., and Bengio, Y. (2014a). Learning phrase representations using RNN encoder-decoder for statistical machine translation. In Proceedings of the Empiricial Methods in Natural Language Processing (EMNLP 2014). to appear. Cho, K., van Merriënboer, B., Bahdanau, D., and Bengio, Y. (2014b). On the properties of neural machine translation: Encoder–Decoder approaches. In Eighth Workshop on Syntax, Semantics and Structure in Statistical Translation. to appear. Devlin, J., Zbib, R., Huang, Z., Lamar, T., Schwartz, R., and Makhoul, J. (2014). Fast and robust neural network joint models for statistical machine translation. In Association for Computational Linguistics. Forcada, M. L. and Ñeco, R. P. (1997). Recursive hetero-associative memories for translation. In J. Mira, R. Moreno-Dı́az, and J. Cabestany, editors, Biological and Artificial Computation: From Neuroscience to Technology, volume 1240 of Lecture Notes in Computer Science, pages 453–462. Springer Berlin Heidelberg. Goodfellow, I., Warde-Farley, D., Mirza, M., Courville, A., and Bengio, Y. (2013). Maxout networks. In Proceedings of The 30th International Conference on Machine Learning, pages 1319– 1327. Graves, A. (2012). Sequence transduction with recurrent neural networks. In Proceedings of the 29th International Conference on Machine Learning (ICML 2012). Graves, A. (2013). Generating sequences with recurrent neural networks. arXiv:1308.0850 [cs.NE]. Graves, A., Jaitly, N., and Mohamed, A.-R. (2013). Hybrid speech recognition with deep bidirectional LSTM. In Automatic Speech Recognition and Understanding (ASRU), 2013 IEEE Workshop on, pages 273–278. 10 Published as a conference paper at ICLR 2015 Hermann, K. and Blunsom, P. (2014). Multilingual distributed representations without word alignment. In Proceedings of the Second International Conference on Learning Representations (ICLR 2014). Hochreiter, S. (1991). Untersuchungen zu dynamischen neuronalen Netzen. Diploma thesis, Institut für Informatik, Lehrstuhl Prof. Brauer, Technische Universität München. Hochreiter, S. and Schmidhuber, J. (1997). Long short-term memory. Neural Computation, 9(8), 1735–1780. Kalchbrenner, N. and Blunsom, P. (2013). Recurrent continuous translation models. In Proceedings of the ACL Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1700–1709. Association for Computational Linguistics. Koehn, P. (2010). Statistical Machine Translation. Cambridge University Press, New York, NY, USA. Koehn, P., Och, F. J., and Marcu, D. (2003). Statistical phrase-based translation. In Proceedings of the 2003 Conference of the North American Chapter of the Association for Computational Linguistics on Human Language Technology - Volume 1, NAACL ’03, pages 48–54, Stroudsburg, PA, USA. Association for Computational Linguistics. Pascanu, R., Mikolov, T., and Bengio, Y. (2013a). On the difficulty of training recurrent neural networks. In ICML’2013. Pascanu, R., Mikolov, T., and Bengio, Y. (2013b). On the difficulty of training recurrent neural networks. In Proceedings of the 30th International Conference on Machine Learning (ICML 2013). Pascanu, R., Gulcehre, C., Cho, K., and Bengio, Y. (2014). How to construct deep recurrent neural networks. In Proceedings of the Second International Conference on Learning Representations (ICLR 2014). Pouget-Abadie, J., Bahdanau, D., van Merriënboer, B., Cho, K., and Bengio, Y. (2014). Overcoming the curse of sentence length for neural machine translation using automatic segmentation. In Eighth Workshop on Syntax, Semantics and Structure in Statistical Translation. to appear. Schuster, M. and Paliwal, K. K. (1997). Bidirectional recurrent neural networks. Signal Processing, IEEE Transactions on, 45(11), 2673–2681. Schwenk, H. (2012). Continuous space translation models for phrase-based statistical machine translation. In M. Kay and C. Boitet, editors, Proceedings of the 24th International Conference on Computational Linguistics (COLIN), pages 1071–1080. Indian Institute of Technology Bombay. Schwenk, H., Dchelotte, D., and Gauvain, J.-L. (2006). Continuous space language models for statistical machine translation. In Proceedings of the COLING/ACL on Main conference poster sessions, pages 723–730. Association for Computational Linguistics. Sutskever, I., Vinyals, O., and Le, Q. (2014). Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems (NIPS 2014). Zeiler, M. D. (2012). [cs.LG]. ADADELTA: An adaptive learning rate method. 11 arXiv:1212.5701 Published as a conference paper at ICLR 2015 A M ODEL A RCHITECTURE A.1 A RCHITECTURAL C HOICES The proposed scheme in Section 3 is a general framework where one can freely define, for instance, the activation functions f of recurrent neural networks (RNN) and the alignment model a. Here, we describe the choices we made for the experiments in this paper. A.1.1 R ECURRENT N EURAL N ETWORK For the activation function f of an RNN, we use the gated hidden unit recently proposed by Cho et al. (2014a). The gated hidden unit is an alternative to the conventional simple units such as an element-wise tanh. This gated unit is similar to a long short-term memory (LSTM) unit proposed earlier by Hochreiter and Schmidhuber (1997), sharing with it the ability to better model and learn long-term dependencies. This is made possible by having computation paths in the unfolded RNN for which the product of derivatives is close to 1. These paths allow gradients to flow backward easily without suffering too much from the vanishing effect (Hochreiter, 1991; Bengio et al., 1994; Pascanu et al., 2013a). It is therefore possible to use LSTM units instead of the gated hidden unit described here, as was done in a similar context by Sutskever et al. (2014). The new state si of the RNN employing n gated hidden units8 is computed by si = f (si−1 , yi−1 , ci ) = (1 − zi ) ◦ si−1 + zi ◦ s̃i , where ◦ is an element-wise multiplication, and zi is the output of the update gates (see below). The proposed updated state s̃i is computed by s̃i = tanh (W e(yi−1 ) + U [ri ◦ si−1 ] + Cci ) , where e(yi−1 ) ∈ Rm is an m-dimensional embedding of a word yi−1 , and ri is the output of the reset gates (see below). When yi is represented as a 1-of-K vector, e(yi ) is simply a column of an embedding matrix E ∈ Rm×K . Whenever possible, we omit bias terms to make the equations less cluttered. The update gates zi allow each hidden unit to maintain its previous activation, and the reset gates ri control how much and what information from the previous state should be reset. We compute them by zi = σ (Wz e(yi−1 ) + Uz si−1 + Cz ci ) , ri = σ (Wr e(yi−1 ) + Ur si−1 + Cr ci ) , where σ (·) is a logistic sigmoid function. At each step of the decoder, we compute the output probability (Eq. (4)) as a multi-layered function (Pascanu et al., 2014). We use a single hidden layer of maxout units (Goodfellow et al., 2013) and normalize the output probabilities (one for each word) with a softmax function (see Eq. (6)). A.1.2 A LIGNMENT M ODEL The alignment model should be designed considering that the model needs to be evaluated Tx × Ty times for each sentence pair of lengths Tx and Ty . In order to reduce computation, we use a singlelayer multilayer perceptron such that a(si−1 , hj ) = va> tanh (Wa si−1 + Ua hj ) , where Wa ∈ Rn×n , Ua ∈ Rn×2n and va ∈ Rn are the weight matrices. Since Ua hj does not depend on i, we can pre-compute it in advance to minimize the computational cost. 8 Here, we show the formula of the decoder. The same formula can be used in the encoder by simply ignoring the context vector ci and the related terms. 12 Published as a conference paper at ICLR 2015 A.2 A.2.1 D ETAILED D ESCRIPTION OF THE M ODEL E NCODER In this section, we describe in detail the architecture of the proposed model (RNNsearch) used in the experiments (see Sec. 4–5). From here on, we omit all bias terms in order to increase readability. The model takes a source sentence of 1-of-K coded word vectors as input x = (x1 , . . . , xTx ), xi ∈ RKx and outputs a translated sentence of 1-of-K coded word vectors y = (y1 , . . . , yTy ), yi ∈ RKy , where Kx and Ky are the vocabulary sizes of source and target languages, respectively. Tx and Ty respectively denote the lengths of source and target sentences. First, the forward states of the bidirectional recurrent neural network (BiRNN) are computed: ( → − → − − − → − (1 − → z i ) ◦ h i−1 + → z i ◦ h i , if i > 0 hi = 0 , if i = 0 where − i → − − → → − h− → h i = tanh W Exi + U → r i ◦ h i−1 −  − → → − → → − z i =σ W z Exi + U z h i−1 −  − → → − → → − r i =σ W r Exi + U r h i−1 . − → − → − → → − → − → − E ∈ Rm×Kx is the word embedding matrix. W , W z , W r ∈ Rn×m , U , U z , U r ∈ Rn×n are weight matrices. m and n are the word embedding dimensionality and the number of hidden units, respectively. σ(·) is as usual a logistic sigmoid function. ← − ← − The backward states ( h 1 , · · · , h Tx ) are computed similarly. We share the word embedding matrix E between the forward and backward RNNs, unlike the weight matrices. We concatenate the forward and backward states to to obtain the annotations (h1 , h2 , · · · , hTx ), where " → − # hi hi = ← (7) − hi A.2.2 D ECODER The hidden state si of the decoder given the annotations from the encoder is computed by si =(1 − zi ) ◦ si−1 + zi ◦ s̃i , where s̃i = tanh (W Eyi−1 + U [ri ◦ si−1 ] + Cci ) zi =σ (Wz Eyi−1 + Uz si−1 + Cz ci ) ri =σ (Wr Eyi−1 + Ur si−1 + Cr ci ) E is the word embedding matrix for the target language. W, Wz , Wr ∈ Rn×m , U, Uz , Ur ∈ Rn×n , and C, Cz , Cr ∈ Rn×2n are weights. Again, m and n are the word embedding dimensionality and the of hidden units, respectively. The initial hidden state s0 is computed by s0 =  number ← −  tanh Ws h 1 , where Ws ∈ Rn×n . The context vector ci are recomputed at each step by the alignment model: ci = Tx X αij hj , j=1 13 Published as a conference paper at ICLR 2015 Model RNNenc-30 RNNenc-50 RNNsearch-30 RNNsearch-50 RNNsearch-50? Updates (×105 ) 8.46 6.00 4.71 2.88 6.67 Epochs 6.4 4.5 3.6 2.2 5.0 Hours 109 108 113 111 252 GPU TITAN BLACK Quadro K-6000 TITAN BLACK Quadro K-6000 Quadro K-6000 Train NLL 28.1 44.0 26.7 40.7 36.7 Dev. NLL 53.0 43.6 47.2 38.1 35.2 Table 2: Learning statistics and relevant information. Each update corresponds to updating the parameters once using a single minibatch. One epoch is one pass through the training set. NLL is the average conditional log-probabilities of the sentences in either the training set or the development set. Note that the lengths of the sentences differ. where exp (eij ) αij = PTx k=1 exp (eik ) eij =va> tanh (Wa si−1 + Ua hj ) , 0 0 and hj is the j-th annotation in the source sentence (see Eq. (7)). va ∈ Rn , Wa ∈ Rn ×n and 0 Ua ∈ Rn ×2n are weight matrices. Note that the model becomes RNN Encoder–Decoder (Cho → − et al., 2014a), if we fix ci to h Tx . With the decoder state si−1 , the context ci and the last generated word yi−1 , we define the probability of a target word yi as  p(yi |si , yi−1 , ci ) ∝ exp yi> Wo ti , where   > ti = max t̃i,2j−1 , t̃i,2j j=1,...,l and t̃i,k is the k-th element of a vector t̃i which is computed by t̃i =Uo si−1 + Vo Eyi−1 + Co ci . Wo ∈ RKy ×l , Uo ∈ R2l×n , Vo ∈ R2l×m and Co ∈ R2l×2n are weight matrices. This can be understood as having a deep output (Pascanu et al., 2014) with a single maxout hidden layer (Goodfellow et al., 2013). A.2.3 M ODEL S IZE For all the models used in this paper, the size of a hidden layer n is 1000, the word embedding dimensionality m is 620 and the size of the maxout hidden layer in the deep output l is 500. The number of hidden units in the alignment model n0 is 1000. B B.1 T RAINING P ROCEDURE PARAMETER I NITIALIZATION ← − ← − ← − → − → − → − We initialized the recurrent weight matrices U, Uz , Ur , U , U z , U r , U , U z and U r as random orthogonal matrices. For Wa and Ua , we initialized them by sampling each element from the Gaussian distribution of mean 0 and variance 0.0012 . All the elements of Va and all the bias vectors were initialized to zero. Any other weight matrix was initialized by sampling from the Gaussian distribution of mean 0 and variance 0.012 . B.2 T RAINING We used the stochastic gradient descent (SGD) algorithm. Adadelta (Zeiler, 2012) was used to automatically adapt the learning rate of each parameter ( = 10−6 and ρ = 0.95). We explicitly 14 Published as a conference paper at ICLR 2015 normalized the L2 -norm of the gradient of the cost function each time to be at most a predefined threshold of 1, when the norm was larger than the threshold (Pascanu et al., 2013b). Each SGD update direction was computed with a minibatch of 80 sentences. At each update our implementation requires time proportional to the length of the longest sentence in a minibatch. Hence, to minimize the waste of computation, before every 20-th update, we retrieved 1600 sentence pairs, sorted them according to the lengths and split them into 20 minibatches. The training data was shuffled once before training and was traversed sequentially in this manner. In Tables 2 we present the statistics related to training all the models used in the experiments. C T RANSLATIONS OF L ONG S ENTENCES Source Reference RNNenc-50 RNNsearch-50 Google Translate Source Reference RNNenc-50 RNNsearch-50 Google Translate Source Reference RNNenc-50 RNNsearch-50 Google Translate An admitting privilege is the right of a doctor to admit a patient to a hospital or a medical centre to carry out a diagnosis or a procedure, based on his status as a health care worker at a hospital. Le privilège d’admission est le droit d’un médecin, en vertu de son statut de membre soignant d’un hôpital, d’admettre un patient dans un hôpital ou un centre médical afin d’y délivrer un diagnostic ou un traitement. Un privilège d’admission est le droit d’un médecin de reconnaı̂tre un patient à l’hôpital ou un centre médical d’un diagnostic ou de prendre un diagnostic en fonction de son état de santé. Un privilège d’admission est le droit d’un médecin d’admettre un patient à un hôpital ou un centre médical pour effectuer un diagnostic ou une procédure, selon son statut de travailleur des soins de santé à l’hôpital. Un privilège admettre est le droit d’un médecin d’admettre un patient dans un hôpital ou un centre médical pour effectuer un diagnostic ou une procédure, fondée sur sa situation en tant que travailleur de soins de santé dans un hôpital. This kind of experience is part of Disney’s efforts to ”extend the lifetime of its series and build new relationships with audiences via digital platforms that are becoming ever more important,” he added. Ce type d’expérience entre dans le cadre des efforts de Disney pour ”étendre la durée de vie de ses séries et construire de nouvelles relations avec son public grâce à des plateformes numériques qui sont de plus en plus importantes”, a-t-il ajouté. Ce type d’expérience fait partie des initiatives du Disney pour ”prolonger la durée de vie de ses nouvelles et de développer des liens avec les lecteurs numériques qui deviennent plus complexes. Ce genre d’expérience fait partie des efforts de Disney pour ”prolonger la durée de vie de ses séries et créer de nouvelles relations avec des publics via des plateformes numériques de plus en plus importantes”, a-t-il ajouté. Ce genre d’expérience fait partie des efforts de Disney à “étendre la durée de vie de sa série et construire de nouvelles relations avec le public par le biais des plates-formes numériques qui deviennent de plus en plus important”, at-il ajouté. In a press conference on Thursday, Mr Blair stated that there was nothing in this video that might constitute a ”reasonable motive” that could lead to criminal charges being brought against the mayor. En conférence de presse, jeudi, M. Blair a affirmé qu’il n’y avait rien dans cette vidéo qui puisse constituer des ”motifs raisonnables” pouvant mener au dépôt d’une accusation criminelle contre le maire. Lors de la conférence de presse de jeudi, M. Blair a dit qu’il n’y avait rien dans cette vidéo qui pourrait constituer une ”motivation raisonnable” pouvant entraı̂ner des accusations criminelles portées contre le maire. Lors d’une conférence de presse jeudi, M. Blair a déclaré qu’il n’y avait rien dans cette vidéo qui pourrait constituer un ”motif raisonnable” qui pourrait conduire à des accusations criminelles contre le maire. Lors d’une conférence de presse jeudi, M. Blair a déclaré qu’il n’y avait rien dans cette vido qui pourrait constituer un ”motif raisonnable” qui pourrait mener à des accusations criminelles portes contre le maire. Table 3: The translations generated by RNNenc-50 and RNNsearch-50 from long source sentences (30 words or more) selected from the test set. For each source sentence, we also show the goldstandard translation. The translations by Google Translate were made on 27 August 2014. 15
9cs.NE