Surrogate Modeling for Process Prediction and Optimal Decision-Making · Week 8

Week 8: Selecting and Revalidating Operating Conditions

Revalidate Week 6 reactor decisions with reference process equations and compare violations, costs, and targeted data updates.

Week 8: Selecting and Revalidating Operating Conditions

Product specifications and revalidation of an optimum

The optimized product concentration meets the specification of 0.380 mol/L. Yet the process equations give 0.371 mol/L at the same conditions. Should this candidate be accepted?

Surrogate prediction and reference process concentration

Revalidate the selected conditions, choose an acceptable candidate, and identify the next useful data.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 1 / 31

Prediction validation and decision validation

Average error on independent evaluation data summarizes predictive quality across an input region. Optimization selects a few points with low cost, often near constraint boundaries.

Recompute product specifications, physical consistency, and cost at those decisions. Separately check whether the solver correctly represented the fitted model.

This week: these distinctions with the unchanged frozen network from Week 6.

Learning objectives and final report

  1. Prediction error, formulation error, and process constraint violation
  2. Cost comparison among candidates feasible in the reference process model
  3. Revalidation after margins and local data correction
  4. Reproducible records of models, data, solvers, and candidate selection

Final report: accepted candidate, rejection reasons, remaining checks, and additional data locations.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 2 / 31

Reactor assumptions and variables

Reference process: ideal steady-state isothermal CSTR; consecutive first-order reactions A → B → C. Feed concentrations: A 1.2 mol/L, B and C zero. Constant density and flow.

Temperature T spans 310-350 K and residence time τ spans 2-10 min. At fixed F = 1 L/min, V = Fτ, so τ is also a reactor-sizing decision.

Changing τ in an existing fixed-size vessel requires changing flow or another condition. That requires a revised cost and process formulation.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 3 / 31

Temperature-dependent reaction rates

k1(T)=.2exp[400008.314(1330−1T)]k2(T)=.1exp[500008.314(1330−1T)]

Rate constants have units min⁻¹, activation energies are J/mol, and R = 8.314 J/(mol·K). At 330 K, k₁ = 0.2 and k₂ = 0.1.

Temperature is externally maintained; this model includes no energy balance or cooling-capacity limit.

Unlike the 6000 K and 5000 K sensitivities in Weeks 1–4, this reference uses E/R=40000/8.314 and 50000/8.314 K. Rates agree at 330 K but differ elsewhere. Revalidate the Week 6 weights with the reference used in Weeks 6–8.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 4 / 31

Reference process equations and product specifications

CA=1.21+k1τCB=k1τCA1+k2τ,CC=k2τCB

Specifications are CB ≥ 0.38 and CC ≤ 0.25 mol/L. Concentrations must be nonnegative and sum to 1.2 mol/L.

Revalidation with these equations is conditional on their assumptions. Actual equipment requires additional checks on dynamics, heat management, measurement error, and other operating limits.

Calculate A first, then balance B formation against its outflow and onward reaction. C follows from formation out of B. Use this sequence at the identical T,τ when comparing the network with the reference process.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 5 / 31

Cost criterion and comparison baseline

J(T,τ)=12τ+.24(T−310)

J is measured in $/h. Assume a volume cost of 12 $/(L·h) and, at fixed flow, a heating coefficient of 0.24 $/(K·h). With F = 1, the volume term becomes 12τ.

This cost compares designs meeting product specifications. It includes neither sales revenue nor actual equipment quotations.

Baseline: T = 330 K, τ = 6 min; cost 76.80 $/h.

At flow 1 L/min, τ=6 min means volume 6 L. Volume cost is 12×6=72 $/h and temperature cost is 0.24×(330−310)=4.8 $/h, totaling 76.8 $/h. This baseline is checked for specifications as well as cost.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 6 / 31

The surrogate optimization problem

minT,τJ(T,τ)Ĉ=fθ(T,τ)ĈB≥.38,ĈC≤.25,Ĉ≥0

Input bounds and scaling match Week 6. The objective is twelve times the Week 6 cost index, so the unadjusted model has the same optimal input.

Use the ReLU MILP from Weeks 5 and 6. The Week 7 cost-epigraph LP does not automatically apply to concentration constraints.

Multiplying every objective value by positive 12 preserves ranking, so the optimal input matches Week 6 while the cost unit changes. Specifications are imposed on network predictions; that ranking alone does not establish feasible costs for the reference process.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 7 / 31

Separating errors from termination status

CheckQuantities compared
Formulation errorMILP output and network forward output at the same input
Prediction errorNetwork output and reference process output
Constraint violationReference output and product specifications
Optimization gapIncumbent and valid bound for the fitted model

