liveBook · Manning

Constraint

A constraint is a condition or rule that restricts the permissible states, values, actions, or solutions in a system or problem.

How 19 Manning books explain it

The Creative Programmer

A constraint is a limitation or condition that restricts the possible approaches to a problem or creative endeavor.

How it is used
Frames creative problem solving as working with, adjusting, or deliberately introducing limitations.
How deep it goes
Distinguishes intrinsic, imposed, and self-imposed constraints, then gives tactics and a balance model rather than implementation internals.
Examples
Uses parchment, Cézanne, EGA dithering, Basecamp’s six-week budget, limited programming languages, and 4 KB demoscene competitions.
What you can do after
Apply it by identifying limits, generating options before rejecting them, and adding or removing constraints to regain creative momentum.

Read how The Creative Programmer explains constraint →

Building User-Friendly DSLs

A constraint is a rule that evaluates domain-specific language content for patterns that violate semantic or operational requirements.

How it is used
Prevents AST-caused generator, build, and Runtime failures by reporting repairable DSL issues to domain experts.
How deep it goes
Implements an AST checker, reactive issue display, generator hardening, local checks, and reference-cycle detection; defers several expression checks to exercises.
Examples
Uses rental Data Attributes with missing names or types, incomplete initial values, and cyclic attribute references.
What you can do after
Build it from scratch by writing issue-producing AST checks, surfacing violations in a projection, and hardening generation around faulty content.

Read how Building User-Friendly DSLs explains constraint →

Google Anthos in Action

A Gatekeeper constraint is a custom resource that instantiates a constraint template and specifies the resources to which its policy applies.

How it is used
Activates Gatekeeper policy logic for selected Kubernetes resources during Policy Controller admission checks.
How deep it goes
Works through constraint YAML, resource matching, parameters, dry-run violations, and exemptions; leaves template logic largely to existing templates.
Examples
Uses Namespace label requirements, allowed image registries, privileged-container checks, and dry-run Pod violation reports.
What you can do after
Operate/configure it through Gatekeeper YAML, scoping policies and reviewing dry-run violations before enforcement.

Read how Google Anthos in Action explains constraint →

Statistics Every Programmer Needs

A constraint is a condition that restricts the allowable values or solutions in an optimization problem.

How it is used
Restricts feature-selection decisions to choices that meet budgets, resource limits, and strategic-balance requirements.
How deep it goes
Defines linear restrictions and works through budget and epic inequalities as NumPy arrays, without deriving a solution algorithm.
Examples
Uses feature-selection budgets of $700,000 and $1.1 million plus a three-to-four-features-per-epic rule.
What you can do after
Apply it via NumPy constraint arrays and SciPy linprog, then check the solution and inspect selected features and costs.

Read how Statistics Every Programmer Needs explains constraint →

Optimization Algorithms: AI techniques for design, planning, and control problems

A condition in an optimization problem that restricts the values or combinations allowed for decision variables.

How it is used
Defines which candidate solutions are feasible while decision variables are chosen to optimize an objective function.
How deep it goes
Distinguishes boundary, equality, inequality, hard, and soft constraints, then works through an equality-constrained SymPy solution.
Examples
Uses school timetables, routing preferences, cargo-bike loading, ticket sales, and n-queens placements.
What you can do after
Apply it via SymPy to solve the ticket-sales equality example, or model a soft preference with an objective penalty.

Read how Optimization Algorithms: AI techniques for design, planning, and control problems explains constraint →

Prompt Engineering in Practice

A constraint is a requirement that limits the inputs, behavior, or outputs permitted for a model interaction.

How it is used
Bounds acceptable responses in structured prompts independently of task instructions and output format.
How deep it goes
Defines falsifiability, gives measurable examples and selection guidance, and cautions that constraints cannot enforce compliance.
Examples
Uses secure logging guidelines, incident updates, deployment decisions, and restricted code-review and HR-policy assistants.
What you can do after
Apply it by writing checkable prompt restrictions and testing responses for violations or conflicts.

Read how Prompt Engineering in Practice explains constraint →

Bayesian Optimization in Action

