Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INDR 2 2 0 : Introduction to Computing for Operations Research Homework 5 : The Non - attacking Knights Problem Deadline: May 2 7 ,

INDR 220: Introduction to Computing for Operations Research
Homework 5: The Non-attacking Knights Problem
Deadline: May 27,2024,11:59 PM
In this homework, you will implement a Python script that solves the non-attacking knights
problem using CPLEX. The task is to find the maximum number of knights that can be placed
on an MN chessboard such that no knight attack some other knight. The decision variables
can be formulated as
xij={1ifaknightisplacedatlocation(i,j),0otherwise.
The integer linear programming formulation of this problem becomes
maximize z=i=1Nj=1Mxij
subject to: xij+xkl1,AA(i,j,k,l) where (i,j) and (k,l) are attacking locations
xijin{0,1},i=1,2,dots,M;j=1,2,dots,N.
An example of the non-attacking knights problem with a 26 chessboard can be given as
maximize z=x11+x12+x13+x14+x15+x16+x21+x22+x23+x24+x25+x26
subject to: x11+x231
x12+x241
x13+x251
x13+x211
x14+x261
x14+x221
x15+x231
x16+x241
x11in{0,1},x12in{0,1},x13in{0,1},x14in{0,1},x15in{0,1},x16in{0,1}
x21in{0,1},x22in{0,1},x23in{0,1},x24in{0,1},x25in{0,1},x26in{0,1}.
An optimum solution of the example problem with a 26 chessboard is as follows:
x11***=1,x12***=1,x13***=0,x14***=0,x15***=1,x16***=1
x21***=1,x22***=1,x23***=0,x24***=0,x25***=1,x26***=1
An example of the non-attacking knights problem with a 33 chessboard can be given as
mamizez=x11+x12+x13+x21+x22+x23+x31+x32+x33
subject to: x11+x321x11+x231
x12+x331
x12+x311
x13+x321
x13+x211
x21+x331
x23+x311
x11in{0,1},x12in{0,1},x13in{0,1}
x21in{0,1},x22in{0,1},x23in{0,1}
x31in{0,1},x32in{0,1},x33in{0,1}.
An optimum solution of the example problem with a 33 chessboard is as follows:
x11***=0,x12***=1,x13***=0
x21***=1,x22***=1,x23***=1
x31***=0,x32***=1,x33***=0
Implement your algorithm to solve the non-attacking knights problem in a single interactive
Python notebook using Azure Lab Services. Your notebook should include at least the following
function definition that takes the number of rows and columns as parameters and returns the
solution found.
What to submit: You are provided with a template file named as 0099999 hw05.ipynb,
where 99999 should be replaced with your 5-digit student number. You are allowed to change
the template file between the following lines.
# your implementation starts below
# your implementation ends above
You need to submit your source code in a single file (0099999hw05.py file that you will
download from Azure Lab Services by following "File" / "Save and Export Notebook As..."/
"Executable Script" menu items).
How to submit: Submit the file you edited to Blackboard by following the exact style
mentioned. Submissions that do not follow these guidelines will not be graded.
Late submission policy: Late submissions will not be graded.
Cheating policy: Very similar submissions will not be graded.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

ISBN: 1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

Relational Contexts in Organizations

Answered: 1 week ago