MATH3202/7232Operations Research & Mathematical Planning 2024
Tutorial8 –Dynamic Programming
Python Functions
Define functions in Pythonto
• Calculate the factorial of a numbern
• Calculate the value function for the‘Minimal Studying’ problem
• Determine the optimal solution forthe‘Minimal Studying’ problem
Knapsack Problem
Wehave a container of size 20 units, and want to packit with the following
valuableitems:
Itemj Size vj Valuetj
How many ofeachitemshould we pack inorder tomaximize thetotal value?
Fibonacci Sequence
Define afunctionin Python to calculate the number intheFibonacci
sequence.
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。