# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# write a function:

def lp(num_pushup, num_miles_ran):
  """
  This function prints the number of calories burned, time used, and if that time is greater than 10 minutes.
  """
  obj = 3.0 * num_pushup + 130.0 * num_miles_ran
  print("Calories Burned: {0}".format(obj))
  min = 0.2 * num_pushup + 10.0 * num_miles_ran
  print("Time Used: {0}".format(min))
  print("Used too much time: {0}".format(min>10.0))


lp(50,0)

# # basics of PuLP modeling

from pulp import *

model = LpProblem('maximum bakery profit', LpMaximize)

# decision variable
A = LpVariable('A', lowBound=0, cat='Integer')
B = LpVariable('B', lowBound=0, cat='Integer')

# objective function
model += 20 * A + 40 * B

# constraints
model +=.5 * A + 1   * B <= 30
model += 1 * A + 2.5 * B <= 60
model += 1 * A + 2   * B <= 22

model.solve()

print('produce {} cake A'.format(A.varValue))

print('producr {} cake B'.format(B.varValue))

StarcoderdataJupyterScriptsDedupFiltered