instruction
stringlengths
0
29.8k
⌀
null
Admittedly I haven't fully wrapped my head around the paper yet, but I'm curious if this algorithm can be adapted to say, a one dimensional cellular automata with two states, and an even sized neighborhood, there are references in the paper to "neighbor radius" and neighborhood size of 2r+1. But the reversibility of ne...
Can Sutner's (1991) quadratic algorithm for testing reversibility of Cellular Automata be applied to 1-D CA with even sized neighborhoods?
|graphs|time-complexity|cellular-automata|
I will assume that $\delta(u,v)$ denotes the *distance* from $u$ to $v$ in $G$ (and not the shortest path) and that $\delta(u,v) = +\infty$ if $v$ is not reachable from $u$. You can write: $$\sum_{u\in V}\sum_{v\in V}\delta(u,v) = \frac{1}{2} \cdot\sum_{u\in V}\sum_{v\in V} \left( \delta(u,v) + \delta(v,u) \right...
Most constructs / schemes in programming serve an essential purpose (sometimes more than one), for instance : - Structs in essentially C's solution to the problem of providing user defined data types. - Classes in C, Python, generalize the concept and allow for OO programming. - Templates or type parameters or ...
What is the motivation behind (purpose of) "macros" in languages such as Rust, Nim, Crystal, etc.?
|meta-programming|
I need to create an implementation of a directed weighted multigraph with dynamic edges: The edges will be changing during the pathfinding, in the following way:[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/LbdYd.png Summary of the pathfinding: 1. Pathfinding starts at **S**. ...
Directed weighted multigraph with dynamic edges - shortest path
|graphs|graph-traversal|weighted-graphs|
You can model the problem you have by creating, for each location, a set of vertices, each saying "arrive at X in time Y", for all Ys which are a departing time of a transportation from X. Then, for each possible transportation service, you'd add a path from its departing time at its departing place to the departing...
You can model the problem you have by creating, for each location, a set of vertices, each saying "arrive at X in time Y", for all Ys which are a departing time of a transportation from X. Then, for each possible transportation service, you'd add a path from its departing time at its departing place to the departing...
A CA with neighborhood size $s$ can be trivially emulated by a CA with any neighborhood size $s' > s$ that just ignores the extra cells in the neighborhood. So if the method works for CA with odd neighborhood size, then it can be trivially applied to CA with an even neighborhood size simply by adding one cell to the ne...
A CA with neighborhood size $s$ can be trivially emulated by a CA with any neighborhood size $s' > s$ that just ignores the extra cells in the neighborhood. So if the method works for CA with odd neighborhood size, then it can also be applied to CA with an even neighborhood size simply by adding one cell to the neighbo...
How to read a DFA that uses carry bits?
Does infinite run time violate Turing completeness? Shouldn't "completeness" include halting? --- The halting problem: > The halting problem is a decision problem about properties of computer > programs on a fixed **Turing-complete** model of computation > > ... > > The problem is to determine, given a p...
Does infinite run time violate Turing completeness? Shouldn't "completeness" include halting?
null
* There are `n` jobs each consisting of two parts: `a` and `b`. * There are two people: * person `A` is completing part `a` of each job (one at a time), and * person `B` is completing part `b` of each job (also one at a time). * We are given for each `i`: * `a[i]` : the time that it takes to complete part `a...
A scheduling problem
|algorithms|scheduling|
* There are `n` jobs each consisting of two parts: `a` and `b`. * There are two people: * person `A` is completing part `a` of each job (one at a time), and * person `B` is completing part `b` of each job (also one at a time). * **Constraint:** part `a` of each job must be completed **before** part `b` * We ar...
null
What you are looking for is [Johnson's algorithm for job scheduling](https://en.wikipedia.org/wiki/Johnson%27s_rule). Johnson's algorithm works as follows on the situation described in the question. 1. Select a part of a job with the shortest completion time (break ties arbitrarily). Suppose the job is jo...
Scheduling jobs with two people where part (a) of each job must be finished before part (b)
|algorithms|greedy-algorithms|scheduling|
null
null
{"Voters":[{"Id":157600,"DisplayName":"Patrick"}],"DeleteType":1}
null
null
null
Why doesn't infinite run time violate Turing completeness? Shouldn't "completeness" include halting? --- The halting problem: > The halting problem is a decision problem about properties of computer > programs on a fixed **Turing-complete** model of computation > > ... > > The problem is to determine, gi...
Why doesn't infinite run time violate Turing completeness? Shouldn't "completeness" include halting?
How to read a DFA for digit summation that uses carry bits?
I'm trying to understand how to create a DFA on the language $\{a,b\}$ that accepts strings where the number of $a$s is **not** a multiple of n. Creating a DFA with no. of $a$s divisible by $n$ is easy. One simply makes $n$ states such that the string ends into the accept state per every $n$ of e.g. $a$s. I've fi...
null
null
Consider the following optimisation problem that its size is parameterised by $n$ (width) and $m$ (depth): Find $w_1, w_2, \ldots, w_n$ that minmises: $$ \min \Big[w_1x_1^0 + w_2x_2^0 + \ldots + w_nx_n^0 \Big] $$ Subject to: $$ w_1x_1^1 + w_2x_2^1 + \ldots + w_nx_n^1 $$ $$ w_1x_1^2 + w_2x_2^2 + \ldots +...
What's the most scalable solver of this problem?
|algorithms|asymptotics|
Consider the following optimisation problem that its size is parameterised by $n$ (width) and $m$ (depth): Find $w_1, w_2, \ldots, w_n$ that minmises: $$ \min \Big[w_1x_1^0 + w_2x_2^0 + \ldots + w_nx_n^0 \Big] $$ Subject to: $$ b^1_{\min} \le w_1x_1^1 + w_2x_2^1 + \ldots + w_nx_n^1 \le b^1_{\max} $$ $$ ...
It is widely known that the emptiness of counter automata is undecidable since two counters are enough to simulate a Turing machine (see the classic book from Hopcroft and Ullman, for example). However, what happens if we put a bound $k$ on the values stored by the counters? In this restricted model, the counters ca...
null
Consider the following optimisation problem that its size is parameterised by $n$ (width) and $m$ (depth): Find $w_1, w_2, \ldots, w_n$ that minmises: $$ \min \Big[w_1x_1^0 + w_2x_2^0 + \ldots + w_nx_n^0 \Big] $$ Subject to: $$ b^1_{\min} \le w_1x_1^1 + w_2x_2^1 + \ldots + w_nx_n^1 \le b^1_{\max} $$ $$ ...
Consider the following optimisation problem that its size is parameterised by $n$ (width) and $m$ (depth): Find $w_1, w_2, \ldots, w_n$ that minmises: $$ \min \Big[w_1x_1^0 + w_2x_2^0 + \ldots + w_nx_n^0 \Big] $$ Subject to: $$ b^1_{\min} \le w_1x_1^1 + w_2x_2^1 + \ldots + w_nx_n^1 \le b^1_{\max} $$ $$ ...
null
I have a sampled function sruface $$ z = f(x, y) $$ represented as a grayscale raster image. How to find the upper convex hull of that surface. That is I am looking for the minimal $$ g(x, y) $$ such that $$ g(x, y) \geq f(x, y), \text{Eigenvalues}(\text{Hessian}(g)) < 0 $$ It is possible to co...
Compute upper convex hull of a function surface
|convex-hull|
null
I am an undergraduate student in mathematics. I have a fair bit of experience with deep learning in computer vision research and am willing to dabble into NLP. I hope that things won't be very disjointed and some of the knowledge can be transferred. I wanted to know if y'all can recommend some YouTube playlists that...
Resources to learn NLP
|machine-learning|reference-request|natural-language-processing|
Let $G=(V,E)$ be a flow network with two vertices $s,t$ also each edge has its capacity equal to $\infty$. Our goal is to transfer a flow of size $C$ from $s$ to $t$ so that minimize an edge that has highest flow value in it. I geuss by $O(1) $ times using the Ford-Felkerson we can minimize such an edge. First let $...
Minimize bottleneck in flow network
|algorithms|network-flow|
I was wondering about a solution for the following problem: > Given a directed graph $G=(V,E)$ and a subset of vertices $U \subseteq V$ suggest an algorithm that finds if there is a directed path (the path can revisit vertices/edges) that visits every node in U I was thinking about running DFS\BFS from each verte...
Algorithm for finding a path that visits each node in a given subset
|algorithms|graphs|
null
I'm trying to create an algorithm that finds the minimum number of swaps to convert array A into array B. In this case the arrays can only contain the numbers 0, 1 or 2. So for example: given `a = [0, 2, 1, 2] and b = [1, 2, 0, 2]`. The minimum number of swaps to convert a into b is 1, namely swap a[0] and a[2]. ...
Algorithm to find minimum amount of swaps to convert array A into array B with repeated elements
|algorithms|sorting|arrays|
Suppose I have a rank $k$ matrix $A \in \mathbf{R}^{m \times n}$. Now suppose this matrix has its elements shuffled by an adversary to maximize the rank. Is there a way to reverse this permutation and recover the low-rank structure? As follow-ups, what about with sparsity assumptions on the matrix or when k is very sma...
Permuting matrix entries to lower rank
|optimization|matrices|data-compression|linear-algebra|permutations|
> my approach is to sort one of the arrays in ascending order, and one in descending order and pair them up Yes, that's optimal. You pair the smallest x-value $x$ with the largest y-value $Y$. Suppose that's a mistake, i.e., you end up with a solution worse than some optimal better solution which pairs $x$ with s...
null
Suppose I have a rank $k$ matrix $A \in \mathbf{R}^{m \times n}$. Now suppose this matrix has its elements shuffled by an adversary to maximize the rank. Is there a way to reverse this permutation and recover the low-rank structure? As follow-ups, what about with sparsity assumptions on the matrix or when k is very sma...
null
null
Let's say if we have an infinite process that never yields such that other process dosent get to run. Since FCFS is a non preemptive scheduler does it leads to starvation
Is Starvation possible in First Come first serve CPU scheduling algorithm
|operating-systems|process-scheduling|
null
I'm trying to create an algorithm that finds the minimum number of swaps to convert array A into array B. In this case the arrays can only contain the numbers 0, 1 or 2. So for example: given `a = [0, 2, 1, 2] and b = [1, 2, 0, 2]`. The minimum number of swaps to convert a into b is 1, namely swap a[0] and a[2]. ...
null
From the NumPy documentation: > "NumPy arrays have a fixed size at creation, unlike Python lists (which can grow dynamically). Changing the size of an ndarray will create a new array and delete the original." To my understanding, this would make the numpy array *immutable*, but from what I've seen, they're actua...
Can somebody explain to me the concept of mutability with respect to a NumPy array?
|arrays|python|
Ignore already correct A-values. If you can correct two A-values by swapping them, do so. This leaves you with 3-cycles, all 0→1→2→0 or all 0→2→1→0. Each can be corrected with two swaps. Python implementation, where I keep count of the different mismatches: ```python from collections import Counter def solve(...
I am using the book Elements of the Theory of Computation (2nd edition), which has been fine until now. However, I am stuck trying to grasp the Machine Turing conveyed in Example 4.1.8 (pages 189-190). I cannot make sense of the copying machine portrayed in Figure 4-8. Can someone help me understand with an input word ...
Can someone help me understand this Turing Machine?
|turing-machines|
null
Let us reverse the question. In other words, consider the dual question. Instead of minimizing the highest flow value of all edges that can transfer a flow of size $C$, let us compute the maximum flow value of the network if every edge has capacity $x$. Suppose that maximum flow value is $m$, which can be comput...
Let $G=(V,E)$ be a flow network with two vertices $s,t$ also each edge has its capacity equal to $\infty$. Our goal is to transfer a flow of size $C$ from $s$ to $t$ so that minimize an edge that has highest flow value in it. I guess by $O(1) $ times using the Ford-Fulkerson we can minimize such an edge. First let $...
|algorithms|optimization|network-flow|duality|
Store the window in a self-balancing binary search tree, augmented in the standard way for computing item ranks (each node is augmented with the number of values stored in the subtree rooted at that node). Each time a value arrives, add it to the tree, remove the one leaving the window, compute the median, and outp...
null
Just because the *size* of the array is fixed doesn't mean it is immutable. In an immutable array, both the size and the contents must be immutable. With a Numpy array, you can change its contents (the values at each position) in place, without creating a new array.
Hint: >! Work through a few small examples of graphs. Draw a few graphs with <= 8 vertices on a piece of paper, mark a subset of vertices, and check whether there is a path. See what patterns can spot from trying to solve each one by hand, one small problem at a time. If that's not enough, here's a bigger hint: ...
This is an instance of linear programming, so you can solve it with any LP solver. Any instance of linear programming can be represented in this form. For instance, minimize $c^\top w$ subject to $Aw \le b$ can be represented by setting $b^i_\max = b_i$, $x^i_j = A_{i,j}$, $b^i_\min=-\infty$, $x^0_j=c_j$. Therefor...
Suppose I have a rank-$k$ matrix $A \in \mathbf{R}^{m \times n}$. Now suppose this matrix has its elements shuffled by an adversary to maximize the rank. Is there a way to reverse this permutation and recover the low-rank structure? As follow-ups, what about with sparsity assumptions on the matrix or when $k$ is very s...
null
{"Voters":[{"Id":4287,"DisplayName":"Hendrik Jan"},{"Id":755,"DisplayName":"D.W."}]}
You can show this fact by a quick proof by contradiction. If you are not familiar with proof by contradiction, I recommend you read up on it to understand how it works. And you should also know that regular languages are closed under complement. This means that if a language is regular, then its complement must also be...
Let us reverse the question. In other words, consider the dual question. Instead of minimizing the highest flow value of all edges that can transfer a flow of size $C$, let us compute the maximum flow value of the network if every edge has capacity $x$. Suppose that maximum flow value is $m$, which can be comput...