Select products to get maximum cart value - algorithm

Given a list of products available in the store, i need to select set of products to my cart in such a way that, my cart value should be maximum it can.
Restrictions are like, cart has a dimension l*w*h. Products selected should individually and totally fit into the cart giving maximum possible value to cart. One 1 item per product can be selected.
I have product id, price, l, w, ht, weight of each product with me. How can this be accomplished???
I came up with a logic as below.
Calculate volume of the cart
Calculate volume of product and value of product per cubic cm using its price
Sort the product list based on value/cucm
Start adding products from the sorted list like 1st, 2nd , 3rd, etc. till the cart gets filled.
If a product cannot fit into the cart, skip it and select the next possible product from the sorted list.
Once list is obtained, check if any product in the selected list can be replaced with another product with less volume but results in more cart value.
But this is not getting me the correct product list with maximum cart value. What is the problem in the above logic?

Are the three dimensions integer valued with some finite bound ? Then it can be solved with dynamic programming. But I think there should some assumptions made, e.g. the partition of sub-problems should be end-to-end cutting planes etc. Without that dynamic programming would be infeasible.
The key trick here is that you need to account for possibilities that a box can be oriented in several ways, and it is the number of ways to align its own three dimensions along the three axes of the cart. It is 3! = 6 for three dimensions. So in the dynamic programming when you process the i-th product, include all the 6 ways interpret its 3 dimensions as L,W,H.

Related

how to get available quantity of Lot number

how to get available quantity of Lot number in multiple warehouse
suppose i have 3 warehouse A,B and C,
Lot number LOT0001
i want sum of total currently availabel quantity of LOT0001 in all three location.
In odoo you can pass filters in context.
ex:
context={'lot_id':'','owner_id':'','package_id':'','warehouse':'','force_company':'','location':''}
product.with_context(context).qty_available
In odoo base module system will automatically calculate quantity based on context.
If you not pass context then system will give you sum of all warehouse stock.
this may help you.

Magento: Minimal quantity different sizes

I'm making a shop with clothing. But there is a minimal order amount per order. Now i want to have a choice that the customer can make with different sizes.
So the minimal count is 10 pieces, and if a customer wants 4 size M, 5 size L and 1 size XL. what is the easiest way in code that i can accomplish this?
I'm using simple products associated with configurable products.
Maybe this could help :)
How to get the Total Quantity Of All the Items In your Shopping Cart

How to summarize by calculated measure in Power BI?

