#!/bin/bash # makes seq use decimal dots in Swedish locale, not commas export LANG=C echo "x=[" for d in $(seq 0 0.05 2.5) do lp_solve < /tmp/lp_result min: xc; xa + xb >= $d; -2 xa - 3 xb >= -5; -3 xa - 2 xb + xc >= 0; EOF for var in xa xb xc do V=$(grep $var /tmp/lp_result | sed -e 's/^[^0-9]*//') export $var=$V done echo "$d,$xa,$xb,$xc;" done echo "];" echo "plot(x(:,1),x(:,2),x(:,1),x(:,3),x(:,1),x(:,4));" echo "legend('techA','techB','CO_2','location','northeastoutside');" echo "xlabel('Demand');" echo "ylabel('Intensity');" echo "title('CO_2-minimizing labour constrained economy');" echo "axis([0,2.5,0,8]);" echo "print('tiny_economy2.png');"