I have a problem of minimizing a function to optimize 8 variables, but for each data point the routine must generate two solutions , one for x[0] and one for x[1] and the rest of 6 variables generate 1 set only , and for two data point the program must generate 4 solutions 2 for x[0] and 2 for x[1], and 6 variables of one set , and so on , how can I generate this for C++ optimization algorithm? I tried to do the following but is does not matter to do the expected
base class
public:

inline int xx0_index(int i, int j) const
{
//N the problem dimension and Ndata the data point
int Ndata= 22;
return N + Ndata*2 - 2;
};
derived class: base class
public:
}
f(float(&g)[20],const float* x)
{
/// I creat two pointer
const float *x1_index;
const float* x2_index;
//o =2 (for x[0] and x[1]) and Ndata the are data point
x1_index = new float[o_*Ndata];
x2_index = new float[o_*Ndata];
//then I made the following assignment
for (int j=1; j<=2; j++) {
for(int i = 1; i<=Ndata; i++){

int ix0_= xx0_index(1,i);
int ix1_= xx0_index(2,i);
x[0] == x1_index[ix0_];
x[1] == x2_index[ix1_];
}
}
};

and for printting the result how can I print two soltions of x[0] and x[1] for each data point with other 6 varaibale which must generate only one set
cordially
Last edited on
http://www.catb.org/esr/faqs/smart-questions.html

Show what you have done, using code tags. Reformat the original post with code code tags and proper formatting so it makes more sense. Show any errors or warnings from compilation verbatim.

It looks as though you haven't tried very hard - declared some variables then left it at that.
Last edited on
I edit the post please if you have any suggestion for this issue do not hesitate to share it with me
 I edit the post

No you didn't, not to any real effect.
Well, you could try editing the post and adding code tags.

 PLEASE learn to use code tags, they make reading and commenting on source code MUCH easier. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/ HINT: you can edit your post and add code tags. Some formatting & indentation would not hurt either
The code is not compilable C++. Post complete, compilable program code.