首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
辅导program程序、讲解Python语言编程、Python留学生程序讲解 解析Haskell程序|辅导Web开发
项目预算:
开发周期:
发布时间:
要求地区:
Organising a Colour Palette
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)
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!