问题标签 [latin-square]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
r - Experimental design in R: balanced incomplete block design
I would like to generate a matrix to plan an experiment.
- I have 6 individuals and 6 treatments delivered in 6 days.
- I can use 1 individual per week (6 weeks of 6 days in total = 36 days of testings with 6 treatments a day).
- Every day, I will test 6 treatments on the individual in a random order. An individual should not start with the same treatment any day of the week.
For example:
- If possible, different individuals should not have the same order that the others.
- I would like to take into account order treatment; that is each pair of treatments following each other should be repeated as equally often as possible to avoid "carryover" (sequence and order) effects. I am working with R at the moment but could also work with MATLAB.
I have tried to work out a design with the package "agricolae" and the package "crossdes" but no success so far. My ideas were to use a balanced incomplete block design. An example of one of my code follows.
python - 在 Python 中创建拉丁方程序
我正在尝试输入一个订单,然后输入一个左上角的金额,并让它从那里创建一个拉丁方块。问题是,我不知道如何让它在行和列中计数。该程序仅将左上角的数字排列在大小顺序 x 顺序的方形网格中。
javascript - Animate Javascript Canvas while in recursive calculation
I'm trying to animate a solution to the latin-square-problem in javascript.
To do so, I wrote the recursive backtracking algorithm below.
Solving the problem is initiated by calling search(0,0)
and it works just fine, displaying a solution after calculating. But I want it to show an animation on it's progress, in terms of redrawing the whole canvas, after changing the colour of one square.
I tried to incoorporate many of the solutions to similar problems, found on stackoverflow or in tutorials about canvas gameloops. Neither of them worked for me, so I'm presenting the javascript code as close as possible to my pseudo-code algorithm (without any setTimeout
's or requestAnimationFrame
's)
Here's a working jsfiddle containing all the code.
directed-acyclic-graphs - DAG 算法和拉丁方问题
每个拉丁方格对应一个格子排列的有向无环图,其边表示顺序(<)
。例如:
(来源:享受数独网)
我有兴趣确定哪些拉丁方格具有唯一的顺序,即其对应的 DAG 不允许其他有效的顶点标签。
一个有效的标签在行和列中保持唯一性,并且还满足由边指定的顺序关系。
我找不到任何有关此类特定标签问题的参考资料。这是否意味着 DAG 结构对这种分析不是特别有用?
这与对 Futoshiki 谜题的唯一性研究有关。
algorithm - 创建所有可能的拉丁方格的算法
我需要算法方面的帮助,该算法可以创建最多 n=10 的所有拉丁方格。当我创建了 n! 拉丁方格和我之后尝试置换行和列,所以它给了我 n!*n!*n! 拉丁方格,但根据维基百科 ( https://en.wikipedia.org/wiki/Latin_square ) 这个扩展名 n! 拉丁方格是错误的。没有人知道如何获得所有可能的拉丁方格吗?
java - 在Java中我必须检查给定的矩阵是否是拉丁方
我的老师给了我们一个矩阵,我们应该编写一个代码来检查它是否是拉丁方格。我有所有的东西,但我无法把它们整理好,这样它们才能工作。这就是她让我们阅读她创建的矩阵的内容。
文本文件是 matrix.txt,这是它包含的内容。
3
1 2 3
3 1 2
2 3 1
正如你所看到的,这是一个拉丁方格,然而,她说我们可以更改矩阵以确保它适用于她给我们提出的其他问题。
}
这是我目前拥有的代码。它去哪儿了?
而且我也不知道这是怎么回事...
spss - 如何在 IBM SPSS 中分析拉丁方设计?
我进行了一个拉丁方设计的实验。
如何将 IBM SPSS 中的数据整理到一个文件中进行分析?我看过这个视频https://www.youtube.com/watch?v=APvlPjYSSaI,其中组(例如,第 1 组 = 第 1 组,第 2 组 = 第 2 组,第 3 组 = 第 3 组)到测量的时间段。但是在视频的例子中,治疗的顺序是一样的(不像我的例子那样排列在拉丁方格中)。那么我应该如何在SPSS中排列来自拉丁方设计的数据呢?
这是一个受试者内部设计,因为我在每次治疗后测量我的因变量(每个受试者测量因变量的 3 倍)。每个 Block 包含 5 个科目。
matlab - 使用 MATLAB 创建拉丁方阵
我对 MATLAB 很生疏,我正试图通过自动化一些拉丁方问题来复习。我正在处理的代码如下:
我希望这段代码检查值A(i,j)
以确定[1,...,n]
第 i 行中是否已经存在来自的值,然后从中选择随机值
基本上我只是想强行完成部分拉丁方块。
编辑:
我不是要生成随机的拉丁方格,而是要生成具有某些属性的方格。例如,假设我们有以下设置:
其中 0,X,Y,Z 都是 3x3 子矩阵,X,Y,Z 的值来自 1,...,9。我正在尝试设计一种自动化方法来完成具有一些值的部分拉丁方格。
python-3.x - 制作拉丁方块
我试图为一些学校作业完成一个问题,而我只是遇到了人类见过的最糟糕的脑放屁情况。这个问题要求三件事。
• 它自己读取一行上的数字N。这将是一个拉丁正方形的顺序。顺序必须是正整数,例如 N > 0。
• 它读取N 行N 的数字,即,它读取控制台输入的正方形数字。
• 它检查数字序列是否是拉丁方格。如果您的程序满足上述标准,则应显示消息“是”,否则应显示“否”。
我目前的代码是这样的:
所以我想到的是,做一个拉丁方块,然后检查它。我的问题是,我目前停留在 makelatin 部分。用户输入拉丁方格的顺序,然后他们在输入中输入方格。
例子:
哪个会做一个像这样的拉丁方
这不需要制作一个正方形,但它确实帮助我更好地想象它。
所以我的主要问题是,有没有一种好方法可以让用户将拉丁方输入到实际的拉丁方中?
需要注意的是,我不是在寻找任何答案,我只是想要一些帮助来克服我的心理障碍。
java - 为什么这个程序只能找到一个解决方案?
我想编写一个程序来找到拉丁方的所有解决方案。我想使用回溯来做到这一点。我使用类似的方法解决了 n-queens 问题并且它有效。此代码仅找到第一个解决方案,并且不会回溯。
我知道我的代码看起来很糟糕,但我稍后会重构它;)感谢您的帮助:)