Project

General

Profile

C++ issue

Added by gadi balouj over 2 years ago

I have a problem of minimizing a function to optimize variables which 2 of them are depending on number of data point. for example, and for each data point, the routine must generate two solutions , one for x0 and one for x1, and the rest of variables generate 1 set only , and for two data points the program must generate 4 solutions 2 for x0 and 2 for x1, and 6 variables of one set , and so on .
I want to put bounds on x0 and x1 depending on number of data points . For example for 3 data points I make the following but it does not work and the purpose is to bound only x0 and x1 to data points and the rest of variables are constrained by other bounds:
enter code here

// for data point Number 1 to bound x[0]:
for (int i=0; i<=Ndata-2;i++){
for (int j=0; j<=Ndata-2;j++){

int ix0_= xx0_index(i,j);

x_l[ix0_] = lb_x01_;

x_u[ix0_] = ub_x01_;

}
}

// for data point Number 2 to bound x[0]:
for (int k=1; k<=Ndata-1;k++){
for (int m=1; m<=Ndata-1;m++){
int ix0_= xx0_index(k,m);
x_l[ix0_] = lb_x02_;
x_u[ix0_] = ub_x02_;

}
}
// for data point Number 3 to bound x[0]:

for (int k=2; k<=Ndata;k++){
for (int m=2; m<=Ndata-2;m++){
int ix0_= xx0_index(k,m);
x_l[ix0_] = lb_x03_;
x_u[ix0_] = ub_x03_;

}
}
}

creat a function member void Parameters(int N,double b_x01, double ub_x01, double lb_x02, double ub_x02)
in the base class as proctected function by using
protected:
void Parameters(int N,double b_x01, double ub_x01, double lb_x02, double ub_x02);
};
then I creat I dervied class from the base one
derived class: base class
// I define the lb_x01, ub_x01, lb_x02, ub_x02 by assigning value
b_x01= value1;
ub_x01= valu2;
lb_x02= value3;
lb_x02 = value4;
};

I when I call void Parameters(int N,double b_x01, double ub_x01, double lb_x02, double ub_x02) in file.cpp by making
void base class::parameters(int N,double b_x01, double ub_x01, double lb_x02, double ub_x02)
the compiler does not give these values. How can I resolve this please? How can I creat an instance of derived class for a sepcified member(i.e, lb_x01?
Please I need your help to advance because I have no time
Thank you;


Replies (1)

RE: C++ issue - Added by gadi balouj over 2 years ago

I call void Parameters(int N,double b_x01, double ub_x01, double lb_x02, double ub_x02) in file.cpp by making

void base class::parameters(int N,double b_x01, double ub_x01, double lb_x02, double ub_x02)
the compiler does not give these values. How can I resolve this please? How can I creat an instance of derived class for a sepcified member(i.e, lb_x01?
Please I need your help to advance because I have no time
Thank you;

    (1-1/1)