#Graphical resolution of the River Pollution Problem
#Create one point
x<-0
y<-0

# Plot a graph with nothing
plot(x,y, type="n", xlim=c(0,350), ylim=c(0,350), main="The River Pollution Problem")

#Plot constraints
# 1. Employment
lines(c(0,300), c(300,0), col="Blue", lwd=2)
text(200,50,"x+y=300",col="Red")

# 2. Revenues
abline(200,-1/2, col="Blue", lwd=2, lty=1)
text(50,150,"0.5x+y=200",col="Red")

# 3. Mech Capacity
lines(c(300,300), c(0,500), col="Blue", lwd=2)
text(250,220, "x=300",col="Red")

# 4. Chem Capacity
lines(c(0,500), c(200,200), col="Blue", lwd=2)
text(20,220,"y=200",col="Red")

polygon(c(300,300,100,200),c(50,200,200,100), col="Red")
points(c(300,300,100,200),c(50,200,200,100), pch=19, cex=2, col="Black")
text(c(300,300,100,200)+10,c(50,200,200,100)+20,c("D","C","B","A") )

#Plot objective function
abline(0*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,0*2/3,0)

abline(100*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,100*2/3,100)

abline(200*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,200*2/3,200)

abline(300*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,300*2/3,300)

abline(400*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,400*2/3,400)

abline(500*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,500*2/3,500)

abline(600*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,600*2/3,600)

abline(700*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,700*2/3,700)

abline(800*2/3,-2/3, col="green", lwd=2, lty=3)
text(0,800*2/3,800)


for (z in seq(from=0,to=800,by=100)) abline(z*2/3,-2/3, col="green", lwd=2, lty=3)
for (z in seq(from=0,to=800,by=100)) text(0,z*2/3,z)

abline(350*2/3,-2/3, col="green", lwd=5, lty=1)
text(0,350*2/3,"350")

