title: Cplex model: no solution
body: <p>having problems with my C++ Concert Cplex. 
  I'm trying to recreate the Shortest Path Problem. The output to text file is:</p>
  
  <pre><code>Minimize
   obj: 2 x_12 + x_13 + 2 x_21 + x_24 + x_31 + 3 x_34 + x_42 + 3 x_43 + x9
  Subject To
   c1: x_12 + x_13 - x_21 - x_31 + x_14 - x_41  = 1
   c2: - x_12 + x_21 + x_24 - x_42 + x_23 - x_32  = 0
   c3: - x_13 + x_31 + x_34 - x_43 - x_23 + x_32  = 0
   c4: - x_24 - x_34 + x_42 + x_43 - x_14 + x_41  = -1
  Bounds
        x9 = 0
  End
  </code></pre>
  
  <p>I then used the following code to obtain the solution:</p>
  
  <pre><code>    IloCplex spp(model);
      spp.setParam(IloCplex::RootAlg, IloCplex::AutoAlg);
      spp.solve();
      IloArray&lt;IloNumArray&gt; vals(env);
      env.out() &lt;&lt; "Solution status = " &lt;&lt; spp.getStatus() &lt;&lt; endl;
      env.out() &lt;&lt; "Solution value  = " &lt;&lt; spp.getObjValue() &lt;&lt; endl;
      env.out() &lt;&lt; "Values x       = " &lt;&lt; vals &lt;&lt; endl;
  </code></pre>
  
  <p>However the output I keep getting is:</p>
  
  <pre><code>Solution status = Optimal
  Solution value = 0
  Values x       =  []
  </code></pre>
  
  <p>Does anybody know what's wrong with my program?
  Thanks</p>
  
  <p>EDIT: </p>
  
  <p>My model is built in the program itself, here is the first part:</p>
  
  <pre><code>    IloEnv env;
      IloModel model(env);
      IloArray&lt;IloNumVarArray&gt; x(env);
      IloRangeArray c(env);
      IloInt nnodes = G.size();
      IloInt i, j;
      IloEnv env = model.getEnv();
  
      //SHORTEST PATH PROBLEM
  
      for (i = 0; i &lt; nnodes; i++){   //x decision variables
          x.add(IloNumVarArray(env, nnodes, 0, IloInfinity));
      }
      for (i = 0; i &lt; nnodes; i++){
          for (j = 0; j &lt; nnodes; j++){
              stringstream sts;
              sts &lt;&lt; "x_" &lt;&lt; i + 1 &lt;&lt; j + 1;
              x[i][j].setName(sts.str().c_str()); //SET NAMES
          }
      }
  
      //set objective min sum_(all ij)[c_ij][x_ij]
      IloExpr obj(env);
      for (i = 0; i &lt; nnodes; i++){
          for (j = 0; j &lt; nnodes; j++){
              obj += G[i][j] * x[i][j];
          }
      }
      model.add(IloMinimize(env, obj));
      obj.end();
  
      //constraints sum_j[x_ij]-sum_j[x_ji] = 1 for s, -1 for t, or 0
      for (i = 0; i &lt; nnodes; i++){
          int ss = 0;
          if (i == s) ss = 1;
          if (i == t) ss = -1;
          IloExpr sum1(env);
          IloExpr sum2(env);
          for (j = 0; j &lt; nnodes; j++){
              sum1 += x[i][j];
              sum2 += x[j][i];
          }
          c.add(sum1 - sum2 == ss);
          sum1.end();
          sum2.end();
      }
      model.add(c);
  
      //solving---------------------------------------------------------
      IloCplex spp(model);
  
      //write to file
      spp.exportModel("model1.lp");
      spp.solve();
  </code></pre>