How to call This function

6 次查看(过去 30 天)
function [ solution ] = knapsack_generate_random( problem, ~ ) %KNAPSACK_INITIALIZE_RANDOM generates a solution for the problem
solution = randi(2,1,problem.n_var)-1;
end

采纳的回答

Walter Roberson
Walter Roberson 2013-9-22
Sample call:
prob = struct('n_var', 7);
trial_solution = knapsack_generate_random(prob);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by