473,513 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<command-line>:0:21: warning: ISO C99 requires whitespace after the macro name <comma

1 New Member
#ifndef _ASA_USER_ASA_H_
#define _ASA_USER_ASA_H_
#ifdef __cplusplus
extern "C" {
#endif

/************************************************** *********************
* Adaptive Simulated Annealing (ASA)
* Lester Ingber <ingber@ingber.com>
* Copyright (c) 1987-2010 Lester Ingber. All Rights Reserved.
* The ASA-LICENSE file must be included with ASA code.
************************************************** *********************/

/* $Id: asa_usr_asa.h,v 26.38 2010/01/04 23:43:10 ingber Exp ingber $ */

/* asa_usr_asa.h for Adaptive Simulated Annealing */

#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h> /* misc defs on most machines */
#include <string.h>

/* required if use machine-defined {DBL_EPSILON DBL_MIN DBL_MAX} */
/* #include <float.h> */

/* test for memory leaks */
/* #include "/usr/local/include/leak.h" */

#define TRUE 1
#define FALSE 0

#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))

/* DEFAULT PARAMETERS SETTINGS */

/* Pre-Compile Options */

/* Special ASA_TEMPLATEs */

#ifndef MY_TEMPLATE
#define MY_TEMPLATE TRUE
#endif
#if MY_TEMPLATE /* MY_TEMPLATE_asa_user */
/* you can add your own set of #define here */
#endif /* MY_TEMPLATE */

#ifndef ASA_TEMPLATE_LIB
#define ASA_TEMPLATE_LIB FALSE
#endif
#if ASA_TEMPLATE_LIB
#define ASA_LIB TRUE
#define ASA_TEST TRUE
#endif

#ifndef ASA_TEMPLATE_ASA_OUT_PID
#define ASA_TEMPLATE_ASA_OUT_PID FALSE
#endif
#if ASA_TEMPLATE_ASA_OUT_PID
#define USER_ASA_OUT TRUE
#endif

#ifndef ASA_TEMPLATE_MULTIPLE
#define ASA_TEMPLATE_MULTIPLE FALSE
#endif
#if ASA_TEMPLATE_MULTIPLE
#define COST_FILE FALSE
#define USER_ASA_OUT TRUE
#define ASA_TEST TRUE
#define QUENCH_COST TRUE
#define QUENCH_PARAMETERS TRUE
#define OPTIONS_FILE FALSE
#endif

#ifndef ASA_TEMPLATE_SELFOPT
#define ASA_TEMPLATE_SELFOPT FALSE
#endif
#if ASA_TEMPLATE_SELFOPT
#define COST_FILE FALSE
#define SELF_OPTIMIZE TRUE
#define OPTIONAL_DATA_DBL TRUE
#define USER_ASA_OUT TRUE
#define ASA_TEST TRUE
#define OPTIONS_FILE FALSE
#endif

#ifndef ASA_TEMPLATE_SAMPLE
#define ASA_TEMPLATE_SAMPLE FALSE
#endif
#if ASA_TEMPLATE_SAMPLE
#define COST_FILE FALSE
#define ASA_SAMPLE TRUE
#define USER_ACCEPTANCE_TEST TRUE
#define USER_COST_SCHEDULE TRUE
#define OPTIONS_FILE_DATA FALSE
#define USER_ACCEPT_ASYMP_EXP TRUE
#endif

#ifndef ASA_TEMPLATE_PARALLEL
#define ASA_TEMPLATE_PARALLEL FALSE
#endif
#if ASA_TEMPLATE_PARALLEL
#define COST_FILE FALSE
#define ASA_TEST TRUE
#define ASA_PARALLEL TRUE
#endif

#ifndef ASA_TEMPLATE_SAVE
#define ASA_TEMPLATE_SAVE FALSE
#endif
#if ASA_TEMPLATE_SAVE
#define COST_FILE FALSE
#define ASA_TEST TRUE
#define ASA_SAVE TRUE
#define QUENCH_PARAMETERS TRUE
#define QUENCH_COST TRUE
#endif

#ifndef ASA_TEMPLATE_QUEUE
#define ASA_TEMPLATE_QUEUE FALSE
#endif
#if ASA_TEMPLATE_QUEUE
#define ASA_QUEUE TRUE
#define ASA_RESOLUTION FALSE
#define ASA_TEST TRUE
#define COST_FILE FALSE
#define ASA_PRINT_MORE TRUE
#endif

#ifndef ASA_TEST_POINT
#define ASA_TEST_POINT FALSE
#endif
#if ASA_TEST_POINT
#define ASA_TEST TRUE
#define COST_FILE FALSE
#define SMALL_FLOAT 1.0E-50
#define QUENCH_COST TRUE
#endif

#ifndef ASA_EXIT_ANYTIME
#define ASA_EXIT_ANYTIME FALSE
#endif

/* Standard Pre-Compile Options */

#ifndef USER_COST_FUNCTION
#define USER_COST_FUNCTION cost_function
#endif

#if SELF_OPTIMIZE
#ifndef RECUR_USER_COST_FUNCTION
#define RECUR_USER_COST_FUNCTION recur_cost_function
#endif
#ifndef INCL_STDOUT
#define INCL_STDOUT FALSE
#endif
#endif

#ifndef INCL_STDOUT
#define INCL_STDOUT TRUE
#endif
#if INCL_STDOUT
#ifndef TIME_CALC
#define TIME_CALC FALSE
#endif
#endif

#ifndef OPTIONS_FILE
#define OPTIONS_FILE TRUE
#endif

#if OPTIONS_FILE
#ifndef OPTIONS_FILE_DATA
#define OPTIONS_FILE_DATA TRUE
#endif
#else
#define OPTIONS_FILE_DATA FALSE
#endif

#ifndef RECUR_OPTIONS_FILE
#define RECUR_OPTIONS_FILE FALSE
#endif

#if RECUR_OPTIONS_FILE
#ifndef RECUR_OPTIONS_FILE_DATA
#define RECUR_OPTIONS_FILE_DATA FALSE
#endif
#else
#define RECUR_OPTIONS_FILE_DATA FALSE
#endif

#ifndef COST_FILE
#define COST_FILE TRUE
#endif

#ifndef ASA_LIB
#define ASA_LIB FALSE
#endif

#ifndef HAVE_ANSI
#define HAVE_ANSI TRUE
#endif

#ifndef IO_PROTOTYPES
#define IO_PROTOTYPES FALSE
#endif

#ifndef TIME_CALC
#define TIME_CALC FALSE
#endif

#ifndef INT_LONG
#define INT_LONG TRUE
#endif

#if INT_LONG
#define LONG_INT long int
#else
#define LONG_INT int
#endif

#ifndef INT_ALLOC
#define INT_ALLOC FALSE
#endif

#if INT_ALLOC
#define ALLOC_INT int
#else
#define ALLOC_INT LONG_INT
#endif

/* You can define SMALL_FLOAT to better correlate to your machine's
precision, i.e., as used in asa */
#ifndef SMALL_FLOAT
#define SMALL_FLOAT 1.0E-18
#endif

/* You can define your machine's maximum and minimum doubles here */
#ifndef MIN_DOUBLE
#define MIN_DOUBLE ((double) SMALL_FLOAT)
#endif

#ifndef MAX_DOUBLE
#define MAX_DOUBLE ((double) 1.0 / (double) SMALL_FLOAT)
#endif

#ifndef EPS_DOUBLE
#define EPS_DOUBLE ((double) SMALL_FLOAT)
#endif

#ifndef CHECK_EXPONENT
#define CHECK_EXPONENT FALSE
#endif

#ifndef ASA_TEST
#define ASA_TEST FALSE
#endif

#ifndef ASA_TEMPLATE
#define ASA_TEMPLATE FALSE
#endif

#ifndef USER_INITIAL_COST_TEMP
#define USER_INITIAL_COST_TEMP FALSE
#endif

#ifndef RATIO_TEMPERATURE_SCALES
#define RATIO_TEMPERATURE_SCALES FALSE
#endif

#ifndef USER_INITIAL_PARAMETERS_TEMPS
#define USER_INITIAL_PARAMETERS_TEMPS FALSE
#endif

#ifndef DELTA_PARAMETERS
#define DELTA_PARAMETERS FALSE
#endif

#ifndef QUENCH_PARAMETERS
#define QUENCH_PARAMETERS FALSE
#endif

#ifndef QUENCH_COST
#define QUENCH_COST FALSE
#endif

#ifndef QUENCH_PARAMETERS_SCALE
#define QUENCH_PARAMETERS_SCALE TRUE
#endif

#ifndef QUENCH_COST_SCALE
#define QUENCH_COST_SCALE TRUE
#endif

#ifndef OPTIONAL_DATA_DBL
#define OPTIONAL_DATA_DBL FALSE
#endif

#ifndef OPTIONAL_DATA_INT
#define OPTIONAL_DATA_INT FALSE
#endif

#ifndef OPTIONAL_DATA_PTR
#define OPTIONAL_DATA_PTR FALSE
#endif
#if OPTIONAL_DATA_PTR
/* user must define USER_TYPE; if a struct, it must be declared above */
#ifndef OPTIONAL_PTR_TYPE
#define OPTIONAL_PTR_TYPE USER_TYPE
#endif
#endif /* OPTIONAL_DATA_PTR */

#ifndef USER_REANNEAL_COST
#define USER_REANNEAL_COST FALSE
#endif

#ifndef USER_REANNEAL_PARAMETERS
#define USER_REANNEAL_PARAMETERS FALSE
#endif

#ifndef MAXIMUM_REANNEAL_INDEX
#define MAXIMUM_REANNEAL_INDEX 50000
#endif

#ifndef REANNEAL_SCALE
#define REANNEAL_SCALE 10
#endif

#ifndef USER_COST_SCHEDULE
#define USER_COST_SCHEDULE FALSE
#endif

#ifndef USER_ACCEPT_ASYMP_EXP
#define USER_ACCEPT_ASYMP_EXP FALSE
#endif

#ifndef USER_ACCEPT_THRESHOLD
#define USER_ACCEPT_THRESHOLD FALSE
#endif

#ifndef USER_ACCEPTANCE_TEST
#define USER_ACCEPTANCE_TEST FALSE
#endif

#ifndef USER_GENERATING_FUNCTION
#define USER_GENERATING_FUNCTION FALSE
#endif

/* in asa.c, field-width.precision = G_FIELD.G_PRECISION */
#ifndef G_FIELD
#define G_FIELD 12
#endif
#ifndef G_PRECISION
#define G_PRECISION 7
#endif

#define INTEGER_TYPE ((int) 1)
#define REAL_TYPE ((int) -1)
#define INTEGER_NO_REANNEAL ((int) 2)
#define REAL_NO_REANNEAL ((int) -2)

/* Set this to TRUE to self-optimize the Program Options */
#ifndef SELF_OPTIMIZE
#define SELF_OPTIMIZE FALSE
#endif

#ifndef USER_OUT
#define USER_OUT "asa_usr_out"
#endif

#ifndef USER_ASA_OUT
#define USER_ASA_OUT FALSE
#endif

#ifndef ASA_SAMPLE
#define ASA_SAMPLE FALSE
#endif

#ifndef ASA_QUEUE
#define ASA_QUEUE FALSE
#endif

#ifndef ASA_RESOLUTION
#define ASA_RESOLUTION FALSE
#endif

#ifndef ASA_PARALLEL
#define ASA_PARALLEL FALSE
#endif

#ifndef ASA_SAVE_OPT
#define ASA_SAVE_OPT FALSE
#endif
#if ASA_SAVE_OPT
#define ASA_SAVE TRUE
#endif

#ifndef ASA_SAVE_BACKUP
#define ASA_SAVE_BACKUP FALSE
#endif
#if ASA_SAVE_BACKUP
#define ASA_SAVE TRUE
#endif

#ifndef ASA_SAVE
#define ASA_SAVE FALSE
#endif

#ifndef ASA_PIPE
#define ASA_PIPE FALSE
#endif

#ifndef ASA_PIPE_FILE
#define ASA_PIPE_FILE FALSE
#endif

#ifndef FDLIBM_POW
#define FDLIBM_POW FALSE
#endif
#if FDLIBM_POW
#define F_POW s_pow
#else
#define F_POW pow
#endif

#ifndef FDLIBM_LOG
#define FDLIBM_LOG FALSE
#endif
#if FDLIBM_LOG
#define F_LOG s_log
#else
#define F_LOG log
#endif

#ifndef FDLIBM_EXP
#define FDLIBM_EXP FALSE
#endif
#if FDLIBM_EXP
#define F_EXP s_exp
#else
#define F_EXP exp
#endif

#ifndef FITLOC
#define FITLOC FALSE
#endif

#ifndef FITLOC_ROUND
#define FITLOC_ROUND TRUE
#endif

#ifndef FITLOC_PRINT
#define FITLOC_PRINT TRUE
#endif

#ifndef MULTI_MIN
#define MULTI_MIN FALSE
#endif

/* Program Options */

typedef struct {
LONG_INT Limit_Acceptances;
LONG_INT Limit_Generated;
int Limit_Invalid_Generated_States;
double Accepted_To_Generated_Ratio;

double Cost_Precision;
int Maximum_Cost_Repeat;
int Number_Cost_Samples;
double Temperature_Ratio_Scale;
double Cost_Parameter_Scale_Ratio;
double Temperature_Anneal_Scale;
#if USER_INITIAL_COST_TEMP
double *User_Cost_Temperature;
#endif

int Include_Integer_Parameters;
int User_Initial_Parameters;
ALLOC_INT Sequential_Parameters;
double Initial_Parameter_Temperature;
#if RATIO_TEMPERATURE_SCALES
double *User_Temperature_Ratio;
#endif
#if USER_INITIAL_PARAMETERS_TEMPS
double *User_Parameter_Temperature;
#endif

int Acceptance_Frequency_Modulus;
int Generated_Frequency_Modulus;
int Reanneal_Cost;
int Reanneal_Parameters;

double Delta_X;
#if DELTA_PARAMETERS
double *User_Delta_Parameter;
#endif
int User_Tangents;
int Curvature_0;

#if QUENCH_PARAMETERS
double *User_Quench_Param_Scale;
#endif
#if QUENCH_COST
double *User_Quench_Cost_Scale;
#endif

LONG_INT N_Accepted;
LONG_INT N_Generated;
int Locate_Cost;
int Immediate_Exit;

double *Best_Cost;
double *Best_Parameters;
double *Last_Cost;
double *Last_Parameters;

#if OPTIONAL_DATA_DBL
ALLOC_INT Asa_Data_Dim_Dbl;
double *Asa_Data_Dbl;
#endif
#if OPTIONAL_DATA_INT
ALLOC_INT Asa_Data_Dim_Int;
LONG_INT *Asa_Data_Int;
#endif
#if OPTIONAL_DATA_PTR
ALLOC_INT Asa_Data_Dim_Ptr;
OPTIONAL_PTR_TYPE *Asa_Data_Ptr;
#endif
#if USER_ASA_OUT
char *Asa_Out_File;
#endif
/* Keep OPTIONS_TMP in parameter lists in asa_usr.[ch] as they are
* needed if using recursively, e.g., with SELF_OPTIMIZE=TRUE.
* Make (USER_DEFINE *) casts explicit within functions. */
#if USER_COST_SCHEDULE
#if HAVE_ANSI
double (*Cost_Schedule) (double current_cost_temperature,
const void *OPTIONS_TMP);
#else /* HAVE_ANSI */
double (*Cost_Schedule) ();
#endif /* HAVE_ANSI */
#endif
#if USER_ACCEPT_ASYMP_EXP
double Asymp_Exp_Param;
#endif
#if USER_ACCEPTANCE_TEST
#if HAVE_ANSI
void (*Acceptance_Test) (double cost,
double *parameter_minimum,
double *parameter_maximum,
ALLOC_INT * number_parameters,
const void *OPTIONS_TMP);
#else /* HAVE_ANSI */
void (*Acceptance_Test) ();
#endif /* HAVE_ANSI */
int User_Acceptance_Flag;
int Cost_Acceptance_Flag;
double Cost_Temp_Curr;
double Cost_Temp_Init;
double Cost_Temp_Scale;
double Prob_Bias;
LONG_INT *Random_Seed;
#endif
#if USER_GENERATING_FUNCTION
#if HAVE_ANSI
double (*Generating_Distrib) (LONG_INT * seed,
ALLOC_INT * parameter_dimension,
ALLOC_INT index_v,
double temperature_v,
double init_param_temp_v,
double temp_scale_params_v,
double parameter_v,
double parameter_range_v,
double *last_saved_parameter,
const void *OPTIONS_TMP);
#else /* HAVE_ANSI */
double (*Generating_Distrib) ();
#endif /* HAVE_ANSI */
#endif
#if USER_REANNEAL_COST
#if HAVE_ANSI
int (*Reanneal_Cost_Function) (double *cost_best,
double *cost_last,
double *initial_cost_temperature,
double *current_cost_temperature,
const void *OPTIONS_TMP);
#else /* HAVE_ANSI */
int (*Reanneal_Cost_Function) ();
#endif /* HAVE_ANSI */
#endif
#if USER_REANNEAL_PARAMETERS
#if HAVE_ANSI
double (*Reanneal_Params_Function) (double current_temp,
double tangent,
double max_tangent,
const void *OPTIONS_TMP);
#else /* HAVE_ANSI */
double (*Reanneal_Params_Function) ();
#endif /* HAVE_ANSI */
#endif
#if ASA_SAMPLE
double Bias_Acceptance;
double *Bias_Generated;
double Average_Weights;
double Limit_Weights;
#endif
#if ASA_QUEUE
ALLOC_INT Queue_Size;
double *Queue_Resolution;
#endif
#if ASA_RESOLUTION
double *Coarse_Resolution;
#endif
#if FITLOC
int Fit_Local;
int Iter_Max;
double Penalty;
#endif
#if MULTI_MIN
int Multi_Number;
double *Multi_Cost;
double **Multi_Params;
double *Multi_Grid;
int Multi_Specify;
#endif
#if ASA_PARALLEL
int Gener_Mov_Avr;
LONG_INT Gener_Block;
LONG_INT Gener_Block_Max;
#endif
#if ASA_SAVE
ALLOC_INT Random_Array_Dim;
double *Random_Array;
#endif
int Asa_Recursive_Level;
} USER_DEFINES;

/* system function prototypes */

#if HAVE_ANSI

/* This block gives trouble under some Ultrix */
#if FALSE
int fprintf (FILE * fp, const char *string, ...);
int sprintf (char *s, const char *format, ...);
FILE *popen (const char *command, const char *mode);
void exit (int code);
#endif

#if IO_PROTOTYPES
int fprintf ();
int sprintf ();
int fflush (FILE * fp);
int fclose (FILE * fp);
void exit ();
int fread ();
int fwrite ();
int pclose ();
#endif

double
asa (double (*user_cost_function)


(double *, double *, double *, double *, double *, ALLOC_INT *,
int *, int *, int *, USER_DEFINES *),
double (*user_random_generator) (LONG_INT *), LONG_INT * rand_seed,
double *parameter_initial_final, double *parameter_minimum,
double *parameter_maximum, double *tangents, double *curvature,
ALLOC_INT * number_parameters, int *parameter_type,
int *valid_state_generated_flag, int *exit_status,
USER_DEFINES * OPTIONS);

#if TIME_CALC
void print_time (char *message, FILE * ptr_out);
#endif

#if FDLIBM_POW
double s_pow (double x, double y);
#endif
#if FDLIBM_LOG
double s_log (double x);
#endif
#if FDLIBM_EXP
double s_exp (double x);
#endif

#else /* HAVE_ANSI */

#if IO_PROTOTYPES
int fprintf ();
int sprintf ();
int fflush ();
int fclose ();
int fread ();
int fwrite ();
FILE *popen ();
int pclose ();
#endif

double asa ();

#if TIME_CALC
void print_time ();
#endif

#if FDLIBM_POW
double s_pow ();
#endif
#if FDLIBM_LOG
double s_log ();
#endif
#if FDLIBM_EXP
double s_exp ();
#endif

#endif /* HAVE_ANSI */

#ifdef __cplusplus
}
#endif
#endif /* _ASA_USER_ASA_H_ */
Nov 27 '18 #1
1 4360
weaknessforcats
9,208 Recognized Expert Moderator Expert
I can't help you here. Your code compiles and links no warnings no errors using Visual Studio 2013.
Nov 27 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2601
by: John | last post by:
Please, consider this macro: #define mymacro(arg1, arg2) arg1 and arg2 Then it is used: mymacro(boys, girls) How is its expansion?
1
1851
by: D Senthil Kumar | last post by:
Hi, Is it possible to get the name of the macro from that macro itself. Thank you in advance.
17
7051
by: sounak | last post by:
How could we get a macro name from a macro value such that in a header file #define a 100 #define b 200 now the source file will be such that the user gives 100 then the value is outputted as...
2
2203
by: Kathy | last post by:
One of my customers is running an Access 2003 application. They have the Macro Security Level set to Low. When the .mde app is executed directly from the C: drive on their server, they get into...
1
4271
by: rockdc1981 | last post by:
I dont get it lately the code is working andnow i get the error message...the code below is on a list where i can select the reports from a table source and enables user to preview and export it..any...
6
2409
by: Michael B Allen | last post by:
Hi, I have a macro that looks like the following: #define MMSG msgno_loc0(LOC0, LOC1) && msgno_mmsg0 which if used in some code like: MMSG("foo=%s", foo);
5
1756
by: rupeshh | last post by:
hi In a project I saw following line of code : class PDS_COREDLL_API cMatrix viewing the definition of the PDS_COREDLL_API I was directed to a file having these lines of code
16
2757
by: mdh | last post by:
I have asked a few questions about Macros...and think what I have been missing ...and which all who have replied clearly understand...is that this is a Pre-processor action. Hopefully the above is...
2
15341
by: unagidon | last post by:
ISO C requires whitespace after the macro name #include <iostream> #include <iomanip> #include <cmath> #include <fstream> #define a=5.5 // 1 #define b=6 // 2 #define c=7 ...
1
2966
by: gbox26 | last post by:
there is a lot of errors in this perl. what causes and how can i fix them #!/usr/bin/perl use strict; use File::Path qw(make_path); use LWP::UserAgent; use File::Temp qw(tempfile tempdir);...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7158
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.