Skip to content

yslsml/dynalglib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dynalglib

Tests Code style: black

Dynalglib is a library which is designed to solve problems using dynamic programming algorithms in Python.

Released algorithms:

  • Fibonacci
  • Knapsack Problem
  • Traveling Salesman Problem
  • Resource Allocation Problem
  • Coin Change Problem

Installing

To install this library you should run:

pip install dynalglib    

To update the library you should run:

pip install -U dynalglib

A simple example

from dynalglib import Item
from dynalglib import Knapsack

knapsack = Knapsack(
    items=[
        Item(name="apple", weight=2, value=3, quantity=6),
        Item(name="pineapple", weight=4, value=8, quantity=3),
        Item(name="kiwi", weight=3, value=6, quantity=3),
        Item(name="strawberry", weight=1, value=7, quantity=8),
    ],
    capacity=10,
)

knapsack.fill() 
print(knapsack.total_value)
print(knapsack)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages