amplnlc.c
/*
LP written by GAMS Convert at 07/06/07 14:18:15
Equation counts
Total E G L N X C
6 1 3 2 0 0 0
Variable counts
x b i s1s s2s sc si
Total cont binary integer sos1 sos2 scont sint
7 7 0 0 0 0 0 0
FX 0 0 0 0 0 0 0 0
Nonzero counts
Total const NL DLL
19 19 0 0
*/
#include "gmsfunc.h"
#include "errno.h"
#ifdef __cplusplus
extern "C" {
#endif
static int auxcom_[1] = { 0 /* Number of nonlinear constraints */ };
static int funcom_[5+1+6+1+12] = {
6, /* Number of variables */
1, /* Number of objectives */
5, /* Number of constraints */
12, /* Number of nonzeros */
0, /* =0 stored sparsely (default), =1 stored fully */
/* Objectiv Types (0 = minimize, 1 = maximize) */
0,
/* First jacobians of columns */
1,
3,
5,
7,
9,
11,
13,
/* Row numbers of jacobians */
1,
3,
1,
4,
1,
5,
2,
3,
2,
4,
2,
5
};
double boundc_[1+12+10] = {
/* Infinity */
1.7e308,
/* Variable lower and upper bounds */
0,
1.7e308,
0,
1.7e308,
0,
1.7e308,
0,
1.7e308,
0,
1.7e308,
0,
1.7e308,
/* Constraint bounds */
-1.7e308,
350,
-1.7e308,
600,
325,
1.7e308,
300,
1.7e308,
275,
1.7e308
};
double x0comn_[6] = {
0,
0,
0,
0,
0,
0
};
static double old_x[6];
static int xkind = -1;
static int xcheck (const double x[]) {
double *x1 = old_x;
const double *xe = x + 6;
errno = 0;
if (xkind >= 0) {
while(*x++ == *x1++)
if (x == xe)
return 0;
--x, --x1;
}
do *x1++ = *x++;
while(x < xe);
xkind = 0;
return 1;
}
double feval0_(const int *nobj, const double x[]) {
double res;
xcheck(x);
/* objective */
res = -0.225*x[0];
res += -0.153*x[1];
res += -0.162*x[2];
res += -0.225*x[3];
res += -0.162*x[4];
res += -0.126*x[5];
res /= -1;
return res;
}
double feval_(const int *nobj, const int *needfg, const double x[], double g[]) {
double res;
int wantfg = *needfg;
if (xcheck(x) && wantfg == 2)
wantfg = 3;
if (wantfg & 1) {
res = feval0_(nobj,x);
}
if (wantfg & 2) {
/* partial derivatives for objective */
/* with respect to var x[0] */
g[0] = 0.225;
/* with respect to var x[1] */
g[1] = 0.153;
/* with respect to var x[2] */
g[2] = 0.162;
/* with respect to var x[3] */
g[3] = 0.225;
/* with respect to var x[4] */
g[4] = 0.162;
/* with respect to var x[5] */
g[5] = 0.126;
}
return res;
}
void ceval0_(const double x[], double c[]) {
xcheck(x);
/* constraint e2 */
c[0] = x[0];
c[0] += x[1];
c[0] += x[2];
/* constraint e3 */
c[1] = x[3];
c[1] += x[4];
c[1] += x[5];
/* constraint e4 */
c[2] = x[0];
c[2] += x[3];
/* constraint e5 */
c[3] = x[1];
c[3] += x[4];
/* constraint e6 */
c[4] = x[2];
c[4] += x[5];
}
void ceval_(const int *needfg, const double x[], double c[], double J[]) {
int wantfg = *needfg;
if (xcheck(x) && wantfg == 2)
wantfg = 3;
if (wantfg & 1) {
ceval0_(x,c);
}
if (wantfg & 2) {
/* partial derivatives for constraint e2 */
/* with respect to var x[0] */
J[0] = 1;
/* with respect to var x[1] */
J[2] = 1;
/* with respect to var x[2] */
J[4] = 1;
/* partial derivatives for constraint e3 */
/* with respect to var x[3] */
J[6] = 1;
/* with respect to var x[4] */
J[8] = 1;
/* with respect to var x[5] */
J[10] = 1;
/* partial derivatives for constraint e4 */
/* with respect to var x[0] */
J[1] = 1;
/* with respect to var x[3] */
J[7] = 1;
/* partial derivatives for constraint e5 */
/* with respect to var x[1] */
J[3] = 1;
/* with respect to var x[4] */
J[9] = 1;
/* partial derivatives for constraint e6 */
/* with respect to var x[2] */
J[5] = 1;
/* with respect to var x[5] */
J[11] = 1;
}
}
#ifdef __cplusplus
}
#endif