The unadjusted solve has MILP/forward disagreement below 10⁻¹² mol/L. Its reference product concentration still misses the specification.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 8 / 31

Average prediction error and decision-point error

Generate 997 inputs uniformly over the full box, separately from training. RMSE is 0.00535 for A, 0.00439 for B, and 0.00527 for C, in mol/L.

At the optimized candidate, B is overpredicted by 0.00884 mol/L. Since its prediction lies exactly on the specification boundary, this error causes a violation.

Report error at the optimized candidate alongside independent average error so that specification violations at the selected point are visible.

Optimization can reduce cost by reducing specification slack until predicted B touches its lower bound. At that point even a small overprediction causes violation. Evaluate the selected point’s error direction and slack separately from domain-average RMSE.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 9 / 31

Reference revalidation of the unadjusted candidate

QuantityValue
T / τ342.0593 K / 2.52444 min
Predicted B / reference B0.380000 / 0.371157 mol/L
Reference C0.178136 mol/L
B shortfall0.008843 mol/L
Calculated cost37.9875 $/h

Reject this candidate because it violates the product specification. Its lower cost does not make it an improvement over a feasible baseline.

Predicted B slack is zero and overprediction is 0.008843, so reference slack is −0.008843. C retains slack 0.25−0.178136=0.071864 mol/L. Failure of even one required specification rejects the candidate.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 10 / 31

Input domain and data support

A candidate inside the training box can still have large error if nearby data are sparse or the response varies rapidly. Being inside the box alone does not guarantee accurate interpolation.

Inspect input ranges, scaled coordinates, distances to nearby training points, and errors near boundaries. An expanded optimization domain needs separate model validation.

Recompute valid formulation bounds for the new domain as well.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 11 / 31

Physical consistency and product feasibility

rbal=|ĈA+ĈB+ĈC−1.2|vB=max(0,.38−CB)vC=max(0,CC−.25)

Record the concentration sum, negative concentrations, and product specifications separately. An exact sum can coexist with low B; positive concentrations can coexist with excessive C.

The Week 4 equality projection enforces its specified linear equality. It does not guarantee product specifications or accurate nonlinear process responses.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 12 / 31

Margins from one-sided errors

ĈB≥.38+δBĈC≤.25−δC

Overprediction of B and underprediction of C are the adverse directions. A separate calibration grid gives δB = 0.02130 and δC = 0.01305 mol/L.

These are maxima observed at 961 points, not proven bounds over the continuous domain. Reevaluate the new candidate with the process equations.

B has a lower requirement, so guard against the model predicting too much. C has an upper limit, so guard against predicting too little. Opposite inequality directions explain why one margin is added and the other subtracted.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 13 / 31

Calculating one-sided margins

Define e=prediction−reference. Positive e is adverse for B; negative e is adverse for C.

Quantity B lower limit C upper limit
Original specification Reference B≥0.38 Reference C≤0.25
Applied margin δ_B=0.02130 δ_C=0.01305
Required prediction B̂≥0.40130 Ĉ≤0.23695
At the assumed error limit 0.40130−0.02130=0.38 0.23695+0.01305=0.25

The last row applies when the error limit holds at that input. The maximum over 961 calibration points does not prove a bound at every unseen point. Reevaluate the next candidate with the reference process even after adding margins.

Sample margins are δ_B=max(0,maxᵢ e_B,i) and δ_C=max(0,maxᵢ(−e_C,i)). B errors [−0.003,0.008,0.002] give 0.008; C errors [0.004,−0.006,−0.001] give 0.006. Unlike an absolute-error maximum, these select only the direction that can violate the specification.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 14 / 31

Cost and specifications of the margin candidate

QuantityResult
T / τ329.1148 K / 4.66529 min
Reference B / C0.392935 / 0.174547 mol/L
Reference feasibilitySpecifications met
Cost60.5710 $/h
Savings versus baseline16.2290 $/h

Using a large error observed anywhere in the domain as a margin can be costly in some regions. Compare the margin with error at the actual selected point.

Savings from the baseline are 76.8000−60.5710=16.2290 $/h. First confirm positive reference slacks: 0.012935 for B and 0.075453 mol/L for C; then report the savings.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 15 / 31

Choosing additional data locations

Form a 3 × 3 grid around the unadjusted candidate using offsets −0.06, 0, +0.06 on each scaled axis. Clip to the original input box and obtain nine reference outputs.

Local residual correction: these data, separate from the 997 final-evaluation inputs

Choose points to examine constraint boundaries, the current candidate, and error direction. For physical experiments, include accessible conditions and experimental costs.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 16 / 31

