liveBook · Manning

Constraint

Also called limitations

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

How 29 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 →

Build High Value Software Systems

A condition or limitation that restricts how work can proceed within a delivery system.

How it is used
Identifies both deliberate boundaries on work and bottlenecks that govern delivery or system throughput.
How deep it goes
Develops a measurement-and-intervention procedure for bottlenecks and gives concrete prompt and pipeline safeguards, without prescribing one universal constraint.
Examples
Illustrates constraints with vague AI prompts, a congested staging environment, a slow CI pipeline, and a shared database.
What you can do after
Diagnose/debug with it by tracing delays, testing a targeted change, and measuring whether the constraint moves.

Read how Build High Value Software Systems explains constraint →

Applied Reinforcement Learning

A restriction that limits the values or combinations allowed in an optimization problem, including which actions are valid in a state.

How it is used
Defines business limits and state-dependent action validity for optimization and reinforcement learning decisions.
How deep it goes
Works from a linear resource formulation to state encoding and code that filters valid actions.
Examples
Uses bakery labor and flour limits, data-center maintenance and power budgets, and project allocation rules.
What you can do after
Builds constraint-aware action selection from scratch for a resource allocation model.

Read how Applied Reinforcement Learning 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 restrictions on decision variables that delimit feasible solutions in optimization and constraint-satisfaction problems.
How deep it goes
Distinguishes constraint types and explains penalty modeling, with a worked equality-constrained solution using Lagrange multipliers.
Examples
Uses school timetabling, cargo-bike loading, event ticket sales, and the n-queen problem to illustrate constraints.
What you can do after
Apply equality constraints via SymPy and Lagrange multipliers, and evaluate hard and soft constraints in optimization models.

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 →

Software Architecture Decision-Making

A limitation or condition, such as time, cost, capability, risk, ownership, law, or organization, that restricts architectural choices.

How it is used
Frames architectural decisions as trade-offs between technical intent and delivery, organizational, and operational realities.
How deep it goes
Develops constraint assessment through clarification, competing-force analysis, consequences, and adaptation rather than implementation internals.
Examples
Uses a vague request to make a process faster and a rapidly growing consumer application nearing capacity limits.
What you can do after
Evaluate/understand architectural options by surfacing constraints, judging trade-offs, and revisiting decisions as conditions change.

Read how Software Architecture Decision-Making 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 →

Data-Oriented Programming in Java

A constraint is a condition that restricts which data representations or program states are valid.

How it is used
Turns domain meaning into invariants, construction checks, and valid state-transition rules.
How deep it goes
Works through constructor guards and database transition encodings, then defers stronger illegal-state representations to later techniques.
Examples
Uses measurement records, checklist templates and statuses, and Started, Completed, and Failed task lifecycles.
What you can do after
Apply it via constructor validation, alternative modeling, and database conditions to reject invalid values and transitions.

Read how Data-Oriented Programming in Java 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 →

Build Financial Software with Generative AI (From Scratch)

A database constraint is a rule enforced by a database to restrict the values or relationships permitted in stored data.

How it is used
Protects ACH records from missing values and invalid relationships in a relational database.
How deep it goes
Explains common field rules and foreign keys, then works through a constraint failure and test setup.
Examples
Uses ACH batch deletion and a parser test requiring a valid parent record.
What you can do after
Diagnose constraint failures by identifying missing values or parent records and adjusting test setup.

Read how Build Financial Software with Generative AI (From Scratch) explains constraint →

Timeless Algorithms, The Foundational Ideas

A condition that restricts the feasible choices or solutions in an optimization problem.

How it is used
Restricts feasible solutions in optimization and bounds how much uncertainty learning methods can reduce.
How deep it goes
Defines optimization inequalities and connects learning limits to data, computation, and resources; scaling pushes constraints outward but does not eliminate them.
Examples
Uses project portfolios with multiple resource limits and SVM training points constrained by margin boundaries.
What you can do after
Evaluate whether a candidate solution satisfies resource limits or training-point margin inequalities.

