find different combinations of splitting a vector

1 回表示 (過去 30 日間)
Elysi Cochin
Elysi Cochin 2020 年 3 月 23 日
編集済み: Elysi Cochin 2020 年 3 月 25 日
having a vector V, how can i find the different ways to split this vector v into subvectors such that the sum of each subvector does not exceed limit K
  1 件のコメント
John D'Errico
John D'Errico 2020 年 3 月 23 日
This question is so wildly vague as to be virtually impossible to give an intelligent answer.
What is the real vector length that your REAL problem has? Often the answer is hundreds or thousands of elements, in which case the answer is tyou don't have a large enough computer.
Are there replicate elements in the vector?
Does order matter?
Must each segment be as large as possible?
Lots of other questions that are left unresolved.

サインインしてコメントする。

採用された回答

Fangjun Jiang
Fangjun Jiang 2020 年 3 月 23 日
編集済み: Fangjun Jiang 2020 年 3 月 23 日
try
nchoosek(V,1)
nchoosek(V,2)
% ...
nchoosek(V,8)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by