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

Week 8: Selecting and Revalidating Operating Conditions | Worked Companion

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

Week 8: Selecting and Revalidating Operating Conditions | Worked Companion

Cost reduction subject to specifications

Reject candidates that violate product specifications even when their cost is low. Recalculate candidates under identical reactor equations and specifications to compare acceptance and cost.

The baseline is 330 K and 6 min, giving B = 0.409091 and C = 0.245455 mol/L. It is reference-feasible and costs 76.80 $/h.

Retaining it during comparison preserves a checked option when a new model or solve fails.

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

Deriving the steady-state material balances

0=CA0−CAτ−k1CA0=−CBτ+k1CA−k2CB0=−CCτ+k2CB

These are per-volume balances using τ = V/F. Solve the first for A, the second for B, and the third for C to obtain the lecture’s reference equations.

Summing the equations gives CA + CB + CC = CA0, under the equal-mole consecutive-reaction and constant-density assumptions.

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

Hand calculation of the baseline

At 330 K, k₁ = 0.2 and k₂ = 0.1 min⁻¹. Substitute τ = 6 min.

CA=1.2/(1+.2×6)=.545455CB=.2×6×.545455/(1+.1×6)=.409091CC=.1×6×.409091=.245455

This satisfies B ≥ 0.38 and C ≤ 0.25. Cost is 12 × 6 + 0.24 × 20 = 76.80 $/h.

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

Deriving one-sided margins

Define error as e = prediction − reference. If overprediction eB is bounded by δB everywhere in the domain, then

CB=ĈB−eB≥.38+δB−δB=.38

For C, the required bound is on underprediction, −eC ≤ δC. Then ĈC ≤ 0.25 − δC gives CC = ĈC − eC ≤ 0.25.

This argument assumes uniform bounds. Maxima on a finite calibration sample do not prove that assumption.

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

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 Reading · 5 / 22

Data partitions and reference-evaluation cost

DataSize and role
Existing trainingWeek 6 network, 1,200 training points
Independent evaluation997 inputs, seed 808, full-box prediction error
Calibration31 × 31 = 961, margin calculation
Local update3 × 3 = 9, affine residual fitting
Candidate revalidationFresh reference evaluation at each selected input
Comparison search4,001 T values and local scalar refinement

Do not mix post-fit candidate revalidation data into independent test results. With expensive process models, calibration and benchmark costs also belong in the evaluation budget.

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

Error signs at a selected point

At the unadjusted candidate, predicted B is 0.380000 and reference B is 0.371157 mol/L. Thus eB = +0.008843, the adverse overprediction direction.

Predicted C is 0.171228 and reference C is 0.178136 mol/L. Although eC = −0.006908 is adverse underprediction, reference C remains below 0.25.

Error signs alone do not determine acceptance. Compare error magnitudes with the remaining margin to each constraint.

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

Local update coordinates and residual regression

The unadjusted candidate has scaled coordinates approximately (0.80148, 0.06556). Offsets ±0.06 correspond to ±2.4 K and ±0.48 min.

ri=Cref(xi)−fθ(xi)minβ∑i=19‖ri−[1,xi1,xi2]β‖22

Use the same input matrix for every output component. Adding an affine output term preserves the ReLU binary structure. Optimize the corrected model only inside the update-data box.

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

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 Reading · 9 / 22

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 Reading · 10 / 22

Follow-up data from a failed correction

B error at the local-correction candidate is 0.005180 mol/L, exceeding the applied 0.002 margin. Although its prediction is 0.002 above the specification, its reference output falls short by 0.003180.

Add the failed point’s reference output to the update data and examine residual changes with temperature and residence time. A smaller region or larger margin are other candidate revisions.

Each revision defines a new model or problem. Revalidate against the same original specifications and retain a checked feasible candidate until a revision succeeds.

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

Calculating residence time from the product specification

At fixed T, setting CB to target b gives a quadratic equation in τ.

