Skip to content

Commit

Permalink
Updated data and fixed bug in line remove script
Browse files Browse the repository at this point in the history
  • Loading branch information
willu47 committed Aug 19, 2019
1 parent b9064ed commit 01f59dc
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions run_analysis_gurobi.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
MODEL_RUN_NAME=TEMBA_09_08_Ref
DATA_FOLDER=output_data
#!/bin/bash
if [ "$1" != "" ]; then
echo "Running model workflow for $1"
MODEL_RUN_NAME=$1
DATA_FOLDER=output_data

INPUT_FILE=$MODEL_RUN_NAME.xlsx
INPUT_FILE=$MODEL_RUN_NAME.xlsx

MODEL_FILE=model/Temba_0406_modex.txt
# This should be replaced by a model file downloaded from the OSeMOSYS repository (or a branch of the repository)
MODEL_FILE=model/Temba_0406_modex.txt

DATA_FILE=$DATA_FOLDER/$MODEL_RUN_NAME.txt
LP_FILE=$DATA_FOLDER/$MODEL_RUN_NAME.lp.gz
GUROBI_FILE=$DATA_FOLDER/$MODEL_RUN_NAME
DATA_FILE=$DATA_FOLDER/$MODEL_RUN_NAME.txt
LP_FILE=$DATA_FOLDER/$MODEL_RUN_NAME.lp.gz
GUROBI_FILE=$DATA_FOLDER/$MODEL_RUN_NAME

python scripts/excel_to_osemosys.py input_data $INPUT_FILE $DATA_FILE
python scripts/CBC_results_AS_MODEX.py $DATA_FILE
python scripts/excel_to_osemosys.py input_data $INPUT_FILE $DATA_FILE
python scripts/CBC_results_AS_MODEX.py $DATA_FILE

glpsol -m $MODEL_FILE -d $DATA_FILE --wlp $LP_FILE --check
glpsol -m $MODEL_FILE -d $DATA_FILE --wlp $LP_FILE --check

# Solve with Gurobi
gurobi_cl NumericFocus=1 ResultFile=$GUROBI_FILE.sol LogFile=$GUROBI_FILE.log $LP_FILE
sed '/ * 0/d' $GUROBI_FILE.sol >> results/$GUROBI_FILE.sol # Remove zero value items
# Solve with Gurobi
gurobi_cl NumericFocus=1 ResultFile=$GUROBI_FILE.sol ResultFile=$GUROBI_FILE.ilp LogFile=$GUROBI_FILE.log $LP_FILE
sed '/ * 0$/d' $GUROBI_FILE.sol > results/$MODEL_RUN_NAME.sol # Remove zero value items

# Create a folder in which to place the csv files computed by the generate_pickle script
mkdir -p results/$MODEL_RUN_NAME

# Generate the processed results files including csv files of computed results and a pickle file for the viewer
python scripts/generate_pickle.py output_data/$MODEL_RUN_NAME.txt results/$MODEL_RUN_NAME.sol gurobi results/$MODEL_RUN_NAME.pickle results/$MODEL_RUN_NAME

else
echo "usage: bash $0 <model run name>"
exit 1
fi

0 comments on commit 01f59dc

Please sign in to comment.