A constraint is an equality or inequality condition that candidate solutions must satisfy in an optimization problem.

How it is used
Uses constraints to restrict black-box optimization to practical solutions in hyperparameter tuning, drug discovery, and materials science.
How deep it goes
Defines feasible points and models black-box constraints with Gaussian processes, then stops at constrained expected-improvement implementation.
Examples
Uses neural-network architecture tuning, scientific discovery, a Forrester-function toy problem, and a nonpositive cost constraint.
What you can do after
Apply it via BoTorch to optimize an objective while modeling constraint functions and selecting feasible candidates.

Read how Bayesian Optimization in Action explains constraint →

Build a Robo-Advisor with Python (From Scratch)

A constraint is a mathematical restriction that limits the values or combinations permitted for optimization variables.

How it is used
Shapes portfolio optimization into diversified, risk-controlled, and benchmark-aware allocations.
How deep it goes
Works from bounded scalar optima through portfolio constraint equations, cvxpy expressions, and reusable constraint classes.
Examples
Uses a bounded quadratic, six ETF asset classes, 25% position caps, and equity and bond benchmark weights.
What you can do after
Apply it via cvxpy to encode portfolio bounds and relationships while recognizing infeasible or nonconvex formulations.

Read how Build a Robo-Advisor with Python (From Scratch) explains constraint →

Collaborative Software Design: How to facilitate domain modeling decisions

A constraint is a limitation or condition that restricts the available choices or outcomes in a business or software context.

How it is used
Uses constraints to discover business rules and acceptance criteria while modeling commands, scenarios, and stakeholder needs.
How deep it goes
Defines restrictions, shows their EventStorming notation, and works through seat-reservation examples without detailing implementation.
Examples
Uses cinema seat reservation, unavailable seats, one-ticket-per-seat, adjacent-seat requirements, and concrete Example Mapping cases.
What you can do after
Apply it via EventStorming and Example Mapping to expose restrictions, discuss alternatives, and record acceptance criteria.

Read how Collaborative Software Design: How to facilitate domain modeling decisions explains constraint →

Classic Computer Science Problems in Swift: Essential techniques for practicing programmers

A book-specific class whose instances store constrained variables and provide a method for checking whether an assignment satisfies the constraint.

How it is used
Models validity rules inside a generic constraint-satisfaction problem and lets backtracking reject inconsistent assignments.
How deep it goes
Defines a generic base class, registration behavior, partial-assignment handling, and concrete overrides without formal failure handling.
Examples
Uses Australian map coloring, eight queens, and non-overlapping word placement as concrete constraint implementations.
What you can do after
Build it from scratch by subclassing Constraint and implementing rules for partial assignments.

Read how Classic Computer Science Problems in Swift: Essential techniques for practicing programmers explains constraint →

Graph Neural Networks in Action

A constraint is a formal rule that restricts the permitted structure, values, or relationships in data or a model.

How it is used
Makes graph-dataset rules explicit so a GNN pipeline can be changed and its data and models tested.
How deep it goes
Defines constraints through graph schemas and outlines concrete validation checks, but does not specify a constraint-enforcement mechanism.
Examples
Uses bipartite-graph edge restrictions, a maximum node degree, and checks for non-null attributes, edge types, and unique IDs.
What you can do after
Practice/perform graph validation by expressing schema rules as queries or functions and checking an instance model against them.

Read how Graph Neural Networks in Action explains constraint →

The Art of Code

A limitation that restricts the available choices or implementation of a software solution.

How it is used
Uses constraints to generate and compare alternative designs for ordinary programming tasks.
How deep it goes
Works through performance, memory, and single-stream variants, including Java parallel-stream caveats, without deriving runtime or memory formulas.
Examples
Uses a Person-list task that finds youngest and oldest people and alphabetizes names under several limits.
What you can do after
Evaluate/understand competing implementations by selecting limits that fit workload, memory needs, paradigm requirements, and clarity.

Read how The Art of Code explains constraint →

The Art of AI Product Development

A prompt constraint is an instruction that restricts the content, length, vocabulary, or other properties of a model's output.

