## Is dynamic programming restricted to optimization problems?

The usual criteria used to decide if a problem can be solved using dynamic programming is (1) if it has optimal sub-problems and (2) if it has overlapping sub-problems. Does the word “optimal” mean that DP can only be used to solve optimization problems? Otherwise, it would make more sense to write (1) as “if it can be decomposed in sub-problems” (i.e. it is recursive). Obviously, this definition includes optimization problems with optimal sub-problems.

Posted on Categories proxies

## Using decision oracle to solve optimization problem of maximum polyomino tiling

So, this problem is a kind of variant of polyomino packing which has been discussed frequently elsewhere, but I haven’t been able to find anything on my particular problem. Suppose we have a list of polyominos $$p_1, p_2, …, p_n$$ (not necessarily distinct), and we want to find a tiling of a rectangle of dimension $$a \times b$$ with $$a, b \leq n$$ that maximizes the number of squares covered, where we can use each $$p_i$$ at most once, and polyominos must be fully contained within the rectangle. Now, we have the decision problem which tells us, for a given $$t$$, if there is some tiling covering at least $$t$$ squares, and the optimization problem which is finding a tiling that covers the maximum number of squares. There are two parts: first, if you can solve the optimization problem in polynomial time, can you solve the decision problem in polynomial time? And secondly, if you can solve the decision problem in polynomial problem, can you solve the optimization problem in polynomial time?

If we have an oracle that solves the optimization in polynomial time, solving the decision problem in polynomial time is easy. However, given an oracle for the decision problem, I was unable to find a way to solve the optimization problem in polynomial time. The main issue I’m facing is that the decision oracle only works for rectangular boards, which means we can’t just place pieces and then use the oracle to see if the placement works, since we won’t have a rectangular board if we want to exclude the piece we just placed. It isn’t hard to determine the actual maximum number of tiles you can cover, and you can even find the actual pieces you need to use, but I haven’t been able to figure out a way to find an arrangement of the pieces in polynomial time using the oracle. I assume there is some trick here, but I don’t see it.

Posted on Categories proxies

## Coding optimization

I am wondering if there is a book/course that, instead of giving good written code, it gives a bad/underoptimized code, explain why it’s bad/underoptimized and then gives a better approach.

PS : It can be pseudocode, python or C++ code

## Would an optimization version of the 3-partition problem also be strongly np-complete / np-hard?

Anyone know if an optimization variant of the 3-partition problem (as explained there) would also be strongly np-complete?

This would be where the goal is to group a multiset whose size is evenly divisible by 3 into triplets that sum to as close to a target as possible and to produce this grouping. This would not be a decision problem but an actual optimization problem.

Posted on Categories proxies

## is the complexity of an algorithm connected to the “classification” of a optimization problem?

I wonder if the complexity is connected to an optimization problem. In general but also specifically e.g. when having a look at $$O(n^2)$$. Does this just describe the complexity in general or does it also mean does the underlying algorithm has to be a nonlinear optimization problem? Or is it also valid for linear tasks?

In simple words: Can a nonlinear task be solved in $$O(n)$$?

Posted on Categories proxies

## Cities/Countries Autocomplete query optimization

I have Cities and Countries tables, based on Geonames data. I’m trying to implement an autocomplete function, but so far it doesn’t work as I intend it to.

CREATE INDEX gin_pgtrm_testcity_big_index ON testcity_big USING gin ((name || ' ' || asciiname || ' ' || alternatenames) COLLATE pg_catalog."default"  gin_trgm_ops);  CREATE INDEX gin_pgtrm_tescountry_big_index ON testcountry_big USING gin ((name) COLLATE pg_catalog."default" gin_trgm_ops);  SELECT     country.name AS country,     city.name AS city,     city.population AS city_population,     city.fcode AS fscode,      similarity(coalesce(country.name,'')                  || coalesce(city.name,'')                  || coalesce(city.asciiname,'')      ,'%ribe dk%) AS rank  FROM testcountry_big country JOIN testcity_big city ON city.country = country.iso_alpha2  WHERE similarity(coalesce(country.name,'')                      || coalesce(city.name,'')                      || coalesce(city.asciiname,'')      ,'%ribe dk%') > 0.15  AND fcode ~ '\yPPLC\y|\yPPLA\y|\yPPLA2\y|\yPPL\y|\yHMSD\y' ORDER BY rank DESC LIMIT 5; 

1. I cannot return country only. My current query retrieves cities only, for example for “New York United States” I get 4 different cities, but I’m not getting United States country, and I can’t understand how to make it work for all possible combinations: cities, countries , cities+countries.

2. This query performs too slow for an autocomplete function – around 0.5 seconds.

(a) should I add a Materialized View to help boost the performance?

(b) could it be so slow simply because I’m using a local machine (laptop) and the performance on a real server is expected to be better?

** I also tried working with tsvector here, but :

1. unfortunately they only work for whole words and not substrings
2. the performance seemed worse than with triagrams
3. the similarity function using triagrams gives the ability for the users to be more “loose” with the queries, and get results even when they have a typo.

## Multiple parameters in optimization [on hold]

Consider a scenario where I have multiple unique balls of different sizes and weights. The problem is to identify the maximum number of balls which can fit into a bucket B given the following constraints:

1. The algorithm should pick up the largest sized ball amongst all available balls.
2. The total weight of all balls should not exceed the capacity of the bucket.
3. There should be minimal wastage of capacity, as we fit balls into the bucket

eg: If we have 5 balls of sizes and weights as follows {4, 5},{6, 25}, {7, 18}, {5, 50},{10, 80} and a bucket of size, weight as {25,100} An optimal algorithm, as manually done by me will be: {7,18},{6,25},{5,50},{4,5}

Posted on Categories proxies

## Social Media Maintenance & Optimization for $12 I am an experienced social media expert with extensive knowledge of facebook, twitter, LinkedIn, Instagram, Pinterest, and branding. I can help you to maintain and optimize your social media accounts with content posting, likes and followers. by: karansinghw Created: — Category: Social Networks Viewed: 256 Posted on Categories shared proxies ## l’ll do Shopify Store SEO optimization, Product Tags, Meta Description, Alt Tags and Schema Markup for$20

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

Posted on Categories shared proxies