public int Golomb( int n ) { Golomb golomb = new Golomb( n ); Solver solver = golomb.Solver; solver.IntObjective.Var = golomb.MarkList[ golomb.MarkList.Count - 1 ]; solver.IntObjective.Step = 1; SolutionGoal solution = new SolutionGoal( solver, solver.IntObjective.Var ); solver.Solve( new GoalAnd( new IntGenerate( solver, golomb.MarkList.ToArray(), IntVarSelector.FirstNotBound, new IntSearchInstantiateBest() ), solution ) ); int count = CountSolution( solver ); return solution.Value; }
public static void Golomb( int n ) { Golomb golomb = new Golomb( n ); Solver solver = golomb.Solver; solver.IntObjective.Var = golomb.MarkList[ golomb.MarkList.Count - 1 ]; solver.IntObjective.Step = 1; Objective objective = new Objective(); objective.Value = int.MaxValue; objective.Register( solver.IntObjective ); solver.Solve( new GoalAnd( new IntGenerate( solver, golomb.MarkList.ToArray(), IntVarSelector.FirstNotBound, new IntSearchInstantiateBest() ), new SolutionGoal( solver, solver.IntObjective, objective, "0" ) ) ); SearchAll( solver ); Console.Out.WriteLine(); Console.Out.WriteLine( solver.Time.ToString() ); }