CB=1.2k1τ(1+k1τ)(1+k2τ)bk1k2τ2+[b(k1+k2)−1.2k1]τ+b=0

With a nonnegative discriminant and two positive roots, B ≥ b between the roots. The τ bounds and C upper limit must also hold.

The smaller root is preferred because cost increases with τ at fixed T.

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

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 Reading · 13 / 22

The smaller root and a stable numerical formula

a=bk1k2,d=b(k1+k2)−1.2k1D=d2−4abτlow=2b−d+D

For a > 0, d < 0, D ≥ 0, this computes the smaller positive root while avoiding subtraction of similar positive quantities in the standard formula.

Take max(2, τlow), then check the larger root, the 10 min upper bound, and the C specification. No roots or an exceeded upper bound means no feasible candidate at that T.

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

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 Reading · 15 / 22

Calculating the reference-repaired candidate

Fix the local-correction candidate’s temperature at 339.8152 K and use b = 0.382. The smaller root is τ = 3.08559 min.

Reference outputs are A = 0.618470, B = 0.382000, and C = 0.199530 mol/L. They sum to 1.2 and satisfy the C upper bound.

Cost is 44.1828 $/h, which is 32.6172 $/h below the initial baseline. This point leaves the local optimization box, so report it separately as a repair checked directly with the reference equations.

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

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 Reading · 17 / 22

Benchmark differences and conditions for regret

ΔJbench=J(ucandidate)−J(ubench)

Compute this when both points satisfy the original specifications. If the benchmark is only a found feasible solution, the difference does not certify regret relative to the global optimum. It could become negative for a better candidate.

The repaired candidate has difference 44.1828 − 41.3920 = 2.7908 $/h. Leave savings and benchmark differences blank for the infeasible unadjusted and local-correction candidates.

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

Predicted versus actual improvement

For minimization using an objective model m on a common feasible input domain, compare predicted and actual improvement between the current point and a candidate.

ρ=J(uold)−J(unew)m(uold)−m(unew)

Use this ratio only with a positive denominator. Here the cost is an exact input function, so feasibility error is the issue rather than objective-model error. Do not use this ratio to accept infeasible candidates.

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

If the true objective drops from 100 to 92 while the model predicts 100 to 90, actual improvement is 8, predicted improvement is 10, and ρ=0.8. If the model also predicts 100 at the new point, the denominator is zero and the ratio is not evaluated. Both candidates must first satisfy the original constraints.

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

Exercises

  1. Calculate B violation at the unadjusted candidate and C slack at the baseline.
  2. If the uniform overprediction bound for B is 0.01, what lower bound is needed on predicted B?
  3. Does the maximum error on 961 calibration points guarantee the entire box? Explain.
  4. State the acceptance rule when comparing an infeasible cost of 37.9875 with a feasible cost of 44.1828.
  5. Propose a point after local-correction failure and explain why it should not be added to the independent test set.
Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 Reading · 20 / 22

Short answer checks

  1. B shortfall is 0.008843 mol/L. Baseline C slack is 0.25 − 0.245455 = 0.004545 mol/L.
  2. Require predicted B ≥ 0.39 mol/L. The implication holds only where the uniform bound is valid.
  3. Larger errors between sampled points remain possible. Reevaluate the new candidate.
  4. Compare costs among specification-feasible candidates. The cost 37.9875 is not accepted savings.
  5. The failed point (339.8152 K, 2.87093 min) and nearby boundary points are useful. If used for improvement, they become adaptively collected training data.
Sunwoo Kim · Surrogate Modeling for Process Prediction and Optimal Decision-Making Week 8 Reading · 21 / 22

Final submission and supporting sources

Submit the candidate table, rejection reasons, feasible-cost comparison, model/data revision plan, and execution record. State the reference assumptions used in evaluation.

Use the weight hash recorded in the result file to check that the same fitted model was used. A solver’s optimal status applies to its formulation, not global optimality of the actual process.

Week 6 frozen model

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 Reading · 22 / 22