是的。你有什麼是system of linear equations,每行一個,每列一個; m * n個變量和m + n個方程。
如何計算(並表示)解決方案集解決這樣一個系統取決於你的環境是什麼。
編輯:我明白了。有關此問題的大量情況,請參閱integer programming。
但是,如果您的矩陣和行/列總和很小,則可以通過backtracking找到所有解決方案。非常高級別的僞代碼:
function SOLVE(partially filled M) {
if (M has no empty entries) {
M is a solution
} else {
ij <- one empty position of M
// in practice, try picking one that reduces the number of
// iterations of the following loop
for (each possible value v of M[ij], subject to the constraints) {
M' <- a copy of M
M'[ij] = v
SOLVE(M')
}
}
M0 <- an empty Matrix of correct size
SOLVE(M0)
線性方程組的結果系統如何確保矩陣條目是正的(實際上可能是「非負的」)? – Codor
基本上,環境就像輸入行和列的總和並獲得滿足這些總和的所有可能的矩陣集合的輸出。 – user2751130