How it is used
Uses constraints to shape model outputs for specific editorial, programmatic, and retrieval-grounded requirements.
How deep it goes
Defines constraints and demonstrates practical wording, but does not descend into model internals or formal constraint enforcement.
Examples
Demonstrates word limits, accessible language, excluded promotion, and dynamically added grounding instructions.
What you can do after
Apply prompt engineering manually, then scale effective constraints through reusable templates and LangChain.

Read how The Art of AI Product Development explains constraint →

Statistics Slam Dunk

A constraint is a condition that restricts the feasible values or combinations of variables in an optimization problem.

How it is used
Frames restricted choices as boundaries around a function being minimized or maximized.
How deep it goes
Defines constraints and works through four roster requirements as concrete feasibility conditions.
Examples
Uses NBA free-agent selection, capital-project funding, and triathlete packing decisions.
What you can do after
Apply constrained optimization to restricted selection problems by changing the target function and constraints.

Read how Statistics Slam Dunk explains constraint →

Quantum Programming in Depth

A constraint is a condition that a candidate queen placement must satisfy, such as prohibiting two queens from sharing a row, column, or diagonal.

How it is used
Evaluates candidate N-queens placements before marking solutions in a Grover-style search.
How deep it goes
Derives pair counts and reversible workspace estimates, but stops short of a complete implementation.
Examples
Uses shared rows, columns, and diagonals as concrete conflict examples, with cell bits encoding occupancy.
What you can do after
Evaluate candidate placements by enumerating conflicting cell pairs or counting queens along board lines.

Read how Quantum Programming in Depth explains constraint →

Grokking Relational Database Design

A database constraint is a rule that restricts permitted data values or database states to preserve validity, consistency, and integrity.

How it is used
Uses SQL constraints during implementation to enforce design requirements and protect data integrity.
How deep it goes
Defines column rules and names common types, but stops short of covering every constraint or all SQL implementation code.
Examples
Uses a user table and spaceship requirements to assign primary, foreign, NOT NULL, UNIQUE, and CHECK constraints.
What you can do after
Build it from scratch by translating a database design into SQL rules and validating the resulting implementation.

Read how Grokking Relational Database Design explains constraint →

Java Persistence with Spring Data and Hibernate epub

A database constraint is a rule enforced by a database to restrict valid schema or data states.

How it is used
Centralizes integrity rules across domain objects, application layers, ORM metadata, and the SQL database.
How deep it goes
Descends from rule motivation to field annotations and Validator API tests, without detailing database-enforcement internals.
Examples
Uses @NotNull, @Size, and @Future on Item fields, then inspects a ConstraintViolation for an invalid auction-end date.
What you can do after
Diagnose/debug with it by validating Java objects and locating failed properties through ConstraintViolation results.

Read how Java Persistence with Spring Data and Hibernate epub explains constraint →

Learn SQL in a Month of Lunches

A database constraint is a rule that restricts which data operations or values are permitted for a table.

How it is used
Uses rules to preserve unique rows, valid relationships, and safe data operations across database tables.
How deep it goes
Explains creation styles, named keys, composite keys, duplicate-key diagnosis, and deletion effects without detailing constraint internals.
Examples
Demonstrates named keys on book-related tables and repairs duplicate order-item values before adding a composite primary key.
What you can do after
Diagnose duplicate key data, add named primary and foreign keys, and predict when deletion operations may be rejected.

Read how Learn SQL in a Month of Lunches explains constraint →

Delivering Machine Learning Projects: From design to deployment

A system constraint is a limitation imposed by the capabilities, configuration, interfaces, or operating conditions of a customer system.

How it is used
Uses constraints to determine whether a customer solution is feasible and to guide model design after exploratory data analysis.
How deep it goes
Defines data, business, system, and ethical constraints, then directs teams to document and resolve them without detailing implementation methods.
Examples
Uses data limitations, business boundaries, customer-system restrictions, and unacceptable stakeholder harm as constraint examples.
What you can do after
Evaluate/understand constraints, document them, and use them to shape feasible model-development decisions.

Read how Delivering Machine Learning Projects: From design to deployment explains constraint →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.