email simple problem

a_stupid_boy 2002-12-13 08:02:33
ULONG (PASCAL *lpfnMAPISendMail) (LHANDLE lhSession, ULONG ulUIParam, lpMapiMessage lpMessage, FLAGS flFlags, ULONG ulReserved);

当我在程序中定义一个准备得到function address的指针时,编译时老出现以下的错误error C2143: syntax error : missing ')' before '__stdcall',error C2059: syntax error : ')'

请问这是怎么回事,我下载了有的email程序,它们也是这样定义的,为什么会有问题呢?
...全文
29 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
guizi6 2002-12-13
  • 打赏
  • 举报
回复
可能缺少符号了,虽然意思是说少')',但是VC编译时往往不能准确定位错误
Delphi VCLSkin 5.30 website : http://www.link-rank.com email : info@link-rank.com VCLSkin is a component to create skinnable user interface for Delphi/C++Builder application, It is easy to use, just put one component on mainform, Vclskin will skin whole application without source code modification. Vclskin is leader in this field, Vclskin support most third-part controls in market, there isn't a competitor was able to support 3rd-part controls as many as Vclskin. VclSkin automatically skin kinds of windows in application, include Delphi forms,MDIform and common Windows dialogs (MsgBox,Open/Save,Font,Print), even the Exception MsgBox. Vclskin not only support Delphi standard controls, but also support many third-party component, such as TMS Grid pack, EnLib Grid, Developer Express QuantumGrid. It is an excellent choice for those wanting to skin existing applications. The cool thing is that it uses existing VCL components. -Install Run install.exe to install. You also get help in help.chm -Demo The demo package download at: http://www.link-rank.com/download.htm Demo version adds a string 'VclSkin demo' on form caption, but allows to test all available functions. -History News In 5.30 05/20/2009 *Fix bugs in windows 7. News In 5.25 04/14/2009 *Add xoCaptionButtonHint in skindata.options to hide hint of caption button, to upgrade new version: 1 run uninstall.exe in demo package. 2 compile and install new version. News In 5.20 03/05/2009 *fix problem on hint on caption button. News In 5.14 11/04/2008 *fix unicode problem in delphi 2009 News In 5.12 11/04/2008 *fix bug in hint for caption button News In 5.11 11/03/2008 *support hint for caption button News In 5.10 09/17/2008 *support delphi 2009 News In 5.04 08/16/2008 *fix bug in BCB2007. News In 5.1 05/29/2008 *fix bug in TBitbtn. News In 4.99 05/07/2008 *fix bug in Tprogressbar. News In 4.98 04/23/2008 *fix bug in Tbutton. News In 4.97 04/20/2008 *fix bug in Tlistview. News In 4.96 03/25/2008 *fix bug in Tlistview. News In 4.95 03/13/2008 *fix bug in dll forms. News In 4.94 11/13/2007 *Skip to skin control in Skindata.OnSkinControl event. News In 4.93 11/13/2007 *Support PNGspeedbutton. News In 4.92 11/06/2007 *Fix combobox button problem when form is scaled. News In 4.91 10/02/2007 *Support QuantumGrid 6. News In 4.90 09/03/2007 *Support C++builder 2006, c++builder 2007. News In 4.89 07/26/2007 *Fix problem with Multilizer . News In 4.88 07/18/2007 *Fix form icon problem . News In 4.87 07/10/2007 *Fix problem in Form Caption News In 4.86 06/13/2007 *Fix problem in TDateTimePicker News In 4.85 06/06/2007 *Fix problem in TDateTimePicker News In 4.83 05/18/2007 *Fix problem in Dev Dbtreeview. News In 4.82 05/11/2007 *Improve image quality of form icon. News In 4.81 04/30/2007 *Fix menu border problem. News In 4.80 04/20/2007 *Fix menu border problem in windows2000. News In 4.76 04/11/2007 *Support application Icon updated at runtime. News In 4.75 04/04/2007 *Fix default button problem. News In 4.72 02/27/2007 *Fix form paint problem when cpation changed. News In 4.60 02/09/2007 *Support Help button in form system button. News in 4.55 01/31/2007 *Fix problem that right click caption on Dll form. News in 4.53 01/22/2007 *Fix problem on multi-lines caption header in Listview. News in 4.52 01/11/2007 *Fix problem in DatetimePicker when it resize. News in 4.50 01/03/2007 *Fix problem work with Billenium Effects. News in 4.42 12/06/2006 *skindata.skincontrols option work in window common dialog. News in 4.41 11/13/2006 *fix problem in TImageEnOpendialog. News in 4.40 11/09/2006 *fix problem with Billenium Effects. News in 4.36 10/21/2006 *Fix popupmenu problem in win98 . News in 4.35 10/20/2006 *Fix problem when combobox right-to-left . News in 4.33 10/11/2006 *Fix problem when checkbox and radiobutton is right-to-left reading . News in 4.32 10/03/2006 *Fix problem of button shortcut. News in 4.31 9/25/2006 *Support Toolbarwindow32 in Opendialog. News in 4.30 9/7/2006 *Fix Caption problem in bidiRighttoLeft form. News in 4.25 9/5/2006 *Fix Mainmenu problem in MDIform with bidiRighttoLeft. News in 4.22 8/28/2006 *Fix problem when Menuitem text is right-to-left reading . News in 4.21 8/21/2006 *Fix problem when form caption is right-to-left reading . News in 4.20 8/18/2006 *Fix problem when form Max/Min button is disable. *Change skin file format. News in 4.13 8/14/2006 *unskin dialog when download file in webbrowser. News in 4.12 7/30/2006 *Fix problem when form Max/Min button is disable. News in 4.11 6/25/2006 *Change Grid.fixedcolor when skin file changed. News in 4.10 6/14/2006 *Add BeforeFormSkin and AfterFormSkin event. News in 4.09 6/07/2006 *fix bug in MDIchild when form create and change form caption. News in 4.08 5/25/2006 *(5/26)Fix bug in TSkinControl.GetParentColor . *Change Tabcontrol background color. News in 4.07 5/10/2006 *Fix problem TScrollbar control. News in 4.07 5/5/2006 *Fix problem in Mainmenu. News in 4.06 4/19/2006 *Fix combobox scrollbar problem. News in 4.05 4/18/2006 *Fix scrollbar problem when grid is disable. *Fix Mainmenu problem in Windows95 News in 4.04 4/10/2006 *Fix Mainmenu problem in MDIform. *Fix Menu merge problem in Win98. News in 4.03 4/01/2006 *Fix problem in TCheckbox and TRadiobutton when BiDimode=bdRighttoLeft. *Fix problem when Menuitems have Actions. News in 4.02 3/28/2006 *Fix problem in TSpeedbutton when size is zero. *Support scrollbar in drop-down of combobox. News in 4.01 3/16/2006 *fix problem with trackbar when skin active *support TCategoryButtons in delphi2006 News in 4.0. 3/9/2006 *Fix problem when skin file do not have checkbox image. *Fix bug when click button and move mouse. *Fix bug with TVirtualTreeview. News in 3.99 3/3/2006 *Fix bug when skindata.skinformtype=sfOnlyThisForm *Fix bug in TcxRadioGroup *Fix bug in TDateTimePicker *Fix bug in TMediaPlayer. News in 3.98 2/24/2006 * Support TPageControl with tsButton style. * Fix problem on Mainmenu with ActionList. News in 3.97 2/16/2006 * Fix problem when Groupbox in ScrollBox. *Fix problem with newest TNTcontrol. News in 3.96 2/6/2006 * Fix problem with TTrayIcon. * Fix problem bug with TMainmenu. News in 3.95 1/25/2006 * Fix flicker problem about TSpeedbutton. * Fix flicker problem when form caption change. News in 3.94 1/25/2006 * Fix bug in TPopupMenu. add 'xoMenuBG' in skindata.options to support menuitem with mbBarBreak. News in 3.93 1/18/2006 * Fix bug in TDateTime. News in 3.92 1/12/2006 * Fix paint bug in TTabcontrol. * Fix paint bug in Checkbox and radiobutton without caption . News in 3.91 1/8/2006 * Fix bug in Mainmenur. News in 3.90 1/1/2006 * Fix bug in TrackBar. News in 3.89 12/31/2005 * Fix bug in form with BorderStyle=bsNone. *Fix mainmenu bug in MDIForm. News in 3.88 12/26/2005 *Fix bug in THeaderControl. *Support TcxTreeList, TcxNavigator in Dev express controls. News in 3.87 12/22/2005 *Paint minimized form. *Fix bug in TPageControl. News in 3.85 12/13/2005 *Fix a crush bug. News in 3.84 12/5/2005 *Support TPnbBitBtn. *fix flicker in Tpagecontrol. *Fix GDI leak problem. News in 3.83 12/2/2005 *Fix problem that toolbar Backbround is too dark . News in 3.82 12/1/2005 *Fix bug when form maximize. News in 3.81 11/29/2005 *Support TMediaPlayer control. News in 3.80 11/20/2005 *Fix some skin files. *Fix bug on ImageEn SaveImageEnDialog. News in 3.72 11/10/2005 *Fix bug in TScrollbar when its min is negative. *Fix bug in Tmainmenu. News in 3.71 11/5/2005 *change caption text color to gray when checkbox or radiobutton is disable. *Fix paint problem in Tbitbtn when caption is empty. *Fix bug of changing skin file when Skindata.SkinFormtype = sfOnlyThisForm. News in 3.70 10/27/2005 *Support TAdvPageControl. *Support TRzMenuButton, TcxButton with cxbkDropDownButton. *work with RECREATEWND message for skined control has scrollbar. *Fix a memory leak bug. *Fix paint bug for TPagecontrol in win95. News in 3.65 10/21/2005 *Add TSkindata.Options.xoMDIChildBorder which do not skin MDIChild form's border. News in 3.64 10/19/2005 *Fix problem when skindata.skincontrols.xcMainMenu is flase. News in 3.63 10/15/2005 *Support THeaderControl. News in 3.62 10/13/2005 *fix bug in SystemMenu. News in 3.61 10/11/2005 *fix bug in TcxDbCheckbox. *fix paint problem in Tcheckbox when Alignment is taLeftJustify. News in 3.60 10/10/2005 *Vclskin can run in Win95. News in 3.52 10/6/2005 *Fix paint problem of form border. News in 3.51 10/4/2005 *Fix paint problem in checkbox with big image. News in 3.50 9/25/2005 *Support Mouse Hover in Scrollbar. *Add Mouse thumb gripper in Scrollbar. News in 3.41 *Fix some problem in Button when mouse move. News in 3.40 2005.9.21 *Support Hover state in Header control. *Improve on TrackBar *Fix problem to unskin radiogroup. News in 3.38 2005.9.13 *Fix icon problme in MDIChild. News in 3.37 2005.9.12 *Fix font color problem in TButton when button is focused. News in 3.36 2005.9.9 *Fix font color problem in Tgroupbox,radiobutton,checkbox. News in 3.35 2005.9.5 *Support TGroupbox font color. News in 3.34 2005.8.31 *Fix paint problem in Trackbar when skin file change. News in 3.33 2005.8.29 *Fix problem in TcxDBCheckbox. News in 3.32 2005.8.25 *Add close button on TPageControl. News in 3.31 *fix problem when righ click form caption that BorderIcons:=[] News in 3.30 *fix problem that show normal window border when windows first show. *fix resize problem when form border is bsSingle. News in 3.29 *System menu is NOT only English.It support Language in windows. *Fix some problem in DLL applicaton. News in 3.28 * fix paint bug in checkbox and radiobutton in windows common dialog. News in 3.27 *fix bug in TTntDateTimePicker. *fix paint problem in TPageControl. News in 3.26 *Support Popupmenu in TFrame. News in 3.25 * fix Icon problem in MDIChild form. * fix caption paint problem in MDIForm. News in 3.24 * Fix Icon problem in MDIChild form. * fix paint problem in Tbitbtn. * Add feature that Skin file Preview image saved in skin-builder. * Add xcTrackbar and xcSpin. News in 3.23 * Support wordwrap in Bitbtn and speedbutton. * Fix scrollbar problem in TImageScrollBox. News in 3.22 * fix transparent problem in button. News in 3.21 * Fix paint problem in TSpidEdit. * Support owner-MeasureItem event in Popupmenu. News in 3.20 * support toolbar background. * support workwrap in checkbox and radiobutton. News in 3.14 *fix mainmenu merge problem . *fix flicker problem in transparent background . News in 3.13 *fix scrollbar problem when form move. *fix bug in DLL form. *fix Edit control focus problem in MDIChild. *fix formresize problem when skin file change. News in 3.12 * Add Focus border on checkbox,radiobutton,button. * Support Transparent Background on Checkbox,Radiobutton,Groupbox. * Support WS_EX_APPWINDOW style. * fix MDIchild problem in TBX. * improve on RzRadiobutton. News in 3.11 *Support runtime package. *support ALT,ALT-Space. *support hint for scrollbar control *fix Z-order problem when skin change. *fix shortcut problem. News in 3.10 *Support TBX. *Support TNT MDIChild Form. *Support more FastReprt button control. News in 3.08 *Fix problem in TOpenImageEnDialog. *Paint Border in scrollbar control. *Fix checkbox paint problem in Dibiright *Fix Tscrollbox problem. *Support LMD Elpack. *Fix problem that Control without parent. *Fix bug in skin file change. News in 3.07 *Fix problem when BiDiRight Mainmenu popup. *Fix bug in 3.06,3.05 when skin remove at runtime. News in 3.06 *Fix bug in C++Builder. *Fix bug in scrollbar resize. *Fix bug in Delphi7 XPmanifest component. News in 3.05 *Fix bug when move controls in different forms. *Fix problem in TStatusbar that is simple and DiBiRight. News in 3.04 *Fix Tscrollbox problem in delphi5. *Fix Mainmenu display problem in BIDIRight. *Fix font color problem in TSpeedbutton when it is disable. *Fix bug in TntCombobox. *Fix skinfile mxskin59.skn when form is maximized. News in 3.03 *Fix bug in dockable form. *Support Tbutton onMouseDown event. News in 3.02 *Fix Combobx problem in BIDIRight. *Fix MOUSE WHEEL problem in Tlistbox. *Fix Scrollbar problem when control is invisible. News in 3.01 *Fix problem in Inherited-MDIchild. News in 3.0 *Scrollbar flicker problem fixed. *Redundant separator bars in menu are automatically removed. *Add xoMDIScrollbar to show scrollbar in MDIClient area. News in 2.77 * Support TspinButton. * Support TRzDBCheckbox. * Fix paint problem when MDIform lost focus. * Fix AV bug in application close; * Fix bug when change skin file in multi-skins application. * Fix problem about skin delay. News in 2.76 * 4 new skin file released. * fix some bug in Opendialog. News in 2.75 * Fix bugs in IP4000 combobox * Add install.exe and uninstall.exe * Add "embedscrollbar" in Skindata.skin3rd to support TAdvpanelGroup's scrollbar. * Fix Colorpicker Popupmenu problem in WwRichEdit form. * Support SpinEdit now. * Fix TScrollbox problem in delphi5 or c++builder5. News in 2.74 * Delphi 2005 support. * Enable/Disable skin control at runtime. * Fix bug in MDIForm menu merge. * Add "xcMenuitem" in skincontrols property. * skip to skin QuickReport preivew form. News in 2.73 * Fix bugs in MDIForm when MDIChild is maximized. * Fix bug of form Caption in Chinese. News in 2.72 * Support TNT Unicode Controls . * Support menu in Tookbar2000 . * fix bug in MDIform close. * fix bug in TScrollbar control. * fix bug in TDateTimePicker when TDateTimePicker.kind is dtkTime. News in 2.71 * fix bugs of MDIChild form. * support progressbar with pbVertical style. * support preset color in skin file. * support speedbutton in skin3rd property. News in 2.70 * fix bug in embeded form. * fix bug of MDIform with Expressbar. * fix bug of form caption refresh when skin change. * fix trackbar refresh bug when skin change. * fix Quickreport , reprotbuilder preview form problem. * Support Raize TRzbitbtn with ImageList. * Support TComboboxex. News in 2.69 *Support Raize TRzbitbtn with glyph. *Support TMS TAdvMemo. *Fix bug of mainmenu shortcut in MDIform. News in 2.68 *Fix bugs in mainmenu. *Fix Icon bug in dialog. News in 2.67 *Fix DBEdit paint bug. *Fix Icon paint bug. News in 2.66 *Use Memory Inifile. *Fixed bug in multiskin demo. *Fixed MDIform Tile and Cascade problem. *Fixed bugs in default button and disable button. *Add LMD tools 7.0 demo. News in 2.65 *Paint with gray glyph when Speendbtn is disable. *Fixed Topendialog resize problem *Fixed shortcut problem in menuitem. *Add Raized component demo. *Add QuantumGrid4 demo. *Add IP4000 demo. News in 2.62 *Paint TGroupbox with new style. *Fixed bug in painting TSpeedbutton pictures. *Fixed bug in application closed. News in 2.60 *Support Arabic language, BiDiMode is righttoleft. *Fixed some bugs when application closed. News in 2.55 *Fixed bug that Tspeedbutton destory at runtime. *Improve performance when change menutitem at runtime. *Fixed OpenDialog bug. News in 2.50 *Support LMD tools. *Fixed bug of checkbox that is disabled . *Add TSkindata.Skin3rd property to add 3rd control easily. News in 2.45 *Some bugs fixed. *Improve compatibility with Billenium effects. News in 2.4 *Support to skin an application but keep the menu bar and title bar the default Windows standard. *DBCheckbox bug fixed. *Fixed bug in cascade,tile command in MIDform. *Bug with minimized state when form created. *Suport ReportBuilder News in 2.3 *Support TUpDown and TSpinEdit. *Support TrackBar. *Restore form size when remove skin. *Fix more bugs. News in 2.25 *Fix bug with QuickReport and FastReport. *Fix bug in Tstatusbar. *Fix bug in Application. News in 2.20 *Support Header control in TlistView. *Fix Menuitem ShortCut bug. *Fix bug that change windows Z-Order when skin change at runtime. *Support Tframe created at runtime. News in 2.10 *Fix Scrollbar drag thumb problem. News in 2.05 *Support multi-skindata in application,Mainform and messagebox can use different skindate. *Nested form support. *Fixed Title flicker problem when form resize. *Support Mainmenu change at runtime. News in 2.0 *skin kinds of windows in your project, Delphi forms,MDIform and common Windows dialogs (MsgBox,Open/Save,Font,Print), even the Exception MsgBox. *Enable/Disable skin at runtime. *fixed many bugs in MDIform. *system menu enchanced.
王小平版遗传算法的光盘源代码 SGPC: Simple Genetic Programming in C by Walter Alden Tackett and Aviram Carmi (gpc@ipld01.hac.com) Version 1.1 (c) 1993 by Walter Alden Tackett and Aviram Carmi This code and documentation is copyrighted and is not in the public domain. All rights reserved. Genetic Programming is a method of "Adaptive Automatic Program Induction" originally created by John Koza and James Rice of Stanford University. SGPC is a C implementation of Genetic Programming: it is a C program which writes LISP programs. These programs are tailored by the system to solve a problem specified by the user. Koza and Rice have provided to the public a version of Genetic Programming which is written in LISP. SGPC offers greater portability and about 25-50 times improvement in execution speed due to a highly optimized C implementation. For further information on Genetic Programming See: _Genetic_Programming_ by John R. Koza, MIT Press 1992 "Genetic Programming for Feature Discovery and Image Discrimination" by Walter Alden Tackett in _Genetic_Algorithms:_Proceedings_of_the_ Fifth_International_Conference_ (GA93), S. Forrest Ed., Morgan- Kaufman 1993 To participate in our on-line Internet e-mail forum send your subscription request to: genetic-programming-request@cs.stanford.edu Basically, the code does the same things that Koza & Rice s simple LISP does and is set up to handle multiple populations as well (e.g., for co-evolution). You need to provide three modules, setup.c, fitness.c, and prob.h, in a subdirectory named PROBNAME, where PROBNAME is some descriptive name of the problem. E.G., in the version we ship we include REGRESSION/setup.c and REGRESSION/fitness.c, Which do Koza s simple regression problem. setup.c contains functions to setup the function table, the terminals table, and code for the functions in the function table. prob.h contains prototypes for the user defined functions. fitness.c contains functions to evaluate and validate populations and trees, early termination, and definition of the fitness (training and test) cases. As a second example, for your enlightenment, we include the ADF problem which shows you how to build a simple 2-class "dendritic" classifier (see my paper in the sfi account). You should not need to modify any of the other myriad files. COMPILING Source code for the kernel system is in the sub-directory `lib . Source code for problem depended modules are in sub-directories named after the problem. There is a Makefile in the top level directory which invokes the Makefile in the problem specific directory, which invokes the Makefile in the `lib directory (if needed). The source in the lib directory is compiled into an object library file, which is then linked with the problem specific objects. Read the notes in the Makefiles in all the sub-directories, make any necessary changes to fit your system, and then type: make depend PROBLEM=PROBNAME make PROBLEM=PROBNAME where PROBNAME is the name of the subdirectory where the problem specific setup.c and fitness.c files are. EXECUTING the executable is called gpcPROBNAME and will be in the PROBNAME directory. gpcPROBNAME [-d nrow ncol] npops ngen (pop0_pfile|`none )... [seed] NOTE: you must have a parameters file name for each population. EXAMPLE gpcREGRESSION 2 100 none pop1_file 1234 will run gpcREGRESSION with 2 pops 100 gens with pop0 using the default values, pop1 using values from pop1_file, and 12345 as the initial random seed. On startup default values for the runtime parameters are assigned from hard-coded values, then if a file called "default.in" exists in the current directory, values are read from it and override the hard-coded values. If a parameters file name for a population is present on the command line, values from this file override the previous values for that population, else if `none is specified on the command line, the parameters will retain the default values. Remember you must specify either a population params file or `none on the command line for each population. Note: since the random seed value is not a population parameter but it can be specified in the population parameters file, if there are multiple populations, and no seed value was specified on the command line, the value read from the last population parameters file will be used. Some salient points about the modules which are provided for you: The main() is located in lib/gpc.c The top-level loop which iterates over the generations is in generations.c The data structures which you must work with are in the file gpc.h Expressions (trees) are evaluated via calls to eval(tree *t) in eval.c. Trees are operated on using routines in treeops.c and can be read/written using operations in treeio.c. You will get some tutorial feel for using the data structures involved by examining the initializations which take place in populations.c and generations.c. In general, the modules are descriptively named: e.g., selection.c, crossover.c, mutation.c. CREATING YOUR OWN PROBLEMS First create a sub-directory under the top-level sgpc directory and name it a descriptive name. Copy the Makefile and optionally the fitness.c setup.c and prob.h files to the new directory. FITNESS.C Here are the functions you must include in the fitness.c module: /* assigns standardized fitness values to all members of each population pop[0]...pop[numpops-1] */ void evaluate_fitness_of_populations ( int numpops, /* number of populations */ int numgens, /* number of generations */ pop_struct *pop /* the population array */ ); /* returning != 0 from this routine halts SGPC at the end of the generation, eg, if a "perfect" (ha!) individual is found */ int terminate_early ( int numpops, int numgens, pop_struct *pop ); /* creates the array of fitness cases, or does other startup peculiar to your problem */ void define_fitness_cases ( int numpops, int numgens, pop_struct *pop ); /* this routine is used to test the best-of-generation individual against a separate set of test cases which were not used in training (i.e., in generating the fitness values which drive selection). The best-of-run individual is determined using the figure returned from this function */ float validate_fitness_of_tree( int numpops, int numgens, pop_struct *pop, tree *t ) SETUP.C Here are the functions you must include in the setup.c module: /* assigns function pointers, print names, arity, macro-flag, etc, to function table entries for all populations */ void make_function_table ( pop_struct *pop ); /* assigns function pointers, print names, arity, macro-flag, etc, to terminal table entries for all populations */ void make_terminal_table ( pop_struct *pop ); In addition, you declare all of the actual function code for you function set in setup.c. A declared function can either be a function or a macro: a function has an array of values (eg float *args;) passed into it as arguments, whereas a macro has an array of unevaluated expressions passed in, so that some of them may remain unevaluated to prevent side-effects. Here is how the properties of a function are assigned in make_function_table(pop_struct *pop): pop[0].function_table[0].arity = 2; pop[0].function_table[0].macro = FALSE; pop[0].function_table[0].enabled = TRUE; pop[0].function_table[0].printname = "+"; pop[0].function_table[0].code = plus; Here is the assignment of a macro: pop[0].function_table[4].arity = 4; pop[0].function_table[4].macro = TRUE; pop[0].function_table[4].enabled = TRUE; pop[0].function_table[4].printname = "IFLTE"; pop[0].function_table[4].code = iflte; Here is how the functions they point to are declared: For the function plus: GENERIC plus(GENERIC *args) { return args[0]+args[1]; } For the macro iflte: /* note that args are unevaluated trees, not GENERIC values */ GENERIC iflte(tree **args) { return ((eval(args[0]) < eval(args[1])) ? eval(args[2]) : eval(args[3])); } Note that in the code above, the type generic can be set by the TYPE definition set to the make file: default is #define GENERIC float. TERMINAL TABLE: We play some games here. Here is the definition of a terminal from make_terminal_set(pop_struct *pop): pop[0].terminal_table[0].val = 0; pop[0].terminal_table[0].printname = "X"; pop[0].terminal_table[0].constant_generator = random_constant; If we declare that there are N terminals in the terminal set, then there a total of N+1 entries 0...N, where entry N is the randomly generated constant, which should always be declared as follows: pop[0].terminal_table[pop[0].terminal_table_size].val = 0; pop[0].terminal_table[pop[0].terminal_table_size].printname = FORMAT; pop[0].terminal_table[pop[0].terminal_table_size].constant_generator = random_constant; Here, FORMAT is #defined to be the format string associated with the GENERIC type, eg if GENERIC == float then FORMAT == "%f". SAMPLE POPULATION PARAMETERS FILE: seed = 11287 # use this if no value for seed on command line population_size = 100 max_depth_for_new_trees = 6 max_depth_after_crossover = 17 max_mutant_depth = 4 grow_method = RAMPED # FULL GROW selection_method = FITNESSPROP # TOURNAMENT tournament_K = 6 # used only if TOURNAMENT is selected crossover_func_pt_fraction = 0.2 crossover_any_pt_fraction = 0.2 fitness_prop_repro_fraction = 0.1 parsimony_factor = 0.00000 CHECKPOINTING: To enable checkpointing, a non zero value for checkpoint_frequency must be specified in the default parameters file, e.g., checkpoint_frequency = 10 Remember that if you specify value in the population s parameters file, the value read from the last parameters file will be used as the checkpoint frequency for all the populations. The generated ckptfile is named gpc_`hostid _`pid .ckpt.Z, i.e. it is compressed using the compression utility specified in the makefile (Note: ignore ckpt files that are not compressed, the process could have crashed while writing the uncompressed file and it is probably corrupted. Of course, this is assuming that you have `compress on your system.) To recover from a crash, just uncompress the ckpt file and type in: gpc -r ckpt_file_name As a bonus you can now extend a run for more generations (only if checkpointing is enabled, i.e. checkpoint_frequency is greater than zero. Set it to a large value if you do not want checkpointing to slow you down, but do want a checkpoint file for the last generation). To do this, just edit the ckpt file and change the value ONLY for the following line (it should be the fourth line in the file): number_of_generations = 100 ^^^ to the new total number of generations, i.e. to extend the run by 10 gens replace 100 by 110. **************************************************************************** FAQ S FROM OUR EMAIL ARCHIVES: > First, do you use mutation? I couldnt find a mutation parameter that easily accessible... Yes. It is implicit, like in Koza & Rice s code: it is 1.0 - (crossover_func_pt_fraction + crossover_any_pt_fraction + fitness_prop_repro_fraction) > > Second, do you have a facilty for inserting pre-created individuals into the > population? Yes- the load_from_file keyword in the parameter file, e.g.: load_from_file = foo.lsp ...in your input parameter file will load the N lisp expressions in file foo.lsp as the first N elements of the population. Also, *don t* include the load_from_file keyword unless you are actually loading a file. > Thanks for the info...I was also curious how I could prohibit the > random constants from being terminals...ie I do not wish/need to use > random constants and I was wondering how best to remove them...The solution > is somewhat obvious maybe (dont include them in the terminal table) but then > I was a bit concerned given all of the warnings that there are N+1 > terminals.. > Yet another undocumented feature (YAUF :), in lib/gpc.h change: #define ALLOW_CONST 1 to: #define ALLOW_CONST 0 You will need to recompile the entire libgpc object library. i.e., you cannot have this set to different values for different problems w/o recompiling the whole damn thing. SGPC 1.0 is shipped with three makefiles: Makefile - sun-specific makefile: slick, cryptic, non-portable. gMakefile - gnu makefile: you can find gnu make for most machines. Ask your local systems hacker to help you find it on the net and install it. make.script - a shell script for compiling SGPC, may require some editing if you have changed directory names or the PROBLEM you are working on. Basically, if you can t run this you re not running Unix. The c-code itself should be portable to standard Unix systems. The only portability issues should surround the use of the system qsort routine (we provide one ourselves, anyway) the timing routines (you don t need this unless you re anal, anyway) and mallopt (you don t *have* to use mallopt, but it helps to ensure locality and reduce fragmentation). Of course this is only an estimate and your actual mileage may vary.

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