How can i bound initial guess during optimization
3 views (last 30 days)
Show older comments
i have initial Guess
A= [ 0 30 0 30 30 30 30 30];
i don't want compiler take other values than 0 or 30. It should change only sequence.
7 Comments
Walter Roberson
on 19 Dec 2015
Do you need the solutions to be permutations of A, so that in theory you could just try all the permutations and take the best one? Or do you need the upper bound to be 30 and the lower bound to be 0 and you accept all values between those two?
Which optimization routine are you calling?
Answers (1)
Walter Roberson
on 20 Dec 2015
Which input to ga() does this represent? If this is your x vector that is not explicitly passed in or initialized for ga(), then you would not use ga() at all: you would just call your objective function with all of the permutations .
A = [ 0 30 0 30 30 30 30 30];
Aperm = unique(perms(A),'rows');
best_perm = Aperm(1,:);
best_val = YourObjectiveFunction(best_perm);
for K = 2 : size(Aperm,1)
this_perm = Aperm(K,:);
this_val = YourObjectiveFunction(this_perm);
if this_val < best_val
best_perm = this_perm;
best_val = this_val;
end
end
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!