public void TryDropAndReturnPossibility_Succeeds() { var puzzle = new Puzzle(4); var matrix = ExactCoverGraph.Create(puzzle); var possibilities = new FakePossibility[] { new FakePossibility(), new FakePossibility(), new FakePossibility(), }; var toDrop = possibilities[0]; var concreteObjective = Objective.CreateFullyConnected(matrix, possibilities, 2); IObjective objective = concreteObjective; Assert.True(objective.TryDropPossibility(toDrop.AttachedObjectives.First())); Assert.Equal(2, concreteObjective.CountUnknown); Assert.Equal(2, objective.GetUnknownDirectPossibilities().Count()); Assert.Contains(possibilities[1], objective.GetUnknownDirectPossibilities()); Assert.Contains(possibilities[2], objective.GetUnknownDirectPossibilities()); Assert.Empty(toDrop.DroppedFromObjectives); objective.ReturnPossibility(toDrop.AttachedObjectives.First()); Assert.Equal(3, concreteObjective.CountUnknown); Assert.Equal(3, objective.GetUnknownDirectPossibilities().Count()); Assert.Contains(toDrop, objective.GetUnknownDirectPossibilities()); Assert.Contains(possibilities[1], objective.GetUnknownDirectPossibilities()); Assert.Contains(possibilities[2], objective.GetUnknownDirectPossibilities()); }
static void Main(string[] args) { // Create the array of objectives var objectives = new IObjective[] { new ObjectiveOneOne(), new ObjectiveOneTwo(), new ObjectiveOneThree(), new ObjectiveOneFour(), new ObjectiveOneFive(), }; // Execute every objective and require keypress to continue int i = 0; foreach (var objective in objectives) { i++; objective.ObjectiveMain(); // Require keypress to continue if not final objective if (i < objectives.Length) { Console.WriteLine("Press any key to continue to next objective..."); Console.ReadKey(); } } }
public void TrySelectAndDeselectPossibility_WithMultipleRequired_Works() { var puzzle = new Puzzle(4); var matrix = ExactCoverGraph.Create(puzzle); var possibilities = new FakePossibility[] { new FakePossibility(), new FakePossibility(), }; var firstSelected = possibilities[0]; var secondSelected = possibilities[1]; var concreteObjective = Objective.CreateFullyConnected(matrix, possibilities, 2); IObjective objective = concreteObjective; Assert.True(objective.TrySelectPossibility(firstSelected.AttachedObjectives.First())); Assert.NotEqual(NodeState.SELECTED, concreteObjective.State); Assert.Equal(1, concreteObjective.CountUnknown); Assert.Single(objective.GetUnknownDirectPossibilities(), secondSelected); Assert.Contains(concreteObjective, matrix.GetUnsatisfiedRequiredObjectivesWithConcretePossibilities()); Assert.True(objective.TrySelectPossibility(secondSelected.AttachedObjectives.First())); Assert.Equal(NodeState.SELECTED, concreteObjective.State); Assert.Equal(0, concreteObjective.CountUnknown); Assert.True(!matrix.GetUnsatisfiedRequiredObjectivesWithConcretePossibilities().Contains(concreteObjective) || matrix.GetUnsatisfiedRequiredObjectivesWithConcretePossibilities().Count() == 1); objective.DeselectPossibility(secondSelected.AttachedObjectives.First()); Assert.NotEqual(NodeState.SELECTED, concreteObjective.State); Assert.Equal(1, concreteObjective.CountUnknown); Assert.Single(objective.GetUnknownDirectPossibilities(), secondSelected); Assert.Contains(concreteObjective, matrix.GetUnsatisfiedRequiredObjectivesWithConcretePossibilities()); objective.DeselectPossibility(firstSelected.AttachedObjectives.First()); Assert.Equal(2, concreteObjective.CountUnknown); }
internal static void PopulateByColumn(IMPModeler model, INumVar[][] var, IRange[][] rng) { IObjective obj = model.AddMaximize(); rng[0] = new IRange[2]; rng[0][0] = model.AddRange(-System.Double.MaxValue, 20.0, "c1"); rng[0][1] = model.AddRange(-System.Double.MaxValue, 30.0, "c2"); IRange r0 = rng[0][0]; IRange r1 = rng[0][1]; var[0] = new INumVar[3]; var[0][0] = model.NumVar(model.Column(obj, 1.0).And( model.Column(r0, -1.0).And( model.Column(r1, 1.0))), 0.0, 40.0, "x1"); var[0][1] = model.NumVar(model.Column(obj, 2.0).And( model.Column(r0, 1.0).And( model.Column(r1, -3.0))), 0.0, System.Double.MaxValue, "x2"); var[0][2] = model.NumVar(model.Column(obj, 3.0).And( model.Column(r0, 1.0).And( model.Column(r1, 1.0))), 0.0, System.Double.MaxValue, "x3"); }
private void RaiseObjectiveChanged(IObjective previousObjective, IObjective currentObjective) { if (this.ObjectiveChanged != null) { this.ObjectiveChanged(this, previousObjective, currentObjective); } }
public FindTreasureQuest() { Name = "Find a treasure"; Description = "Find the treasure by the big willow tree."; Experience = 200; Objectives = new IObjective[] { new FindTreasureChestObjective() }; }
internal static void BuildModelByColumn(IMPModeler model, Data data, INumVar[] Buy, NumVarType type) { int nFoods = data.nFoods; int nNutrs = data.nNutrs; IObjective cost = model.AddMinimize(); IRange[] constraint = new IRange[nNutrs]; for (int i = 0; i < nNutrs; i++) { constraint[i] = model.AddRange(data.nutrMin[i], data.nutrMax[i]); } for (int j = 0; j < nFoods; j++) { Column col = model.Column(cost, data.foodCost[j]); for (int i = 0; i < nNutrs; i++) { col = col.And(model.Column(constraint[i], data.nutrPerFood[i][j])); } Buy[j] = model.NumVar(col, data.foodMin[j], data.foodMax[j], type); } }
public void Create_ConfiguresSquareObjectives() { var puzzle = new Puzzle(4); var graph = ExactCoverGraph.Create(puzzle); var objectives = graph.GetUnsatisfiedRequiredObjectives(); Assert.Equal(puzzle.Size * puzzle.Size, objectives.Count()); var seenCoordinates = new HashSet <Coordinate>(); var possibilityIndices = new HashSet <int>() { 0, 1, 2, 3 }; Assert.All(objectives, concreteObjective => { IObjective objective = concreteObjective; var possibilities = objective.GetUnknownDirectPossibilities().Cast <Possibility>().ToArray(); // Assert that each square links every possibility at that coordinate. Assert.Equal(puzzle.Size, possibilities.Length); Assert.Equal(possibilityIndices, new HashSet <int>(possibilities.Select(p => p.Index))); var firstCoord = possibilities.First().Coordinate; Assert.All(possibilities, p => { Assert.Equal(firstCoord, p.Coordinate); Assert.Equal(NodeState.UNKNOWN, p.State); }); // Assert an objective is made for each square. Assert.DoesNotContain(firstCoord, seenCoordinates); seenCoordinates.Add(firstCoord); }); }
private bool TryPeekDestination(out IObjective destination) { if (this.destinations.Count == 0) { destination = null; return(false); } destination = this.destinations.Peek(); // Dequeue objectives until we have a valid one. while (!destination.Validate()) { this.destinations.Dequeue(); if (this.destinations.Count > 0) { destination = this.destinations.Peek(); } else { destination = null; return(false); } } return(true); }
public OldBattle(IOldMap map, IObjective objective, ITurn turnState, IActionProber actionProber) { _map = map; _objective = objective; _turnState = turnState; _actionProber = actionProber; }
private void initializeMinMaxObjective(VariabilityModel vm, Cplex plex, bool minimize, List <BinaryOption> wanted, List <BinaryOption> unwanted) { INumVar[] variables = new INumVar[vm.BinaryOptions.Count]; double[] weights = new double[vm.BinaryOptions.Count]; for (int i = 0; i < vm.BinaryOptions.Count; i++) { BinaryOption curr = vm.BinaryOptions.ElementAt(i); variables[i] = binOptsToCplexVars[curr]; if (wanted != null && wanted.Contains(curr)) { weights[i] = -100.0; } else if (unwanted != null && unwanted.Contains(curr)) { weights[i] = 1000.0; } else { weights[i] = minimize ? 100.0 : -100.0; } } ILinearNumExpr weightedVariables = plex.ScalProd(variables, weights); IObjective objective = plex.Minimize(weightedVariables); plex.Add(objective); }
public static Cplex BuildLPModel(IFTMDP Ida) { Cplex model = new Cplex(); INumVar[][] v = new INumVar[Ida.TimeHorizon][]; //V(t,x) for (int t = 0; t < Ida.TimeHorizon; t++) { v[t] = model.NumVarArray(Ida.SS.Count, -double.MaxValue, double.MaxValue); } IObjective RevenueUB = model.AddMinimize(model.Prod(1, v[0][Ida.SS.IndexOf(Ida.InitialState)])); //time->State->Active-> Expression for (int t = 0; t < Ida.TimeHorizon; t++) { foreach (IMDPState s in Ida.SS) { foreach (IMDPDecision a in Ida.GenDecisionSpace(s)) { INumExpr expr = v[t][Ida.SS.IndexOf(s)]; if (t < Ida.TimeHorizon - 1) { foreach (IMDPState k in Ida.GenStateSpace(s, a)) { expr = model.Sum(expr, model.Prod(-Ida.Prob(t, s, k, a), v[t + 1][Ida.SS.IndexOf(k)])); } } model.AddGe(expr, Ida.Reward(t, s, a)); } } } //model.SetOut(null); return(model); }
public void TrySelectPossibility_WhenRejectedByParent_LeavesUnchanged() { var fakePossibilities = new FakePossibility[] { new FakePossibility(), new FakePossibility(), }; var childOptional = OptionalObjective.CreateWithPossibilities( Possibilities.CreatePossibilities(new(), 2), 1); var optional = OptionalObjective.CreateWithPossibilities(fakePossibilities, 1); var linkToChildOptional = Link.CreateConnectedLink(childOptional, optional); var parent = new FakeObjective(isRequired: true); parent.CanSelectPossibilities = false; var linkToParent = Link.CreateConnectedLink(optional, parent); IPossibility possibility = optional; IObjective objective = optional; Assert.False(objective.TrySelectPossibility(fakePossibilities[0].AttachedObjectives.First())); Assert.Equal(NodeState.UNKNOWN, optional.State); Assert.Equal(NodeState.UNKNOWN, childOptional.State); Assert.All(((IObjective)childOptional).GetUnknownDirectPossibilities().Cast <Possibility>(), p => Assert.Equal(NodeState.UNKNOWN, p.State)); Assert.Empty(fakePossibilities[0].DroppedFromObjectives); Assert.Empty(fakePossibilities[1].DroppedFromObjectives); Assert.Empty(parent.SelectedPossibilities); }
// Modifying all quadratic terms x[i]*x[j] // in the objective function. internal static void ModifyQuadObjective(CplexModeler model) { IEnumerator matrixEnum = model.GetLPMatrixEnumerator(); matrixEnum.MoveNext(); ILPMatrix lp = (ILPMatrix)matrixEnum.Current; INumVar[] x = lp.NumVars; int ncols = x.Length; IObjective obj = model.GetObjective(); // Note that the quadratic expression in the objective // is normalized: i.e., for all i != j, terms // c(i,j)*x[i]*x[j] + c(j,i)*x[j]*x[i] are normalized as // (c(i,j) + c(j,i)) * x[i]*x[j], or // (c(i,j) + c(j,i)) * x[j]*x[i]. // Therefore you can only modify one of the terms // x[i]*x[j] or x[j]*x[i]. // If you modify both x[i]*x[j] and x[j]*x[i], then // the second modification will overwrite the first one. for (int i = 0; i < ncols; ++i) { model.SetQuadCoef(obj, x[i], x[i], i * i); for (int j = 0; j < i; ++j) { model.SetQuadCoef(obj, x[i], x[j], -2.0 * (i * j)); } } // Print out the objective function PrintObjective(obj); }
public double SolveBasic(int branchLimit) { // Objective Console.WriteLine(); Console.WriteLine(" ! ----------------------------------------------------------------------------"); Console.WriteLine(" ! Minimizing total cost"); Console.WriteLine(" ! ----------------------------------------------------------------------------"); IIntExpr costExpr = cp.IntExpr(); int nbMachines = machines.Length; int nbJobs = machines[0].Length; for (int i = 0; i < nbJobs; i++) { for (int j = 0; j < nbMachines; j++) { costExpr = cp.Sum(costExpr, cp.Prod(costs[j][i], cp.PresenceOf(machines[j][i]))); } } IObjective obj = cp.Minimize(costExpr); cp.Add(obj); cp.SetParameter(CP.IntParam.LogPeriod, 600000); cp.SetParameter(CP.IntParam.BranchLimit, branchLimit); cp.SetParameter(CP.IntParam.NoOverlapInferenceLevel, CP.ParameterValues.Extended); cp.Solve(); double cost = cp.ObjValue; return(cost); }
protected void InitRMPModel() { cost = RMPModel.AddMaximize(); var = new Dictionary <IALPDecision, INumVar> [Data.TimeHorizon]; DualValue1 = new double[Data.TimeHorizon][]; DualValue2 = new double[Data.TimeHorizon]; lowerbound = new double[Data.TimeHorizon][]; upperbound = new double[Data.TimeHorizon][]; #region //////////////生成约束////////////// constraint1 = new IRange[Data.TimeHorizon][]; constraint2 = new IRange[Data.TimeHorizon]; for (int i = 0; i < Data.TimeHorizon; i++) { DualValue1[i] = new double[Data.RS.Count]; var[i] = new Dictionary <IALPDecision, INumVar>(); constraint1[i] = new IRange[Data.RS.Count]; lowerbound[i] = new double[Data.RS.Count]; upperbound[i] = new double[Data.RS.Count]; foreach (IALPResource re in Data.RS) { constraint1[i][Data.RS.IndexOf(re)] = RMPModel.AddRange(double.MinValue, (Data.InitialState as IALPState)[re]); } //constraint1[i][0].UB -= 0.3; constraint2[i] = RMPModel.AddRange(1, 1); } #endregion RMPModel.SetOut(this.SolverTextWriter); }
public void TryDropPossibility_WhenRejectedByParent_LeavesUnchanged() { var fakePossibilities = new FakePossibility[] { new FakePossibility(), new FakePossibility(), }; var childOptional = OptionalObjective.CreateWithPossibilities( Possibilities.CreatePossibilities(new(), 2), 1); var possibilities = fakePossibilities.Cast <IPossibility>().Append(childOptional).ToArray(); var optional = OptionalObjective.CreateWithPossibilities(possibilities, 3); var parent = new FakeObjective(isRequired: true); parent.CanDropPossibilities = false; IPossibility possibility = optional; IObjective objective = optional; Link.CreateConnectedLink(possibility, parent); var childToDrop = fakePossibilities[0]; Assert.False(objective.TryDropPossibility(childToDrop.AttachedObjectives.First())); Assert.Equal(NodeState.UNKNOWN, optional.State); Assert.Empty(parent.DroppedPossibilities); Assert.Empty(fakePossibilities[0].DroppedFromObjectives); Assert.Empty(fakePossibilities[1].DroppedFromObjectives); Assert.Equal(NodeState.UNKNOWN, childOptional.State); }
public void TryDropAndReturnPossibility_WhenOkWithParent_Succeeds() { var fakePossibilities = new FakePossibility[] { new FakePossibility(), new FakePossibility(), }; var optional = OptionalObjective.CreateWithPossibilities(fakePossibilities, 1); var parent = new FakeObjective(isRequired: true); IPossibility possibility = optional; IObjective objective = optional; var linkToParent = Link.CreateConnectedLink(possibility, parent); var childToDrop = fakePossibilities[0]; Assert.True(objective.TryDropPossibility(childToDrop.AttachedObjectives.First())); Assert.Equal(NodeState.UNKNOWN, optional.State); Assert.Empty(fakePossibilities[1].DroppedFromObjectives); Assert.Empty(parent.DroppedPossibilities); Assert.True(objective.TryDropPossibility(fakePossibilities[1].AttachedObjectives.First())); Assert.Equal(NodeState.DROPPED, optional.State); Assert.Empty(fakePossibilities[1].DroppedFromObjectives); Assert.Single(parent.DroppedPossibilities, linkToParent); objective.ReturnPossibility(fakePossibilities[1].AttachedObjectives.First()); Assert.Equal(NodeState.UNKNOWN, optional.State); Assert.Empty(fakePossibilities[1].DroppedFromObjectives); Assert.Empty(parent.DroppedPossibilities); objective.ReturnPossibility(childToDrop.AttachedObjectives.First()); Assert.Equal(NodeState.UNKNOWN, optional.State); Assert.Empty(fakePossibilities[1].DroppedFromObjectives); Assert.Empty(parent.DroppedPossibilities); }
private void OnObjectiveChanged(IMoveDriver driver, IObjective previous, IObjective current) { if (current == null) { this.AddNextStrongest(); } }
void FixedUpdate() { if (this.paused) { return; } IObjective destination; if (this.TryPeekDestination(out destination)) { if (this.CurrentState != MoverStateKind.Moving) { // Raise an event when we start moving for the first time. this.RaiseObjectiveChanged(this.previousObjective, destination); this.CurrentState = MoverStateKind.Moving; } var delta = destination.TargetPosition - this.cachedTx.position; if (!this.ignoreArrival && delta.sqrMagnitude <= this.arrivalDistanceSqr) { this.destinations.Dequeue(); if (this.destinations.Count == 0) { this.CurrentState = MoverStateKind.Arrived; } this.RaiseObjectiveChanged(destination, this.destinations.Count > 0 ? this.destinations.Peek() : null); this.previousObjective = destination; } else { if (delta != Vector3.zero) { var rot = Quaternion.LookRotation(delta); var t = 1f / 360f * this.rotateSpeed * Time.deltaTime; this.cachedTx.rotation = Quaternion.Slerp(this.cachedTx.rotation, rot, t); } this.cachedTx.Translate(Vector3.forward * this.Speed * Time.deltaTime); if (this.snapDown) { var rayconf = RaycastConfig.Ray(layerMask: this.snapLayer); this.cachedTx.SnapDown(rayconf, this.raiseSnapRaycast, this.raiseSnapPosition); } } } else { if (this.CurrentState == MoverStateKind.Moving) { this.Cancel(); } } }
public static void Main(string[] args) { // Check length of command line if (args.Length != 2) { Usage(); System.Environment.Exit(-1); } // Pick up VMC from command line. string vmconfig = args[0]; // Solve the model. Cplex cplex = null; try { // Create CPLEX solver and load model. cplex = new Cplex(); cplex.ImportModel(args[1]); // Load the virtual machine configuration. // This will force Solve() to use distributed parallel MIP. cplex.ReadVMConfig(vmconfig); // Install logging info callback. IEnumerator e = cplex.GetLPMatrixEnumerator(); e.MoveNext(); ILPMatrix lp = (ILPMatrix)e.Current; IObjective obj = cplex.GetObjective(); double lastObjVal = (obj.Sense == ObjectiveSense.Minimize) ? System.Double.MaxValue : -System.Double.MaxValue; cplex.Use(new LogCallback(lp.NumVars, -100000, lastObjVal, cplex.GetCplexTime(), cplex.GetDetTime())); // Turn off CPLEX logging cplex.SetParam(Cplex.Param.MIP.Display, 0); // Solve the model and print some solution information. if (cplex.Solve()) { System.Console.WriteLine("Solution value = " + cplex.ObjValue); } else { System.Console.WriteLine("No solution available"); } System.Console.WriteLine("Solution status = " + cplex.GetStatus()); } catch (ILOG.Concert.Exception e) { System.Console.WriteLine("Concert exception caught '" + e + "' caught"); } finally { if (cplex != null) { cplex.End(); } } }
public CleanseTheCellars() { Name = "Cleanse the cellars"; Description = "Get rid of the rats to reach the magic herbs."; Experience = 100; Objectives = new IObjective[] { new GetRidOfRatsObjective(), new Find10HerbsObjective() }; }
internal static Link CreateConnectedLink(IPossibility possibility, IObjective objective) { var link = new Link(possibility, objective); possibility.AppendObjective(link); objective.AppendPossibility(link); return(link); }
private void OnStageComplete(IObjective completionObjective) { // TODO add stage completion logic here. // Should probably call something in another script. SceneManager.LoadScene(0); // TODO maybe add another objective of waypoint where // you must exit. }
public void Clear() { this.destinations.Clear(); this.previousObjective = null; this.paused = false; this.CurrentState = MoverStateKind.None; this.Speed = this.startSpeed; }
/// <summary> /// Objective changed args /// </summary> /// <param name="objective">Objective that is being updated</param> public ObjectiveArgs(IObjective objective) { if (objective == null) { throw new ArgumentNullException(nameof(objective), $"an objective is required by {this}"); } Objective = objective; }
public void OnProgress(IObjective objective) { m_ProgressText.text = objective.GetProgress(); if (objective.IsCompleted) { m_CompleteIcon.gameObject.SetActive(true); } }
/// <inheritdoc /> public void Remove(IObjective objective) { if (objective == null) { throw new ArgumentNullException(nameof(objective), $"objective is required by {this}"); } Objectives.Remove(objective); ObjectiveRemoved?.Invoke(this, new ObjectiveArgs(objective)); }
public void OnProgress(IObjective _) { m_Won = true; foreach (IObjective objective in m_Objectives) { m_Won &= (objective.IsCompleted || objective.m_Lose); m_Lost |= (objective.IsCompleted && objective.m_Lose); } }
public static void Main(string[] args) { try { Cplex cplex = new Cplex(); INumVar[] inside = cplex.NumVarArray(_nbProds, 10.0, Double.MaxValue); INumVar[] outside = cplex.NumVarArray(_nbProds, 0.0, Double.MaxValue); INumVar costVar = cplex.NumVar(0.0, Double.MaxValue); cplex.AddEq(costVar, cplex.Sum(cplex.ScalProd(inside, _insideCost), cplex.ScalProd(outside, _outsideCost))); IObjective obj = cplex.AddMinimize(costVar); // Must meet demand for each product for (int p = 0; p < _nbProds; p++) { cplex.AddEq(cplex.Sum(inside[p], outside[p]), _demand[p]); } // Must respect capacity constraint for each resource for (int r = 0; r < _nbResources; r++) { cplex.AddLe(cplex.ScalProd(_consumption[r], inside), _capacity[r]); } cplex.Solve(); if (cplex.GetStatus() != Cplex.Status.Optimal) { System.Console.WriteLine("No optimal solution found"); return; } // New constraint: cost must be no more than 10% over minimum double cost = cplex.ObjValue; costVar.UB = 1.1 * cost; // New objective: minimize outside production obj.Expr = cplex.Sum(outside); cplex.Solve(); System.Console.WriteLine("Solution status = " + cplex.GetStatus()); DisplayResults(cplex, costVar, inside, outside); System.Console.WriteLine("----------------------------------------"); cplex.End(); } catch (ILOG.Concert.Exception exc) { System.Console.WriteLine("Concert exception '" + exc + "' caught"); } }
public Column(IObjective obj, double objCoef) { this.objCoef = objCoef; this.objCoefSet = true; this.column = new GRBColumn(); }
// Print out the objective function. // Note that the quadratic expression in the objective // is normalized: i.E., for all i != j, terms // c(i,j)*x[i]*x[j] + c(j,i)*x[j]*x[i] is normalized as // (c(i,j) + c(j,i)) * x[i]*x[j], or // (c(i,j) + c(j,i)) * x[j]*x[i]. internal static void PrintObjective(IObjective obj) { System.Console.WriteLine("obj: " + obj); // Count the number of linear terms // in the objective function. int nlinterms = 0; ILinearNumExprEnumerator len = ((ILQNumExpr)obj.Expr).GetLinearEnumerator(); while ( len.MoveNext() ) ++nlinterms; // Count the number of quadratic terms // in the objective function. int nquadterms = 0; int nquaddiag = 0; IQuadNumExprEnumerator qen = ((ILQNumExpr)obj.Expr).GetQuadEnumerator(); while ( qen.MoveNext() ) { ++nquadterms; INumVar var1 = qen.GetNumVar1(); INumVar var2 = qen.GetNumVar2(); if ( var1.Equals(var2) ) ++nquaddiag; } System.Console.WriteLine("number of linear terms in the objective : " + nlinterms); System.Console.WriteLine("number of quadratic terms in the objective : " + nquadterms); System.Console.WriteLine("number of diagonal quadratic terms in the objective : " + nquaddiag); System.Console.WriteLine(); }
void Start() { m_Objective = transform.GetComponent<IObjective>(); }
public void AddObjective( IObjective obj ) { objectives.Add( obj ); }
/// <summary> /// Checks the objective on list. /// </summary> /// <param name='objective'> /// Objective. /// </param> public void checkObjectiveOnList(IObjective objective){ foreach(IObjective obj in objectives){ if(obj.Equals(objective)){ OnObjectiveComplete(objective.Name); } } }
public IObjective AddMinimize(INumVar var) { IObjective result = new IObjective(this._model, new INumExpr(var), GRB.MINIMIZE); _model.SetObjective(result.expr, result.sense); return result; }
public IObjective AddMaximize() { IObjective result = new IObjective(this._model, GRB.MAXIMIZE); _model.SetObjective(result.expr, result.sense); return result; }
public void Add(IObjective expr) { _model.SetObjective(expr.expr, expr.sense); }
public Column Column(IObjective obj, double objCoef) { return new Column(obj, objCoef); }
public void SetLinearCoef(IObjective obj, double val, INumVar var) { var.var.Set(GRB.DoubleAttr.Obj, val); }