liveBook · Manning

Optimization solver

As explained in The Creative Programmer

A solver is a procedure or computational system that determines a solution to a specified problem.

A solver is a procedure or computational system that determines a solution to a specified problem. Start by identifying the problem’s rules and constraints, then form a solver concept before letting recursion, backtracking, or memory limits shape the solution. section 4.5.2

A playful solver-building workflow looks like this:

  • Temporarily remove hardware and software constraints so the underlying problem becomes easier to imagine. section 4.5.2
  • Preserve the problem’s meaningful rules, such as matching pairs or relationships between neighboring elements. section 4.5.2
  • Translate the formed idea into code, then test it with generated inputs rather than hardcoded answers. section 6.7.2
  • Use timing, another programming language, or a small interface to explore performance and extend the experiment. section 6.7.2

Finding the two bad guys

Represent a 3 × 3 pointing puzzle as a matrix whose arrows describe relationships between people. A solver must identify the two bad guys for each puzzle, then prove it works on newly generated arrangements instead of merely reproducing known answers. section 6.7.2

Figure 6.8 Who are the two bad guys? These are two separate puzzles. This idea is based on puzzles by LEVEL 5 Interactive.
CH06_F08_Groeneveld

Use the puzzle figure to inspect the two arrangements that the solver must distinguish. section 6.7.2

How The Creative Programmer covers it

How deep it goes
Develops abstraction, representation, testing, and extensions, but leaves implementation algorithms and optimization details open.
Examples
Uses tile-based dominoes and a 3 × 3 bad-guy pointing puzzle as concrete solver exercises.
What it assumes
Assumes a specified puzzle or rule system, while teaching the value of separating conceptual constraints from implementation limits.
What you can do after
Build it from scratch by modeling rules, translating them into code, generating test inputs, and measuring repeated runs.
How it connects
Connects solvers with constraints, recursion, backtracking, matrices, input generation, and performance analysis.

Also explained in

Compare how 2 books explain optimization solver →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Creative Programmer. The section links point to the parts of the book it draws on.