Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with COTSCar.set_vec() #17

Open
hmedal opened this issue Jan 17, 2024 · 0 comments
Open

Issue with COTSCar.set_vec() #17

hmedal opened this issue Jan 17, 2024 · 0 comments

Comments

@hmedal
Copy link

hmedal commented Jan 17, 2024

It seems that COTSCar.set_vec() should modify COTSCar.vectorand not COTS.vector. Because it modifies Car.vector, calling COTSCar.set_vec() causes COTSCar.cost() to give a really high value. Here is an example:

carDesignVec = [12, 7, 6, 12, 9, 1, 0, 13, 9, 1, 39, 26, 2, 1, 33, 11, 4]
product = COTSCar()
print("COTSCar vec:", product.get_vec())
print("Car vec:", product.car.get_vec())
print("Cost: $", format(product.cost(), ",.2f"))
product.set_vec(carDesignVec)
print("COTSCar vec:", product.get_vec())
print("Car vec:", product.car.get_vec())
print("Cost: $", format(product.cost(), ",.2f"))

This yields:

COTSCar vec: [0, 0, 12, 9, 5, 4, 5, 9, 18, 0, 63, 70, 3, 2, 94, 46, 36]
Car vec: [0.3625, 0.15, 0.3926990815, 0.1125, 0.275, 1.65, 0.3926990815, 0.1125, 0.30000000000000004, 0.225, 0.3926990815, 0.894, 0.894, 0.6120817771521734, 1.8421606282386331, 1.3937518499228556, 0.007414368836192332, 0.3538183511215326, 0.3850508984033272, 5, 6, 7, 2, 7, 0, 3, 13, 20, 3, 0.5484287498156001, 0.7679158678739382, 0.17545563948117573, 0.10611775895215035, 0.2137548982186032, 0.7295061566429835, 0.24323006416003673, 0.9846194623778417, 0.2967268421009293, 0.4328799518163817]
Cost: $ 24,462.04
COTSCar vec: [0, 0, 12, 9, 5, 4, 5, 9, 18, 0, 63, 70, 3, 2, 94, 46, 36]
Car vec: [12, 7, 6, 12, 9, 1, 0, 13, 9, 1, 39, 26, 2, 1, 33, 11, 4, 0.3538183511215326, 0.3850508984033272, 5, 6, 7, 2, 7, 0, 3, 13, 20, 3, 0.5484287498156001, 0.7679158678739382, 0.17545563948117573, 0.10611775895215035, 0.2137548982186032, 0.7295061566429835, 0.24323006416003673, 0.9846194623778417, 0.2967268421009293, 0.4328799518163817]
Cost: $ 314,743,203.47

Note that calling COTSCar.set_vec() did not change the return value of COTSCar.get_vec().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant