xuebaunion@vip.163.com

3551 Trousdale Rkwy, University Park, Los Angeles, CA

留学生论文指导和课程辅导

无忧GPA：https://www.essaygpa.com

工作时间：全年无休-早上8点到凌晨3点

扫码添加客服微信

扫描添加客服微信

Python代写|算法代写 - Organising a Colour Palette

时间：2020-11-08

Colour Models
Colours used in computer graphics are based on a particular model. The model
you pick depends on the range of colours you need in a graphic and whether it is
going to be output to print media or to screen. There are various colour models
available. Some examples are: Black & White, Grayscale, RGB (Red, Green and
Blue), CMYK (Cyan, Magenta, Yellow and Black), and HSB (Hue, Saturation &
Brightness)
In this assignment, we will consider the RGB (Links to an external site.) model. Red,
green, and blue can be combined in various proportions to obtain any colour in the
visible spectrum. In our representation R, G, B can each range from 0 to 1. Where 0
indicates absence and 1 full intensity.
Dataset
You have given 3 datasets with increasing size to support your implementation and
testing:
• 10 colours: col10.txt • 100 colours: col100.txt
• 500 colours: col500.txt
The files contain rows of three floating-point values. Each row represents a colour
by its red, green, blue coordinates. The first uncommented line is the number of
colours.
You are also given a Python notebook with useful code: colour_startup.ipynb
This notebook includes the code to read the datafile and visualise a sequence of
colours. It also contains some other useful functions to support your assignment.
Solution Representation
To solve this problem, your implementation should encode a candidate solution as
an ordering of indices, not as an ordering of the colours themselves.
To clarify this, let us assume that your dataset has 5 colours (each colour
represented with its RGB coordinates) and it is stored in a list called c. An ordering
of the colours (i.e a candidate solution to your problem) should be encoded as a list
of indices of length 5, where each element in the list is an index in the c list.
For example, a solution encoded as e s = [1, 0, 2, 4, 3], represents the following
ordering of colours c[1] c[0] c[2] c[4] c[3].
What do you need to do?
Your task is to provide a more aesthetically pleasing ordering of a list of colours.
To illustrate what we mean, consider the colour bands in the figure below. The top
band shows an unordered set of colours, while the 2nd and 3rd bands have been
ordered by different algorithms. You can clearly notice the difference between an
arbitrary ordering and an improved ordering.
To complete your task, you are asked to implement 3 different algorithms.
1. Multi-start hill-climbing algorithm
2. Clustering-based algorithm
3. Algorithm of your choice
Below more details for the implementation of each algorithm
1. Multi-start hill-climbing algorithm
How can we formulate this problem as an optimisation problem? One possibility is
to search for an ordering of the given colours where adjacent colours are somewhat
similar. This can be achieved by finding an ordering of colours that minimises the
sum of the distances between adjacent colours, where the distance between two
adjacent colours is computed with the Euclidean distance. This will be the objective
function to evaluate solutions (called evaluate). To facilitate your work, we provide
the implementation of this function, in the given Jupyter
notebook: colour_startup.ipynb
You do not need to implement the function as it is provided. Here an explanation of
what the function does: it computes the sum of the Euclidean distances, between
all pairs of adjacent colours. For example, for a 5 colours list c and the solution s =
[1, 0, 2, 4, 3], and assuming d() is the Euclidean distance, the evaluation function
returns d(c[1], c[0]) + d(c[0], c[2]) + d(c[2], c[4]) + d(c[4], c[3]).
To implement muti-start hill-climbing in a modular way you should first implement a
hill-climbing method as follows:
Hill-climbing
This is the algorithm we have discussed in class and implemented in practical 3 for
the Knapsack problem. It starts from an initial random solution and tries to improve
it iteratively using a mutation operator. Here you can reuse your Hill-climbing code
for the Knapsack problem. Notice, however, that we cannot use the same bit-flip
mutation operator used for the Knapsack problem as the representation in the
colour ordering problem is not a list of binary numbers! Our representation is
instead an ordering (also called a permutation) of integers. Notice that in a
permutation, each integer or index can appear only once.
For a permutation representation, the simplest mutation operator is to swap two
colour indices selected at random. For example, given a solution s = [1, 0, 2, 4, 3],
the solution s' = [1, 3, 2, 4, 0] is a neighbouring solution that swaps the indices at
position 1 and 4. This operator is called swap.
Other possible operators are:
• inversion: this operator works by Inverting (reversing) the ordering
between any two colour indices selected at random. For example, given
the solution s = [1, 0, 2, 4, 3], the solution s' = [1, 3, 4, 2, 0] reverses the
indices between positions 1 and 4
• scramble: this operator works by randomly shuffling (scrambling) the
ordering between any two colour indices selected at random. For
example, given the solution s = [1, 0, 2, 4, 3], the solution s' = [1, 4, 0, 3,
2] scrambles the indices between positions 1 and 4.
The selection of which operator to implement and use is left to your own choice,
you do not need necessarily to implement all of them!
An initial randomly generated solution for the colouring ordering problem is also
different than that of the Knapsack problem. A random solution is a random
permutation or reordering of the colour indexes. The source code provided
illustrates how this can be done in Python (function random_sol).
Multi-start hill-climbing
Once you implemented the hill-climbing function, the multi-start hill-climbing simply
Implements a loop that calls the Hill-climbing algorithm from different initial
solutions. Your function should receive a parameter indicating the number of
repetitions. Here again, you can reuse the code you implemented for the Knapsack
problem.
2. Clustering-based algorithm
Here your solution should consider a clustering algorithm as implemented in the
scikit-learn library. You can use any of the clustering methods available (k-means,
hierarchical, etc).
The idea is to apply the clustering method to the colours dataset, so the colours
will be assigned to a number of clusters. Let us assume your clustering algorithm
produced K groups or clusters. Then you will assemble a solution by ordering the
colours according to their cluster membership. That is, first add all the colours from
cluster 1, then add the colours from cluster 2 and so on up to cluster K.
Notice that within each cluster, the colours will not be ordered, but this is OK. This
algorithms only orders the colours at the level of clusters.
3. Algorithm variant of your choice
Here you’re given the opportunity to design your own algorithm. The general goal is
to try to improve the performance and quality of solutions obtained by Algorithms 1
and 2. This part is left open to your creativity. You can propose variations of
Algorithms1 and 2 by incorporating some of the algorithm ideas and metaheuristics
discussed in the lectures, you can combine methods, you can do your own
research or try your own ideas. Marks will be given for the effort in your research
and implementation, and for the quality of your best-obtained solutions. By "quality"
of solutions, I mean both the subjective appearance and the value obtained using
evaluation function (sum of distances).
What do you need to submit?
You need to submit 3 Jupyter notebooks, one for each Algorithm. The notebooks
will contain your code, some text descriptions and some plots illustrating your
results. There is no page/length limit, but you are encouraged to be concise and
clear in your descriptions.
There is no need to recapitulate the problem or have an introduction. Here
a description of what to include in each of the Jupyter notebooks in addition to
your code. You will also find an indication of the % marks for each part.
1. Multi-start hill-climbing algorithm (40 %)
o Indicate which neighbourhood you implemented,
briefly justify your choice.
o Record the trace of objective function values
obtained across a single run of the Hill-climbing
algorithm. With a line plot, visualise this trace.
o Run your multi-start hill-climbing algorithm for both
colour sizes 100 and 500. You can conduct your own
experimentation, there is no particular limit on the
number of iterations, repetitions you want to run.
o Report (by assigning them to Python variables) the
best solution found for each instance during your
experimentation, call
them mhc_best100 and mhc_best500. Using the
visualisation function, produce the colour band plots
for your solutions, report also their objective function
(evaluation) values.
o Describe briefly the experiments you conducted to
find the best solutions (i.e. number of
iterations, tries)
2. Clustering-based algorithm (30%)
o Indicate which clustering algorithm you used, briefly
justify your choice.
o Indicate how many clusters K you used for each
instance size (100, 500), briefly justify your answer.
o Run your clustering-based algorithm for both
instances 100 and 500. You can conduct your own
experimentation, there is no particular limit on the
number of iterations, repetitions you want to run.
o Report (by assigning them to Python variables) the
best solution found for each instance during your
experimentation, call
them cl_best100 and cl_best500. Using the
visualisation function, produce the colour band plots
for your solutions.
o Here what you consider your best solutions are
subject to your appreciation. Notice that the
function evaluate considered in Algorithm 1, is not
used here. You can still use the evaluate function if
you would like to have an approximate assessment
of the quality of the clustering-based solutions.
o Describe briefly the experiments you conducted to
find the best solutions (i.e. number tries, clustering
algorithm parameters)
3. Algorithm variant of your choice (30 %)
o Briefly describe in text the main idea and motivation
behind your algorithm
o Run your algorithm for both dataset sizes 100 and
500. You can conduct your own experimentation,
there is no particular limit on the number of iterations,
repetitions you want to run.
o Report (by assigning them to Python variables) the
best solution found for each instance during your
experimentation, call
them my_best100 and my_best500. Using the
visualisation function, produce the colour band plots
for your solutions, report also their objective function
(evaluation) values.
o Describe briefly the experiments you conducted to
find the best solutions (i.e. number tries, iterations,
parameters)

- 留学生代写
- Python代写
- Java代写
- c/c++代写
- 数据库代写
- 算法代写
- 机器学习代写
- 数据挖掘代写
- 数据分析代写
- Android代写
- html代写
- 计算机网络代写
- 操作系统代写
- 计算机体系结构代写
- R代写
- 数学代写
- 金融作业代写
- 微观经济学代写
- 会计代写
- 统计代写
- 生物代写
- 物理代写
- 机械代写
- Assignment代写
- sql数据库代写
- analysis代写
- Haskell代写
- Linux代写
- Shell代写
- Diode Ideality Factor代写
- 宏观经济学代写
- 经济代写
- 计量经济代写
- math代写
- 金融统计代写
- 经济统计代写
- 概率论代写
- 代数代写
- 工程作业代写
- Databases代写
- 逻辑代写
- JavaScript代写
- Matlab代写
- Unity代写
- BigDate大数据代写
- 汇编代写
- stat代写
- scala代写
- OpenGL代写
- CS代写
- 程序代写
- 简答代写
- Excel代写
- Logisim代写
- 代码代写
- 手写题代写
- 电子工程代写
- 判断代写
- 论文代写
- stata代写
- witness代写
- statscloud代写
- 证明代写
- 非欧几何代写
- 理论代写
- http代写
- MySQL代写
- PHP代写
- 计算代写
- 考试代写
- 博弈论代写
- 英语代写
- essay代写
- 不限代写
- lingo代写
- 线性代数代写
- 文本处理代写
- 商科代写
- visual studio代写
- 光谱分析代写
- report代写
- GCP代写
- 无代写
- 电力系统代写
- refinitiv eikon代写
- 运筹学代写
- simulink代写
- 单片机代写
- GAMS代写
- 人力资源代写
- 报告代写
- SQLAlchemy代写
- Stufio代写
- sklearn代写
- 计算机架构代写
- 贝叶斯代写
- 以太坊代写
- 计算证明代写
- prolog代写
- 交互设计代写
- mips代写
- css代写
- 云计算代写
- dafny代写
- quiz考试代写
- js代写
- 密码学代写
- ml代写
- 水利工程基础代写
- 经济管理代写
- Rmarkdown代写
- 电路代写
- 质量管理画图代写
- sas代写
- 金融数学代写
- processing代写
- 预测分析代写
- 机械力学代写
- vhdl代写
- solidworks代写
- 不涉及代写
- 计算分析代写
- Netlogo代写
- openbugs代写
- 土木代写
- 国际金融专题代写
- 离散数学代写
- openssl代写
- 化学材料代写
- eview代写
- nlp代写
- Assembly language代写
- gproms代写
- studio代写
- robot analyse代写
- pytorch代写
- 证明题代写
- latex代写
- coq代写
- 市场营销论文代写
- 人力资论文代写
- weka代写
- 英文代写
- Minitab代写
- 航空代写
- webots代写
- Advanced Management Accounting代写
- Lunix代写
- 云基础代写
- 有限状态过程代写
- aws代写
- AI代写
- 图灵机代写
- Sociology代写
- 分析代写
- 经济开发代写
- Data代写
- jupyter代写
- 通信考试代写
- 网络安全代写
- 固体力学代写
- spss代写
- 无编程代写
- react代写
- Ocaml代写
- 期货期权代写
- Scheme代写
- 数学统计代写
- 信息安全代写
- Bloomberg代写
- 残疾与创新设计代写
- 历史代写
- 理论题代写
- cpu代写
- 计量代写
- Xpress-IVE代写
- 微积分代写
- 材料学代写
- 代写
- 会计信息系统代写
- 凸优化代写
- 投资代写
- F#代写
- C#代写
- arm代写
- 伪代码代写
- 白话代写
- IC集成电路代写
- reasoning代写
- agents代写
- 精算代写
- opencl代写
- Perl代写
- 图像处理代写
- 工程电磁场代写
- 时间序列代写
- 数据结构算法代写
- 网络基础代写
- 画图代写
- Marie代写
- ASP代写
- EViews代写
- Interval Temporal Logic代写
- ccgarch代写
- rmgarch代写
- jmp代写
- 选择填空代写
- mathematics代写
- winbugs代写
- maya代写
- Directx代写
- PPT代写
- 可视化代写
- 工程材料代写
- 环境代写
- abaqus代写
- 投资组合代写
- 选择题代写
- openmp.c代写
- cuda.cu代写
- 传感器基础代写
- 区块链比特币代写
- 土壤固结代写
- 电气代写
- 电子设计代写
- 主观题代写
- 金融微积代写
- ajax代写
- Risk theory代写
- tcp代写
- tableau代写
- mylab代写
- research paper代写
- 手写代写
- 管理代写
- paper代写
- 毕设代写
- 衍生品代写
- 学术论文代写
- 计算画图代写
- SPIM汇编代写
- 演讲稿代写
- 金融实证代写
- 环境化学代写
- 通信代写
- 股权市场代写
- 计算机逻辑代写
- Microsoft Visio代写
- 业务流程管理代写
- Spark代写
- USYD代写
- 数值分析代写
- 有限元代写
- 抽代代写
- 不限定代写
- IOS代写
- scikit-learn代写
- ts angular代写
- sml代写
- 管理决策分析代写
- vba代写
- 墨大代写
- erlang代写
- Azure代写
- 粒子物理代写
- 编译器代写
- socket代写
- 商业分析代写
- 财务报表分析代写
- Machine Learning代写
- 国际贸易代写
- code代写
- 流体力学代写
- 辅导代写
- 设计代写
- marketing代写
- web代写
- 计算机代写
- verilog代写
- 心理学代写
- 线性回归代写
- 高级数据分析代写
- clingo代写
- Mplab代写
- coventorware代写
- creo代写
- nosql代写
- 供应链代写
- uml代写
- 数字业务技术代写
- 数字业务管理代写
- 结构分析代写
- tf-idf代写
- 地理代写
- financial modeling代写
- quantlib代写
- 电力电子元件代写
- atenda 2D代写
- 宏观代写
- 媒体代写
- 政治代写
- 化学代写
- 随机过程代写
- self attension算法代写
- arm assembly代写
- wireshark代写
- openCV代写
- Uncertainty Quantificatio代写
- prolong代写
- IPYthon代写
- Digital system design 代写
- julia代写
- Advanced Geotechnical Engineering代写
- 回答问题代写
- junit代写
- solidty代写
- maple代写
- 光电技术代写
- 网页代写
- 网络分析代写
- ENVI代写
- gimp代写
- sfml代写
- 社会学代写
- simulationX solidwork代写
- unity 3D代写
- ansys代写
- react native代写
- Alloy代写
- Applied Matrix代写
- JMP PRO代写
- 微观代写
- 人类健康代写
- 市场代写
- proposal代写
- 软件代写
- 信息检索代写
- 商法代写
- 信号代写
- pycharm代写
- 金融风险管理代写
- 数据可视化代写
- fashion代写
- 加拿大代写
- 经济学代写
- Behavioural Finance代写
- cytoscape代写
- 推荐代写
- 金融经济代写
- optimization代写
- alteryxy代写
- tabluea代写
- sas viya代写
- ads代写
- 实时系统代写
- 药剂学代写
- os代写
- Mathematica代写
- Xcode代写
- Swift代写
- rattle代写
- 人工智能代写
- 流体代写
- 结构力学代写
- Communications代写
- 动物学代写
- 问答代写
- MiKTEX代写
- 图论代写
- 数据科学代写
- 计算机安全代写
- 日本历史代写