Came across this problem and I can't figure it out. Wanted to see if anyone else could.

Solitaire Battleships is a puzzle related to the two player game of battleships. In the solitaire version a grid is given with row and column totals indicating the number of ship segments that exist in each row and column. A number of hint squares are also revealed. These hint squares will show either:

• Water

• A whole submarine (single unit vessel)

• An end of a vessel

• The middle segment of a vessel (only cruisers in the 7x7 problem (see image))

In a legal battleship configuration, no battleship touches any other battleship, even diagonally.The totality of the input is row and column sums, number of each type of vessel and hints.

I'm trying to formulate solitaire battleships as both an Integer Programming problem and a constraint programming problem (obviously the IP formulation is also a valid CP formulation so not the same for either).

I have solved a number of LP, IP, and CP problems before in my field of work - but nothing this complicated.

Some helpful links I've been using:

http://www.cs.umbc.edu/courses/671/f...es/smith06.pdf

and

Battleships techniques

and the attached pdf file.

Hope you have better luck than I. I'm .