[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Siman problem copying best_values
From: |
Alessandro Nascimento |
Subject: |
[Help-gsl] Siman problem copying best_values |
Date: |
Mon, 7 Jan 2013 12:39:39 -0200 |
Hi GSL folks,
I am trying a SA optimization with this code:
/**********************************************************************************************
double Optimizer::Simulated_Annealing(Mol2* Lig){
gsl_rng* r;
r = gsl_rng_alloc(gsl_rng_ranlxs2);
srand(time(NULL));
gsl_rng_set(r, (rand() % 100));
gsl_siman_params_t params = { 200, 200, 1.0, 1.0, 0.001, 1.1, 0.00001};
double f_minimum = evaluate_energy(Lig, Lig->xyz);
printf("Evaluated energy: %7.3f ------> %7.3f\n", f_minimum,
Lig->xyz[0][0]);
gsl_siman_solve(r, Lig, siman_energy, siman_new_step, siman_change,
siman_print_data, NULL, NULL, NULL, sizeof(Mol2), params);
f_minimum = evaluate_energy(Lig, Lig->xyz);
printf("Evaluated energy: %7.3f ------> %7.3f\n", f_minimum,
Lig->xyz[0][0]);
***************************************************************************************************/
The energy function also calls my function "evaluate_energy" cpp function:
/**********************************************************************************************
double Optimizer::siman_energy(void *data){
double f;
Mol2* Lig2 = (Mol2*) data;
f = evaluate_energy(Lig2, Lig2->xyz);
return (f);
}
***************************************************************************************************/
The funny thing is that I can NOT get the best energies achievied with SA
after gsl_siman_solve.In contrary, I have something like:
Evaluated energy: 7.540 ------> 13.196
#-iter #-evals temperature position energy
0 101 0.001 11.508 -7.16879 -7.16879
1 201 0.000909091 6.181 -37.311 -37.311
2 301 0.000826446 9.292 -85.9492 -85.9492
3 401 0.000751315 0.529 -85.9492 -85.9492
4 501 0.000683013 2.821 -85.9492 -85.9492
5 601 0.000620921 0.771 -85.9492 -85.9492
6 701 0.000564474 1.260 -85.9492 -85.9492
7 801 0.000513158 -12.741 -85.9492 -85.9492
8 901 0.000466507 -9.173 -85.9492 -85.9492
9 1001 0.000424098 -15.450 -85.9492 -85.9492
10 1101 0.000385543 -8.908 -85.9492 -85.9492
11 1201 0.000350494 -21.362 -85.9492 -85.9492
12 1301 0.000318631 -21.844 -85.9492 -85.9492
13 1401 0.000289664 -20.422 -85.9492 -85.9492
14 1501 0.000263331 -20.524 -85.9492 -85.9492
15 1601 0.000239392 -21.456 -85.9492 -85.9492
16 1701 0.000217629 -29.786 -85.9492 -85.9492
17 1801 0.000197845 -28.451 -85.9492 -85.9492
18 1901 0.000179859 -34.339 -85.9492 -85.9492
19 2001 0.000163508 -34.233 -85.9492 -85.9492
20 2101 0.000148644 -35.589 -85.9492 -85.9492
21 2201 0.000135131 -24.893 -85.9492 -85.9492
22 2301 0.000122846 -28.700 -85.9492 -85.9492
23 2401 0.000111678 -22.464 -85.9492 -85.9492
24 2501 0.000101526 -23.738 -85.9492 -85.9492
25 2601 9.2296e-05 -27.228 -85.9492 -85.9492
26 2701 8.39055e-05 -34.404 -85.9492 -85.9492
27 2801 7.62777e-05 -26.407 -85.9492 -85.9492
28 2901 6.93433e-05 -17.783 -85.9492 -85.9492
29 3001 6.30394e-05 -19.237 -85.9492 -85.9492
30 3101 5.73086e-05 -33.685 -85.9492 -85.9492
31 3201 5.20987e-05 -21.991 -85.9492 -85.9492
32 3301 4.73624e-05 -28.721 -85.9492 -85.9492
33 3401 4.30568e-05 -37.596 -85.9492 -85.9492
34 3501 3.91425e-05 -31.584 -85.9492 -85.9492
35 3601 3.55841e-05 -39.479 -85.9492 -85.9492
36 3701 3.23492e-05 -36.385 -85.9492 -85.9492
37 3801 2.94083e-05 -40.311 -85.9492 -85.9492
38 3901 2.67349e-05 -32.598 -85.9492 -85.9492
39 4001 2.43044e-05 -39.861 -85.9492 -85.9492
40 4101 2.20949e-05 -40.343 -85.9492 -85.9492
41 4201 2.00863e-05 -41.349 -85.9492 -85.9492
42 4301 1.82603e-05 -36.646 -85.9492 -85.9492
43 4401 1.66002e-05 -26.142 -85.9492 -85.9492
44 4501 1.50911e-05 -28.222 -85.9492 -85.9492
45 4601 1.37192e-05 -21.963 -85.9492 -85.9492
46 4701 1.2472e-05 -32.856 -85.9492 -85.9492
47 4801 1.13382e-05 -36.224 -85.9492 -85.9492
48 4901 1.03074e-05 -39.059 -85.9492 -85.9492
Evaluated energy: 0.881 ------> -39.059
Looks like the SA algorithm is working as expected but my data is not being
copied back to *x0_p, as it should.
Any clues?
PS: The entire code can be visualized in
http://code.google.com/p/libela/source/browse/trunk/iMcLiBELa/src/Optimizer.cpp
Thanks in advance,
--nascimento
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-gsl] Siman problem copying best_values,
Alessandro Nascimento <=