如下,要判断时候为正数,这个搞了好久
我本来是用lingo做的,lingo也是老报错
---------------------------------------------------
我奋斗了好久,只能说是书到用时方恨少.搜索了下,我用了lingo以及5月1号写的那些长长的程序后,没有什么效果,我用lingo老是出错,太久没用了,我也查不出哪里错了.lingo的程序在下楼.MATLAB之前写的程序也在下楼.
这次我是用遗传算法解决,可是每次运行的结果都不一样,而且结果也不是我要的.我乱套用这些,可是没办法.这个问题老是解决不了(问题function.jpg如图).下面是我的程序,不知道我的什么时候能做完,嗨,我的5.1节啊.天亮后去下图书馆,找下lingo该怎么解决.觉得MATLAB来解决这个问题太难啦~~~
%------------------------gainteger_GA.m--------------------------------------
function [x,fval] = gainteger_GA
%This is a function to solve the problem of interger programming using GA
%function in the Genetic Algorithm and Direct Search Toolbox
% Fitness function and numver of variables
fitnessFcn = @(x) gaf(x);
numberOfVariables = 12;
% If decision variables are bounded provide a bound e.g, LB and UB.
LB = -100*ones(1,numberOfVariables);
UB = 100