RSOME案例: 整数规划求解数独问题


RSOME: Robust Stochastic Optimization Made Easy


Integer Programming for Sudoku

In this section we will use a Sudoku game to illustrate how to use integer and multi-dimensional arrays in RSOME. Sudoku is a popular number puzzle. The goal is to place the digits in [1,9] on a nine-by-nine grid, with some of the digits already filled in. The solution must satisfy the following four rules:

  1. Each cell contains an integer in [1,9].
  2. Each row must contain each of the integers in [1,9].
  3. Each column must contain each of the integers in [1,9].
  4. Each of the nine 3x3 squares with bold outlines must contain each of the integers in [1,9].

在这里插入图片描述

The Sudoku game can be considered as a feasibility optimization problem with the objective to be zero and constraints used to fulfill above rules. Consider a binary variable x i j k ∈ { 0 , 1 } x_{ijk}\in \{0, 1\} xijk{ 0,1}, with i ∈ [ 0 , 8 ] i \in [0, 8] i[0,8], j ∈ [ 0 , 8 ] j \in [0, 8] j[0,8], and k ∈ [ 0 , 8 ] k \in [0, 8] k[0,8]. It equals to one if an integer k + 1 k+1 k+1 is placed in a cell at the i i ith row and j j jth column. Let a i j a_{ij} aij be the known number at the i i ith row and j j jth column, with ( i , j ) ∈ I × J (i, j)\in\mathcal{I}\times\mathcal{J} (i,j)I×J as I \mathcal{I} I and J \mathcal{J}

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值