From d3311949374cf1479f10b88b7752565f2cdf1fcb Mon Sep 17 00:00:00 2001 From: Will Usher Date: Mon, 12 Aug 2019 12:03:41 +0200 Subject: [PATCH] Better paramterisation of CPLEX workflow --- run_analysis_cplex.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/run_analysis_cplex.sh b/run_analysis_cplex.sh index a47c5bd..1796da1 100644 --- a/run_analysis_cplex.sh +++ b/run_analysis_cplex.sh @@ -10,29 +10,24 @@ DATA_FILE=$DATA_FOLDER/$MODEL_RUN_NAME.txt python scripts/excel_to_osemosys.py input_data $INPUT_FILE $DATA_FILE python scripts/CBC_results_AS_MODEX.py $INPUT_FILE -glpsol -m $MODEL_FILE -d $DATA_FOLDER/output.txt --wlp $DATA_FOLDER/temba.lp --check +glpsol -m $MODEL_FILE -d $DATA_FOLDER/$DATA_FILE --wlp $DATA_FOLDER/$MODEL_RUN_NAME.lp.gz --check # Solve with CPLEX rm -f mycplexcommands touch mycplexcommands -echo "read $DATA_FOLDER/temba.lp" > mycplexcommands +echo "read $DATA_FOLDER/$MODEL_RUN_NAME.lp.gz" > mycplexcommands echo "optimize" >> mycplexcommands echo "write" >> mycplexcommands -echo "$DATA_FOLDER/temba.sol" >> mycplexcommands +echo "$DATA_FOLDER/$MODEL_RUN_NAME.sol" >> mycplexcommands echo "quit" >> mycplexcommands cplex < mycplexcommands -python scripts/transform_31072013.py $DATA_FOLDER/temba.sol $DATA_FOLDER/temba_solution.txt -sort $DATA_FOLDER/temba_solution.txt -o $DATA_FOLDER/temba_sorted.txt +python scripts/transform_31072013.py $DATA_FOLDER/$MODEL_RUN_NAME.sol $DATA_FOLDER/$MODEL_RUN_NAME.txt +sort $DATA_FOLDER/$MODEL_RUN_NAME.txt > $DATA_FOLDER/sorted_$MODEL_RUN_NAME.txt -wget https://raw.githubusercontent.com/OSeMOSYS/OSeMOSYS_GNU_MathProg/cplex_to_cbc/scripts/convert_cplex_to_cbc.py -O scripts/convert_cplex_to_cbc.py +curl https://raw.githubusercontent.com/OSeMOSYS/OSeMOSYS_GNU_MathProg/master/scripts/convert_cplex_to_cbc.py -o scripts/convert_cplex_to_cbc.py -python scripts/convert_cplex_to_cbc.py $DATA_FOLDER/temba_sorted.txt $DATA_FOLDER/temba_sorted_cbc.txt +python scripts/convert_cplex_to_cbc.py $DATA_FOLDER/sorted_$MODEL_RUN_NAME.txt results/$MODEL_RUN_NAME.sol -# Solve with CBC -cbc $DATA_FOLDER/temba.lp -dualpivot pesteep -psi 1.0 -pertv 52 -duals solve -solu $DATA_FOLDER/temba_sorted_cbc.txt - -# Solve with Gurobi -gurobi_cl NumericFocus=1 ResultFile=$DATA_FOLDER/temba_gur.sol LogFile=$DATA_FOLDER/temba_gur.log $DATA_FOLDER/temba.lp -sed '/ * 0/d' $DATA_FOLDER/temba_gur.sol >> $DATA_FOLDER/temba_gur_nz.sol # Remove zero value items \ No newline at end of file +python scripts/generate_pickle.py results/$MODEL_RUN_NAME.sol results/$MODEL_RUN_NAME.pickle \ No newline at end of file