Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 220072

Summary: [solver] printout of "c The heuristics cannot find the objective function!!!!"
Product: [Eclipse Project] Equinox Reporter: Jed Anderson <jed.anderson>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pascal, tim-at-eclipse
Version: 3.4   
Target Milestone: 3.4 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch to fix the issue none

Description Jed Anderson CLA 2008-02-23 11:56:58 EST
While running some of our tests I get the following printed to System.err.

c The heuristics cannot find the objective function!!!!

I did a search and found this to be in the VarOrderHeapObjective.init() method.  Here's the stack trace of how it got there.

Thread [main] (Suspended (breakpoint at line 83 in VarOrderHeapObjective))	
	VarOrderHeapObjective.init() line: 83	
	PBSolverCP<L>(Solver<L,D>).isSatisfiable(IVecInt, boolean) line: 1046	
	PBSolverCP<L>(Solver<L,D>).isSatisfiable(IVecInt) line: 1039	
	PBSolverCP<L>(Solver<L,D>).isSatisfiable() line: 1020	
	PBProjector.invokeSolver(IProgressMonitor) line: 322	
	SimplePlanner.getProvisioningPlan(ProfileChangeRequest, ProvisioningContext, IProgressMonitor) line: 326	
   ...
   
Is this a result of a missing integration piece?  Or maybe the getProvisioningPlan method approaches in a slightly different manner?
Comment 1 Pascal Rapicault CLA 2008-02-24 22:02:50 EST
Could you please indicate which test case you are encountering that for?
Comment 2 Jed Anderson CLA 2008-02-25 02:47:09 EST
This occurred in one of my tests locally, unfortunately, I can't provide the details.
Comment 3 Pascal Rapicault CLA 2008-02-26 09:29:40 EST
Closing as I can't reproduce.
Comment 4 Timothy Webb CLA 2008-02-26 11:35:48 EST
Once scenario where this occurs for me is:

- Create a new empty profile
- Create a profile change request with the addition of a single group IU
- Get the IPlanner and ask for the Provisioning Plan
- Planner calls into PBProjector to invoke the solver

In looking through the SAT4J resolver, it appears that there are no call paths from the VarOrderHeapObjective.setObjectiveFunction(...) to any P2 code.  The way the objective function should be set is from the PB parser returning an objective function.  I've patched the PBProjector to update the problem/solver with the objective function from the reader and this appears to solve the underlying issue.  (This is modelled after how LanceurPseudo2005.solve() works)

Attached is a patch that addresses the issue with the test cases I am running.

The code path that triggers the System out is triggered from the planner invoking the solver:

Thread [main] (Suspended (breakpoint at line 85 in VarOrderHeapObjective))	
	VarOrderHeapObjective.init() line: 85	
	PBSolverCP<L>(Solver<L,D>).isSatisfiable(IVecInt, boolean) line: 1046	
	PBSolverCP<L>(Solver<L,D>).isSatisfiable(IVecInt) line: 1039	
	PBSolverCP<L>(Solver<L,D>).isSatisfiable() line: 1020	
	PBProjector.invokeSolver(IProgressMonitor) line: 329	
	SimplePlanner.getProvisioningPlan(ProfileChangeRequest, ProvisioningContext, IProgressMonitor) line: 326	

My guess from looking at this issue would be that since we are doing provisioning without a complete lineup, using the solver to resolve the full dependency graph, we are exercising different code paths than would otherwise be done.  The entry IU that we are using is an IU that references a few others including a configuration IU that sets up dependencies to include the various tooling / config IUs.

We don't see this function getting triggered in scenarios when using the generated 'sdk' lineup so I would assume the issue only arises in more complex resolution flows.  Despite the message being printed out, it appears that the solver is for the most part doing what is expected of it though I would imagine the solver would work better with the objective function correctly configured as is done in the attached patch.
Comment 5 Timothy Webb CLA 2008-02-26 11:36:44 EST
Created attachment 90757 [details]
Patch to fix the issue

Attached is a patch that correctly sets the objective function prior to attempting to solve the specified problem.
Comment 6 Pascal Rapicault CLA 2008-04-15 09:01:20 EDT
This has been fixed in M6 and taken out in M7 as SAT4J got fixed.