Tribhuvan University
Faculty of Management
Office of the Dean
Official Model Question Paper / Dean's Office Blueprint
Candidates are required to give their answers in their own words as far as practicable. The figures in the margin indicate full marks.
Group A
Brief Answer Questions. Attempt ALL questions.
[5 × 2 = 10]- [2]
Define an Admissible Heuristic and a Consistent (Monotonic) Heuristic in A* search.
View model answerHide model answer
Answer:
- Admissible Heuristic: A heuristic function
is admissible if it never overestimates the true cost to reach the nearest goal node from node , i.e., for all , where is the true optimal cost. - Consistent (Monotonic) Heuristic: A heuristic
is consistent if, for every node and every successor generated by action with step cost , it satisfies the triangle inequality: Consistency guarantees that once a node is expanded in graph search, the shortest path to it has already been discovered.
- Admissible Heuristic: A heuristic function
- [2]
What is the Turing Test, and how does it operationalize machine intelligence?
View model answerHide model answer
Answer: Turing Test (Alan Turing, 1950): An empirical operational test of machine intelligence based on the "Imitation Game". A human interrogator communicates via text terminal with two unseen respondents (one human, one computer).
- Operationalization: If the interrogator cannot reliably distinguish the computer from the human after a specified duration of questioning, the machine is deemed to possess human-level conversational intelligence.
- [2]
Differentiate between Forward Chaining and Backward Chaining in rule-based inference engines.
View model answerHide model answer
Answer:
- Forward Chaining (Data-Driven / Bottom-Up): Starts with known facts in working memory and applies inference rules (Modus Ponens) iteratively to deduce new facts until a target goal or hypothesis is proven.
- Backward Chaining (Goal-Driven / Top-Down): Starts with a goal or query hypothesis and searches backwards through rules to determine what supporting premise facts must be true to validate the goal (e.g., medical diagnosis, Prolog execution).
- [2]
What is the primary role of an Activation Function in an Artificial Neural Network? Name two non-linear activation functions.
View model answerHide model answer
Answer: Role of Activation Function: Introduces non-linearity into the neural network. Without non-linear activation functions, a multi-layer neural network collapses mathematically into a single linear regression transformation (
), unable to learn complex non-linear decision boundaries. - Examples:
- ReLU (Rectified Linear Unit):
- Sigmoid:
- ReLU (Rectified Linear Unit):
- Examples:
- [2]
Explain the difference between Supervised Learning and Unsupervised Learning with one algorithmic example for each.
View model answerHide model answer
Answer:
- Supervised Learning: The model is trained on labeled data pairs
, learning a mapping function from input features to known ground-truth targets (e.g., Support Vector Machines (SVM) for loan default classification). - Unsupervised Learning: The model is provided unlabeled inputs
without predefined target classes, seeking to uncover latent structures, natural clusters, or lower-dimensional representations (e.g., -Means Clustering for customer market segmentation).
- Supervised Learning: The model is trained on labeled data pairs
Group B
Descriptive Answer Questions. Attempt any THREE questions.
[3 × 10 = 30]- [10]
Explain informed state-space search using the A Search Algorithm*. Detail the evaluation function
and prove why A* is guaranteed to find an optimal path when is admissible. Provide a complete, working Python implementation. View model answerHide model answer
Informed State-Space Search: A* Algorithm, Optimality Proof, and Python Implementation
1. Evaluation Function and Mechanics
A* search combines the uniform-cost search (Dijkstra) with greedy best-first search using the evaluation function:
: Exact path cost accumulated from the initial start node to current node . : Estimated heuristic cost from current node to the nearest goal state. : Estimated total cost of the cheapest solution path passing through node .
2. Mathematical Proof of A* Optimality (Tree Search with Admissible
) Let
be an optimal goal state with true optimal path cost . Suppose for contradiction that A* terminates by selecting a suboptimal goal state with path cost . - Because
is a goal node, by definition , so . - Since an optimal path to
exists, consider some unexpanded frontier node lying along the optimal path to . - By definition of
: - Because
is admissible ( ): - Combining inequalities:
- Since A* always extracts the frontier node with the minimum
-value from its priority queue, it will always expand node before . - Therefore, A* can never expand the suboptimal goal
while an optimal path frontier exists. Hence, A* is guaranteed to find an optimal path.
3. Complete Working Python Implementation of A*
import heapq from typing import Dict, List, Tuple, Optional def a_star_search( graph: Dict[str, List[Tuple[str, float]]], heuristics: Dict[str, float], start: str, goal: str ) -> Tuple[Optional[List[str]], float]: # Priority queue stores tuples: (f_score, current_node, path, g_score) open_set = [(heuristics[start], start, [start], 0.0)] visited_costs = {} while open_set: f_val, current, path, g_val = heapq.heappop(open_set) if current == goal: return path, g_val # If we already found a cheaper path to current node, skip if current in visited_costs and visited_costs[current] <= g_val: continue visited_costs[current] = g_val for neighbor, edge_weight in graph.get(current, []): new_g = g_val + edge_weight if neighbor not in visited_costs or new_g < visited_costs[neighbor]: new_f = new_g + heuristics.get(neighbor, 0.0) heapq.heappush(open_set, (new_f, neighbor, path + [neighbor], new_g)) return None, float("inf") # Demonstration Graph: Route from Kathmandu to Pokhara via intermediate waypoints if __name__ == "__main__": nepal_routes = { "Kathmandu": [("Naubise", 26.0)], "Naubise": [("Kathmandu", 26.0), ("Galchhi", 22.0), ("Daman", 50.0)], "Galchhi": [("Naubise", 22.0), ("Mugling", 62.0)], "Daman": [("Naubise", 50.0), ("Hetauda", 55.0)], "Mugling": [("Galchhi", 62.0), ("Pokhara", 88.0), ("Narayangarh", 36.0)], "Pokhara": [("Mugling", 88.0)], "Hetauda": [("Daman", 55.0)], "Narayangarh": [("Mugling", 36.0)] } # Straight-line Euclidean distance heuristic to Pokhara heuristic_to_pokhara = { "Kathmandu": 140.0, "Naubise": 115.0, "Galchhi": 95.0, "Daman": 120.0, "Mugling": 70.0, "Narayangarh": 90.0, "Hetauda": 150.0, "Pokhara": 0.0 } path, total_km = a_star_search(nepal_routes, heuristic_to_pokhara, "Kathmandu", "Pokhara") print("Optimal A* Route:", " -> ".join(path)) print(f"Total Road Distance: {total_km} km") - [10]
Explain Adversarial Search and Game Playing using the Minimax Algorithm and Alpha-Beta Pruning. Illustrate a game tree with depth 3 showing min/max evaluations, alpha and beta cutoffs, and computational complexity reduction.
View model answerHide model answer
Adversarial Search: Minimax Algorithm and Alpha-Beta Pruning
1. The Minimax Decision Rule
In a two-player, zero-sum, perfect-information game (e.g., Chess, Tic-Tac-Toe):
- MAX: Aims to choose moves maximizing the utility value:
- MIN: Aims to choose moves minimizing the utility value:
- Computational Complexity: For branching factor
and search depth , time complexity is and space complexity is .
2. Alpha-Beta (
- ) Pruning Optimization Alpha-Beta pruning removes subtrees that cannot influence the final decision without affecting the optimal Minimax outcome.
(Alpha): Best (highest-value) choice found so far along path for MAX (initialized to ). (Beta): Best (lowest-value) choice found so far along path for MIN (initialized to ). - Pruning Rule: Prune remaining children of node
if:
3. Game Tree Trace (Depth 3)
Consider root MAX node
, children MIN nodes and , and leaf terminal nodes: [A] (MAX) --> Value = 6 / \ [B] (MIN) [C] (MIN) / \ / \ [D] [E] [F] [G] (Pruned!) / \ / \ / \ 3 5 6 9 2 (beta <= alpha prune!)Step-by-Step Pruning Walkthrough:
- At Node
(leaves 3, 5): MIN chooses . Returns 3 to . - At Node
: . - At Node
(leaves 6, 9): MIN chooses . - At Node
: . Returns 3 to Root . - At Root
: . Root will achieve at least 3. - Search enters right subtree at
(MIN, ). - At Node
: Evaluates first child = 2. - At Node
: . - Pruning Condition Checked at
: Nodeand all remaining branches beneath are pruned immediately because MIN at can force an outcome , which Root MAX will never choose over 3. - Final Decision: Root
chooses left branch with value 3.
4. Time Complexity Reduction
- Standard Minimax:
- Optimal Alpha-Beta Pruning:
- Impact: Effectively doubles the searchable search depth in the same computational time limit.
- MAX: Aims to choose moves maximizing the utility value:
- [10]
Discuss Knowledge Representation and Automated Reasoning. Explain Propositional Logic and First-Order Predicate Logic (FOPL). Demonstrate conversion into Conjunctive Normal Form (CNF) and theorem proving via Resolution Refutation.
View model answerHide model answer
Knowledge Representation, First-Order Logic, and Resolution Refutation
1. Propositional Logic (PL) vs. First-Order Predicate Logic (FOPL)
Dimension Propositional Logic (PL) First-Order Predicate Logic (FOPL) Ontological Commitments World consists of discrete atomic propositions that are True or False. World consists of Objects, Properties (Predicates), and Relations. Expressive Power Weak; cannot express generalizations across classes of items. High; utilizes universal ( ) and existential ( ) quantifiers. Inference Decidability Decidable (truth tables, NP-complete). Semi-decidable (resolution refutation terminates if sentence is entailed). 2. Conversion to Conjunctive Normal Form (CNF)
A formula is in CNF if it is a conjunction (
) of clauses, where each clause is a disjunction ( ) of literals: - Eliminate Implications: Replace
with . - Move Negations Inward (De Morgan’s Laws):
- Standardize Variables: Rename variables so each quantifier binds a unique variable name.
- Skolemization: Replace existentially quantified variables with Skolem constants or functions.
- Drop Universal Quantifiers: Assume all remaining variables are universally quantified.
- Distribute
over : Transform into .
3. Theorem Proving by Resolution Refutation
Problem Statement:
- Premise 1: "All software engineers write code."
- Premise 2: "Bibek is a software engineer."
- Query: Prove "Bibek writes code."
Step 1: Convert Knowledge Base to CNF Clauses
(Clause 1) (Clause 2)
Step 2: Negate Query and Add to Clause Set
- Negated Goal:
(Clause 3)
Step 3: Resolution Graph (Deriving the Empty Clause
) Clause 1: ~Engineer(x) v WritesCode(x) Clause 2: Engineer(Bibek) \ / \ Unification {x/Bibek} / v v Clause 4: WritesCode(Bibek) Clause 3: ~WritesCode(Bibek) \ / \ / v v Clause 5: [] (Empty Clause / Contradiction!)- Derivation of the empty clause
confirms that the negated goal is unsatisfiable. Hence, the original query is mathematically proven.
- Eliminate Implications: Replace
- [10]
Deep dive into Artificial Neural Networks (ANN). Contrast biological neurons with artificial perceptrons. Formulate the mathematical model of a Multi-Layer Perceptron (MLP) and derive the Backpropagation Algorithm using the chain rule of calculus. Provide a working Python implementation from scratch.
View model answerHide model answer
Artificial Neural Networks: Architecture, Mathematical Backpropagation, and Code
1. Biological Neuron vs. Artificial Perceptron
- Dendrites
Input vector : Receive chemical signals from neighboring neurons. - Synaptic Strengths
Weights : Scale the influence of incoming inputs. - Cell Body (Soma)
Weighted Sum : Aggregates net incoming stimulation . - Axon
Output : Propagates activation pulse if cumulative signal exceeds threshold via non-linear activation function .
2. Mathematical Model and Backpropagation Derivation
Consider a 2-layer network with Mean Squared Error loss:
- Forward Propagation:
- Hidden layer:
, - Output layer:
,
- Hidden layer:
- Backpropagation Derivation (Chain Rule):
- For output layer weight
: - For hidden layer weight
:
- For output layer weight
- Weight Updates (Gradient Descent):
3. Python Implementation of 2-Layer Neural Network From Scratch
import numpy as np class TwoLayerNeuralNetwork: def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, lr: float = 0.5): np.random.seed(42) self.lr = lr # Weight initialization self.W1 = np.random.randn(input_dim, hidden_dim) * 0.1 self.b1 = np.zeros((1, hidden_dim)) self.W2 = np.random.randn(hidden_dim, output_dim) * 0.1 self.b2 = np.zeros((1, output_dim)) @staticmethod def sigmoid(z: np.ndarray) -> np.ndarray: return 1.0 / (1.0 + np.exp(-np.clip(z, -250, 250))) @classmethod def sigmoid_derivative(cls, a: np.ndarray) -> np.ndarray: return a * (1.0 - a) def forward(self, X: np.ndarray) -> np.ndarray: self.z1 = np.dot(X, self.W1) + self.b1 self.a1 = self.sigmoid(self.z1) self.z2 = np.dot(self.a1, self.W2) + self.b2 self.a2 = self.sigmoid(self.z2) return self.a2 def backward(self, X: np.ndarray, y: np.ndarray) -> float: m = X.shape[0] loss = 0.5 * np.mean((y - self.a2) ** 2) # Output layer gradients delta2 = (self.a2 - y) * self.sigmoid_derivative(self.a2) dW2 = np.dot(self.a1.T, delta2) / m db2 = np.sum(delta2, axis=0, keepdims=True) / m # Hidden layer gradients delta1 = np.dot(delta2, self.W2.T) * self.sigmoid_derivative(self.a1) dW1 = np.dot(X.T, delta1) / m db1 = np.sum(delta1, axis=0, keepdims=True) / m # Parameter update self.W2 -= self.lr * dW2 self.b2 -= self.lr * db2 self.W1 -= self.lr * dW1 self.b1 -= self.lr * db1 return float(loss) # Training on non-linear XOR Problem if __name__ == "__main__": X_train = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) y_train = np.array([[0], [1], [1], [0]]) nn = TwoLayerNeuralNetwork(input_dim=2, hidden_dim=4, output_dim=1, lr=1.0) for epoch in range(1500): preds = nn.forward(X_train) loss = nn.backward(X_train, y_train) print("Trained XOR Predictions:") print(np.round(nn.forward(X_train), 3)) - Dendrites
Group C
Comprehensive Answer / Case Analysis Question. Attempt ALL questions.
[1 × 20 = 20]- [20]
System Design Case: Intelligent Agricultural Pest Detection & Advisory System for Nepal FarmTech
Nepal FarmTech is deploying an autonomous mobile AI advisory platform assisting 200,000 smallholder rice, maize, and tea farmers across Jhapa, Chitwan, and Kaski districts:
- Operational Reality: Farmers photograph damaged crop leaves using low-cost Android smartphones under harsh solar glare, shadow, and variable angles. The field environment suffers from spotty 2G/3G connectivity. The system must diagnose foliar diseases (e.g., Rice Blast Magnaporthe oryzae, Brown Spot Bipolaris oryzae, Late Blight in potato) within 2 seconds.
- Uncertainty and Agronomic Knowledge: Visual symptoms alone can be ambiguous (early-stage nitrogen deficiency mimics early bacterial blight). Diagnosis must synthesize visual image confidence with contextual environmental features: recent local rainfall, humidity, soil pH, and geographical altitude.
- Advisory Engine: Once a diagnosis is finalized, the system must generate legally compliant, eco-friendly chemical and biological pest management guidelines in Nepali language.
Questions: a) Design the Intelligent Agent Architecture using the PEAS framework (Performance measure, Environment, Actuators, Sensors). Classify the operational environment across standard dimensions (observability, determinism, dynamic nature, continuity, agent cardinality). (6 Marks) b) Design the Computer Vision and Deep Learning Pipeline: Explain data augmentation strategies tailored to rural field photography, the Convolutional Neural Network (CNN) feature extraction architecture (Convolution, ReLU, MaxPooling, Dropout, Softmax), and strategies to prevent model bias across crop varieties. (7 Marks) c) Construct the Expert Diagnostic & Uncertainty Inference Engine: Formulate a Bayesian Network or fuzzy production rule engine in Python that fuses visual image prediction probabilities with agronomic weather signals to output the finalized disease diagnosis and treatment prescription. (7 Marks)
View model answerHide model answer
Comprehensive System Design: Nepal FarmTech AI Agricultural Platform
a) PEAS Framework and Environment Classification
1. PEAS Specification for Crop Diagnostic Agent
PEAS Dimension Technical Specification Performance Measure Disease classification accuracy ( ), false negative rate on contagious fungal blights ( ), inference latency ( s), farmer pesticide cost reduction. Environment Rural agricultural crop fields, fluctuating sunlight/shadows, pest populations, microclimates, mobile device camera optics. Actuators Mobile UI screen displaying disease diagnosis, audio-synthesized Nepali advisory recommendations, SMS alert push notifications, automated retailer chemical order links. Sensors Smartphone camera sensor (RGB image), GPS telematics (altitude/district), capacitive touchscreen, local weather API feed (relative humidity, precipitation). 2. Environmental Property Classification
- Partially Observable: Camera image captures only external leaf surfaces; underground root rot and latent microscopic fungal spores cannot be directly observed.
- Stochastic: Disease incubation depends on unpredictable weather, temperature fluctuations, and wind dispersion of spores.
- Sequential: Current treatment actions directly impact whether blight spreads or halts in subsequent growth cycles.
- Dynamic: Crop foliage status and microclimate continuously evolve while the diagnostic model is computing.
- Continuous: Pixel intensities, temperature, and ambient humidity are continuous real-valued variables.
- Multi-Agent: The agent operates in an ecosystem alongside farmers, pests, beneficial predator insects, and regional agricultural extension officers.
b) Computer Vision & Deep Learning Pipeline
1. Rural Data Augmentation Pipeline
To generalize across low-cost mobile lenses and variable outdoor sunlight in Nepal:
- Photometric Distortions: Random brightness variation (
), contrast jittering, and solar glare simulation. - Geometric Transformations: Random rotations (
), horizontal/vertical flips, and random affine shears mimicking hand tilt. - Weather & Occlusion Simulators: Random Erasing (Cutout) to simulate finger shadows, mud droplets, or water spray on leaves.
2. Convolutional Neural Network (CNN) Architecture
Input Leaf Image (224x224x3) | v [Conv2D Layer: 32 filters (3x3), Stride 1, Padding 'same'] -> Feature maps detecting edges | v [Batch Normalization + ReLU Activation] -> Introduces non-linearity & stabilizes gradient | v [MaxPooling2D: (2x2 pool size, Stride 2)] -> Spatial downsampling (112x112x32) | v [Conv2D Block 2: 64 filters (3x3)] -> Complex texture/spot detection | v [MaxPooling2D: (2x2)] -> Downsampling (56x56x64) | v [Global Average Pooling] -> Flattens spatial dimensions into feature vector (64) | v [Dense Fully Connected Layer: 128 units + Dropout (0.4)] -> Prevents co-adaptation / overfitting | v [Output Layer: Dense with Softmax Activation (C classes)] -> Probability distribution over diseases
c) Expert Diagnostic & Uncertainty Inference Engine (Python Implementation)
Below is the complete, self-contained Python module fusing Computer Vision probabilistic outputs with Bayesian agronomic priors and expert rule-based pesticide prescriptions:
from typing import Dict, Tuple class AgronomicBayesianEngine: # Prior probabilities of diseases across Nepal Terai region DISEASE_PRIORS = { "RICE_BLAST": 0.30, "BROWN_SPOT": 0.25, "BACTERIAL_BLIGHT": 0.20, "HEALTHY_LEAF": 0.25 } # Conditional likelihood multipliers given high humidity (> 85%) and rainfall WEATHER_FACTORS_HIGH_HUMIDITY = { "RICE_BLAST": 2.5, # Highly favorable to blast fungus "BROWN_SPOT": 1.4, "BACTERIAL_BLIGHT": 1.8, "HEALTHY_LEAF": 0.4 } ADVISORY_RULES = { "RICE_BLAST": { "disease_name_np": "धानको मरुवा रोग (Rice Blast)", "severity": "CRITICAL", "organic_cure": "Neem seed kernel extract (5%) spray every 10 days.", "chemical_cure": "Tricyclazole 75% WP @ 0.6 g/liter water." }, "BROWN_SPOT": { "disease_name_np": "खैरो थोप्ले रोग (Brown Spot)", "severity": "MODERATE", "organic_cure": "Apply balanced potassium fertilizer and vermicompost.", "chemical_cure": "Mancozeb 75% WP @ 2 g/liter water." }, "BACTERIAL_BLIGHT": { "disease_name_np": "ब्याक्टेरियल पात डढुवा (Bacterial Blight)", "severity": "HIGH", "organic_cure": "Drain standing water from field for 3-4 days.", "chemical_cure": "Copper Oxychloride 50% WP @ 2.5 g/liter water." }, "HEALTHY_LEAF": { "disease_name_np": "स्वस्थ बाली (Healthy Crop)", "severity": "NONE", "organic_cure": "Continue standard nitrogen-phosphorus-potassium balance.", "chemical_cure": "No chemical application necessary." } } @classmethod def fuse_evidence( cls, cnn_probabilities: Dict[str, float], humidity_pct: float, recent_rain: bool ) -> Tuple[str, float, dict]: # Compute posterior probability via Bayes Rule fusion: P(Disease | Vision, Weather) posteriors = {} for disease, cnn_prob in cnn_probabilities.items(): prior = cls.DISEASE_PRIORS.get(disease, 0.1) weather_mult = 1.0 if humidity_pct > 80.0 or recent_rain: weather_mult = cls.WEATHER_FACTORS_HIGH_HUMIDITY.get(disease, 1.0) unnormalized_posterior = cnn_prob * prior * weather_mult posteriors[disease] = unnormalized_posterior # Normalize probabilities total_sum = sum(posteriors.values()) for d in posteriors: posteriors[d] = round(posteriors[d] / total_sum, 4) # Select diagnosis with maximum posterior probability (MAP estimate) final_diagnosis = max(posteriors, key=posteriors.get) confidence = posteriors[final_diagnosis] advisory = cls.ADVISORY_RULES[final_diagnosis] return final_diagnosis, confidence, advisory # Demonstration Execution if __name__ == "__main__": # Simulated CNN model output on leaf photo: # Model is slightly ambiguous between Rice Blast (42%) and Brown Spot (38%) raw_cnn_probs = { "RICE_BLAST": 0.42, "BROWN_SPOT": 0.38, "BACTERIAL_BLIGHT": 0.15, "HEALTHY_LEAF": 0.05 } # Field sensor readings: High humidity monsoon conditions in Chitwan current_humidity = 88.0 rain_last_24h = True diagnosis, confidence, advisory = AgronomicBayesianEngine.fuse_evidence( raw_cnn_probs, current_humidity, rain_last_24h ) print("=== Nepal FarmTech Diagnostic Advisory ===") print(f"Finalized Disease Diagnosis: {diagnosis} (Confidence: {confidence*100:.1f}%)") print(f"Nepali Name: {advisory['disease_name_np']}") print(f"Severity: {advisory['severity']}") print(f"Organic Remedy: {advisory['organic_cure']}") print(f"Chemical Prescription: {advisory['chemical_cure']}")