specific assignments of vector items

1 回表示 (過去 30 日間)
Michal
Michal 2019 年 3 月 28 日
I am looking for suitable algorithm to solve the following problem:
For vector v (Nx1, double, single) I need to find assigments of items of this vector (pairs) that fulfil following conditions:
  1. Each item is in assigned in only one pair
  2. sum of item distances over all assigned pairs (violation) is minimal
  3. as an input of the function is additional parameter vio_max which limits violation of non assignment
[pairs,dist, vio] = findpairs(v,vio_max)
ExampleA:
Input: v = [3.0 2.1 0.9 2.9 1.1 ] , vio_max = 1.0
Output: pairs = [1 4; 3 5], dist = [0.1; 0.2], vio = sum(dist) = 0.3
and item 2.1 remains unassigned (for lenght(v) is odd)
ExampleB:
Input: v = [3.0 2.1 0.9 2.9 1.1 ] , vio_max = 0.15
Output: pairs = [1 4], dist = [0.1], vio = sum(dist) = 0.1

回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by