22 #include "TermConstant.h"
23 #include "TermVariable.h"
25 #include "TermProduct.h"
35 string var(
string name,
int index1,
int index2,
int index3) {
44 int defineProblem(
Problem *p,
const int n,
const int w) {
48 Term *obj, *t1, *t2, *t3, *t4, *t5, *t6;
52 for (
int i = 0; i < n; i++) {
53 for (
int k = 0; k < n; k++) {
54 for (
int g = 0; g < n; g++) {
55 for (
int h = 0; h < n; h++) {
56 for (
int r = 0; r < n; r++) {
57 for (
int s = 0; s < n; s++) {
59 for (
int t = 0; t < w; t++) {
73 if (i == g && h == r && s == k) {
91 cout <<
"Problem mismatch" << endl;
97 int initializeVariableValues(
Problem *p, vector<double>* variableValues) {
98 int numberofVariables;
100 for (
int i = 0; i < numberofVariables; i++) {
102 value = 1. - 2. * (double) rand() / (double) RAND_MAX;
103 variableValues->insert(variableValues->end(), value);
110 vector<double>* variableValues;
111 DoubleVector *hessian;
117 ret = defineProblem(p, n, w);
118 if (ret != EXIT_SUCCESS) {
125 variableValues =
new vector<double>();
126 initializeVariableValues(p, variableValues);
130 if (p->
hessian(variableValues, &hessian)) {
131 cout <<
"Size of Hessian " << hessian->size() << endl;
138 delete(variableValues);