heapnode.java

来自「用分支界限法解决的几个问题:包括0-1背包问题,最大团问题,电路布线问题,最大装」· Java 代码 · 共 41 行

JAVA
41
字号
/* * HeapNode.java * * Created on 2006年4月17日, 下午2:13 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package test;import java.lang.*;/** * * @author michael */public  class HeapNode  implements Comparable{        BBnode liveNode;    //活对结点        double upperProfit; //结点的价植上界        double profit;      //结点所相应的价值        double weight;   //结点所相应的重量        int level;       //活结点在子集树中所处的层序号                //构造方法        HeapNode(BBnode node,double up,double pp,double ww,int lev){            liveNode=node;            upperProfit=up;            profit=pp;            weight=ww;            level=lev;        }                public int compareTo(Object x){            double xup=((HeapNode)x).upperProfit;            if (upperProfit<xup) return -1;            if(upperProfit==xup) return 0;            return 1;        }    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?