Untitled

mail@pastecode.io avatar
unknown
abc
2 years ago
937 B
1
Indexable
Never
nBig <- 1e+5

x1 <- runif(n = nBig, min = 0, max = 2000)
x2 <- runif(n = nBig, min = 0, max = 2000)


isDraw <- rep(FALSE, legth = nBig)


isDraw <- ((0.52*x1 + 0.1*x2 <=180) & (0.01*x1 + 0.005*x2 <= 5.5) & (0.5*x1 + x2 <= 780) &(x1 >= 0) & (x2 >= 0))

plot(
  x = 1,
  y = 1,
  type = 'n',
  xlim = c(-1,400),
  ylim = c(-1,800),
  main = 'область возможных решений',
  xlab = 'кол-во батонов',
  ylab = 'кол-во булочек',
  cex.main = 1.5,
  caex.lab = 1.2,
)

points(
  x = x1[isDraw],
  y = x2[isDraw],
  col = 'green',
  pch = 21,
  cex = 0.5
)
# 4x1 + 7x2 = 
lines(
  x = c(0, 807),
  y = c(910,0),
  col = 'red',
  lwd = 1
)
legend(x = 400 ,y = 800, legend = 'a = 3')
points(
  x = 213,
  y = 671,
  pch = 3,
  bg = 'black',
  col ='blue',
  cex = 3,
  lwd =1.5
  
)

pr <- 4*213 + 7*671
pr2 <- 4*106 + 7*674
print(pr)
print(pr2)