📄 dembo1as.c
字号:
/* **************************************************************************** */
/* user functions */
/* **************************************************************************** */
#include "o8para.h"
main() {
void donlp2(void);
donlp2();
exit(0);
}
/* **************************************************************************** */
/* donlp2 standard setup */
/* **************************************************************************** */
void setup0(void) {
#define X extern
#include "o8comm.h"
#undef X
static INTEGER i,j;
/* data di[] = { 0, /* not used : index 0 */
/* 1.e6,1.e5,1.e6,1.e9,1.e9,1.e3,1.e3,1.e3,1.e5,1.e4, */
/* 1.e4,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0, */
/* 1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0, */
/* 1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0, */
/* 1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0,1.e0 } */
/* scaling factors for x[i], incorporated into function subprograms */
/* dembo1a */
strcpy(name,"dembo1asc");
for (i = 1 ; i <= 12 ; i++) {
x[i] = 4.e0;
}
n = 12;
nh = 0;
ng = 15;
del0 = 0.05e0;
tau0 = 1.0e0;
tau = .1e0;
for (j = 0 ; j <= 3 ; j++) {
gunit[1][j] = -1;
gunit[2][j] = 0;
gunit[3][j] = 0;
}
for (j = 4 ; j <= 15 ; j++) {
gunit[1][j] = 1;
gunit[2][j] = j-3;
gunit[3][j] = 100;
}
analyt = TRUE;
epsdif = 0.e0;
silent = FALSE;
nreset = n;
return;
}
/* **************************************************************************** */
/* special setup */
/* **************************************************************************** */
void setup(void) {
#define X extern
#include "o8comm.h"
#undef X
return;
}
/* **************************************************************************** */
/* the user may add additional computations using the computed solution here */
/* **************************************************************************** */
void solchk(void) {
#define X extern
#include "o8comm.h"
#undef X
#include "o8cons.h"
return;
}
/* **************************************************************************** */
/* objective function */
/* **************************************************************************** */
void ef(DOUBLE x[],DOUBLE *fx) {
#define X extern
#include "o8fuco.h"
#undef X
void fgeo(DOUBLE x[],DOUBLE con,DOUBLE gam[],LOGICAL lin,DOUBLE dl[],void *pk,
void *pal,INTEGER nlen,INTEGER nanz,INTEGER nx,DOUBLE *fx);
static DOUBLE dl[NX+1];
static INTEGER kf[][2] = { {0, 0}, /* not used : indexes 0,0 */
{0, 1},
{0, 2},
{0, 3},
{0, 4},
{0, 5},
{0, 6},
{0, 7},
{0, 8},
{0, 9},
{0, 10},
{0, 11} };
static DOUBLE gamf[] = {0, 1.e5};
static DOUBLE alf[][2] = { {0, 0 }, /* not used : indexes 0,0 */
{0, -0.001331720e0},
{0, -0.002270927e0},
{0, -0.00248546e0 },
{0, -4.67e0 },
{0, -4.671973e0 },
{0, -0.00814e0 },
{0, -0.008092e0 },
{0, -.005e0 },
{0, -.000909e0 },
{0, -0.00088e0 },
{0, -0.00119e0 } };
icf = icf+1;
fgeo(x,0.e0,gamf,FALSE,dl,kf,alf,11,1,12,fx);
return;
}
/* **************************************************************************** */
/* gradient of objective function */
/* **************************************************************************** */
void egradf(DOUBLE x[],DOUBLE gradf[]) {
#define X extern
#include "o8fuco.h"
#undef X
void dfgeo(DOUBLE x[],DOUBLE gam[],LOGICAL lin,DOUBLE dl[],void *pk,
void *pal,INTEGER nlen,INTEGER nanz,DOUBLE g[],INTEGER nx);
static DOUBLE dl[NX+1];
static INTEGER kf[][2] = { {0, 0}, /* not used : indexes 0,0 */
{0, 1},
{0, 2},
{0, 3},
{0, 4},
{0, 5},
{0, 6},
{0, 7},
{0, 8},
{0, 9},
{0, 10},
{0, 11} };
static DOUBLE gamf[] = {0,1.e5};
static DOUBLE alf[][2] = { {0, 0 }, /* not used : indexes 0,0 */
{0, -0.001331720e0},
{0, -0.002270927e0},
{0, -0.00248546e0 },
{0, -4.67e0 },
{0, -4.671973e0 },
{0, -0.00814e0 },
{0, -0.008092e0 },
{0, -.005e0 },
{0, -.000909e0 },
{0, -0.00088e0 },
{0, -0.00119e0 } };
icgf = icgf+1;
dfgeo(x,gamf,FALSE,dl,kf,alf,11,1,gradf,12);
return;
}
/* **************************************************************************** */
/* compute the i-th equality constaint, value is hxi */
/* **************************************************************************** */
void eh(INTEGER i,DOUBLE x[],DOUBLE *hxi) {
#define X extern
#include "o8fuco.h"
#undef X
return;
}
/* **************************************************************************** */
/* compute the gradient of the i-th equality constraint */
/* **************************************************************************** */
void egradh(INTEGER i,DOUBLE x[],DOUBLE gradhi[]) {
#define X extern
#include "o8fuco.h"
#undef X
return;
}
/* **************************************************************************** */
/* compute the i-th inequality constaint, bounds included */
/* **************************************************************************** */
void eg(INTEGER i,DOUBLE x[],DOUBLE *gxi) {
#define X extern
#include "o8fuco.h"
#undef X
void fgeo(DOUBLE x[],DOUBLE con,DOUBLE gam[],LOGICAL lin,DOUBLE dl[],void *pk,
void *pal,INTEGER nlen,INTEGER nanz,INTEGER nx,DOUBLE *fx);
static DOUBLE gam2[] = { 0., /* not used : index 0 */
-1.e-9,-1.e-9,-1.e-3,-1.e-3,
-1.0898645e-1,-1.6108052e-5,-1.0e-23,-1.9304541e-8,
-1.e-4 };
static DOUBLE gam3[] = { 0., /* not used : index 0 */
-1.0898645e-1,-1.6108052e-5,-1.e-23,-1.9304541e-8,
-1.1184059e-4 };
static DOUBLE al2[][10] = {
{0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0},
{0.e0, 1.e0, 1.e0, 1.e0, 1.e0, 1.e0, 1.e0, 1.e0, 1.e0, 1.e0},
{0.e0, 1.e0,-1.e0,-1.e0, 1.e0, 1.e0, 1.e0, 1.e0,-1.e0,-1.e0},
{0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0,-1.e0, 1.e0, 1.e0, 0.e0},
{0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0,-2.e0, 0.e0} };
static INTEGER k2[][10] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 4, 5, 6, 7, 4, 2, 2, 2,10},
{0, 12,12,12,12, 5, 5, 4, 4,12},
{0, 0, 0, 0, 0, 0,12, 5, 4, 0},
{0, 0, 0, 0, 0, 0, 0, 0,12, 0} };
static DOUBLE al3[][6] = {
{0.e0, 0.e0, 0.e0, 0.e0, 0.e0, 0.e0},
{0.e0, 1.e0, 1.e0, 1.e0, 1.e0, 1.e0},
{0.e0, 1.e0, 1.e0, 1.e0,-1.e0, 1.e0},
{0.e0, 0.e0, 0.e0, 1.e0, 1.e0, 0.e0} };
static INTEGER k3[][6] = {
{0, 0, 0, 0, 0, 0},
{0, 4, 2, 2, 2, 1},
{0, 5, 5, 4, 4, 9},
{0, 0, 0, 5, 5, 0} };
static DOUBLE ug[] = { 0., /* not used : index 0 */
.1e0,.1e0,.1e0,.01e0,1.e0,0.1e0,0.1e0,0.1e0,0.1e0,0.1e0,0.1e0,0.1e0 };
static DOUBLE dl2[] = { 0., /* not used : index 0 */
-1.e-6,-1.e-5,-1.e-6,0.e0,0.e0,0.e0,0.e0,0.e0,0.e0,0.e0,0.e0,0.e0 };
static DOUBLE dl3[] = { 0., /* not used : index 0 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -