Iterate cartesian product (cross product) of sorted lists of positive numbers in order of decreasing product of entries (MVCE of a stub included)

Suppose I have several sorted lists of positive numbers, like so for example:

double[] a1 = new double[]{0.70, 0.20, 0.10}; double[] a2 = new double[]{0.80, 0.10, 0.05, 0.05}; double[] a3 = new double[]{0.60, 0.15, 0.14, 0.10, 0.01}; 

I want to iterate Cartesian product of these arrays in the order of decreasing product of entries, like so:

0000: Combo[product=3.36e-01, vals=[0.70, 0.80, 0.60], indexes=[0, 0, 0]] 0001: Combo[product=9.60e-02, vals=[0.20, 0.80, 0.60], indexes=[1, 0, 0]] 0002: Combo[product=8.40e-02, vals=[0.70, 0.80, 0.15], indexes=[0, 0, 1]] 0003: Combo[product=7.84e-02, vals=[0.70, 0.80, 0.14], indexes=[0, 0, 2]] 0004: Combo[product=5.60e-02, vals=[0.70, 0.80, 0.10], indexes=[0, 0, 3]] 0005: Combo[product=4.80e-02, vals=[0.10, 0.80, 0.60], indexes=[2, 0, 0]] ... 

E.g. in the example above the first entry is obvious (as arrays are sorted) and it is a combination of the first values: [0.70, 0.80, 0.60] with product 0.70*0.80*0.60 = 3.36e-01 and corresponding value indexes in arrays a1, a2, a3 are [0, 0, 0]. Now the second entry is less obvious, should we change 0.70 to 0.20? Or 0.60 to 0.15? Or 0.80 to 0.10? The second should be [0.20, 0.80, 0.60]with product 9.60e-02, indexes [1, 0, 0].

Here is a program in java to generate/print them: https://repl.it/repls/FilthyGreatRotation (all the logic is in printWholeCartesianProduct() method)
This program generates them in lexicographic order and then sorts the whole set by product.

Question: Is there an easy way to actually generate the combos in correct order in the first place?

The reason for this: I don’t have the lists in the first place, only iterators over some sorted collections of numbers. Possibly veeery long, length not known ahead of time, but it is known that the numbers in each iterator are sorted.

MVCE to play with (same as in https://repl.it link above):

import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringJoiner; import java.util.function.Consumer; import java.util.stream.Collectors;  public class Main {      public static void main(String[] args) {         List<List<Double>> data = createData();         printWholeCartesianProduct(data);     }      public static List<List<Double>> createData() {         double[] a1 = new double[]{0.70, 0.20, 0.10};         double[] a2 = new double[]{0.80, 0.10, 0.05, 0.05};         double[] a3 = new double[]{0.60, 0.15, 0.14, 0.10, 0.01};         return createData(a1, a2, a3);     }      public static void  printWholeCartesianProduct(List<List<Double>> data) {         final DecimalFormat df = new DecimalFormat("0.00");          // print input data         String matrix = data.stream()             .map(l -> l.stream().map(df::format).collect(Collectors.joining(", ")))             .map(row -> "[" + row + "]")             .collect(Collectors.joining("\n"));         System.out.println("Input data:\n" + matrix);          // collect combos as they are generated         final List<Combo> combos = new ArrayList<>();         Consumer<int[]> callback = indexes -> {             double[] v = new double[indexes.length];             double prod = 1;             for (int i = 0; i < indexes.length; i++) {                 List<Double> col = data.get(i);                 int index = indexes[i];                 v[i] = col.get(index);                 prod *= v[i];             }             combos.add(new Combo(prod, v, indexes.clone()));         };          // generate combos         int[] c = new int[data.size()];         int ptr = c.length - 1;         while (ptr >= 0) {             callback.accept(c);             c[ptr]++; // increment             if (c[ptr] == data.get(ptr).size()) { // carry                 do {                     ptr--;                 } while(ptr >= 0 && c[ptr] == data.get(ptr).size() - 1);                 if (ptr < 0) {                     break;                 }                 c[ptr]++;                 // zero out                 while (++ptr <= c.length - 1) {                     c[ptr] = 0;                 }                 ptr = c.length - 1;             }         }          // cheating - sort after generation and print result         combos.sort((o1, o2) -> Double.compare(o2.product, o1.product));         StringBuilder sb = new StringBuilder();         double totalP = 0;         for (int i = 0; i < combos.size(); i++) {             sb.append(String.format("%04d: ", i)).append(combos.get(i)).append("\n");             totalP += combos.get(i).product;         }         System.out.printf("Cartesian product in descending product (total p=%.3e):\n%s", totalP, sb.toString());     }      public static List<Double> asList(double[] a) {         return Arrays.stream(a).boxed().collect(Collectors.toList());     }      public static List<List<Double>> createData(double[]... arrays) {         final List<List<Double>> vals = new ArrayList<>();         Arrays.stream(arrays).forEachOrdered(a -> vals.add(asList(a)));         return vals;     }      static class Combo {         final double product;         final double[] vals;         final int[] indexes;          Combo(double product, double[] vals, int[] indexes) {             this.product = product;             this.vals = vals;             this.indexes = indexes;         }          @Override         public String toString() {             return new StringJoiner(", ", Combo.class.getSimpleName() + "[", "]")                 .add("product=" + String.format("%.2e", product))                 .add("vals=[" + Arrays.stream(vals).boxed().map(v -> String.format("%.2f", v)).collect(                     Collectors.joining(", ")) + "]")                 .add("indexes=" + Arrays.toString(indexes))                 .toString();         }     } } ``` 

Apps loaded in App Catalog do not have the correct App Version or Product ID

I’m working with a client who just set up a new SharePoint 2016 site on their server. They created an App Catalog but when I load in a custom SharePoint App, the App Catalog doesn’t read in the version from the AppManifest.XML and sets the version to 1.0.0.0 nor is the app assigned a Product ID – the Product ID is left blank.

The same App is uploaded with the correct metadata on other sites.

Is there something that needs to be configured so the App Catalog library behaves like an App Catalog?

Thanks in advance

i will do removal background from photo or product for $5

i am online worker on seoclerks and am expert in photoshop am per day deliver 200+ image my best and intrested skill photoshop/ My Services: image background removal image resize Crop color or white imageTransparent background Change Background White Background for Amazon or ebay Product Create Shadow / Reflection Shadow / Drop Shadow Benefits: fast delivery unlimited revision affordable pkg,s

by: haidersabri
Created: —
Category: Graphics & Logos
Viewed: 201


How should be the proximity of elements on this product list page?

I have the product list page below defined by I’m having a bit of trouble figuring out which information should be more associated to which. For example, the filtering group on the left, should it be closer to the products on the right and further from the title or at the same distance of both? Should the title be at the same distance from the filter and products/filters? I think is the relationship between things. Anyway, any suggestions for improvements are also welcomed! enter image description here

l’ll do Shopify Store SEO optimization, Product Tags, Meta Description, Alt Tags and Schema Markup for $20

Shopify Store SEO optimization is the process of optimizing each and every product and page of your store in order to rank higher in the Search Engine Results Pages (SERPS). If you want to enhance Shopify Store ranking, organic web traffic and sales, you simply can’t ignore search engine optimization(SEO). This White Hat on page SEO services can boost google ranking of your Shopify Store or Store traffic by 90% or more. Our on page SEO optimization services include: Free: Shopify Store SEO analysis and Store SEO audit report.LSI, Focused & Long tail keywords Optimization.Install & configure necessary store apps.Compelling Meta descriptions, SEO Meta Titles and Product tags.Heading tags (H₁, H₂, H₃), Image alt tags and Shopify store Speed Optimization.Fix duplicate content & Redirect Broken Links to the Homepage or Parent Page.Social media Meta tags, Hyperlink and anchor text optimization.Search Engines friendly URLs and SEO Titles.Schema Markup, XML Sitemaps, Internal / External Linking and Robots.txt.Webmaster Tools(Google, Bing, Yahoo) & Google analytics. Why us? 100% Client Satisfaction and Money back Guarantee.Increased store authority.Top-ranked website based SEO keywords research.100% White Hat manual work.WordPress SEO, Wix SEO and Shopify Store SEO Specialists.If you have any questions, please don’t hesitate to get in touch. Tags: Shopify SEO, Shopify store SEO, e-commerce store SEO, store optimization, SEO services, Store SEO analysis, Shopify store SEO optimization, Shopify store SEO ranking, Shopify store on page SEO optimization, Shopify store SEO services, Shopify store SEO specialist, Shopify store SEO agency, Shopify store SEO consultant, Product Tags, SEO keyword research, LSI keywords research, Keywords analysis, Shopify store SEO Audit Report, Shopify store SEO audit, 301 redirect, Competitor analysis, Meta descriptions, image alt tags, Shopify store speed optimization, XML sitemap, robots file, hyper link optimization, anchor text optimization, SEO friendly titles, long tail keywords research and Targeted Organic Traffic.

by: ONELIFESEO
Created: —
Category: Local SEO
Viewed: 197


drive CANADA visitors to your Link web shop product with extras for $1

Do you look for HUMAN traffic to your website from CANADA only oder with special countries!!!! for 1$ : I will deliver High quality organictraffic from Google and socialnetworks ,to your website /shop /item /store or link ,till your track-counter shows min.500-1000 from CANADA it take ( 3-5 days or faster) We do not guarantee any actionen, dealsor clicks from our traffic. We cannot force anyone to do something. This TRAFFIC is good for : * Improve your ranking by continuous visitors * Boost Alexa ranking and googlesearch rank only if you have any questions or wishes,then you are always welcome to INBOX us If you want special wishes,then please contact us….

by: amanyx
Created: —
Category: Traffic
Viewed: 288


Is {a^n: n is a product of exactly two primes} regular?

I am struggling to prove the following question.

$ L_1 = \{a^n: n \text{ is a product of exactly two primes}\}$

I feel like the language is not regular but I am having trouble proving it. I tried using pumping lemma but got stuck at the end. Here’s how I did it:

Assume that the language is regular and $ m$ is a constant of Pumping Lemma. Now let $ w = a^M$ where $ M > m$ and $ M$ is a co-prime number. Clearly $ w$ is in the language and $ |w| > m$ .

Now let $ y=a^j$ where $ j$ is between $ 1$ and $ m$ , with $ |xy| \leq m$ and $ |y| \geq 1$ .

This is where I am getting stuck. I feel like we should pump up but I don’t know by “how much”. Also, I feel like I have to know what is the next co-prime number after $ M$ , but can’t figure it out.

Translating print product catalog (with 5000 products) to digital with good UX: how?

I’m currently working at a large B2B company which operates in a very traditional market (ordering happens mainly by phone, e-mail and even fax).

Since many years we are using a product catalog (print) with over 5000 products in it, but since it costs a lot of money to print and send it to our customers, we slowly want to move to digital.

The big question is: how can we translate this print manual to a digital version?

There are many PDF e-publishing tools, but that doesn’t really work with a 500 page catalog.

There are some examples like IKEA (where you can browse through pages online and download a pdf version): https://onlinecatalogue.ikea.com/PT/en/IKEA_Catalogue/#/pages/1

What are best practices here? What is the purpose of an online version? For reading? For buying (should we link products to a webshop)?

Another question: could a digital product catalog replace a printed version when customers are still ordering by phone / e-mail?

Many thanks in advance, looking forward to your reply.