optimal separation of vector on pairs of its elementsMatlab: optimal-distance matching of the elements of two setsvectorize/optimize this code in MATLAB?How to pair vectors with different lengths?How to vectorize vector-matrix element-by-element operation?How to generate unique pairs of the elements of a vector - ignoring the order of the pair elementsFind the minimum difference between any pair of elements between two vectorsfind pair elements in 2 vectorsHow to assign a matrix to several several vectors at once?Motion vectors between pairs of pointsOptimizing bilinear interpolation / Vectorizing

Is it possible to take a database offline when doing a backup using an SQL job?

How big would the ice ball have to be to deliver all the water at once?

What are one's options when facing religious discrimination at the airport?

IEEE 754 square root with Newton-Raphson

Are devices supposed to automatically be removed from iCloud when all content and settings are erased?

Impossible violin chord, how to fix this?

GPLv3 forces us to make code available, but to who?

Was the ruling that prorogation was unlawful only possible because of the creation of a separate supreme court?

Why aren't faces sharp in my f/1.8 portraits even though I'm carefully using center-point autofocus?

Which Catholic priests were given diplomatic missions?

How to translate "it's right to leave this world better than you found it"?

Earliest time frog can jump to the other side of a river in C#. Codility's task

Windows 10 deletes lots of tiny files super slowly. Anything that can be done to speed it up?

How do my husband and I get over our fear of having another difficult baby?

Calculate the Ultraradical

Would allowing versatile weapons wielded in two hands to benefit from Dueling be unbalanced?

Would an object shot from earth fall into the sun?

How is the Apple Watch ECG disabled in certain countries?

What would influence an alien race to map their planet in a way other than the traditional map of the Earth

How deep is the liquid in a half-full hemisphere?

Can the President of the US limit First Amendment rights?

How to visualize an ordinal variable predicting a continuous outcome?

Isn't the detector always measuring, and thus always collapsing the state?

Why has Speaker Pelosi been so hesitant to impeach President Trump?



optimal separation of vector on pairs of its elements


Matlab: optimal-distance matching of the elements of two setsvectorize/optimize this code in MATLAB?How to pair vectors with different lengths?How to vectorize vector-matrix element-by-element operation?How to generate unique pairs of the elements of a vector - ignoring the order of the pair elementsFind the minimum difference between any pair of elements between two vectorsfind pair elements in 2 vectorsHow to assign a matrix to several several vectors at once?Motion vectors between pairs of pointsOptimizing bilinear interpolation / Vectorizing






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















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



Note:
Problem is completely solved, see: https://cs.stackexchange.com/questions/106214/find-separate-pairs-of-points-with-minimal-total-distance










share|improve this question


























  • I assume that you also want to somehow favor more pairs being generated, otherwise the answer in both examples would be pairs = [1 4] (ignoring the trivial pairs = []). Given a choice between 3 pairs with cost a and 2 pairs with cost b, how do you choose between the two options?

    – beaker
    Mar 29 at 23:03











  • The linked solution is fine. You've neglected to include vio_max, but that just breaks the problem down into subsets.

    – beaker
    Apr 1 at 20:54

















0















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



Note:
Problem is completely solved, see: https://cs.stackexchange.com/questions/106214/find-separate-pairs-of-points-with-minimal-total-distance










share|improve this question


























  • I assume that you also want to somehow favor more pairs being generated, otherwise the answer in both examples would be pairs = [1 4] (ignoring the trivial pairs = []). Given a choice between 3 pairs with cost a and 2 pairs with cost b, how do you choose between the two options?

    – beaker
    Mar 29 at 23:03











  • The linked solution is fine. You've neglected to include vio_max, but that just breaks the problem down into subsets.

    – beaker
    Apr 1 at 20:54













0












0








0








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



Note:
Problem is completely solved, see: https://cs.stackexchange.com/questions/106214/find-separate-pairs-of-points-with-minimal-total-distance










share|improve this question
















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



Note:
Problem is completely solved, see: https://cs.stackexchange.com/questions/106214/find-separate-pairs-of-points-with-minimal-total-distance







matlab variable-assignment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 1 at 7:03







michalkvasnicka

















asked Mar 28 at 19:46









michalkvasnickamichalkvasnicka

386 bronze badges




386 bronze badges















  • I assume that you also want to somehow favor more pairs being generated, otherwise the answer in both examples would be pairs = [1 4] (ignoring the trivial pairs = []). Given a choice between 3 pairs with cost a and 2 pairs with cost b, how do you choose between the two options?

    – beaker
    Mar 29 at 23:03











  • The linked solution is fine. You've neglected to include vio_max, but that just breaks the problem down into subsets.

    – beaker
    Apr 1 at 20:54

















  • I assume that you also want to somehow favor more pairs being generated, otherwise the answer in both examples would be pairs = [1 4] (ignoring the trivial pairs = []). Given a choice between 3 pairs with cost a and 2 pairs with cost b, how do you choose between the two options?

    – beaker
    Mar 29 at 23:03











  • The linked solution is fine. You've neglected to include vio_max, but that just breaks the problem down into subsets.

    – beaker
    Apr 1 at 20:54
















I assume that you also want to somehow favor more pairs being generated, otherwise the answer in both examples would be pairs = [1 4] (ignoring the trivial pairs = []). Given a choice between 3 pairs with cost a and 2 pairs with cost b, how do you choose between the two options?

– beaker
Mar 29 at 23:03





I assume that you also want to somehow favor more pairs being generated, otherwise the answer in both examples would be pairs = [1 4] (ignoring the trivial pairs = []). Given a choice between 3 pairs with cost a and 2 pairs with cost b, how do you choose between the two options?

– beaker
Mar 29 at 23:03













The linked solution is fine. You've neglected to include vio_max, but that just breaks the problem down into subsets.

– beaker
Apr 1 at 20:54





The linked solution is fine. You've neglected to include vio_max, but that just breaks the problem down into subsets.

– beaker
Apr 1 at 20:54












0






active

oldest

votes














Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405750%2foptimal-separation-of-vector-on-pairs-of-its-elements%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405750%2foptimal-separation-of-vector-on-pairs-of-its-elements%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript