Optimization/Dynamic Programming to Find Least Sum from Elements of Two Arrays
Mostra commenti meno recenti
Given the following optimization problem,
Find the least sum (globally optimized) from elements of two arrays A and B such that
- Only one element is selected from A or B at each index, i.e., when A(1) is selected, B(1) cannot be selected
- Total sum of elements selected from array B should be <= 57
- Atleast one element should be selected at each index
A = [10, 15, 17, 30, 45]
B= [7, 10, 15, 26, 31]
Basically, elements of B will always be less than elements of A at every index. However, there is a limit on the maximum sum of elements that can be used from B.
2 Commenti
John D'Errico
il 15 Mag 2018
But now, having shown two simple vectors A and B, what would the solution be that you want to see? As far as I can see, the least sum there is gained by taking no elements at all.
Or perhaps, the least sum is gained from just B(1).
Must your solution have a total of 5 elements chosen? So the choice is simply whether you choose from vectors A or B for each index?
Neeraj Rama
il 16 Mag 2018
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Solver Outputs and Iterative Display in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!