g = sprintf('Input the number of objective: '); % Obtain the number of objective function number_of_objectives = input(g); g = sprintf('\nInput the number of decision variables: '); % Obtain the number of decision variables number_of_decision_variables = input(g); clc for i = 1 : number_of_decision_variables clc g = sprintf('\nInput the minimum value for decision variable %d : ', i); % Obtain the minimum possible value for each decision variable min_range_of_decesion_variable(i) = input(g); g = sprintf('\nInput the maximum value for decision variable %d : ', i); % Obtain the maximum possible value for each decision variable max_range_of_decesion_variable(i) = input(g); clc end g = sprintf('\n Now edit the function named "evaluate_objective" appropriately to match your needs. \n Make sure that the number of objective functions and decision variables match your numerical input. \n Make each objective function as a corresponding array element. \n After editing do not forget to save. \n Press "c" and enter to continue... '); % Prompt the user to edit the evaluate_objective function and wait until % 'c' is pressed. x = input(g, 's'); if isempty(x) x = 'x'; end while x ~= 'c' clc x = input(g, 's'); if isempty(x) x = 'x'; end end
时间: 2023-03-02 15:16:39 浏览: 133
PHP数字前补0的自带函数sprintf 和number_format的用法(详解)
"null" 是一个计算机编程术语,表示一个值或者对象不存在、无效或未定义。在程序中,如果一个变量或者对象没有被赋值或者被初始化,它们的值就是 null。在某些编程语言中,null 也可以表示空指针或空引用。
阅读全文