Read how Timeless Algorithms, The Foundational Ideas 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 focus creative coding and explore alternative designs.
How deep it goes
Works through baseline, performance, memory, and single-pipeline variations before asking for a readable combined solution.
Examples
Uses a people-list transformation that finds age extremes and alphabetizes names.
What you can do after
Practice comparing implementations under different constraints and combining their useful aspects in a readable solution.

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 →

The Design of Web APIs, Second Edition

A contextual constraint is a condition arising from an API's data, services, usage, implementation, business environment, existing systems, or consumers that limits design choices.

How it is used
Guides API choices so consumer needs remain workable within security, efficiency, implementation, and business limits.
How deep it goes
Develops discovery questions and a root-cause challenge for apparent constraints rather than prescribing one universal API design.
Examples
Illustrates constraints with banking clients limited to POST and XML, financial message standards, document uploads, and slow video processing.
What you can do after
Practice constraint discovery: question consumer, data, operational, and implementation limits before settling on an API flow.

Read how The Design of Web APIs, Second Edition 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 →

Architecting for Autonomy

A rule or limit that restricts the scope, data, actions, retries, evidence sources, or communications permitted in an interaction.

How it is used
Bounds agentic interactions by governing permitted intent, context, authority, outcomes, evidence, and escalation.
How deep it goes
Defines runtime boundaries and decision paths but deliberately leaves internal agent reasoning unspecified.
Examples
Uses a production-lot containment assessment requiring defined records, recommendations, delegated authority, and escalation.
What you can do after
Operate/configure governed interactions that constrain actions, preserve evidence, and route exceptions to authorized humans.

Read how Architecting for Autonomy explains constraint →

Grokking Software Architecture

A practical limitation imposed by a project's operating context, such as available resources or environmental conditions.

How it is used
Uses project limits to bound design options and focus architectural inquiry.
How deep it goes
Explains resource limits through a worked CSV-export tradeoff and distinguishes adjustable qualities from non-negotiable ones.
Examples
Uses a one-day CSV-export deadline and a small team, limited budget, and six-week deadline as concrete cases.
What you can do after
Apply constraints by stating project limits, comparing feasible options, and making deliberate quality tradeoffs.

Read how Grokking Software Architecture 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 →

Algorithms Every Programmer Should Know

A constraint is a requirement or limitation that restricts which selections or solutions are permitted.

How it is used
Frames algorithm design as finding correct, generalized solutions within limits on time, memory, cost, and scale.
How deep it goes
Demonstrates constraints through matching stability and exact resource ceilings, while stopping short of formal constraint-solving methods.
Examples
Uses ride-sharing assignments, cloud-memory scheduling, and electric-van cargo loading to make restrictions concrete.
What you can do after
Evaluate/understand algorithm choices by identifying limiting resources, checking feasibility, and recognizing tradeoffs between competing goals.

Read how Algorithms Every Programmer Should Know 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 →

Also covered in

What to know first

Related concepts

Questions about constraint

What is constraint?

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

Which Manning books explain constraint?

The Creative Programmer, Building User-Friendly DSLs, Google Anthos in Action, Build High Value Software Systems, Applied Reinforcement Learning, Statistics Every Programmer Needs, Optimization Algorithms: AI techniques for design, planning, and control problems, Prompt Engineering in Practice and 21 more.

What should I know before learning constraint?

Manning books that teach constraint usually introduce language model, contract, prompt and optimization first.

What is the difference between constraint and instruction?

A constraint is a condition or rule that restricts the permissible choices, states, actions, values, or solutions in a system or problem. An instruction is a directive specifying an action, operation, task, constraint, or expected behavior for a person or computational system.

What kinds of constraint are there?

Kinds of constraint include check constraint and drum.

What is constraint also called?

Constraint is also called limitations.

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.