Skip to content

Instantly share code, notes, and snippets.

View jac0320's full-sized avatar

Site Wang jac0320

View GitHub Profile
@jac0320
jac0320 / benchmark_tsp_jump.jl
Created September 6, 2018 22:52
jump benchmark file
using JuMP, CPLEX, Cbc;
at = time()
m = Model(solver=CplexSolver(CPX_PARAM_SCRIND=0, CPX_PARAM_TILIM=10));
# m = Model(solver=CbcSolver(logLevel=1))
# Parameter Initialization
node = parse(ARGS[1]);
xcoord = rand(node);
ycoord = rand(node);
@jac0320
jac0320 / benchmark_tsp_pyomo.py
Last active September 6, 2018 22:51
pyomo benchmark file
import re, sys, time
at = time.time()
import numpy as np
import pyomo.environ as pe
from pyomo.opt import SolverFactory
node = int(sys.argv[1]);
edge = node * node
@jac0320
jac0320 / benchmark_tsp_pulp.py
Created September 6, 2018 22:50
pulp benchmark file
import pulp, sys, time
import pandas as pd
import numpy as np
at = time.time()
node = int(sys.argv[1]);
xcoord = np.random.rand(node);
ycoord = np.random.rand(node);
edge = node * node
2500 250
5000 500
8000 800
9000 900
10000 1000
15000 1500
20000 2000
25000 2500
35000 3500
40000 4000
using JuMP, Ipopt
m = Model(solver=IpoptSolver())
lowub = parse(ARGS[1])
highub = parse(ARGS[2])
@variable(m, x[1:8])
setlowerbound(x[1], 100)
using JuMP, Ipopt
m = Model(solver=IpoptSolver())
@variable(m, x[1:8])
setlowerbound(x[1], 100)
setlowerbound(x[2], 1000)
setlowerbound(x[3], 1000)
setlowerbound(x[4], 10)
using JuMP, Gurobi
m = Model(solver=GurobiSolver())
@variable(m, 5 >= x >= 0)
@variable(m, 10 >= y >= 0 , Int)
@variable(m, z , Bin)
@constraint(m, x + y + z <= 10)
@constraint(m, x + 2y + z <= 15)