A local residual model and restricted domain

x1=T−31040,x2=τ−28Ccorr(x)=fθ(x)+β0+β1x1+β2x2

Fit an affine model to reference-minus-prediction residuals at the nine points. Restrict optimization to their bounding box and apply a 0.002 mol/L margin to both product constraints.

This margin is heuristic. Affine correction preserves the MILP structure but provides no uniform bound on residual error.

The correction target is reference minus prediction. At a point overpredicting B by 0.008843, the desired correction is −0.008843. Reversing the sign would raise an already inflated prediction; check corrected output explicitly at one point.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 17 / 31

Local-data coordinates and the regression matrix

Candidate (342.0593 K,2.52444 min) has scaled coordinates [(342.0593−310)/40,(2.52444−2)/8]≈[0.80148,0.06556].

Axis Scaled offset Physical offset
Temperature ±0.06 ±2.4 K
Residence time ±0.06 ±0.48 min
design = np.column_stack((np.ones(len(x_local)), x_local))
residual = reference_y - network_y
beta = np.linalg.lstsq(design, residual, rcond=None)[0]
corrected_y = network_y + design @ beta

For nine inputs, design is (9,3), the three-component residual is (9,3), and beta is (3,3). Multiplying a row [1,x₁,x₂] by beta gives three corrections. Restrict the next optimization to the fitted region and check remaining error at the new candidate.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 18 / 31

Substituting the fitted correction coefficients

The recorded B correction coefficients are [−0.0160962605,0.0074357617,0.0823403944]. At local candidate (339.815193 K,2.870934 min), x₁=0.745379824 and x₂=0.108866748.

B correction term Value [mol/L]
Intercept −0.0160962605
Temperature-coordinate term 0.0074357617×0.745379824=0.0055424667
Residence-time-coordinate term 0.0823403944×0.108866748=0.0089641309
Sum −0.0015896628

Adding this to the original network prediction B≈0.3835896628 gives corrected prediction 0.382000. The reference value at the same input is 0.3768201356, leaving error 0.0051798644.

Least squares reduces the summed squared errors of nine points. It does not require interpolation of every point or exact prediction at a new candidate. Correctly computed regression coefficients still require candidate revalidation.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 19 / 31

Failed revalidation after local correction

QuantityResult
T / τ339.8152 K / 2.87093 min
Corrected prediction B0.382000 mol/L
Reference B0.376820 mol/L
B shortfall0.003180 mol/L
Cost41.6069 $/h

Reject this candidate despite nine new data points and a restricted local domain. Its corrected-model error exceeds the 0.002 margin.

The new residual at the candidate becomes useful follow-up data. Do not report the rejected candidate’s cost as achieved savings.

The corrected model predicts 0.382 while the reference gives 0.376820. Subtracting the reserved margin 0.002 from error 0.005180 leaves shortfall 0.003180. Adding data does not by itself establish that remaining error lies within the margin.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 20 / 31

Repairing a candidate with the reference process equations

Because this reference model is inexpensive, fix T = 339.8152 K and directly calculate the smaller τ satisfying B = 0.382. Use the original input range, without the local-correction box restriction.

At τ = 3.08559 min, reference C is 0.199530 mol/L and cost is 44.1828 $/h. All original specifications are met.

Specification feasibility of this candidate is checked directly with the reference equations; it lies outside any guarantee supplied by the local correction model.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 21 / 31

From the B specification to a quadratic in residence time

At fixed temperature, k₁ and k₂ are numbers. Set B to target b and multiply by the positive concentration denominator.

Step Relation
Set B=b 1.2k₁τ=b(1+k₁τ)(1+k₂τ)
Expand denominator 1.2k₁τ=b[1+(k₁+k₂)τ+k₁k₂τ²]
Collect terms bk₁k₂τ²+[b(k₁+k₂)−1.2k₁]τ+b=0

At 330 K and b=0.4, this is 0.008τ²−0.12τ+0.4=0. Dividing by 0.008 gives (τ−5)(τ−10)=0. B≥0.4 holds between the roots, [5,10].

At fixed temperature, cost increases with τ, so check 5 min first. It gives C=0.1×5×0.4=0.2≤0.25. At 10 min, C=0.4 violates the cap; the B condition alone is insufficient.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 22 / 31

Computing the smaller root and revalidating the candidate

At T=339.8152 K and b=0.382, calculate a=bk₁k₂ and d=b(k₁+k₂)−1.2k₁. A negative discriminant means there is no real residence time with B=b at this temperature.

