Professional Documents
Culture Documents
Cautare directa:
Chart Title
4
3.5
2.5
1.5
0.5
0
0 0.5 1 1.5 2
Cautare pe coordonate:
Chart Title
2.5
1.5
0.5
0
-1 -0.5 0 0.5 1 1.5 2 2.5
-0.5
-1
-1.5
Series1 Series2
Gradient Descent:
Chart Title
1.2
0.8
0.6
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1 1.2
Pentru Rosenblock:
Cautare directa:
Chart Title
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Cautare pe coordonate:
Chart Title
18
16
14
12
10
8
6
4
2
0
-0.4 -0.2 -2 0 0.2 0.4 0.6 0.8
Series1 Series2
Gradient Descent:
Chart Title
1.2
0.8
0.6
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1 1.2
Codul Sursa:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
FILE *logpatternSearch;
FILE *logCoordonate;
FILE *logGradient;
void coordonate(double f(double,double), double pas, double alfa, double tol, double x[2]);
return 2*x - y - 1;
return -x + 2*y - 1;
}
int i;
int i;
int main() {
logGradient = fopen("logGradient.csv","w");
if(logpatternSearch==NULL || logCoordonate==NULL || logGradient==NULL) {
return 1;
printf("%f\n", init[1]);
double x_next[2];
double aux[2];
int k;
int i;
int j;
aux[j] = dir[i][j];
else
verif = 0;
if(verif == 0)
coef/=1.001;
void coordonate(double f(double,double), double pas, double alfa, double tol, double x[2]){
int distanta;
double f0;
int j;
int i;
for( i=0; i<2; i++){
f0 = f(x[0],x[1]);
distanta =1;
if(f(x[0],x[1])>f0){
distanta = -1;
while(f0>= f(x[0],x[1])){
f0 = f(x[0],x[1]);
pas = pas*alfa;
break;
int nr_pasi = 0;
double distanta;
do {
x0_ant = x0_init;
x1_ant = x1_init;
nr_pasi++;