I have transactional data which contains customer information as well as stores they shopped from. I can count the number of different stores each customer used by a simple DISTINCTCOUNT([Site Name]) measure.
There are millions of customers and I want to make a simple summary table which shows the sum of # customers who visited X number of stores. Like a histogram. Maximum stores they visited is 6, minimum is 1.
I know there are multiple ways to do this but I am new to DAX and can't do what I think yet.
The easiest way:
Assuming your DISTINCTCOUNT([Site Name]) measure is called CustomerStoreCount ...
Add a new dimension table, StoreCount, to your model containing a single column, StoreCount. Populate it with the values 1,2,3,4,5,6 (... up to maximum number of stores.)
Create a measure, ThisStoreCount = MAX(StoreCount[StoreCount]).
Create a base customer count measure, TotalCustomers:=DISTINCTCOUNT(CustomerTable[Customer])
Create a contextual measure, CustomersWhoVisitedXNumberOfStores := CALCULATE ( TotalCustomers, FILTER(VALUES(CustomerTable[Customer]), ThisStoreCount = CustomerStoreCount) )
On your pivot table / reporting tool, etc. use StoreCount[StoreCount] on the axes and CustomersWhOVisitedXNumberOfStores as the measure.
So basically walk through the customer list (since there's no relationship between StoreCount and CustomerTable), compare that customer's CustomerStoreCount with the maximum StoreCount[StoreCount] value, which for each StoreCount[StoreCount] value is ... drum roll itself. If it matches, keep it, otherwise filter it out; you end up with a count of customers whose store visits equals the value of StoreCount[StoreCount].
And of course the more general modeling hint: when you want to display a metric by something (i.e. customer count by number of stores visited), that something is an attribute, not a metric.

Approximating Price

I have a set of products. Each product is a variation of a non existent “parent”. Also, each product (let’s call them child products) has its own individually assigned price in our database. Here is a small example set.
Parent SKU is 1000.
Product Children are:
1000-TankTop-SM - 14.95
1000-TankTop-2X - 17.95
1000-Hoodie-SM - 34.95
1000-Hooodie-2X - 39.95
Here is the problem. Our database lists each real child product price (as directly above) in a one-to-one relationship. Each product has a SKU and I can look up the price of each product by SKU. I have a website that that cannot support this method of pricing. The way pricing works is this. I create a “parent” product. Each parent product must have a base price. The prices of variations are created from adding or subtracting a dollar amount. So a “parent” has two attribute sets, product type and size. A plus or minus amount must be associated with each attribute. So from my example above we have.
Sizes:
SM +- ?
2X +- ?
Product Types:
TankTop +- ?
Hoodie += ?
How can I decide what the variables above should equal to at least approximate the actual child product prices? Is this possible without any extreme outliers?
This sounds like a frustrating (ie: crummy) database system, since it's effectively impossible to create certain arbitrary prices. ie:
TankTop = + $2.00
Shirt = + $1.00
Sweat = + $5.00
Small = - $1.00
Medium = + $0.00
Large = + $3.00
X-Large = + $5.00
With the above example, it would be impossible to have a Small Shirt cost $10.00 while simultaneously having a Medium Shirt cost $10.50.
So, each product has a price defined as a sum of: BASE_SKU_PRICE + SIZE_MODIFIER + STYLE_MODIFIER. This means that you cannot assign an arbitrary price value to each unique item, so you'll need to use a regression model.
If you want to re-adjust the price for a massive table of items, the easiest approach to minimize outliers would be a multivariate variation of linear least mean square errors approximation (LMS), which is just another type of multivariate linear regression approach.
This will allow you to model each unique item (ie: SKU) as a function of:
y = a + bX_1 + cX_2
If you want a very tidy approach to handling this for a production database system, you would be best off just using MATLAB or SPSS to create your database table, as you can specify confidence intervals, and other parameters to help optimize your approximation.
Finally, I found an example online which you could try out in OpenOffice Calc or Microsoft Excel. This will give you a working algorithmic approach rather than you having to derive the analytical form equations and generate code from them. It might even be enough to solve your problem without having to break out MATLAB or SPSS.

Complex configurable products

Here is the scenario. I have a configurable product which has two attributes. However, the price increment for the second attribute is dependent on the first. The price increments are a combination of fixed and percentage. So, lets assume the two attributes in question are size and colour - the amount added on for larger sizes is fixed, but the amount added on for different colours is a percentage.
The issue is that magento is adding the percentage increment for colour to the base price, not to the price plus the fixed increment for size.
As an example, let assume my product is available in three sizes, small medium and large; and in three colours, red, green and blue. The increment for medium and large are £5 and £10 respectively, and the increment for colour is 5% for green and 10% for blue (to be applied dependent on the size selected). My product has a base price of £100.
A customer purchasing a medium red product would pay £105, however magento applies the same price to a customer purchasing a medium blue product (because the percentage increase is calculated BEFORE the size is selected).
Is there any way to handle this so that the correct percentage increase is calculated AFTER the size is selected?
Cheers
Simon
Generally I do not like to recommend this extension as it makes pricing in Magneto way more complicated and time consuming (I just got out of it myself and it was not the fault of the module), but I think this might be the solution for you:
http://www.magentocommerce.com/magento-connect/simple-configurable-products.html
Basically this modifies the way Configurable products are priced so that it uses the price of the simple product and not the values contained in the super attributes.
The upside is that the price of the simple product is the price that it will be sold for on the configurable page.
The downside is that it is very easy to have the website do some funky things with pricing if you are not careful. For example we had a lot of scenarios where the configurable product price was $10.00, but all the simple products price was $8. Each item in the dropdown had a "negative upcharge" in there.
This was not the modules fault, rather carelessness of people managing the products.

Resources