Originally posted by: SystemAdmin
Paul, thank you for your suggestion. I am back, I forgot my id and password, so I got a new account.
I printed the value for m, n and o, their values are correct. But I am not sure about what were you meaning "initialize the env and print it out", when I constructed it using " IloEnv env;" it has been initialized automatically, right? and did you mean I should print its pointer out? (cout<<env.getImpl()<<endl;) otherwise I do not know how to print it out, since if I use "cout<<env<<endl;" it does not work.
Yes, you were correct, there are some declare things before those piece of code, the whole piece of code from beginning is as follows, would you please help me look at it again? Thank you very much.
#include "header.h"
vector<double> MP_ADD (vector<vector<double> >& matrix_dual_var, int m, int n, int o, vector<vector<double> >& passtime_arc, vector<int>& population, vector<int>& capacity_node, vector<int>& capacity_shelter,vector<vector<int> >& capacity_edge, vector<int>& fixcost_node, vector<int>& fixcost_shelter, vector<vector<int> >& fixcost_edge,vector<vector<vector<vector<int> > > >& open_z, vector<vector<int> >& open_edge, vector<int>& open_shelter,vector<int>& open_transfer, vector<bool>& unbounded_vector)
{
vector<double> mp_val;
ILOSTLBEGIN
double masteropt;
typedef IloArray<IloNumArray> IloNumArray2;
typedef IloArray<IloNumArray2> IloNumArray3;
typedef IloArray<IloNumArray3> IloNumArray4;
typedef IloArray<IloNumVarArray> IloNumVarArray2;
typedef IloArray<IloNumVarArray2> IloNumVarArray3;
typedef IloArray<IloNumVarArray3> IloNumVarArray4;
try{
IloEnv env;
IloInt i, j, s, q, p, d;
IloModel model(env);
IloRangeArray con1(env), con2(env), con3(env), con4(env), con5(env), con6(env), con7(env), con8(env), con9(env), con10(env), con11(env), con12(env), con13(env), con14(env), con_cut(env);
cout<<"The enviorement pointer is: "<<env.getImpl()<<endl;
cout<<"m = "<<m<<endl;
cout<<"n = "<<n<<endl;
cout<<"o = "<<o<<endl;
IloNumVarArray y_shelter(env, n, 0, 1, ILOINT);
IloNumVarArray y_transfer(env, o, 0, 1, ILOINT);
IloNumVarArray2 y_edge(env, o);
for(i = 0; i < o; i++)
{
y_edge[i] = IloNumVarArray(env, o, 0, 1, ILOINT);
}
cout<<"print"<<endl;
IloNumVarArray4 z(env, m);
for(p = 0; p < m; p++)
{
z[p] = IloNumVarArray3 (env, o);
for(i=0; i<o; i++)
{
z[p][i] = IloNumVarArray2 (env, o);
for(j = 0; j < o; j++)
{
cout<<"p = "<<p<<endl;
cout<<"i = "<<i<<endl;
cout<<"j = "<<j<<endl;
z[p][i][j] = IloNumVarArray(env, o, 0, 1, ILOINT);
cout<<"F"<<endl;
}
}
}
#CPLEXOptimizers#DecisionOptimization