k1 = 0.2 * np.exp(40000 / 8.314 * (1/330 - 1/T))
k2 = 0.1 * np.exp(50000 / 8.314 * (1/330 - 1/T))
a = b * k1 * k2
d = b * (k1 + k2) - 1.2 * k1
disc = d*d - 4*a*b
tau = 2*b / (-d + np.sqrt(disc))

Here k₁≈0.3047, k₂≈0.1693/min and τ≈3.08559 min. This smaller-root formula uses a>0,d<0,disc≥0. Check the original τ bounds and reference B,C for each candidate.

Reference C≈0.199530<0.25 and cost is 12×3.08559+0.24×(339.8152−310)≈44.1828 $/h. Savings from the original baseline are 76.8−44.1828=32.6172 $/h.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 23 / 31

Rationalizing the smaller-root formula

For aτ²+dτ+b=0, define D=d²−4ab. With a>0,d<0,D≥0, the smaller root is (−d−√D)/(2a). Multiply numerator and denominator by −d+√D.

−d−D2a=d2−D2a(−d+D)=2b−d+D

Since d²−D=4ab, cancellation gives the last expression. Replacing subtraction of similar positive values −d and √D with addition reduces loss of significant digits.

At 330 K,b=0.4, a=0.008,d=−0.12,D=0.0016 and √D=0.04. The smaller root is 0.8/(0.12+0.04)=5; the larger is (0.12+0.04)/0.016=10 min. Substitute roots back into the original B equation and C specification before accepting a candidate.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 24 / 31

Reference-model optimization for comparison

At each T, solve the quadratic equation for the smaller τ giving B = 0.38. Check τ bounds and the C specification, then use 4,001 temperature grid points and a scalar search near the best grid point.

Comparison candidate: T = 344.9116 K, τ = 2.75110 min; cost 41.3920 $/h.

This supplies a feasible benchmark, not a certified global bound over the continuous domain. Report cost differences as observed benchmark differences.

At fixed temperature, cost increases with τ, so first inspect the smallest τ satisfying the B lower limit. Residence-time bounds and the C limit still apply. The smaller root at an arbitrary temperature is not automatically feasible.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 25 / 31

Reference process results by candidate

CandidateB (mol/L)Cost ($/h)Specs
Baseline0.4090976.800Met
Unadjusted MILP0.3711637.988Violated
Margin MILP0.3929360.571Met
Local correction0.3768241.607Violated
Reference repair0.3820044.183Met
Reference benchmark0.3800041.392Met

Every B value uses the same reference process equations. Specification checks include B, C, nonnegative concentrations, and the concentration sum.

Check each row using its complete reference composition. Although the table displays B, also evaluate C, the sum, and nonnegativity. A failed row’s low cost is excluded from rankings of feasible savings.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 26 / 31

Cost comparison among feasible candidates

Costs of candidates feasible in the reference model

The reference-repaired candidate costs 32.6172 $/h less than the initial baseline, with an observed benchmark difference of 2.7908 $/h.

All values depend on the assumed cost coefficients. Record reference evaluations, model training, and optimization time separately.

Subtracting benchmark 41.3920 from repaired-candidate cost 44.1828 gives 2.7908 $/h. This compares two checked candidates. Without a proof that the benchmark is globally optimal, it is not certified regret relative to the global optimum.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 27 / 31

Iteration procedure and acceptance criteria

  1. Fix the fitted model, domain, context, specifications, and cost.
  2. Obtain a candidate and check forward agreement and solver termination.
  3. Check original constraints with the reference equations. On failure, retain a feasible incumbent.
  4. Add data, revise the model or region, and revalidate the next candidate.

Convergence of trust-region methods requires conditions on model accuracy and acceptance rules. Those conditions have not been established for this local correction procedure, so convergence is not guaranteed.

Alexandrov, Dennis, Lewis and Torczon, A trust-region framework for managing the use of approximation models in optimization (1998), author manuscript

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 28 / 31

Reproducibility items in the final report

CategoryRecord
Model/dataFrozen-weight hash, scaling, training/calibration/evaluation/update data
ProblemInput bounds, fixed context, units, objective, and constraints
ComputationSolver/version/status/gap/time and forward error
DecisionReference output, violations, cost, and acceptance by candidate
Remaining checksReference assumptions, dynamics, heat management, and experiments
Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 29 / 31

Running the lab and report assignment

python -m pip install -r requirements.txt
python week08_lab.py --output-dir my-results

The bundle includes the frozen Week 6 network and required calculation functions. It saves a results JSON, candidate-comparison CSV, independent evaluation data, and nine update points.

Change a margin or local-grid width once, then revalidate the new candidate against the original specifications. Record data count and cost and explain acceptance or rejection.

Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 30 / 31
Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 · 31 / 31