All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.ortools.graph.LinearSumAssignment Maven / Gradle / Ivy

The newest version!
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.10
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.google.ortools.graph;

public class LinearSumAssignment {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected LinearSumAssignment(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(LinearSumAssignment obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        operations_research_graphJNI.delete_LinearSumAssignment(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public LinearSumAssignment() {
    this(operations_research_graphJNI.new_LinearSumAssignment(), true);
  }

  public int addArcWithCost(int left_node, int right_node, long cost) {
    return operations_research_graphJNI.LinearSumAssignment_addArcWithCost(swigCPtr, this, left_node, right_node, cost);
  }

  public int getNumNodes() {
    return operations_research_graphJNI.LinearSumAssignment_getNumNodes(swigCPtr, this);
  }

  public int getNumArcs() {
    return operations_research_graphJNI.LinearSumAssignment_getNumArcs(swigCPtr, this);
  }

  public int getLeftNode(int arc) {
    return operations_research_graphJNI.LinearSumAssignment_getLeftNode(swigCPtr, this, arc);
  }

  public int getRightNode(int arc) {
    return operations_research_graphJNI.LinearSumAssignment_getRightNode(swigCPtr, this, arc);
  }

  public long getCost(int arc) {
    return operations_research_graphJNI.LinearSumAssignment_getCost(swigCPtr, this, arc);
  }

  public LinearSumAssignment.Status solve() {
    return LinearSumAssignment.Status.swigToEnum(operations_research_graphJNI.LinearSumAssignment_solve(swigCPtr, this));
  }

  public long getOptimalCost() {
    return operations_research_graphJNI.LinearSumAssignment_getOptimalCost(swigCPtr, this);
  }

  public int getRightMate(int left_node) {
    return operations_research_graphJNI.LinearSumAssignment_getRightMate(swigCPtr, this, left_node);
  }

  public long getAssignmentCost(int left_node) {
    return operations_research_graphJNI.LinearSumAssignment_getAssignmentCost(swigCPtr, this, left_node);
  }

  public final static class Status {
    public final static LinearSumAssignment.Status OPTIMAL = new LinearSumAssignment.Status("OPTIMAL");
    public final static LinearSumAssignment.Status INFEASIBLE = new LinearSumAssignment.Status("INFEASIBLE");
    public final static LinearSumAssignment.Status POSSIBLE_OVERFLOW = new LinearSumAssignment.Status("POSSIBLE_OVERFLOW");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static Status swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + Status.class + " with value " + swigValue);
    }

    private Status(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private Status(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private Status(String swigName, Status swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static Status[] swigValues = { OPTIMAL, INFEASIBLE, POSSIBLE_OVERFLOW };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy