-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.run
More file actions
96 lines (76 loc) · 4.04 KB
/
script.run
File metadata and controls
96 lines (76 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#===============#
# INITIAL SETUP #
#===============#
reset; # purge any existing model, data, and problem/solution state from the AMPL interpreter's session
load amplcsv.dll; # load CSV table handler
# AMPL display options
option display_width 233; # max characters displayed per line
option omit_zero_rows 1; # when 1, omits rows with all zero values from displayed lists
option times 0; # when 1, shows AMPL translator's time and memory stats (handy for debugging memory issues and speeding)
option gentimes 0; # when 1, shows genmod phase stats (including time and memory used per model component)
option show_stats 2; # when 1, shows generated problem's size stats; if 2, also shows presolve iteration recommendations (which often improve speed when followed)
# AMPL presolve iterations
option presolve 100; # max iterations of AMPL's presolve algorithm (raise or lower per guidance in the AMPL log, enabled by show_stat 2)
#======================#
# SELECT & TUNE SOLVER #
#======================#
option solver gurobi;
# solver options EXACT-ALGORITHMS------------------------------------------------------------------------------------------------------ HEURISTICS----------------
# log-chatter--------------------------- CPU------ stopping-criteria----------- presolve------------------------------------ continuous/relaxed-phase----------------- MIP-phase-- Other----------
option gurobi_options ' outlev=1 logfreq=10 threads=8 timelim=99999 mipgap=0.001 presolve=2 alg:method=1 bar:crossover=-1 alg:basis=3 mip:focus=0 mip:obbt=3 mip:intfocus=1 mip:disconnected=2 alg:feasrelax=0 mip:heurfrac=0.5 ';
option cplex_options ' display=1 mipdisplay=2 threads=8 time=55 mipgap=0.0001 presolve=0 primalopt mipsearch=1 heureffort=2 heurfreq=10 ';
option highs_options ' outlev=1 version timing=1 miploglev=2 timelim=233 relgaptol=0.0001 presolve=on cvt:pre:all=1 cvt:pre:eqbinary=0 parallel=choose method=choose heureff=0.5 ';
#============#
# LOAD MODEL #
#============#
model 'model.mod';
#=============#
# IMPORT DATA #
#=============#
data 'data/data.dat';
table vehicles
IN "amplcsv" "quote=double" "data/vehicles.csv":
VEHC <- [ID],
drvt ~ Vehicle,
size ~ Size,
year ~ Year,
c_prch ~ "Cost ($)",
d_max_pa ~ "Yearly range (km)",
dist ~ Distance;
read table vehicles;
table cost_profiles
IN "amplcsv" "quote=double" "data/cost_profiles.csv":
AGES <- ["End of Year"],
c_sell_fctr ~ "Resale Value %",
c_insu_fctr ~ "Insurance Cost %",
c_mntn_fctr ~ "Maintenance Cost %";
read table cost_profiles;
table carbon_emissions
IN "amplcsv" "quote=double" "data/carbon_emissions.csv":
[Year],
co2_max ~ "Carbon emission CO2/kg";
read table carbon_emissions;
table vehicles_fuels
IN "amplcsv" "quote=double" "data/vehicles_fuels.csv":
[ID, Fuel],
fuel_cons ~ "Consumption (unit_fuel/km)";
read table vehicles_fuels;
table fuels
IN "amplcsv" "quote=double" "data/fuels.csv":
[Fuel, Year],
c_fuel ~ "Cost ($/unit_fuel)",
c_fuel_uncr ~ "Cost Uncertainty (±%)";
read table fuels;
table demand
IN "amplcsv" "quote=double" "data/demand.csv":
[Size, Distance, Year],
demand ~ "Demand (km)";
read table demand;
#=======#
# SOLVE #
#=======#
solve;
#=================#
# EXPORT SOLUTION #
#=================#
commands print_submission.run;