1. ## The variable input

If I have a few groups Variable，for example：x_1[1:5],x_2[1:3]
i want to put into the fcn,can i use?,for example:void fcn(int n, float x_1[],float x_2[] int iact, float *result, int *ierr)  Reply With Quote

2. Originally Posted by zhangyunfeng If I have a few groups Variable，for example：x_1[1:5],x_2[1:3]
i want to put into the fcn,can i use?,for example:void fcn(int n, float x_1[],float x_2[] int iact, float *result, int *ierr)
and in imsl_f_constrained_nlp ,if i have several inequality constraints,what should i do ?
i find if i add the "case 3",to no effect  Reply With Quote

3. Originally Posted by zhangyunfeng If I have a few groups Variable，for example：x_1[1:5],x_2[1:3]
i want to put into the fcn,can i use?,for example:void fcn(int n, float x_1[],float x_2[] int iact, float *result, int *ierr)
Without context, this question is incomprehensible. What is a "groups Variable"? Is this a question about the C language, or some IMSL function? If the latter, which?

If this is a question about the "fcn" argument to "imsl_f_constrained_nlp", the answer is that it should a pointer to a function with the prototype given in the documentation. You cannot change the order or types of the arguments to "fcn". You can either combine x_1[] and x_2[] into x[], or you can split and recombine the pieces in a wrapper function. For example:

void fcn(int n, float x[], int iact, float result[]){
float *x_1 = x-1,*x_2=x+4; // split x into x_1[1:5] = x[0:4], x_2[1:3] = x[5:7]
my_fcn(n, x_1, x_2, iact, result);
}  Reply With Quote

4. Originally Posted by zhangyunfeng and in imsl_f_constrained_nlp ,if i have several inequality constraints,what should i do ?
i find if i add the "case 3",to no effect
If you have, for example, three equality constraints and two inequality constraints, you would write the following code in the function and call the IMSL routine with meq = 3, m = 5:

Code:
```switch (iact) {

case 0:

*result ={expression for objective function};

break;

case 1:
*result = {expression for equality constraint-1};
break;
case 2:
*result = {expression for equality constraint-2};
break;
case 3:
*result = {expression for equality constraint-3};
break;
case 4:
*result = {expression for inequality constraint-1};
break;
case 5:
*result = {expression for inequality constraint-2};
break;

default: ;
break;
}```  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•