title: Is it possible reduce time of building a mathematical formulate in coding?
body: <p>I would like to use the optimization model in a code. But processing and preparation time of the objective function (f) is too long. Is there any way to reduce the time of these kinds of large models?</p>
  <pre><code>using JuMP,CPLEX
  Tsp=Model(solver=CplexSolver());
  
  #Parameters-----------------------------------------------------------------
  V, T, K = 1:100, 1:5, 1:5
  totalV=100
  d=1 .+ 99 .*rand(V,V);
  #variables---------------------------------------------------------------------
  @variable(Tsp,x[V,V,K,T],Bin);
  
  @variable(Tsp,u[V,V,K,T]&gt;=0);
  #constrains---------------------------------------------------------------------
  @constraint(Tsp,c1[i in V, k in K,t in T ], sum(x[i,j,k,t] for j in V )==1);
  
  @constraint(Tsp,c2[j in V, k in K,t in T], sum(x[i,j,k,t] for i in V )==1);
  
  @constraint(Tsp,c3[i in U,j in V,k in K, t in T; i!=j],u[i,k,t]-u[j,k,t]+totalV*x[i,j,k,t]&lt;=totalV-1);
  # objective function---------------------------------------------------------
  f=sum(d[i,j]*x[i,j,k,t] for i in V,j in V, k in K, t in T);
  
  @objective(Tsp, Min, f);
  
  solve(Tsp);
  </code></pre>
  <p>Thanks very much.</p>