source: trunk/packages/optimizer/src/fitfunc/ff_modules_for_discrete_params.c

Last change on this file was 5673, checked in by ldelgass, 9 years ago

Fix line endings, set eol-style to native on all C/C++ sources.

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1/*
2* This module contains functions which will help a user write his own Fitness Function in case of discrete variables
3* Have not written the code yet. Need to verify some things first.
4*/
5#include<stdio.h>
6#include<math.h>
7#include<stdlib.h>
8#include<time.h>
9#include "pgapack.h"
10#include "rp_optimizer.h"
11
12
13/*Idea behind this function: Whenever a user would want to get the value of a certain i/p geneeter
14*during the course of a GA, he would use this function. The work of interfacing it to the GA Algo
15* is not yet complete.
16*/
17double get_gene(char* name){
18        return 0;
19}
20
21/*
22 * Return the actual values of all the genes in the currently evaluated chromosome
23 */
24double* get_all_genes(){
25        return 0;
26}
27
28/*
29 * The way to go about doing this is to fetch 
30 */
31double weighted_sum_of_variances(double* array_of_current_values, double* array_of_desired_values){
32        return 0;
33}
34
35
36double abs_nth_power_distance(double actual_value, double desired_value,double power){
37        return pow(fabs(actual_value-desired_value),power);
38}
39
40int main(){
41        double actual=5,desired=30,power=0.2;
42        printf("Actual - %lf, Desired - %lf, (Actual-Desired)^ %lf is %lf\n", actual,desired,power,abs_nth_power_distance(actual,desired,power));
43        return 0;
44}
Note: See TracBrowser for help on using the repository browser.