 [ GAMS World Home | GMS2XX Translator | Search | Contact ]

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_ = { 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_ = {
0,
0,
0,
0,
0,
0
};

static double old_x;
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;
res += -0.153*x;
res += -0.162*x;
res += -0.225*x;
res += -0.162*x;
res += -0.126*x;
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 */
g = 0.225;
/* with respect to var x */
g = 0.153;
/* with respect to var x */
g = 0.162;
/* with respect to var x */
g = 0.225;
/* with respect to var x */
g = 0.162;
/* with respect to var x */
g = 0.126;

}

return res;
}

void ceval0_(const double x[], double c[]) {
xcheck(x);

/* constraint e2 */
c  = x;
c += x;
c += x;

/* constraint e3 */
c  = x;
c += x;
c += x;

/* constraint e4 */
c  = x;
c += x;

/* constraint e5 */
c  = x;
c += x;

/* constraint e6 */
c  = x;
c += x;

}

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 */
J = 1;
/* with respect to var x */
J = 1;
/* with respect to var x */
J = 1;

/* partial derivatives for constraint e3 */
/* with respect to var x */
J = 1;
/* with respect to var x */
J = 1;
/* with respect to var x */
J = 1;

/* partial derivatives for constraint e4 */
/* with respect to var x */
J = 1;
/* with respect to var x */
J = 1;

/* partial derivatives for constraint e5 */
/* with respect to var x */
J = 1;
/* with respect to var x */
J = 1;

/* partial derivatives for constraint e6 */
/* with respect to var x */
J = 1;
/* with respect to var x */
J = 1;

}
}

#ifdef __cplusplus
}
#endif